react-achievements 2.2.2 → 3.0.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 (77) hide show
  1. package/README.md +377 -401
  2. package/dist/index.d.ts +222 -8
  3. package/dist/index.js +631 -0
  4. package/dist/index.js.map +1 -0
  5. package/dist/stories/Button.d.ts +28 -0
  6. package/dist/stories/Button.stories.d.ts +23 -0
  7. package/dist/stories/Header.d.ts +13 -0
  8. package/dist/stories/Header.stories.d.ts +18 -0
  9. package/dist/stories/Page.d.ts +3 -0
  10. package/dist/stories/Page.stories.d.ts +12 -0
  11. package/dist/types/__mocks__/confetti-wrapper.d.ts +5 -0
  12. package/dist/types/__mocks__/react-confetti.d.ts +3 -0
  13. package/dist/types/__mocks__/react-toastify.d.ts +13 -0
  14. package/dist/types/core/components/BadgesButton.d.ts +10 -0
  15. package/dist/types/core/components/BadgesModal.d.ts +11 -0
  16. package/dist/types/core/components/ConfettiWrapper.d.ts +6 -0
  17. package/dist/types/core/context/AchievementContext.d.ts +5 -0
  18. package/dist/types/core/icons/defaultIcons.d.ts +81 -0
  19. package/dist/types/core/storage/LocalStorage.d.ts +16 -0
  20. package/dist/types/core/storage/MemoryStorage.d.ts +11 -0
  21. package/dist/types/core/styles/defaultStyles.d.ts +2 -0
  22. package/dist/types/core/types.d.ts +74 -0
  23. package/dist/types/hooks/useAchievements.d.ts +1 -0
  24. package/dist/types/index.d.ts +10 -0
  25. package/dist/types/providers/AchievementProvider.d.ts +24 -0
  26. package/dist/types/setupTests.d.ts +1 -0
  27. package/dist/types/stories/Button.d.ts +16 -0
  28. package/dist/types/stories/Button.stories.d.ts +23 -0
  29. package/dist/types/stories/Header.d.ts +13 -0
  30. package/dist/types/stories/Header.stories.d.ts +18 -0
  31. package/dist/types/stories/Page.d.ts +3 -0
  32. package/dist/types/stories/Page.stories.d.ts +12 -0
  33. package/package.json +73 -54
  34. package/.idea/jsLibraryMappings.xml +0 -6
  35. package/.idea/modules.xml +0 -8
  36. package/.idea/react-achievements.iml +0 -12
  37. package/.idea/vcs.xml +0 -6
  38. package/coverage/clover.xml +0 -131
  39. package/coverage/coverage-final.json +0 -9
  40. package/coverage/lcov-report/base.css +0 -224
  41. package/coverage/lcov-report/block-navigation.js +0 -87
  42. package/coverage/lcov-report/favicon.png +0 -0
  43. package/coverage/lcov-report/index.html +0 -146
  44. package/coverage/lcov-report/prettify.css +0 -1
  45. package/coverage/lcov-report/prettify.js +0 -2
  46. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  47. package/coverage/lcov-report/sorter.js +0 -196
  48. package/coverage/lcov-report/src/components/AchievementModal.tsx.html +0 -229
  49. package/coverage/lcov-report/src/components/BadgesButton.tsx.html +0 -169
  50. package/coverage/lcov-report/src/components/BadgesModal.tsx.html +0 -253
  51. package/coverage/lcov-report/src/components/ConfettiWrapper.tsx.html +0 -157
  52. package/coverage/lcov-report/src/components/index.html +0 -161
  53. package/coverage/lcov-report/src/context/AchievementContext.tsx.html +0 -505
  54. package/coverage/lcov-report/src/context/index.html +0 -116
  55. package/coverage/lcov-report/src/index.html +0 -146
  56. package/coverage/lcov-report/src/index.ts.html +0 -121
  57. package/coverage/lcov-report/src/react-confetti.d.ts.html +0 -139
  58. package/coverage/lcov-report/src/react-use.d.ts.html +0 -94
  59. package/coverage/lcov.info +0 -240
  60. package/demo/src/AchievementConfig.ts +0 -0
  61. package/public/badges/icon1.svg +0 -1
  62. package/rollup.config.mjs +0 -34
  63. package/src/assets/defaultIcons.ts +0 -100
  64. package/src/components/BadgesButton.tsx +0 -49
  65. package/src/components/BadgesModal.tsx +0 -47
  66. package/src/components/ConfettiWrapper.tsx +0 -17
  67. package/src/defaultStyles.ts +0 -86
  68. package/src/hooks/useAchievement.ts +0 -17
  69. package/src/index.ts +0 -25
  70. package/src/providers/AchievementProvider.tsx +0 -202
  71. package/src/react-confetti.d.ts +0 -19
  72. package/src/react-use.d.ts +0 -4
  73. package/src/redux/achievementSlice.ts +0 -116
  74. package/src/redux/notificationSlice.ts +0 -26
  75. package/src/redux/store.ts +0 -16
  76. package/src/types.ts +0 -39
  77. package/tsconfig.json +0 -113
@@ -1,202 +0,0 @@
1
- import React, { useEffect, useCallback, useState, useMemo, useRef } from 'react';
2
- import { useSelector, useDispatch } from 'react-redux';
3
- import { RootState, AppDispatch } from '../redux/store';
4
- import { initialize, setMetrics, resetAchievements, unlockAchievement, clearNotifications } from '../redux/achievementSlice';
5
- import { toast, ToastContainer } from 'react-toastify';
6
- import 'react-toastify/dist/ReactToastify.css';
7
- import {
8
- AchievementDetails,
9
- AchievementMetricValue,
10
- AchievementConfiguration,
11
- AchievementProviderProps,
12
- AchievementMetrics,
13
- AchievementState
14
- } from '../types';
15
- import BadgesButton from '../components/BadgesButton';
16
- import BadgesModal from '../components/BadgesModal';
17
- import ConfettiWrapper from '../components/ConfettiWrapper';
18
- import { defaultStyles } from '../defaultStyles';
19
-
20
- export interface AchievementContextType {
21
- updateMetrics: (newMetrics: AchievementMetrics | ((prevMetrics: AchievementMetrics) => AchievementMetrics)) => void;
22
- unlockedAchievements: string[];
23
- resetStorage: () => void;
24
- }
25
-
26
- export const AchievementContext = React.createContext<AchievementContextType | undefined>(undefined);
27
-
28
- export const useAchievementContext = () => {
29
- const context = React.useContext(AchievementContext);
30
- if (!context) {
31
- throw new Error('useAchievementContext must be used within an AchievementProvider');
32
- }
33
- return context;
34
- };
35
-
36
- // Helper function to serialize dates for Redux actions
37
- const serializeMetrics = (metrics: AchievementMetrics): AchievementMetrics => {
38
- return Object.entries(metrics).reduce((acc, [key, values]) => ({
39
- ...acc,
40
- [key]: values.map(value => value instanceof Date ? value.toISOString() : value)
41
- }), {} as AchievementMetrics);
42
- };
43
-
44
- // Helper function to parse potential date strings
45
- const deserializeValue = (value: string | number | boolean): AchievementMetricValue => {
46
- if (typeof value === 'string') {
47
- // Try to parse ISO date string
48
- const date = new Date(value);
49
- if (!isNaN(date.getTime()) && value === date.toISOString()) {
50
- return date;
51
- }
52
- }
53
- return value;
54
- };
55
-
56
- const AchievementProvider: React.FC<AchievementProviderProps> = ({
57
- children,
58
- config,
59
- initialState = {},
60
- storageKey = 'react-achievements',
61
- badgesButtonPosition = 'top-right',
62
- styles = {},
63
- icons = {},
64
- }) => {
65
- const dispatch: AppDispatch = useDispatch();
66
- const configRef = useRef(config);
67
- const metrics = useSelector((state: RootState) => state.achievements.metrics);
68
- const unlockedAchievementIds = useSelector((state: RootState) => state.achievements.unlockedAchievements);
69
- const pendingNotifications = useSelector((state: RootState) => state.achievements.pendingNotifications);
70
- const [showBadges, setShowBadges] = useState(false);
71
- const [showConfetti, setShowConfetti] = useState(false);
72
-
73
- // Update config ref when it changes
74
- useEffect(() => {
75
- configRef.current = config;
76
- }, [config]);
77
-
78
- const checkAchievements = useCallback(() => {
79
- Object.entries(configRef.current).forEach(([metricName, conditions]) => {
80
- const metricValues = metrics[metricName];
81
- if (!metricValues) return;
82
-
83
- const latestValue = deserializeValue(metricValues[metricValues.length - 1]);
84
- const state: AchievementState = {
85
- metrics: Object.entries(metrics).reduce((acc, [key, values]) => ({
86
- ...acc,
87
- [key]: values.map(deserializeValue)
88
- }), {}),
89
- unlockedAchievements: unlockedAchievementIds
90
- };
91
-
92
- conditions.forEach((condition) => {
93
- if (
94
- condition.isConditionMet(latestValue, state) &&
95
- !unlockedAchievementIds.includes(condition.achievementDetails.achievementId)
96
- ) {
97
- dispatch(unlockAchievement(condition.achievementDetails));
98
- setShowConfetti(true);
99
- }
100
- });
101
- });
102
- }, [metrics, unlockedAchievementIds, dispatch]);
103
-
104
- // Handle notifications
105
- useEffect(() => {
106
- if (pendingNotifications.length > 0) {
107
- pendingNotifications.forEach((notification) => {
108
- toast.success(
109
- <div>
110
- <h4 style={{ margin: '0 0 8px 0' }}>Achievement Unlocked! 🎉</h4>
111
- <strong>{notification.achievementTitle}</strong>
112
- <p style={{ margin: '4px 0 0 0' }}>{notification.achievementDescription}</p>
113
- {notification.achievementIconKey && icons[notification.achievementIconKey] && (
114
- <div style={{ fontSize: '24px', marginTop: '8px' }}>
115
- {icons[notification.achievementIconKey]}
116
- </div>
117
- )}
118
- </div>,
119
- {
120
- position: "top-right",
121
- autoClose: 5000,
122
- hideProgressBar: false,
123
- closeOnClick: true,
124
- pauseOnHover: true,
125
- draggable: true,
126
- }
127
- );
128
- });
129
- dispatch(clearNotifications());
130
- }
131
- }, [pendingNotifications, dispatch, icons]);
132
-
133
- // Reset confetti after delay
134
- useEffect(() => {
135
- if (showConfetti) {
136
- const timer = setTimeout(() => setShowConfetti(false), 5000);
137
- return () => clearTimeout(timer);
138
- }
139
- }, [showConfetti]);
140
-
141
- // Check for achievements when metrics change
142
- useEffect(() => {
143
- checkAchievements();
144
- }, [metrics, checkAchievements]);
145
-
146
- // Initialize on mount, but don't store config in Redux
147
- useEffect(() => {
148
- dispatch(initialize({
149
- initialState,
150
- storageKey,
151
- }));
152
- }, [dispatch, initialState, storageKey]);
153
-
154
- // Convert achievement IDs to details using config from ref
155
- const achievementDetails = useMemo(() => {
156
- return unlockedAchievementIds
157
- .map(id => {
158
- const achievement = Object.values(configRef.current)
159
- .flat()
160
- .find(condition => condition.achievementDetails.achievementId === id);
161
- return achievement?.achievementDetails;
162
- })
163
- .filter((a): a is AchievementDetails => !!a);
164
- }, [unlockedAchievementIds]);
165
-
166
- return (
167
- <AchievementContext.Provider value={{
168
- updateMetrics: (newMetrics) => {
169
- if (typeof newMetrics === 'function') {
170
- const updatedMetrics = newMetrics(metrics);
171
- dispatch(setMetrics(serializeMetrics(updatedMetrics)));
172
- } else {
173
- dispatch(setMetrics(serializeMetrics(newMetrics)));
174
- }
175
- },
176
- unlockedAchievements: unlockedAchievementIds,
177
- resetStorage: () => {
178
- localStorage.removeItem(storageKey);
179
- dispatch(resetAchievements());
180
- },
181
- }}>
182
- {children}
183
- <ToastContainer />
184
- <ConfettiWrapper show={showConfetti} />
185
- <BadgesButton
186
- onClick={() => setShowBadges(true)}
187
- position={badgesButtonPosition}
188
- styles={styles.badgesButton || defaultStyles.badgesButton}
189
- unlockedAchievements={achievementDetails}
190
- />
191
- <BadgesModal
192
- isOpen={showBadges}
193
- achievements={achievementDetails}
194
- onClose={() => setShowBadges(false)}
195
- styles={styles.badgesModal || defaultStyles.badgesModal}
196
- icons={icons}
197
- />
198
- </AchievementContext.Provider>
199
- );
200
- };
201
-
202
- export { AchievementProvider };
@@ -1,19 +0,0 @@
1
- declare module 'react-confetti' {
2
- import { ComponentType } from 'react';
3
-
4
- export interface ConfettiProps {
5
- width?: number;
6
- height?: number;
7
- numberOfPieces?: number;
8
- recycle?: boolean;
9
- run?: boolean;
10
- colors?: string[];
11
- gravity?: number;
12
- wind?: number;
13
- tweenDuration?: number;
14
- drawShape?: (ctx: CanvasRenderingContext2D) => void;
15
- }
16
-
17
- const Confetti: ComponentType<ConfettiProps>;
18
- export default Confetti;
19
- }
@@ -1,4 +0,0 @@
1
- declare module 'react-use' {
2
- export function useWindowSize(): { width: number; height: number };
3
- // Add other functions from react-use that you're using
4
- }
@@ -1,116 +0,0 @@
1
- // src/redux/achievementSlice.ts
2
- import { createSlice, PayloadAction } from '@reduxjs/toolkit';
3
- import {
4
- InitialAchievementMetrics,
5
- AchievementMetrics,
6
- AchievementDetails,
7
- AchievementMetricValue,
8
- } from '../types';
9
-
10
- // Helper function to serialize dates
11
- const serializeValue = (value: AchievementMetricValue): string | number | boolean => {
12
- if (value instanceof Date) {
13
- return value.toISOString();
14
- }
15
- return value;
16
- };
17
-
18
- // Helper function to process metrics for storage
19
- const processMetrics = (metrics: AchievementMetrics): Record<string, (string | number | boolean)[]> => {
20
- return Object.entries(metrics).reduce((acc, [key, values]) => ({
21
- ...acc,
22
- [key]: values.map(serializeValue)
23
- }), {});
24
- };
25
-
26
- export interface AchievementState {
27
- metrics: Record<string, (string | number | boolean)[]>;
28
- unlockedAchievements: string[];
29
- storageKey: string | null;
30
- pendingNotifications: AchievementDetails[];
31
- }
32
-
33
- const initialState: AchievementState = {
34
- metrics: {},
35
- unlockedAchievements: [],
36
- storageKey: null,
37
- pendingNotifications: [],
38
- };
39
-
40
- export const achievementSlice = createSlice({
41
- name: 'achievements',
42
- initialState,
43
- reducers: {
44
- initialize: (state, action: PayloadAction<{
45
- initialState?: InitialAchievementMetrics & { unlockedAchievements?: string[] };
46
- storageKey: string
47
- }>) => {
48
- state.storageKey = action.payload.storageKey;
49
-
50
- // Load from storage first
51
- if (action.payload.storageKey) {
52
- const stored = localStorage.getItem(action.payload.storageKey);
53
- if (stored) {
54
- try {
55
- const parsed = JSON.parse(stored);
56
- state.metrics = parsed.metrics || {};
57
- state.unlockedAchievements = parsed.unlockedAchievements || [];
58
- return;
59
- } catch (error) {
60
- console.error('Error parsing stored achievements:', error);
61
- }
62
- }
63
- }
64
-
65
- // If no storage or parse error, use initial state
66
- if (action.payload.initialState) {
67
- const { unlockedAchievements, ...metrics } = action.payload.initialState;
68
- state.metrics = Object.entries(metrics).reduce((acc, [key, value]) => ({
69
- ...acc,
70
- [key]: Array.isArray(value) ? value.map(serializeValue) : [serializeValue(value as AchievementMetricValue)]
71
- }), {});
72
- state.unlockedAchievements = unlockedAchievements || [];
73
- }
74
- },
75
-
76
- setMetrics: (state, action: PayloadAction<AchievementMetrics>) => {
77
- state.metrics = processMetrics(action.payload);
78
- if (state.storageKey) {
79
- localStorage.setItem(state.storageKey, JSON.stringify({
80
- metrics: state.metrics,
81
- unlockedAchievements: state.unlockedAchievements
82
- }));
83
- }
84
- },
85
-
86
- unlockAchievement: (state, action: PayloadAction<AchievementDetails>) => {
87
- if (!state.unlockedAchievements.includes(action.payload.achievementId)) {
88
- state.unlockedAchievements.push(action.payload.achievementId);
89
- state.pendingNotifications.push(action.payload);
90
- if (state.storageKey) {
91
- localStorage.setItem(state.storageKey, JSON.stringify({
92
- metrics: state.metrics,
93
- unlockedAchievements: state.unlockedAchievements
94
- }));
95
- }
96
- }
97
- },
98
-
99
- clearNotifications: (state) => {
100
- state.pendingNotifications = [];
101
- },
102
-
103
- resetAchievements: (state) => {
104
- state.metrics = {};
105
- state.unlockedAchievements = [];
106
- state.pendingNotifications = [];
107
- if (state.storageKey) {
108
- localStorage.removeItem(state.storageKey);
109
- }
110
- },
111
- },
112
- });
113
-
114
- export const { initialize, setMetrics, resetAchievements, unlockAchievement, clearNotifications } = achievementSlice.actions;
115
-
116
- export default achievementSlice.reducer;
@@ -1,26 +0,0 @@
1
- import { createSlice, PayloadAction } from '@reduxjs/toolkit';
2
-
3
- interface NotificationState {
4
- notifications: string[];
5
- }
6
-
7
- const initialState: NotificationState = {
8
- notifications: [],
9
- };
10
-
11
- export const notificationSlice = createSlice({
12
- name: 'notifications',
13
- initialState,
14
- reducers: {
15
- addNotification: (state, action: PayloadAction<string>) => {
16
- state.notifications.push(action.payload);
17
- },
18
- clearNotifications: (state) => {
19
- state.notifications = [];
20
- },
21
- },
22
- });
23
-
24
- export const { addNotification, clearNotifications } = notificationSlice.actions;
25
-
26
- export default notificationSlice.reducer;
@@ -1,16 +0,0 @@
1
- import { configureStore } from '@reduxjs/toolkit';
2
- import achievementReducer from './achievementSlice';
3
- import { AchievementState } from './achievementSlice';
4
-
5
- export interface RootState {
6
- achievements: AchievementState;
7
- }
8
-
9
- const store = configureStore({
10
- reducer: {
11
- achievements: achievementReducer,
12
- },
13
- });
14
-
15
- export type AppDispatch = typeof store.dispatch;
16
- export default store;
package/src/types.ts DELETED
@@ -1,39 +0,0 @@
1
- import {Styles} from "./defaultStyles";
2
-
3
- export type AchievementMetricValue = number | string | boolean | Date;
4
-
5
- export interface AchievementState {
6
- metrics: Record<string, AchievementMetricValue[]>;
7
- unlockedAchievements: string[];
8
- }
9
-
10
- export interface AchievementDetails {
11
- achievementId: string;
12
- achievementTitle: string;
13
- achievementDescription: string;
14
- achievementIconKey?: string;
15
- }
16
-
17
- export type AchievementIconRecord = Record<string, string>;
18
-
19
- export interface AchievementUnlockCondition {
20
- isConditionMet: (value: AchievementMetricValue, state?: AchievementState) => boolean;
21
- achievementDetails: AchievementDetails;
22
- }
23
-
24
- export interface AchievementConfiguration {
25
- [metricName: string]: AchievementUnlockCondition[];
26
- }
27
-
28
- export type InitialAchievementMetrics = Record<string, AchievementMetricValue | AchievementMetricValue[] | undefined>;
29
- export type AchievementMetrics = Record<string, AchievementMetricValue[]>;
30
-
31
- export interface AchievementProviderProps {
32
- children: React.ReactNode;
33
- config: AchievementConfiguration;
34
- initialState?: InitialAchievementMetrics & { previouslyAwardedAchievements?: string[] };
35
- storageKey?: string;
36
- badgesButtonPosition?: 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right';
37
- styles?: Partial<Styles>;
38
- icons?: Record<string, string>;
39
- }
package/tsconfig.json DELETED
@@ -1,113 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- /* Visit https://aka.ms/tsconfig to read more about this file */
4
-
5
- /* Projects */
6
- // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */
7
- // "composite": true, /* Enable constraints that allow a TypeScript project to be used with project references. */
8
- // "tsBuildInfoFile": "./.tsbuildinfo", /* Specify the path to .tsbuildinfo incremental compilation file. */
9
- // "disableSourceOfProjectReferenceRedirect": true, /* Disable preferring source files instead of declaration files when referencing composite projects. */
10
- // "disableSolutionSearching": true, /* Opt a project out of multi-project reference checking when editing. */
11
- // "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
12
-
13
- /* Language and Environment */
14
- "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
15
- // "lib": [], /* Specify a set of bundled library declaration files that describe the target runtime environment. */
16
- "jsx": "react", /* Specify what JSX code is generated. */
17
- // "experimentalDecorators": true, /* Enable experimental support for legacy experimental decorators. */
18
- // "emitDecoratorMetadata": true, /* Emit design-type metadata for decorated declarations in source files. */
19
- // "jsxFactory": "", /* Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'. */
20
- // "jsxFragmentFactory": "", /* Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'. */
21
- // "jsxImportSource": "", /* Specify module specifier used to import the JSX factory functions when using 'jsx: react-jsx*'. */
22
- // "reactNamespace": "", /* Specify the object invoked for 'createElement'. This only applies when targeting 'react' JSX emit. */
23
- // "noLib": true, /* Disable including any library files, including the default lib.d.ts. */
24
- // "useDefineForClassFields": true, /* Emit ECMAScript-standard-compliant class fields. */
25
- // "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
26
-
27
- /* Modules */
28
- "module": "ES6", /* Specify what module code is generated. */
29
- // "rootDir": "./", /* Specify the root folder within your source files. */
30
- "moduleResolution": "node10", /* Specify how TypeScript looks up a file from a given module specifier. */
31
- // "baseUrl": "./", /* Specify the base directory to resolve non-relative module names. */
32
- // "paths": {}, /* Specify a set of entries that re-map imports to additional lookup locations. */
33
- // "rootDirs": [], /* Allow multiple folders to be treated as one when resolving modules. */
34
- // "typeRoots": [], /* Specify multiple folders that act like './node_modules/@types'. */
35
- // "types": [], /* Specify type package names to be included without being referenced in a source file. */
36
- // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
37
- // "moduleSuffixes": [], /* List of file name suffixes to search when resolving a module. */
38
- // "allowImportingTsExtensions": true, /* Allow imports to include TypeScript file extensions. Requires '--moduleResolution bundler' and either '--noEmit' or '--emitDeclarationOnly' to be set. */
39
- // "resolvePackageJsonExports": true, /* Use the package.json 'exports' field when resolving package imports. */
40
- // "resolvePackageJsonImports": true, /* Use the package.json 'imports' field when resolving imports. */
41
- // "customConditions": [], /* Conditions to set in addition to the resolver-specific defaults when resolving imports. */
42
- // "resolveJsonModule": true, /* Enable importing .json files. */
43
- // "allowArbitraryExtensions": true, /* Enable importing files with any extension, provided a declaration file is present. */
44
- // "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
45
-
46
- /* JavaScript Support */
47
- // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */
48
- // "checkJs": true, /* Enable error reporting in type-checked JavaScript files. */
49
- // "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
50
-
51
- /* Emit */
52
- "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
53
- // "declarationMap": true, /* Create sourcemaps for d.ts files. */
54
- // "emitDeclarationOnly": true, /* Only output d.ts files and not JavaScript files. */
55
- // "sourceMap": true, /* Create source map files for emitted JavaScript files. */
56
- // "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
57
- // "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
58
- "outDir": "./dist", /* Specify an output folder for all emitted files. */
59
- // "removeComments": true, /* Disable emitting comments. */
60
- // "noEmit": true, /* Disable emitting files from a compilation. */
61
- // "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
62
- // "downlevelIteration": true, /* Emit more compliant, but verbose and less performant JavaScript for iteration. */
63
- // "sourceRoot": "", /* Specify the root path for debuggers to find the reference source code. */
64
- // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
65
- // "inlineSources": true, /* Include source code in the sourcemaps inside the emitted JavaScript. */
66
- // "emitBOM": true, /* Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files. */
67
- // "newLine": "crlf", /* Set the newline character for emitting files. */
68
- // "stripInternal": true, /* Disable emitting declarations that have '@internal' in their JSDoc comments. */
69
- // "noEmitHelpers": true, /* Disable generating custom helper functions like '__extends' in compiled output. */
70
- // "noEmitOnError": true, /* Disable emitting files if any type checking errors are reported. */
71
- // "preserveConstEnums": true, /* Disable erasing 'const enum' declarations in generated code. */
72
- // "declarationDir": "./", /* Specify the output directory for generated declaration files. */
73
-
74
- /* Interop Constraints */
75
- // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */
76
- // "verbatimModuleSyntax": true, /* Do not transform or elide any imports or exports not marked as type-only, ensuring they are written in the output file's format based on the 'module' setting. */
77
- // "isolatedDeclarations": true, /* Require sufficient annotation on exports so other tools can trivially generate declaration files. */
78
- // "allowSyntheticDefaultImports": true, /* Allow 'import x from y' when a module doesn't have a default export. */
79
- "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
80
- "preserveSymlinks": true, /* Disable resolving symlinks to their realpath. This correlates to the same flag in node. */
81
- "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
82
-
83
- /* Type Checking */
84
- "strict": true, /* Enable all strict type-checking options. */
85
- // "noImplicitAny": true, /* Enable error reporting for expressions and declarations with an implied 'any' type. */
86
- // "strictNullChecks": true, /* When type checking, take into account 'null' and 'undefined'. */
87
- // "strictFunctionTypes": true, /* When assigning functions, check to ensure parameters and the return values are subtype-compatible. */
88
- // "strictBindCallApply": true, /* Check that the arguments for 'bind', 'call', and 'apply' methods match the original function. */
89
- // "strictPropertyInitialization": true, /* Check for class properties that are declared but not set in the constructor. */
90
- // "noImplicitThis": true, /* Enable error reporting when 'this' is given the type 'any'. */
91
- // "useUnknownInCatchVariables": true, /* Default catch clause variables as 'unknown' instead of 'any'. */
92
- // "alwaysStrict": true, /* Ensure 'use strict' is always emitted. */
93
- // "noUnusedLocals": true, /* Enable error reporting when local variables aren't read. */
94
- // "noUnusedParameters": true, /* Raise an error when a function parameter isn't read. */
95
- // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
96
- // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
97
- // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
98
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
99
- // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
100
- // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
101
- // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
102
- // "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
103
-
104
- /* Completeness */
105
- // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */
106
- "skipLibCheck": true /* Skip type checking all .d.ts files. */
107
- },
108
- "include": [
109
- "src",
110
- "stories",
111
- "react-confetti.d.ts"
112
- ]
113
- }