tsv2-library 1.0.61-alpha.125 → 1.0.61-alpha.127

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.
@@ -26082,6 +26082,77 @@ const Presets = {
26082
26082
  terminal,
26083
26083
  image: ImagePreset
26084
26084
  };
26085
+ function mitt(all) {
26086
+ var _a;
26087
+ all = all || ((_a = window.eventBus) == null ? void 0 : _a.all) || /* @__PURE__ */ new Map();
26088
+ const bus = {
26089
+ /**
26090
+ * A Map of event names to registered handler functions.
26091
+ */
26092
+ all,
26093
+ /**
26094
+ * Register an event handler for the given type.
26095
+ * @param {string|symbol} type Type of event to listen for, or `'*'` for all events
26096
+ * @param {Function} handler Function to call in response to given event
26097
+ * @memberOf mitt
26098
+ */
26099
+ on(type, handler9) {
26100
+ const handlers = all == null ? void 0 : all.get(type);
26101
+ if (handlers) {
26102
+ handlers.push(handler9);
26103
+ } else {
26104
+ all == null ? void 0 : all.set(type, [handler9]);
26105
+ }
26106
+ },
26107
+ /**
26108
+ * Remove an event handler for the given type.
26109
+ * If `handler` is omitted, all handlers of the given type are removed.
26110
+ * @param {string|symbol} type Type of event to unregister `handler` from (`'*'` to remove a wildcard handler)
26111
+ * @param {Function} [handler] Handler function to remove
26112
+ * @memberOf mitt
26113
+ */
26114
+ off(type, handler9) {
26115
+ const handlers = all == null ? void 0 : all.get(type);
26116
+ if (handlers) {
26117
+ if (handler9) {
26118
+ handlers.splice(handlers.indexOf(handler9) >>> 0, 1);
26119
+ } else {
26120
+ all == null ? void 0 : all.set(type, []);
26121
+ }
26122
+ }
26123
+ },
26124
+ /**
26125
+ * Invoke all handlers for the given type.
26126
+ * If present, `'*'` handlers are invoked after type-matched handlers.
26127
+ *
26128
+ * Note: Manually firing '*' handlers is not supported.
26129
+ *
26130
+ * @param {string|symbol} type The event type to invoke
26131
+ * @param {Any} [evt] Any value (object is recommended and powerful), passed to each handler
26132
+ * @memberOf mitt
26133
+ */
26134
+ emit(type, evt) {
26135
+ let handlers = all == null ? void 0 : all.get(type);
26136
+ if (handlers) {
26137
+ handlers.slice().map((handler9) => {
26138
+ handler9(evt);
26139
+ });
26140
+ }
26141
+ handlers = all == null ? void 0 : all.get("*");
26142
+ if (handlers) {
26143
+ handlers.slice().map((handler9) => {
26144
+ handler9(type, evt);
26145
+ });
26146
+ }
26147
+ }
26148
+ };
26149
+ window.eventBus ?? (window.eventBus = bus);
26150
+ return window.eventBus;
26151
+ }
26152
+ const eventBus = mitt();
26153
+ const extendEventBus = () => {
26154
+ return eventBus;
26155
+ };
26085
26156
  const flattenTreeNodeChildren = (nodes) => {
26086
26157
  if (!nodes)
26087
26158
  return [];
@@ -77914,7 +77985,9 @@ export {
77914
77985
  clearStorage,
77915
77986
  buildEntry as default,
77916
77987
  downloadFile,
77988
+ eventBus,
77917
77989
  exportToExcel,
77990
+ extendEventBus,
77918
77991
  filterNodeKeys,
77919
77992
  flattenTreeNodeChildren,
77920
77993
  forceLogout,