@dreamtree-org/twreact-ui 1.0.99 → 1.0.100

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/index.esm.js CHANGED
@@ -16517,7 +16517,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
16517
16517
  }));
16518
16518
  };
16519
16519
 
16520
- var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className"],
16520
+ var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className", "onOpen"],
16521
16521
  _excluded2$1 = ["children", "className"],
16522
16522
  _excluded3$1 = ["children", "className"],
16523
16523
  _excluded4$1 = ["children", "className"];
@@ -16534,6 +16534,7 @@ var Dialog = function Dialog(_ref) {
16534
16534
  showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
16535
16535
  footer = _ref.footer,
16536
16536
  className = _ref.className,
16537
+ onOpen = _ref.onOpen,
16537
16538
  props = _objectWithoutProperties$1(_ref, _excluded$8);
16538
16539
  var dialogRef = useRef(null);
16539
16540
  useEffect(function () {
@@ -16541,6 +16542,9 @@ var Dialog = function Dialog(_ref) {
16541
16542
  var _dialogRef$current;
16542
16543
  document.body.style.overflow = 'hidden';
16543
16544
  (_dialogRef$current = dialogRef.current) === null || _dialogRef$current === void 0 || _dialogRef$current.focus();
16545
+ onOpen === null || onOpen === void 0 || onOpen({
16546
+ dialogRef: dialogRef.current
16547
+ });
16544
16548
  } else {
16545
16549
  document.body.style.overflow = 'unset';
16546
16550
  }
@@ -20990,7 +20994,10 @@ var TrackingPromise = /*#__PURE__*/function () {
20990
20994
  var helperInstance = new Helpers();
20991
20995
 
20992
20996
  // src/store/cartSlice.js
20993
- var storeInstance = {};
20997
+ var storeInstance = {
20998
+ actions: {}
20999
+ };
21000
+ var promiseMap = new Map();
20994
21001
  function getStore() {
20995
21002
  var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
20996
21003
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -21000,8 +21007,22 @@ function getStore() {
21000
21007
  reducers: {
21001
21008
  setStore: function setStore(state, _ref) {
21002
21009
  var payload = _ref.payload;
21003
- context.changes.push(payload);
21004
- var newState = helperInstance.setNested(state, payload.name, payload.value);
21010
+ // Extract only serializable data
21011
+ var name = payload.name,
21012
+ value = payload.value,
21013
+ uniqueId = payload.uniqueId;
21014
+
21015
+ // Store change event for listener middleware (without promise)
21016
+ // Note: We no longer store resolve/reject functions here - they're in promiseMap
21017
+ if (context.changes) {
21018
+ var changeEvent = {
21019
+ name: name,
21020
+ value: value,
21021
+ uniqueId: uniqueId
21022
+ };
21023
+ context.changes.push(changeEvent);
21024
+ }
21025
+ var newState = helperInstance.setNested(state, name, value);
21005
21026
  return newState;
21006
21027
  }
21007
21028
  }
@@ -21057,20 +21078,36 @@ var useMixins = function useMixins(name) {
21057
21078
  };
21058
21079
  var setStore = function setStore(name, value) {
21059
21080
  var timestamp = Date.now();
21060
- var changeEvent = {
21081
+ var uniqueId = timestamp;
21082
+
21083
+ // Create promise - the TrackingPromise has resolve/reject methods we can call
21084
+ var promise = new TrackingPromise(function () {
21085
+ // Callback is called but we don't need to store resolve/reject here
21086
+ // We'll use promise.resolve() and promise.reject() methods directly
21087
+ });
21088
+
21089
+ // Store promise in module-level map (not in action payload)
21090
+ promiseMap.set(uniqueId, promise);
21091
+
21092
+ // Create a completely clean, serializable payload object
21093
+ // Only include primitive/serializable values - no promises, no functions
21094
+ var cleanPayload = {
21061
21095
  name: name,
21062
21096
  value: value,
21063
- uniqueId: timestamp,
21064
- promise: null,
21065
- resolve: null,
21066
- reject: null
21097
+ uniqueId: uniqueId
21067
21098
  };
21068
- var promise = new TrackingPromise(function (resolve, reject) {
21069
- changeEvent.resolve = resolve;
21070
- changeEvent.reject = reject;
21071
- });
21072
- changeEvent.promise = promise;
21073
- dispatch(storeInstance.actions.setStore(changeEvent));
21099
+
21100
+ // Dispatch using action creator if available, otherwise use action type directly
21101
+ // This handles the case where the store hasn't been initialized yet
21102
+ if (storeInstance.actions.setStore) {
21103
+ dispatch(storeInstance.actions.setStore(cleanPayload));
21104
+ } else {
21105
+ // Fallback: create action manually using the action type
21106
+ dispatch({
21107
+ type: 'store/setStore',
21108
+ payload: cleanPayload
21109
+ });
21110
+ }
21074
21111
  return promise;
21075
21112
  };
21076
21113
  var getStore = function getStore(name) {
@@ -26337,8 +26374,8 @@ function setupStore() {
26337
26374
  middleware: function middleware(getDefault) {
26338
26375
  return getDefault({
26339
26376
  serializableCheck: {
26340
- // Ignore redux-persist action types
26341
- ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER]
26377
+ // Ignore redux-persist action types and setStore action
26378
+ ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER, 'store/setStore']
26342
26379
  }
26343
26380
  }).concat(listenerMiddleware.middleware);
26344
26381
  },
@@ -26349,21 +26386,39 @@ function setupStore() {
26349
26386
  matcher: isAnyOf(actions.setStore),
26350
26387
  effect: function () {
26351
26388
  var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(action, api) {
26352
- var state, changeEvent;
26389
+ var state, stateSlice, changeEvent, uniqueId, value, promise;
26353
26390
  return _regeneratorRuntime.wrap(function (_context) {
26354
26391
  while (1) switch (_context.prev = _context.next) {
26355
26392
  case 0:
26356
- state = api.getState(); // already the **next** state
26357
- state.storeSlice;
26358
- changeEvent = action.payload; // do things after state is reduced
26359
- context.changes.forEach(function (change) {
26360
- if (change.uniqueId === changeEvent.uniqueId) {
26361
- change.resolve(changeEvent.value);
26393
+ try {
26394
+ state = api.getState(); // already the **next** state
26395
+ stateSlice = state.storeSlice;
26396
+ changeEvent = action.payload; // do things after state is reduced
26397
+ uniqueId = changeEvent.uniqueId, value = changeEvent.value; // Resolve promise from module-level map if it exists
26398
+ if (promiseMap && promiseMap.has(uniqueId)) {
26399
+ promise = promiseMap.get(uniqueId);
26400
+ if (promise && typeof promise.resolve === 'function') {
26401
+ promise.resolve(value);
26402
+ }
26403
+ // Clean up fulfilled promises
26404
+ if (promise && promise.isFulfilled()) {
26405
+ promiseMap["delete"](uniqueId);
26406
+ }
26362
26407
  }
26363
- });
26364
- context.changes = context.changes.filter(function (change) {
26365
- return !change.promise.isFulfilled();
26366
- });
26408
+
26409
+ // Clean up changes array - remove fulfilled promises
26410
+ context.changes = context.changes.filter(function (change) {
26411
+ // Check if promise still exists in promiseMap
26412
+ if (promiseMap && promiseMap.has(change.uniqueId)) {
26413
+ var _promise = promiseMap.get(change.uniqueId);
26414
+ return _promise && !_promise.isFulfilled();
26415
+ }
26416
+ return false;
26417
+ });
26418
+ } catch (error) {
26419
+ console.error('Error in setStore listener middleware:', error);
26420
+ // Don't throw - let the action complete even if promise resolution fails
26421
+ }
26367
26422
  case 1:
26368
26423
  case "end":
26369
26424
  return _context.stop();
package/dist/index.js CHANGED
@@ -16537,7 +16537,7 @@ var Breadcrumbs = function Breadcrumbs(_ref) {
16537
16537
  }));
16538
16538
  };
16539
16539
 
16540
- var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className"],
16540
+ var _excluded$8 = ["isOpen", "onClose", "title", "children", "size", "dismissible", "showCloseButton", "footer", "className", "onOpen"],
16541
16541
  _excluded2$1 = ["children", "className"],
16542
16542
  _excluded3$1 = ["children", "className"],
16543
16543
  _excluded4$1 = ["children", "className"];
@@ -16554,6 +16554,7 @@ var Dialog = function Dialog(_ref) {
16554
16554
  showCloseButton = _ref$showCloseButton === void 0 ? true : _ref$showCloseButton,
16555
16555
  footer = _ref.footer,
16556
16556
  className = _ref.className,
16557
+ onOpen = _ref.onOpen,
16557
16558
  props = _objectWithoutProperties$1(_ref, _excluded$8);
16558
16559
  var dialogRef = React.useRef(null);
16559
16560
  React.useEffect(function () {
@@ -16561,6 +16562,9 @@ var Dialog = function Dialog(_ref) {
16561
16562
  var _dialogRef$current;
16562
16563
  document.body.style.overflow = 'hidden';
16563
16564
  (_dialogRef$current = dialogRef.current) === null || _dialogRef$current === void 0 || _dialogRef$current.focus();
16565
+ onOpen === null || onOpen === void 0 || onOpen({
16566
+ dialogRef: dialogRef.current
16567
+ });
16564
16568
  } else {
16565
16569
  document.body.style.overflow = 'unset';
16566
16570
  }
@@ -21010,7 +21014,10 @@ var TrackingPromise = /*#__PURE__*/function () {
21010
21014
  var helperInstance = new Helpers();
21011
21015
 
21012
21016
  // src/store/cartSlice.js
21013
- var storeInstance = {};
21017
+ var storeInstance = {
21018
+ actions: {}
21019
+ };
21020
+ var promiseMap = new Map();
21014
21021
  function getStore() {
21015
21022
  var initialState = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
21016
21023
  var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
@@ -21020,8 +21027,22 @@ function getStore() {
21020
21027
  reducers: {
21021
21028
  setStore: function setStore(state, _ref) {
21022
21029
  var payload = _ref.payload;
21023
- context.changes.push(payload);
21024
- var newState = helperInstance.setNested(state, payload.name, payload.value);
21030
+ // Extract only serializable data
21031
+ var name = payload.name,
21032
+ value = payload.value,
21033
+ uniqueId = payload.uniqueId;
21034
+
21035
+ // Store change event for listener middleware (without promise)
21036
+ // Note: We no longer store resolve/reject functions here - they're in promiseMap
21037
+ if (context.changes) {
21038
+ var changeEvent = {
21039
+ name: name,
21040
+ value: value,
21041
+ uniqueId: uniqueId
21042
+ };
21043
+ context.changes.push(changeEvent);
21044
+ }
21045
+ var newState = helperInstance.setNested(state, name, value);
21025
21046
  return newState;
21026
21047
  }
21027
21048
  }
@@ -21077,20 +21098,36 @@ var useMixins = function useMixins(name) {
21077
21098
  };
21078
21099
  var setStore = function setStore(name, value) {
21079
21100
  var timestamp = Date.now();
21080
- var changeEvent = {
21101
+ var uniqueId = timestamp;
21102
+
21103
+ // Create promise - the TrackingPromise has resolve/reject methods we can call
21104
+ var promise = new TrackingPromise(function () {
21105
+ // Callback is called but we don't need to store resolve/reject here
21106
+ // We'll use promise.resolve() and promise.reject() methods directly
21107
+ });
21108
+
21109
+ // Store promise in module-level map (not in action payload)
21110
+ promiseMap.set(uniqueId, promise);
21111
+
21112
+ // Create a completely clean, serializable payload object
21113
+ // Only include primitive/serializable values - no promises, no functions
21114
+ var cleanPayload = {
21081
21115
  name: name,
21082
21116
  value: value,
21083
- uniqueId: timestamp,
21084
- promise: null,
21085
- resolve: null,
21086
- reject: null
21117
+ uniqueId: uniqueId
21087
21118
  };
21088
- var promise = new TrackingPromise(function (resolve, reject) {
21089
- changeEvent.resolve = resolve;
21090
- changeEvent.reject = reject;
21091
- });
21092
- changeEvent.promise = promise;
21093
- dispatch(storeInstance.actions.setStore(changeEvent));
21119
+
21120
+ // Dispatch using action creator if available, otherwise use action type directly
21121
+ // This handles the case where the store hasn't been initialized yet
21122
+ if (storeInstance.actions.setStore) {
21123
+ dispatch(storeInstance.actions.setStore(cleanPayload));
21124
+ } else {
21125
+ // Fallback: create action manually using the action type
21126
+ dispatch({
21127
+ type: 'store/setStore',
21128
+ payload: cleanPayload
21129
+ });
21130
+ }
21094
21131
  return promise;
21095
21132
  };
21096
21133
  var getStore = function getStore(name) {
@@ -26357,8 +26394,8 @@ function setupStore() {
26357
26394
  middleware: function middleware(getDefault) {
26358
26395
  return getDefault({
26359
26396
  serializableCheck: {
26360
- // Ignore redux-persist action types
26361
- ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER]
26397
+ // Ignore redux-persist action types and setStore action
26398
+ ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER, 'store/setStore']
26362
26399
  }
26363
26400
  }).concat(listenerMiddleware.middleware);
26364
26401
  },
@@ -26369,21 +26406,39 @@ function setupStore() {
26369
26406
  matcher: isAnyOf(actions.setStore),
26370
26407
  effect: function () {
26371
26408
  var _effect = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(action, api) {
26372
- var state, changeEvent;
26409
+ var state, stateSlice, changeEvent, uniqueId, value, promise;
26373
26410
  return _regeneratorRuntime.wrap(function (_context) {
26374
26411
  while (1) switch (_context.prev = _context.next) {
26375
26412
  case 0:
26376
- state = api.getState(); // already the **next** state
26377
- state.storeSlice;
26378
- changeEvent = action.payload; // do things after state is reduced
26379
- context.changes.forEach(function (change) {
26380
- if (change.uniqueId === changeEvent.uniqueId) {
26381
- change.resolve(changeEvent.value);
26413
+ try {
26414
+ state = api.getState(); // already the **next** state
26415
+ stateSlice = state.storeSlice;
26416
+ changeEvent = action.payload; // do things after state is reduced
26417
+ uniqueId = changeEvent.uniqueId, value = changeEvent.value; // Resolve promise from module-level map if it exists
26418
+ if (promiseMap && promiseMap.has(uniqueId)) {
26419
+ promise = promiseMap.get(uniqueId);
26420
+ if (promise && typeof promise.resolve === 'function') {
26421
+ promise.resolve(value);
26422
+ }
26423
+ // Clean up fulfilled promises
26424
+ if (promise && promise.isFulfilled()) {
26425
+ promiseMap["delete"](uniqueId);
26426
+ }
26382
26427
  }
26383
- });
26384
- context.changes = context.changes.filter(function (change) {
26385
- return !change.promise.isFulfilled();
26386
- });
26428
+
26429
+ // Clean up changes array - remove fulfilled promises
26430
+ context.changes = context.changes.filter(function (change) {
26431
+ // Check if promise still exists in promiseMap
26432
+ if (promiseMap && promiseMap.has(change.uniqueId)) {
26433
+ var _promise = promiseMap.get(change.uniqueId);
26434
+ return _promise && !_promise.isFulfilled();
26435
+ }
26436
+ return false;
26437
+ });
26438
+ } catch (error) {
26439
+ console.error('Error in setStore listener middleware:', error);
26440
+ // Don't throw - let the action complete even if promise resolution fails
26441
+ }
26387
26442
  case 1:
26388
26443
  case "end":
26389
26444
  return _context.stop();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamtree-org/twreact-ui",
3
- "version": "1.0.99",
3
+ "version": "1.0.100",
4
4
  "description": "A comprehensive React + Tailwind components library for building modern web apps",
5
5
  "author": {
6
6
  "name": "Partha Preetham Krishna",