@wakastellar/ui 1.0.12 → 2.1.0
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 +163 -193
- package/dist/charts.cjs.js +1 -0
- package/dist/charts.es.js +16 -0
- package/dist/cli/commands/add.d.ts +7 -0
- package/dist/cli/commands/init.d.ts +6 -0
- package/dist/cli/commands/list.d.ts +5 -0
- package/dist/cli/commands/search.d.ts +1 -0
- package/dist/cli/index.cjs +4844 -0
- package/dist/cli/index.d.ts +1 -0
- package/dist/cli/utils/config.d.ts +29 -0
- package/dist/cli/utils/logger.d.ts +20 -0
- package/dist/cli/utils/registry.d.ts +23 -0
- package/dist/cn-B-fTneHh.js +1 -0
- package/dist/cn-DzRe1GWm.mjs +21 -0
- package/dist/components/index.d.ts +122 -0
- package/dist/components/waka-3d-pie-chart/index.d.ts +67 -0
- package/dist/components/waka-achievement-unlock/index.d.ts +83 -0
- package/dist/components/waka-activity-feed/index.d.ts +78 -0
- package/dist/components/waka-address-autocomplete/index.d.ts +124 -0
- package/dist/components/waka-alert-stack/index.d.ts +58 -0
- package/dist/components/waka-allocation-matrix/index.d.ts +193 -0
- package/dist/components/waka-approval-chain/index.d.ts +43 -0
- package/dist/components/waka-audit-log/index.d.ts +142 -0
- package/dist/components/waka-badge-showcase/index.d.ts +51 -0
- package/dist/components/waka-biometric-prompt/index.d.ts +84 -0
- package/dist/components/waka-bottom-sheet/index.d.ts +61 -0
- package/dist/components/waka-breadcrumb-path/index.d.ts +46 -0
- package/dist/components/waka-budget-burn/index.d.ts +154 -0
- package/dist/components/waka-capacity-planner/index.d.ts +132 -0
- package/dist/components/waka-cart-summary/index.d.ts +154 -0
- package/dist/components/waka-challenge-timer/index.d.ts +86 -0
- package/dist/components/waka-chat-bubble/index.d.ts +127 -0
- package/dist/components/waka-checklist/index.d.ts +123 -0
- package/dist/components/waka-checkout-stepper/index.d.ts +154 -0
- package/dist/components/waka-cohort-table/index.d.ts +130 -0
- package/dist/components/waka-combo-counter/index.d.ts +53 -0
- package/dist/components/waka-command-bar/index.d.ts +45 -0
- package/dist/components/waka-compare-period/index.d.ts +122 -0
- package/dist/components/waka-connection-matrix/index.d.ts +117 -0
- package/dist/components/waka-contribution-graph/index.d.ts +34 -0
- package/dist/components/waka-cost-breakdown/index.d.ts +50 -0
- package/dist/components/waka-coupon-input/index.d.ts +105 -0
- package/dist/components/waka-credit-card-input/index.d.ts +95 -0
- package/dist/components/waka-daily-reward/index.d.ts +76 -0
- package/dist/components/waka-deployment-lane/index.d.ts +43 -0
- package/dist/components/waka-device-trust/index.d.ts +95 -0
- package/dist/components/waka-dock/index.d.ts +44 -0
- package/dist/components/waka-empty-state/index.d.ts +85 -0
- package/dist/components/waka-error-shake/index.d.ts +49 -0
- package/dist/components/waka-feature-announcement/index.d.ts +112 -0
- package/dist/components/waka-floating-nav/index.d.ts +51 -0
- package/dist/components/waka-flow-diagram/index.d.ts +71 -0
- package/dist/components/waka-funnel-chart/index.d.ts +108 -0
- package/dist/components/waka-glow-card/index.d.ts +32 -0
- package/dist/components/waka-goal-progress/index.d.ts +139 -0
- package/dist/components/waka-haptic-button/index.d.ts +45 -0
- package/dist/components/waka-health-pulse/index.d.ts +28 -0
- package/dist/components/waka-heatmap/index.d.ts +135 -0
- package/dist/components/waka-hotspot/index.d.ts +106 -0
- package/dist/components/waka-incident-timeline/index.d.ts +38 -0
- package/dist/components/waka-invoice-preview/index.d.ts +137 -0
- package/dist/components/waka-kpi-dashboard/index.d.ts +80 -0
- package/dist/components/waka-leaderboard/index.d.ts +85 -0
- package/dist/components/waka-level-progress/index.d.ts +89 -0
- package/dist/components/waka-liquid-button/index.d.ts +41 -0
- package/dist/components/waka-loading-orbit/index.d.ts +90 -0
- package/dist/components/waka-loot-box/index.d.ts +87 -0
- package/dist/components/waka-magic-link/index.d.ts +34 -0
- package/dist/components/waka-magnetic-button/index.d.ts +56 -0
- package/dist/components/waka-mention-input/index.d.ts +106 -0
- package/dist/components/waka-metric-sparkline/index.d.ts +46 -0
- package/dist/components/waka-milestone-road/index.d.ts +91 -0
- package/dist/components/waka-morph-button/index.d.ts +62 -0
- package/dist/components/waka-network-topology/index.d.ts +35 -0
- package/dist/components/waka-orbital-menu/index.d.ts +61 -0
- package/dist/components/waka-order-tracker/index.d.ts +121 -0
- package/dist/components/waka-password-strength/index.d.ts +98 -0
- package/dist/components/waka-payment-method-picker/index.d.ts +88 -0
- package/dist/components/waka-permission-matrix/index.d.ts +197 -0
- package/dist/components/waka-phone-input/index.d.ts +93 -0
- package/dist/components/waka-pipeline-view/index.d.ts +49 -0
- package/dist/components/waka-player-card/index.d.ts +36 -0
- package/dist/components/waka-points-popup/index.d.ts +75 -0
- package/dist/components/waka-power-up/index.d.ts +103 -0
- package/dist/components/waka-presence-indicator/index.d.ts +188 -0
- package/dist/components/waka-pricing-table/index.d.ts +77 -0
- package/dist/components/waka-product-card/index.d.ts +81 -0
- package/dist/components/waka-progress-onboarding/index.d.ts +97 -0
- package/dist/components/waka-pull-to-refresh/index.d.ts +45 -0
- package/dist/components/waka-quest-card/index.d.ts +110 -0
- package/dist/components/waka-quota-bar/index.d.ts +100 -0
- package/dist/components/waka-radar-score/index.d.ts +95 -0
- package/dist/components/waka-rank-badge/index.d.ts +58 -0
- package/dist/components/waka-rating-input/index.d.ts +110 -0
- package/dist/components/waka-reaction-picker/index.d.ts +77 -0
- package/dist/components/waka-region-map/index.d.ts +27 -0
- package/dist/components/waka-resource-gauge/index.d.ts +78 -0
- package/dist/components/waka-resource-pool/index.d.ts +81 -0
- package/dist/components/waka-rollback-slider/index.d.ts +79 -0
- package/dist/components/waka-sankey-diagram/index.d.ts +120 -0
- package/dist/components/waka-schedule-picker/index.d.ts +100 -0
- package/dist/components/waka-scratch-card/index.d.ts +87 -0
- package/dist/components/waka-season-pass/index.d.ts +65 -0
- package/dist/components/waka-security-score/index.d.ts +124 -0
- package/dist/components/waka-server-rack/index.d.ts +44 -0
- package/dist/components/waka-session-manager/index.d.ts +116 -0
- package/dist/components/waka-signature-pad/index.d.ts +87 -0
- package/dist/components/waka-skeleton-wave/index.d.ts +79 -0
- package/dist/components/waka-skill-tree/index.d.ts +78 -0
- package/dist/components/waka-sla-tracker/index.d.ts +65 -0
- package/dist/components/waka-slider-range/index.d.ts +88 -0
- package/dist/components/waka-spin-wheel/index.d.ts +51 -0
- package/dist/components/waka-spotlight/index.d.ts +47 -0
- package/dist/components/waka-stats-hexagon/index.d.ts +149 -0
- package/dist/components/waka-status-matrix/index.d.ts +38 -0
- package/dist/components/waka-streak-counter/index.d.ts +27 -0
- package/dist/components/waka-success-explosion/index.d.ts +51 -0
- package/dist/components/waka-swipe-card/index.d.ts +64 -0
- package/dist/components/waka-tabs-morph/index.d.ts +66 -0
- package/dist/components/waka-tag-input/index.d.ts +134 -0
- package/dist/components/waka-team-banner/index.d.ts +122 -0
- package/dist/components/waka-terminal-output/index.d.ts +48 -0
- package/dist/components/waka-thread-view/index.d.ts +101 -0
- package/dist/components/waka-tilt-card/index.d.ts +36 -0
- package/dist/components/waka-tooltip-tour/index.d.ts +118 -0
- package/dist/components/waka-tour-guide/index.d.ts +122 -0
- package/dist/components/waka-tournament-bracket/index.d.ts +101 -0
- package/dist/components/waka-treemap-chart/index.d.ts +104 -0
- package/dist/components/waka-two-factor-setup/index.d.ts +93 -0
- package/dist/components/waka-typewriter/index.d.ts +98 -0
- package/dist/components/waka-typing-indicator/index.d.ts +64 -0
- package/dist/components/waka-versus-card/index.d.ts +117 -0
- package/dist/components/waka-video-call/index.d.ts +170 -0
- package/dist/components/waka-voice-message/index.d.ts +117 -0
- package/dist/components/waka-welcome-modal/index.d.ts +120 -0
- package/dist/components/waka-xp-bar/index.d.ts +54 -0
- package/dist/export.cjs.js +1 -0
- package/dist/export.d.ts +3 -1
- package/dist/export.es.js +5 -0
- package/dist/index-B9GTFkji.js +1 -0
- package/dist/index-c0jcWyEL.mjs +466 -0
- package/dist/index.cjs.js +2530 -22
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +72081 -19512
- package/dist/rich-text.cjs.js +1 -0
- package/dist/rich-text.es.js +4 -0
- package/dist/types-BOWIoR7j.mjs +1111 -0
- package/dist/types-D2yCJ91P.js +1 -0
- package/dist/useDataTableImport-D8R2HQl6.mjs +229 -0
- package/dist/useDataTableImport-S_hhA5Wo.js +9 -0
- package/package.json +70 -22
- package/src/blocks/activity-timeline/index.tsx +586 -0
- package/src/blocks/calendar-view/index.tsx +756 -0
- package/src/blocks/chat/index.tsx +1018 -0
- package/src/blocks/chat/widget.tsx +504 -0
- package/src/blocks/dashboard/index.tsx +522 -0
- package/src/blocks/empty-states/index.tsx +452 -0
- package/src/blocks/error-pages/index.tsx +426 -0
- package/src/blocks/faq/index.tsx +479 -0
- package/src/blocks/file-manager/index.tsx +890 -0
- package/src/blocks/footer/index.tsx +133 -0
- package/src/blocks/header/index.tsx +357 -0
- package/src/blocks/headtab/index.tsx +139 -0
- package/src/blocks/i18n-editor/index.tsx +1016 -0
- package/src/blocks/index.ts +80 -0
- package/src/blocks/kanban-board/index.tsx +779 -0
- package/src/blocks/landing/index.tsx +677 -0
- package/src/blocks/language-selector/index.tsx +88 -0
- package/src/blocks/layout/index.tsx +159 -0
- package/src/blocks/login/index.tsx +339 -0
- package/src/blocks/login/types.ts +131 -0
- package/src/blocks/pricing/index.tsx +564 -0
- package/src/blocks/profile/index.tsx +746 -0
- package/src/blocks/settings/index.tsx +558 -0
- package/src/blocks/sidebar/index.tsx +713 -0
- package/src/blocks/theme-creator-block/index.tsx +835 -0
- package/src/blocks/user-management/index.tsx +1037 -0
- package/src/blocks/wizard/index.tsx +719 -0
- package/src/components/DataTable/DataTable.tsx +406 -0
- package/src/components/DataTable/DataTableAdvanced.tsx +720 -0
- package/src/components/DataTable/DataTableBody.tsx +216 -0
- package/src/components/DataTable/DataTableCell.tsx +172 -0
- package/src/components/DataTable/DataTableColumnResizer.tsx +62 -0
- package/src/components/DataTable/DataTableConflictResolver.tsx +478 -0
- package/src/components/DataTable/DataTableContextMenu.tsx +219 -0
- package/src/components/DataTable/DataTableEditCell.tsx +279 -0
- package/src/components/DataTable/DataTableFilterBuilder.tsx +519 -0
- package/src/components/DataTable/DataTableFilters.tsx +535 -0
- package/src/components/DataTable/DataTableGrouping.tsx +147 -0
- package/src/components/DataTable/DataTableHeader.tsx +172 -0
- package/src/components/DataTable/DataTablePagination.tsx +125 -0
- package/src/components/DataTable/DataTableSelection.tsx +269 -0
- package/src/components/DataTable/DataTableSyncStatus.tsx +281 -0
- package/src/components/DataTable/DataTableToolbar.tsx +262 -0
- package/src/components/DataTable/README.md +446 -0
- package/src/components/DataTable/__tests__/DataTableAdvanced.test.tsx +426 -0
- package/src/components/DataTable/__tests__/DataTableEdit.test.tsx +329 -0
- package/src/components/DataTable/__tests__/useDataTableAdvanced.test.ts +455 -0
- package/src/components/DataTable/examples/EditExample.tsx +166 -0
- package/src/components/DataTable/formatters/index.ts +335 -0
- package/src/components/DataTable/hooks/__tests__/useDataTableEdit.test.ts +239 -0
- package/src/components/DataTable/hooks/useDataTable.ts +145 -0
- package/src/components/DataTable/hooks/useDataTableAdvanced.ts +342 -0
- package/src/components/DataTable/hooks/useDataTableAdvancedFilters.ts +637 -0
- package/src/components/DataTable/hooks/useDataTableColumnTemplates.ts +186 -0
- package/src/components/DataTable/hooks/useDataTableEdit.ts +167 -0
- package/src/components/DataTable/hooks/useDataTableExport.ts +227 -0
- package/src/components/DataTable/hooks/useDataTableImport.ts +216 -0
- package/src/components/DataTable/hooks/useDataTableOffline.ts +481 -0
- package/src/components/DataTable/hooks/useDataTableTheme.ts +213 -0
- package/src/components/DataTable/hooks/useDataTableVirtualization.ts +99 -0
- package/src/components/DataTable/hooks/useTableLayout.ts +85 -0
- package/src/components/DataTable/index.ts +81 -0
- package/src/components/DataTable/services/IndexedDBService.ts +504 -0
- package/src/components/DataTable/templates/index.tsx +803 -0
- package/src/components/DataTable/types.ts +504 -0
- package/src/components/DataTable/utils.ts +164 -0
- package/src/components/DataTable/workers/exportWorker.ts +213 -0
- package/src/components/accordion/index.tsx +61 -0
- package/src/components/alert/index.tsx +61 -0
- package/src/components/alert-dialog/index.tsx +146 -0
- package/src/components/aspect-ratio/index.tsx +12 -0
- package/src/components/avatar/index.tsx +54 -0
- package/src/components/badge/Badge.stories.tsx +64 -0
- package/src/components/badge/index.tsx +38 -0
- package/src/components/button/Button.stories.tsx +173 -0
- package/src/components/button/index.tsx +56 -0
- package/src/components/calendar/index.tsx +73 -0
- package/src/components/card/index.tsx +78 -0
- package/src/components/checkbox/index.tsx +34 -0
- package/src/components/code/index.tsx +229 -0
- package/src/components/collapsible/index.tsx +16 -0
- package/src/components/command/index.tsx +162 -0
- package/src/components/context-menu/index.tsx +204 -0
- package/src/components/dialog/index.tsx +126 -0
- package/src/components/dropdown-menu/index.tsx +204 -0
- package/src/components/error-boundary/ErrorBoundary.tsx +281 -0
- package/src/components/error-boundary/index.ts +7 -0
- package/src/components/form/index.tsx +183 -0
- package/src/components/hover-card/index.tsx +33 -0
- package/src/components/index.ts +368 -0
- package/src/components/input/Input.stories.tsx +100 -0
- package/src/components/input/index.tsx +27 -0
- package/src/components/input-otp/index.tsx +277 -0
- package/src/components/label/index.tsx +30 -0
- package/src/components/language-selector/index.tsx +341 -0
- package/src/components/menubar/index.tsx +240 -0
- package/src/components/navigation-menu/index.tsx +134 -0
- package/src/components/popover/index.tsx +35 -0
- package/src/components/progress/index.tsx +32 -0
- package/src/components/radio-group/index.tsx +48 -0
- package/src/components/scroll-area/index.tsx +52 -0
- package/src/components/select/index.tsx +164 -0
- package/src/components/separator/index.tsx +35 -0
- package/src/components/sheet/index.tsx +147 -0
- package/src/components/skeleton/index.tsx +22 -0
- package/src/components/slider/index.tsx +32 -0
- package/src/components/switch/index.tsx +33 -0
- package/src/components/table/index.tsx +117 -0
- package/src/components/tabs/index.tsx +59 -0
- package/src/components/textarea/index.tsx +30 -0
- package/src/components/theme-selector/index.tsx +327 -0
- package/src/components/toast/index.tsx +133 -0
- package/src/components/toaster/index.tsx +34 -0
- package/src/components/toggle/index.tsx +49 -0
- package/src/components/tooltip/index.tsx +34 -0
- package/src/components/typography/index.tsx +276 -0
- package/src/components/waka-3d-pie-chart/index.tsx +486 -0
- package/src/components/waka-achievement-unlock/index.tsx +716 -0
- package/src/components/waka-activity-feed/index.tsx +686 -0
- package/src/components/waka-address-autocomplete/index.tsx +1202 -0
- package/src/components/waka-admincrumb/index.tsx +349 -0
- package/src/components/waka-alert-stack/index.tsx +827 -0
- package/src/components/waka-allocation-matrix/index.tsx +1278 -0
- package/src/components/waka-approval-chain/index.tsx +766 -0
- package/src/components/waka-audit-log/index.tsx +1475 -0
- package/src/components/waka-autocomplete/index.tsx +358 -0
- package/src/components/waka-badge-showcase/index.tsx +704 -0
- package/src/components/waka-barcode/index.tsx +260 -0
- package/src/components/waka-biometric-prompt/index.tsx +765 -0
- package/src/components/waka-bottom-sheet/index.tsx +495 -0
- package/src/components/waka-breadcrumb/index.tsx +376 -0
- package/src/components/waka-breadcrumb-path/index.tsx +513 -0
- package/src/components/waka-budget-burn/index.tsx +1234 -0
- package/src/components/waka-capacity-planner/index.tsx +1107 -0
- package/src/components/waka-carousel/index.tsx +893 -0
- package/src/components/waka-cart-summary/index.tsx +1055 -0
- package/src/components/waka-challenge-timer/index.tsx +1044 -0
- package/src/components/waka-charts/WakaAreaChart.tsx +251 -0
- package/src/components/waka-charts/WakaBarChart.tsx +222 -0
- package/src/components/waka-charts/WakaChart.tsx +124 -0
- package/src/components/waka-charts/WakaLineChart.tsx +219 -0
- package/src/components/waka-charts/WakaMiniChart.tsx +133 -0
- package/src/components/waka-charts/WakaPieChart.tsx +214 -0
- package/src/components/waka-charts/WakaSparkline.tsx +229 -0
- package/src/components/waka-charts/dataTableHelpers.ts +109 -0
- package/src/components/waka-charts/hooks/useChartTheme.ts +123 -0
- package/src/components/waka-charts/hooks/useRechartsLoader.ts +234 -0
- package/src/components/waka-charts/index.ts +90 -0
- package/src/components/waka-charts/types.ts +330 -0
- package/src/components/waka-chat-bubble/index.tsx +1060 -0
- package/src/components/waka-checklist/index.tsx +1067 -0
- package/src/components/waka-checkout-stepper/index.tsx +976 -0
- package/src/components/waka-cohort-table/index.tsx +1011 -0
- package/src/components/waka-color-picker/index.tsx +447 -0
- package/src/components/waka-combo-counter/index.tsx +864 -0
- package/src/components/waka-combobox/index.tsx +497 -0
- package/src/components/waka-command-bar/index.tsx +403 -0
- package/src/components/waka-compare-period/index.tsx +1230 -0
- package/src/components/waka-connection-matrix/index.tsx +1053 -0
- package/src/components/waka-contribution-graph/index.tsx +552 -0
- package/src/components/waka-cost-breakdown/index.tsx +1065 -0
- package/src/components/waka-coupon-input/index.tsx +592 -0
- package/src/components/waka-credit-card-input/index.tsx +982 -0
- package/src/components/waka-daily-reward/index.tsx +762 -0
- package/src/components/waka-date-range-picker/index.tsx +378 -0
- package/src/components/waka-datetime-picker/index.tsx +793 -0
- package/src/components/waka-datetime-picker.form-integration/index.tsx +402 -0
- package/src/components/waka-deployment-lane/index.tsx +673 -0
- package/src/components/waka-device-trust/index.tsx +1259 -0
- package/src/components/waka-dock/index.tsx +285 -0
- package/src/components/waka-drawer/index.tsx +319 -0
- package/src/components/waka-empty-state/index.tsx +545 -0
- package/src/components/waka-error-shake/index.tsx +398 -0
- package/src/components/waka-feature-announcement/index.tsx +991 -0
- package/src/components/waka-file-upload/index.tsx +437 -0
- package/src/components/waka-floating-nav/index.tsx +413 -0
- package/src/components/waka-flow-diagram/index.tsx +508 -0
- package/src/components/waka-funnel-chart/index.tsx +823 -0
- package/src/components/waka-glow-card/index.tsx +246 -0
- package/src/components/waka-goal-progress/index.tsx +1025 -0
- package/src/components/waka-haptic-button/index.tsx +388 -0
- package/src/components/waka-health-pulse/index.tsx +451 -0
- package/src/components/waka-heatmap/index.tsx +1026 -0
- package/src/components/waka-hotspot/index.tsx +682 -0
- package/src/components/waka-image/index.tsx +373 -0
- package/src/components/waka-incident-timeline/index.tsx +686 -0
- package/src/components/waka-invoice-preview/index.tsx +829 -0
- package/src/components/waka-kanban/index.tsx +646 -0
- package/src/components/waka-kpi-dashboard/index.tsx +755 -0
- package/src/components/waka-leaderboard/index.tsx +746 -0
- package/src/components/waka-level-progress/index.tsx +665 -0
- package/src/components/waka-liquid-button/index.tsx +520 -0
- package/src/components/waka-loading-orbit/index.tsx +478 -0
- package/src/components/waka-loot-box/index.tsx +1091 -0
- package/src/components/waka-magic-link/index.tsx +321 -0
- package/src/components/waka-magnetic-button/index.tsx +567 -0
- package/src/components/waka-mention-input/index.tsx +953 -0
- package/src/components/waka-metric-sparkline/index.tsx +627 -0
- package/src/components/waka-milestone-road/index.tsx +1064 -0
- package/src/components/waka-modal/index.tsx +374 -0
- package/src/components/waka-morph-button/index.tsx +495 -0
- package/src/components/waka-network-topology/index.tsx +801 -0
- package/src/components/waka-notifications/index.tsx +414 -0
- package/src/components/waka-number-input/index.tsx +373 -0
- package/src/components/waka-orbital-menu/index.tsx +445 -0
- package/src/components/waka-order-tracker/index.tsx +1041 -0
- package/src/components/waka-pagination/index.tsx +393 -0
- package/src/components/waka-password-strength/index.tsx +824 -0
- package/src/components/waka-payment-method-picker/index.tsx +715 -0
- package/src/components/waka-permission-matrix/index.tsx +1302 -0
- package/src/components/waka-phone-input/index.tsx +801 -0
- package/src/components/waka-pipeline-view/index.tsx +604 -0
- package/src/components/waka-player-card/index.tsx +691 -0
- package/src/components/waka-points-popup/index.tsx +366 -0
- package/src/components/waka-power-up/index.tsx +1155 -0
- package/src/components/waka-presence-indicator/index.tsx +1181 -0
- package/src/components/waka-pricing-table/index.tsx +755 -0
- package/src/components/waka-product-card/index.tsx +786 -0
- package/src/components/waka-progress-onboarding/index.tsx +878 -0
- package/src/components/waka-pull-to-refresh/index.tsx +451 -0
- package/src/components/waka-qrcode/index.tsx +232 -0
- package/src/components/waka-quest-card/index.tsx +1275 -0
- package/src/components/waka-quota-bar/index.tsx +693 -0
- package/src/components/waka-radar-score/index.tsx +512 -0
- package/src/components/waka-rank-badge/index.tsx +813 -0
- package/src/components/waka-rating-input/index.tsx +560 -0
- package/src/components/waka-reaction-picker/index.tsx +1062 -0
- package/src/components/waka-region-map/index.tsx +730 -0
- package/src/components/waka-resource-gauge/index.tsx +654 -0
- package/src/components/waka-resource-pool/index.tsx +1035 -0
- package/src/components/waka-rich-text-editor/index.tsx +594 -0
- package/src/components/waka-rollback-slider/index.tsx +891 -0
- package/src/components/waka-sankey-diagram/index.tsx +1032 -0
- package/src/components/waka-schedule-picker/index.tsx +1060 -0
- package/src/components/waka-scratch-card/index.tsx +914 -0
- package/src/components/waka-season-pass/index.tsx +886 -0
- package/src/components/waka-security-score/index.tsx +1126 -0
- package/src/components/waka-segmented-control/index.tsx +238 -0
- package/src/components/waka-server-rack/index.tsx +764 -0
- package/src/components/waka-session-manager/index.tsx +815 -0
- package/src/components/waka-signature-pad/index.tsx +744 -0
- package/src/components/waka-skeleton-wave/index.tsx +454 -0
- package/src/components/waka-skill-tree/index.tsx +1031 -0
- package/src/components/waka-sla-tracker/index.tsx +798 -0
- package/src/components/waka-slider-range/index.tsx +765 -0
- package/src/components/waka-spin-wheel/index.tsx +671 -0
- package/src/components/waka-spinner/index.tsx +284 -0
- package/src/components/waka-spotlight/index.tsx +410 -0
- package/src/components/waka-stat/index.tsx +428 -0
- package/src/components/waka-stats-hexagon/index.tsx +824 -0
- package/src/components/waka-status-matrix/index.tsx +565 -0
- package/src/components/waka-stepper/index.tsx +489 -0
- package/src/components/waka-streak-counter/index.tsx +334 -0
- package/src/components/waka-success-explosion/index.tsx +453 -0
- package/src/components/waka-swipe-card/index.tsx +574 -0
- package/src/components/waka-tabs-morph/index.tsx +509 -0
- package/src/components/waka-tag-input/index.tsx +877 -0
- package/src/components/waka-team-banner/index.tsx +1183 -0
- package/src/components/waka-terminal-output/index.tsx +836 -0
- package/src/components/waka-theme-creator/index.tsx +762 -0
- package/src/components/waka-theme-manager/index.tsx +654 -0
- package/src/components/waka-thread-view/index.tsx +874 -0
- package/src/components/waka-tilt-card/index.tsx +250 -0
- package/src/components/waka-time-picker/index.tsx +479 -0
- package/src/components/waka-timeline/index.tsx +385 -0
- package/src/components/waka-tooltip-tour/index.tsx +855 -0
- package/src/components/waka-tour-guide/index.tsx +920 -0
- package/src/components/waka-tournament-bracket/index.tsx +1276 -0
- package/src/components/waka-tree/index.tsx +557 -0
- package/src/components/waka-treemap-chart/index.tsx +1031 -0
- package/src/components/waka-two-factor-setup/index.tsx +995 -0
- package/src/components/waka-typewriter/index.tsx +566 -0
- package/src/components/waka-typing-indicator/index.tsx +649 -0
- package/src/components/waka-versus-card/index.tsx +1026 -0
- package/src/components/waka-video/index.tsx +557 -0
- package/src/components/waka-video-call/index.tsx +1087 -0
- package/src/components/waka-virtual-list/index.tsx +327 -0
- package/src/components/waka-voice-message/index.tsx +1019 -0
- package/src/components/waka-welcome-modal/index.tsx +790 -0
- package/src/components/waka-xp-bar/index.tsx +799 -0
- package/src/styles/base.css +108 -0
- package/src/styles/code-highlight.css +82 -86
- package/src/styles/globals-v3.css +9 -0
- package/src/styles/globals.css +57 -74
- package/src/styles/tailwind.preset.js +69 -0
|
@@ -0,0 +1,504 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service IndexedDB pour le mode offline du DataTable
|
|
3
|
+
* Gère le cache des données, la queue de synchronisation et les conflits
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
// Types pour IndexedDB
|
|
7
|
+
export interface CacheEntry<TData> {
|
|
8
|
+
id: string
|
|
9
|
+
tableId: string
|
|
10
|
+
data: TData[]
|
|
11
|
+
timestamp: Date
|
|
12
|
+
version: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export interface SyncQueueItem<TData> {
|
|
16
|
+
id: string
|
|
17
|
+
tableId: string
|
|
18
|
+
rowId: string
|
|
19
|
+
type: "create" | "update" | "delete"
|
|
20
|
+
data: Partial<TData> | null
|
|
21
|
+
timestamp: Date
|
|
22
|
+
attempts: number
|
|
23
|
+
lastError?: string
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface ConflictEntry<TData> {
|
|
27
|
+
id: string
|
|
28
|
+
tableId: string
|
|
29
|
+
rowId: string
|
|
30
|
+
localData: Partial<TData> | null
|
|
31
|
+
serverData: Partial<TData> | null
|
|
32
|
+
localTimestamp: Date
|
|
33
|
+
serverTimestamp: Date
|
|
34
|
+
type: "create" | "update" | "delete"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const DB_NAME = "wakastart-datatable"
|
|
38
|
+
const DB_VERSION = 1
|
|
39
|
+
|
|
40
|
+
const STORES = {
|
|
41
|
+
CACHE: "cache",
|
|
42
|
+
SYNC_QUEUE: "syncQueue",
|
|
43
|
+
CONFLICTS: "conflicts",
|
|
44
|
+
} as const
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Service pour gérer IndexedDB
|
|
48
|
+
*/
|
|
49
|
+
export class IndexedDBService {
|
|
50
|
+
private db: IDBDatabase | null = null
|
|
51
|
+
private initPromise: Promise<void> | null = null
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Initialise la connexion à IndexedDB
|
|
55
|
+
*/
|
|
56
|
+
async init(): Promise<void> {
|
|
57
|
+
if (this.db) return
|
|
58
|
+
|
|
59
|
+
if (this.initPromise) {
|
|
60
|
+
return this.initPromise
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
this.initPromise = new Promise((resolve, reject) => {
|
|
64
|
+
if (!("indexedDB" in window)) {
|
|
65
|
+
reject(new Error("IndexedDB is not supported in this browser"))
|
|
66
|
+
return
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const request = indexedDB.open(DB_NAME, DB_VERSION)
|
|
70
|
+
|
|
71
|
+
request.onerror = () => {
|
|
72
|
+
reject(request.error)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
request.onsuccess = () => {
|
|
76
|
+
this.db = request.result
|
|
77
|
+
resolve()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
request.onupgradeneeded = (event) => {
|
|
81
|
+
const db = (event.target as IDBOpenDBRequest).result
|
|
82
|
+
|
|
83
|
+
// Store pour le cache des données
|
|
84
|
+
if (!db.objectStoreNames.contains(STORES.CACHE)) {
|
|
85
|
+
const cacheStore = db.createObjectStore(STORES.CACHE, { keyPath: "id" })
|
|
86
|
+
cacheStore.createIndex("tableId", "tableId", { unique: false })
|
|
87
|
+
cacheStore.createIndex("timestamp", "timestamp", { unique: false })
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// Store pour la queue de synchronisation
|
|
91
|
+
if (!db.objectStoreNames.contains(STORES.SYNC_QUEUE)) {
|
|
92
|
+
const syncStore = db.createObjectStore(STORES.SYNC_QUEUE, { keyPath: "id" })
|
|
93
|
+
syncStore.createIndex("tableId", "tableId", { unique: false })
|
|
94
|
+
syncStore.createIndex("timestamp", "timestamp", { unique: false })
|
|
95
|
+
syncStore.createIndex("rowId", "rowId", { unique: false })
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Store pour les conflits
|
|
99
|
+
if (!db.objectStoreNames.contains(STORES.CONFLICTS)) {
|
|
100
|
+
const conflictStore = db.createObjectStore(STORES.CONFLICTS, { keyPath: "id" })
|
|
101
|
+
conflictStore.createIndex("tableId", "tableId", { unique: false })
|
|
102
|
+
conflictStore.createIndex("rowId", "rowId", { unique: false })
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
return this.initPromise
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Vérifie si IndexedDB est disponible
|
|
112
|
+
*/
|
|
113
|
+
isAvailable(): boolean {
|
|
114
|
+
return "indexedDB" in window
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Ferme la connexion
|
|
119
|
+
*/
|
|
120
|
+
close(): void {
|
|
121
|
+
if (this.db) {
|
|
122
|
+
this.db.close()
|
|
123
|
+
this.db = null
|
|
124
|
+
this.initPromise = null
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
// ============ CACHE ============
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Sauvegarde les données en cache
|
|
132
|
+
*/
|
|
133
|
+
async cacheData<TData>(
|
|
134
|
+
tableId: string,
|
|
135
|
+
data: TData[],
|
|
136
|
+
version = 1
|
|
137
|
+
): Promise<void> {
|
|
138
|
+
await this.init()
|
|
139
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
140
|
+
|
|
141
|
+
const entry: CacheEntry<TData> = {
|
|
142
|
+
id: tableId,
|
|
143
|
+
tableId,
|
|
144
|
+
data,
|
|
145
|
+
timestamp: new Date(),
|
|
146
|
+
version,
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return new Promise((resolve, reject) => {
|
|
150
|
+
const transaction = this.db!.transaction([STORES.CACHE], "readwrite")
|
|
151
|
+
const store = transaction.objectStore(STORES.CACHE)
|
|
152
|
+
const request = store.put(entry)
|
|
153
|
+
|
|
154
|
+
request.onsuccess = () => resolve()
|
|
155
|
+
request.onerror = () => reject(request.error)
|
|
156
|
+
})
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Récupère les données du cache
|
|
161
|
+
*/
|
|
162
|
+
async getCachedData<TData>(tableId: string): Promise<CacheEntry<TData> | null> {
|
|
163
|
+
await this.init()
|
|
164
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
165
|
+
|
|
166
|
+
return new Promise((resolve, reject) => {
|
|
167
|
+
const transaction = this.db!.transaction([STORES.CACHE], "readonly")
|
|
168
|
+
const store = transaction.objectStore(STORES.CACHE)
|
|
169
|
+
const request = store.get(tableId)
|
|
170
|
+
|
|
171
|
+
request.onsuccess = () => resolve(request.result || null)
|
|
172
|
+
request.onerror = () => reject(request.error)
|
|
173
|
+
})
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Supprime les données du cache
|
|
178
|
+
*/
|
|
179
|
+
async clearCache(tableId: string): Promise<void> {
|
|
180
|
+
await this.init()
|
|
181
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
182
|
+
|
|
183
|
+
return new Promise((resolve, reject) => {
|
|
184
|
+
const transaction = this.db!.transaction([STORES.CACHE], "readwrite")
|
|
185
|
+
const store = transaction.objectStore(STORES.CACHE)
|
|
186
|
+
const request = store.delete(tableId)
|
|
187
|
+
|
|
188
|
+
request.onsuccess = () => resolve()
|
|
189
|
+
request.onerror = () => reject(request.error)
|
|
190
|
+
})
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* Supprime les entrées de cache expirées
|
|
195
|
+
*/
|
|
196
|
+
async cleanExpiredCache(maxAgeMs: number): Promise<number> {
|
|
197
|
+
await this.init()
|
|
198
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
199
|
+
|
|
200
|
+
const cutoff = new Date(Date.now() - maxAgeMs)
|
|
201
|
+
|
|
202
|
+
return new Promise((resolve, reject) => {
|
|
203
|
+
const transaction = this.db!.transaction([STORES.CACHE], "readwrite")
|
|
204
|
+
const store = transaction.objectStore(STORES.CACHE)
|
|
205
|
+
const index = store.index("timestamp")
|
|
206
|
+
const range = IDBKeyRange.upperBound(cutoff)
|
|
207
|
+
const request = index.openCursor(range)
|
|
208
|
+
|
|
209
|
+
let deletedCount = 0
|
|
210
|
+
|
|
211
|
+
request.onsuccess = (event) => {
|
|
212
|
+
const cursor = (event.target as IDBRequest).result as IDBCursorWithValue | null
|
|
213
|
+
if (cursor) {
|
|
214
|
+
cursor.delete()
|
|
215
|
+
deletedCount++
|
|
216
|
+
cursor.continue()
|
|
217
|
+
} else {
|
|
218
|
+
resolve(deletedCount)
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
request.onerror = () => reject(request.error)
|
|
223
|
+
})
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ============ SYNC QUEUE ============
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Ajoute un changement à la queue de synchronisation
|
|
230
|
+
*/
|
|
231
|
+
async queueChange<TData>(
|
|
232
|
+
tableId: string,
|
|
233
|
+
rowId: string,
|
|
234
|
+
type: SyncQueueItem<TData>["type"],
|
|
235
|
+
data: Partial<TData> | null
|
|
236
|
+
): Promise<string> {
|
|
237
|
+
await this.init()
|
|
238
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
239
|
+
|
|
240
|
+
const id = `${tableId}_${rowId}_${Date.now()}`
|
|
241
|
+
const item: SyncQueueItem<TData> = {
|
|
242
|
+
id,
|
|
243
|
+
tableId,
|
|
244
|
+
rowId,
|
|
245
|
+
type,
|
|
246
|
+
data,
|
|
247
|
+
timestamp: new Date(),
|
|
248
|
+
attempts: 0,
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
return new Promise((resolve, reject) => {
|
|
252
|
+
const transaction = this.db!.transaction([STORES.SYNC_QUEUE], "readwrite")
|
|
253
|
+
const store = transaction.objectStore(STORES.SYNC_QUEUE)
|
|
254
|
+
const request = store.add(item)
|
|
255
|
+
|
|
256
|
+
request.onsuccess = () => resolve(id)
|
|
257
|
+
request.onerror = () => reject(request.error)
|
|
258
|
+
})
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/**
|
|
262
|
+
* Récupère les changements en attente
|
|
263
|
+
*/
|
|
264
|
+
async getPendingChanges<TData>(tableId: string): Promise<SyncQueueItem<TData>[]> {
|
|
265
|
+
await this.init()
|
|
266
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
267
|
+
|
|
268
|
+
return new Promise((resolve, reject) => {
|
|
269
|
+
const transaction = this.db!.transaction([STORES.SYNC_QUEUE], "readonly")
|
|
270
|
+
const store = transaction.objectStore(STORES.SYNC_QUEUE)
|
|
271
|
+
const index = store.index("tableId")
|
|
272
|
+
const request = index.getAll(tableId)
|
|
273
|
+
|
|
274
|
+
request.onsuccess = () => {
|
|
275
|
+
const items = request.result as SyncQueueItem<TData>[]
|
|
276
|
+
// Trier par timestamp
|
|
277
|
+
items.sort((a, b) => new Date(a.timestamp).getTime() - new Date(b.timestamp).getTime())
|
|
278
|
+
resolve(items)
|
|
279
|
+
}
|
|
280
|
+
request.onerror = () => reject(request.error)
|
|
281
|
+
})
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* Compte les changements en attente
|
|
286
|
+
*/
|
|
287
|
+
async countPendingChanges(tableId: string): Promise<number> {
|
|
288
|
+
await this.init()
|
|
289
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
290
|
+
|
|
291
|
+
return new Promise((resolve, reject) => {
|
|
292
|
+
const transaction = this.db!.transaction([STORES.SYNC_QUEUE], "readonly")
|
|
293
|
+
const store = transaction.objectStore(STORES.SYNC_QUEUE)
|
|
294
|
+
const index = store.index("tableId")
|
|
295
|
+
const request = index.count(tableId)
|
|
296
|
+
|
|
297
|
+
request.onsuccess = () => resolve(request.result)
|
|
298
|
+
request.onerror = () => reject(request.error)
|
|
299
|
+
})
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Marque un changement comme traité (le supprime)
|
|
304
|
+
*/
|
|
305
|
+
async removeFromQueue(id: string): Promise<void> {
|
|
306
|
+
await this.init()
|
|
307
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
308
|
+
|
|
309
|
+
return new Promise((resolve, reject) => {
|
|
310
|
+
const transaction = this.db!.transaction([STORES.SYNC_QUEUE], "readwrite")
|
|
311
|
+
const store = transaction.objectStore(STORES.SYNC_QUEUE)
|
|
312
|
+
const request = store.delete(id)
|
|
313
|
+
|
|
314
|
+
request.onsuccess = () => resolve()
|
|
315
|
+
request.onerror = () => reject(request.error)
|
|
316
|
+
})
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
/**
|
|
320
|
+
* Met à jour le nombre de tentatives d'un changement
|
|
321
|
+
*/
|
|
322
|
+
async updateAttempts<TData>(id: string, error?: string): Promise<void> {
|
|
323
|
+
await this.init()
|
|
324
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
325
|
+
|
|
326
|
+
return new Promise((resolve, reject) => {
|
|
327
|
+
const transaction = this.db!.transaction([STORES.SYNC_QUEUE], "readwrite")
|
|
328
|
+
const store = transaction.objectStore(STORES.SYNC_QUEUE)
|
|
329
|
+
const getRequest = store.get(id)
|
|
330
|
+
|
|
331
|
+
getRequest.onsuccess = () => {
|
|
332
|
+
const item = getRequest.result as SyncQueueItem<TData> | undefined
|
|
333
|
+
if (item) {
|
|
334
|
+
item.attempts++
|
|
335
|
+
if (error) item.lastError = error
|
|
336
|
+
const putRequest = store.put(item)
|
|
337
|
+
putRequest.onsuccess = () => resolve()
|
|
338
|
+
putRequest.onerror = () => reject(putRequest.error)
|
|
339
|
+
} else {
|
|
340
|
+
resolve()
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
getRequest.onerror = () => reject(getRequest.error)
|
|
344
|
+
})
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Vide la queue de synchronisation
|
|
349
|
+
*/
|
|
350
|
+
async clearQueue(tableId: string): Promise<void> {
|
|
351
|
+
await this.init()
|
|
352
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
353
|
+
|
|
354
|
+
const items = await this.getPendingChanges(tableId)
|
|
355
|
+
|
|
356
|
+
return new Promise((resolve, reject) => {
|
|
357
|
+
const transaction = this.db!.transaction([STORES.SYNC_QUEUE], "readwrite")
|
|
358
|
+
const store = transaction.objectStore(STORES.SYNC_QUEUE)
|
|
359
|
+
|
|
360
|
+
let completed = 0
|
|
361
|
+
const total = items.length
|
|
362
|
+
|
|
363
|
+
if (total === 0) {
|
|
364
|
+
resolve()
|
|
365
|
+
return
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
items.forEach((item) => {
|
|
369
|
+
const request = store.delete(item.id)
|
|
370
|
+
request.onsuccess = () => {
|
|
371
|
+
completed++
|
|
372
|
+
if (completed === total) resolve()
|
|
373
|
+
}
|
|
374
|
+
request.onerror = () => reject(request.error)
|
|
375
|
+
})
|
|
376
|
+
})
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
// ============ CONFLICTS ============
|
|
380
|
+
|
|
381
|
+
/**
|
|
382
|
+
* Ajoute un conflit
|
|
383
|
+
*/
|
|
384
|
+
async addConflict<TData>(conflict: Omit<ConflictEntry<TData>, "id">): Promise<string> {
|
|
385
|
+
await this.init()
|
|
386
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
387
|
+
|
|
388
|
+
const id = `conflict_${conflict.tableId}_${conflict.rowId}_${Date.now()}`
|
|
389
|
+
const entry: ConflictEntry<TData> = { id, ...conflict }
|
|
390
|
+
|
|
391
|
+
return new Promise((resolve, reject) => {
|
|
392
|
+
const transaction = this.db!.transaction([STORES.CONFLICTS], "readwrite")
|
|
393
|
+
const store = transaction.objectStore(STORES.CONFLICTS)
|
|
394
|
+
const request = store.add(entry)
|
|
395
|
+
|
|
396
|
+
request.onsuccess = () => resolve(id)
|
|
397
|
+
request.onerror = () => reject(request.error)
|
|
398
|
+
})
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
/**
|
|
402
|
+
* Récupère les conflits d'une table
|
|
403
|
+
*/
|
|
404
|
+
async getConflicts<TData>(tableId: string): Promise<ConflictEntry<TData>[]> {
|
|
405
|
+
await this.init()
|
|
406
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
407
|
+
|
|
408
|
+
return new Promise((resolve, reject) => {
|
|
409
|
+
const transaction = this.db!.transaction([STORES.CONFLICTS], "readonly")
|
|
410
|
+
const store = transaction.objectStore(STORES.CONFLICTS)
|
|
411
|
+
const index = store.index("tableId")
|
|
412
|
+
const request = index.getAll(tableId)
|
|
413
|
+
|
|
414
|
+
request.onsuccess = () => resolve(request.result)
|
|
415
|
+
request.onerror = () => reject(request.error)
|
|
416
|
+
})
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
/**
|
|
420
|
+
* Supprime un conflit résolu
|
|
421
|
+
*/
|
|
422
|
+
async resolveConflict(id: string): Promise<void> {
|
|
423
|
+
await this.init()
|
|
424
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
425
|
+
|
|
426
|
+
return new Promise((resolve, reject) => {
|
|
427
|
+
const transaction = this.db!.transaction([STORES.CONFLICTS], "readwrite")
|
|
428
|
+
const store = transaction.objectStore(STORES.CONFLICTS)
|
|
429
|
+
const request = store.delete(id)
|
|
430
|
+
|
|
431
|
+
request.onsuccess = () => resolve()
|
|
432
|
+
request.onerror = () => reject(request.error)
|
|
433
|
+
})
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Vide tous les conflits d'une table
|
|
438
|
+
*/
|
|
439
|
+
async clearConflicts(tableId: string): Promise<void> {
|
|
440
|
+
await this.init()
|
|
441
|
+
if (!this.db) throw new Error("Database not initialized")
|
|
442
|
+
|
|
443
|
+
const conflicts = await this.getConflicts(tableId)
|
|
444
|
+
|
|
445
|
+
return new Promise((resolve, reject) => {
|
|
446
|
+
const transaction = this.db!.transaction([STORES.CONFLICTS], "readwrite")
|
|
447
|
+
const store = transaction.objectStore(STORES.CONFLICTS)
|
|
448
|
+
|
|
449
|
+
let completed = 0
|
|
450
|
+
const total = conflicts.length
|
|
451
|
+
|
|
452
|
+
if (total === 0) {
|
|
453
|
+
resolve()
|
|
454
|
+
return
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
conflicts.forEach((conflict) => {
|
|
458
|
+
const request = store.delete(conflict.id)
|
|
459
|
+
request.onsuccess = () => {
|
|
460
|
+
completed++
|
|
461
|
+
if (completed === total) resolve()
|
|
462
|
+
}
|
|
463
|
+
request.onerror = () => reject(request.error)
|
|
464
|
+
})
|
|
465
|
+
})
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
// ============ STATS ============
|
|
469
|
+
|
|
470
|
+
/**
|
|
471
|
+
* Obtient des statistiques sur la base de données
|
|
472
|
+
*/
|
|
473
|
+
async getStats(tableId: string): Promise<{
|
|
474
|
+
cacheSize: number
|
|
475
|
+
pendingChanges: number
|
|
476
|
+
conflicts: number
|
|
477
|
+
lastCacheUpdate: Date | null
|
|
478
|
+
}> {
|
|
479
|
+
await this.init()
|
|
480
|
+
|
|
481
|
+
const cache = await this.getCachedData(tableId)
|
|
482
|
+
const pendingChanges = await this.countPendingChanges(tableId)
|
|
483
|
+
const conflicts = await this.getConflicts(tableId)
|
|
484
|
+
|
|
485
|
+
return {
|
|
486
|
+
cacheSize: cache?.data?.length ?? 0,
|
|
487
|
+
pendingChanges,
|
|
488
|
+
conflicts: conflicts.length,
|
|
489
|
+
lastCacheUpdate: cache?.timestamp ? new Date(cache.timestamp) : null,
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// Singleton pour le service
|
|
495
|
+
let instance: IndexedDBService | null = null
|
|
496
|
+
|
|
497
|
+
export function getIndexedDBService(): IndexedDBService {
|
|
498
|
+
if (!instance) {
|
|
499
|
+
instance = new IndexedDBService()
|
|
500
|
+
}
|
|
501
|
+
return instance
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
export default IndexedDBService
|