@ozen-ui/responsive 0.84.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.
Files changed (173) hide show
  1. package/README.md +26 -0
  2. package/__inner__/cjs/constants/environment/constants/index.js +5 -0
  3. package/__inner__/cjs/constants/environment/constants/isDev.js +5 -0
  4. package/__inner__/cjs/constants/environment/constants/isProduction.js +4 -0
  5. package/__inner__/cjs/constants/environment/index.js +4 -0
  6. package/__inner__/cjs/constants/index.js +4 -0
  7. package/__inner__/cjs/entities/breakpoint.js +2 -0
  8. package/__inner__/cjs/entities/index.js +9 -0
  9. package/__inner__/cjs/entities/orientation.js +4 -0
  10. package/__inner__/cjs/entities/os.js +4 -0
  11. package/__inner__/cjs/entities/scope.js +2 -0
  12. package/__inner__/cjs/entities/type.js +4 -0
  13. package/__inner__/cjs/entities/viewport.js +2 -0
  14. package/__inner__/cjs/fabric/fabric.js +79 -0
  15. package/__inner__/cjs/fabric/index.js +5 -0
  16. package/__inner__/cjs/fabric/infers/base.js +2 -0
  17. package/__inner__/cjs/fabric/infers/breakpoint.js +2 -0
  18. package/__inner__/cjs/fabric/infers/index.js +8 -0
  19. package/__inner__/cjs/fabric/infers/orientation.js +2 -0
  20. package/__inner__/cjs/fabric/infers/os.js +2 -0
  21. package/__inner__/cjs/fabric/infers/type.js +2 -0
  22. package/__inner__/cjs/fabric/infers/viewport.js +2 -0
  23. package/__inner__/cjs/fabric/utils.js +25 -0
  24. package/__inner__/cjs/hooks/index.js +15 -0
  25. package/__inner__/cjs/hooks/useBreakpoint.js +16 -0
  26. package/__inner__/cjs/hooks/useBreakpointObserver.js +19 -0
  27. package/__inner__/cjs/hooks/useDeviceType.js +16 -0
  28. package/__inner__/cjs/hooks/useDeviceTypeObserver.js +19 -0
  29. package/__inner__/cjs/hooks/useOS.js +16 -0
  30. package/__inner__/cjs/hooks/useOSObserver.js +19 -0
  31. package/__inner__/cjs/hooks/useOrientation.js +16 -0
  32. package/__inner__/cjs/hooks/useOrientationObserver.js +19 -0
  33. package/__inner__/cjs/hooks/useSnapshot.js +16 -0
  34. package/__inner__/cjs/hooks/useSnapshotObserver.js +19 -0
  35. package/__inner__/cjs/hooks/useViewport.js +16 -0
  36. package/__inner__/cjs/hooks/useViewportObserver.js +19 -0
  37. package/__inner__/cjs/index.js +4 -0
  38. package/__inner__/cjs/provider/ResponsiveContext.js +16 -0
  39. package/__inner__/cjs/provider/ResponsiveProvider.js +24 -0
  40. package/__inner__/cjs/provider/index.js +6 -0
  41. package/__inner__/cjs/provider/types.js +2 -0
  42. package/__inner__/cjs/store/ResponsiveStore.js +95 -0
  43. package/__inner__/cjs/store/index.js +5 -0
  44. package/__inner__/cjs/store/types.js +2 -0
  45. package/__inner__/cjs/store/utils.js +69 -0
  46. package/__inner__/cjs/ui/ResponsiveNodes/ResponsiveNodes.js +30 -0
  47. package/__inner__/cjs/ui/ResponsiveNodes/index.js +5 -0
  48. package/__inner__/cjs/ui/ResponsiveNodes/types.js +2 -0
  49. package/__inner__/cjs/ui/ResponsiveProps/ResponsiveProps.js +40 -0
  50. package/__inner__/cjs/ui/ResponsiveProps/index.js +5 -0
  51. package/__inner__/cjs/ui/ResponsiveProps/types.js +2 -0
  52. package/__inner__/cjs/ui/index.js +5 -0
  53. package/__inner__/cjs/ui/utils/index.js +5 -0
  54. package/__inner__/cjs/ui/utils/types.js +2 -0
  55. package/__inner__/cjs/ui/utils/utils.js +78 -0
  56. package/__inner__/cjs/user-agent/constants.js +115 -0
  57. package/__inner__/cjs/user-agent/index.js +5 -0
  58. package/__inner__/cjs/user-agent/user-agent-parser.js +92 -0
  59. package/__inner__/esm/constants/environment/constants/index.js +2 -0
  60. package/__inner__/esm/constants/environment/constants/isDev.js +2 -0
  61. package/__inner__/esm/constants/environment/constants/isProduction.js +1 -0
  62. package/__inner__/esm/constants/environment/index.js +1 -0
  63. package/__inner__/esm/constants/index.js +1 -0
  64. package/__inner__/esm/entities/breakpoint.js +1 -0
  65. package/__inner__/esm/entities/index.js +6 -0
  66. package/__inner__/esm/entities/orientation.js +1 -0
  67. package/__inner__/esm/entities/os.js +1 -0
  68. package/__inner__/esm/entities/scope.js +1 -0
  69. package/__inner__/esm/entities/type.js +1 -0
  70. package/__inner__/esm/entities/viewport.js +1 -0
  71. package/__inner__/esm/fabric/fabric.js +75 -0
  72. package/__inner__/esm/fabric/index.js +2 -0
  73. package/__inner__/esm/fabric/infers/base.js +1 -0
  74. package/__inner__/esm/fabric/infers/breakpoint.js +1 -0
  75. package/__inner__/esm/fabric/infers/index.js +5 -0
  76. package/__inner__/esm/fabric/infers/orientation.js +1 -0
  77. package/__inner__/esm/fabric/infers/os.js +1 -0
  78. package/__inner__/esm/fabric/infers/type.js +1 -0
  79. package/__inner__/esm/fabric/infers/viewport.js +1 -0
  80. package/__inner__/esm/fabric/utils.js +21 -0
  81. package/__inner__/esm/hooks/index.js +12 -0
  82. package/__inner__/esm/hooks/useBreakpoint.js +12 -0
  83. package/__inner__/esm/hooks/useBreakpointObserver.js +15 -0
  84. package/__inner__/esm/hooks/useDeviceType.js +12 -0
  85. package/__inner__/esm/hooks/useDeviceTypeObserver.js +15 -0
  86. package/__inner__/esm/hooks/useOS.js +12 -0
  87. package/__inner__/esm/hooks/useOSObserver.js +15 -0
  88. package/__inner__/esm/hooks/useOrientation.js +12 -0
  89. package/__inner__/esm/hooks/useOrientationObserver.js +15 -0
  90. package/__inner__/esm/hooks/useSnapshot.js +12 -0
  91. package/__inner__/esm/hooks/useSnapshotObserver.js +15 -0
  92. package/__inner__/esm/hooks/useViewport.js +12 -0
  93. package/__inner__/esm/hooks/useViewportObserver.js +15 -0
  94. package/__inner__/esm/index.js +1 -0
  95. package/__inner__/esm/provider/ResponsiveContext.js +12 -0
  96. package/__inner__/esm/provider/ResponsiveProvider.js +19 -0
  97. package/__inner__/esm/provider/index.js +3 -0
  98. package/__inner__/esm/provider/types.js +1 -0
  99. package/__inner__/esm/store/ResponsiveStore.js +92 -0
  100. package/__inner__/esm/store/index.js +2 -0
  101. package/__inner__/esm/store/types.js +1 -0
  102. package/__inner__/esm/store/utils.js +62 -0
  103. package/__inner__/esm/ui/ResponsiveNodes/ResponsiveNodes.js +25 -0
  104. package/__inner__/esm/ui/ResponsiveNodes/index.js +2 -0
  105. package/__inner__/esm/ui/ResponsiveNodes/types.js +1 -0
  106. package/__inner__/esm/ui/ResponsiveProps/ResponsiveProps.js +36 -0
  107. package/__inner__/esm/ui/ResponsiveProps/index.js +2 -0
  108. package/__inner__/esm/ui/ResponsiveProps/types.js +1 -0
  109. package/__inner__/esm/ui/index.js +2 -0
  110. package/__inner__/esm/ui/utils/index.js +2 -0
  111. package/__inner__/esm/ui/utils/types.js +1 -0
  112. package/__inner__/esm/ui/utils/utils.js +74 -0
  113. package/__inner__/esm/user-agent/constants.js +112 -0
  114. package/__inner__/esm/user-agent/index.js +2 -0
  115. package/__inner__/esm/user-agent/user-agent-parser.js +89 -0
  116. package/__inner__/types/constants/environment/constants/index.d.ts +2 -0
  117. package/__inner__/types/constants/environment/constants/isDev.d.ts +1 -0
  118. package/__inner__/types/constants/environment/constants/isProduction.d.ts +1 -0
  119. package/__inner__/types/constants/environment/index.d.ts +1 -0
  120. package/__inner__/types/constants/index.d.ts +1 -0
  121. package/__inner__/types/entities/breakpoint.d.ts +21 -0
  122. package/__inner__/types/entities/index.d.ts +6 -0
  123. package/__inner__/types/entities/orientation.d.ts +7 -0
  124. package/__inner__/types/entities/os.d.ts +8 -0
  125. package/__inner__/types/entities/scope.d.ts +11 -0
  126. package/__inner__/types/entities/type.d.ts +8 -0
  127. package/__inner__/types/entities/viewport.d.ts +4 -0
  128. package/__inner__/types/fabric/fabric.d.ts +25 -0
  129. package/__inner__/types/fabric/index.d.ts +2 -0
  130. package/__inner__/types/fabric/infers/base.d.ts +2 -0
  131. package/__inner__/types/fabric/infers/breakpoint.d.ts +5 -0
  132. package/__inner__/types/fabric/infers/index.d.ts +5 -0
  133. package/__inner__/types/fabric/infers/orientation.d.ts +4 -0
  134. package/__inner__/types/fabric/infers/os.d.ts +4 -0
  135. package/__inner__/types/fabric/infers/type.d.ts +4 -0
  136. package/__inner__/types/fabric/infers/viewport.d.ts +3 -0
  137. package/__inner__/types/fabric/utils.d.ts +2 -0
  138. package/__inner__/types/hooks/index.d.ts +12 -0
  139. package/__inner__/types/hooks/useBreakpoint.d.ts +2 -0
  140. package/__inner__/types/hooks/useBreakpointObserver.d.ts +2 -0
  141. package/__inner__/types/hooks/useDeviceType.d.ts +2 -0
  142. package/__inner__/types/hooks/useDeviceTypeObserver.d.ts +2 -0
  143. package/__inner__/types/hooks/useOS.d.ts +2 -0
  144. package/__inner__/types/hooks/useOSObserver.d.ts +2 -0
  145. package/__inner__/types/hooks/useOrientation.d.ts +2 -0
  146. package/__inner__/types/hooks/useOrientationObserver.d.ts +2 -0
  147. package/__inner__/types/hooks/useSnapshot.d.ts +2 -0
  148. package/__inner__/types/hooks/useSnapshotObserver.d.ts +3 -0
  149. package/__inner__/types/hooks/useViewport.d.ts +2 -0
  150. package/__inner__/types/hooks/useViewportObserver.d.ts +2 -0
  151. package/__inner__/types/index.d.ts +1 -0
  152. package/__inner__/types/provider/ResponsiveContext.d.ts +8 -0
  153. package/__inner__/types/provider/ResponsiveProvider.d.ts +4 -0
  154. package/__inner__/types/provider/index.d.ts +3 -0
  155. package/__inner__/types/provider/types.d.ts +6 -0
  156. package/__inner__/types/store/ResponsiveStore.d.ts +16 -0
  157. package/__inner__/types/store/index.d.ts +2 -0
  158. package/__inner__/types/store/types.d.ts +12 -0
  159. package/__inner__/types/store/utils.d.ts +5 -0
  160. package/__inner__/types/ui/ResponsiveNodes/ResponsiveNodes.d.ts +4 -0
  161. package/__inner__/types/ui/ResponsiveNodes/index.d.ts +2 -0
  162. package/__inner__/types/ui/ResponsiveNodes/types.d.ts +6 -0
  163. package/__inner__/types/ui/ResponsiveProps/ResponsiveProps.d.ts +5 -0
  164. package/__inner__/types/ui/ResponsiveProps/index.d.ts +2 -0
  165. package/__inner__/types/ui/ResponsiveProps/types.d.ts +8 -0
  166. package/__inner__/types/ui/index.d.ts +2 -0
  167. package/__inner__/types/ui/utils/index.d.ts +2 -0
  168. package/__inner__/types/ui/utils/types.d.ts +6 -0
  169. package/__inner__/types/ui/utils/utils.d.ts +6 -0
  170. package/__inner__/types/user-agent/constants.d.ts +108 -0
  171. package/__inner__/types/user-agent/index.d.ts +2 -0
  172. package/__inner__/types/user-agent/user-agent-parser.d.ts +11 -0
  173. package/package.json +34 -0
@@ -0,0 +1,74 @@
1
+ /* eslint-disable no-continue */
2
+ import { __read, __values } from "tslib";
3
+ export var resolveBreakpoints = function (scope, by, device) {
4
+ var e_1, _a, e_2, _b;
5
+ var SIZE_RANK = {};
6
+ scope.sizesAscending.forEach(function (size, index) {
7
+ SIZE_RANK[size] = index;
8
+ });
9
+ var currentRank = SIZE_RANK[device.size];
10
+ var bestMixed = null;
11
+ try {
12
+ for (var _c = __values(Object.entries(by)), _d = _c.next(); !_d.done; _d = _c.next()) {
13
+ var _e = __read(_d.value, 2), rawKey = _e[0], Comp = _e[1];
14
+ if (!Comp) {
15
+ continue;
16
+ }
17
+ var key = rawKey;
18
+ var parts = rawKey.split(':');
19
+ if (parts.length !== 2) {
20
+ continue;
21
+ }
22
+ var _f = __read(parts, 2), type = _f[0], size = _f[1];
23
+ if (type !== device.type) {
24
+ continue;
25
+ }
26
+ if (!(size in SIZE_RANK)) {
27
+ continue;
28
+ }
29
+ var rank = SIZE_RANK[size];
30
+ if (rank <= currentRank && (!bestMixed || rank > bestMixed.rank)) {
31
+ bestMixed = { key: key, rank: rank, value: Comp };
32
+ }
33
+ }
34
+ }
35
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
36
+ finally {
37
+ try {
38
+ if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
39
+ }
40
+ finally { if (e_1) throw e_1.error; }
41
+ }
42
+ if (bestMixed) {
43
+ return { key: bestMixed.key, value: bestMixed.value };
44
+ }
45
+ var typeOnly = by[device.type];
46
+ if (typeOnly) {
47
+ return { key: device.type, value: typeOnly };
48
+ }
49
+ var bestSize = null;
50
+ try {
51
+ for (var _g = __values(scope.sizesAscending), _h = _g.next(); !_h.done; _h = _g.next()) {
52
+ var size = _h.value;
53
+ var value = by[size];
54
+ if (!value) {
55
+ continue;
56
+ }
57
+ var rank = SIZE_RANK[size];
58
+ if (rank <= currentRank && (!bestSize || rank > bestSize.rank)) {
59
+ bestSize = { key: size, rank: rank, value: value };
60
+ }
61
+ }
62
+ }
63
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
64
+ finally {
65
+ try {
66
+ if (_h && !_h.done && (_b = _g.return)) _b.call(_g);
67
+ }
68
+ finally { if (e_2) throw e_2.error; }
69
+ }
70
+ if (bestSize) {
71
+ return { key: bestSize.key, value: bestSize.value };
72
+ }
73
+ return null;
74
+ };
@@ -0,0 +1,112 @@
1
+ var UADeviceType = {
2
+ CONSOLE: 'console',
3
+ DESKTOP: 'desktop',
4
+ EMBEDDED: 'embedded',
5
+ MOBILE: 'mobile',
6
+ SMARTTV: 'smarttv',
7
+ TABLET: 'tablet',
8
+ WEARABLE: 'wearable',
9
+ XR: 'xr',
10
+ };
11
+ var OSName = {
12
+ AIX: 'AIX',
13
+ AMIGA_OS: 'Amiga OS',
14
+ ANDROID: 'Android',
15
+ ANDROID_X86: 'Android-x86',
16
+ ARCAOS: 'ArcaOS',
17
+ ARCH: 'Arch',
18
+ BADA: 'Bada',
19
+ BEOS: 'BeOS',
20
+ BLACKBERRY: 'BlackBerry',
21
+ CENTOS: 'CentOS',
22
+ CHROME_OS: 'Chrome OS',
23
+ CHROMECAST: 'Chromecast',
24
+ CHROMECAST_ANDROID: 'Chromecast Android',
25
+ CHROMECAST_FUCHSIA: 'Chromecast Fuchsia',
26
+ CHROMECAST_LINUX: 'Chromecast Linux',
27
+ CHROMECAST_SMARTSPEAKER: 'Chromecast SmartSpeaker',
28
+ CONTIKI: 'Contiki',
29
+ DEBIAN: 'Debian',
30
+ DEEPIN: 'Deepin',
31
+ DRAGONFLY: 'DragonFly',
32
+ ELEMENTARY_OS: 'elementary OS',
33
+ FEDORA: 'Fedora',
34
+ FIREFOX_OS: 'Firefox OS',
35
+ FREEBSD: 'FreeBSD',
36
+ FUCHSIA: 'Fuchsia',
37
+ GENTOO: 'Gentoo',
38
+ GHOSTBSD: 'GhostBSD',
39
+ GNU: 'GNU',
40
+ HAIKU: 'Haiku',
41
+ HARMONYOS: 'HarmonyOS',
42
+ HP_UX: 'HP-UX',
43
+ HURD: 'Hurd',
44
+ IOS: 'iOS',
45
+ JOLI: 'Joli',
46
+ KAIOS: 'KaiOS',
47
+ KNOPPIX: 'Knoppix',
48
+ KUBUNTU: 'Kubuntu',
49
+ LINPUS: 'Linpus',
50
+ LINSPIRE: 'Linspire',
51
+ LINUX: 'Linux',
52
+ MACOS: 'macOS',
53
+ MAEMO: 'Maemo',
54
+ MAGEIA: 'Mageia',
55
+ MANDRIVA: 'Mandriva',
56
+ MANJARO: 'Manjaro',
57
+ MEEGO: 'MeeGo',
58
+ MINIX: 'Minix',
59
+ MINT: 'Mint',
60
+ MORPH_OS: 'Morph OS',
61
+ NETBSD: 'NetBSD',
62
+ NETRANGE: 'NetRange',
63
+ NETTV: 'NetTV',
64
+ NINTENDO: 'Nintendo',
65
+ OPENHARMONY: 'OpenHarmony',
66
+ OPENBSD: 'OpenBSD',
67
+ OPENVMS: 'OpenVMS',
68
+ OS2: 'OS/2',
69
+ PALM: 'Palm',
70
+ PC_BSD: 'PC-BSD',
71
+ PCLINUXOS: 'PCLinuxOS',
72
+ PICO: 'Pico',
73
+ PLAN9: 'Plan9',
74
+ PLAYSTATION: 'PlayStation',
75
+ QNX: 'QNX',
76
+ RASPBIAN: 'Raspbian',
77
+ REDHAT: 'RedHat',
78
+ RIM_TABLET_OS: 'RIM Tablet OS',
79
+ RISC_OS: 'RISC OS',
80
+ SABAYON: 'Sabayon',
81
+ SAILFISH: 'Sailfish',
82
+ SERENITYOS: 'SerenityOS',
83
+ SERIES40: 'Series40',
84
+ SLACKWARE: 'Slackware',
85
+ SOLARIS: 'Solaris',
86
+ SUSE: 'SUSE',
87
+ SYMBIAN: 'Symbian',
88
+ TIZEN: 'Tizen',
89
+ UBUNTU: 'Ubuntu',
90
+ UBUNTU_TOUCH: 'Ubuntu Touch',
91
+ UNIX: 'Unix',
92
+ VECTORLINUX: 'VectorLinux',
93
+ WATCHOS: 'watchOS',
94
+ WEBOS: 'WebOS',
95
+ WINDOWS: 'Windows',
96
+ WINDOWS_CE: 'Windows CE',
97
+ WINDOWS_IOT: 'Windows IoT',
98
+ WINDOWS_MOBILE: 'Windows Mobile',
99
+ WINDOWS_PHONE: 'Windows Phone',
100
+ WINDOWS_RT: 'Windows RT',
101
+ XBOX: 'Xbox',
102
+ XUBUNTU: 'Xubuntu',
103
+ ZENWALK: 'Zenwalk',
104
+ };
105
+ export var USER_AGENT_PARSER_OS_TO_INTERNAL_OS = {
106
+ macOS: ['macOS'],
107
+ ios: ['iOS'],
108
+ };
109
+ export var USER_AGENT_PARSER_TYPE_TO_INTERNAL_TYPE = {
110
+ mobile: ['mobile'],
111
+ tablet: ['tablet'],
112
+ };
@@ -0,0 +1,2 @@
1
+ export * from './constants';
2
+ export * from './user-agent-parser';
@@ -0,0 +1,89 @@
1
+ import { __read, __values } from "tslib";
2
+ import { UAParser } from 'ua-parser-js';
3
+ import { USER_AGENT_PARSER_OS_TO_INTERNAL_OS, USER_AGENT_PARSER_TYPE_TO_INTERNAL_TYPE, } from './constants';
4
+ var UserAgentParser = /** @class */ (function () {
5
+ function UserAgentParser(userAgent) {
6
+ this.userAgent = new UAParser(userAgent);
7
+ }
8
+ UserAgentParser.prototype.update = function () {
9
+ this.userAgent = new UAParser();
10
+ };
11
+ Object.defineProperty(UserAgentParser.prototype, "deviceType", {
12
+ get: function () {
13
+ var e_1, _a;
14
+ var rawType = this.device.type;
15
+ if (!rawType) {
16
+ return 'desktop';
17
+ }
18
+ var _loop_1 = function (rawType_1, uaTypes) {
19
+ var type = rawType_1;
20
+ if (uaTypes.some(function (type) { return type === rawType_1; })) {
21
+ return { value: type };
22
+ }
23
+ };
24
+ try {
25
+ for (var _b = __values(Object.entries(USER_AGENT_PARSER_TYPE_TO_INTERNAL_TYPE)), _c = _b.next(); !_c.done; _c = _b.next()) {
26
+ var _d = __read(_c.value, 2), rawType_1 = _d[0], uaTypes = _d[1];
27
+ var state_1 = _loop_1(rawType_1, uaTypes);
28
+ if (typeof state_1 === "object")
29
+ return state_1.value;
30
+ }
31
+ }
32
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
33
+ finally {
34
+ try {
35
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
36
+ }
37
+ finally { if (e_1) throw e_1.error; }
38
+ }
39
+ return 'desktop';
40
+ },
41
+ enumerable: false,
42
+ configurable: true
43
+ });
44
+ Object.defineProperty(UserAgentParser.prototype, "OSName", {
45
+ get: function () {
46
+ var e_2, _a;
47
+ var rawName = this.OS.name;
48
+ if (!rawName) {
49
+ return 'unknown';
50
+ }
51
+ try {
52
+ for (var _b = __values(Object.entries(USER_AGENT_PARSER_OS_TO_INTERNAL_OS)), _c = _b.next(); !_c.done; _c = _b.next()) {
53
+ var _d = __read(_c.value, 2), rawOS = _d[0], uaOS = _d[1];
54
+ var OS = rawOS;
55
+ if (uaOS.some(function (OS) { return OS === rawName; })) {
56
+ return OS;
57
+ }
58
+ }
59
+ }
60
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
61
+ finally {
62
+ try {
63
+ if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
64
+ }
65
+ finally { if (e_2) throw e_2.error; }
66
+ }
67
+ return 'unknown';
68
+ },
69
+ enumerable: false,
70
+ configurable: true
71
+ });
72
+ Object.defineProperty(UserAgentParser.prototype, "device", {
73
+ get: function () {
74
+ return this.userAgent.getDevice();
75
+ },
76
+ enumerable: false,
77
+ configurable: true
78
+ });
79
+ Object.defineProperty(UserAgentParser.prototype, "OS", {
80
+ get: function () {
81
+ return this.userAgent.getOS();
82
+ },
83
+ enumerable: false,
84
+ configurable: true
85
+ });
86
+ return UserAgentParser;
87
+ }());
88
+ export { UserAgentParser };
89
+ export var userAgentParser = new UserAgentParser();
@@ -0,0 +1,2 @@
1
+ export * from './isDev';
2
+ export * from './isProduction';
@@ -0,0 +1 @@
1
+ export declare const isDev: boolean;
@@ -0,0 +1 @@
1
+ export declare const isProduction: boolean;
@@ -0,0 +1 @@
1
+ export * from './constants';
@@ -0,0 +1 @@
1
+ export * from './environment';
@@ -0,0 +1,21 @@
1
+ import type { Type } from './type';
2
+ export type Breakpoints = Record<string, number>;
3
+ export type InternalInferBreakpoint<TBreakpoints extends Breakpoints> = keyof TBreakpoints & string;
4
+ export type BreakpointState<TBreakpoints extends Breakpoints> = {
5
+ current: InternalInferBreakpoint<TBreakpoints>;
6
+ } & {
7
+ [Size in InternalInferBreakpoint<TBreakpoints> as `is${Uppercase<Size>}`]: boolean;
8
+ } & {
9
+ [Size in InternalInferBreakpoint<TBreakpoints> as `above${Uppercase<Size>}`]: boolean;
10
+ } & {
11
+ [Size in InternalInferBreakpoint<TBreakpoints> as `below${Uppercase<Size>}`]: boolean;
12
+ } & {
13
+ [Size in InternalInferBreakpoint<TBreakpoints> as `atOrAbove${Uppercase<Size>}`]: boolean;
14
+ } & {
15
+ [Size in InternalInferBreakpoint<TBreakpoints> as `atOrBelow${Uppercase<Size>}`]: boolean;
16
+ };
17
+ export type BreakpointSimpleSize<TBreakpoints extends Breakpoints> = InternalInferBreakpoint<TBreakpoints>;
18
+ export type BreakpointSimpleType = Type;
19
+ export type BreakpointMixedKey<TBreakpoints extends Breakpoints> = `${BreakpointSimpleType}:${BreakpointSimpleSize<TBreakpoints>}`;
20
+ export type BreakpointKey<TBreakpoints extends Breakpoints> = BreakpointSimpleSize<TBreakpoints> | BreakpointSimpleType | BreakpointMixedKey<TBreakpoints>;
21
+ export type ByBreakpoints<TBreakpoints extends Breakpoints, Value> = Partial<Record<BreakpointKey<TBreakpoints>, Value>>;
@@ -0,0 +1,6 @@
1
+ export * from './breakpoint';
2
+ export * from './orientation';
3
+ export * from './os';
4
+ export * from './scope';
5
+ export * from './type';
6
+ export * from './viewport';
@@ -0,0 +1,7 @@
1
+ export declare const orientation: readonly ["horizontal", "vertical"];
2
+ export type Orientation = (typeof orientation)[number];
3
+ export type OrientationState = {
4
+ current: Orientation;
5
+ } & {
6
+ [TOrientation in Orientation as `is${Capitalize<TOrientation>}`]: boolean;
7
+ };
@@ -0,0 +1,8 @@
1
+ export declare const OSVariant: readonly ["macOS", "ios", "unknown"];
2
+ export type OS = (typeof OSVariant)[number];
3
+ export type OSStateKeyIs<TOS extends OS = OS> = `is${Capitalize<TOS>}`;
4
+ export type OSState = {
5
+ [TOS in OS as OSStateKeyIs<TOS>]: boolean;
6
+ } & {
7
+ current: OS;
8
+ };
@@ -0,0 +1,11 @@
1
+ import type { Breakpoints } from './breakpoint';
2
+ import type { Orientation } from './orientation';
3
+ import type { OS } from './os';
4
+ import type { Type } from './type';
5
+ export type Scope<TBreakpoints extends Breakpoints> = {
6
+ breakpoints: TBreakpoints;
7
+ sizesAscending: (keyof TBreakpoints & string)[];
8
+ osVariant: Readonly<OS[]>;
9
+ typeVariant: Readonly<Type[]>;
10
+ orientationVariant: Readonly<Orientation[]>;
11
+ };
@@ -0,0 +1,8 @@
1
+ export declare const type: readonly ["mobile", "tablet", "desktop"];
2
+ export type Type = (typeof type)[number];
3
+ export type TypeStateKeyIs<TType extends Type = Type> = `is${Capitalize<TType>}`;
4
+ export type TypeState = {
5
+ [TType in Type as TypeStateKeyIs<TType>]: boolean;
6
+ } & {
7
+ current: Type;
8
+ };
@@ -0,0 +1,4 @@
1
+ export type Viewport = {
2
+ width: number;
3
+ height: number;
4
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import type { ElementType } from 'react';
3
+ import type { Breakpoints } from '../entities';
4
+ import type { ResponsiveProviderProps } from '../provider';
5
+ import type { ResponsiveNodesProps, ResponsivePropsProps } from '../ui';
6
+ export declare const createResponsive: <TBreakpoints extends Breakpoints>(breakpoints: TBreakpoints) => {
7
+ breakpoints: TBreakpoints;
8
+ osVariant: readonly ("macOS" | "ios" | "unknown")[];
9
+ sizesAscending: (keyof TBreakpoints & string)[];
10
+ typeVariant: readonly ("mobile" | "tablet" | "desktop")[];
11
+ orientationVariant: readonly ("horizontal" | "vertical")[];
12
+ ResponsiveProps: <Component extends ElementType>(props: ResponsivePropsProps<TBreakpoints, Component>) => React.JSX.Element;
13
+ ResponsiveNodes: (props: ResponsiveNodesProps<TBreakpoints>) => React.JSX.Element;
14
+ Provider: (props: Omit<ResponsiveProviderProps<TBreakpoints>, "scope">) => React.JSX.Element;
15
+ useBreakpoint: () => import("../entities").BreakpointState<TBreakpoints>;
16
+ useBreakpointObserver: (onChange?: ((current: import("../entities").BreakpointState<Breakpoints>, previous: import("../entities").BreakpointState<Breakpoints>) => void) | undefined) => import("@ozen-ui/kit/useStoredValue").StoredValue<import("../entities").BreakpointState<TBreakpoints>>;
17
+ useDeviceType: () => import("../entities").TypeState;
18
+ useDeviceTypeObserver: (onChange?: ((current: import("../entities").TypeState, previous: import("../entities").TypeState) => void) | undefined) => import("@ozen-ui/kit/useStoredValue").StoredValue<import("../entities").TypeState>;
19
+ useOrientation: () => import("../entities").OrientationState;
20
+ useOrientationObserver: (onChange?: ((current: import("../entities").OrientationState, previous: import("../entities").OrientationState) => void) | undefined) => import("@ozen-ui/kit/useStoredValue").StoredValue<import("../entities").OrientationState>;
21
+ useOS: () => import("../entities").OSState;
22
+ useOSObserver: (onChange?: ((current: import("../entities").OSState, previous: import("../entities").OSState) => void) | undefined) => import("@ozen-ui/kit/useStoredValue").StoredValue<import("../entities").OSState>;
23
+ useViewport: () => import("../entities").Viewport;
24
+ useViewportObserver: (onChange?: ((current: import("../entities").Viewport, previous: import("../entities").Viewport) => void) | undefined) => import("@ozen-ui/kit/useStoredValue").StoredValue<import("../entities").Viewport>;
25
+ };
@@ -0,0 +1,2 @@
1
+ export * from './infers';
2
+ export * from './fabric';
@@ -0,0 +1,2 @@
1
+ import type { createResponsive } from '../fabric';
2
+ export type FabricValue = ReturnType<typeof createResponsive>;
@@ -0,0 +1,5 @@
1
+ import type { BreakpointKey, BreakpointState, InternalInferBreakpoint } from '../../entities';
2
+ import type { FabricValue } from './base';
3
+ export type InferBreakpoint<Fabric extends FabricValue> = InternalInferBreakpoint<Fabric['breakpoints']>;
4
+ export type InferBreakpointState<Fabric extends FabricValue> = BreakpointState<Fabric['breakpoints']>;
5
+ export type InferBreakpointKey<Fabric extends FabricValue> = BreakpointKey<Fabric['breakpoints']>;
@@ -0,0 +1,5 @@
1
+ export * from './breakpoint';
2
+ export * from './orientation';
3
+ export * from './os';
4
+ export * from './type';
5
+ export * from './viewport';
@@ -0,0 +1,4 @@
1
+ import type { Orientation, OrientationState } from '../../entities';
2
+ import type { FabricValue } from './base';
3
+ export type InferOrientation<Fabric extends FabricValue> = Orientation;
4
+ export type InferOrientationState<Fabric extends FabricValue> = OrientationState;
@@ -0,0 +1,4 @@
1
+ import type { OS, OSState } from '../../entities';
2
+ import type { FabricValue } from './base';
3
+ export type InferOS<Fabric extends FabricValue> = OS;
4
+ export type InferOSState<Fabric extends FabricValue> = OSState;
@@ -0,0 +1,4 @@
1
+ import type { Type, TypeState } from '../../entities';
2
+ import type { FabricValue } from './base';
3
+ export type InferType<Fabric extends FabricValue> = Type;
4
+ export type InferTypeState<Fabric extends FabricValue> = TypeState;
@@ -0,0 +1,3 @@
1
+ import type { Viewport } from '../../entities';
2
+ import type { FabricValue } from './base';
3
+ export type InferViewport<Fabric extends FabricValue> = Viewport;
@@ -0,0 +1,2 @@
1
+ import type { Breakpoints, Scope } from '../entities';
2
+ export declare const createScope: <TBreakpoints extends Breakpoints>(breakpoints: TBreakpoints) => Scope<TBreakpoints>;
@@ -0,0 +1,12 @@
1
+ export * from './useBreakpoint';
2
+ export * from './useBreakpointObserver';
3
+ export * from './useDeviceType';
4
+ export * from './useDeviceTypeObserver';
5
+ export * from './useOrientation';
6
+ export * from './useOrientationObserver';
7
+ export * from './useOS';
8
+ export * from './useOSObserver';
9
+ export * from './useSnapshot';
10
+ export * from './useSnapshotObserver';
11
+ export * from './useViewport';
12
+ export * from './useViewportObserver';
@@ -0,0 +1,2 @@
1
+ import type { Breakpoints } from '../entities';
2
+ export declare const useBreakpoint: <TBreakpoints extends Breakpoints>() => import("../entities").BreakpointState<TBreakpoints>;
@@ -0,0 +1,2 @@
1
+ import type { BreakpointState, Breakpoints } from '../entities';
2
+ export declare const useBreakpointObserver: <TBreakpoints extends Breakpoints>(onChange?: (current: BreakpointState<TBreakpoints>, previous: BreakpointState<TBreakpoints>) => void) => import("@ozen-ui/kit/useStoredValue").StoredValue<BreakpointState<TBreakpoints>>;
@@ -0,0 +1,2 @@
1
+ import type { TypeState, Breakpoints } from '../entities';
2
+ export declare const useDeviceType: <TBreakpoints extends Breakpoints>() => TypeState;
@@ -0,0 +1,2 @@
1
+ import type { TypeState, Breakpoints } from '../entities';
2
+ export declare const useDeviceTypeObserver: <TBreakpoints extends Breakpoints>(onChange?: (current: TypeState, previous: TypeState) => void) => import("@ozen-ui/kit/useStoredValue").StoredValue<TypeState>;
@@ -0,0 +1,2 @@
1
+ import type { OSState, Breakpoints } from '../entities';
2
+ export declare const useOS: <TBreakpoints extends Breakpoints>() => OSState;
@@ -0,0 +1,2 @@
1
+ import type { OSState, Breakpoints } from '../entities';
2
+ export declare const useOSObserver: <TBreakpoints extends Breakpoints>(onChange?: (current: OSState, previous: OSState) => void) => import("@ozen-ui/kit/useStoredValue").StoredValue<OSState>;
@@ -0,0 +1,2 @@
1
+ import type { OrientationState, Breakpoints } from '../entities';
2
+ export declare const useOrientation: <TBreakpoints extends Breakpoints>() => OrientationState;
@@ -0,0 +1,2 @@
1
+ import type { OrientationState, Breakpoints } from '../entities';
2
+ export declare const useOrientationObserver: <TBreakpoints extends Breakpoints>(onChange?: (current: OrientationState, previous: OrientationState) => void) => import("@ozen-ui/kit/useStoredValue").StoredValue<OrientationState>;
@@ -0,0 +1,2 @@
1
+ import type { Breakpoints } from '../entities';
2
+ export declare const useSnapshot: <TBreakpoints extends Breakpoints>() => import("../store/types").Snapshot<TBreakpoints>;
@@ -0,0 +1,3 @@
1
+ import type { Breakpoints } from '../entities';
2
+ import type { Snapshot } from '../store/types';
3
+ export declare const useSnapshotObserver: <TBreakpoints extends Breakpoints>(onChange?: (current: Snapshot<TBreakpoints>, previous: Snapshot<TBreakpoints>) => void) => import("@ozen-ui/kit/useStoredValue").StoredValue<Snapshot<TBreakpoints>>;
@@ -0,0 +1,2 @@
1
+ import type { Breakpoints, Viewport } from '../entities';
2
+ export declare const useViewport: <TBreakpoints extends Breakpoints>() => Viewport;
@@ -0,0 +1,2 @@
1
+ import type { Breakpoints, Viewport } from '../entities';
2
+ export declare const useViewportObserver: <TBreakpoints extends Breakpoints>(onChange?: (current: Viewport, previous: Viewport) => void) => import("@ozen-ui/kit/useStoredValue").StoredValue<Viewport>;
@@ -0,0 +1 @@
1
+ export * from './fabric';
@@ -0,0 +1,8 @@
1
+ import type { Breakpoints } from '../entities';
2
+ import type { ResponsiveStore } from '../store';
3
+ export type ResponsiveContextValue<TBreakpoints extends Breakpoints> = {
4
+ store: ResponsiveStore<TBreakpoints>;
5
+ };
6
+ export declare const AutocompleteBaseContextDefaultValue: ResponsiveContextValue<Breakpoints>;
7
+ export declare const ResponsiveContext: import("react").Context<ResponsiveContextValue<Breakpoints>>;
8
+ export declare const useResponsiveContext: <TBreakpoints extends Breakpoints>() => ResponsiveContextValue<TBreakpoints>;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { Breakpoints } from '../entities';
3
+ import type { ResponsiveProviderProps } from './types';
4
+ export declare const ResponsiveProvider: <TBreakpoints extends Breakpoints>({ scope, children, }: ResponsiveProviderProps<TBreakpoints>) => React.JSX.Element;
@@ -0,0 +1,3 @@
1
+ export * from './ResponsiveContext';
2
+ export * from './ResponsiveProvider';
3
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Breakpoints, Scope } from '../entities';
3
+ export type ResponsiveProviderProps<TBreakpoints extends Breakpoints> = {
4
+ scope: Scope<TBreakpoints>;
5
+ children: ReactNode;
6
+ };
@@ -0,0 +1,16 @@
1
+ import { EventBus } from "@ozen-ui/kit/utils";
2
+ import type { Breakpoints, Scope } from '../entities';
3
+ import type { Events, Snapshot } from './types';
4
+ export declare class ResponsiveStore<TBreakpoints extends Breakpoints> {
5
+ eventBus: EventBus<Events<TBreakpoints>>;
6
+ snapshot: Snapshot<TBreakpoints>;
7
+ scope: Scope<TBreakpoints>;
8
+ private raf;
9
+ private cleanup;
10
+ constructor(scope: Scope<TBreakpoints>);
11
+ getSnapshot(): Snapshot<TBreakpoints>;
12
+ mount(): void;
13
+ unmount(): void;
14
+ private notify;
15
+ private schedule;
16
+ }
@@ -0,0 +1,2 @@
1
+ export * from './ResponsiveStore';
2
+ export * from './utils';
@@ -0,0 +1,12 @@
1
+ import type { BreakpointState, OrientationState, OSState, TypeState, Breakpoints, Viewport } from '../entities';
2
+ export type Snapshot<TBreakpoints extends Breakpoints> = {
3
+ orientation: OrientationState;
4
+ viewport: Viewport;
5
+ size: BreakpointState<TBreakpoints>;
6
+ type: TypeState;
7
+ os: OSState;
8
+ };
9
+ export type Events<TBreakpoints extends Breakpoints> = Record<'orientationChange' | 'viewportChange' | 'breakpointChange' | 'typeChange' | 'osChange' | 'snapshotChange', {
10
+ previous: Snapshot<TBreakpoints>;
11
+ current: Snapshot<TBreakpoints>;
12
+ }>;
@@ -0,0 +1,5 @@
1
+ import type { OS, OSState, Breakpoints, Scope, Type, TypeState, OrientationState, BreakpointState, Viewport } from '../entities';
2
+ export declare const getTypeState: <TBreakpoints extends Breakpoints>(scope: Scope<TBreakpoints>, current: Type) => TypeState;
3
+ export declare const getOrientationState: ({ width, height, }: Viewport) => OrientationState;
4
+ export declare const getBreakpointState: <TBreakpoints extends Breakpoints>(scope: Scope<TBreakpoints>, width: number) => BreakpointState<TBreakpoints>;
5
+ export declare const getOSState: <TBreakpoints extends Breakpoints>(scope: Scope<TBreakpoints>, current: OS) => OSState;
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { Breakpoints } from '../../entities';
3
+ import type { ResponsiveNodesProps } from './types';
4
+ export declare const ResponsiveNodes: <TBreakpoints extends Breakpoints>({ by, fallback, }: ResponsiveNodesProps<TBreakpoints>) => string | number | boolean | Iterable<React.ReactNode> | React.JSX.Element | null | undefined;
@@ -0,0 +1,2 @@
1
+ export * from './ResponsiveNodes';
2
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { Breakpoints, ByBreakpoints } from '../../entities';
3
+ export type ResponsiveNodesProps<TBreakpoints extends Breakpoints> = {
4
+ fallback?: () => ReactNode;
5
+ by: ByBreakpoints<TBreakpoints, ReactNode | (() => ReactNode)>;
6
+ };
@@ -0,0 +1,5 @@
1
+ import type { ElementType } from 'react';
2
+ import React from 'react';
3
+ import type { Breakpoints } from '../../entities';
4
+ import type { ResponsivePropsProps } from './types';
5
+ export declare const ResponsiveProps: <TBreakpoints extends Breakpoints, Component extends ElementType>({ component, props, sharedProps: sharedPropsProp, fallback, }: ResponsivePropsProps<TBreakpoints, Component>) => React.JSX.Element;
@@ -0,0 +1,2 @@
1
+ export * from './ResponsiveProps';
2
+ export * from './types';
@@ -0,0 +1,8 @@
1
+ import type { ComponentProps, ElementType, ReactNode } from 'react';
2
+ import type { Breakpoints, ByBreakpoints } from '../../entities';
3
+ export type ResponsivePropsProps<TBreakpoints extends Breakpoints, Component extends ElementType> = {
4
+ fallback?: () => ReactNode;
5
+ component: Component;
6
+ props: ByBreakpoints<TBreakpoints, ComponentProps<Component> | (() => ComponentProps<Component>)>;
7
+ sharedProps?: Partial<ComponentProps<Component>> | (() => Partial<ComponentProps<Component>>);
8
+ };