@fox-js/fox 3.1.1-24 → 3.1.1-25

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.
@@ -1,11 +1,8 @@
1
1
  import { App } from 'vue';
2
- import { ComponentInternalInstance } from 'vue';
3
2
  import { ComponentOptionsMixin } from 'vue';
4
3
  import { ComponentProvideOptions } from 'vue';
5
- import { ComponentPublicInstance } from 'vue';
6
4
  import { DefineComponent } from 'vue';
7
5
  import { ExtractPropTypes } from 'vue';
8
- import { InjectionKey } from 'vue';
9
6
  import { PropType } from 'vue';
10
7
  import { PublicProps } from 'vue';
11
8
  import { Ref } from 'vue';
@@ -48,6 +45,12 @@ declare interface BeforeRouteFilter {
48
45
  }, session: Record<string | number | symbol, any>): void;
49
46
  }
50
47
 
48
+ /**
49
+ * 在当前scope中绑定Lifecycle context
50
+ * @params 扩展范围引用
51
+ */
52
+ export declare function bindLifecycleContextToCurrentScope(extScopeRefs?: Array<Object>): boolean;
53
+
51
54
  declare const _buildPage: unique symbol;
52
55
 
53
56
  /**
@@ -126,15 +129,15 @@ declare const cursorKey: unique symbol;
126
129
  /**
127
130
  * 自定义过渡
128
131
  */
129
- export declare type CustomTransition = 'custom';
132
+ declare type CustomTransition = 'custom';
130
133
 
131
134
  /**
132
135
  * 删除 context value
133
- * @param proxy
136
+ * @param refKey
134
137
  * @param key
135
138
  *
136
139
  */
137
- export declare function deleteContextValue(proxy: ComponentPublicInstance, key: KeyType_2): void;
140
+ export declare function deleteContextValue(refKey: LifecycleContextKey | null, key: KeyType_2, route?: Route): void;
138
141
 
139
142
  declare const _destroy: unique symbol;
140
143
 
@@ -439,8 +442,9 @@ export declare interface Fox {
439
442
  /**
440
443
  * 安装
441
444
  * @param app
445
+ * @param options
442
446
  */
443
- install(app: App<Element>): void;
447
+ install(app: App<Element>, options?: FoxInstallOptions): void;
444
448
  }
445
449
 
446
450
  /**
@@ -453,27 +457,18 @@ export declare const FoxBeforeEnter = "FoxBeforeEnter";
453
457
  */
454
458
  export declare const FoxBeforeLeave = "FoxLeave";
455
459
 
456
- /**
457
- * 全局Bus
458
- */
459
- export declare const foxBusKey: FoxInjectionKey<BusInterface>;
460
-
461
460
  /**
462
461
  * Fox过渡进入事件
463
462
  */
464
463
  export declare const FoxEnter = "FoxEnter";
465
464
 
466
465
  /**
467
- * 全局Event Proxy
466
+ * Fox安装参数
468
467
  */
469
- export declare const foxEventProxyKey: FoxInjectionKey<EventProxy>;
470
-
471
- declare type FoxInjectionKey<T> = InjectionKey<T>;
472
-
473
- /**
474
- * 全局Fox
475
- */
476
- export declare const foxKey: FoxInjectionKey<Fox>;
468
+ declare interface FoxInstallOptions {
469
+ install?: boolean;
470
+ optionsApi?: boolean;
471
+ }
477
472
 
478
473
  /**
479
474
  * Fox过渡离开事件
@@ -487,15 +482,15 @@ export declare const FoxLeave = "FoxLeave";
487
482
  export declare const FoxLeaveEnd = "FoxLeaveEnd";
488
483
 
489
484
  /**
490
- * 参数
485
+ * Fox参数
491
486
  */
492
- export declare interface FoxOptions extends RouterOptions {
487
+ declare interface FoxOptions extends RouterOptions {
493
488
  }
494
489
 
495
490
  /**
496
491
  * 通用函数接口
497
492
  */
498
- export declare interface GenericFunction {
493
+ declare interface GenericFunction {
499
494
  (...args: any[]): any;
500
495
  }
501
496
 
@@ -538,10 +533,17 @@ declare const initKey: unique symbol;
538
533
 
539
534
  /**
540
535
  * inject context value
541
- * @param proxy
536
+ * @param refKey
537
+ * @param key
542
538
  * @returns
543
539
  */
544
- export declare function injectContextValue(proxy: ComponentPublicInstance, key: KeyType_2): unknown;
540
+ export declare function injectContextValue<T extends unknown>(refKey: LifecycleContextKey | null, key: KeyType_2): T | null;
541
+
542
+ /**
543
+ * inject Lifecycle context
544
+ * @param refKey
545
+ */
546
+ export declare function injectLifecycleContext(refKey?: LifecycleContextKey | null): LifecycleContext | null;
545
547
 
546
548
  /**
547
549
  * 是否数组
@@ -645,6 +647,49 @@ declare class Layer {
645
647
  views: View[];
646
648
  }
647
649
 
650
+ /**
651
+ * 生命周期上下文
652
+ */
653
+ declare class LifecycleContext {
654
+ /**
655
+ * 数据列表
656
+ */
657
+ private [registerKey_3];
658
+ /**
659
+ * 构造函数
660
+ */
661
+ constructor();
662
+ /**
663
+ * 设置value
664
+ * @param key
665
+ * @param value
666
+ */
667
+ set(key: KeyType_2, value: any): void;
668
+ /**
669
+ * 获取数据
670
+ * @param key
671
+ * @returns
672
+ */
673
+ get(key: KeyType_2): any;
674
+ /**
675
+ * 是否有对应的数据
676
+ * @param key
677
+ * @returns
678
+ */
679
+ has(key: KeyType_2): boolean;
680
+ /**
681
+ * 删除数据
682
+ * @param key
683
+ * @returns
684
+ */
685
+ delete(key: KeyType_2): boolean;
686
+ }
687
+
688
+ /**
689
+ * LifecycleContextKey
690
+ */
691
+ declare type LifecycleContextKey = Object;
692
+
648
693
  declare const _load: unique symbol;
649
694
 
650
695
  declare const mainDispatcherKey: unique symbol;
@@ -724,10 +769,6 @@ declare class ModelLayer {
724
769
  * model插槽
725
770
  */
726
771
  declare class ModelSlot {
727
- /**
728
- * 实例
729
- */
730
- instance: ComponentInternalInstance | null;
731
772
  /**
732
773
  * model
733
774
  */
@@ -778,8 +819,14 @@ export declare function onBeforeRouteUpdate(callback: {
778
819
  (to: Route, from?: Route): void;
779
820
  }): void;
780
821
 
822
+ /**
823
+ * 导出注册Fox Activated方法
824
+ */
781
825
  export declare const onFoxActivated: (hook: GenericFunction) => void;
782
826
 
827
+ /**
828
+ * 导出注册Fox Inactivated方法
829
+ */
783
830
  export declare const onFoxInactivated: (hook: GenericFunction) => void;
784
831
 
785
832
  /**
@@ -840,7 +887,7 @@ declare type PersistPolicy = 'memory' | 'session' | 'local' | 'custom';
840
887
  /**
841
888
  * 属性函数
842
889
  */
843
- export declare type PropFunction = {
890
+ declare type PropFunction = {
844
891
  (route: Route, index: number): any;
845
892
  };
846
893
 
@@ -855,13 +902,11 @@ declare const propsFilterKey: unique symbol;
855
902
 
856
903
  /**
857
904
  * provide context value
858
- * @param proxy
905
+ * @param refkey
859
906
  * @param key
860
907
  * @param value
861
908
  */
862
- export declare function provideContextValue(proxy: ComponentPublicInstance, key: KeyType_2, value: any): void;
863
-
864
- declare type Proxy_2 = ComponentPublicInstance | null;
909
+ export declare function provideContextValue(refKey: LifecycleContextKey | null, key: KeyType_2, value: any, route?: Route): void;
865
910
 
866
911
  /**
867
912
  * raw state
@@ -887,6 +932,8 @@ declare const registerKey: unique symbol;
887
932
 
888
933
  declare const registerKey_2: unique symbol;
889
934
 
935
+ declare const registerKey_3: unique symbol;
936
+
890
937
  /**
891
938
  * remove route 条件
892
939
  */
@@ -1215,7 +1262,7 @@ export declare class Route {
1215
1262
  * @param y
1216
1263
  * @returns
1217
1264
  */
1218
- static isSamePathForRoute(x: Route, y: Route): boolean;
1265
+ static isSamePathForRoute(x: Route | null, y: Route | null): boolean;
1219
1266
  /**
1220
1267
  * 由对象生成路由
1221
1268
  * @param obj
@@ -2439,7 +2486,7 @@ declare const routeSessionCacheKey: unique symbol;
2439
2486
 
2440
2487
  declare const routeUpdatedCallback: unique symbol;
2441
2488
 
2442
- export declare const sessionKey: unique symbol;
2489
+ declare const sessionKey: unique symbol;
2443
2490
 
2444
2491
  /**
2445
2492
  * shallow reactive state
@@ -2519,7 +2566,6 @@ declare interface Storage_2 {
2519
2566
  */
2520
2567
  removeItem(key: string): void;
2521
2568
  }
2522
- export { Storage_2 as Storage }
2523
2569
 
2524
2570
  declare const successFnsKey: unique symbol;
2525
2571
 
@@ -2528,7 +2574,7 @@ declare const sync: unique symbol;
2528
2574
  /**
2529
2575
  * Task类型
2530
2576
  */
2531
- export declare interface Task {
2577
+ declare interface Task {
2532
2578
  (context: EventChainContext, ...args: any[]): void;
2533
2579
  }
2534
2580
 
@@ -2551,7 +2597,7 @@ export declare const toTypeString: (value: unknown) => string;
2551
2597
  /**
2552
2598
  * 过渡属性
2553
2599
  */
2554
- export declare type TransitionProp = {
2600
+ declare type TransitionProp = {
2555
2601
  (route: Route, index: number): CustomTransition | boolean;
2556
2602
  } | CustomTransition | boolean;
2557
2603
 
@@ -2699,37 +2745,33 @@ declare enum UpdateType {
2699
2745
 
2700
2746
  /**
2701
2747
  * Returns the global bus
2702
- * @param proxy
2703
2748
  * @returns
2704
2749
  */
2705
- export declare function useBus(proxy?: Proxy_2): BusInterface;
2750
+ export declare function useBus(): BusInterface | null;
2706
2751
 
2707
2752
  /**
2708
2753
  * Returns the global event proxy
2709
- * @param proxy
2710
2754
  * @returns
2711
2755
  */
2712
- export declare function useEventProxy(proxy?: Proxy_2): EventProxy;
2756
+ export declare function useEventProxy(): EventProxy | null;
2713
2757
 
2714
2758
  /**
2715
2759
  * Returns the current fox
2716
- * @param proxy
2717
2760
  * @returns
2718
2761
  */
2719
- export declare function useFox(proxy?: Proxy_2): Fox;
2762
+ export declare function useFox(): Fox | null;
2720
2763
 
2721
2764
  /**
2722
2765
  * Returns the current route
2723
- * @param proxy
2724
2766
  * @returns
2725
2767
  */
2726
- export declare function useRoute(proxy?: Proxy_2): Route | null;
2768
+ export declare function useRoute(refkey?: LifecycleContextKey): Route | null;
2727
2769
 
2728
2770
  /**
2729
2771
  * Returns the current router
2730
2772
  * @returns
2731
2773
  */
2732
- export declare function useRouter(proxy?: Proxy_2): Router;
2774
+ export declare function useRouter(): Router | null;
2733
2775
 
2734
2776
  declare const valueKey: unique symbol;
2735
2777
 
@@ -2809,4 +2851,14 @@ declare class ViewPlace {
2809
2851
  static include(list: ViewPlace[], viewPlace: ViewPlace): boolean;
2810
2852
  }
2811
2853
 
2854
+ /**
2855
+ * 在绑定LifecycleContext上下文中中执行函数
2856
+ *
2857
+ * currentScope(effectScope)为空的情况的替代方案
2858
+ * @param ctx
2859
+ * @param fn
2860
+ * @returns
2861
+ */
2862
+ export declare function withLifecycleContext<T>(ctx: LifecycleContext, fn: () => Promise<T> | T): Promise<T>;
2863
+
2812
2864
  export { }