@liorian/sdk 0.28.0-alpha.56010ca
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +483 -0
- package/package.json +94 -0
- package/schemas/module.schema.json +818 -0
- package/src/application/index.ts +3 -0
- package/src/application/module-instance.ts +36 -0
- package/src/application/service/auth-api-service.ts +291 -0
- package/src/application/service/auth-user.service.ts +108 -0
- package/src/application/service/index.ts +12 -0
- package/src/application/service/module-activation-api.service.ts +105 -0
- package/src/application/service/notifications-api-service.ts +38 -0
- package/src/application/service/notifications-push.service.ts +299 -0
- package/src/application/service/notifications-socket-service.ts +76 -0
- package/src/application/service/organizations-api-service.ts +104 -0
- package/src/application/service/otp-api-service.ts +11 -0
- package/src/application/service/storage-api-service.ts +77 -0
- package/src/application/service/storefront-api.service.ts +72 -0
- package/src/application/service/user-preferences-api.service.ts +57 -0
- package/src/domain/config/app.config.ts +35 -0
- package/src/domain/config/auth.config.ts +30 -0
- package/src/domain/config/index.ts +4 -0
- package/src/domain/config/logo.config.ts +17 -0
- package/src/domain/entities/activities.interface.ts +18 -0
- package/src/domain/entities/catalog.interface.ts +96 -0
- package/src/domain/entities/index.ts +13 -0
- package/src/domain/entities/media.ts +22 -0
- package/src/domain/entities/module-activation.interface.ts +173 -0
- package/src/domain/entities/module.interface.ts +101 -0
- package/src/domain/entities/notification.interface.ts +23 -0
- package/src/domain/entities/objectable.type.ts +3 -0
- package/src/domain/entities/organization.interface.ts +81 -0
- package/src/domain/entities/user-auth.interface.ts +17 -0
- package/src/domain/entities/user-phone.interface.ts +11 -0
- package/src/domain/entities/user-profile.interface.ts +23 -0
- package/src/domain/entities/user.interface.ts +79 -0
- package/src/domain/enums/coloring.enum.ts +6 -0
- package/src/domain/enums/domains.enum.ts +282 -0
- package/src/domain/enums/index.ts +8 -0
- package/src/domain/enums/module-category.enum.ts +57 -0
- package/src/domain/enums/module.enum.ts +97 -0
- package/src/domain/enums/routine.enum.ts +12 -0
- package/src/domain/enums/user-profile.enum.ts +25 -0
- package/src/domain/enums/user-status.enum.ts +7 -0
- package/src/domain/index.ts +6 -0
- package/src/domain/typing/auth-caches.ts +12 -0
- package/src/domain/typing/auth-oauth.types.ts +172 -0
- package/src/domain/typing/devise.ts +2 -0
- package/src/domain/typing/index.ts +10 -0
- package/src/domain/typing/response.ts +30 -0
- package/src/domain/typing/routine.types.ts +113 -0
- package/src/domain/typing/session.interface.ts +28 -0
- package/src/domain/typing/statisticals.ts +11 -0
- package/src/domain/typing/user-media-upload.ts +9 -0
- package/src/domain/typing/values.ts +6 -0
- package/src/index.tsx +168 -0
- package/src/infrastructure/capabilities/cache-storage/capability.ts +129 -0
- package/src/infrastructure/capabilities/cache-storage/enum.ts +5 -0
- package/src/infrastructure/capabilities/cache-storage/index.ts +4 -0
- package/src/infrastructure/capabilities/cache-storage/types.ts +13 -0
- package/src/infrastructure/capabilities/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/capability.ts +55 -0
- package/src/infrastructure/capabilities/stackable/index.ts +3 -0
- package/src/infrastructure/capabilities/stackable/types.ts +24 -0
- package/src/infrastructure/common-classname.constant.ts +4 -0
- package/src/infrastructure/data/countries.ts +208 -0
- package/src/infrastructure/data/gender.ts +5 -0
- package/src/infrastructure/data/index.ts +3 -0
- package/src/infrastructure/dataset/index.ts +3 -0
- package/src/infrastructure/dataset/sign-in.dataset.ts +21 -0
- package/src/infrastructure/dataset/sign-up.dataset.ts +64 -0
- package/src/infrastructure/hooks/index.ts +10 -0
- package/src/infrastructure/hooks/use-activity-lock-draft.ts +69 -0
- package/src/infrastructure/hooks/use-auth.ts +24 -0
- package/src/infrastructure/hooks/use-elastic-interaction.ts +180 -0
- package/src/infrastructure/hooks/use-is-desktop.ts +25 -0
- package/src/infrastructure/hooks/use-is-tauri.ts +17 -0
- package/src/infrastructure/hooks/use-mobile.ts +19 -0
- package/src/infrastructure/hooks/use-notifications.ts +128 -0
- package/src/infrastructure/hooks/use-recent-colors.ts +113 -0
- package/src/infrastructure/hooks/use-recent-modules.ts +76 -0
- package/src/infrastructure/index.tsx +11 -0
- package/src/infrastructure/library/design-system.ts +95 -0
- package/src/infrastructure/library/index.tsx +5 -0
- package/src/infrastructure/library/motion-utils.ts +77 -0
- package/src/infrastructure/library/motion.tsx +31 -0
- package/src/infrastructure/library/scroll-progress.tsx +93 -0
- package/src/infrastructure/providers/auth-guard.provider.tsx +47 -0
- package/src/infrastructure/providers/auth.provider.tsx +168 -0
- package/src/infrastructure/providers/index.tsx +8 -0
- package/src/infrastructure/providers/module-usage.provider.tsx +95 -0
- package/src/infrastructure/providers/modules-guard.provider.tsx +64 -0
- package/src/infrastructure/providers/modules-routines.provider.tsx +33 -0
- package/src/infrastructure/providers/modules-switcher.provider.tsx +25 -0
- package/src/infrastructure/providers/query.provider.tsx +27 -0
- package/src/infrastructure/routines/__tests__/routine.test.ts +368 -0
- package/src/infrastructure/routines/index.tsx +3 -0
- package/src/infrastructure/routines/routine.hook.ts +121 -0
- package/src/infrastructure/routines/routine.ts +283 -0
- package/src/infrastructure/routines/routine.tsx +283 -0
- package/src/infrastructure/stores/activity-lock.store.ts +22 -0
- package/src/infrastructure/stores/auth-user-connected.store.ts +24 -0
- package/src/infrastructure/stores/dataset.store.ts +106 -0
- package/src/infrastructure/stores/index.ts +6 -0
- package/src/infrastructure/stores/module.store.ts +266 -0
- package/src/infrastructure/stores/upload.store.ts +198 -0
- package/src/infrastructure/utilities/access-label.util.ts +158 -0
- package/src/infrastructure/utilities/activities.util.tsx +54 -0
- package/src/infrastructure/utilities/activity-lock.service.ts +263 -0
- package/src/infrastructure/utilities/activity-tracker.service.ts +205 -0
- package/src/infrastructure/utilities/api-service.ts +237 -0
- package/src/infrastructure/utilities/auth-logout.util.ts +23 -0
- package/src/infrastructure/utilities/classname.util.ts +7 -0
- package/src/infrastructure/utilities/encryption.service.ts +125 -0
- package/src/infrastructure/utilities/form-snapshot.service.ts +304 -0
- package/src/infrastructure/utilities/format.util.ts +40 -0
- package/src/infrastructure/utilities/index.tsx +23 -0
- package/src/infrastructure/utilities/media-label.service.ts +47 -0
- package/src/infrastructure/utilities/modules.ts +11 -0
- package/src/infrastructure/utilities/permission.util.ts +22 -0
- package/src/infrastructure/utilities/push-permission.util.ts +43 -0
- package/src/infrastructure/utilities/route-access.ts +38 -0
- package/src/infrastructure/utilities/socket-service.ts +123 -0
- package/src/infrastructure/utilities/sso-auth.util.ts +188 -0
- package/src/infrastructure/utilities/stringable.util.ts +16 -0
- package/src/infrastructure/utilities/strings.util.ts +18 -0
- package/src/infrastructure/utilities/tauri.util.ts +15 -0
- package/src/infrastructure/utilities/utils.ts +6 -0
- package/src/infrastructure/utilities/values.ts +5 -0
- package/src/presentation/8starlabs-ui/button.tsx +94 -0
- package/src/presentation/8starlabs-ui/flip-clock.tsx +368 -0
- package/src/presentation/8starlabs-ui/heatmap.tsx +430 -0
- package/src/presentation/8starlabs-ui/hooks/index.tsx +2 -0
- package/src/presentation/8starlabs-ui/hooks/use-mobile.ts +21 -0
- package/src/presentation/8starlabs-ui/index.tsx +20 -0
- package/src/presentation/8starlabs-ui/json-viewer.tsx +972 -0
- package/src/presentation/8starlabs-ui/marquee.tsx +134 -0
- package/src/presentation/8starlabs-ui/partition-bar.tsx +198 -0
- package/src/presentation/8starlabs-ui/scroll-fade.tsx +158 -0
- package/src/presentation/8starlabs-ui/status-indicator.tsx +86 -0
- package/src/presentation/8starlabs-ui/system-banner.tsx +50 -0
- package/src/presentation/8starlabs-ui/timeline.tsx +576 -0
- package/src/presentation/8starlabs-ui/transport-badge.tsx +249 -0
- package/src/presentation/8starlabs-ui/ui/copy-button.tsx +60 -0
- package/src/presentation/8starlabs-ui/ui/index.tsx +2 -0
- package/src/presentation/analytics-section.tsx +85 -0
- package/src/presentation/app-sidebar.tsx +234 -0
- package/src/presentation/charts/area-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/area-widget.chart.tsx +128 -0
- package/src/presentation/charts/chart-widgets.types.ts +81 -0
- package/src/presentation/charts/index.tsx +16 -0
- package/src/presentation/charts/line-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/line-widget.chart.tsx +105 -0
- package/src/presentation/charts/pie-widget.chart-skeleton.tsx +56 -0
- package/src/presentation/charts/pie-widget.chart.tsx +168 -0
- package/src/presentation/charts/radar-widget.chart-skeleton.tsx +67 -0
- package/src/presentation/charts/radar-widget.chart.tsx +80 -0
- package/src/presentation/charts/radial-stacked-widget.chart-skeleton.tsx +66 -0
- package/src/presentation/charts/radial-stacked-widget.chart.tsx +120 -0
- package/src/presentation/charts/radial-widget.chart-skeleton.tsx +61 -0
- package/src/presentation/charts/radial-widget.chart.tsx +87 -0
- package/src/presentation/charts/tooltip-widget.chart-skeleton.tsx +64 -0
- package/src/presentation/charts/tooltip-widget.chart.tsx +89 -0
- package/src/presentation/components/activity-actions.tsx +20 -0
- package/src/presentation/components/activity-container.tsx +55 -0
- package/src/presentation/components/activity-content.tsx +20 -0
- package/src/presentation/components/activity-descriptor-parser.tsx +37 -0
- package/src/presentation/components/activity-header.tsx +20 -0
- package/src/presentation/components/activity-loader.tsx +19 -0
- package/src/presentation/components/activity-title.tsx +32 -0
- package/src/presentation/components/activity.tsx +22 -0
- package/src/presentation/components/auth/index.tsx +4 -0
- package/src/presentation/components/auth/sso-callback.view.tsx +44 -0
- package/src/presentation/components/auth/sso-disconnect.view.tsx +41 -0
- package/src/presentation/components/auth/sso-sign-in.view.tsx +29 -0
- package/src/presentation/components/auth-lock-screen.tsx +309 -0
- package/src/presentation/components/auth-session.view.tsx +17 -0
- package/src/presentation/components/data-table.tsx +814 -0
- package/src/presentation/components/dynamic-icon.tsx +16 -0
- package/src/presentation/components/floating-upload.tsx +291 -0
- package/src/presentation/components/index.tsx +40 -0
- package/src/presentation/components/local-time.tsx +170 -0
- package/src/presentation/components/markdown-parser.tsx +201 -0
- package/src/presentation/components/message-scroller.tsx +131 -0
- package/src/presentation/components/module-first-access-config.view.tsx +181 -0
- package/src/presentation/components/module-first-access-pending.view.tsx +38 -0
- package/src/presentation/components/module-guard.tsx +34 -0
- package/src/presentation/components/modules-first-access.guard.tsx +88 -0
- package/src/presentation/components/modules-guard-forbidden.tsx +46 -0
- package/src/presentation/components/notification-details.modal.tsx +145 -0
- package/src/presentation/components/notification-item.tsx +127 -0
- package/src/presentation/components/notifications-popover.tsx +128 -0
- package/src/presentation/components/push-notifications.provider.tsx +65 -0
- package/src/presentation/components/upload-progress-dialog.tsx +140 -0
- package/src/presentation/components/waiting-bar.tsx +22 -0
- package/src/presentation/components/waiting-section.tsx +15 -0
- package/src/presentation/components/waiting.tsx +14 -0
- package/src/presentation/data-grid/data-grid-empty.tsx +24 -0
- package/src/presentation/data-grid/data-grid-search-engine.tsx +32 -0
- package/src/presentation/data-grid/data-grid.tsx +892 -0
- package/src/presentation/data-grid/index.tsx +4 -0
- package/src/presentation/form-screen.tsx +95 -0
- package/src/presentation/icons/custom.tsx +20 -0
- package/src/presentation/icons/glyphIcons.tsx +53 -0
- package/src/presentation/icons/icons.enum.ts +4 -0
- package/src/presentation/icons/icons.util.ts +6 -0
- package/src/presentation/icons/index.tsx +8 -0
- package/src/presentation/icons/lucide.tsx +17 -0
- package/src/presentation/icons/remix.tsx +33 -0
- package/src/presentation/icons/types.ts +27 -0
- package/src/presentation/index.tsx +45 -0
- package/src/presentation/modals/components/ModalBox.tsx +74 -0
- package/src/presentation/modals/components/ModalPortal.tsx +31 -0
- package/src/presentation/modals/components/ModalStepper.tsx +319 -0
- package/src/presentation/modals/components/ModalWrapper.tsx +65 -0
- package/src/presentation/modals/components/index.tsx +5 -0
- package/src/presentation/modals/hooks/index.ts +2 -0
- package/src/presentation/modals/hooks/useModal.ts +38 -0
- package/src/presentation/modals/index.tsx +5 -0
- package/src/presentation/modals/stores/index.ts +2 -0
- package/src/presentation/modals/stores/useModalStore.ts +90 -0
- package/src/presentation/modals/types/index.ts +2 -0
- package/src/presentation/modals/types/modal.type.ts +33 -0
- package/src/presentation/module-menubar.tsx +300 -0
- package/src/presentation/module-widget.tsx +233 -0
- package/src/presentation/nav-documents.tsx +89 -0
- package/src/presentation/nav-main.tsx +62 -0
- package/src/presentation/nav-secondary.tsx +41 -0
- package/src/presentation/nav-user.tsx +109 -0
- package/src/presentation/permission-action-badge.tsx +35 -0
- package/src/presentation/reui/index.tsx +3 -0
- package/src/presentation/reui/stepper.tsx +508 -0
- package/src/presentation/reui/timeline.tsx +226 -0
- package/src/presentation/sheets/index.tsx +2 -0
- package/src/presentation/sheets/legacy-sheet-header.tsx +0 -0
- package/src/presentation/sheets/legacy-sheet.tsx +37 -0
- package/src/presentation/size.enum.ts +19 -0
- package/src/presentation/system/index.tsx +3 -0
- package/src/presentation/system/logo.theme.tsx +21 -0
- package/src/presentation/system/types.ts +10 -0
- package/src/presentation/theme/index.tsx +6 -0
- package/src/presentation/theme/prefer-color-scheme.tsx +50 -0
- package/src/presentation/theme/switch-color-scheme.tsx +16 -0
- package/src/presentation/theme/theme-switcher-button.tsx +20 -0
- package/src/presentation/theme/theme.enum.ts +4 -0
- package/src/presentation/theme/theme.store.ts +87 -0
- package/src/presentation/themes/index.tsx +2 -0
- package/src/presentation/themes/katon/dashboard-layout.tsx +1080 -0
- package/src/presentation/themes/katon/edge-section.tsx +19 -0
- package/src/presentation/themes/katon/header-menubar.tsx +270 -0
- package/src/presentation/themes/katon/header-modules-available.tsx +44 -0
- package/src/presentation/themes/katon/header-modules-recents.tsx +52 -0
- package/src/presentation/themes/katon/header-modules-store.tsx +25 -0
- package/src/presentation/themes/katon/header-options.tsx +13 -0
- package/src/presentation/themes/katon/header-organization-select.tsx +146 -0
- package/src/presentation/themes/katon/header-routines.tsx +74 -0
- package/src/presentation/themes/katon/header-tasks-connected-user.tsx +150 -0
- package/src/presentation/themes/katon/index.tsx +16 -0
- package/src/presentation/themes/katon/main-wrapper.tsx +34 -0
- package/src/presentation/themes/katon/module-item-link.tsx +32 -0
- package/src/presentation/themes/katon/view-frame.tsx +25 -0
- package/src/presentation/themes/katon/view-helmet.tsx +53 -0
- package/src/presentation/themes/katon/view-status.tsx +32 -0
- package/src/presentation/themes/katon/view-wrapper.tsx +15 -0
- package/src/presentation/themes/katon/view.tsx +42 -0
- package/src/presentation/ui/accordion-multiselect.tsx +206 -0
- package/src/presentation/ui/accordion.tsx +81 -0
- package/src/presentation/ui/alert-dialog.tsx +199 -0
- package/src/presentation/ui/alert.tsx +76 -0
- package/src/presentation/ui/aspect-ratio.tsx +11 -0
- package/src/presentation/ui/attachment.tsx +204 -0
- package/src/presentation/ui/avatar.tsx +112 -0
- package/src/presentation/ui/badge.tsx +49 -0
- package/src/presentation/ui/breadcrumb.tsx +122 -0
- package/src/presentation/ui/bubble.tsx +125 -0
- package/src/presentation/ui/button-group.tsx +83 -0
- package/src/presentation/ui/button.tsx +87 -0
- package/src/presentation/ui/calendar.tsx +222 -0
- package/src/presentation/ui/card.tsx +106 -0
- package/src/presentation/ui/carousel.tsx +242 -0
- package/src/presentation/ui/chart.tsx +373 -0
- package/src/presentation/ui/checkbox.tsx +33 -0
- package/src/presentation/ui/clickable.tsx +58 -0
- package/src/presentation/ui/collapsible.tsx +33 -0
- package/src/presentation/ui/color-swatch-selector.tsx +81 -0
- package/src/presentation/ui/combobox.tsx +299 -0
- package/src/presentation/ui/command.tsx +195 -0
- package/src/presentation/ui/context-menu.tsx +263 -0
- package/src/presentation/ui/dialog.tsx +168 -0
- package/src/presentation/ui/direction.tsx +22 -0
- package/src/presentation/ui/drawer.tsx +134 -0
- package/src/presentation/ui/dropdown-menu.tsx +269 -0
- package/src/presentation/ui/empty.tsx +104 -0
- package/src/presentation/ui/field.tsx +238 -0
- package/src/presentation/ui/granularity-selector.tsx +58 -0
- package/src/presentation/ui/hover-card.tsx +44 -0
- package/src/presentation/ui/index.tsx +74 -0
- package/src/presentation/ui/input-group.tsx +156 -0
- package/src/presentation/ui/input-otp.tsx +87 -0
- package/src/presentation/ui/input.tsx +19 -0
- package/src/presentation/ui/item.tsx +196 -0
- package/src/presentation/ui/kpi-card.tsx +203 -0
- package/src/presentation/ui/label-selector.tsx +100 -0
- package/src/presentation/ui/label.tsx +24 -0
- package/src/presentation/ui/legacy-birth-date-input.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/index.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.content.tsx +37 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.context.tsx +42 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.hex-input.tsx +97 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.picker.tsx +266 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.presets.ts +22 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.quick-list.tsx +49 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.recent.tsx +43 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.swatches.tsx +111 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.trigger.tsx +128 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.tsx +110 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.types.ts +1 -0
- package/src/presentation/ui/legacy-color-picker/legacy-color-picker.utils.ts +114 -0
- package/src/presentation/ui/legacy-country-input.tsx +171 -0
- package/src/presentation/ui/legacy-gender-input.tsx +22 -0
- package/src/presentation/ui/legacy-input.tsx +106 -0
- package/src/presentation/ui/legacy-phone-input.tsx +213 -0
- package/src/presentation/ui/legacy-select-input.tsx +114 -0
- package/src/presentation/ui/legacy-text-area.tsx +111 -0
- package/src/presentation/ui/list-items.tsx +59 -0
- package/src/presentation/ui/marker.tsx +69 -0
- package/src/presentation/ui/media-player/index.tsx +12 -0
- package/src/presentation/ui/media-player/media-player.context.tsx +36 -0
- package/src/presentation/ui/media-player/media-player.tsx +167 -0
- package/src/presentation/ui/media-player/player-controls.tsx +207 -0
- package/src/presentation/ui/media-player/players/audio-player.tsx +78 -0
- package/src/presentation/ui/media-player/players/index.tsx +4 -0
- package/src/presentation/ui/media-player/players/video-player.tsx +193 -0
- package/src/presentation/ui/media-player/players/voice-note-player.tsx +108 -0
- package/src/presentation/ui/media-player/use-media-player.hook.ts +263 -0
- package/src/presentation/ui/menubar.tsx +281 -0
- package/src/presentation/ui/message.tsx +92 -0
- package/src/presentation/ui/navigation-menu.tsx +172 -0
- package/src/presentation/ui/pagination.tsx +129 -0
- package/src/presentation/ui/popover.tsx +89 -0
- package/src/presentation/ui/progress.tsx +31 -0
- package/src/presentation/ui/resizable.tsx +50 -0
- package/src/presentation/ui/select.tsx +192 -0
- package/src/presentation/ui/separator.tsx +28 -0
- package/src/presentation/ui/sheet.tsx +147 -0
- package/src/presentation/ui/sidebar.tsx +702 -0
- package/src/presentation/ui/skeleton.tsx +13 -0
- package/src/presentation/ui/slide-to-confirm.tsx +129 -0
- package/src/presentation/ui/slider.tsx +59 -0
- package/src/presentation/ui/sonner.tsx +58 -0
- package/src/presentation/ui/switch.tsx +33 -0
- package/src/presentation/ui/table.tsx +116 -0
- package/src/presentation/ui/tabs.tsx +90 -0
- package/src/presentation/ui/text-gradient.tsx +84 -0
- package/src/presentation/ui/textarea.tsx +18 -0
- package/src/presentation/ui/timeline-steps.tsx +235 -0
- package/src/presentation/ui/toggle-group.tsx +89 -0
- package/src/presentation/ui/toggle.tsx +47 -0
- package/src/presentation/ui/tooltip.tsx +57 -0
- package/src/presentation/uploading/index.tsx +3 -0
- package/src/presentation/uploading/media-upload-field.tsx +152 -0
- package/src/presentation/uploading/storage-media.tsx +210 -0
- package/src/styles.css +403 -0
- package/src/themes.css +1038 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import * as React from "react"
|
|
4
|
+
import { useCallback, useRef } from "react"
|
|
5
|
+
import gsap from "gsap"
|
|
6
|
+
|
|
7
|
+
export interface ElasticInteractionOptions {
|
|
8
|
+
/**
|
|
9
|
+
* Scale applied while the element is pressed.
|
|
10
|
+
* @default 0.97
|
|
11
|
+
*/
|
|
12
|
+
pressScale?: number
|
|
13
|
+
/**
|
|
14
|
+
* Scale applied while the element is focused.
|
|
15
|
+
* @default 1.02
|
|
16
|
+
*/
|
|
17
|
+
focusScale?: number
|
|
18
|
+
/**
|
|
19
|
+
* Scale applied while the element is hovered. When omitted, no hover
|
|
20
|
+
* animation is attached.
|
|
21
|
+
*/
|
|
22
|
+
hoverScale?: number
|
|
23
|
+
/**
|
|
24
|
+
* Vertical offset (in px) applied while pressed, for a tactile "press down" feel.
|
|
25
|
+
* @default 0
|
|
26
|
+
*/
|
|
27
|
+
pressY?: number
|
|
28
|
+
/**
|
|
29
|
+
* Duration of the press-down tween (seconds).
|
|
30
|
+
* @default 0.08
|
|
31
|
+
*/
|
|
32
|
+
pressDuration?: number
|
|
33
|
+
/**
|
|
34
|
+
* Duration of the elastic settle tween (seconds).
|
|
35
|
+
* @default 0.6
|
|
36
|
+
*/
|
|
37
|
+
duration?: number
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function chainHandlers(
|
|
41
|
+
...handlers: Array<((...args: any[]) => void) | undefined | null>
|
|
42
|
+
): (...args: any[]) => void {
|
|
43
|
+
return (...args: any[]) => {
|
|
44
|
+
for (const handler of handlers) {
|
|
45
|
+
if (handler) handler(...args)
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Adds organic, elastic scale transitions to an element in response to
|
|
52
|
+
* click/press and focus/blur. Handlers target `event.currentTarget`, so they
|
|
53
|
+
* can be attached directly to the element that should animate (no ref needed).
|
|
54
|
+
*/
|
|
55
|
+
export function useElasticInteraction({
|
|
56
|
+
pressScale = 0.97,
|
|
57
|
+
focusScale = 1.02,
|
|
58
|
+
hoverScale,
|
|
59
|
+
pressY = 0,
|
|
60
|
+
pressDuration = 0.08,
|
|
61
|
+
duration = 0.6,
|
|
62
|
+
}: ElasticInteractionOptions = {}) {
|
|
63
|
+
const pressedRef = useRef(false)
|
|
64
|
+
const focusedRef = useRef(false)
|
|
65
|
+
const hoveredRef = useRef(false)
|
|
66
|
+
|
|
67
|
+
const animate = useCallback((el: Element, vars: gsap.TweenVars) => {
|
|
68
|
+
gsap.to(el, { ...vars, overwrite: "auto" })
|
|
69
|
+
}, [])
|
|
70
|
+
|
|
71
|
+
const settle = useCallback(
|
|
72
|
+
(el: Element) => {
|
|
73
|
+
const target = pressedRef.current
|
|
74
|
+
? pressScale
|
|
75
|
+
: hoveredRef.current && hoverScale !== undefined
|
|
76
|
+
? hoverScale
|
|
77
|
+
: focusedRef.current
|
|
78
|
+
? focusScale
|
|
79
|
+
: 1
|
|
80
|
+
animate(el, {
|
|
81
|
+
scale: target,
|
|
82
|
+
y: 0,
|
|
83
|
+
duration,
|
|
84
|
+
ease: "elastic.out(1, 0.4)",
|
|
85
|
+
})
|
|
86
|
+
},
|
|
87
|
+
[animate, duration, pressScale, focusScale, hoverScale]
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
const onPointerDown = useCallback(
|
|
91
|
+
(event: React.PointerEvent<HTMLElement>) => {
|
|
92
|
+
pressedRef.current = true
|
|
93
|
+
animate(event.currentTarget, {
|
|
94
|
+
scale: pressScale,
|
|
95
|
+
y: pressY,
|
|
96
|
+
duration: pressDuration,
|
|
97
|
+
ease: "power2.out",
|
|
98
|
+
})
|
|
99
|
+
},
|
|
100
|
+
[animate, pressScale, pressY, pressDuration]
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
const onPointerUp = useCallback(
|
|
104
|
+
(event: React.PointerEvent<HTMLElement>) => {
|
|
105
|
+
pressedRef.current = false
|
|
106
|
+
settle(event.currentTarget)
|
|
107
|
+
},
|
|
108
|
+
[settle]
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
const onPointerCancel = useCallback(
|
|
112
|
+
(event: React.PointerEvent<HTMLElement>) => {
|
|
113
|
+
pressedRef.current = false
|
|
114
|
+
settle(event.currentTarget)
|
|
115
|
+
},
|
|
116
|
+
[settle]
|
|
117
|
+
)
|
|
118
|
+
|
|
119
|
+
const onPointerLeave = useCallback(
|
|
120
|
+
(event: React.PointerEvent<HTMLElement>) => {
|
|
121
|
+
if (!pressedRef.current) return
|
|
122
|
+
pressedRef.current = false
|
|
123
|
+
settle(event.currentTarget)
|
|
124
|
+
},
|
|
125
|
+
[settle]
|
|
126
|
+
)
|
|
127
|
+
|
|
128
|
+
const onFocus = useCallback(
|
|
129
|
+
(event: React.FocusEvent<HTMLElement>) => {
|
|
130
|
+
focusedRef.current = true
|
|
131
|
+
animate(event.currentTarget, {
|
|
132
|
+
scale: focusScale,
|
|
133
|
+
duration: 0.4,
|
|
134
|
+
ease: "elastic.out(1, 0.5)",
|
|
135
|
+
})
|
|
136
|
+
},
|
|
137
|
+
[animate, focusScale]
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
const onBlur = useCallback(
|
|
141
|
+
(event: React.FocusEvent<HTMLElement>) => {
|
|
142
|
+
focusedRef.current = false
|
|
143
|
+
settle(event.currentTarget)
|
|
144
|
+
},
|
|
145
|
+
[settle]
|
|
146
|
+
)
|
|
147
|
+
|
|
148
|
+
const onMouseEnter = useCallback(
|
|
149
|
+
(event: React.MouseEvent<HTMLElement>) => {
|
|
150
|
+
if (hoverScale === undefined) return
|
|
151
|
+
hoveredRef.current = true
|
|
152
|
+
animate(event.currentTarget, {
|
|
153
|
+
scale: hoverScale,
|
|
154
|
+
duration: 0.5,
|
|
155
|
+
ease: "elastic.out(1, 0.6)",
|
|
156
|
+
})
|
|
157
|
+
},
|
|
158
|
+
[animate, hoverScale]
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
const onMouseLeave = useCallback(
|
|
162
|
+
(event: React.MouseEvent<HTMLElement>) => {
|
|
163
|
+
if (hoverScale === undefined) return
|
|
164
|
+
hoveredRef.current = false
|
|
165
|
+
settle(event.currentTarget)
|
|
166
|
+
},
|
|
167
|
+
[settle, hoverScale]
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
return {
|
|
171
|
+
onPointerDown,
|
|
172
|
+
onPointerUp,
|
|
173
|
+
onPointerCancel,
|
|
174
|
+
onPointerLeave,
|
|
175
|
+
onFocus,
|
|
176
|
+
onBlur,
|
|
177
|
+
onMouseEnter,
|
|
178
|
+
onMouseLeave,
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
|
|
5
|
+
export const DESKTOP_BREAKPOINT = 768;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Hook to determine if the current viewport corresponds to a desktop screen (width >= breakpoint).
|
|
9
|
+
* Defaults to 768px (md breakpoint).
|
|
10
|
+
*/
|
|
11
|
+
export function useIsDesktop(breakpoint: number = DESKTOP_BREAKPOINT): boolean {
|
|
12
|
+
const [isDesktop, setIsDesktop] = React.useState<boolean>(false);
|
|
13
|
+
|
|
14
|
+
React.useEffect(() => {
|
|
15
|
+
const mql = window.matchMedia(`(min-width: ${breakpoint}px)`);
|
|
16
|
+
const onChange = () => {
|
|
17
|
+
setIsDesktop(mql.matches);
|
|
18
|
+
};
|
|
19
|
+
mql.addEventListener("change", onChange);
|
|
20
|
+
setIsDesktop(mql.matches);
|
|
21
|
+
return () => mql.removeEventListener("change", onChange);
|
|
22
|
+
}, [breakpoint]);
|
|
23
|
+
|
|
24
|
+
return isDesktop;
|
|
25
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { isTauri } from "../utilities/tauri.util";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hook to determine if the application is running inside Tauri.
|
|
8
|
+
*/
|
|
9
|
+
export function useIsTauri(): boolean {
|
|
10
|
+
const [inTauri, setInTauri] = React.useState<boolean>(false);
|
|
11
|
+
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
setInTauri(isTauri());
|
|
14
|
+
}, []);
|
|
15
|
+
|
|
16
|
+
return inTauri;
|
|
17
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import * as React from "react"
|
|
2
|
+
|
|
3
|
+
const MOBILE_BREAKPOINT = 768
|
|
4
|
+
|
|
5
|
+
export function useIsMobile() {
|
|
6
|
+
const [isMobile, setIsMobile] = React.useState<boolean | undefined>(undefined)
|
|
7
|
+
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`)
|
|
10
|
+
const onChange = () => {
|
|
11
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
12
|
+
}
|
|
13
|
+
mql.addEventListener("change", onChange)
|
|
14
|
+
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT)
|
|
15
|
+
return () => mql.removeEventListener("change", onChange)
|
|
16
|
+
}, [])
|
|
17
|
+
|
|
18
|
+
return !!isMobile
|
|
19
|
+
}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import {useState} from "react";
|
|
4
|
+
import {useQuery} from "@tanstack/react-query";
|
|
5
|
+
import {PaginationState} from "@tanstack/react-table";
|
|
6
|
+
import {AppConfig} from "../../domain/config/app.config";
|
|
7
|
+
import {FetchResponseMetaProps} from "../../domain/typing/response";
|
|
8
|
+
import {NotificationsApiService} from "../../application/service/notifications-api-service";
|
|
9
|
+
import {NotificationsSocketService} from "../../application/service/notifications-socket-service";
|
|
10
|
+
import {NotificationInterface} from "../../domain/entities/notification.interface";
|
|
11
|
+
import {useAuth} from "./use-auth";
|
|
12
|
+
|
|
13
|
+
export type NotificationCategory = "user" | "organization";
|
|
14
|
+
|
|
15
|
+
export interface NotificationsQuery {
|
|
16
|
+
data: NotificationInterface[];
|
|
17
|
+
meta: FetchResponseMetaProps;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface UseNotificationsOptions {
|
|
21
|
+
limit?: number;
|
|
22
|
+
enabled?: boolean;
|
|
23
|
+
manualPagination?: boolean;
|
|
24
|
+
read?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface UseNotificationsResult extends NotificationsQuery {
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
isFetching: boolean;
|
|
30
|
+
isError: boolean;
|
|
31
|
+
pageCount: number;
|
|
32
|
+
pagination: PaginationState;
|
|
33
|
+
setPagination: (pagination: PaginationState) => void;
|
|
34
|
+
refetch: () => void;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function normalizeResponse(payload: any): NotificationsQuery {
|
|
38
|
+
const empty: NotificationsQuery = {data: [], meta: {}};
|
|
39
|
+
|
|
40
|
+
if (!payload) return empty;
|
|
41
|
+
|
|
42
|
+
if (Array.isArray(payload)) {
|
|
43
|
+
return {data: payload, meta: {}};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (Array.isArray(payload.data)) {
|
|
47
|
+
return {data: payload.data, meta: payload.meta || {}};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if (Array.isArray(payload.items)) {
|
|
51
|
+
return {
|
|
52
|
+
data: payload.items,
|
|
53
|
+
meta: {
|
|
54
|
+
total: payload.total,
|
|
55
|
+
page: payload.page,
|
|
56
|
+
limit: payload.limit,
|
|
57
|
+
totalPages: payload.totalPages,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (Array.isArray(payload.notifications)) {
|
|
63
|
+
return {
|
|
64
|
+
data: payload.notifications,
|
|
65
|
+
meta: {
|
|
66
|
+
total: payload.total,
|
|
67
|
+
page: payload.page,
|
|
68
|
+
limit: payload.limit,
|
|
69
|
+
totalPages: payload.totalPages,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return empty;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function useNotifications(
|
|
78
|
+
category: NotificationCategory,
|
|
79
|
+
options: UseNotificationsOptions = {}
|
|
80
|
+
): UseNotificationsResult {
|
|
81
|
+
const {currentOrganization} = useAuth();
|
|
82
|
+
const {limit = 10, enabled = true, manualPagination = true} = options;
|
|
83
|
+
const [pagination, setPagination] = useState<PaginationState>({
|
|
84
|
+
pageIndex: 0,
|
|
85
|
+
pageSize: limit,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
const query = useQuery<NotificationsQuery>({
|
|
90
|
+
queryKey: ['notifications', category, pagination.pageIndex, pagination.pageSize, options.read],
|
|
91
|
+
enabled,
|
|
92
|
+
queryFn: async () => {
|
|
93
|
+
const page = manualPagination ? pagination.pageIndex + 1 : 1;
|
|
94
|
+
const pageSize = manualPagination ? pagination.pageSize : limit;
|
|
95
|
+
const params = {page, limit: pageSize, read: options.read}
|
|
96
|
+
|
|
97
|
+
const payload = category === "user"
|
|
98
|
+
? await NotificationsApiService.getAll(params)
|
|
99
|
+
: (
|
|
100
|
+
currentOrganization?.id
|
|
101
|
+
? await NotificationsApiService.getAllByOrganization(currentOrganization.id, params)
|
|
102
|
+
: null
|
|
103
|
+
)
|
|
104
|
+
;
|
|
105
|
+
|
|
106
|
+
const body = category === "user" ? payload?.data : payload;
|
|
107
|
+
return normalizeResponse(body);
|
|
108
|
+
},
|
|
109
|
+
refetchInterval: AppConfig.APP_REFRESH_UI,
|
|
110
|
+
refetchOnWindowFocus: false,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
const pageCount = query.data?.meta?.total && query.data?.meta?.limit
|
|
114
|
+
? Math.ceil(query.data.meta.total / query.data.meta.limit)
|
|
115
|
+
: 0;
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
data: query.data?.data ?? [],
|
|
119
|
+
meta: query.data?.meta ?? {},
|
|
120
|
+
isLoading: query.isLoading,
|
|
121
|
+
isFetching: query.isFetching,
|
|
122
|
+
isError: query.isError,
|
|
123
|
+
pageCount,
|
|
124
|
+
pagination,
|
|
125
|
+
setPagination,
|
|
126
|
+
refetch: query.refetch,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useCallback, useEffect, useRef, useState } from "react"
|
|
4
|
+
|
|
5
|
+
import { UserPreferencesApiService } from "../../application/service/user-preferences-api.service"
|
|
6
|
+
import { useAuth } from "./use-auth"
|
|
7
|
+
|
|
8
|
+
const STORAGE_KEY = "liorian-workspace:recent-colors"
|
|
9
|
+
const API_LABEL = "recent-colors"
|
|
10
|
+
const MAX_RECENT_COLORS = 10
|
|
11
|
+
const SYNC_DEBOUNCE_MS = 500
|
|
12
|
+
const COLOR_REGEX = /^#([0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/
|
|
13
|
+
|
|
14
|
+
function parseColors(value: unknown): string[] {
|
|
15
|
+
if (!Array.isArray(value)) return []
|
|
16
|
+
return value
|
|
17
|
+
.filter((color): color is string => typeof color === "string" && COLOR_REGEX.test(color))
|
|
18
|
+
.slice(0, MAX_RECENT_COLORS)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
function loadFromStorage(): string[] {
|
|
22
|
+
if (typeof window === "undefined") return []
|
|
23
|
+
try {
|
|
24
|
+
return parseColors(JSON.parse(window.localStorage.getItem(STORAGE_KEY) ?? "[]"))
|
|
25
|
+
} catch {
|
|
26
|
+
return []
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function saveToStorage(colors: string[]) {
|
|
31
|
+
if (typeof window === "undefined") return
|
|
32
|
+
try {
|
|
33
|
+
window.localStorage.setItem(STORAGE_KEY, JSON.stringify(colors))
|
|
34
|
+
} catch {
|
|
35
|
+
// Stockage indisponible (navigation privée, quota...) : on ignore.
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface UseRecentColorsOptions {
|
|
40
|
+
enabled?: boolean
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export function useRecentColors(options: UseRecentColorsOptions = {}) {
|
|
44
|
+
const { enabled = true } = options
|
|
45
|
+
const { user } = useAuth()
|
|
46
|
+
const userId = user?.id
|
|
47
|
+
const [recentColors, setRecentColors] = useState<string[]>(loadFromStorage)
|
|
48
|
+
const syncTimer = useRef<ReturnType<typeof setTimeout> | null>(null)
|
|
49
|
+
const latestColors = useRef(recentColors)
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
latestColors.current = recentColors
|
|
53
|
+
}, [recentColors])
|
|
54
|
+
|
|
55
|
+
useEffect(() => {
|
|
56
|
+
if (!enabled || !userId) return
|
|
57
|
+
|
|
58
|
+
let cancelled = false
|
|
59
|
+
UserPreferencesApiService.getRecentColors(userId)
|
|
60
|
+
.then((serverColors) => {
|
|
61
|
+
if (cancelled || serverColors.length === 0) return
|
|
62
|
+
setRecentColors((current) => {
|
|
63
|
+
const merged = [...serverColors, ...current.filter((color) => !serverColors.includes(color))]
|
|
64
|
+
const next = merged.slice(0, MAX_RECENT_COLORS)
|
|
65
|
+
saveToStorage(next)
|
|
66
|
+
return next
|
|
67
|
+
})
|
|
68
|
+
})
|
|
69
|
+
.catch(() => {})
|
|
70
|
+
return () => {
|
|
71
|
+
cancelled = true
|
|
72
|
+
}
|
|
73
|
+
}, [enabled, userId])
|
|
74
|
+
|
|
75
|
+
const addRecentColor = useCallback(
|
|
76
|
+
(color: string) => {
|
|
77
|
+
if (!COLOR_REGEX.test(color)) return
|
|
78
|
+
const normalized = color.toLowerCase()
|
|
79
|
+
|
|
80
|
+
setRecentColors((current) => {
|
|
81
|
+
const next = [normalized, ...current.filter((c) => c !== normalized)].slice(0, MAX_RECENT_COLORS)
|
|
82
|
+
saveToStorage(next)
|
|
83
|
+
return next
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
if (syncTimer.current !== null) {
|
|
87
|
+
clearTimeout(syncTimer.current)
|
|
88
|
+
}
|
|
89
|
+
if (!userId) return
|
|
90
|
+
|
|
91
|
+
syncTimer.current = setTimeout(() => {
|
|
92
|
+
UserPreferencesApiService.addRecentColor(userId, normalized)
|
|
93
|
+
.then((serverColors) => {
|
|
94
|
+
if (serverColors.length === 0) return
|
|
95
|
+
setRecentColors(serverColors)
|
|
96
|
+
})
|
|
97
|
+
.catch(() => {})
|
|
98
|
+
}, SYNC_DEBOUNCE_MS)
|
|
99
|
+
},
|
|
100
|
+
[userId]
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
useEffect(
|
|
104
|
+
() => () => {
|
|
105
|
+
if (syncTimer.current !== null) {
|
|
106
|
+
clearTimeout(syncTimer.current)
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
[]
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return { recentColors, addRecentColor }
|
|
113
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use client"
|
|
2
|
+
|
|
3
|
+
import { useEffect, useState } from "react"
|
|
4
|
+
import { usePathname } from "next/navigation"
|
|
5
|
+
import { ModuleDeclarationInterface, ModuleNavigationInterface } from "../../domain/entities/module.interface"
|
|
6
|
+
import { useModuleStore } from "../stores/module.store"
|
|
7
|
+
|
|
8
|
+
const STORAGE_KEY = "recent-modules"
|
|
9
|
+
const MAX_RECENT = 5
|
|
10
|
+
|
|
11
|
+
function loadIds(): string[] {
|
|
12
|
+
if (typeof window === "undefined") return []
|
|
13
|
+
try {
|
|
14
|
+
return JSON.parse(localStorage.getItem(STORAGE_KEY) || "[]")
|
|
15
|
+
} catch {
|
|
16
|
+
return []
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function saveIds(ids: string[]) {
|
|
21
|
+
if (typeof window === "undefined") return
|
|
22
|
+
localStorage.setItem(STORAGE_KEY, JSON.stringify(ids))
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function moduleToNavItem(mod: ModuleDeclarationInterface): ModuleNavigationInterface {
|
|
26
|
+
return {
|
|
27
|
+
id: mod.identifier,
|
|
28
|
+
label: mod.name,
|
|
29
|
+
icon: mod.icon,
|
|
30
|
+
url: mod.uri,
|
|
31
|
+
useOnlyIcon: true,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function useRecentModules(): ModuleNavigationInterface[] {
|
|
36
|
+
const pathname = usePathname()
|
|
37
|
+
const modules = useModuleStore(s => s.modules)
|
|
38
|
+
const [recent, setRecent] = useState<ModuleNavigationInterface[]>([])
|
|
39
|
+
|
|
40
|
+
useEffect(() => {
|
|
41
|
+
if (modules.length === 0) return
|
|
42
|
+
|
|
43
|
+
const ids = loadIds()
|
|
44
|
+
if (ids.length === 0) return
|
|
45
|
+
|
|
46
|
+
setRecent(
|
|
47
|
+
[...new Set(ids)]
|
|
48
|
+
.map(id => modules.find(m => m.identifier === id))
|
|
49
|
+
.filter((m): m is ModuleDeclarationInterface => !!m)
|
|
50
|
+
.map(moduleToNavItem)
|
|
51
|
+
)
|
|
52
|
+
}, [modules])
|
|
53
|
+
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (modules.length === 0) return
|
|
56
|
+
|
|
57
|
+
const current = modules.find(m => {
|
|
58
|
+
if (!m.uri || m.uri === "/") return false
|
|
59
|
+
return pathname.startsWith(m.uri)
|
|
60
|
+
})
|
|
61
|
+
if (!current) return
|
|
62
|
+
|
|
63
|
+
const ids = loadIds()
|
|
64
|
+
const updated = [...new Set([current.identifier, ...ids.filter(id => id !== current.identifier)])].slice(0, MAX_RECENT)
|
|
65
|
+
saveIds(updated)
|
|
66
|
+
|
|
67
|
+
setRecent(
|
|
68
|
+
updated
|
|
69
|
+
.map(id => modules.find(m => m.identifier === id))
|
|
70
|
+
.filter((m): m is ModuleDeclarationInterface => !!m)
|
|
71
|
+
.map(moduleToNavItem)
|
|
72
|
+
)
|
|
73
|
+
}, [pathname, modules])
|
|
74
|
+
|
|
75
|
+
return recent
|
|
76
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @liorian/sdk/infrastructure — cross-cutting infrastructure (providers, hooks, stores, utilities…).
|
|
2
|
+
export * from "./common-classname.constant";
|
|
3
|
+
export * from "./capabilities/index";
|
|
4
|
+
export * from "./data/index";
|
|
5
|
+
export * from "./dataset/index";
|
|
6
|
+
export * from "./hooks/index";
|
|
7
|
+
export * from "./library";
|
|
8
|
+
export * from "./providers";
|
|
9
|
+
export * from "./routines";
|
|
10
|
+
export * from "./stores/index";
|
|
11
|
+
export * from "./utilities";
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// src/core/presentation/design-system.ts
|
|
2
|
+
// Design system tokens for the Liorian Dashboard
|
|
3
|
+
|
|
4
|
+
export interface DesignSystemTokens {
|
|
5
|
+
colors: {
|
|
6
|
+
primary: string
|
|
7
|
+
secondary: string
|
|
8
|
+
success: string
|
|
9
|
+
warning: string
|
|
10
|
+
error: string
|
|
11
|
+
background: string
|
|
12
|
+
foreground: string
|
|
13
|
+
// ... other colors
|
|
14
|
+
}
|
|
15
|
+
spacing: {
|
|
16
|
+
xs: number
|
|
17
|
+
sm: number
|
|
18
|
+
md: number
|
|
19
|
+
lg: number
|
|
20
|
+
xl: number
|
|
21
|
+
xxl: number
|
|
22
|
+
// ... other spacing
|
|
23
|
+
}
|
|
24
|
+
borderRadius: {
|
|
25
|
+
none: string
|
|
26
|
+
sm: string
|
|
27
|
+
md: string
|
|
28
|
+
lg: string
|
|
29
|
+
full: string
|
|
30
|
+
}
|
|
31
|
+
shadows: {
|
|
32
|
+
sm: string
|
|
33
|
+
md: string
|
|
34
|
+
lg: string
|
|
35
|
+
}
|
|
36
|
+
motion: {
|
|
37
|
+
springStiffness: number
|
|
38
|
+
springDamping: number
|
|
39
|
+
elasticEaseDuration: number
|
|
40
|
+
// ... other motion-related tokens
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Default design system tokens
|
|
45
|
+
export const tokens: DesignSystemTokens = {
|
|
46
|
+
colors: {
|
|
47
|
+
primary: '#2563EB', // blue-600
|
|
48
|
+
secondary: '#10B981', // emerald-500
|
|
49
|
+
success: '#10B981',
|
|
50
|
+
warning: '#F59E0B', // amber-500
|
|
51
|
+
error: '#EF4444', // red-500
|
|
52
|
+
background: '#FFFFFF',
|
|
53
|
+
foreground: '#111827', // gray-900
|
|
54
|
+
// ... other colors can be added
|
|
55
|
+
},
|
|
56
|
+
spacing: {
|
|
57
|
+
xs: 4, // 0.5rem
|
|
58
|
+
sm: 8, // 0.75rem
|
|
59
|
+
md: 12, // 1rem
|
|
60
|
+
lg: 16, // 1.5rem
|
|
61
|
+
xl: 20, // 2.5rem
|
|
62
|
+
xxl: 24, // 3rem
|
|
63
|
+
// ...
|
|
64
|
+
},
|
|
65
|
+
borderRadius: {
|
|
66
|
+
none: '0px',
|
|
67
|
+
sm: '4px', // 0.5rem
|
|
68
|
+
md: '8px', // 1rem
|
|
69
|
+
lg: '12px', // 1.5rem
|
|
70
|
+
full: '9999px',
|
|
71
|
+
},
|
|
72
|
+
shadows: {
|
|
73
|
+
sm: '0 1px 2px 0 rgba(0,0,0,0.05)',
|
|
74
|
+
md: '0 4px 6px -1px rgba(0,0,0,0.1)',
|
|
75
|
+
lg: '0 10px 15px -5px rgba(0,0,0,0.1)',
|
|
76
|
+
},
|
|
77
|
+
motion: {
|
|
78
|
+
springStiffness: 170, // stiffness for spring physics
|
|
79
|
+
springDamping: 26, // damping for spring physics
|
|
80
|
+
elasticEaseDuration: 300, // duration in ms for elastic easing
|
|
81
|
+
// ...
|
|
82
|
+
},
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
// Helper function to get a token value (if needed for JS usage)
|
|
86
|
+
export const getToken = <T, K extends keyof DesignSystemTokens>(
|
|
87
|
+
tokensObj: DesignSystemTokens,
|
|
88
|
+
key: K,
|
|
89
|
+
subKey?: keyof DesignSystemTokens[K]
|
|
90
|
+
): T => {
|
|
91
|
+
if (subKey) {
|
|
92
|
+
return tokensObj[key][subKey] as unknown as T;
|
|
93
|
+
}
|
|
94
|
+
return tokensObj[key] as unknown as T;
|
|
95
|
+
};
|