@apvee/spfx-react-toolkit 1.1.0 → 1.2.1

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.
Files changed (135) hide show
  1. package/README.md +52 -7217
  2. package/lib/core/context.internal.d.ts +6 -1
  3. package/lib/core/context.internal.d.ts.map +1 -1
  4. package/lib/core/context.internal.js +6 -1
  5. package/lib/core/context.internal.js.map +1 -1
  6. package/lib/core/index.d.ts +21 -0
  7. package/lib/core/index.d.ts.map +1 -1
  8. package/lib/core/index.js +21 -0
  9. package/lib/core/index.js.map +1 -1
  10. package/lib/core/provider-application-customizer.d.ts.map +1 -1
  11. package/lib/core/provider-application-customizer.js.map +1 -1
  12. package/lib/core/provider-field-customizer.d.ts.map +1 -1
  13. package/lib/core/provider-field-customizer.js.map +1 -1
  14. package/lib/core/provider-listview-commandset.d.ts.map +1 -1
  15. package/lib/core/provider-listview-commandset.js.map +1 -1
  16. package/lib/core/provider-webpart.d.ts.map +1 -1
  17. package/lib/core/provider-webpart.js.map +1 -1
  18. package/lib/core/types.d.ts +2 -0
  19. package/lib/core/types.d.ts.map +1 -1
  20. package/lib/hooks/index.d.ts +31 -0
  21. package/lib/hooks/index.d.ts.map +1 -1
  22. package/lib/hooks/index.js +31 -0
  23. package/lib/hooks/index.js.map +1 -1
  24. package/lib/hooks/useAsyncInvoke.internal.d.ts +58 -0
  25. package/lib/hooks/useAsyncInvoke.internal.d.ts.map +1 -0
  26. package/lib/hooks/useAsyncInvoke.internal.js +118 -0
  27. package/lib/hooks/useAsyncInvoke.internal.js.map +1 -0
  28. package/lib/hooks/useSPFxAadHttpClient.d.ts.map +1 -1
  29. package/lib/hooks/useSPFxAadHttpClient.js +5 -75
  30. package/lib/hooks/useSPFxAadHttpClient.js.map +1 -1
  31. package/lib/hooks/useSPFxContainerInfo.d.ts +2 -0
  32. package/lib/hooks/useSPFxContainerInfo.d.ts.map +1 -1
  33. package/lib/hooks/useSPFxContainerInfo.js +2 -0
  34. package/lib/hooks/useSPFxContainerInfo.js.map +1 -1
  35. package/lib/hooks/useSPFxDisplayMode.d.ts +4 -0
  36. package/lib/hooks/useSPFxDisplayMode.d.ts.map +1 -1
  37. package/lib/hooks/useSPFxDisplayMode.js +4 -0
  38. package/lib/hooks/useSPFxDisplayMode.js.map +1 -1
  39. package/lib/hooks/useSPFxHttpClient.d.ts +4 -0
  40. package/lib/hooks/useSPFxHttpClient.d.ts.map +1 -1
  41. package/lib/hooks/useSPFxHttpClient.js +8 -75
  42. package/lib/hooks/useSPFxHttpClient.js.map +1 -1
  43. package/lib/hooks/useSPFxMSGraphClient.d.ts.map +1 -1
  44. package/lib/hooks/useSPFxMSGraphClient.js +4 -74
  45. package/lib/hooks/useSPFxMSGraphClient.js.map +1 -1
  46. package/lib/hooks/useSPFxOneDriveAppData.d.ts +25 -0
  47. package/lib/hooks/useSPFxOneDriveAppData.d.ts.map +1 -1
  48. package/lib/hooks/useSPFxOneDriveAppData.js +121 -256
  49. package/lib/hooks/useSPFxOneDriveAppData.js.map +1 -1
  50. package/lib/hooks/useSPFxPermissions.d.ts +15 -3
  51. package/lib/hooks/useSPFxPermissions.d.ts.map +1 -1
  52. package/lib/hooks/useSPFxPermissions.js.map +1 -1
  53. package/lib/hooks/useSPFxPnPContext.d.ts +4 -0
  54. package/lib/hooks/useSPFxPnPContext.d.ts.map +1 -1
  55. package/lib/hooks/useSPFxPnPContext.js +4 -0
  56. package/lib/hooks/useSPFxPnPContext.js.map +1 -1
  57. package/lib/hooks/useSPFxPnPSearch.d.ts.map +1 -1
  58. package/lib/hooks/useSPFxPnPSearch.js +61 -48
  59. package/lib/hooks/useSPFxPnPSearch.js.map +1 -1
  60. package/lib/hooks/useSPFxSPHttpClient.d.ts.map +1 -1
  61. package/lib/hooks/useSPFxSPHttpClient.js +4 -74
  62. package/lib/hooks/useSPFxSPHttpClient.js.map +1 -1
  63. package/lib/hooks/useSPFxThemeInfo.d.ts +2 -0
  64. package/lib/hooks/useSPFxThemeInfo.d.ts.map +1 -1
  65. package/lib/hooks/useSPFxThemeInfo.js +2 -0
  66. package/lib/hooks/useSPFxThemeInfo.js.map +1 -1
  67. package/lib/index.d.ts +27 -0
  68. package/lib/index.d.ts.map +1 -1
  69. package/lib/index.js +27 -0
  70. package/lib/index.js.map +1 -1
  71. package/lib/utils/resize-observer.internal.d.ts +12 -2
  72. package/lib/utils/resize-observer.internal.d.ts.map +1 -1
  73. package/lib/utils/resize-observer.internal.js +12 -2
  74. package/lib/utils/resize-observer.internal.js.map +1 -1
  75. package/lib/utils/theme-subscription.internal.d.ts +12 -3
  76. package/lib/utils/theme-subscription.internal.d.ts.map +1 -1
  77. package/lib/utils/theme-subscription.internal.js +19 -3
  78. package/lib/utils/theme-subscription.internal.js.map +1 -1
  79. package/lib/utils/type-guards.internal.d.ts +78 -5
  80. package/lib/utils/type-guards.internal.d.ts.map +1 -1
  81. package/lib/utils/type-guards.internal.js +78 -5
  82. package/lib/utils/type-guards.internal.js.map +1 -1
  83. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.d.ts +0 -4
  84. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.d.ts.map +1 -1
  85. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.js +35 -752
  86. package/lib/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.js.map +1 -1
  87. package/lib/webparts/spFxReactToolkitTest/components/demos/HttpClientDemo.d.ts +7 -0
  88. package/lib/webparts/spFxReactToolkitTest/components/demos/HttpClientDemo.d.ts.map +1 -0
  89. package/lib/webparts/spFxReactToolkitTest/components/demos/HttpClientDemo.js +131 -0
  90. package/lib/webparts/spFxReactToolkitTest/components/demos/HttpClientDemo.js.map +1 -0
  91. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPContextDemo.d.ts +8 -0
  92. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPContextDemo.d.ts.map +1 -0
  93. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPContextDemo.js +158 -0
  94. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPContextDemo.js.map +1 -0
  95. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPListDemo.d.ts +9 -0
  96. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPListDemo.d.ts.map +1 -0
  97. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPListDemo.js +159 -0
  98. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPListDemo.js.map +1 -0
  99. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPOperationsDemo.d.ts +10 -0
  100. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPOperationsDemo.d.ts.map +1 -0
  101. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPOperationsDemo.js +141 -0
  102. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPOperationsDemo.js.map +1 -0
  103. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchAdvancedDemo.d.ts +6 -0
  104. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchAdvancedDemo.d.ts.map +1 -0
  105. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchAdvancedDemo.js +62 -0
  106. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchAdvancedDemo.js.map +1 -0
  107. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchBasicDemo.d.ts +6 -0
  108. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchBasicDemo.d.ts.map +1 -0
  109. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchBasicDemo.js +98 -0
  110. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchBasicDemo.js.map +1 -0
  111. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchRefinersDemo.d.ts +6 -0
  112. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchRefinersDemo.d.ts.map +1 -0
  113. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchRefinersDemo.js +45 -0
  114. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchRefinersDemo.js.map +1 -0
  115. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchSuggestionsDemo.d.ts +6 -0
  116. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchSuggestionsDemo.d.ts.map +1 -0
  117. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchSuggestionsDemo.js +134 -0
  118. package/lib/webparts/spFxReactToolkitTest/components/demos/PnPSearchSuggestionsDemo.js.map +1 -0
  119. package/lib/webparts/spFxReactToolkitTest/components/demos/index.d.ts +13 -0
  120. package/lib/webparts/spFxReactToolkitTest/components/demos/index.d.ts.map +1 -0
  121. package/lib/webparts/spFxReactToolkitTest/components/demos/index.js +18 -0
  122. package/lib/webparts/spFxReactToolkitTest/components/demos/index.js.map +1 -0
  123. package/lib/webparts/spFxReactToolkitTest/components/shared/InfoRow.d.ts +18 -0
  124. package/lib/webparts/spFxReactToolkitTest/components/shared/InfoRow.d.ts.map +1 -0
  125. package/lib/webparts/spFxReactToolkitTest/components/shared/InfoRow.js +17 -0
  126. package/lib/webparts/spFxReactToolkitTest/components/shared/InfoRow.js.map +1 -0
  127. package/lib/webparts/spFxReactToolkitTest/components/shared/StatusBadge.d.ts +16 -0
  128. package/lib/webparts/spFxReactToolkitTest/components/shared/StatusBadge.d.ts.map +1 -0
  129. package/lib/webparts/spFxReactToolkitTest/components/shared/StatusBadge.js +14 -0
  130. package/lib/webparts/spFxReactToolkitTest/components/shared/StatusBadge.js.map +1 -0
  131. package/lib/webparts/spFxReactToolkitTest/components/shared/index.d.ts +6 -0
  132. package/lib/webparts/spFxReactToolkitTest/components/shared/index.d.ts.map +1 -0
  133. package/lib/webparts/spFxReactToolkitTest/components/shared/index.js +6 -0
  134. package/lib/webparts/spFxReactToolkitTest/components/shared/index.js.map +1 -0
  135. package/package.json +7 -7
@@ -4,31 +4,104 @@ import type { BaseListViewCommandSet, BaseFieldCustomizer } from '@microsoft/sp-
4
4
  import type { SPFxComponent, HostKind } from '../core/types';
5
5
  /**
6
6
  * Type guard: Check if instance is a WebPart
7
- * Uses duck typing - checks for WebPart-specific properties
7
+ *
8
+ * Uses duck typing (structural typing) to detect WebPart instances
9
+ * by checking for WebPart-specific properties: displayMode, domElement, render, context, properties.
10
+ *
11
+ * @template TProps - WebPart properties type
12
+ * @param instance - SPFx component instance to check
13
+ * @returns True if instance is a BaseClientSideWebPart, narrowing the type
14
+ *
15
+ * @example
16
+ * ```typescript
17
+ * if (isWebPart(instance)) {
18
+ * // instance is now typed as BaseClientSideWebPart<TProps>
19
+ * console.log(instance.displayMode);
20
+ * }
21
+ * ```
22
+ *
8
23
  * @internal
9
24
  */
10
25
  export declare function isWebPart<TProps extends {} = {}>(instance: unknown): instance is BaseClientSideWebPart<TProps>;
11
26
  /**
12
27
  * Type guard: Check if instance is an ApplicationCustomizer
13
- * Uses duck typing - checks for ApplicationCustomizer-specific properties
28
+ *
29
+ * Uses duck typing (structural typing) to detect ApplicationCustomizer instances
30
+ * by checking for placeholderProvider in context and absence of displayMode.
31
+ *
32
+ * @template TProps - ApplicationCustomizer properties type
33
+ * @param instance - SPFx component instance to check
34
+ * @returns True if instance is a BaseApplicationCustomizer, narrowing the type
35
+ *
36
+ * @example
37
+ * ```typescript
38
+ * if (isApplicationCustomizer(instance)) {
39
+ * // instance is now typed as BaseApplicationCustomizer<TProps>
40
+ * console.log(instance.context.placeholderProvider);
41
+ * }
42
+ * ```
43
+ *
14
44
  * @internal
15
45
  */
16
46
  export declare function isApplicationCustomizer<TProps extends {} = {}>(instance: unknown): instance is BaseApplicationCustomizer<TProps>;
17
47
  /**
18
48
  * Type guard: Check if instance is a ListViewCommandSet
19
- * Uses duck typing - checks for CommandSet-specific properties
49
+ *
50
+ * Uses duck typing (structural typing) to detect ListViewCommandSet instances
51
+ * by checking for onExecute and tryGetCommand methods.
52
+ *
53
+ * @template TProps - ListViewCommandSet properties type
54
+ * @param instance - SPFx component instance to check
55
+ * @returns True if instance is a BaseListViewCommandSet, narrowing the type
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * if (isListViewCommandSet(instance)) {
60
+ * // instance is now typed as BaseListViewCommandSet<TProps>
61
+ * instance.tryGetCommand('COMMAND_ID');
62
+ * }
63
+ * ```
64
+ *
20
65
  * @internal
21
66
  */
22
67
  export declare function isListViewCommandSet<TProps extends {} = {}>(instance: unknown): instance is BaseListViewCommandSet<TProps>;
23
68
  /**
24
69
  * Type guard: Check if instance is a FieldCustomizer
25
- * Uses duck typing - checks for FieldCustomizer-specific properties
70
+ *
71
+ * Uses duck typing (structural typing) to detect FieldCustomizer instances
72
+ * by checking for field in context and onRenderCell method.
73
+ *
74
+ * @template TProps - FieldCustomizer properties type
75
+ * @param instance - SPFx component instance to check
76
+ * @returns True if instance is a BaseFieldCustomizer, narrowing the type
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * if (isFieldCustomizer(instance)) {
81
+ * // instance is now typed as BaseFieldCustomizer<TProps>
82
+ * console.log(instance.context.field);
83
+ * }
84
+ * ```
85
+ *
26
86
  * @internal
27
87
  */
28
88
  export declare function isFieldCustomizer<TProps extends {} = {}>(instance: unknown): instance is BaseFieldCustomizer<TProps>;
29
89
  /**
30
90
  * Detect the kind of SPFx component from an instance
31
- * Throws if unable to detect
91
+ *
92
+ * Checks the instance against all known SPFx component types and returns
93
+ * the corresponding HostKind discriminator.
94
+ *
95
+ * @template TProps - SPFx component properties type
96
+ * @param instance - SPFx component instance to detect
97
+ * @returns HostKind ('WebPart' | 'AppCustomizer' | 'CommandSet' | 'FieldCustomizer')
98
+ * @throws Error if unable to detect component type
99
+ *
100
+ * @example
101
+ * ```typescript
102
+ * const kind = detectComponentKind(this); // 'WebPart'
103
+ * ```
104
+ *
32
105
  * @internal
33
106
  */
34
107
  export declare function detectComponentKind<TProps extends {} = {}>(instance: SPFxComponent<TProps>): HostKind;
@@ -1 +1 @@
1
- {"version":3,"file":"type-guards.internal.d.ts","sourceRoot":"","sources":["../../src/utils/type-guards.internal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AACxG,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EAC9C,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAa3C;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EAC5D,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAgB/C;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EACzD,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAa5C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EACtD,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAiBzC;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EACxD,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,QAAQ,CAUV"}
1
+ {"version":3,"file":"type-guards.internal.d.ts","sourceRoot":"","sources":["../../src/utils/type-guards.internal.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAChF,OAAO,KAAK,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AACxG,OAAO,KAAK,EACV,aAAa,EACb,QAAQ,EACT,MAAM,eAAe,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,SAAS,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EAC9C,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,qBAAqB,CAAC,MAAM,CAAC,CAa3C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,uBAAuB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EAC5D,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,yBAAyB,CAAC,MAAM,CAAC,CAgB/C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EACzD,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,sBAAsB,CAAC,MAAM,CAAC,CAa5C;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EACtD,QAAQ,EAAE,OAAO,GAChB,QAAQ,IAAI,mBAAmB,CAAC,MAAM,CAAC,CAiBzC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,SAAS,EAAE,GAAG,EAAE,EACxD,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAC9B,QAAQ,CAUV"}
@@ -2,7 +2,22 @@
2
2
  // Type guards for SPFx component detection using structural typing (duck typing)
3
3
  /**
4
4
  * Type guard: Check if instance is a WebPart
5
- * Uses duck typing - checks for WebPart-specific properties
5
+ *
6
+ * Uses duck typing (structural typing) to detect WebPart instances
7
+ * by checking for WebPart-specific properties: displayMode, domElement, render, context, properties.
8
+ *
9
+ * @template TProps - WebPart properties type
10
+ * @param instance - SPFx component instance to check
11
+ * @returns True if instance is a BaseClientSideWebPart, narrowing the type
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * if (isWebPart(instance)) {
16
+ * // instance is now typed as BaseClientSideWebPart<TProps>
17
+ * console.log(instance.displayMode);
18
+ * }
19
+ * ```
20
+ *
6
21
  * @internal
7
22
  */
8
23
  export function isWebPart(instance) {
@@ -18,7 +33,22 @@ export function isWebPart(instance) {
18
33
  }
19
34
  /**
20
35
  * Type guard: Check if instance is an ApplicationCustomizer
21
- * Uses duck typing - checks for ApplicationCustomizer-specific properties
36
+ *
37
+ * Uses duck typing (structural typing) to detect ApplicationCustomizer instances
38
+ * by checking for placeholderProvider in context and absence of displayMode.
39
+ *
40
+ * @template TProps - ApplicationCustomizer properties type
41
+ * @param instance - SPFx component instance to check
42
+ * @returns True if instance is a BaseApplicationCustomizer, narrowing the type
43
+ *
44
+ * @example
45
+ * ```typescript
46
+ * if (isApplicationCustomizer(instance)) {
47
+ * // instance is now typed as BaseApplicationCustomizer<TProps>
48
+ * console.log(instance.context.placeholderProvider);
49
+ * }
50
+ * ```
51
+ *
22
52
  * @internal
23
53
  */
24
54
  export function isApplicationCustomizer(instance) {
@@ -36,7 +66,22 @@ export function isApplicationCustomizer(instance) {
36
66
  }
37
67
  /**
38
68
  * Type guard: Check if instance is a ListViewCommandSet
39
- * Uses duck typing - checks for CommandSet-specific properties
69
+ *
70
+ * Uses duck typing (structural typing) to detect ListViewCommandSet instances
71
+ * by checking for onExecute and tryGetCommand methods.
72
+ *
73
+ * @template TProps - ListViewCommandSet properties type
74
+ * @param instance - SPFx component instance to check
75
+ * @returns True if instance is a BaseListViewCommandSet, narrowing the type
76
+ *
77
+ * @example
78
+ * ```typescript
79
+ * if (isListViewCommandSet(instance)) {
80
+ * // instance is now typed as BaseListViewCommandSet<TProps>
81
+ * instance.tryGetCommand('COMMAND_ID');
82
+ * }
83
+ * ```
84
+ *
40
85
  * @internal
41
86
  */
42
87
  export function isListViewCommandSet(instance) {
@@ -52,7 +97,22 @@ export function isListViewCommandSet(instance) {
52
97
  }
53
98
  /**
54
99
  * Type guard: Check if instance is a FieldCustomizer
55
- * Uses duck typing - checks for FieldCustomizer-specific properties
100
+ *
101
+ * Uses duck typing (structural typing) to detect FieldCustomizer instances
102
+ * by checking for field in context and onRenderCell method.
103
+ *
104
+ * @template TProps - FieldCustomizer properties type
105
+ * @param instance - SPFx component instance to check
106
+ * @returns True if instance is a BaseFieldCustomizer, narrowing the type
107
+ *
108
+ * @example
109
+ * ```typescript
110
+ * if (isFieldCustomizer(instance)) {
111
+ * // instance is now typed as BaseFieldCustomizer<TProps>
112
+ * console.log(instance.context.field);
113
+ * }
114
+ * ```
115
+ *
56
116
  * @internal
57
117
  */
58
118
  export function isFieldCustomizer(instance) {
@@ -70,7 +130,20 @@ export function isFieldCustomizer(instance) {
70
130
  }
71
131
  /**
72
132
  * Detect the kind of SPFx component from an instance
73
- * Throws if unable to detect
133
+ *
134
+ * Checks the instance against all known SPFx component types and returns
135
+ * the corresponding HostKind discriminator.
136
+ *
137
+ * @template TProps - SPFx component properties type
138
+ * @param instance - SPFx component instance to detect
139
+ * @returns HostKind ('WebPart' | 'AppCustomizer' | 'CommandSet' | 'FieldCustomizer')
140
+ * @throws Error if unable to detect component type
141
+ *
142
+ * @example
143
+ * ```typescript
144
+ * const kind = detectComponentKind(this); // 'WebPart'
145
+ * ```
146
+ *
74
147
  * @internal
75
148
  */
76
149
  export function detectComponentKind(instance) {
@@ -1 +1 @@
1
- {"version":3,"file":"type-guards.internal.js","sourceRoot":"","sources":["../../src/utils/type-guards.internal.ts"],"names":[],"mappings":"AAAA,iBAAiB;AACjB,iFAAiF;AAUjF;;;;GAIG;AACH,MAAM,UAAU,SAAS,CACvB,QAAiB;IAEjB,IAAI,CAAC,QAAQ,IAAI,OAAO,QAAQ,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC;IAE5D,IAAM,GAAG,GAAG,QAAmC,CAAC;IAEhD,OAAO,CACL,a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mC,CAAC;IAEhD,IAAI,CAAC,CAAC,SAAS,IAAI,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE,CAAC;QAC3E,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAM,OAAO,GAAG,GAAG,CAAC,OAAkC,CAAC;IAEvD,OAAO,CACL,OAAO,IAAI,OAAO;QAClB,cAAc,IAAI,GAAG;QACrB,OAAO,GAAG,CAAC,YAAY,KAAK,UAAU;QACtC,YAAY,IAAI,GAAG,CACpB,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,UAAU,mBAAmB,CACjC,QAA+B;IAE/B,IAAI,SAAS,CAAC,QAAQ,CAAC;QAAE,OAAO,SAAS,CAAC;IAC1C,IAAI,uBAAuB,CAAC,QAAQ,CAAC;QAAE,OAAO,eAAe,CAAC;IAC9D,IAAI,oBAAoB,CAAC,QAAQ,CAAC;QAAE,OAAO,YAAY,CAAC;IACxD,IAAI,iBAAiB,CAAC,QAAQ,CAAC;QAAE,OAAO,iBAAiB,CAAC;IAE1D,MAAM,IAAI,KAAK,CACb,uDAAuD;QACvD,oFAAoF,CACrF,CAAC;AACJ,CAAC"}
@@ -1,8 +1,4 @@
1
1
  import * as React from 'react';
2
- import '@pnp/sp/webs';
3
- import '@pnp/sp/lists';
4
- import '@pnp/sp/items';
5
- import '@pnp/sp/site-users';
6
2
  declare const SpFxReactToolkitTest: React.FC;
7
3
  export default SpFxReactToolkitTest;
8
4
  //# sourceMappingURL=SpFxReactToolkitTest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SpFxReactToolkitTest.d.ts","sourceRoot":"","sources":["../../../../src/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAuD/B,OAAO,cAAc,CAAC;AACtB,OAAO,eAAe,CAAC;AACvB,OAAO,eAAe,CAAC;AACvB,OAAO,oBAAoB,CAAC;AA6+B5B,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAy/BjC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"SpFxReactToolkitTest.d.ts","sourceRoot":"","sources":["../../../../src/webparts/spFxReactToolkitTest/components/SpFxReactToolkitTest.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA0F/B,QAAA,MAAM,oBAAoB,EAAE,KAAK,CAAC,EA8/BjC,CAAC;AAEF,eAAe,oBAAoB,CAAC"}