@e1011/es-kit 1.0.202 → 1.0.206

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 (144) hide show
  1. package/dist/hooks/esm/index.css +43 -43
  2. package/dist/hooks/index.css +43 -43
  3. package/dist/lib/tsconfig.tsbuildinfo +1 -1
  4. package/dist/utils/esm/index.css +43 -43
  5. package/dist/utils/index.css +43 -43
  6. package/package.json +1 -3
  7. package/dist/lib/src/core/constants/index.js +0 -2
  8. package/dist/lib/src/core/constants/index.js.map +0 -1
  9. package/dist/lib/src/core/constants/ui.constants.js +0 -12
  10. package/dist/lib/src/core/constants/ui.constants.js.map +0 -1
  11. package/dist/lib/src/core/hooks/index.js +0 -9
  12. package/dist/lib/src/core/hooks/index.js.map +0 -1
  13. package/dist/lib/src/core/hooks/useApi.js +0 -31
  14. package/dist/lib/src/core/hooks/useApi.js.map +0 -1
  15. package/dist/lib/src/core/hooks/useClassNames.js +0 -4
  16. package/dist/lib/src/core/hooks/useClassNames.js.map +0 -1
  17. package/dist/lib/src/core/hooks/useOutsideClick.js +0 -18
  18. package/dist/lib/src/core/hooks/useOutsideClick.js.map +0 -1
  19. package/dist/lib/src/core/hooks/useParseProps.js +0 -7
  20. package/dist/lib/src/core/hooks/useParseProps.js.map +0 -1
  21. package/dist/lib/src/core/hooks/useResize.js +0 -43
  22. package/dist/lib/src/core/hooks/useResize.js.map +0 -1
  23. package/dist/lib/src/core/hooks/useThemePreference.js +0 -75
  24. package/dist/lib/src/core/hooks/useThemePreference.js.map +0 -1
  25. package/dist/lib/src/core/hooks/useToggle.js +0 -16
  26. package/dist/lib/src/core/hooks/useToggle.js.map +0 -1
  27. package/dist/lib/src/core/hooks/useTranslations.js +0 -29
  28. package/dist/lib/src/core/hooks/useTranslations.js.map +0 -1
  29. package/dist/lib/src/core/index.js +0 -5
  30. package/dist/lib/src/core/index.js.map +0 -1
  31. package/dist/lib/src/core/ui/components/container/CollapsibleContainer.js +0 -56
  32. package/dist/lib/src/core/ui/components/container/CollapsibleContainer.js.map +0 -1
  33. package/dist/lib/src/core/ui/components/container/Flex.js +0 -55
  34. package/dist/lib/src/core/ui/components/container/Flex.js.map +0 -1
  35. package/dist/lib/src/core/ui/components/container/LayoutBox.js +0 -67
  36. package/dist/lib/src/core/ui/components/container/LayoutBox.js.map +0 -1
  37. package/dist/lib/src/core/ui/components/container/Placeholder.js +0 -10
  38. package/dist/lib/src/core/ui/components/container/Placeholder.js.map +0 -1
  39. package/dist/lib/src/core/ui/components/container/ResizableContainer.js +0 -25
  40. package/dist/lib/src/core/ui/components/container/ResizableContainer.js.map +0 -1
  41. package/dist/lib/src/core/ui/components/container/index.js +0 -7
  42. package/dist/lib/src/core/ui/components/container/index.js.map +0 -1
  43. package/dist/lib/src/core/ui/components/container/layoutBox.types.js +0 -9
  44. package/dist/lib/src/core/ui/components/container/layoutBox.types.js.map +0 -1
  45. package/dist/lib/src/core/ui/components/dividers/DividerLine.js +0 -24
  46. package/dist/lib/src/core/ui/components/dividers/DividerLine.js.map +0 -1
  47. package/dist/lib/src/core/ui/components/dividers/index.js +0 -2
  48. package/dist/lib/src/core/ui/components/dividers/index.js.map +0 -1
  49. package/dist/lib/src/core/ui/components/field/Field.js +0 -137
  50. package/dist/lib/src/core/ui/components/field/Field.js.map +0 -1
  51. package/dist/lib/src/core/ui/components/field/index.js +0 -3
  52. package/dist/lib/src/core/ui/components/field/index.js.map +0 -1
  53. package/dist/lib/src/core/ui/components/field/types.js +0 -2
  54. package/dist/lib/src/core/ui/components/field/types.js.map +0 -1
  55. package/dist/lib/src/core/ui/components/icon/Icon.js +0 -5
  56. package/dist/lib/src/core/ui/components/icon/Icon.js.map +0 -1
  57. package/dist/lib/src/core/ui/components/icon/IconBase.js +0 -26
  58. package/dist/lib/src/core/ui/components/icon/IconBase.js.map +0 -1
  59. package/dist/lib/src/core/ui/components/icon/IconWC.js +0 -76
  60. package/dist/lib/src/core/ui/components/icon/IconWC.js.map +0 -1
  61. package/dist/lib/src/core/ui/components/icon/index.js +0 -4
  62. package/dist/lib/src/core/ui/components/icon/index.js.map +0 -1
  63. package/dist/lib/src/core/ui/components/icon/unifyIconUrl.js +0 -20
  64. package/dist/lib/src/core/ui/components/icon/unifyIconUrl.js.map +0 -1
  65. package/dist/lib/src/core/ui/components/index.js +0 -6
  66. package/dist/lib/src/core/ui/components/index.js.map +0 -1
  67. package/dist/lib/src/core/ui/components/molecules/index.js +0 -2
  68. package/dist/lib/src/core/ui/components/molecules/index.js.map +0 -1
  69. package/dist/lib/src/core/ui/components/molecules/layouts/FlowLayout.js +0 -51
  70. package/dist/lib/src/core/ui/components/molecules/layouts/FlowLayout.js.map +0 -1
  71. package/dist/lib/src/core/ui/components/molecules/layouts/flowLayout.types.js +0 -2
  72. package/dist/lib/src/core/ui/components/molecules/layouts/flowLayout.types.js.map +0 -1
  73. package/dist/lib/src/core/ui/components/molecules/layouts/index.js +0 -3
  74. package/dist/lib/src/core/ui/components/molecules/layouts/index.js.map +0 -1
  75. package/dist/lib/src/core/ui/index.js +0 -3
  76. package/dist/lib/src/core/ui/index.js.map +0 -1
  77. package/dist/lib/src/core/ui/types/CommonProps.js +0 -2
  78. package/dist/lib/src/core/ui/types/CommonProps.js.map +0 -1
  79. package/dist/lib/src/core/ui/utils/clickOutside.js +0 -8
  80. package/dist/lib/src/core/ui/utils/clickOutside.js.map +0 -1
  81. package/dist/lib/src/core/ui/utils/index.js +0 -2
  82. package/dist/lib/src/core/ui/utils/index.js.map +0 -1
  83. package/dist/lib/src/core/ui/utils/style.js +0 -62
  84. package/dist/lib/src/core/ui/utils/style.js.map +0 -1
  85. package/dist/lib/src/core/utils/appState/stateMachine/tiny-state-machine.base.js +0 -143
  86. package/dist/lib/src/core/utils/appState/stateMachine/tiny-state-machine.base.js.map +0 -1
  87. package/dist/lib/src/core/utils/appState/store/index.js +0 -4
  88. package/dist/lib/src/core/utils/appState/store/index.js.map +0 -1
  89. package/dist/lib/src/core/utils/appState/store/simpleComponent/SimpleComponent.js +0 -59
  90. package/dist/lib/src/core/utils/appState/store/simpleComponent/SimpleComponent.js.map +0 -1
  91. package/dist/lib/src/core/utils/appState/store/simpleComponent/SimpleComponent2.js +0 -62
  92. package/dist/lib/src/core/utils/appState/store/simpleComponent/SimpleComponent2.js.map +0 -1
  93. package/dist/lib/src/core/utils/appState/store/store.vanillajs.js +0 -105
  94. package/dist/lib/src/core/utils/appState/store/store.vanillajs.js.map +0 -1
  95. package/dist/lib/src/core/utils/appState/store/store.vanillajs.templates.js +0 -41
  96. package/dist/lib/src/core/utils/appState/store/store.vanillajs.templates.js.map +0 -1
  97. package/dist/lib/src/core/utils/appState/store/useStore.react.js +0 -30
  98. package/dist/lib/src/core/utils/appState/store/useStore.react.js.map +0 -1
  99. package/dist/lib/src/core/utils/date.js +0 -98
  100. package/dist/lib/src/core/utils/date.js.map +0 -1
  101. package/dist/lib/src/core/utils/decorators/convert.js +0 -68
  102. package/dist/lib/src/core/utils/decorators/convert.js.map +0 -1
  103. package/dist/lib/src/core/utils/helpers/birthnumber.validator.js +0 -18
  104. package/dist/lib/src/core/utils/helpers/birthnumber.validator.js.map +0 -1
  105. package/dist/lib/src/core/utils/helpers/birthnumberCZSKvalidator.js +0 -96
  106. package/dist/lib/src/core/utils/helpers/birthnumberCZSKvalidator.js.map +0 -1
  107. package/dist/lib/src/core/utils/helpers/cancelableDelayedFunction.js +0 -9
  108. package/dist/lib/src/core/utils/helpers/cancelableDelayedFunction.js.map +0 -1
  109. package/dist/lib/src/core/utils/helpers/date.js +0 -5
  110. package/dist/lib/src/core/utils/helpers/date.js.map +0 -1
  111. package/dist/lib/src/core/utils/helpers/deviceInfo.js +0 -11
  112. package/dist/lib/src/core/utils/helpers/deviceInfo.js.map +0 -1
  113. package/dist/lib/src/core/utils/helpers/emailMatcher.js +0 -29
  114. package/dist/lib/src/core/utils/helpers/emailMatcher.js.map +0 -1
  115. package/dist/lib/src/core/utils/helpers/file.js +0 -22
  116. package/dist/lib/src/core/utils/helpers/file.js.map +0 -1
  117. package/dist/lib/src/core/utils/helpers/fileValidator.js +0 -152
  118. package/dist/lib/src/core/utils/helpers/fileValidator.js.map +0 -1
  119. package/dist/lib/src/core/utils/helpers/index.js +0 -14
  120. package/dist/lib/src/core/utils/helpers/index.js.map +0 -1
  121. package/dist/lib/src/core/utils/helpers/objectOperations.js +0 -98
  122. package/dist/lib/src/core/utils/helpers/objectOperations.js.map +0 -1
  123. package/dist/lib/src/core/utils/helpers/other.js +0 -40
  124. package/dist/lib/src/core/utils/helpers/other.js.map +0 -1
  125. package/dist/lib/src/core/utils/helpers/textValueOperations.js +0 -37
  126. package/dist/lib/src/core/utils/helpers/textValueOperations.js.map +0 -1
  127. package/dist/lib/src/core/utils/helpers/ui.js +0 -27
  128. package/dist/lib/src/core/utils/helpers/ui.js.map +0 -1
  129. package/dist/lib/src/core/utils/helpers/valueOperations.js +0 -41
  130. package/dist/lib/src/core/utils/helpers/valueOperations.js.map +0 -1
  131. package/dist/lib/src/core/utils/index.js +0 -6
  132. package/dist/lib/src/core/utils/index.js.map +0 -1
  133. package/dist/lib/src/core/utils/keyExtractor.js +0 -6
  134. package/dist/lib/src/core/utils/keyExtractor.js.map +0 -1
  135. package/dist/lib/src/core/utils/test/testRenderer.js +0 -12
  136. package/dist/lib/src/core/utils/test/testRenderer.js.map +0 -1
  137. package/dist/lib/src/core/utils/webComponents/exampleCustomElement.js +0 -42
  138. package/dist/lib/src/core/utils/webComponents/exampleCustomElement.js.map +0 -1
  139. package/dist/lib/src/core/utils/webComponents/index.js +0 -2
  140. package/dist/lib/src/core/utils/webComponents/index.js.map +0 -1
  141. package/dist/lib/src/core/utils/webComponents/webComponent.utils.js +0 -29
  142. package/dist/lib/src/core/utils/webComponents/webComponent.utils.js.map +0 -1
  143. package/dist/lib/src/index.js +0 -2
  144. package/dist/lib/src/index.js.map +0 -1
@@ -1,51 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useMemo } from 'react';
3
- import { LayoutBox } from '../../container';
4
- import { classNames } from '../../../../utils';
5
- import classes from './flowLayout.module.scss';
6
- /**
7
- * Renders a flexible flow layout that automatically arranges child components based on specified columns and spacing.
8
- * This component is highly customizable through its props,
9
- * allowing for dynamic layouts responsive to the content and screen size.
10
- *
11
- * Utilizes a grid layout by default, falling back to flex layout
12
- * if `numColumns` is not greater than 0. Each item's width
13
- * and placement can be controlled via `spanColumn` on
14
- * individual items, with additional layout props provided for fine-tuning.
15
- *
16
- * @param {FlowLayoutProps} props The properties to configure the FlowLayout.
17
- * @param {ItemDTOType[]} props.itemDTOs Array of item DTOs defining the
18
- * components to render and their layout properties.
19
- * @param {Partial<LayoutBoxProps>} [props.containerProps={}] Optional.
20
- * Props to be spread onto the container `LayoutBox`, allowing for custom styles and behaviors.
21
- * @param {Partial<LayoutBoxProps>} [props.defaultItemLayoutProps={}] Optional.
22
- * Default layout properties applied to each item, unless overridden by item-specific props.
23
- * @param {number} [props.numColumns=1] Optional.
24
- * Defines the number of columns in the grid. Affects item distribution and layout.
25
- * @param {string} [props.className=''] Optional.
26
- * Additional CSS class names to apply to the layout container for custom styling.
27
- * @param {ReactNode} [props.beforeContent] Optional.
28
- * Content to render before the main items. Useful for titles, descriptions, or custom components.
29
- * @param {ReactNode} [props.afterContent] Optional.
30
- Content to render after the main items. Can be used for additional information or actions related to the items.
31
- * @returns {React.ReactElement} The rendered FlowLayout component.
32
- */
33
- export const FlowLayout = memo(({ itemDTOs, containerProps = {}, defaultItemLayoutProps = {}, numColumns = 1, className = '', beforeContent, afterContent, ...props }) => {
34
- // Calculation for column styles based on the number of columns specified.
35
- const columnStyles = useMemo(() => (numColumns > 0
36
- ? {
37
- display: 'grid',
38
- gridTemplateColumns: `${'1fr '.repeat(numColumns)}`,
39
- width: '100%',
40
- height: 'unset',
41
- }
42
- : {
43
- display: 'flex',
44
- }), [numColumns]);
45
- return (_jsxs(LayoutBox, { width: '100%', column: true, className: classNames(classes.flowLayout, className), ...props, children: [beforeContent && (_jsx("span", { className: classes.beforeContent, tabIndex: -1, children: beforeContent })), _jsx(LayoutBox, { flexWrap: 'wrap', gap: '1rem', style: columnStyles, width: '100%', ...containerProps, children: itemDTOs.map(({ id, spanColumn, Component, layoutProps, ...props }) => (_jsx(LayoutBox, { ...defaultItemLayoutProps, ...layoutProps, ...(spanColumn
46
- ? { style: { width: `calc(${Math.round(spanColumn * 100)}% - ${spanColumn * 16}px)` } }
47
- : {}), children: _jsx(Component, { ...props }) }, id))) }), afterContent && (_jsx("span", { className: classes.afterContent, tabIndex: -1, children: afterContent }))] }));
48
- });
49
- // Set display name for the component.
50
- FlowLayout.displayName = 'FlowLayout';
51
- //# sourceMappingURL=FlowLayout.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"FlowLayout.js","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/molecules/layouts/FlowLayout.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAM,OAAO,EAAE,MAAM,OAAO,CAAA;AAEzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAG9C,OAAO,OAAO,MAAM,0BAA0B,CAAA;AAG9C;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,CAAC,MAAM,UAAU,GAAwB,IAAI,CAAkB,CAAC,EACpE,QAAQ,EACR,cAAc,GAAG,EAAE,EACnB,sBAAsB,GAAG,EAAE,EAC3B,UAAU,GAAG,CAAC,EACd,SAAS,GAAG,EAAE,EACd,aAAa,EACb,YAAY,EACZ,GAAG,KAAK,EACQ,EAAE,EAAE;IACpB,0EAA0E;IAC1E,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,UAAU,GAAG,CAAC;QAChD,CAAC,CAAC;YACA,OAAO,EAAE,MAAM;YACf,mBAAmB,EAAE,GAAG,MAAM,CAAC,MAAM,C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ingURL=flowLayout.types.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"flowLayout.types.js","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/molecules/layouts/flowLayout.types.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- export * from './FlowLayout';
2
- export * from './flowLayout.types';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../../src/core/ui/components/molecules/layouts/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,oBAAoB,CAAA"}
@@ -1,3 +0,0 @@
1
- export * from './utils';
2
- export * from './components';
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/core/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=CommonProps.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"CommonProps.js","sourceRoot":"","sources":["../../../../../../src/core/ui/types/CommonProps.ts"],"names":[],"mappings":""}
@@ -1,8 +0,0 @@
1
- export const handleClickOutside = (element, callback) => (event) => {
2
- const target = event.target;
3
- const resolvedElement = typeof element === 'function' ? element() : element;
4
- if (resolvedElement && !resolvedElement.contains(target)) {
5
- callback?.(target);
6
- }
7
- };
8
- //# sourceMappingURL=clickOutside.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clickOutside.js","sourceRoot":"","sources":["../../../../../../src/core/ui/utils/clickOutside.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAChC,OAAgB,EAChB,QAA2B,EAC3B,EAAE,CAAC,CAAC,KAAiB,EAAE,EAAE;IACzB,MAAM,MAAM,GAAG,KAAK,CAAC,MAA4B,CAAA;IACjD,MAAM,eAAe,GAAsB,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAA;IAE9F,IAAI,eAAe,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;QACzD,QAAQ,EAAE,CAAC,MAAM,CAAC,CAAA;IACpB,CAAC;AACH,CAAC,CAAA"}
@@ -1,2 +0,0 @@
1
- export * from './style';
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../src/core/ui/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAA"}
@@ -1,62 +0,0 @@
1
- // eslint-disable-next-line import/no-mutable-exports
2
- export let defaultFontSize = 16;
3
- export const setDefaultFontSize = (fontSize) => {
4
- defaultFontSize = fontSize;
5
- };
6
- export const pxToRem = (px) => px / defaultFontSize;
7
- export const resolveStyleValue = (value, units = 'rem') => {
8
- if (typeof value === 'string') {
9
- return value;
10
- }
11
- if (units === 'px') {
12
- return `${pxToRem(value)}rem`;
13
- }
14
- return `${value}${units}`;
15
- };
16
- /* eslint-disable no-param-reassign */
17
- export const toHex = (x) => {
18
- x = x.toString(16);
19
- return x.padStart(2, '0');
20
- };
21
- export const convertHex = (hex, opacity, rgba = false) => {
22
- const hexValue = hex.replace('#', '');
23
- const rValue = hexValue.substring(0, 2);
24
- const gValue = hexValue.substring(2, 4);
25
- const bValue = hexValue.substring(4, 6);
26
- const r = parseInt(rValue, 16);
27
- const g = parseInt(gValue, 16);
28
- const b = parseInt(bValue, 16);
29
- const a = opacity <= 1 ? opacity : (opacity / 100);
30
- return (rgba
31
- ? `rgba(${r},${g},${b},${a})`
32
- : `#${rValue}${gValue}${bValue}${toHex(Math.round((opacity <= 1 ? opacity : (opacity / 100)) * 255))}`)
33
- .toLowerCase();
34
- };
35
- export const convertRGB = (r, g, b, opacity) => `#${toHex(r)}${toHex(g)}${toHex(b)}${toHex(Math.round((opacity <= 1 ? opacity : (opacity / 100)) * 255))}`;
36
- export const calculatePercColor = (startColor, endColor, ratio = 0.5) => {
37
- if (startColor.indexOf('#') === 0) {
38
- startColor = startColor.substr(1);
39
- }
40
- if (endColor.indexOf('#') === 0) {
41
- endColor = endColor.substr(1);
42
- }
43
- const r = Math.ceil(parseInt(endColor.substring(0, 2), 16) * ratio
44
- + parseInt(startColor.substring(0, 2), 16) * (1 - ratio));
45
- const g = Math.ceil(parseInt(endColor.substring(2, 4), 16) * ratio
46
- + parseInt(startColor.substring(2, 4), 16) * (1 - ratio));
47
- const b = Math.ceil(parseInt(endColor.substring(4, 6), 16) * ratio
48
- + parseInt(startColor.substring(4, 6), 16) * (1 - ratio));
49
- return `#${toHex(r) + toHex(g) + toHex(b)}`;
50
- };
51
- export const calculateColors = (startColor, endColor, num = 10) => {
52
- const ratioIterator = (num / (num + 1)) / num;
53
- const ratios = [];
54
- let ratio = ratioIterator;
55
- // eslint-disable-next-line no-plusplus
56
- while (num--) {
57
- ratios.push(ratio);
58
- ratio += ratioIterator;
59
- }
60
- return ratios.map((rat) => calculatePercColor(startColor, endColor, rat));
61
- };
62
- //# sourceMappingURL=style.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../../../../../src/core/ui/utils/style.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,CAAC,IAAI,eAAe,GAAG,EAAE,CAAA;AAC/B,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,QAAgB,EAAE,EAAE;IACrD,eAAe,GAAG,QAAQ,CAAA;AAC5B,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAU,EAAU,EAAE,CAAC,EAAE,GAAG,eAAe,CAAA;AAEnE,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,KAAsB,EACtB,KAAK,GAAG,KAAK,EACL,EAAE;IACV,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,KAA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AG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,kBAAkB,CAAC,UAAU,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAA;AAC3E,CAAC,CAAA"}
@@ -1,143 +0,0 @@
1
- export var TinyStateMachineEventType;
2
- (function (TinyStateMachineEventType) {
3
- TinyStateMachineEventType["CHANGE"] = "change";
4
- TinyStateMachineEventType["TRANSITIONED_TO"] = "transitionedTo";
5
- TinyStateMachineEventType["TRANSITIONED_FROM"] = "transitionedFrom";
6
- TinyStateMachineEventType["ADDED_TO_QUEUE"] = "addedToQueue";
7
- TinyStateMachineEventType["REMOVED_FROM_QUEUE"] = "removedFromQueue";
8
- })(TinyStateMachineEventType || (TinyStateMachineEventType = {}));
9
- export class TinyStateMachineEvent extends Event {
10
- constructor(type, eventInitDict) {
11
- super(type, eventInitDict);
12
- }
13
- }
14
- export class TinyStateMachineState {
15
- #name;
16
- #listeners;
17
- constructor(name) {
18
- this.#name = name;
19
- this.#listeners = new Set();
20
- }
21
- get name() {
22
- return this.#name;
23
- }
24
- subscribe = (listener) => {
25
- this.#listeners.add(listener);
26
- return () => this.#listeners.delete(listener);
27
- };
28
- unsubscribe = (listener) => {
29
- this.#listeners.delete(listener);
30
- };
31
- publish = (event) => {
32
- if (!this.#listeners?.size) {
33
- return;
34
- }
35
- // eslint-disable-next-line no-restricted-syntax
36
- for (const listener of this.#listeners) {
37
- listener(event);
38
- }
39
- };
40
- toString = () => `TinyStateMachineSate: ${this.#name}`;
41
- get [Symbol.toStringTag]() {
42
- return `TinyStateMachineSate: ${this.#name}`;
43
- }
44
- }
45
- export const createStates = (stateNames) => new Set(stateNames.map((name) => new TinyStateMachineState(name)));
46
- export class TinyStateMachine {
47
- #states;
48
- #listeners;
49
- #currentState;
50
- constructor(states) {
51
- this.#states = states;
52
- this.#listeners = new Set();
53
- }
54
- addState = (state) => {
55
- this.#states.add(state);
56
- };
57
- removeState = (state) => {
58
- this.#states.delete(state);
59
- };
60
- get states() {
61
- return this.#states;
62
- }
63
- get currentState() {
64
- return this.#currentState;
65
- }
66
- subscribe = (listener) => {
67
- this.#listeners.add(listener);
68
- return () => this.#listeners.delete(listener);
69
- };
70
- unsubscribe = (listener) => {
71
- this.#listeners.delete(listener);
72
- };
73
- publish = (event, state) => {
74
- if (!this.#listeners?.size) {
75
- return;
76
- }
77
- // eslint-disable-next-line no-restricted-syntax
78
- for (const listener of this.#listeners) {
79
- listener(event, state);
80
- }
81
- };
82
- #getStateByName = (stateName) => Array
83
- .from(this.#states).find((state) => state.name === stateName);
84
- #getStateByState = (state) => (this.#states.has(state) ? state : undefined);
85
- gotoState = (state) => {
86
- const foundState = typeof state === 'string'
87
- ? this.#getStateByName(state)
88
- : this.#getStateByState(state);
89
- if (!foundState) {
90
- throw Error(`TinyStateMachin::gotoState state not found: ${state}`);
91
- }
92
- const prevState = this.#currentState;
93
- this.#currentState = foundState;
94
- this.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_FROM), prevState);
95
- this.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_TO), foundState);
96
- prevState?.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_FROM));
97
- this.#currentState.publish(new TinyStateMachineEvent(TinyStateMachineEventType.TRANSITIONED_TO));
98
- return true;
99
- };
100
- next = () => {
101
- let nextState;
102
- const arrayOfStates = Array.from(this.#states);
103
- if (!this.#currentState) {
104
- [nextState] = arrayOfStates;
105
- return this.gotoState(nextState) ? nextState : null;
106
- }
107
- const currentStateIndex = arrayOfStates
108
- .findIndex((state) => state === this.#currentState);
109
- if (currentStateIndex < this.#states.size - 2) {
110
- nextState = arrayOfStates[currentStateIndex + 1];
111
- return this.gotoState(nextState) ? nextState : null;
112
- }
113
- return null;
114
- };
115
- }
116
- export const stateIterator = function* () {
117
- let operation;
118
- let state = stateIterator.IS_RUNNING;
119
- while (true) {
120
- // console.log('inside while loop')
121
- // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
122
- // // @ts-ignore
123
- // // eslint-disable-next-line @typescript-eslint/ban-ts-comment
124
- // // @ts-ignore
125
- operation = yield state;
126
- // // console.log('operation', operation)
127
- // // console.log('state', state)
128
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
129
- // @ts-ignore
130
- if (operation === stateIterator.DO_END) {
131
- state = stateIterator.IS_FINITE;
132
- yield state;
133
- break;
134
- }
135
- }
136
- yield* [1, 2, 3];
137
- yield 123;
138
- return 10;
139
- };
140
- stateIterator.DO_END = '__DO__END__';
141
- stateIterator.IS_FINITE = '__IS__FINITE__';
142
- stateIterator.IS_RUNNING = '__IS__RUNNING__';
143
- //# sourceMappingURL=tiny-state-machine.base.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tiny-state-machine.base.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/stateMachine/tiny-state-machine.base.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,yBAMX;AAND,WAAY,yBAAyB;IACnC,8CAAiB,CAAA;IACjB,+DAAkC,CAAA;IAClC,mEAAsC,CAAA;IACtC,4DAA+B,CAAA;IAC/B,oEAAuC,CAAA;AACzC,CAAC,EANW,yBAAyB,KAAzB,yBAAyB,QAMpC;AAOD,MAAM,OAAO,qBAAsB,SAAQ,KAAK;IAC9C,YAAY,IAA+B,EAAE,aAAmB;QAC9D,KAAK,CAAC,IAAI,EAAE,aAAa,CAAC,CAAA;IAC5B,CAAC;CACF;AAYD,MAAM,OAAO,qBAAqB;IAChC,KAAK,CAAQ;IAEb,UAAU,CAAuB;IAEjC,YAAY,IAAY;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;QACjB,IAAI,CAAC,UAAU,GAAG,IAAI,GAAG,EAAoB,CAAA;IAC/C,CAAC;IAED,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,SAAS,GAAG,CAAC,QAA0B,EAAE,EAAE;QACzC,IAAI,CAAC,UAAU,CAAC,GAAG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aAAa;aACpC,SAAS,CAAC,CAAC,KAA4B,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,CAAC,aAAa,CAAC,CAAA;QAE5E,IAAI,iBAAiB,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YAC9C,SAAS,GAAG,aAAa,CAAC,iBAAiB,GAAG,CAAC,CAAC,CAAA;YAChD,OAAO,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAA;QACrD,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC,CAAA;CACF;AAID,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC;IACpC,IAAI,SAAiB,CAAA;IACrB,IAAI,KAAK,GAAW,aAAa,CAAC,UAAU,CAAA;IAE5C,OAAO,IAAI,EAAE,CAAC;QACZ,mCAAmC;QAEnC,gEAAgE;QAChE,gBAAgB;QAGhB,gEAAgE;QAChE,gBAAgB;QAChB,SAAS,GAAG,MAAM,KAAK,CAAA;QAEvB,yCAAyC;QACzC,iCAAiC;QACjC,6DAA6D;QAC7D,aAAa;QACb,IAAI,SAAS,KAAK,aAAa,CAAC,MAAM,EAAE,CAAC;YACvC,KAAK,GAAG,aAAa,CAAC,SAAS,CAAA;YAC/B,MAAM,KAAK,CAAA;YACX,MAAK;QACP,CAAC;IACH,CAAC;IACD,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAA;IAChB,MAAM,GAAG,CAAA;IAET,OAAO,EAAE,CAAA;AACX,CAAC,CAAA;AAED,aAAa,CAAC,MAAM,GAAG,aAAa,CAAA;AACpC,aAAa,CAAC,SAAS,GAAG,gBAAgB,CAAA;AAC1C,aAAa,CAAC,UAAU,GAAG,iBAAiB,CAAA"}
@@ -1,4 +0,0 @@
1
- export * from './store.vanillajs';
2
- export * from './store.vanillajs.templates';
3
- export * from './useStore.react';
4
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA;AACjC,cAAc,6BAA6B,CAAA;AAC3C,cAAc,kBAAkB,CAAA"}
@@ -1,59 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useCallback } from 'react';
3
- import { createSelector } from 'reselect';
4
- import { useStore } from '../useStore.react';
5
- import { createStore } from '../store.vanillajs';
6
- import { LayoutBox } from '../../../../ui/components/container/LayoutBox';
7
- import { delay } from '../../../helpers/other';
8
- export const simpleStore = createStore({
9
- title: 'Initial Title',
10
- count: 0,
11
- data: [1, 2, 3],
12
- }, {
13
- addData: async (getState, setState) => {
14
- console.log('addData start');
15
- await delay(1000);
16
- console.log('addData end');
17
- setState({
18
- ...getState(),
19
- title: 'Added Data Title',
20
- });
21
- },
22
- addCount: (getState, setState) => {
23
- const prevState = getState();
24
- setState({
25
- ...prevState,
26
- count: (prevState.count || 0) + 1,
27
- });
28
- },
29
- });
30
- let renderCount = 0;
31
- export const getRenderCount = () => renderCount;
32
- export const setRenderCount = (count) => {
33
- renderCount = count;
34
- };
35
- const titleSelector = (state) => state.title;
36
- const countSelector = (state) => state.count;
37
- // const dataSelector = (state: Partial<SimpleState>) => state.data
38
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
- // @ts-ignore
40
- const simpleSelector = createSelector(titleSelector, countSelector,
41
- // dataSelector,
42
- (title, count, data) => {
43
- console.log('simpleSelector called');
44
- return {
45
- title,
46
- count,
47
- data,
48
- };
49
- });
50
- export const SimpleComponent = memo(({ children }) => {
51
- renderCount += 1;
52
- const { title, count, data } = useStore(simpleStore, simpleSelector);
53
- const simpleComponentButtonClickHandler = useCallback(() => {
54
- simpleStore.actions.addCount();
55
- }, []);
56
- return (_jsxs(LayoutBox, { direction: 'column', children: [_jsx("h3", { children: title }), _jsx("p", { children: count }), _jsx("p", { children: JSON.stringify(data) }), _jsx("button", { type: 'button', id: 'simpleComponentButton', onClick: simpleComponentButtonClickHandler, children: "Add Count" }), children && (_jsx(LayoutBox, { children: children }))] }));
57
- });
58
- SimpleComponent.displayName = 'SimpleComponent';
59
- //# sourceMappingURL=SimpleComponent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SimpleComponent.js","sourceRoot":"","sources":["../../../../../../../../src/core/utils/appState/store/simpleComponent/SimpleComponent.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAyB,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAAgB,MAAM,mBAAmB,CAAA;AAC1D,OAAO,EAAoB,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAW9C,MAAM,CAAC,MAAM,WAAW,GAAkC,WAAW,CAAc;IACjF,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAChB,EAAE;IACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;QACpC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QAC5B,MAAM,KAAK,CAAC,IAAI,CAAC,CAAA;QACjB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;QAC1B,QAAQ,CAAC;YACP,GAAG,QAAQ,EAAE;YACb,KAAK,EAAE,kBAAkB;SAC1B,CAAC,CAAA;IACJ,CAAC;IACD,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE;QAC/B,MAAM,SAAS,GAAG,QAAQ,EAAE,CAAA;QAE5B,QAAQ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,uBAAK,KAAK,GAAM,EAChB,sBAAI,KAAK,GAAK,EACd,sBAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAK,EAC7B,iBAAQ,IAAI,EAAC,QAAQ,EAAC,EAAE,EAAC,uBAAuB,EAAC,OAAO,EAAE,iCAAiC,0BAAoB,EAC9G,QAAQ,IAAI,CACb,KAAC,SAAS,cACP,QAAQ,GACC,CACX,IACS,CACb,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,eAAe,CAAC,WAAW,GAAG,iBAAiB,CAAA"}
@@ -1,62 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { memo, useCallback } from 'react';
3
- import { createSelector } from 'reselect';
4
- import { useStore } from '../useStore.react';
5
- import { createStore } from '../store.vanillajs';
6
- import { LayoutBox } from '../../../../ui/components/container/LayoutBox';
7
- import { delay } from '../../../helpers/other';
8
- export const simpleStore2 = createStore({
9
- title: 'Initial Title',
10
- count: 0,
11
- data: [1, 2, 3],
12
- }, {
13
- addData: async (getState, setState) => {
14
- console.log('addData start');
15
- await delay(1000);
16
- console.log('addData end');
17
- setState({
18
- ...getState(),
19
- title: 'Added Data Title',
20
- });
21
- },
22
- addCount: (getState, setState) => {
23
- const prevState = getState();
24
- setState({
25
- ...prevState,
26
- count: (prevState.count || 0) + 1,
27
- });
28
- },
29
- });
30
- let renderCount = 0;
31
- export const getRenderCount = () => renderCount;
32
- export const setRenderCount = (count) => {
33
- renderCount = count;
34
- };
35
- const titleSelector = (state) => state.title;
36
- const countSelector = (state) => state.count;
37
- // const dataSelector = (state: Partial<SimpleState>) => state.data
38
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
39
- // @ts-ignore
40
- const simpleSelector = createSelector(titleSelector, countSelector,
41
- // dataSelector,
42
- (title, count, data) => {
43
- console.log('simpleSelector called');
44
- return {
45
- title,
46
- count,
47
- data,
48
- };
49
- });
50
- export const SimpleComponent2 = memo(({ children }) => {
51
- renderCount += 1;
52
- const [{ title, count, data }, setState] = useStore(simpleStore2, simpleSelector, true);
53
- const simpleComponentButtonClickHandler = useCallback(() => {
54
- setState({
55
- ...simpleStore2.getState(),
56
- count: 111,
57
- });
58
- }, [setState]);
59
- return (_jsxs(LayoutBox, { direction: 'column', children: [_jsx("h3", { children: title }), _jsx("p", { children: count }), _jsx("p", { children: JSON.stringify(data) }), _jsx("button", { type: 'button', id: 'simpleComponentButton', onClick: simpleComponentButtonClickHandler, children: "Add Count" }), children && (_jsx(LayoutBox, { children: children }))] }));
60
- });
61
- SimpleComponent2.displayName = 'SimpleComponent2';
62
- //# sourceMappingURL=SimpleComponent2.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"SimpleComponent2.js","sourceRoot":"","sources":["../../../../../../../../src/core/utils/appState/store/simpleComponent/SimpleComponent2.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAyB,IAAI,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAChE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAA;AAEzC,OAAO,EAAE,QAAQ,EAA0B,MAAM,mBAAmB,CAAA;AACpE,OAAO,EAAoB,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAClE,OAAO,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAA;AACzE,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAA;AAW9C,MAAM,CAAC,MAAM,YAAY,GAAkC,WAAW,CAAc;IAClF,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CAChB,EAAE;IACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE;QACpC,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QAC5B,MAAM,KAAK,CAAC,IAAI,CAAC,CAAA;QACjB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;QAC1B,QAAQ,CAAC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Y,EAAE,cAAc,EAAE,IAAI,CAAC,CAAA;IAE9C,MAAM,iCAAiC,GAAG,WAAW,CAAC,GAAG,EAAE;QACzD,QAAQ,CAAC;YACP,GAAG,YAAY,CAAC,QAAQ,EAAE;YAC1B,KAAK,EAAE,GAAG;SACX,CAAC,CAAA;IACJ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAA;IAEd,OAAO,CACL,MAAC,SAAS,IAAC,SAAS,EAAC,QAAQ,aAC3B,uBAAK,KAAK,GAAM,EAChB,sBAAI,KAAK,GAAK,EACd,sBAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAK,EAC7B,iBAAQ,IAAI,EAAC,QAAQ,EAAC,EAAE,EAAC,uBAAuB,EAAC,OAAO,EAAE,iCAAiC,0BAAoB,EAC9G,QAAQ,IAAI,CACb,KAAC,SAAS,cACP,QAAQ,GACC,CACX,IACS,CACb,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,gBAAgB,CAAC,WAAW,GAAG,kBAAkB,CAAA"}
@@ -1,105 +0,0 @@
1
- // TinyStore, inspired by https://github.com/jherr/syncexternalstore/blob/main/csr/src/store.js
2
- /**
3
- * Creates a new store.
4
- * @param initialState - The initial state of the store.
5
- * @param actions - Optional actions for the store.
6
- * @returns The created store.
7
- */
8
- export const createStore = (initialState, actions, reducer) => {
9
- let currentState = initialState;
10
- const listeners = new Set();
11
- /**
12
- * Gets the current state of the store.
13
- * @returns The current state of the store.
14
- */
15
- const getState = () => currentState;
16
- // TODO debounce, batch? what is the meaningful time between setState ofr UI to be rendered and registerd by User?
17
- /**
18
- * Sets the state of the store.
19
- * @param newState - The new state to set.
20
- * @returns A promise that resolves to the new state.
21
- */
22
- const setState = async (newState) => {
23
- currentState = newState;
24
- // eslint-disable-next-line no-restricted-syntax
25
- for (const listener of listeners) {
26
- // has Listener selector?
27
- const selector = listener?.selector;
28
- // TODO compare selected value to the previous values of that listener/selector pair
29
- // if listener.previousValue === selector(currentState) no call
30
- // else listener.previousValue = selector(currentState) and call
31
- // l1 cache, weak references?
32
- const newValue = selector ? selector(currentState) : currentState;
33
- // TODO plugin equality
34
- if (listener.previousValue === undefined || listener.previousValue !== newValue) {
35
- listener.previousValue = newValue;
36
- // eslint-disable-next-line no-await-in-loop
37
- await listener(newValue);
38
- }
39
- }
40
- return currentState;
41
- };
42
- /**
43
- * Represents the basic API of the store.
44
- */
45
- const storeBaseicApi = {
46
- /**
47
- * Get the current state of the store.
48
- * @returns The current state of the store.
49
- */
50
- getState,
51
- /**
52
- * Set the state of the store.
53
- * @param state - The new state to set.
54
- * @returns A promise that resolves to the new state.
55
- */
56
- setState,
57
- /**
58
- * Subscribe a listener to the store.
59
- * @param listener - The listener function to be subscribed.
60
- * @returns A function to unsubscribe the listener.
61
- */
62
- subscribe: (listener, selector) => {
63
- if (selector && listener.selector && listener.selector !== selector) {
64
- throw new Error('Error, mismatchm selector, listener.selector !== selector.');
65
- }
66
- if (selector && !listener.selector) {
67
- // eslint-disable-next-line no-param-reassign
68
- listener.selector = selector;
69
- }
70
- listeners.add(listener);
71
- return () => listeners.delete(listener);
72
- },
73
- /**
74
- * Unsubscribe a listener from the store.
75
- * @param listener - The listener function to be unsubscribed.
76
- */
77
- unsubscribe: (listener) => {
78
- listeners.delete(listener);
79
- },
80
- };
81
- /**
82
- * Resolves the actions and creates action handlers.
83
- */
84
- const resolvedActions = actions ? Object.entries(actions)?.reduce((aggregator, [actionName, actionHandler]) => ({
85
- ...aggregator,
86
- [actionName]: async (...rest) => {
87
- const resultOfAction = await actionHandler(getState, setState, ...rest);
88
- if (reducer) {
89
- setState(reducer(getState(), actionName, ...rest));
90
- }
91
- return resultOfAction;
92
- },
93
- }), {}) : null;
94
- /**
95
- * Represents the store combined with actions.
96
- */
97
- const storeCombinedWithActions = {
98
- ...storeBaseicApi,
99
- ...(resolvedActions ? { actions: { ...resolvedActions } } : {}),
100
- };
101
- return resolvedActions
102
- ? storeCombinedWithActions
103
- : storeCombinedWithActions;
104
- };
105
- //# sourceMappingURL=store.vanillajs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"store.vanillajs.js","sourceRoot":"","sources":["../../../../../../../src/core/utils/appState/store/store.vanillajs.ts"],"names":[],"mappings":"AACA,+FAA+F;AAoF/F;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CACzB,YAAwB,EACxB,OAA0C,EAC1C,OAAoB,EACY,EAAE;IAClC,IAAI,YAAY,GAAe,YAAY,CAAA;IAC3C,MAAM,SAAS,GAAG,IAAI,GAAG,EAAe,CAAA;IAExC;;;OAGG;IACH,MAAM,QAAQ,GAAG,GAAG,EAAE,CAAC,YAAY,CAAA;IAEnC,kHAAkH;IAClH;;;;OAIG;IACH,MAAM,QAAQ,GAAG,KAAK,EAAE,QAAoB,EAAE,EAAE;QAC9C,YAAY,GAAG,QAAQ,CAAA;QAEvB,gDAAgD;QAChD,KAAK,MAAM,QAAQ,IAAI,SAAS,EAAE,CAAC;YACjC,yBAAyB;YACzB,MAAM,QAAQ,GAA4B,QAAQ,EAAE,QAAQ,CAAA;YAE5D,oFAAoF;YACpF,+DAA+D;YAC/D,gEAAgE;YAChE,6BAA6B;YAC7B,MAAM,QAAQ,GAAyB,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,YAAY,CAAA;YAEvF,uBAAuB;YACvB,IAAI,QAAQ,CAAC,aAAa,KAAK,SAAS,IAAI,QAAQ,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;gBAChF,QAAQ,CAAC,aAAa,GAAG,QAAQ,CAAA;gBACjC,4CAA4C;gBAC5C,MAAM,QAAQ,CAAC,QAAsB,CAAC,CAAA;YACxC,CAAC;QACH,CAAC;QACD,OAAO,YAAY,CAAA;IACrB,CAAC,CAAA;IAED;;OAEG;IACH,MAAM,cAAc,GAAa;QAC/B;;;WAGG;QACH,QAAQ;QACR;;;;WAIG;QACH,QAAQ;QACR;;;;WAIG;QACH,SAAS,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,GAAG;QAC/B,GAAG,cAAc;QACjB,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,EAAE,GAAG,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAChE,CAAA;IAED,OAAO,eAAe;QACpB,CAAC,CAAC,wBAA+C;QACjD,CAAC,CAAC,wBAAoC,CAAA;AAC1C,CAAC,CAAA"}
@@ -1,41 +0,0 @@
1
- import { createStore } from './store.vanillajs';
2
- /**
3
- * Creates a data store with actions.
4
- * @param dataId - The ID of the data.
5
- * @param actions - Optional actions for the data store.
6
- * @returns The created data store with actions.
7
- */
8
- export const createDataStore = (dataId, initialState, actions, reducer) => {
9
- const loadActions = {
10
- ...actions,
11
- /**
12
- * Loads data into the data store.
13
- * @param getState - Function to get the current state of the data store.
14
- * @param setState - Function to set the state of the data store.
15
- * @param dataPromise - The data promise to be loaded.
16
- * @returns A promise that resolves to the updated state of the data store.
17
- */
18
- load: async (getState, setState, dataPromise) => {
19
- const dataState = getState();
20
- setState({ ...dataState, isLoading: true });
21
- try {
22
- const response = await dataPromise;
23
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
24
- // @ts-ignore
25
- dataState.data = response?.data || response;
26
- }
27
- catch (error) {
28
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
29
- // @ts-ignore
30
- dataState.error = error;
31
- }
32
- return setState({ ...dataState, isLoading: false });
33
- },
34
- };
35
- return (createStore({
36
- ...initialState,
37
- dataId,
38
- isLoading: false,
39
- }, loadActions, reducer));
40
- };
41
- //# sourceMappingURL=store.vanillajs.templates.js.map