@apia/util 4.0.45 → 5.0.0

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.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import * as React from 'react';
2
- import React__default, { SetStateAction, Dispatch, EffectCallback, MutableRefObject, DependencyList, FC, HTMLAttributes } from 'react';
2
+ import React__default, { SetStateAction, Dispatch, EffectCallback, MutableRefObject, DependencyList, FC, HTMLAttributes, ReactNode } from 'react';
3
3
  import { AxiosResponse } from 'axios';
4
+ import * as react_jsx_runtime from 'react/jsx-runtime';
4
5
 
5
6
  declare function animate(duration: number, callback: (progress: number) => unknown, onFinish?: () => unknown): () => void;
6
7
 
@@ -39,7 +40,7 @@ declare function uniqueId(prefix?: string): string;
39
40
 
40
41
  declare function apiaDateToStandarFormat(date: string): string;
41
42
 
42
- declare function dateToApiaFormat(date: string | Date): string;
43
+ declare function dateToApiaFormat(date: string | Date): string | undefined;
43
44
 
44
45
  type TDateFormat = 'DD/MM/YYYY' | 'MM/DD/YYYY' | 'YYYY/MM/DD';
45
46
 
@@ -50,6 +51,8 @@ declare global {
50
51
  }
51
52
  declare const getDateFormat: (format?: string) => TDateFormat;
52
53
 
54
+ declare function dateFromApiaFormat(str: string): Date | null;
55
+
53
56
  declare global {
54
57
  const VERSION: string;
55
58
  const COMMITHASH: string;
@@ -773,18 +776,18 @@ type TApiaFilter = {
773
776
  isRange?: boolean;
774
777
  };
775
778
 
776
- interface TApiaAction {
779
+ interface T__LEGACY_SERVER__ApiaAction {
777
780
  toDo?: string;
778
781
  param: string | string[];
779
782
  }
780
- interface TApiaActions {
781
- action: TApiaAction | TApiaAction[];
783
+ interface T__LEGACY_SERVER__ApiaActions {
784
+ action: T__LEGACY_SERVER__ApiaAction | T__LEGACY_SERVER__ApiaAction[];
782
785
  }
783
- interface TApiaMessage {
786
+ interface T__LEGACY_SERVER__ApiaMessage {
784
787
  text: string;
785
788
  label?: string;
786
789
  }
787
- type TApiaComplexCell = {
790
+ type T__LEGACY_SERVER__ApiaComplexCell = {
788
791
  label: string;
789
792
  classToAdd?: string;
790
793
  isHTML?: boolean;
@@ -792,8 +795,8 @@ type TApiaComplexCell = {
792
795
  forceTitle?: string;
793
796
  [key: string]: unknown;
794
797
  };
795
- type TApiaCellDefinition = TApiaComplexCell | string;
796
- type TApiaRowDefinition = {
798
+ type T__LEGACY_SERVER__ApiaCellDefinition = T__LEGACY_SERVER__ApiaComplexCell | string;
799
+ type T__LEGACY_SERVER__ApiaRowDefinition = {
797
800
  'data-selected'?: boolean;
798
801
  selected?: boolean;
799
802
  dblclic: boolean;
@@ -806,11 +809,11 @@ type TApiaRowDefinition = {
806
809
  docLock?: boolean;
807
810
  uneditableTR?: boolean;
808
811
  isLocked?: boolean;
809
- cell: TApiaCellDefinition | TApiaCellDefinition[];
812
+ cell: T__LEGACY_SERVER__ApiaCellDefinition | T__LEGACY_SERVER__ApiaCellDefinition[];
810
813
  boldType?: boolean;
811
814
  'expired-doc': true;
812
815
  };
813
- type TApiaFunctionPageInfo = {
816
+ type T__LEGACY_SERVER__ApiaFunctionPageInfo = {
814
817
  amount: string;
815
818
  currentPage: string;
816
819
  hasMore: boolean;
@@ -822,30 +825,30 @@ type TApiaFunctionPageInfo = {
822
825
  orderType: 'desc' | '';
823
826
  orderCol: number;
824
827
  };
825
- type TApiaSystemMessageObj<Structure = Record<string, unknown>> = Structure & {
828
+ type T__LEGACY_SERVER__ApiaSystemMessageObj<Structure = Record<string, unknown>> = Structure & {
826
829
  onClose?: string;
827
830
  sysMessages?: {
828
- message: TApiaMessage | TApiaMessage[];
831
+ message: T__LEGACY_SERVER__ApiaMessage | T__LEGACY_SERVER__ApiaMessage[];
829
832
  };
830
833
  sysExceptions?: {
831
- exception: TApiaMessage | TApiaMessage[];
834
+ exception: T__LEGACY_SERVER__ApiaMessage | T__LEGACY_SERVER__ApiaMessage[];
832
835
  };
833
836
  exceptions?: {
834
- exception: TApiaMessage | TApiaMessage[];
837
+ exception: T__LEGACY_SERVER__ApiaMessage | T__LEGACY_SERVER__ApiaMessage[];
835
838
  };
836
- actions?: TApiaActions;
839
+ actions?: T__LEGACY_SERVER__ApiaActions;
837
840
  code?: unknown;
838
841
  load?: Structure;
839
842
  };
840
- type TApiaTableFunction = {
843
+ type T__LEGACY_SERVER__ApiaTableFunction = {
841
844
  result: {
842
- pageInfo: TApiaFunctionPageInfo;
845
+ pageInfo: T__LEGACY_SERVER__ApiaFunctionPageInfo;
843
846
  table?: {
844
- row: TApiaRowDefinition | TApiaRowDefinition[];
847
+ row: T__LEGACY_SERVER__ApiaRowDefinition | T__LEGACY_SERVER__ApiaRowDefinition[];
845
848
  };
846
849
  };
847
850
  };
848
- type TApiaFunction<T = TApiaTableFunction, HasMessages = true> = HasMessages extends true ? {
851
+ type T__LEGACY_SERVER__ApiaFunction<T = T__LEGACY_SERVER__ApiaTableFunction, HasMessages = true> = HasMessages extends true ? {
849
852
  function: {
850
853
  dropLastMessage?: boolean;
851
854
  name: string;
@@ -856,7 +859,7 @@ type TApiaFunction<T = TApiaTableFunction, HasMessages = true> = HasMessages ext
856
859
  name: string;
857
860
  } & T;
858
861
  };
859
- type TApiaLoadText = {
862
+ type T__LEGACY_SERVER__ApiaLoadText = {
860
863
  text: {
861
864
  closeAll: boolean;
862
865
  title: string;
@@ -864,29 +867,43 @@ type TApiaLoadText = {
864
867
  content: string;
865
868
  };
866
869
  };
867
- type TApiaLoad<T extends Record<string, unknown> = TApiaLoadForm> = {
870
+ type T__LEGACY_SERVER__ApiaLoad<T extends Record<string, unknown> = TApiaLoadForm> = {
868
871
  canClose: boolean;
869
872
  type: string;
870
873
  } & T;
871
- interface TMessage {
874
+ interface T__LEGACY_SERVER__Message {
872
875
  text: string;
873
876
  content?: string;
874
877
  title?: string;
878
+ stack?: string;
875
879
  type?: string;
876
880
  }
877
- interface TNotificationMessage {
881
+ interface T__LEGACY_SERVER__MessagesPayload {
878
882
  onClose?: string;
879
883
  sysMessages?: {
880
- message: TMessage | TMessage[];
884
+ message: T__LEGACY_SERVER__Message | T__LEGACY_SERVER__Message[];
881
885
  };
882
886
  sysExceptions?: {
883
- exception: TMessage | TMessage[];
887
+ exception: T__LEGACY_SERVER__Message | T__LEGACY_SERVER__Message[];
884
888
  };
885
889
  exceptions?: {
886
- exception: TMessage | TMessage[];
890
+ exception: T__LEGACY_SERVER__Message | T__LEGACY_SERVER__Message[];
887
891
  };
892
+ actions?: T__LEGACY_SERVER__ApiaActions;
888
893
  }
889
894
 
895
+ type NotificationIcon = string;
896
+ type NotificationType = 'info' | 'error' | 'success' | 'warning' | 'modal';
897
+ type NotificationDefinition = {
898
+ icon?: NotificationIcon;
899
+ id?: string | number;
900
+ isOpen?: boolean;
901
+ message: string;
902
+ stackTrace?: string;
903
+ title?: string;
904
+ type?: NotificationType;
905
+ };
906
+
890
907
  type TAttribute = {
891
908
  name: string;
892
909
  value: string;
@@ -908,6 +925,7 @@ type TBehavior = TWithAttributes & {
908
925
  hasDynamicStructure: boolean;
909
926
  showAdditionalInfo: boolean;
910
927
  };
928
+ type TSortType = 'ASC' | 'DESC' | 'NONE';
911
929
  type TColumn = TWithAttributes & TWithStylesModifiers & {
912
930
  className: string;
913
931
  hideFromAccordion: boolean;
@@ -917,7 +935,7 @@ type TColumn = TWithAttributes & TWithStylesModifiers & {
917
935
  name: string;
918
936
  showAsAdditional: boolean;
919
937
  showInAccordionTitle: boolean;
920
- sortType: 'ASC' | 'DESC' | 'NONE';
938
+ sortType: TSortType;
921
939
  title: string;
922
940
  tooltip: string;
923
941
  width: string;
@@ -1382,6 +1400,14 @@ declare function useImperativeComponentContext<Events extends TMap = TMap>(): {
1382
1400
  eventsStore: TEventsHandlers<Events>;
1383
1401
  };
1384
1402
 
1403
+ interface ILabelsContainer {
1404
+ labels: {
1405
+ [key: string]: {
1406
+ text: string;
1407
+ title: string;
1408
+ };
1409
+ };
1410
+ }
1385
1411
  /**
1386
1412
  * Dado un nombre de etiqueta, devuelve el texto que esa etiqueta contiene en
1387
1413
  * el idioma actual. En este momento, lo único que hace realmente esta función
@@ -1393,6 +1419,9 @@ declare function useImperativeComponentContext<Events extends TMap = TMap>(): {
1393
1419
  *
1394
1420
  * Permite el pasaje de tokens para el reemplazo automático de los mismos.
1395
1421
  *
1422
+ * @param outerWindow - En librerías que puedan trabajar tanto en Browser como en Node es requerido pasar el window como parámetro para evitar que la función vaya directamente al window.
1423
+ *
1424
+ *
1396
1425
  * @example
1397
1426
  *
1398
1427
  * // Suponemos la etiqueta msgUsu = { text: 'Usuario <TOK1>', title: 'Usuario <TOK1>' }
@@ -1517,6 +1546,11 @@ type DeepReadonly<T> = Readonly<T extends object ? {
1517
1546
  } : T>;
1518
1547
  declare function freezeDeep<T>(o: T): DeepReadonly<T>;
1519
1548
 
1549
+ /**
1550
+ * Given the objects `src` and `target`, copies and overrides all properties from src to target.
1551
+ */
1552
+ declare function mergeDeep(src: any, target: any): void;
1553
+
1520
1554
  type TProperties = Record<string, unknown>;
1521
1555
  type TPropsSuscriptor<PropsType extends Record<string, unknown> = TProperties> = (props: PropsType, urgent?: boolean) => unknown;
1522
1556
  type TPropsSelector<Selected = any, PropsType = TProperties> = (props: PropsType) => Selected;
@@ -2075,5 +2109,31 @@ declare class TasksQueue {
2075
2109
  run<T>(task: Task<T>): Promise<T | undefined>;
2076
2110
  }
2077
2111
 
2078
- export { AudioRecorder, type AudioRecorderState, BasicStoredElement, BouncingEmitter, type Callback, ClassNameBuilder, type DebounceOptions, type DeepReadonly, type DownloadStringAsDocProps, EventEmitter, History, type IOnFocusConfiguration, type IParameter, type ISetBoundary, type IStatesSource, Locker, type Map, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TActionBehavior, type TActionSource, type TApiaAction, type TApiaActions, type TApiaCellDefinition, type TApiaComplexCell, type TApiaFieldPropsObj, type TApiaFilter, type TApiaFilterOption, type TApiaFilterValue, type TApiaFormButton, type TApiaFormElement, type TApiaFormElementOption, type TApiaFunction, type TApiaFunctionPageInfo, type TApiaLoad, type TApiaLoadForm, type TApiaLoadText, type TApiaMessage, type TApiaMultiplePossibleValue, type TApiaPossibleValue, type TApiaRadioPossibleValue, type TApiaRowDefinition, type TApiaSelectPossibleValue, type TApiaSystemMessageObj, type TApiaTableFunction, type TAttribute, type TBasicAction, type TBehavior, type TCallback, type TCell, type TColumn, type TDateFormat, type TDispatchCallback, type TDownloadUrlOptions, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFilter, type TFncParams, type TFocusRetriever, type THistoryCount, type THistoryStep, type THistoryStepChange, type TId, type TKey, type TLoadStructure, type TMap$1 as TMap, type TMessage, type TModify, type TNotificationMessage, type TOption, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRefresh, type TRequireOnlyOne, type TRow, type TShortcutBranch, type TState, type TStateIcon, type TUpdateFieldConfiguration, type TWithAlignment, type TWithAttributes, type TWithOptions, type TWithStylesModifiers, type Task, TasksQueue, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
2112
+ declare class Router {
2113
+ route: string;
2114
+ constructor();
2115
+ set(path: string): void;
2116
+ Context: ({ children }: {
2117
+ children: ReactNode;
2118
+ }) => react_jsx_runtime.JSX.Element;
2119
+ Route: (({ children, path }: {
2120
+ children: ReactNode;
2121
+ path: string;
2122
+ }) => react_jsx_runtime.JSX.Element | null) & {
2123
+ displayName: string;
2124
+ };
2125
+ }
2126
+
2127
+ declare const RouterContext: React.Context<Router | null>;
2128
+ declare const RouteContext: React.Context<{
2129
+ path: string;
2130
+ params: Record<string, string>;
2131
+ } | null>;
2132
+ declare function useRouter(): Router;
2133
+ declare function useRoute(): {
2134
+ path: string;
2135
+ params: Record<string, string>;
2136
+ };
2137
+
2138
+ export { AudioRecorder, type AudioRecorderState, BasicStoredElement, BouncingEmitter, type Callback, ClassNameBuilder, type DebounceOptions, type DeepReadonly, type DownloadStringAsDocProps, EventEmitter, History, type ILabelsContainer, type IOnFocusConfiguration, type IParameter, type ISetBoundary, type IStatesSource, Locker, type Map, Mutex, type NotificationDefinition, type NotificationIcon, type NotificationType, PropsSelectorUndefinedObject, PropsStore, RouteContext, Router, RouterContext, ScrollLocker, Semaphore, StatefulEmitter, type StatefulStoreUpdateProps, type StatefulStoreUpdater, type TActionBehavior, type TActionSource, type TApiaFieldPropsObj, type TApiaFilter, type TApiaFilterOption, type TApiaFilterValue, type TApiaFormButton, type TApiaFormElement, type TApiaFormElementOption, type TApiaLoadForm, type TApiaMultiplePossibleValue, type TApiaPossibleValue, type TApiaRadioPossibleValue, type TApiaSelectPossibleValue, type TAttribute, type TBasicAction, type TBehavior, type TCallback, type TCell, type TColumn, type TDateFormat, type TDispatchCallback, type TDownloadUrlOptions, type TFieldEvent, type TFieldScriptEvent, type TFieldScriptEvents, type TFieldServerEvent, type TFieldServerEvents, type TFilter, type TFncParams, type TFocusRetriever, type THistoryCount, type THistoryStep, type THistoryStepChange, type TId, type TKey, type TLoadStructure, type TMap$1 as TMap, type TModify, type TOption, type TPropsComparator, type TPropsConfiguration, type TPropsSelector, type TRefresh, type TRequireOnlyOne, type TRow, type TShortcutBranch, type TSortType, type TState, type TStateIcon, type TUpdateFieldConfiguration, type TWithAlignment, type TWithAttributes, type TWithOptions, type TWithStylesModifiers, type T__LEGACY_SERVER__ApiaAction, type T__LEGACY_SERVER__ApiaActions, type T__LEGACY_SERVER__ApiaCellDefinition, type T__LEGACY_SERVER__ApiaComplexCell, type T__LEGACY_SERVER__ApiaFunction, type T__LEGACY_SERVER__ApiaFunctionPageInfo, type T__LEGACY_SERVER__ApiaLoad, type T__LEGACY_SERVER__ApiaLoadText, type T__LEGACY_SERVER__ApiaMessage, type T__LEGACY_SERVER__ApiaRowDefinition, type T__LEGACY_SERVER__ApiaSystemMessageObj, type T__LEGACY_SERVER__ApiaTableFunction, type T__LEGACY_SERVER__Message, type T__LEGACY_SERVER__MessagesPayload, type Task, TasksQueue, type ThrottleOptions, type UnSubscriber, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateFromApiaFormat, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, mergeDeep, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useRoute, useRouter, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
2079
2139
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -12,6 +12,7 @@ import clone from 'lodash-es/clone';
12
12
  import cloneDeep$1 from 'lodash-es/cloneDeep';
13
13
  import xml2js from 'xml2js';
14
14
  import { parseBooleans, parseNumbers } from 'xml2js/lib/processors';
15
+ import { observer } from 'mobx-react-lite';
15
16
 
16
17
  function getWindow() {
17
18
  return globalThis;
@@ -232,7 +233,18 @@ function apiaDateToStandarFormat(date) {
232
233
  }
233
234
 
234
235
  function dateToApiaFormat(date) {
235
- return dayjs(date).format(getDateFormat());
236
+ const parsed = dayjs(date);
237
+ if (!parsed.isValid()) {
238
+ return void 0;
239
+ }
240
+ return parsed.format(getDateFormat());
241
+ }
242
+
243
+ function dateFromApiaFormat(str) {
244
+ const newDate = dayjs(str, getDateFormat());
245
+ if (!newDate.isValid())
246
+ return null;
247
+ return newDate.toDate();
236
248
  }
237
249
 
238
250
  const globals = {
@@ -865,7 +877,7 @@ const focusSelector = [
865
877
  "[tabIndex]",
866
878
  '[role="button"]'
867
879
  ].map((current) => `${current}${cantFocusSelector}`).join(",");
868
- function getFocusSelector(not) {
880
+ function getFocusSelector(not = ":not(:disabled)") {
869
881
  return `input${not ?? ""},
870
882
  textarea${not ?? ""},
871
883
  select${not ?? ""},
@@ -2505,8 +2517,8 @@ function getLabel(name, replaceTokens, outerWindow) {
2505
2517
  const actualWindow = outerWindow ?? window;
2506
2518
  const label = {
2507
2519
  ...actualWindow.labels[name] ?? {
2508
- text: `Not preloaded: ${name}`,
2509
- title: `Not preloaded: ${name}`
2520
+ text: `${name}`,
2521
+ title: `${name}`
2510
2522
  }
2511
2523
  };
2512
2524
  if (replaceTokens?.text !== void 0)
@@ -2544,16 +2556,26 @@ function setValueByPath(obj, path, value) {
2544
2556
  const originalClonedObject = clone(obj ?? {});
2545
2557
  let currentObj = originalClonedObject;
2546
2558
  for (let i = 0; i < steps.length - 1; i++) {
2547
- if (!currentObj[steps[i]])
2548
- currentObj[steps[i]] = {};
2549
- if (typeof currentObj[steps[i]] === "object") {
2550
- currentObj = currentObj[steps[i]];
2559
+ let key = steps[i];
2560
+ const match = key.match(/([^[]+)\[(\d+)\]/);
2561
+ if (match) {
2562
+ const varName = match[1];
2563
+ const index = Number.parseInt(match[2]);
2564
+ if (!currentObj[varName])
2565
+ currentObj[varName] = [];
2566
+ currentObj = currentObj[varName];
2567
+ key = index;
2568
+ }
2569
+ if (!currentObj[key])
2570
+ currentObj[key] = {};
2571
+ if (typeof currentObj[key] === "object") {
2572
+ currentObj = currentObj[key];
2551
2573
  } else {
2552
2574
  console.info({
2553
2575
  originalObject: obj,
2554
2576
  originalPath: path,
2555
2577
  currentObj,
2556
- currentStep: steps[i]
2578
+ currentStep: key
2557
2579
  });
2558
2580
  throw new Error(
2559
2581
  `The provided path ${path} cannot be applied due to it is not an object's path.`
@@ -2598,6 +2620,39 @@ function freezeDeep(o) {
2598
2620
  return typeof o === "object" && o ? Object.freeze(o) : o;
2599
2621
  }
2600
2622
 
2623
+ function isMergeable(el) {
2624
+ return typeof el === "object" && el !== null;
2625
+ }
2626
+ function mergeDeep(src, target) {
2627
+ if (!isMergeable(src) || !isMergeable(target)) {
2628
+ throw new Error("src and target parameters must be objects");
2629
+ }
2630
+ for (const key of Object.keys(src)) {
2631
+ if (isMergeable(src[key])) {
2632
+ if (!isMergeable(target[key])) {
2633
+ target[key] = {};
2634
+ }
2635
+ mergeDeep(src[key], target[key]);
2636
+ } else if (Array.isArray(src[key])) {
2637
+ if (!Array.isArray(target[key])) {
2638
+ target[key] = [];
2639
+ }
2640
+ for (let i = 0; i < src[key].length; i++) {
2641
+ if (isMergeable(src[key][i])) {
2642
+ if (!isMergeable(target[key][i])) {
2643
+ target[key][i] = {};
2644
+ }
2645
+ mergeDeep(src[key][i], target[key][i]);
2646
+ } else {
2647
+ target[key][i] = src[key][i];
2648
+ }
2649
+ }
2650
+ } else {
2651
+ target[key] = src[key];
2652
+ }
2653
+ }
2654
+ }
2655
+
2601
2656
  const propsLog = "propsLog";
2602
2657
  const PropsSelectorUndefinedObject = {};
2603
2658
  class PropsStore {
@@ -3081,5 +3136,61 @@ const postNavigation = (url, data) => {
3081
3136
  form.submit();
3082
3137
  };
3083
3138
 
3084
- export { AudioRecorder, BasicStoredElement, BouncingEmitter, ClassNameBuilder, EventEmitter, History, Locker, Mutex, PropsSelectorUndefinedObject, PropsStore, ScrollLocker, Semaphore, StatefulEmitter, TasksQueue, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
3139
+ const RouterContext = createContext(null);
3140
+ const RouteContext = createContext(null);
3141
+ function useRouter() {
3142
+ return useContext(RouterContext);
3143
+ }
3144
+ function useRoute() {
3145
+ return useContext(RouteContext);
3146
+ }
3147
+
3148
+ function parseRoute(route, path) {
3149
+ const keys = [];
3150
+ const escaped = route.replace(/([.+*?=^!:${}()[\]|/\\])/g, "\\$1");
3151
+ const pattern = escaped.replace(/\\:([a-zA-Z0-9_]+)/g, (_, key) => {
3152
+ keys.push(key);
3153
+ return "([^/]+)";
3154
+ });
3155
+ const regex = new RegExp(`^${pattern}\\/?$`);
3156
+ const match = path.match(regex);
3157
+ if (!match)
3158
+ return null;
3159
+ const result = {};
3160
+ keys.forEach((key, i) => {
3161
+ result[key] = decodeURIComponent(match[i + 1]);
3162
+ });
3163
+ return result;
3164
+ }
3165
+
3166
+ class Router {
3167
+ constructor() {
3168
+ this.route = "";
3169
+ this.Context = ({ children }) => /* @__PURE__ */ jsx(RouterContext.Provider, { value: this, children });
3170
+ this.Route = observer(
3171
+ ({ children, path }) => {
3172
+ const res = parseRoute(path, this.route);
3173
+ if (!res) {
3174
+ return null;
3175
+ }
3176
+ return /* @__PURE__ */ jsx(
3177
+ RouteContext.Provider,
3178
+ {
3179
+ value: {
3180
+ params: res,
3181
+ path
3182
+ },
3183
+ children
3184
+ }
3185
+ );
3186
+ }
3187
+ );
3188
+ makeAutoObservable(this);
3189
+ }
3190
+ set(path) {
3191
+ this.route = path;
3192
+ }
3193
+ }
3194
+
3195
+ export { AudioRecorder, BasicStoredElement, BouncingEmitter, ClassNameBuilder, EventEmitter, History, Locker, Mutex, PropsSelectorUndefinedObject, PropsStore, RouteContext, Router, RouterContext, ScrollLocker, Semaphore, StatefulEmitter, TasksQueue, Url, addBoundary, alignment, animate, apiaDateToStandarFormat, arrayOrArray, autoDisconnectMutationObserver, awaitTime, cantFocusSelector, cloneDeep, customEvents, dateFromApiaFormat, dateToApiaFormat, debugDispatcher, decodeBase64ToUtf8, decodeHTMLEntities, decrypt, deepEqual, defaultGetNameFromResponse, disableChildrenFocus, downloadStringAsDoc, downloadUrl, enableChildrenFocus, encodeStrToBase64Utf8, encrypt, findOffsetRelativeToScrollParent, findScrollContainer, focus, focusSelector, formatMessage, freezeDeep, getDateFormat, getFocusSelector, getIndex, getJSObjFromXML, getLabel, getSpecificParent, getValueByPath, globalFocus, globals, isChild, isDebugDispatcherEnabled, isFocusable, isPropsConfigurationObject, isSetter, isTrue, makeImperativeComponent, makeSingleImperativeComponent, makeStatefulStore, mergeDeep, noNaN, notificationsSelector, openAndReadFile, openAndReadFiles, parseAsSize, parseXMLRequestResponse, parseXmlAsync, persistentStorage, postNavigation, propsStore, screenLocker, scrollParentIntoElement, setValueByPath, shallowCompareArrays, shallowEqual, shortcutController, toBoolean, ucfirst, uniqueId, useCombinedRefs, useDebouncedCallback, useDebouncedState, useDomState, useImperativeComponentContext, useImperativeComponentEvents, useIntermediateValue, useLatest, useLocalStorage, useMatchScrollDirection, useMount, useMountTransition, usePanAndZoom, usePrevious, usePropsSelector, useRoute, useRouter, useShallowMemo, useStateRef, useSubscription, useUnmount, useUpdateEffect, useWhyUpdated };
3085
3196
  //# sourceMappingURL=index.js.map