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

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 contextRelationKey 上下文关联key
134
137
  * @param key
135
138
  *
136
139
  */
137
- export declare function deleteContextValue(proxy: ComponentPublicInstance, key: KeyType_2): void;
140
+ export declare function deleteContextValue(contextRelationKey: FoxContextRelationKey | 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
  /**
@@ -454,9 +458,10 @@ export declare const FoxBeforeEnter = "FoxBeforeEnter";
454
458
  export declare const FoxBeforeLeave = "FoxLeave";
455
459
 
456
460
  /**
457
- * 全局Bus
461
+ * FoxContextKey
462
+ * 上下文key
458
463
  */
459
- export declare const foxBusKey: FoxInjectionKey<BusInterface>;
464
+ declare type FoxContextRelationKey = Object;
460
465
 
461
466
  /**
462
467
  * Fox过渡进入事件
@@ -464,16 +469,12 @@ export declare const foxBusKey: FoxInjectionKey<BusInterface>;
464
469
  export declare const FoxEnter = "FoxEnter";
465
470
 
466
471
  /**
467
- * 全局Event Proxy
468
- */
469
- export declare const foxEventProxyKey: FoxInjectionKey<EventProxy>;
470
-
471
- declare type FoxInjectionKey<T> = InjectionKey<T>;
472
-
473
- /**
474
- * 全局Fox
472
+ * Fox安装参数
475
473
  */
476
- export declare const foxKey: FoxInjectionKey<Fox>;
474
+ declare interface FoxInstallOptions {
475
+ install?: boolean;
476
+ optionsApi?: boolean;
477
+ }
477
478
 
478
479
  /**
479
480
  * Fox过渡离开事件
@@ -487,15 +488,15 @@ export declare const FoxLeave = "FoxLeave";
487
488
  export declare const FoxLeaveEnd = "FoxLeaveEnd";
488
489
 
489
490
  /**
490
- * 参数
491
+ * Fox参数
491
492
  */
492
- export declare interface FoxOptions extends RouterOptions {
493
+ declare interface FoxOptions extends RouterOptions {
493
494
  }
494
495
 
495
496
  /**
496
497
  * 通用函数接口
497
498
  */
498
- export declare interface GenericFunction {
499
+ declare interface GenericFunction {
499
500
  (...args: any[]): any;
500
501
  }
501
502
 
@@ -538,10 +539,17 @@ declare const initKey: unique symbol;
538
539
 
539
540
  /**
540
541
  * inject context value
541
- * @param proxy
542
+ * @param contextRelationKey 上下文关联key
543
+ * @param key
542
544
  * @returns
543
545
  */
544
- export declare function injectContextValue(proxy: ComponentPublicInstance, key: KeyType_2): unknown;
546
+ export declare function injectContextValue<T extends unknown>(contextRelationKey: FoxContextRelationKey | null, key: KeyType_2): T | null;
547
+
548
+ /**
549
+ * inject Lifecycle context
550
+ * @param contextRelationKey 上下文关联key
551
+ */
552
+ export declare function injectLifecycleContext(contextRelationKey?: FoxContextRelationKey | null): LifecycleContext | null;
545
553
 
546
554
  /**
547
555
  * 是否数组
@@ -633,6 +641,9 @@ export declare const isString: (val: unknown) => val is string;
633
641
  */
634
642
  export declare const isSymbol: (val: unknown) => val is symbol;
635
643
 
644
+ /**
645
+ * 数据类型key
646
+ */
636
647
  declare type KeyType_2 = string | number | Symbol;
637
648
 
638
649
  /**
@@ -645,6 +656,44 @@ declare class Layer {
645
656
  views: View[];
646
657
  }
647
658
 
659
+ /**
660
+ * 生命周期上下文
661
+ */
662
+ declare class LifecycleContext {
663
+ /**
664
+ * 数据列表
665
+ */
666
+ private [registerKey_3];
667
+ /**
668
+ * 构造函数
669
+ */
670
+ constructor();
671
+ /**
672
+ * 设置value
673
+ * @param key
674
+ * @param value
675
+ */
676
+ set(key: KeyType_2, value: any): void;
677
+ /**
678
+ * 获取数据
679
+ * @param key
680
+ * @returns
681
+ */
682
+ get(key: KeyType_2): any;
683
+ /**
684
+ * 是否有对应的数据
685
+ * @param key
686
+ * @returns
687
+ */
688
+ has(key: KeyType_2): boolean;
689
+ /**
690
+ * 删除数据
691
+ * @param key
692
+ * @returns
693
+ */
694
+ delete(key: KeyType_2): boolean;
695
+ }
696
+
648
697
  declare const _load: unique symbol;
649
698
 
650
699
  declare const mainDispatcherKey: unique symbol;
@@ -724,10 +773,6 @@ declare class ModelLayer {
724
773
  * model插槽
725
774
  */
726
775
  declare class ModelSlot {
727
- /**
728
- * 实例
729
- */
730
- instance: ComponentInternalInstance | null;
731
776
  /**
732
777
  * model
733
778
  */
@@ -778,8 +823,14 @@ export declare function onBeforeRouteUpdate(callback: {
778
823
  (to: Route, from?: Route): void;
779
824
  }): void;
780
825
 
826
+ /**
827
+ * 导出注册Fox Activated方法
828
+ */
781
829
  export declare const onFoxActivated: (hook: GenericFunction) => void;
782
830
 
831
+ /**
832
+ * 导出注册Fox Inactivated方法
833
+ */
783
834
  export declare const onFoxInactivated: (hook: GenericFunction) => void;
784
835
 
785
836
  /**
@@ -840,7 +891,7 @@ declare type PersistPolicy = 'memory' | 'session' | 'local' | 'custom';
840
891
  /**
841
892
  * 属性函数
842
893
  */
843
- export declare type PropFunction = {
894
+ declare type PropFunction = {
844
895
  (route: Route, index: number): any;
845
896
  };
846
897
 
@@ -855,13 +906,11 @@ declare const propsFilterKey: unique symbol;
855
906
 
856
907
  /**
857
908
  * provide context value
858
- * @param proxy
909
+ * @param contextRelationKey 上下文关联key
859
910
  * @param key
860
911
  * @param value
861
912
  */
862
- export declare function provideContextValue(proxy: ComponentPublicInstance, key: KeyType_2, value: any): void;
863
-
864
- declare type Proxy_2 = ComponentPublicInstance | null;
913
+ export declare function provideContextValue(contextRelationKey: FoxContextRelationKey | null, key: KeyType_2, value: any): void;
865
914
 
866
915
  /**
867
916
  * raw state
@@ -887,6 +936,11 @@ declare const registerKey: unique symbol;
887
936
 
888
937
  declare const registerKey_2: unique symbol;
889
938
 
939
+ /**
940
+ * 注册表key
941
+ */
942
+ declare const registerKey_3: unique symbol;
943
+
890
944
  /**
891
945
  * remove route 条件
892
946
  */
@@ -1215,7 +1269,7 @@ export declare class Route {
1215
1269
  * @param y
1216
1270
  * @returns
1217
1271
  */
1218
- static isSamePathForRoute(x: Route, y: Route): boolean;
1272
+ static isSamePathForRoute(x: Route | null, y: Route | null): boolean;
1219
1273
  /**
1220
1274
  * 由对象生成路由
1221
1275
  * @param obj
@@ -2439,7 +2493,7 @@ declare const routeSessionCacheKey: unique symbol;
2439
2493
 
2440
2494
  declare const routeUpdatedCallback: unique symbol;
2441
2495
 
2442
- export declare const sessionKey: unique symbol;
2496
+ declare const sessionKey: unique symbol;
2443
2497
 
2444
2498
  /**
2445
2499
  * shallow reactive state
@@ -2519,7 +2573,6 @@ declare interface Storage_2 {
2519
2573
  */
2520
2574
  removeItem(key: string): void;
2521
2575
  }
2522
- export { Storage_2 as Storage }
2523
2576
 
2524
2577
  declare const successFnsKey: unique symbol;
2525
2578
 
@@ -2551,7 +2604,7 @@ export declare const toTypeString: (value: unknown) => string;
2551
2604
  /**
2552
2605
  * 过渡属性
2553
2606
  */
2554
- export declare type TransitionProp = {
2607
+ declare type TransitionProp = {
2555
2608
  (route: Route, index: number): CustomTransition | boolean;
2556
2609
  } | CustomTransition | boolean;
2557
2610
 
@@ -2699,37 +2752,38 @@ declare enum UpdateType {
2699
2752
 
2700
2753
  /**
2701
2754
  * Returns the global bus
2702
- * @param proxy
2755
+ * @param contextRelationKey 上下文关联key
2703
2756
  * @returns
2704
2757
  */
2705
- export declare function useBus(proxy?: Proxy_2): BusInterface;
2758
+ export declare function useBus(contextRelationKey?: FoxContextRelationKey): BusInterface | null;
2706
2759
 
2707
2760
  /**
2708
2761
  * Returns the global event proxy
2709
- * @param proxy
2710
2762
  * @returns
2711
2763
  */
2712
- export declare function useEventProxy(proxy?: Proxy_2): EventProxy;
2764
+ export declare function useEventProxy(contextRelationKey?: FoxContextRelationKey): EventProxy | null;
2713
2765
 
2714
2766
  /**
2715
2767
  * Returns the current fox
2716
- * @param proxy
2768
+ * @param contextRelationKey 上下文关联key
2769
+ *
2717
2770
  * @returns
2718
2771
  */
2719
- export declare function useFox(proxy?: Proxy_2): Fox;
2772
+ export declare function useFox(contextRelationKey?: FoxContextRelationKey): Fox | null;
2720
2773
 
2721
2774
  /**
2722
2775
  * Returns the current route
2723
- * @param proxy
2776
+ * @param 上下文关联key
2724
2777
  * @returns
2725
2778
  */
2726
- export declare function useRoute(proxy?: Proxy_2): Route | null;
2779
+ export declare function useRoute(contextRelationKey?: FoxContextRelationKey): Route | null;
2727
2780
 
2728
2781
  /**
2729
2782
  * Returns the current router
2783
+ * @param 上下文关联key
2730
2784
  * @returns
2731
2785
  */
2732
- export declare function useRouter(proxy?: Proxy_2): Router;
2786
+ export declare function useRouter(contextRelationKey?: FoxContextRelationKey): Router | null;
2733
2787
 
2734
2788
  declare const valueKey: unique symbol;
2735
2789
 
@@ -2809,4 +2863,14 @@ declare class ViewPlace {
2809
2863
  static include(list: ViewPlace[], viewPlace: ViewPlace): boolean;
2810
2864
  }
2811
2865
 
2866
+ /**
2867
+ * 在绑定LifecycleContext上下文中中执行函数
2868
+ *
2869
+ * currentScope(effectScope)为空的情况的替代方案
2870
+ * @param ctx
2871
+ * @param fn
2872
+ * @returns
2873
+ */
2874
+ export declare function withLifecycleContext<T>(ctx: LifecycleContext, fn: () => Promise<T> | T): Promise<T>;
2875
+
2812
2876
  export { }