react-native-flux-desktop 0.0.0-stage → 0.1.4
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 +172 -3
- package/README.zh-CN.md +172 -0
- package/dist/src/anim/FadeIn.d.ts +21 -0
- package/dist/src/anim/FadeIn.js +1 -0
- package/dist/src/anim/easing.d.ts +21 -0
- package/dist/src/anim/easing.js +1 -0
- package/dist/src/anim/entrance.d.ts +22 -0
- package/dist/src/anim/entrance.js +1 -0
- package/dist/src/anim/index.d.ts +22 -0
- package/dist/src/anim/index.js +1 -0
- package/dist/src/anim/layout.d.ts +26 -0
- package/dist/src/anim/layout.js +1 -0
- package/dist/src/anim/motion.d.ts +40 -0
- package/dist/src/anim/motion.js +1 -0
- package/dist/src/anim/presets.d.ts +98 -0
- package/dist/src/anim/presets.js +1 -0
- package/dist/src/anim/sequence.d.ts +15 -0
- package/dist/src/anim/sequence.js +1 -0
- package/dist/src/anim/stagger.d.ts +23 -0
- package/dist/src/anim/stagger.js +1 -0
- package/dist/src/anim/ticker.d.ts +5 -0
- package/dist/src/anim/ticker.js +1 -0
- package/dist/src/anim/transition.d.ts +21 -0
- package/dist/src/anim/transition.js +1 -0
- package/dist/src/anim/useAnimation.d.ts +14 -0
- package/dist/src/anim/useAnimation.js +1 -0
- package/dist/src/anim/useTween.d.ts +2 -0
- package/dist/src/anim/useTween.js +1 -0
- package/dist/src/app/db.d.ts +35 -0
- package/dist/src/app/db.js +1 -0
- package/dist/src/app/index.d.ts +261 -0
- package/dist/src/app/index.js +1 -0
- package/dist/src/app/tray.d.ts +65 -0
- package/dist/src/app/tray.js +1 -0
- package/dist/src/chart/area/index.d.ts +37 -0
- package/dist/src/chart/area/index.js +1 -0
- package/dist/src/chart/bar/index.d.ts +30 -0
- package/dist/src/chart/bar/index.js +1 -0
- package/dist/src/chart/boxplot/index.d.ts +29 -0
- package/dist/src/chart/boxplot/index.js +1 -0
- package/dist/src/chart/bullet/index.d.ts +34 -0
- package/dist/src/chart/bullet/index.js +1 -0
- package/dist/src/chart/calendar-heatmap/index.d.ts +31 -0
- package/dist/src/chart/calendar-heatmap/index.js +1 -0
- package/dist/src/chart/candlestick/index.d.ts +54 -0
- package/dist/src/chart/candlestick/index.js +1 -0
- package/dist/src/chart/column/index.d.ts +36 -0
- package/dist/src/chart/column/index.js +1 -0
- package/dist/src/chart/combo/index.d.ts +27 -0
- package/dist/src/chart/combo/index.js +1 -0
- package/dist/src/chart/compact-box/index.d.ts +23 -0
- package/dist/src/chart/compact-box/index.js +1 -0
- package/dist/src/chart/core/boxplot.d.ts +24 -0
- package/dist/src/chart/core/boxplot.js +1 -0
- package/dist/src/chart/core/calendar.d.ts +48 -0
- package/dist/src/chart/core/calendar.js +1 -0
- package/dist/src/chart/core/canvas-layer.d.ts +22 -0
- package/dist/src/chart/core/canvas-layer.js +1 -0
- package/dist/src/chart/core/common.d.ts +109 -0
- package/dist/src/chart/core/common.js +1 -0
- package/dist/src/chart/core/data.d.ts +17 -0
- package/dist/src/chart/core/data.js +1 -0
- package/dist/src/chart/core/flow-layout.d.ts +71 -0
- package/dist/src/chart/core/flow-layout.js +1 -0
- package/dist/src/chart/core/flow-render.d.ts +24 -0
- package/dist/src/chart/core/flow-render.js +1 -0
- package/dist/src/chart/core/geometry.d.ts +35 -0
- package/dist/src/chart/core/geometry.js +1 -0
- package/dist/src/chart/core/grid.d.ts +34 -0
- package/dist/src/chart/core/grid.js +1 -0
- package/dist/src/chart/core/histogram.d.ts +18 -0
- package/dist/src/chart/core/histogram.js +1 -0
- package/dist/src/chart/core/indicators.d.ts +32 -0
- package/dist/src/chart/core/indicators.js +1 -0
- package/dist/src/chart/core/mark.d.ts +18 -0
- package/dist/src/chart/core/mark.js +1 -0
- package/dist/src/chart/core/mindmap-layout.d.ts +49 -0
- package/dist/src/chart/core/mindmap-layout.js +1 -0
- package/dist/src/chart/core/mindmap-render.d.ts +21 -0
- package/dist/src/chart/core/mindmap-render.js +1 -0
- package/dist/src/chart/core/org-layout.d.ts +55 -0
- package/dist/src/chart/core/org-layout.js +1 -0
- package/dist/src/chart/core/org-render.d.ts +23 -0
- package/dist/src/chart/core/org-render.js +1 -0
- package/dist/src/chart/core/sankey.d.ts +50 -0
- package/dist/src/chart/core/sankey.js +1 -0
- package/dist/src/chart/core/scale.d.ts +36 -0
- package/dist/src/chart/core/scale.js +1 -0
- package/dist/src/chart/core/sunburst.d.ts +26 -0
- package/dist/src/chart/core/sunburst.js +1 -0
- package/dist/src/chart/core/theme.d.ts +36 -0
- package/dist/src/chart/core/theme.js +1 -0
- package/dist/src/chart/core/tree-layout.d.ts +67 -0
- package/dist/src/chart/core/tree-layout.js +1 -0
- package/dist/src/chart/core/tree-render.d.ts +15 -0
- package/dist/src/chart/core/tree-render.js +1 -0
- package/dist/src/chart/core/treemap.d.ts +13 -0
- package/dist/src/chart/core/treemap.js +1 -0
- package/dist/src/chart/core/violin.d.ts +24 -0
- package/dist/src/chart/core/violin.js +1 -0
- package/dist/src/chart/dendrogram/index.d.ts +26 -0
- package/dist/src/chart/dendrogram/index.js +1 -0
- package/dist/src/chart/depth/index.d.ts +31 -0
- package/dist/src/chart/depth/index.js +1 -0
- package/dist/src/chart/flow-chart/index.d.ts +27 -0
- package/dist/src/chart/flow-chart/index.js +1 -0
- package/dist/src/chart/funnel/index.d.ts +24 -0
- package/dist/src/chart/funnel/index.js +1 -0
- package/dist/src/chart/gauge/index.d.ts +25 -0
- package/dist/src/chart/gauge/index.js +1 -0
- package/dist/src/chart/heatmap/index.d.ts +27 -0
- package/dist/src/chart/heatmap/index.js +1 -0
- package/dist/src/chart/histogram/index.d.ts +27 -0
- package/dist/src/chart/histogram/index.js +1 -0
- package/dist/src/chart/indented-tree/index.d.ts +39 -0
- package/dist/src/chart/indented-tree/index.js +1 -0
- package/dist/src/chart/index.d.ts +87 -0
- package/dist/src/chart/index.js +1 -0
- package/dist/src/chart/indicator/index.d.ts +34 -0
- package/dist/src/chart/indicator/index.js +1 -0
- package/dist/src/chart/line/index.d.ts +40 -0
- package/dist/src/chart/line/index.js +1 -0
- package/dist/src/chart/mind-map/index.d.ts +35 -0
- package/dist/src/chart/mind-map/index.js +1 -0
- package/dist/src/chart/org-chart/index.d.ts +34 -0
- package/dist/src/chart/org-chart/index.js +1 -0
- package/dist/src/chart/pie/index.d.ts +29 -0
- package/dist/src/chart/pie/index.js +1 -0
- package/dist/src/chart/radar/index.d.ts +27 -0
- package/dist/src/chart/radar/index.js +1 -0
- package/dist/src/chart/radial-bar/index.d.ts +26 -0
- package/dist/src/chart/radial-bar/index.js +1 -0
- package/dist/src/chart/range-bar/index.d.ts +32 -0
- package/dist/src/chart/range-bar/index.js +1 -0
- package/dist/src/chart/rose/index.d.ts +29 -0
- package/dist/src/chart/rose/index.js +1 -0
- package/dist/src/chart/sankey/index.d.ts +31 -0
- package/dist/src/chart/sankey/index.js +1 -0
- package/dist/src/chart/scatter/index.d.ts +35 -0
- package/dist/src/chart/scatter/index.js +1 -0
- package/dist/src/chart/sparkline/index.d.ts +26 -0
- package/dist/src/chart/sparkline/index.js +1 -0
- package/dist/src/chart/sunburst/index.d.ts +28 -0
- package/dist/src/chart/sunburst/index.js +1 -0
- package/dist/src/chart/time-sharing/index.d.ts +33 -0
- package/dist/src/chart/time-sharing/index.js +1 -0
- package/dist/src/chart/treemap/index.d.ts +27 -0
- package/dist/src/chart/treemap/index.js +1 -0
- package/dist/src/chart/violin/index.d.ts +31 -0
- package/dist/src/chart/violin/index.js +1 -0
- package/dist/src/chart/waterfall/index.d.ts +30 -0
- package/dist/src/chart/waterfall/index.js +1 -0
- package/dist/src/components/index.d.ts +114 -0
- package/dist/src/components/index.js +1 -0
- package/dist/src/dev/code-block/index.d.ts +25 -0
- package/dist/src/dev/code-block/index.js +1 -0
- package/dist/src/dev/command-palette/fuzzy.d.ts +14 -0
- package/dist/src/dev/command-palette/fuzzy.js +1 -0
- package/dist/src/dev/command-palette/index.d.ts +24 -0
- package/dist/src/dev/command-palette/index.js +1 -0
- package/dist/src/dev/cron/cron.d.ts +18 -0
- package/dist/src/dev/cron/cron.js +1 -0
- package/dist/src/dev/cron/index.d.ts +11 -0
- package/dist/src/dev/cron/index.js +1 -0
- package/dist/src/dev/diff/algorithm.d.ts +18 -0
- package/dist/src/dev/diff/algorithm.js +1 -0
- package/dist/src/dev/diff-viewer/index.d.ts +20 -0
- package/dist/src/dev/diff-viewer/index.js +1 -0
- package/dist/src/dev/fps-monitor/index.d.ts +31 -0
- package/dist/src/dev/fps-monitor/index.js +1 -0
- package/dist/src/dev/highlight/tokenize.d.ts +22 -0
- package/dist/src/dev/highlight/tokenize.js +1 -0
- package/dist/src/dev/index.d.ts +31 -0
- package/dist/src/dev/index.js +1 -0
- package/dist/src/dev/json-viewer/index.d.ts +16 -0
- package/dist/src/dev/json-viewer/index.js +1 -0
- package/dist/src/dev/log-viewer/index.d.ts +22 -0
- package/dist/src/dev/log-viewer/index.js +1 -0
- package/dist/src/dev/log-viewer/logs.d.ts +22 -0
- package/dist/src/dev/log-viewer/logs.js +1 -0
- package/dist/src/dev/markdown/index.d.ts +10 -0
- package/dist/src/dev/markdown/index.js +1 -0
- package/dist/src/dev/mem-monitor/index.d.ts +19 -0
- package/dist/src/dev/mem-monitor/index.js +1 -0
- package/dist/src/dev/regex-tester/index.d.ts +17 -0
- package/dist/src/dev/regex-tester/index.js +1 -0
- package/dist/src/dev/terminal/index.d.ts +29 -0
- package/dist/src/dev/terminal/index.js +1 -0
- package/dist/src/dev/terminal/live.d.ts +23 -0
- package/dist/src/dev/terminal/live.js +1 -0
- package/dist/src/dev/terminal/screen.d.ts +52 -0
- package/dist/src/dev/terminal/screen.js +1 -0
- package/dist/src/dev/terminal/ssh.d.ts +17 -0
- package/dist/src/dev/terminal/ssh.js +1 -0
- package/dist/src/dev/terminal/view.d.ts +28 -0
- package/dist/src/dev/terminal/view.js +1 -0
- package/dist/src/dev/time-conv/index.d.ts +13 -0
- package/dist/src/dev/time-conv/index.js +1 -0
- package/dist/src/dev/time-conv/timeconv.d.ts +24 -0
- package/dist/src/dev/time-conv/timeconv.js +1 -0
- package/dist/src/events/coordinator.d.ts +23 -0
- package/dist/src/events/coordinator.js +1 -0
- package/dist/src/events/drop.d.ts +15 -0
- package/dist/src/events/drop.js +1 -0
- package/dist/src/events/editable.d.ts +44 -0
- package/dist/src/events/editable.js +1 -0
- package/dist/src/events/hit.d.ts +26 -0
- package/dist/src/events/hit.js +1 -0
- package/dist/src/events/textinput.d.ts +14 -0
- package/dist/src/events/textinput.js +1 -0
- package/dist/src/events/useOverlayGate.d.ts +5 -0
- package/dist/src/events/useOverlayGate.js +1 -0
- package/dist/src/frame/scheduler.d.ts +4 -0
- package/dist/src/frame/scheduler.js +1 -0
- package/dist/src/index.d.ts +40 -0
- package/dist/src/index.js +170 -0
- package/dist/src/io/audio/engine.d.ts +73 -0
- package/dist/src/io/audio/engine.js +1 -0
- package/dist/src/io/audio/ffmpeg.d.ts +16 -0
- package/dist/src/io/audio/ffmpeg.js +1 -0
- package/dist/src/io/audio/mac-av.d.ts +9 -0
- package/dist/src/io/audio/mac-av.js +47 -0
- package/dist/src/io/audio/win-mci.d.ts +16 -0
- package/dist/src/io/audio/win-mci.js +1 -0
- package/dist/src/io/audio-output/index.d.ts +23 -0
- package/dist/src/io/audio-output/index.js +1 -0
- package/dist/src/io/audio-output/waveform.d.ts +21 -0
- package/dist/src/io/audio-output/waveform.js +1 -0
- package/dist/src/io/chart-export/index.d.ts +14 -0
- package/dist/src/io/chart-export/index.js +1 -0
- package/dist/src/io/dialog.d.ts +29 -0
- package/dist/src/io/dialog.js +1 -0
- package/dist/src/io/file-picker/index.d.ts +26 -0
- package/dist/src/io/file-picker/index.js +1 -0
- package/dist/src/io/file-saver/index.d.ts +24 -0
- package/dist/src/io/file-saver/index.js +1 -0
- package/dist/src/io/index.d.ts +14 -0
- package/dist/src/io/index.js +1 -0
- package/dist/src/io/video/frames.d.ts +63 -0
- package/dist/src/io/video/frames.js +1 -0
- package/dist/src/io/video/registry.d.ts +12 -0
- package/dist/src/io/video/registry.js +1 -0
- package/dist/src/io/video/sample.d.ts +1 -0
- package/dist/src/io/video/sample.js +1 -0
- package/dist/src/io/video-output/index.d.ts +21 -0
- package/dist/src/io/video-output/index.js +1 -0
- package/dist/src/layout/yoga.d.ts +33 -0
- package/dist/src/layout/yoga.js +1 -0
- package/dist/src/log/core.d.ts +46 -0
- package/dist/src/log/core.js +1 -0
- package/dist/src/log/index.d.ts +25 -0
- package/dist/src/log/index.js +1 -0
- package/dist/src/main.d.ts +1 -0
- package/dist/src/main.js +1 -0
- package/dist/src/paint/fonts.d.ts +16 -0
- package/dist/src/paint/fonts.js +1 -0
- package/dist/src/paint/painter.d.ts +67 -0
- package/dist/src/paint/painter.js +1 -0
- package/dist/src/paint/textLayout.d.ts +54 -0
- package/dist/src/paint/textLayout.js +1 -0
- package/dist/src/pro/check-card/index.d.ts +49 -0
- package/dist/src/pro/check-card/index.js +1 -0
- package/dist/src/pro/highlight/index.d.ts +17 -0
- package/dist/src/pro/highlight/index.js +1 -0
- package/dist/src/pro/index.d.ts +18 -0
- package/dist/src/pro/index.js +1 -0
- package/dist/src/pro/price-card/index.d.ts +48 -0
- package/dist/src/pro/price-card/index.js +1 -0
- package/dist/src/pro/pro-card/index.d.ts +52 -0
- package/dist/src/pro/pro-card/index.js +1 -0
- package/dist/src/pro/pro-descriptions/index.d.ts +29 -0
- package/dist/src/pro/pro-descriptions/index.js +1 -0
- package/dist/src/pro/pro-form/index.d.ts +66 -0
- package/dist/src/pro/pro-form/index.js +1 -0
- package/dist/src/pro/pro-table/index.d.ts +51 -0
- package/dist/src/pro/pro-table/index.js +1 -0
- package/dist/src/pro/stat-card/index.d.ts +41 -0
- package/dist/src/pro/stat-card/index.js +1 -0
- package/dist/src/pro/trend-card/index.d.ts +35 -0
- package/dist/src/pro/trend-card/index.js +1 -0
- package/dist/src/reconciler/index.d.ts +15 -0
- package/dist/src/reconciler/index.js +1 -0
- package/dist/src/renderer/index.d.ts +14 -0
- package/dist/src/renderer/index.js +1 -0
- package/dist/src/scene/node.d.ts +113 -0
- package/dist/src/scene/node.js +1 -0
- package/dist/src/style/flatten.d.ts +50 -0
- package/dist/src/style/flatten.js +1 -0
- package/dist/src/system/constants.d.ts +98 -0
- package/dist/src/system/constants.js +1 -0
- package/dist/src/system/index.d.ts +4 -0
- package/dist/src/system/index.js +1 -0
- package/dist/src/system/stats.d.ts +83 -0
- package/dist/src/system/stats.js +1 -0
- package/dist/src/theme/ConfigContext.d.ts +25 -0
- package/dist/src/theme/ConfigContext.js +1 -0
- package/dist/src/theme/FluxProvider.d.ts +26 -0
- package/dist/src/theme/FluxProvider.js +1 -0
- package/dist/src/theme/ThemeContext.d.ts +17 -0
- package/dist/src/theme/ThemeContext.js +1 -0
- package/dist/src/theme/componentTokens.d.ts +9 -0
- package/dist/src/theme/componentTokens.js +1 -0
- package/dist/src/theme/index.d.ts +8 -0
- package/dist/src/theme/index.js +1 -0
- package/dist/src/theme/interface/alias.d.ts +47 -0
- package/dist/src/theme/interface/alias.js +1 -0
- package/dist/src/theme/interface/components.d.ts +301 -0
- package/dist/src/theme/interface/components.js +1 -0
- package/dist/src/theme/interface/config.d.ts +21 -0
- package/dist/src/theme/interface/config.js +1 -0
- package/dist/src/theme/interface/index.d.ts +5 -0
- package/dist/src/theme/interface/index.js +1 -0
- package/dist/src/theme/interface/maps.d.ts +79 -0
- package/dist/src/theme/interface/maps.js +1 -0
- package/dist/src/theme/interface/seed.d.ts +47 -0
- package/dist/src/theme/interface/seed.js +1 -0
- package/dist/src/theme/themes/index.d.ts +5 -0
- package/dist/src/theme/themes/index.js +1 -0
- package/dist/src/theme/themes/seed.d.ts +3 -0
- package/dist/src/theme/themes/seed.js +1 -0
- package/dist/src/theme/themes/shared/index.d.ts +14 -0
- package/dist/src/theme/themes/shared/index.js +1 -0
- package/dist/src/theme/useToken.d.ts +10 -0
- package/dist/src/theme/useToken.js +1 -0
- package/dist/src/types.d.ts +170 -0
- package/dist/src/types.js +1 -0
- package/dist/src/ui/affix/index.d.ts +14 -0
- package/dist/src/ui/affix/index.js +1 -0
- package/dist/src/ui/alert/index.d.ts +26 -0
- package/dist/src/ui/alert/index.js +1 -0
- package/dist/src/ui/anchor/index.d.ts +25 -0
- package/dist/src/ui/anchor/index.js +1 -0
- package/dist/src/ui/app/index.d.ts +34 -0
- package/dist/src/ui/app/index.js +1 -0
- package/dist/src/ui/auto-complete/index.d.ts +28 -0
- package/dist/src/ui/auto-complete/index.js +1 -0
- package/dist/src/ui/avatar/index.d.ts +34 -0
- package/dist/src/ui/avatar/index.js +1 -0
- package/dist/src/ui/back-top/index.d.ts +17 -0
- package/dist/src/ui/back-top/index.js +1 -0
- package/dist/src/ui/badge/index.d.ts +40 -0
- package/dist/src/ui/badge/index.js +1 -0
- package/dist/src/ui/breadcrumb/index.d.ts +21 -0
- package/dist/src/ui/breadcrumb/index.js +1 -0
- package/dist/src/ui/button/index.d.ts +27 -0
- package/dist/src/ui/button/index.js +1 -0
- package/dist/src/ui/calendar/index.d.ts +45 -0
- package/dist/src/ui/calendar/index.js +1 -0
- package/dist/src/ui/card/index.d.ts +34 -0
- package/dist/src/ui/card/index.js +1 -0
- package/dist/src/ui/carousel/index.d.ts +26 -0
- package/dist/src/ui/carousel/index.js +1 -0
- package/dist/src/ui/cascader/index.d.ts +37 -0
- package/dist/src/ui/cascader/index.js +1 -0
- package/dist/src/ui/cell/index.d.ts +23 -0
- package/dist/src/ui/cell/index.js +1 -0
- package/dist/src/ui/checkbox/index.d.ts +36 -0
- package/dist/src/ui/checkbox/index.js +1 -0
- package/dist/src/ui/collapse/index.d.ts +35 -0
- package/dist/src/ui/collapse/index.js +1 -0
- package/dist/src/ui/color-picker/index.d.ts +27 -0
- package/dist/src/ui/color-picker/index.js +1 -0
- package/dist/src/ui/context-menu/index.d.ts +3 -0
- package/dist/src/ui/context-menu/index.js +1 -0
- package/dist/src/ui/count-down/index.d.ts +31 -0
- package/dist/src/ui/count-down/index.js +1 -0
- package/dist/src/ui/date-picker/index.d.ts +30 -0
- package/dist/src/ui/date-picker/index.js +1 -0
- package/dist/src/ui/descriptions/index.d.ts +26 -0
- package/dist/src/ui/descriptions/index.js +1 -0
- package/dist/src/ui/divider/index.d.ts +17 -0
- package/dist/src/ui/divider/index.js +1 -0
- package/dist/src/ui/drag/index.d.ts +59 -0
- package/dist/src/ui/drag/index.js +1 -0
- package/dist/src/ui/drawer/index.d.ts +27 -0
- package/dist/src/ui/drawer/index.js +1 -0
- package/dist/src/ui/dropdown/index.d.ts +51 -0
- package/dist/src/ui/dropdown/index.js +1 -0
- package/dist/src/ui/empty/index.d.ts +15 -0
- package/dist/src/ui/empty/index.js +1 -0
- package/dist/src/ui/flex/index.d.ts +15 -0
- package/dist/src/ui/flex/index.js +1 -0
- package/dist/src/ui/float-button/index.d.ts +44 -0
- package/dist/src/ui/float-button/index.js +1 -0
- package/dist/src/ui/form/index.d.ts +47 -0
- package/dist/src/ui/form/index.js +1 -0
- package/dist/src/ui/grid/index.d.ts +29 -0
- package/dist/src/ui/grid/index.js +1 -0
- package/dist/src/ui/icon/index.d.ts +31 -0
- package/dist/src/ui/icon/index.js +1 -0
- package/dist/src/ui/icon/paths.d.ts +14 -0
- package/dist/src/ui/icon/paths.js +1 -0
- package/dist/src/ui/image/index.d.ts +29 -0
- package/dist/src/ui/image/index.js +1 -0
- package/dist/src/ui/image/preview.d.ts +18 -0
- package/dist/src/ui/image/preview.js +1 -0
- package/dist/src/ui/image/usePreloadImages.d.ts +2 -0
- package/dist/src/ui/image/usePreloadImages.js +1 -0
- package/dist/src/ui/index.d.ts +164 -0
- package/dist/src/ui/index.js +1 -0
- package/dist/src/ui/infinite-scroll/index.d.ts +28 -0
- package/dist/src/ui/infinite-scroll/index.js +1 -0
- package/dist/src/ui/input/index.d.ts +27 -0
- package/dist/src/ui/input/index.js +1 -0
- package/dist/src/ui/input-number/index.d.ts +28 -0
- package/dist/src/ui/input-number/index.js +1 -0
- package/dist/src/ui/input-otp/index.d.ts +21 -0
- package/dist/src/ui/input-otp/index.js +1 -0
- package/dist/src/ui/layout/index.d.ts +41 -0
- package/dist/src/ui/layout/index.js +1 -0
- package/dist/src/ui/list/index.d.ts +41 -0
- package/dist/src/ui/list/index.js +1 -0
- package/dist/src/ui/masonry/index.d.ts +23 -0
- package/dist/src/ui/masonry/index.js +1 -0
- package/dist/src/ui/mentions/index.d.ts +29 -0
- package/dist/src/ui/mentions/index.js +1 -0
- package/dist/src/ui/menu/index.d.ts +34 -0
- package/dist/src/ui/menu/index.js +1 -0
- package/dist/src/ui/message/index.d.ts +62 -0
- package/dist/src/ui/message/index.js +1 -0
- package/dist/src/ui/modal/index.d.ts +80 -0
- package/dist/src/ui/modal/index.js +1 -0
- package/dist/src/ui/notification/index.d.ts +83 -0
- package/dist/src/ui/notification/index.js +1 -0
- package/dist/src/ui/pagination/index.d.ts +26 -0
- package/dist/src/ui/pagination/index.js +1 -0
- package/dist/src/ui/popconfirm/index.d.ts +31 -0
- package/dist/src/ui/popconfirm/index.js +1 -0
- package/dist/src/ui/popover/index.d.ts +20 -0
- package/dist/src/ui/popover/index.js +1 -0
- package/dist/src/ui/pro/pro-descriptions/index.js +1 -0
- package/dist/src/ui/pro/pro-table/index.js +1 -0
- package/dist/src/ui/pro/stat-card/index.js +1 -0
- package/dist/src/ui/progress/index.d.ts +32 -0
- package/dist/src/ui/progress/index.js +1 -0
- package/dist/src/ui/qr-code/index.d.ts +29 -0
- package/dist/src/ui/qr-code/index.js +1 -0
- package/dist/src/ui/radio/index.d.ts +53 -0
- package/dist/src/ui/radio/index.js +1 -0
- package/dist/src/ui/rate/index.d.ts +24 -0
- package/dist/src/ui/rate/index.js +1 -0
- package/dist/src/ui/result/index.d.ts +14 -0
- package/dist/src/ui/result/index.js +1 -0
- package/dist/src/ui/search/index.d.ts +12 -0
- package/dist/src/ui/search/index.js +1 -0
- package/dist/src/ui/segmented/index.d.ts +23 -0
- package/dist/src/ui/segmented/index.js +1 -0
- package/dist/src/ui/select/index.d.ts +32 -0
- package/dist/src/ui/select/index.js +1 -0
- package/dist/src/ui/skeleton/index.d.ts +43 -0
- package/dist/src/ui/skeleton/index.js +1 -0
- package/dist/src/ui/slider/index.d.ts +22 -0
- package/dist/src/ui/slider/index.js +1 -0
- package/dist/src/ui/space/index.d.ts +16 -0
- package/dist/src/ui/space/index.js +1 -0
- package/dist/src/ui/spin/index.d.ts +15 -0
- package/dist/src/ui/spin/index.js +1 -0
- package/dist/src/ui/splitter/index.d.ts +31 -0
- package/dist/src/ui/splitter/index.js +1 -0
- package/dist/src/ui/statistic/index.d.ts +27 -0
- package/dist/src/ui/statistic/index.js +1 -0
- package/dist/src/ui/steps/index.d.ts +49 -0
- package/dist/src/ui/steps/index.js +1 -0
- package/dist/src/ui/switch/index.d.ts +17 -0
- package/dist/src/ui/switch/index.js +1 -0
- package/dist/src/ui/table/index.d.ts +61 -0
- package/dist/src/ui/table/index.js +1 -0
- package/dist/src/ui/tabs/index.d.ts +33 -0
- package/dist/src/ui/tabs/index.js +1 -0
- package/dist/src/ui/tag/index.d.ts +31 -0
- package/dist/src/ui/tag/index.js +1 -0
- package/dist/src/ui/tag-input/index.d.ts +21 -0
- package/dist/src/ui/tag-input/index.js +1 -0
- package/dist/src/ui/text-area/index.d.ts +29 -0
- package/dist/src/ui/text-area/index.js +1 -0
- package/dist/src/ui/text-select/index.d.ts +3 -0
- package/dist/src/ui/text-select/index.js +1 -0
- package/dist/src/ui/time-picker/index.d.ts +31 -0
- package/dist/src/ui/time-picker/index.js +1 -0
- package/dist/src/ui/timeline/index.d.ts +29 -0
- package/dist/src/ui/timeline/index.js +1 -0
- package/dist/src/ui/todo/index.d.ts +53 -0
- package/dist/src/ui/todo/index.js +1 -0
- package/dist/src/ui/tooltip/index.d.ts +20 -0
- package/dist/src/ui/tooltip/index.js +1 -0
- package/dist/src/ui/transfer/index.d.ts +24 -0
- package/dist/src/ui/transfer/index.js +1 -0
- package/dist/src/ui/tree/index.d.ts +38 -0
- package/dist/src/ui/tree/index.js +1 -0
- package/dist/src/ui/tree-select/index.d.ts +27 -0
- package/dist/src/ui/tree-select/index.js +1 -0
- package/dist/src/ui/typography/index.d.ts +69 -0
- package/dist/src/ui/typography/index.js +1 -0
- package/dist/src/ui/upload/index.d.ts +30 -0
- package/dist/src/ui/upload/index.js +1 -0
- package/dist/src/ui/virtual-list/index.d.ts +21 -0
- package/dist/src/ui/virtual-list/index.js +1 -0
- package/dist/src/ui/watermark/index.d.ts +25 -0
- package/dist/src/ui/watermark/index.js +1 -0
- package/dist/src/utils/color.d.ts +38 -0
- package/dist/src/utils/color.js +1 -0
- package/dist/src/utils/timezone.d.ts +34 -0
- package/dist/src/utils/timezone.js +1 -0
- package/dist/src/web3/address/index.d.ts +27 -0
- package/dist/src/web3/address/index.js +1 -0
- package/dist/src/web3/avatar/index.d.ts +14 -0
- package/dist/src/web3/avatar/index.js +1 -0
- package/dist/src/web3/coin-icon/coins-data.d.ts +2 -0
- package/dist/src/web3/coin-icon/coins-data.js +1 -0
- package/dist/src/web3/coin-icon/index.d.ts +16 -0
- package/dist/src/web3/coin-icon/index.js +1 -0
- package/dist/src/web3/coin-icon/svgs.d.ts +24 -0
- package/dist/src/web3/coin-icon/svgs.js +1 -0
- package/dist/src/web3/index.d.ts +16 -0
- package/dist/src/web3/index.js +1 -0
- package/dist/src/web3/nft-card/index.d.ts +32 -0
- package/dist/src/web3/nft-card/index.js +1 -0
- package/dist/src/web3/price-range/index.d.ts +19 -0
- package/dist/src/web3/price-range/index.js +1 -0
- package/dist/src/web3/token-price/index.d.ts +28 -0
- package/dist/src/web3/token-price/index.js +1 -0
- package/dist/src/web3/utils.d.ts +31 -0
- package/dist/src/web3/utils.js +1 -0
- package/dist/src/window/app-icon.d.ts +5 -0
- package/dist/src/window/app-icon.js +1 -0
- package/dist/src/window/clipboard.d.ts +4 -0
- package/dist/src/window/clipboard.js +1 -0
- package/dist/src/window/contextmenu.d.ts +21 -0
- package/dist/src/window/contextmenu.js +1 -0
- package/dist/src/window/drag.d.ts +70 -0
- package/dist/src/window/drag.js +1 -0
- package/dist/src/window/gpu2d-proxy.d.ts +79 -0
- package/dist/src/window/gpu2d-proxy.js +1 -0
- package/dist/src/window/host.d.ts +243 -0
- package/dist/src/window/host.js +1 -0
- package/dist/src/window/instance.d.ts +41 -0
- package/dist/src/window/instance.js +1 -0
- package/dist/src/window/platform.d.ts +150 -0
- package/dist/src/window/platform.js +1 -0
- package/dist/src/window/textselect.d.ts +17 -0
- package/dist/src/window/textselect.js +1 -0
- package/dist/src/window/winit-window.d.ts +122 -0
- package/dist/src/window/winit-window.js +1 -0
- package/index.d.ts +213 -0
- package/index.js +363 -0
- package/package.json +28 -5
- package/react-native-flux-desktop.node +0 -0
- package/react-native-flux-desktop.win32-x64-msvc.node +0 -0
package/README.md
CHANGED
|
@@ -1,3 +1,172 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
# react-native-flux-desktop
|
|
2
|
+
|
|
3
|
+
> 🖥️ A self-drawn desktop render stack — build desktop apps in React (JSX); every pixel is painted by Skia onto a window from our self-developed native base. No Electron, no Qt, no native controls.
|
|
4
|
+
|
|
5
|
+
  
|
|
6
|
+
|
|
7
|
+
**Depends on:** `@napi-rs/canvas` (Skia raster) · `react-reconciler` · `yoga-layout` · `react` (peer)
|
|
8
|
+
**This is the UI core** — the `-chart` / `-pro` / `-dev` / `-web3` / `-webview` packages all take it as a peer dependency to pull core symbols back.
|
|
9
|
+
|
|
10
|
+
> 📦 This repo is the **compiled distribution**: `index.js` (napi loader) + `*.node` (native binary) + `dist/src` (built library JS + type declarations). Source lives in a separate repo; only the ready-to-`require` artifact is published here.
|
|
11
|
+
|
|
12
|
+
[中文文档](./README.zh-CN.md)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Gallery
|
|
17
|
+
|
|
18
|
+
<table>
|
|
19
|
+
<tr>
|
|
20
|
+
<td align="center"><b>Welcome · dark</b><br/><img src="./shots/gallery-dark.png" alt="Gallery hero (dark)" /></td>
|
|
21
|
+
<td align="center"><b>Welcome · light</b><br/><img src="./shots/gallery-light.png" alt="Gallery hero (light)" /></td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td align="center"><b>Design tokens</b><br/><img src="./shots/theme.png" alt="Theme token system" /></td>
|
|
25
|
+
<td align="center"><b>Charts · Dendrogram</b><br/><img src="./shots/dendrogram.png" alt="Dendrogram chart" /></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td align="center"><b>Web3 · CoinIcon</b><br/><img src="./shots/coinicon.png" alt="Coin icon grid" /></td>
|
|
29
|
+
<td align="center"><b>Web3 · Crypto live dashboard</b><br/><img src="./shots/crypto-live.png" alt="Crypto live dashboard" /></td>
|
|
30
|
+
</tr>
|
|
31
|
+
</table>
|
|
32
|
+
|
|
33
|
+
*The screenshots above span the whole ecosystem (core UI + chart + web3), rendered entirely by this self-drawn stack — no browser involved.*
|
|
34
|
+
|
|
35
|
+
> 🎮 **See it live.** Every screenshot above — and 100+ more interactive demos — run in the gallery showcase app. Browse its source at **[react-native-flux-desktop-gallery](https://github.com/keyonByIos/react-native-flux-desktop-gallery)**.
|
|
36
|
+
|
|
37
|
+
## What it is
|
|
38
|
+
|
|
39
|
+
`react-native-flux-desktop` is a **custom React Renderer**: it implements the `react-reconciler` host interface, maps the element tree into a self-managed **scene graph**, lays it out with **Yoga**, rasterizes every pixel with **Skia**, and blits the result onto a window driven by our **self-developed native base** (`napi-rs` layer). It ships with 80+ self-drawn components aligned with Ant Design v5's API & token model, a full theme system, and an animation library.
|
|
40
|
+
|
|
41
|
+
## Highlights
|
|
42
|
+
|
|
43
|
+
- **80+ self-drawn components** — `Button` / `Input` / `Select` / `Menu` / `Table` / `Modal` / `Drawer` / `Tabs` / `DatePicker` / `Tree` / `Upload` …
|
|
44
|
+
- **Token theme system** — light / dark × density (compact / loose) × primary color, three orthogonal stackable axes, one `useToken` call to read them.
|
|
45
|
+
- **Animation library** — tween (`useTween`), spring (`useSpring`), enter presets (`FadeIn` / `MoveIn` / `ScaleIn`), stagger (`Stagger`), FLIP, sequence orchestration.
|
|
46
|
+
- **Multi-window + tray** — many windows per process, system tray, single-instance lock with "wake the old window".
|
|
47
|
+
- **Lightweight persistence** — a built-in KV store (`Application.user` / `kv`), no external database needed.
|
|
48
|
+
- **CPU / GPU backends** — the same drawing code, switchable presentation tier per machine / scenario, with DPR capping.
|
|
49
|
+
- **Zero embedded browser** — the core has no WebView; opt in via the separate `-webview` package when you need it.
|
|
50
|
+
|
|
51
|
+
## Install
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install react-native-flux-desktop
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Pulls in `@napi-rs/canvas` / `react-reconciler` / `yoga-layout`; `react@18` is a peer. The native binary is published per platform (currently: Windows x64 MSVC).
|
|
58
|
+
|
|
59
|
+
## Usage
|
|
60
|
+
|
|
61
|
+
Declare a window with `<Window>` at the root, then commit the whole tree with `render()`:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import React from 'react';
|
|
65
|
+
import { render, Window, View, Text, Pressable } from 'react-native-flux-desktop';
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
const [count, setCount] = React.useState(0);
|
|
69
|
+
return (
|
|
70
|
+
<Window title="Hello Flux" width={520} height={420}>
|
|
71
|
+
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
|
72
|
+
<Text style={{ fontSize: 22 }}>count: {count}</Text>
|
|
73
|
+
<Pressable onPress={() => setCount((c) => c + 1)}
|
|
74
|
+
style={{ marginTop: 16, padding: 12, borderRadius: 8, backgroundColor: '#1677ff' }}>
|
|
75
|
+
<Text style={{ color: '#fff' }}>+1</Text>
|
|
76
|
+
</Pressable>
|
|
77
|
+
</View>
|
|
78
|
+
</Window>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
render(React.createElement(App));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
Wrap the component tree with the token theme provider:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { FluxProvider } from 'react-native-flux-desktop';
|
|
89
|
+
render(<FluxProvider dark><MyApp /></FluxProvider>);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Capabilities
|
|
93
|
+
|
|
94
|
+
**Native layer (napi)**
|
|
95
|
+
- Windows: create / close / multi-window, title, size / position, maximize / minimize / restore, borderless / transparent, DPR, cursor, taskbar icon (AUMID)
|
|
96
|
+
- System tray: create / swap icon / tooltip, event callbacks · clipboard read/write · offscreen capture (`grabPixels`)
|
|
97
|
+
- Key-value persistence: `kvOpen` / `kvPut` / `kvGet` / `kvDel` / `kvKeys` / `kvCompact`
|
|
98
|
+
|
|
99
|
+
**JS layer (`dist/src`)**
|
|
100
|
+
- `render` / `hotReload` / `grabAll` · `Window` / `View` / `Text` / `Image` / `Pressable` / `ScrollView`
|
|
101
|
+
- `Application` global singleton: window registry · `config` (theme / prefs / render tier) · `user` (persistence) · `relaunch` · `log`
|
|
102
|
+
- Theme: `FluxProvider` / `useToken` / `createTheme` · Animation: `useTween` / `useSpring` / `FadeIn` / `Stagger` / `Flip` …
|
|
103
|
+
- Fonts: `registerFonts` / `listFontFamilies` · Logging: `configureLogger` / `readLogTail` · Runtime metrics: `systemStats` · Single instance: `acquireSingleInstance` / `onSecondInstance`
|
|
104
|
+
|
|
105
|
+
See `index.d.ts` and `dist/src/index.d.ts` for the full symbol list.
|
|
106
|
+
|
|
107
|
+
## Renderer modes: CPU / GPU
|
|
108
|
+
|
|
109
|
+
The same drawing code supports two presentation paths, switchable at runtime (persisted via `Application.config`; takes effect after restart):
|
|
110
|
+
|
|
111
|
+
- **CPU** — `softbuffer` per-frame blit; best compatibility, no GPU-driver dependency.
|
|
112
|
+
- **GPU** — Skia Ganesh + GL `flush/swap` direct present; cheaper for large / frequently-repainted scenes.
|
|
113
|
+
|
|
114
|
+
DPR (resolution multiple) can be capped to control cost; in GPU mode the window size is bound to the native scale.
|
|
115
|
+
|
|
116
|
+
## Fonts & assets
|
|
117
|
+
|
|
118
|
+
Fonts are declared as app resources in **`app.json`**, injected via env at entry, and registered before the first frame by `registerFonts()`:
|
|
119
|
+
|
|
120
|
+
```jsonc
|
|
121
|
+
{
|
|
122
|
+
"defaultFont": "", // global default family (empty = built-in)
|
|
123
|
+
"fonts": [
|
|
124
|
+
{ "family": "Arial", "file": "C:/Windows/Fonts/arial.ttf", "bold": "C:/Windows/Fonts/arialbd.ttf" },
|
|
125
|
+
{ "family": "MySans", "file": "assets/fonts/my-sans.ttf" } // relative path is auto-embedded with assets/
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- **Global font**: `Application.setFont(family)` → writes the preference + restart (affects global layout metrics).
|
|
131
|
+
- **Local font**: `<Text style={{ fontFamily: 'Arial' }}>` → hot-swaps just that subtree, immediately.
|
|
132
|
+
- **Tofu fallback chain**: when the primary font lacks a glyph, it falls back to a built-in CJK-capable font, so Chinese still renders under a Latin-only font.
|
|
133
|
+
|
|
134
|
+
## Ecosystem (separated packages)
|
|
135
|
+
|
|
136
|
+
Component families are split into independently published packages, all taking this package as an **optional peerDependency** to pull core symbols back — keeping the core lean, opt-in, and sharing a single React instance:
|
|
137
|
+
|
|
138
|
+
| Package | Role | Deps |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| **react-native-flux-desktop** | Render stack + base UI kit + theme + animation + native capabilities (this repo) | — |
|
|
141
|
+
| **react-native-flux-desktop-chart** | Chart suite (Skia-drawn, `@ant-design/charts`-style data model) | core |
|
|
142
|
+
| **react-native-flux-desktop-pro** | Higher-order composites (ProTable / ProForm / ProCard / TrendCard …) | core + chart |
|
|
143
|
+
| **react-native-flux-desktop-dev** | Developer / diagnostic components (CodeBlock / Markdown / JsonViewer / DiffViewer / Terminal / MemMonitor …) | core + chart |
|
|
144
|
+
| **react-native-flux-desktop-web3** | Web3 / crypto UI (CoinIcon / Address / TokenPrice / NFTCard …) | core |
|
|
145
|
+
| **react-native-flux-desktop-webview** | Optional WebView (Chromium / WebView2, view-only + JS bridge; ships its own `.node`) | core |
|
|
146
|
+
| **react-native-flux-desktop-ffi** | Optional native-library calls (`libloading` + `libffi`: declarative signatures → call any C-ABI DLL/dylib/.so export; ships its own `.node`) | core (optional) |
|
|
147
|
+
| **react-native-flux-desktop-packer** | Packaging CLI (`flux-pack`: Go launcher + `go:embed` → self-contained `.exe`) | devDependency |
|
|
148
|
+
| **react-native-flux-desktop-gallery** | Runnable demo showcase app (100+ demos) consuming all of the above — [view demos here](https://github.com/keyonByIos/react-native-flux-desktop-gallery) | all packages |
|
|
149
|
+
|
|
150
|
+
All repos live at `github.com/keyonByIos/<package-name>`.
|
|
151
|
+
|
|
152
|
+
## Package into .exe
|
|
153
|
+
|
|
154
|
+
Use `react-native-flux-desktop-packer`: install as a devDependency, set `output` / `main` in `app.json`, then:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npx flux-pack
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
Produces a self-contained Windows `.exe` (Go launcher + embedded payload, including the `assets/` tree).
|
|
161
|
+
|
|
162
|
+
## Notes
|
|
163
|
+
|
|
164
|
+
- **Platform**: the native binary currently targets **Windows x64 (MSVC)**; Node `>= 18`.
|
|
165
|
+
- The `-webview` child surface is based on WebView2 (Chromium); Windows needs the **WebView2 Runtime** installed. It is a separate opt-in package — the core never bundles it.
|
|
166
|
+
- This repo is a compiled artifact; `dist/` and `*.node` are the published content (kept out of `.gitignore` intentionally so `git add` includes them).
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
MIT
|
|
171
|
+
|
|
172
|
+
> 中文文档见 [README.zh-CN.md](./README.zh-CN.md)。
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# react-native-flux-desktop(中文文档)
|
|
2
|
+
|
|
3
|
+
> 🖥️ 纯自绘的桌面渲染栈 —— 用 React(JSX)写桌面应用,每一个像素都由 Skia 直接绘制在自研底座的窗口上。不依赖 Electron / Qt / 任何系统原生控件。
|
|
4
|
+
|
|
5
|
+
  
|
|
6
|
+
|
|
7
|
+
**依赖:** `@napi-rs/canvas`(Skia 光栅)· `react-reconciler` · `yoga-layout` · `react`(peer)
|
|
8
|
+
**本包即 UI 核心** —— `-chart` / `-pro` / `-dev` / `-web3` / `-webview` 等独立包都以它为 peer 依赖回取核心符号。
|
|
9
|
+
|
|
10
|
+
> 📦 本仓库为**编译分发产物**:`index.js`(napi 装载器)+ `*.node`(原生二进制)+ `dist/src`(编译后的库 JS + 类型声明)。源码在独立仓库,此处只发布可直接 `require` / `npm install` 的成品。
|
|
11
|
+
|
|
12
|
+
[English](./README.md)
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## 界面一览
|
|
17
|
+
|
|
18
|
+
<table>
|
|
19
|
+
<tr>
|
|
20
|
+
<td align="center"><b>欢迎页 · 暗色</b><br/><img src="./shots/gallery-dark.png" alt="Gallery 首页(暗色)" /></td>
|
|
21
|
+
<td align="center"><b>欢迎页 · 亮色</b><br/><img src="./shots/gallery-light.png" alt="Gallery 首页(亮色)" /></td>
|
|
22
|
+
</tr>
|
|
23
|
+
<tr>
|
|
24
|
+
<td align="center"><b>设计 Token</b><br/><img src="./shots/theme.png" alt="主题 Token 体系" /></td>
|
|
25
|
+
<td align="center"><b>图表 · 水平生态树</b><br/><img src="./shots/dendrogram.png" alt="水平生态树图" /></td>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td align="center"><b>Web3 · 币种图标</b><br/><img src="./shots/coinicon.png" alt="币种图标墙" /></td>
|
|
29
|
+
<td align="center"><b>Web3 · 币价实时看板</b><br/><img src="./shots/crypto-live.png" alt="币价实时看板" /></td>
|
|
30
|
+
</tr>
|
|
31
|
+
</table>
|
|
32
|
+
|
|
33
|
+
*以上截图横跨整个生态(核心 UI + 图表 + Web3),全部由这套自绘栈渲染 —— 全程无浏览器参与。*
|
|
34
|
+
|
|
35
|
+
> 🎮 **看实际运行效果。** 以上每一张截图 —— 以及 100+ 个可交互 demo —— 都跑在 gallery 展示应用里。源码见 **[react-native-flux-desktop-gallery](https://github.com/keyonByIos/react-native-flux-desktop-gallery)**。
|
|
36
|
+
|
|
37
|
+
## 它是什么
|
|
38
|
+
|
|
39
|
+
`react-native-flux-desktop` 是一个**自绘的 React Renderer**:它实现 `react-reconciler` 的宿主接口,把元素树映射成自定义**场景树**,经 **Yoga** 布局、由 **Skia** 逐像素光栅化,最后 blit 到**自研底座**(`napi-rs` 原生层)驱动的窗口上屏。内置 80+ 自绘组件(对齐 Ant Design v5 的 API 与 token)、完整的主题系统与动画库。
|
|
40
|
+
|
|
41
|
+
## 特性亮点
|
|
42
|
+
|
|
43
|
+
- **纯自绘组件族** 80+:`Button` / `Input` / `Select` / `Menu` / `Table` / `Modal` / `Drawer` / `Tabs` / `DatePicker` / `Tree` / `Upload` …
|
|
44
|
+
- **token 主题系统**:明 / 暗 × 密度(紧凑 / 宽松)× 主色,三维正交可叠加,`useToken` 一处取色。
|
|
45
|
+
- **动画库**:补间 `useTween` · 弹簧 `useSpring` · 进场 `FadeIn` / `MoveIn` / `ScaleIn` · 错峰 `Stagger` · FLIP · 序列编排 · 预设墙。
|
|
46
|
+
- **多窗口 + 托盘**:一进程多窗、系统托盘、单实例锁与「次实例唤起老窗」。
|
|
47
|
+
- **轻量持久化**:内置 KV 存储(`Application.user` / `kv`),无需外部数据库。
|
|
48
|
+
- **CPU / GPU 双后端**:同一套绘制,按机器 / 场景切换上屏档位,支持 DPR 封顶。
|
|
49
|
+
- **零内嵌浏览器**:核心不含 WebView,需要时以独立可选包 `-webview` 引入。
|
|
50
|
+
|
|
51
|
+
## 安装
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install react-native-flux-desktop
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
自动带来 `@napi-rs/canvas` / `react-reconciler` / `yoga-layout`;`react@18` 为 peer。原生二进制按平台随包发布(当前:Windows x64 MSVC)。
|
|
58
|
+
|
|
59
|
+
## 用法
|
|
60
|
+
|
|
61
|
+
根节点用 `<Window>` 声明一扇窗,`render()` 提交整棵树:
|
|
62
|
+
|
|
63
|
+
```tsx
|
|
64
|
+
import React from 'react';
|
|
65
|
+
import { render, Window, View, Text, Pressable } from 'react-native-flux-desktop';
|
|
66
|
+
|
|
67
|
+
function App() {
|
|
68
|
+
const [count, setCount] = React.useState(0);
|
|
69
|
+
return (
|
|
70
|
+
<Window title="Hello Flux" width={520} height={420}>
|
|
71
|
+
<View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
|
|
72
|
+
<Text style={{ fontSize: 22 }}>点我:{count}</Text>
|
|
73
|
+
<Pressable onPress={() => setCount((c) => c + 1)}
|
|
74
|
+
style={{ marginTop: 16, padding: 12, borderRadius: 8, backgroundColor: '#1677ff' }}>
|
|
75
|
+
<Text style={{ color: '#fff' }}>+1</Text>
|
|
76
|
+
</Pressable>
|
|
77
|
+
</View>
|
|
78
|
+
</Window>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
render(React.createElement(App));
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
用 token 主题包裹组件族:
|
|
86
|
+
|
|
87
|
+
```tsx
|
|
88
|
+
import { FluxProvider } from 'react-native-flux-desktop';
|
|
89
|
+
render(<FluxProvider dark><MyApp /></FluxProvider>);
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## 能力清单
|
|
93
|
+
|
|
94
|
+
**原生层(napi)**
|
|
95
|
+
- 窗口:创建 / 关闭 / 多窗、标题、尺寸 / 位置、最大化 / 最小化 / 还原、无边框 / 透明、DPR、光标、任务栏图标(AUMID)
|
|
96
|
+
- 系统托盘:建 / 换图标 / 提示、事件回抛 · 剪贴板读写 · 离屏抓帧(`grabPixels`)
|
|
97
|
+
- 键值持久化:`kvOpen` / `kvPut` / `kvGet` / `kvDel` / `kvKeys` / `kvCompact`
|
|
98
|
+
|
|
99
|
+
**JS 层(`dist/src`)**
|
|
100
|
+
- `render` / `hotReload` / `grabAll` · `Window` / `View` / `Text` / `Image` / `Pressable` / `ScrollView`
|
|
101
|
+
- `Application` 全局单例:窗口注册表 · `config`(主题 / 偏好 / 渲染档位)· `user`(持久化)· `relaunch` · `log`
|
|
102
|
+
- 主题:`FluxProvider` / `useToken` / `createTheme` · 动画:`useTween` / `useSpring` / `FadeIn` / `Stagger` / `Flip` …
|
|
103
|
+
- 字体:`registerFonts` / `listFontFamilies` · 日志:`configureLogger` / `readLogTail` · 运行时取数:`systemStats` · 单实例:`acquireSingleInstance` / `onSecondInstance`
|
|
104
|
+
|
|
105
|
+
完整符号见 `index.d.ts` 与 `dist/src/index.d.ts`。
|
|
106
|
+
|
|
107
|
+
## 渲染档位:CPU / GPU
|
|
108
|
+
|
|
109
|
+
同一套绘制支持两种上屏方式,运行时可切换(`Application.config` 持久化偏好,切换后重启生效):
|
|
110
|
+
|
|
111
|
+
- **CPU** — `softbuffer` 逐帧 blit,兼容性最好、无 GPU 驱动依赖。
|
|
112
|
+
- **GPU** — Skia Ganesh + GL `flush/swap` 直呈,大画面 / 高频重绘更省。
|
|
113
|
+
|
|
114
|
+
DPR(分辨率倍数)可封顶以控成本;GPU 模式下窗口尺寸恒绑原生 scale。
|
|
115
|
+
|
|
116
|
+
## 字体与资源
|
|
117
|
+
|
|
118
|
+
字体在 **`app.json`** 里声明为应用资源,经入口注入环境变量,首帧前由 `registerFonts()` 注册:
|
|
119
|
+
|
|
120
|
+
```jsonc
|
|
121
|
+
{
|
|
122
|
+
"defaultFont": "", // 全局默认族(留空走内置)
|
|
123
|
+
"fonts": [
|
|
124
|
+
{ "family": "Arial", "file": "C:/Windows/Fonts/arial.ttf", "bold": "C:/Windows/Fonts/arialbd.ttf" },
|
|
125
|
+
{ "family": "MySans", "file": "assets/fonts/my-sans.ttf" } // 相对路径随包 assets/ 自动内嵌
|
|
126
|
+
]
|
|
127
|
+
}
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
- **全局字体**:`Application.setFont(family)` → 写偏好 + 重启(影响全局布局度量)。
|
|
131
|
+
- **局部字体**:`<Text style={{ fontFamily: 'Arial' }}>` → 该子树热更新,即时生效。
|
|
132
|
+
- **豆腐兜底链**:主字体缺字时自动回落内置含 CJK 的字体,纯拉丁字体下中文仍正常显示。
|
|
133
|
+
|
|
134
|
+
## 生态(已拆分的独立包)
|
|
135
|
+
|
|
136
|
+
组件族按能力拆成若干**独立发布包**,均以本包为 **peerDependency**(可选)回取核心符号 —— 保持核心精简、按需引入、共享单一 React 实例:
|
|
137
|
+
|
|
138
|
+
| 包 | 角色 | 依赖 |
|
|
139
|
+
| --- | --- | --- |
|
|
140
|
+
| **react-native-flux-desktop** | 渲染栈 + 基础 UI 组件族 + 主题 + 动画 + 原生能力(本仓库) | — |
|
|
141
|
+
| **react-native-flux-desktop-chart** | 图表族(Skia 自绘,`@ant-design/charts` 风格数据模型) | core |
|
|
142
|
+
| **react-native-flux-desktop-pro** | 高阶复合组件(ProTable / ProForm / ProCard / TrendCard …) | core + chart |
|
|
143
|
+
| **react-native-flux-desktop-dev** | 开发者 / 诊断组件(CodeBlock / Markdown / JsonViewer / DiffViewer / Terminal / MemMonitor …) | core + chart |
|
|
144
|
+
| **react-native-flux-desktop-web3** | Web3 / 加密 UI(CoinIcon / Address / TokenPrice / NFTCard …) | core |
|
|
145
|
+
| **react-native-flux-desktop-webview** | 可选 WebView(Chromium / WebView2,view-only + JS 双向桥;自带 `.node`) | core |
|
|
146
|
+
| **react-native-flux-desktop-ffi** | 可选原生库调用(`libloading` + `libffi`:声明式签名 → 调用任意 C ABI 的 DLL/dylib/so 导出;自带 `.node`) | core(可选) |
|
|
147
|
+
| **react-native-flux-desktop-packer** | 打包 CLI(`flux-pack`:Go launcher + `go:embed` → 自包含 `.exe`) | devDependency |
|
|
148
|
+
| **react-native-flux-desktop-gallery** | 可运行的 demo 展示应用(100+ 个)消费以上全部包 —— [在此查看示例](https://github.com/keyonByIos/react-native-flux-desktop-gallery) | 全部包 |
|
|
149
|
+
|
|
150
|
+
各仓库均在 `github.com/keyonByIos/<包名>`。
|
|
151
|
+
|
|
152
|
+
## 打包成 exe
|
|
153
|
+
|
|
154
|
+
用 `react-native-flux-desktop-packer`:装为 devDependency,在 `app.json` 配 `output` / `main`,运行:
|
|
155
|
+
|
|
156
|
+
```bash
|
|
157
|
+
npx flux-pack
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
产出自包含的 Windows `.exe`(Go 启动器 + 内嵌 payload,含 `assets/` 资源树)。
|
|
161
|
+
|
|
162
|
+
## 说明
|
|
163
|
+
|
|
164
|
+
- **平台**:当前原生二进制面向 **Windows x64(MSVC)**;Node `>= 18`。
|
|
165
|
+
- `-webview` 子面基于 WebView2(Chromium),Windows 需系统装有 **WebView2 Runtime**;它是独立可选包,主包默认不含。
|
|
166
|
+
- 本仓库为编译产物,`dist/` 与 `*.node` 即发布内容(已从 `.gitignore` 放开,`git add` 会纳入)。
|
|
167
|
+
|
|
168
|
+
## 许可证
|
|
169
|
+
|
|
170
|
+
MIT
|
|
171
|
+
|
|
172
|
+
> English 版见 [README.md](./README.md)。
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from '../types';
|
|
3
|
+
export declare function useEnter(duration?: number): number;
|
|
4
|
+
export interface FadeInProps {
|
|
5
|
+
children: React.ReactNode;
|
|
6
|
+
duration?: number;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
/** 透传给内部容器:供浮层实测自身尺寸(如 Tooltip 居中对齐触发器) */
|
|
9
|
+
onLayout?: (e: {
|
|
10
|
+
nativeEvent: {
|
|
11
|
+
layout: {
|
|
12
|
+
x: number;
|
|
13
|
+
y: number;
|
|
14
|
+
w: number;
|
|
15
|
+
h: number;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
}) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function FadeIn(props: FadeInProps): React.ReactElement;
|
|
21
|
+
export default FadeIn;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.useEnter=useEnter,exports.FadeIn=FadeIn;const react_1=__importDefault(require("react")),react_2=require("react"),components_1=require("../components"),ticker_1=require("./ticker"),ConfigContext_1=require("../theme/ConfigContext"),easing_1=require("./easing");function useEnter(e=240){const t=(0,ConfigContext_1.useAnimationEnabled)(),[r,n]=(0,react_2.useState)(t?0:1);return(0,react_2.useEffect)(()=>{if(!t)return void n(1);let r=null,u=(0,ticker_1.subscribe)(t=>{null==r&&(r=t);const o=e<=0?1:(t-r)/e;o>=1?(n(1),u()):n((0,easing_1.easeOutCubic)(o))});return()=>u()},[e,t]),t?r:1}function FadeIn(e){const{children:t,duration:r=240,style:n,onLayout:u}=e,o=useEnter(r);return react_1.default.createElement(components_1.View,{style:[{opacity:o},n],onLayout:u},t)}exports.default=FadeIn;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export type Easing = (t: number) => number;
|
|
2
|
+
export declare const linear: Easing;
|
|
3
|
+
export declare const easeInQuad: Easing;
|
|
4
|
+
export declare const easeOutQuad: Easing;
|
|
5
|
+
export declare const easeOutCubic: Easing;
|
|
6
|
+
export declare const easeInOutCubic: Easing;
|
|
7
|
+
/** 先快后慢带回弹,适合入场。 */
|
|
8
|
+
export declare const easeOutBack: Easing;
|
|
9
|
+
/** 正弦脉冲:0→1→0,适合呼吸/闪烁。 */
|
|
10
|
+
export declare const sinePulse: Easing;
|
|
11
|
+
/** 弹性出场(欠阻尼振荡逼近),末端多次回弹,适合俏皮入场。 */
|
|
12
|
+
export declare const easeOutElastic: Easing;
|
|
13
|
+
/**
|
|
14
|
+
* 阻尼弹簧闭合解(欠阻尼):输出可 >1(过冲后回摆),t=1 强制收敛到 1。
|
|
15
|
+
* dampingRatio<1 振荡(越小越弹);>=1 走临界阻尼无过冲。frequency 为每秒振荡周期数(越大越快到位)。
|
|
16
|
+
* 用于「一次性入场/切换」的弹簧感;实时交互/手势跟随请用 useSpring(物理积分,帧率无关)。
|
|
17
|
+
*/
|
|
18
|
+
export declare function spring(options?: {
|
|
19
|
+
dampingRatio?: number;
|
|
20
|
+
frequency?: number;
|
|
21
|
+
}): Easing;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.easeOutElastic=exports.sinePulse=exports.easeOutBack=exports.easeInOutCubic=exports.easeOutCubic=exports.easeOutQuad=exports.easeInQuad=exports.linear=void 0,exports.spring=spring;const linear=e=>e;exports.linear=linear;const easeInQuad=e=>e*e;exports.easeInQuad=easeInQuad;const easeOutQuad=e=>e*(2-e);exports.easeOutQuad=easeOutQuad;const easeOutCubic=e=>1-Math.pow(1-e,3);exports.easeOutCubic=easeOutCubic;const easeInOutCubic=e=>e<.5?4*e*e*e:1-Math.pow(-2*e+2,3)/2;exports.easeInOutCubic=easeInOutCubic;const easeOutBack=e=>1+2.70158*Math.pow(e-1,3)+1.70158*Math.pow(e-1,2);exports.easeOutBack=easeOutBack;const sinePulse=e=>.5-.5*Math.cos(e*Math.PI*2);exports.sinePulse=sinePulse;const easeOutElastic=e=>{const t=2*Math.PI/3;return e<=0?0:e>=1?1:Math.pow(2,-10*e)*Math.sin((10*e-.75)*t)+1};function spring(e={}){const t=e.dampingRatio??.6,s=(e.frequency??3)*Math.PI*2;if(t>=1)return e=>e<=0?0:e>=1?1:1-Math.exp(-s*e)*(1+s*e);const a=s*Math.sqrt(1-t*t);return e=>e<=0?0:e>=1?1:1-Math.exp(-t*s*e)*(Math.cos(a*e)+t*s/a*Math.sin(a*e))}exports.easeOutElastic=easeOutElastic;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle } from '../types';
|
|
3
|
+
interface Base {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
duration?: number;
|
|
6
|
+
fade?: boolean;
|
|
7
|
+
style?: StyleProp<ViewStyle>;
|
|
8
|
+
}
|
|
9
|
+
/** 平移入场。direction = 元素「进入时的来向」:up=从下方上移落位,left=从右方左移落位。 */
|
|
10
|
+
export declare function MoveIn(props: Base & {
|
|
11
|
+
direction?: 'up' | 'down' | 'left' | 'right';
|
|
12
|
+
distance?: number;
|
|
13
|
+
}): React.ReactElement;
|
|
14
|
+
/** 缩放入场:from → 1。 */
|
|
15
|
+
export declare function ScaleIn(props: Base & {
|
|
16
|
+
from?: number;
|
|
17
|
+
}): React.ReactElement;
|
|
18
|
+
/** 旋转入场:from(度) → 0。 */
|
|
19
|
+
export declare function RotateIn(props: Base & {
|
|
20
|
+
from?: number;
|
|
21
|
+
}): React.ReactElement;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.MoveIn=MoveIn,exports.ScaleIn=ScaleIn,exports.RotateIn=RotateIn;const react_1=__importDefault(require("react")),components_1=require("../components"),FadeIn_1=require("./FadeIn");function MoveIn(e){const{children:t,direction:n="up",distance:r=24,duration:o=280,fade:a=!0,style:c}=e,s=(0,FadeIn_1.useEnter)(o),l=1-s;let u=0,i=0;"up"===n?i=r*l:"down"===n?i=-r*l:u="left"===n?r*l:-r*l;const d=[{translateX:u},{translateY:i}];return react_1.default.createElement(components_1.View,{style:[{transform:d,opacity:a?s:1},c]},t)}function ScaleIn(e){const{children:t,from:n=.8,duration:r=240,fade:o=!0,style:a}=e,c=(0,FadeIn_1.useEnter)(r),s=n+(1-n)*c;return react_1.default.createElement(components_1.View,{style:[{transform:[{scale:s}],opacity:o?c:1},a]},t)}function RotateIn(e){const{children:t,from:n=-90,duration:r=320,fade:o=!0,style:a}=e,c=(0,FadeIn_1.useEnter)(r),s=n*(1-c);return react_1.default.createElement(components_1.View,{style:[{transform:[{rotate:`${s}deg`}],opacity:o?c:1},a]},t)}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { subscribe } from './ticker';
|
|
2
|
+
export type { TickerCallback } from './ticker';
|
|
3
|
+
export * as Easing from './easing';
|
|
4
|
+
export type { Easing as EasingFn } from './easing';
|
|
5
|
+
export { useAnimation } from './useAnimation';
|
|
6
|
+
export type { AnimationOptions } from './useAnimation';
|
|
7
|
+
export { useTween } from './useTween';
|
|
8
|
+
export { FadeIn, useEnter } from './FadeIn';
|
|
9
|
+
export type { FadeInProps } from './FadeIn';
|
|
10
|
+
export { MoveIn, ScaleIn, RotateIn } from './entrance';
|
|
11
|
+
export { useMotionValue, useSpring, useTransformTween } from './motion';
|
|
12
|
+
export type { MotionOptions, TransformSpec } from './motion';
|
|
13
|
+
export { Flip, useFlip } from './layout';
|
|
14
|
+
export type { FlipProps, FlipOptions } from './layout';
|
|
15
|
+
export { presets, styleAt } from './presets';
|
|
16
|
+
export type { AnimPreset, AnimState, PresetName } from './presets';
|
|
17
|
+
export { Stagger, StaggerItem } from './stagger';
|
|
18
|
+
export type { StaggerProps, StaggerItemProps } from './stagger';
|
|
19
|
+
export { Transition, useTransition } from './transition';
|
|
20
|
+
export type { TransitionProps, TransitionOptions } from './transition';
|
|
21
|
+
export { runSequence } from './sequence';
|
|
22
|
+
export type { SequenceStep, SequenceHandle } from './sequence';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __createBinding=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r);var o=Object.getOwnPropertyDescriptor(t,r);o&&!("get"in o?!t.__esModule:o.writable||o.configurable)||(o={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,n,o)}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),__setModuleDefault=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),__importStar=this&&this.__importStar||function(){var e=function(t){return e=Object.getOwnPropertyNames||function(e){var t=[];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[t.length]=r);return t},e(t)};return function(t){if(t&&t.__esModule)return t;var r={};if(null!=t)for(var n=e(t),o=0;o<n.length;o++)"default"!==n[o]&&__createBinding(r,t,n[o]);return __setModuleDefault(r,t),r}}();Object.defineProperty(exports,"__esModule",{value:!0}),exports.runSequence=exports.useTransition=exports.Transition=exports.StaggerItem=exports.Stagger=exports.styleAt=exports.presets=exports.useFlip=exports.Flip=exports.useTransformTween=exports.useSpring=exports.useMotionValue=exports.RotateIn=exports.ScaleIn=exports.MoveIn=exports.useEnter=exports.FadeIn=exports.useTween=exports.useAnimation=exports.Easing=exports.subscribe=void 0;var ticker_1=require("./ticker");Object.defineProperty(exports,"subscribe",{enumerable:!0,get:function(){return ticker_1.subscribe}}),exports.Easing=__importStar(require("./easing"));var useAnimation_1=require("./useAnimation");Object.defineProperty(exports,"useAnimation",{enumerable:!0,get:function(){return useAnimation_1.useAnimation}});var useTween_1=require("./useTween");Object.defineProperty(exports,"useTween",{enumerable:!0,get:function(){return useTween_1.useTween}});var FadeIn_1=require("./FadeIn");Object.defineProperty(exports,"FadeIn",{enumerable:!0,get:function(){return FadeIn_1.FadeIn}}),Object.defineProperty(exports,"useEnter",{enumerable:!0,get:function(){return FadeIn_1.useEnter}});var entrance_1=require("./entrance");Object.defineProperty(exports,"MoveIn",{enumerable:!0,get:function(){return entrance_1.MoveIn}}),Object.defineProperty(exports,"ScaleIn",{enumerable:!0,get:function(){return entrance_1.ScaleIn}}),Object.defineProperty(exports,"RotateIn",{enumerable:!0,get:function(){return entrance_1.RotateIn}});var motion_1=require("./motion");Object.defineProperty(exports,"useMotionValue",{enumerable:!0,get:function(){return motion_1.useMotionValue}}),Object.defineProperty(exports,"useSpring",{enumerable:!0,get:function(){return motion_1.useSpring}}),Object.defineProperty(exports,"useTransformTween",{enumerable:!0,get:function(){return motion_1.useTransformTween}});var layout_1=require("./layout");Object.defineProperty(exports,"Flip",{enumerable:!0,get:function(){return layout_1.Flip}}),Object.defineProperty(exports,"useFlip",{enumerable:!0,get:function(){return layout_1.useFlip}});var presets_1=require("./presets");Object.defineProperty(exports,"presets",{enumerable:!0,get:function(){return presets_1.presets}}),Object.defineProperty(exports,"styleAt",{enumerable:!0,get:function(){return presets_1.styleAt}});var stagger_1=require("./stagger");Object.defineProperty(exports,"Stagger",{enumerable:!0,get:function(){return stagger_1.Stagger}}),Object.defineProperty(exports,"StaggerItem",{enumerable:!0,get:function(){return stagger_1.StaggerItem}});var transition_1=require("./transition");Object.defineProperty(exports,"Transition",{enumerable:!0,get:function(){return transition_1.Transition}}),Object.defineProperty(exports,"useTransition",{enumerable:!0,get:function(){return transition_1.useTransition}});var sequence_1=require("./sequence");Object.defineProperty(exports,"runSequence",{enumerable:!0,get:function(){return sequence_1.runSequence}});
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { StyleProp, ViewStyle, TransformArray } from '../types';
|
|
3
|
+
import { type Easing } from './easing';
|
|
4
|
+
export interface FlipOptions {
|
|
5
|
+
duration?: number;
|
|
6
|
+
/** 传入 spring() 结果可让 FLIP 带过冲回弹 */
|
|
7
|
+
easing?: Easing;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* 测量宿主盒绝对位置,检测跳变并产出「反演→恒等」的补间 transform。
|
|
11
|
+
* 用法:把 onLayoutAbs 挂到元素上、transform + transformOrigin:'0 0' 塞进 style。
|
|
12
|
+
*/
|
|
13
|
+
export declare function useFlip(options?: FlipOptions): {
|
|
14
|
+
onLayoutAbs: (e: any) => void;
|
|
15
|
+
transform: TransformArray;
|
|
16
|
+
};
|
|
17
|
+
export interface FlipProps extends FlipOptions {
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
style?: StyleProp<ViewStyle>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 声明式 FLIP 容器:包一层 View,自动测盒 + 反演补间。
|
|
23
|
+
* transformOrigin 固定 '0 0'(左上角),使缩放把「旧盒」精确套到「新盒」上(左对齐、按比例);
|
|
24
|
+
* 纯位移场景(尺寸不变)缩放分量恒为 1,不会拉伸子内容。
|
|
25
|
+
*/
|
|
26
|
+
export declare function Flip(props: FlipProps): React.ReactElement;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __importDefault=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(exports,"__esModule",{value:!0}),exports.useFlip=useFlip,exports.Flip=Flip;const react_1=__importDefault(require("react")),react_2=require("react"),components_1=require("../components"),ticker_1=require("./ticker"),ConfigContext_1=require("../theme/ConfigContext"),easing_1=require("./easing");function useFlip(e={}){const t=e.duration??320,r=(0,ConfigContext_1.useAnimationEnabled)(),n=(0,react_2.useRef)(e.easing??easing_1.easeOutCubic);n.current=e.easing??easing_1.easeOutCubic;const a=(0,react_2.useRef)(null),[s,u]=(0,react_2.useState)([]),i=(0,react_2.useRef)(()=>{});return(0,react_2.useEffect)(()=>()=>i.current(),[]),{onLayoutAbs:e=>{const s=e.nativeEvent.layout,o=a.current;if(a.current=s,!o)return;if(!r)return i.current(),void u([]);const c=o.x-s.x,l=o.y-s.y,_=s.w>0?o.w/s.w:1,f=s.h>0?o.h/s.h:1;if(Math.abs(c)<.5&&Math.abs(l)<.5&&Math.abs(_-1)<.01&&Math.abs(f-1)<.01)return;i.current();let p=null;i.current=(0,ticker_1.subscribe)(e=>{null==p&&(p=e);const r=t<=0?1:(e-p)/t;if(r>=1)return u([]),void i.current();const a=1-n.current(r),s=[];(Math.abs(c*a)>.1||Math.abs(l*a)>.1)&&s.push({translateX:c*a},{translateY:l*a}),(Math.abs(_-1)>.01||Math.abs(f-1)>.01)&&s.push({scaleX:1+(_-1)*a},{scaleY:1+(f-1)*a}),u(s)})},transform:s}}function Flip(e){const{children:t,style:r,duration:n,easing:a}=e,{onLayoutAbs:s,transform:u}=useFlip({duration:n,easing:a});return react_1.default.createElement(components_1.View,{style:[{transform:u,transformOrigin:"0 0"},r],onLayoutAbs:s},t)}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type Easing } from './easing';
|
|
2
|
+
import { TransformArray } from '../types';
|
|
3
|
+
export interface MotionOptions {
|
|
4
|
+
/** 'tween' 定时补间(默认)| 'spring' 物理弹簧 */
|
|
5
|
+
mode?: 'tween' | 'spring';
|
|
6
|
+
/** tween 时长(ms) */
|
|
7
|
+
duration?: number;
|
|
8
|
+
/** tween 缓动函数 */
|
|
9
|
+
easing?: Easing;
|
|
10
|
+
/** spring 刚度(越大越快越硬) */
|
|
11
|
+
stiffness?: number;
|
|
12
|
+
/** spring 阻尼(越大越少回弹) */
|
|
13
|
+
damping?: number;
|
|
14
|
+
/** spring 质量 */
|
|
15
|
+
mass?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* 单一订阅循环内按 mode 分支:tween 走定时缓动,spring 走半隐式欧拉积分(子步保稳)。
|
|
19
|
+
* 只在 hook 顶层调用一次 subscribe,规避「条件调用 hook」。静止即退订,不空转。
|
|
20
|
+
*/
|
|
21
|
+
export declare function useMotionValue(target: number, options?: MotionOptions): number;
|
|
22
|
+
/** 物理弹簧值:target 变化时从当前速度继续,适合交互/手势。config 用原始值传入避免每帧换引用重启。 */
|
|
23
|
+
export declare function useSpring(target: number, config?: {
|
|
24
|
+
stiffness?: number;
|
|
25
|
+
damping?: number;
|
|
26
|
+
mass?: number;
|
|
27
|
+
}): number;
|
|
28
|
+
/** 变换目标(各分量可选,缺省按恒等:位移 0、缩放 1、旋转 0)。 */
|
|
29
|
+
export interface TransformSpec {
|
|
30
|
+
translateX?: number;
|
|
31
|
+
translateY?: number;
|
|
32
|
+
scale?: number;
|
|
33
|
+
rotate?: number;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* 把目标变换逐分量平滑到最新值,返回可直接用于 style.transform 的数组。
|
|
37
|
+
* 分量固定调用 4 次 useMotionValue(不随 target 键增减而变),符合 hook 规则。
|
|
38
|
+
* 全部落回恒等时 parseTransform 返回 null → painter 走快速路径,静止零开销。
|
|
39
|
+
*/
|
|
40
|
+
export declare function useTransformTween(target: TransformSpec, options?: MotionOptions): TransformArray;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.useMotionValue=useMotionValue,exports.useSpring=useSpring,exports.useTransformTween=useTransformTween;const react_1=require("react"),ticker_1=require("./ticker"),ConfigContext_1=require("../theme/ConfigContext"),easing_1=require("./easing");function useMotionValue(e,t={}){const{mode:r="tween",duration:n=220,easing:u=easing_1.easeOutCubic,stiffness:s=170,damping:a=20,mass:o=1}=t,i=(0,ConfigContext_1.useAnimationEnabled)(),[c,l]=(0,react_1.useState)(e),f=(0,react_1.useRef)(c);f.current=c;const _=(0,react_1.useRef)(0),M=(0,react_1.useRef)(u);return M.current=u,(0,react_1.useEffect)(()=>{if(!i)return l(e),f.current=e,void(_.current=0);const t=f.current;if(Math.abs(t-e)<1e-4)return void l(e);let u=()=>{};if("tween"===r){let r=null;u=(0,ticker_1.subscribe)(s=>{null==r&&(r=s);const a=n<=0?1:(s-r)/n;a>=1?(l(e),f.current=e,_.current=0,u()):l(t+(e-t)*M.current(a))})}else{let t=null;u=(0,ticker_1.subscribe)(r=>{if(null==t)return void(t=r);let n=(r-t)/1e3;t=r,n>.064&&(n=.064);const i=Math.max(1,Math.ceil(n/.008)),c=n/i;let M=f.current,g=_.current;for(let t=0;t<i;t++)g+=(-s*(M-e)-a*g)/o*c,M+=g*c;f.current=M,_.current=g,Math.abs(g)<.01&&Math.abs(M-e)<.01?(l(e),f.current=e,_.current=0,u()):l(M)})}return()=>u()},[e,r,n,s,a,o,i]),i?c:e}function useSpring(e,t={}){return useMotionValue(e,{mode:"spring",...t})}function useTransformTween(e,t={}){return[{translateX:useMotionValue(e.translateX??0,t)},{translateY:useMotionValue(e.translateY??0,t)},{scale:useMotionValue(e.scale??1,t)},{rotate:`${useMotionValue(e.rotate??0,t)}deg`}]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { TransformArray } from '../types';
|
|
2
|
+
import { type Easing } from './easing';
|
|
3
|
+
export interface AnimState {
|
|
4
|
+
opacity?: number;
|
|
5
|
+
translateX?: number;
|
|
6
|
+
translateY?: number;
|
|
7
|
+
scale?: number;
|
|
8
|
+
rotate?: number;
|
|
9
|
+
}
|
|
10
|
+
export interface AnimPreset {
|
|
11
|
+
/** 入场/退场共用时长(ms) */
|
|
12
|
+
duration: number;
|
|
13
|
+
easing: Easing;
|
|
14
|
+
/** 隐藏态(进度 0) */
|
|
15
|
+
from: AnimState;
|
|
16
|
+
}
|
|
17
|
+
declare const IDLE: AnimState;
|
|
18
|
+
/** 按进度 p∈[0,1] 把预设插值成绘制样式(p=1 落位、p=0 隐藏态)。 */
|
|
19
|
+
export declare function styleAt(preset: AnimPreset, p: number): {
|
|
20
|
+
opacity: number;
|
|
21
|
+
transform: TransformArray;
|
|
22
|
+
};
|
|
23
|
+
/** 预设库:命名对齐 framer-motion / antd 惯例。 */
|
|
24
|
+
export declare const presets: {
|
|
25
|
+
/** 纯淡入淡出 */
|
|
26
|
+
fade: {
|
|
27
|
+
duration: number;
|
|
28
|
+
easing: Easing;
|
|
29
|
+
from: {
|
|
30
|
+
opacity: number;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
/** 从下方上滑落位(最常用入场) */
|
|
34
|
+
slideUp: {
|
|
35
|
+
duration: number;
|
|
36
|
+
easing: Easing;
|
|
37
|
+
from: {
|
|
38
|
+
opacity: number;
|
|
39
|
+
translateY: number;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
/** 从上方下滑落位(下拉面板/通知) */
|
|
43
|
+
slideDown: {
|
|
44
|
+
duration: number;
|
|
45
|
+
easing: Easing;
|
|
46
|
+
from: {
|
|
47
|
+
opacity: number;
|
|
48
|
+
translateY: number;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
/** 从右侧滑入(抽屉/侧栏) */
|
|
52
|
+
slideLeft: {
|
|
53
|
+
duration: number;
|
|
54
|
+
easing: Easing;
|
|
55
|
+
from: {
|
|
56
|
+
opacity: number;
|
|
57
|
+
translateX: number;
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
/** 从左侧滑入 */
|
|
61
|
+
slideRight: {
|
|
62
|
+
duration: number;
|
|
63
|
+
easing: Easing;
|
|
64
|
+
from: {
|
|
65
|
+
opacity: number;
|
|
66
|
+
translateX: number;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
/** 缩放弹出:略过冲回弹,适合气泡/弹窗 */
|
|
70
|
+
pop: {
|
|
71
|
+
duration: number;
|
|
72
|
+
easing: Easing;
|
|
73
|
+
from: {
|
|
74
|
+
opacity: number;
|
|
75
|
+
scale: number;
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
/** 弹性放大:多次回弹,适合俏皮场合 */
|
|
79
|
+
bounce: {
|
|
80
|
+
duration: number;
|
|
81
|
+
easing: Easing;
|
|
82
|
+
from: {
|
|
83
|
+
opacity: number;
|
|
84
|
+
scale: number;
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
/** 弹簧落位(ζ=0.7 近似不过冲) */
|
|
88
|
+
springUp: {
|
|
89
|
+
duration: number;
|
|
90
|
+
easing: Easing;
|
|
91
|
+
from: {
|
|
92
|
+
opacity: number;
|
|
93
|
+
translateY: number;
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
export type PresetName = keyof typeof presets;
|
|
98
|
+
export { IDLE };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.IDLE=exports.presets=void 0,exports.styleAt=styleAt;const easing_1=require("./easing"),IDLE={opacity:1,translateX:0,translateY:0,scale:1,rotate:0};function styleAt(e,a){const t=e.from,s=(e,t)=>e+(t-e)*a;return{opacity:s(t.opacity??1,1),transform:[{translateX:s(t.translateX??0,0)},{translateY:s(t.translateY??0,0)},{scale:s(t.scale??1,1)},{rotate:`${s(t.rotate??0,0)}deg`}]}}exports.IDLE=IDLE,exports.presets={fade:{duration:240,easing:easing_1.easeOutCubic,from:{opacity:0}},slideUp:{duration:320,easing:easing_1.easeOutCubic,from:{opacity:0,translateY:24}},slideDown:{duration:320,easing:easing_1.easeOutCubic,from:{opacity:0,translateY:-24}},slideLeft:{duration:320,easing:easing_1.easeOutCubic,from:{opacity:0,translateX:24}},slideRight:{duration:320,easing:easing_1.easeOutCubic,from:{opacity:0,translateX:-24}},pop:{duration:300,easing:easing_1.easeOutBack,from:{opacity:0,scale:.8}},bounce:{duration:640,easing:easing_1.easeOutElastic,from:{opacity:0,scale:.6}},springUp:{duration:520,easing:(0,easing_1.spring)({dampingRatio:.7,frequency:2.2}),from:{opacity:0,translateY:32}}};
|