playbook_ui 15.5.0.pre.alpha.play265012854 → 15.5.0.pre.alpha.revert5553typeaheadfix12763

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,71 +0,0 @@
1
- /**
2
- * Tracks which deprecated kits have already logged warnings in this session
3
- * to ensure we only log once per page load per kit
4
- */
5
- const warnedKits = new Set<string>();
6
-
7
- /**
8
- * Logs a deprecation warning for a Playbook kit
9
- * - Only logs once per kit per page load (prevents spam on re-renders)
10
- * - Only logs in development mode (not in production or test environments)
11
- *
12
- * @param kitName - The name of the deprecated kit (e.g., 'BarGraph', 'RichTextEditor')
13
- * @param message - Optional custom deprecation message. If not provided, uses a default message.
14
- *
15
- * @example
16
- * // In your kit component:
17
- * useEffect(() => {
18
- * deprecatedKitWarning('BarGraph');
19
- * }, []);
20
- */
21
- export const deprecatedKitWarning = (
22
- kitName: string,
23
- message?: string
24
- ): void => {
25
- // Skip in test environments (Jest sets NODE_ENV to 'test')
26
- if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') {
27
- return;
28
- }
29
-
30
- // Skip if production mode was set at build time
31
- if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'production') {
32
- return;
33
- }
34
-
35
- // Skip if this looks like a production build (minified, no sourcemaps in browser)
36
- // This helps catch cases where the package was built for production but consumed in dev
37
- if (typeof window !== 'undefined') {
38
- // Check for common production indicators
39
- const isMinified = !new Error().stack?.includes('.ts:') && !new Error().stack?.includes('.tsx:');
40
- // Allow warnings even in built packages when consumed locally (localhost)
41
- const isLocalhost = window.location?.hostname === 'localhost' ||
42
- window.location?.hostname === '127.0.0.1' ||
43
- window.location?.hostname === '';
44
-
45
- // Only skip if it's minified AND not on localhost
46
- if (isMinified && !isLocalhost) {
47
- return;
48
- }
49
- }
50
-
51
- // Only warn once per kit per page load
52
- if (warnedKits.has(kitName)) {
53
- return;
54
- }
55
-
56
- // Mark this kit as warned
57
- warnedKits.add(kitName);
58
-
59
- // Log the warning
60
- const defaultMessage = `[PLAYBOOK] The "${kitName}" kit is deprecated and will be removed in a future version. Please migrate to the recommended alternative.`;
61
-
62
- console.warn(message || defaultMessage);
63
- };
64
-
65
- /**
66
- * Resets the warned kits tracker (useful for testing)
67
- * @internal
68
- */
69
- export const resetDeprecationWarnings = (): void => {
70
- warnedKits.clear();
71
- };