@donotdev/components 0.0.22 → 0.0.24
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.
- package/dist/advanced/Carousel/CarouselContent.d.ts +14 -2
- package/dist/advanced/Carousel/CarouselContent.d.ts.map +1 -1
- package/dist/advanced/Carousel/CarouselContent.js +138 -53
- package/dist/advanced/Code/CodeContent.d.ts.map +1 -1
- package/dist/advanced/Code/CodeContent.js +5 -1
- package/dist/advanced/Crawl/Crawl.d.ts.map +1 -1
- package/dist/advanced/Crawl/Crawl.js +15 -3
- package/dist/advanced/Crawl/utils/parseHtml.d.ts.map +1 -1
- package/dist/advanced/Crawl/utils/parseHtml.js +10 -9
- package/dist/advanced/ImageGallery/ImageGallery.d.ts.map +1 -1
- package/dist/advanced/ImageGallery/ImageGallery.js +4 -0
- package/dist/advanced/JsonViewer/JsonViewer.d.ts.map +1 -1
- package/dist/advanced/JsonViewer/JsonViewer.js +9 -8
- package/dist/advanced/Reveal/Reveal.d.ts.map +1 -1
- package/dist/advanced/Reveal/Reveal.js +1 -1
- package/dist/advanced/SplitReveal/SplitReveal.d.ts.map +1 -1
- package/dist/advanced/SplitReveal/SplitReveal.js +1 -1
- package/dist/atomic/ButtonGroup/index.d.ts +93 -0
- package/dist/atomic/ButtonGroup/index.d.ts.map +1 -0
- package/dist/atomic/ButtonGroup/index.js +57 -0
- package/dist/atomic/ColorPicker/index.d.ts +100 -0
- package/dist/atomic/ColorPicker/index.d.ts.map +1 -0
- package/dist/atomic/ColorPicker/index.js +195 -0
- package/dist/atomic/Combobox/index.d.ts.map +1 -1
- package/dist/atomic/Combobox/index.js +27 -3
- package/dist/atomic/Rating/index.d.ts.map +1 -1
- package/dist/atomic/Rating/index.js +1 -1
- package/dist/atomic/SkipLink/index.d.ts +38 -0
- package/dist/atomic/SkipLink/index.d.ts.map +1 -0
- package/dist/atomic/SkipLink/index.js +56 -0
- package/dist/atomic/TreeView/index.d.ts +116 -0
- package/dist/atomic/TreeView/index.d.ts.map +1 -0
- package/dist/atomic/TreeView/index.js +316 -0
- package/dist/atomic/VideoPlayer/index.d.ts.map +1 -1
- package/dist/atomic/VideoPlayer/index.js +9 -4
- package/dist/atomic/index.d.ts +8 -0
- package/dist/atomic/index.d.ts.map +1 -1
- package/dist/atomic/index.js +4 -0
- package/dist/hooks/useClickOutside.d.ts.map +1 -1
- package/dist/hooks/useClickOutside.js +2 -0
- package/dist/hooks/useIntersectionObserver.js +1 -1
- package/dist/hooks/useSwipeToClose.d.ts.map +1 -1
- package/dist/hooks/useSwipeToClose.js +12 -4
- package/dist/hooks/useToast.d.ts.map +1 -1
- package/dist/hooks/useToast.js +25 -4
- package/dist/index.js +6 -6
- package/dist/styles/index.css +536 -41
- package/dist/utils/intersectionObserver.d.ts.map +1 -1
- package/dist/utils/intersectionObserver.js +4 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/hooks/useToast.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,IAAI,mBAAmB,EAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"useToast.d.ts","sourceRoot":"","sources":["../../src/hooks/useToast.tsx"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EACV,kBAAkB,EAClB,UAAU,IAAI,mBAAmB,EAClC,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAcvC;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAMrD,CAAC;AAMF;;;;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"}
|
package/dist/hooks/useToast.js
CHANGED
|
@@ -28,7 +28,10 @@ import { useSyncExternalStore, useMemo } from 'react';
|
|
|
28
28
|
// CONSTANTS & CONFIGURATION
|
|
29
29
|
// ============================================================================
|
|
30
30
|
const TOAST_LIMIT = 5;
|
|
31
|
-
|
|
31
|
+
// Must match the CSS exit animation duration in Toast styles — changing this
|
|
32
|
+
// without updating the CSS will cause toasts to vanish before animation completes
|
|
33
|
+
// or linger after animation ends.
|
|
34
|
+
const TOAST_REMOVE_DELAY = 300;
|
|
32
35
|
// ToastType is imported from Toast.types.ts
|
|
33
36
|
/**
|
|
34
37
|
* Toast duration configuration
|
|
@@ -151,7 +154,16 @@ const getMemoryState = () => {
|
|
|
151
154
|
}
|
|
152
155
|
return snapshotCache;
|
|
153
156
|
};
|
|
154
|
-
|
|
157
|
+
// Always return the same array reference from window global — never a new [].
|
|
158
|
+
// This guarantees push/splice in subscribe and forEach in dispatch operate on the same array.
|
|
159
|
+
const getListeners = () => {
|
|
160
|
+
if (typeof window === 'undefined')
|
|
161
|
+
return [];
|
|
162
|
+
if (!window.__DNDEV_TOAST_LISTENERS__) {
|
|
163
|
+
window.__DNDEV_TOAST_LISTENERS__ = [];
|
|
164
|
+
}
|
|
165
|
+
return window.__DNDEV_TOAST_LISTENERS__;
|
|
166
|
+
};
|
|
155
167
|
function dispatch(action) {
|
|
156
168
|
const currentState = getMemoryState();
|
|
157
169
|
const newState = reducer(currentState, action);
|
|
@@ -163,8 +175,17 @@ function dispatch(action) {
|
|
|
163
175
|
if (process.env.NODE_ENV === 'development') {
|
|
164
176
|
console.log('[Toast] Dispatch:', action.type, 'Listeners:', getListeners().length);
|
|
165
177
|
}
|
|
166
|
-
// Notify all listeners
|
|
167
|
-
getListeners().forEach((listener) =>
|
|
178
|
+
// Notify all listeners — wrap each call so one throwing listener doesn't break the chain
|
|
179
|
+
getListeners().forEach((listener) => {
|
|
180
|
+
try {
|
|
181
|
+
listener(newState);
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
if (process.env.NODE_ENV === 'development') {
|
|
185
|
+
console.error('[Toast] Listener threw:', err);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
});
|
|
168
189
|
}
|
|
169
190
|
/**
|
|
170
191
|
* Toast state reducer
|