@g4rcez/components 3.0.0 → 3.0.2

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 (303) hide show
  1. package/dist/MotionConfigContext-C7MqlSdv.js +2713 -0
  2. package/dist/MotionConfigContext-C7MqlSdv.js.map +1 -0
  3. package/dist/ai/SKILL.md +266 -0
  4. package/dist/ai/docs/Alert.md +167 -0
  5. package/dist/ai/docs/AnimatedList.md +205 -0
  6. package/dist/ai/docs/Autocomplete.md +225 -0
  7. package/dist/ai/docs/Button.md +182 -0
  8. package/dist/ai/docs/Calendar.md +219 -0
  9. package/dist/ai/docs/Card.md +174 -0
  10. package/dist/ai/docs/Checkbox.md +199 -0
  11. package/dist/ai/docs/CommandPalette.md +293 -0
  12. package/dist/ai/docs/DatePicker.md +171 -0
  13. package/dist/ai/docs/Dropdown.md +223 -0
  14. package/dist/ai/docs/Empty.md +163 -0
  15. package/dist/ai/docs/Expand.md +143 -0
  16. package/dist/ai/docs/FileUpload.md +225 -0
  17. package/dist/ai/docs/Form.md +107 -0
  18. package/dist/ai/docs/FormReset.md +117 -0
  19. package/dist/ai/docs/Heading.md +88 -0
  20. package/dist/ai/docs/Input.md +237 -0
  21. package/dist/ai/docs/InputField.md +170 -0
  22. package/dist/ai/docs/List.md +205 -0
  23. package/dist/ai/docs/Menu.md +166 -0
  24. package/dist/ai/docs/Modal.md +280 -0
  25. package/dist/ai/docs/MultiSelect.md +196 -0
  26. package/dist/ai/docs/Notifications.md +231 -0
  27. package/dist/ai/docs/PageCalendar.md +271 -0
  28. package/dist/ai/docs/Polymorph.md +159 -0
  29. package/dist/ai/docs/Progress.md +145 -0
  30. package/dist/ai/docs/Radiobox.md +128 -0
  31. package/dist/ai/docs/RenderOnView.md +138 -0
  32. package/dist/ai/docs/Resizable.md +159 -0
  33. package/dist/ai/docs/Select.md +284 -0
  34. package/dist/ai/docs/Shortcut.md +105 -0
  35. package/dist/ai/docs/Skeleton.md +166 -0
  36. package/dist/ai/docs/Slider.md +144 -0
  37. package/dist/ai/docs/Slot.md +173 -0
  38. package/dist/ai/docs/Spinner.md +118 -0
  39. package/dist/ai/docs/Stats.md +137 -0
  40. package/dist/ai/docs/Step.md +159 -0
  41. package/dist/ai/docs/Switch.md +167 -0
  42. package/dist/ai/docs/Table.md +298 -0
  43. package/dist/ai/docs/Tabs.md +191 -0
  44. package/dist/ai/docs/Tag.md +224 -0
  45. package/dist/ai/docs/TaskList.md +144 -0
  46. package/dist/ai/docs/Textarea.md +167 -0
  47. package/dist/ai/docs/Timeline.md +210 -0
  48. package/dist/ai/docs/Toolbar.md +132 -0
  49. package/dist/ai/docs/Tooltip.md +231 -0
  50. package/dist/ai/docs/TransferList.md +142 -0
  51. package/dist/ai/docs/Typography.md +187 -0
  52. package/dist/ai/docs/Wizard.md +213 -0
  53. package/dist/ai/docs/index.md +183 -0
  54. package/dist/autocomplete-Boida9R7.js +375 -0
  55. package/dist/autocomplete-Boida9R7.js.map +1 -0
  56. package/dist/calendar-BswV66Nx.js +1719 -0
  57. package/dist/calendar-BswV66Nx.js.map +1 -0
  58. package/dist/chevron-down-BBFYYzZq.js +6 -0
  59. package/dist/chevron-down-BBFYYzZq.js.map +1 -0
  60. package/dist/chevron-right-DvXGOiS_.js +6 -0
  61. package/dist/chevron-right-DvXGOiS_.js.map +1 -0
  62. package/dist/circle-check-big-3M5lhTxx.js +9 -0
  63. package/dist/circle-check-big-3M5lhTxx.js.map +1 -0
  64. package/dist/components/core/button.js +76 -0
  65. package/dist/components/core/button.js.map +1 -0
  66. package/dist/components/core/tag.d.ts +1 -1
  67. package/dist/components/core/tag.d.ts.map +1 -1
  68. package/dist/components/core/tag.js +67 -0
  69. package/dist/components/core/tag.js.map +1 -0
  70. package/dist/components/display/alert.js +94 -0
  71. package/dist/components/display/alert.js.map +1 -0
  72. package/dist/components/display/calendar.js +15 -0
  73. package/dist/components/display/calendar.js.map +1 -0
  74. package/dist/components/display/card.js +84 -0
  75. package/dist/components/display/card.js.map +1 -0
  76. package/dist/components/display/list.d.ts.map +1 -1
  77. package/dist/components/display/list.js +93 -0
  78. package/dist/components/display/list.js.map +1 -0
  79. package/dist/components/display/notifications.js +15 -0
  80. package/dist/components/display/notifications.js.map +1 -0
  81. package/dist/components/display/stats.js +16 -0
  82. package/dist/components/display/stats.js.map +1 -0
  83. package/dist/components/display/tabs.js +12 -0
  84. package/dist/components/display/tabs.js.map +1 -0
  85. package/dist/components/display/timeline.js +29 -0
  86. package/dist/components/display/timeline.js.map +1 -0
  87. package/dist/components/floating/dropdown.d.ts +1 -0
  88. package/dist/components/floating/dropdown.d.ts.map +1 -1
  89. package/dist/components/floating/dropdown.js +58 -0
  90. package/dist/components/floating/dropdown.js.map +1 -0
  91. package/dist/components/floating/expand.js +41 -0
  92. package/dist/components/floating/expand.js.map +1 -0
  93. package/dist/components/floating/menu.d.ts.map +1 -1
  94. package/dist/components/floating/menu.js +177 -0
  95. package/dist/components/floating/menu.js.map +1 -0
  96. package/dist/components/floating/modal.js +297 -0
  97. package/dist/components/floating/modal.js.map +1 -0
  98. package/dist/components/floating/tooltip.js +73 -0
  99. package/dist/components/floating/tooltip.js.map +1 -0
  100. package/dist/components/form/autocomplete.js +16 -0
  101. package/dist/components/form/autocomplete.js.map +1 -0
  102. package/dist/components/form/checkbox.js +44 -0
  103. package/dist/components/form/checkbox.js.map +1 -0
  104. package/dist/components/form/date-picker.js +12 -0
  105. package/dist/components/form/date-picker.js.map +1 -0
  106. package/dist/components/form/file-upload.js +11 -0
  107. package/dist/components/form/file-upload.js.map +1 -0
  108. package/dist/components/form/form.js +8 -0
  109. package/dist/components/form/form.js.map +1 -0
  110. package/dist/components/form/input.js +5 -0
  111. package/dist/components/form/input.js.map +1 -0
  112. package/dist/components/form/radiobox.js +30 -0
  113. package/dist/components/form/radiobox.js.map +1 -0
  114. package/dist/components/form/select.js +106 -0
  115. package/dist/components/form/select.js.map +1 -0
  116. package/dist/components/form/switch.js +65 -0
  117. package/dist/components/form/switch.js.map +1 -0
  118. package/dist/components/form/task-list.js +68 -0
  119. package/dist/components/form/task-list.js.map +1 -0
  120. package/dist/components/form/transfer-list.js +55 -0
  121. package/dist/components/form/transfer-list.js.map +1 -0
  122. package/dist/components/table/table.js +10 -0
  123. package/dist/components/table/table.js.map +1 -0
  124. package/dist/config/default-translations.d.ts +4 -4
  125. package/dist/constants-r-AHn273.js +6 -0
  126. package/dist/constants-r-AHn273.js.map +1 -0
  127. package/dist/context-BFXNJVn2.js +161 -0
  128. package/dist/context-BFXNJVn2.js.map +1 -0
  129. package/dist/createLucideIcon-CP-mMPfa.js +76 -0
  130. package/dist/createLucideIcon-CP-mMPfa.js.map +1 -0
  131. package/dist/date-picker-BxPTdZPy.js +1598 -0
  132. package/dist/date-picker-BxPTdZPy.js.map +1 -0
  133. package/dist/dom-Dl8XH0CK.js +2833 -0
  134. package/dist/dom-Dl8XH0CK.js.map +1 -0
  135. package/dist/file-CBCP85VI.js +15 -0
  136. package/dist/file-CBCP85VI.js.map +1 -0
  137. package/dist/file-upload-BB6BdGcE.js +3118 -0
  138. package/dist/file-upload-BB6BdGcE.js.map +1 -0
  139. package/dist/floating-ui.react-DycKASR0.js +3706 -0
  140. package/dist/floating-ui.react-DycKASR0.js.map +1 -0
  141. package/dist/fns-D2eyJKd5.js +33 -0
  142. package/dist/fns-D2eyJKd5.js.map +1 -0
  143. package/dist/hooks/use-translations.d.ts +4 -4
  144. package/dist/hooks/use-translations.d.ts.map +1 -1
  145. package/dist/index-0YMC-_Lt.js +20 -0
  146. package/dist/index-0YMC-_Lt.js.map +1 -0
  147. package/dist/index-BJ1ayTam.js +126 -0
  148. package/dist/index-BJ1ayTam.js.map +1 -0
  149. package/dist/index-BtlhELJ3.js +3416 -0
  150. package/dist/index-BtlhELJ3.js.map +1 -0
  151. package/dist/index-ChfR6F8d.js +1590 -0
  152. package/dist/index-ChfR6F8d.js.map +1 -0
  153. package/dist/index-DE4shK8D.js +215 -0
  154. package/dist/index-DE4shK8D.js.map +1 -0
  155. package/dist/index-DJSMaZR4.js +35 -0
  156. package/dist/index-DJSMaZR4.js.map +1 -0
  157. package/dist/index-t1qLJTt5.js +351 -0
  158. package/dist/index-t1qLJTt5.js.map +1 -0
  159. package/dist/index.css +1 -1
  160. package/dist/index.esm-BaIwleSE.js +343 -0
  161. package/dist/index.esm-BaIwleSE.js.map +1 -0
  162. package/dist/index.js +8050 -20
  163. package/dist/index.js.map +1 -1
  164. package/dist/info-N5jWZg2A.js +10 -0
  165. package/dist/info-N5jWZg2A.js.map +1 -0
  166. package/dist/input-CoJoHIhd.js +441 -0
  167. package/dist/input-CoJoHIhd.js.map +1 -0
  168. package/dist/input-field-DTeIrwpK.js +146 -0
  169. package/dist/input-field-DTeIrwpK.js.map +1 -0
  170. package/dist/notifications-NPuFDsBp.js +2550 -0
  171. package/dist/notifications-NPuFDsBp.js.map +1 -0
  172. package/dist/polymorph-B5n9fs_K.js +10 -0
  173. package/dist/polymorph-B5n9fs_K.js.map +1 -0
  174. package/dist/proxy-BZcQiBrp.js +2495 -0
  175. package/dist/proxy-BZcQiBrp.js.map +1 -0
  176. package/dist/skeleton-D75GFBV6.js +10 -0
  177. package/dist/skeleton-D75GFBV6.js.map +1 -0
  178. package/dist/slot-CQW8ZzBb.js +79 -0
  179. package/dist/slot-CQW8ZzBb.js.map +1 -0
  180. package/dist/styles/common.js +3 -3
  181. package/dist/styles/dark.js +4 -4
  182. package/dist/styles/design-tokens.js +89 -60
  183. package/dist/styles/light.js +4 -4
  184. package/dist/styles/theme.js +2 -2
  185. package/dist/tabs-ccIA7vMo.js +106 -0
  186. package/dist/tabs-ccIA7vMo.js.map +1 -0
  187. package/dist/triangle-alert-CHMhQ6yd.js +16 -0
  188. package/dist/triangle-alert-CHMhQ6yd.js.map +1 -0
  189. package/dist/use-motion-value-eGwNuWuw.js +14 -0
  190. package/dist/use-motion-value-eGwNuWuw.js.map +1 -0
  191. package/dist/use-stable-ref-CYh-YkID.js +11 -0
  192. package/dist/use-stable-ref-CYh-YkID.js.map +1 -0
  193. package/dist/use-translations-BwLKTrZv.js +10 -0
  194. package/dist/use-translations-BwLKTrZv.js.map +1 -0
  195. package/dist/x-B9bYxG31.js +9 -0
  196. package/dist/x-B9bYxG31.js.map +1 -0
  197. package/package.json +6 -7
  198. package/dist/components/core/button.jsx +0 -79
  199. package/dist/components/core/heading.jsx +0 -4
  200. package/dist/components/core/polymorph.jsx +0 -5
  201. package/dist/components/core/render-on-view.jsx +0 -31
  202. package/dist/components/core/resizable.jsx +0 -51
  203. package/dist/components/core/slot.jsx +0 -156
  204. package/dist/components/core/tag.jsx +0 -51
  205. package/dist/components/core/typography.jsx +0 -22
  206. package/dist/components/display/alert.jsx +0 -58
  207. package/dist/components/display/calendar.jsx +0 -299
  208. package/dist/components/display/card.jsx +0 -43
  209. package/dist/components/display/empty.jsx +0 -11
  210. package/dist/components/display/list.jsx +0 -81
  211. package/dist/components/display/notifications.jsx +0 -126
  212. package/dist/components/display/progress.jsx +0 -11
  213. package/dist/components/display/shortcut.jsx +0 -23
  214. package/dist/components/display/skeleton.jsx +0 -12
  215. package/dist/components/display/spinner.jsx +0 -7
  216. package/dist/components/display/stats.jsx +0 -20
  217. package/dist/components/display/step.jsx +0 -131
  218. package/dist/components/display/tabs.jsx +0 -98
  219. package/dist/components/display/timeline.jsx +0 -25
  220. package/dist/components/floating/command-palette.jsx +0 -194
  221. package/dist/components/floating/dropdown.jsx +0 -53
  222. package/dist/components/floating/expand.jsx +0 -44
  223. package/dist/components/floating/menu.jsx +0 -147
  224. package/dist/components/floating/modal.jsx +0 -299
  225. package/dist/components/floating/toolbar.jsx +0 -5
  226. package/dist/components/floating/tooltip.jsx +0 -58
  227. package/dist/components/floating/wizard.jsx +0 -161
  228. package/dist/components/form/autocomplete.jsx +0 -279
  229. package/dist/components/form/checkbox.jsx +0 -12
  230. package/dist/components/form/date-picker.jsx +0 -115
  231. package/dist/components/form/file-upload.jsx +0 -133
  232. package/dist/components/form/form.jsx +0 -10
  233. package/dist/components/form/formReset.jsx +0 -17
  234. package/dist/components/form/free-text.jsx +0 -41
  235. package/dist/components/form/input-field.jsx +0 -56
  236. package/dist/components/form/input.jsx +0 -36
  237. package/dist/components/form/multi-select.jsx +0 -328
  238. package/dist/components/form/radiobox.jsx +0 -6
  239. package/dist/components/form/select.jsx +0 -42
  240. package/dist/components/form/slider.jsx +0 -45
  241. package/dist/components/form/switch.jsx +0 -46
  242. package/dist/components/form/task-list.jsx +0 -26
  243. package/dist/components/form/textarea.jsx +0 -12
  244. package/dist/components/form/transfer-list.jsx +0 -39
  245. package/dist/components/index.js +0 -45
  246. package/dist/components/page-calendar/calendar-header.jsx +0 -81
  247. package/dist/components/page-calendar/day-view.jsx +0 -87
  248. package/dist/components/page-calendar/event-pill.jsx +0 -25
  249. package/dist/components/page-calendar/index.js +0 -2
  250. package/dist/components/page-calendar/month-view.jsx +0 -47
  251. package/dist/components/page-calendar/page-calendar.jsx +0 -41
  252. package/dist/components/page-calendar/page-calendar.types.js +0 -1
  253. package/dist/components/page-calendar/page-calendar.utils.js +0 -71
  254. package/dist/components/page-calendar/week-view.jsx +0 -64
  255. package/dist/components/table/filter.jsx +0 -141
  256. package/dist/components/table/group.jsx +0 -68
  257. package/dist/components/table/index.jsx +0 -60
  258. package/dist/components/table/inner-table.jsx +0 -104
  259. package/dist/components/table/metadata.jsx +0 -36
  260. package/dist/components/table/pagination.jsx +0 -73
  261. package/dist/components/table/row.jsx +0 -58
  262. package/dist/components/table/sort.jsx +0 -105
  263. package/dist/components/table/table-lib.js +0 -83
  264. package/dist/components/table/table.context.jsx +0 -4
  265. package/dist/components/table/thead.jsx +0 -103
  266. package/dist/config/context.js +0 -12
  267. package/dist/config/default-translations.jsx +0 -83
  268. package/dist/config/default-tweaks.js +0 -4
  269. package/dist/constants.js +0 -2
  270. package/dist/hooks/use-click-outside.js +0 -17
  271. package/dist/hooks/use-color-parser.js +0 -9
  272. package/dist/hooks/use-components-provider.jsx +0 -19
  273. package/dist/hooks/use-debounce.js +0 -12
  274. package/dist/hooks/use-floating-ref.js +0 -6
  275. package/dist/hooks/use-form.js +0 -550
  276. package/dist/hooks/use-hover.js +0 -18
  277. package/dist/hooks/use-input-id.js +0 -5
  278. package/dist/hooks/use-is-coarse-device.js +0 -12
  279. package/dist/hooks/use-locale.js +0 -10
  280. package/dist/hooks/use-media-query.js +0 -25
  281. package/dist/hooks/use-on-event.js +0 -7
  282. package/dist/hooks/use-parent.js +0 -21
  283. package/dist/hooks/use-preferences.js +0 -23
  284. package/dist/hooks/use-previous.js +0 -9
  285. package/dist/hooks/use-reactive.js +0 -9
  286. package/dist/hooks/use-remove-scroll.js +0 -61
  287. package/dist/hooks/use-resize-observer.js +0 -17
  288. package/dist/hooks/use-stable-ref.js +0 -9
  289. package/dist/hooks/use-swipe.js +0 -17
  290. package/dist/hooks/use-translations.js +0 -9
  291. package/dist/hooks/use-tweaks.js +0 -9
  292. package/dist/hooks/use-window-size.js +0 -14
  293. package/dist/index.mjs +0 -37103
  294. package/dist/index.mjs.map +0 -1
  295. package/dist/index.umd.js +0 -28
  296. package/dist/index.umd.js.map +0 -1
  297. package/dist/lib/combi-keys.js +0 -60
  298. package/dist/lib/dict.js +0 -39
  299. package/dist/lib/dom.js +0 -62
  300. package/dist/lib/fns.js +0 -46
  301. package/dist/lib/fzf.js +0 -117
  302. package/dist/lib/keyboard-area.js +0 -14
  303. package/dist/types.js +0 -1
@@ -1,60 +0,0 @@
1
- export const osxRegex = /Mac|iPod|iPhone|iPad/;
2
- export const isMac = () => osxRegex.test(navigator.userAgent);
3
- const parseCombination = (combination) => combination.split("+").map((k) => {
4
- const key = k.trim();
5
- if (key === "Mod")
6
- return isMac() ? "Meta" : "Control";
7
- if (key === "Hyper")
8
- return isMac() ? "Meta+Shift+Alt" : "Control+Shift+Alt";
9
- return key;
10
- });
11
- const combine = (keys) => keys.map((x) => x.trim()).join("+");
12
- export class CombiKeys {
13
- combinations = [];
14
- constructor(combi = []) {
15
- this.combinations = this.combinations.concat(combi);
16
- this.combinations.forEach((x) => {
17
- this.add(x.key, x.fn);
18
- });
19
- }
20
- add(combi, fn) {
21
- const key = combine(parseCombination(combi));
22
- if (this.combinations.find((x) => x.key === key))
23
- return;
24
- this.combinations.push({ fn, key });
25
- return this;
26
- }
27
- register() {
28
- const controller = new AbortController();
29
- const handler = (event) => {
30
- const element = event.target;
31
- if (element.tagName === "INPUT" || element.tagName === "TEXTAREA") {
32
- const bypass = element.getAttribute("data-combikeysbypass");
33
- if (bypass !== "true")
34
- return;
35
- }
36
- const activeKeys = new Set();
37
- if (event.metaKey)
38
- activeKeys.add("Meta");
39
- if (event.ctrlKey)
40
- activeKeys.add("Control");
41
- if (event.altKey)
42
- activeKeys.add("Alt");
43
- if (event.key.charCodeAt(0) > 127) {
44
- const char = event.code.replace(/^Digit/, "").replace(/^Key/, "");
45
- activeKeys.add(event.shiftKey ? char.toUpperCase() : char.toLowerCase());
46
- }
47
- else
48
- activeKeys.add(event.shiftKey ? event.key.toUpperCase() : event.key);
49
- const action = combine(Array.from(activeKeys));
50
- this.combinations.forEach((bind) => {
51
- if (bind.key === action) {
52
- event.preventDefault();
53
- return void bind.fn(event);
54
- }
55
- });
56
- };
57
- window.addEventListener("keydown", handler, { signal: controller.signal });
58
- return () => controller.abort();
59
- }
60
- }
package/dist/lib/dict.js DELETED
@@ -1,39 +0,0 @@
1
- export class Dict extends Map {
2
- list = [];
3
- constructor(init) {
4
- super(init);
5
- this.list = [];
6
- if (Array.isArray(init))
7
- this.list = init;
8
- if (init instanceof Dict)
9
- this.list = Array.from(init.entries());
10
- }
11
- set(key, value) {
12
- super.set(key, value);
13
- this.list = (this.list ?? []).concat([[key, value]]);
14
- return this;
15
- }
16
- remove(key) {
17
- super.delete(key);
18
- this.list = Array.from(this.entries()) ?? [];
19
- return this;
20
- }
21
- map(callback) {
22
- return this.list.map((x, i) => callback(x[1], i));
23
- }
24
- clone(fn) {
25
- const clone = new Dict(this);
26
- if (fn)
27
- return fn(clone);
28
- return clone;
29
- }
30
- static from(items, selector) {
31
- return new Dict(items.map((x) => [selector(x), x]));
32
- }
33
- static unique(items, selector) {
34
- return Array.from(Dict.from(items, selector).values());
35
- }
36
- toArray() {
37
- return Array.from(this.values());
38
- }
39
- }
package/dist/lib/dom.js DELETED
@@ -1,62 +0,0 @@
1
- import { clsx } from "clsx";
2
- import { Is } from "sidekicker";
3
- import { twMerge } from "tailwind-merge";
4
- export const mergeRefs = (...refs) => (value) => {
5
- refs.forEach((ref) => {
6
- if (typeof ref === "function") {
7
- ref(value);
8
- }
9
- else if (ref !== null) {
10
- ref.current = value;
11
- }
12
- });
13
- };
14
- export const isReactComponent = (a) => {
15
- if (a.$$typeof === Symbol.for("react.forward_ref")) {
16
- return true;
17
- }
18
- if (a.$$typeof === Symbol.for("react.fragment")) {
19
- return true;
20
- }
21
- return a.$$typeof === Symbol.for("react.element");
22
- };
23
- export const isReactFC = (a) => Is.function(a);
24
- export const css = (...styles) => twMerge(clsx(styles));
25
- export const dispatchInput = (input) => {
26
- const event = new Event("input", { bubbles: true, composed: true });
27
- input?.dispatchEvent(event);
28
- return Object.assign({}, event, { target: input, currentTarget: input });
29
- };
30
- export const initializeInputDataset = (input) => {
31
- const focus = () => input.setAttribute("data-initialized", "true");
32
- input.addEventListener("focus", focus);
33
- return () => input.removeEventListener("focus", focus);
34
- };
35
- export const hasVerticalScroll = (htmlElement) => htmlElement.scrollHeight > htmlElement.clientHeight;
36
- export const getRemainingSize = (element, windowSize) => {
37
- if (element && element.getBoundingClientRect) {
38
- const rect = element.getBoundingClientRect();
39
- return Math.abs(windowSize - rect.bottom);
40
- }
41
- return 320;
42
- };
43
- export const getCoords = (elem, docEl) => {
44
- const box = elem.getBoundingClientRect();
45
- const parent = docEl.getBoundingClientRect();
46
- return { top: Math.round(box.top - parent.top), left: Math.round(box.left - parent.left) };
47
- };
48
- export const isChildVisible = (container, child, partial = true) => {
49
- const containerRect = container.getBoundingClientRect();
50
- const childRect = child.getBoundingClientRect();
51
- const isWithinTop = childRect.top >= containerRect.top;
52
- const isWithinBottom = childRect.bottom <= containerRect.bottom;
53
- const isWithinLeft = childRect.left >= containerRect.left;
54
- const isWithinRight = childRect.right <= containerRect.right;
55
- if (partial) {
56
- return (childRect.top < containerRect.bottom &&
57
- childRect.bottom > containerRect.top &&
58
- childRect.left < containerRect.right &&
59
- childRect.right > containerRect.left);
60
- }
61
- return isWithinTop && isWithinBottom && isWithinLeft && isWithinRight;
62
- };
package/dist/lib/fns.js DELETED
@@ -1,46 +0,0 @@
1
- export const uuid = () => {
2
- const timestamp = Date.now();
3
- const bytes = new Uint8Array(16);
4
- bytes[0] = (timestamp / Math.pow(2, 40)) & 0xff;
5
- bytes[1] = (timestamp / Math.pow(2, 32)) & 0xff;
6
- bytes[2] = (timestamp / Math.pow(2, 24)) & 0xff;
7
- bytes[3] = (timestamp / Math.pow(2, 16)) & 0xff;
8
- bytes[4] = (timestamp / Math.pow(2, 8)) & 0xff;
9
- bytes[5] = timestamp & 0xff;
10
- const randomBytes = new Uint8Array(10);
11
- crypto.getRandomValues(randomBytes);
12
- bytes.set(randomBytes, 6);
13
- bytes[6] = (bytes[6] & 0x0f) | 0x70;
14
- bytes[8] = (bytes[8] & 0x3f) | 0x80;
15
- const hex = Array.from(bytes)
16
- .map((b) => b.toString(16).padStart(2, "0"))
17
- .join("");
18
- return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
19
- };
20
- const travel = (path, regexp, obj) => path
21
- .split(regexp)
22
- .filter(Boolean)
23
- .reduce((res, key) => (res !== null && res !== undefined ? res[key] : res), obj);
24
- const regexPaths = { basic: /[,[\]]+?/, extend: /[,[\].]+?/ };
25
- export const path = (obj, path) => {
26
- const result = travel(path, regexPaths.basic, obj) || travel(path, regexPaths.extend, obj);
27
- return result === undefined || result === obj ? undefined : result;
28
- };
29
- export const isSsr = () => typeof window === "undefined";
30
- export const safeRegex = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
31
- export const splitInto = (array, size) => {
32
- const newArray = [];
33
- for (let i = 0; i < size; i++) {
34
- const init = i * size;
35
- const result = array.slice(init, init + size);
36
- if (result.length > 0)
37
- newArray.push(result);
38
- }
39
- return newArray;
40
- };
41
- export const negate = (b) => !b;
42
- export const noop = () => { };
43
- export const isMobile = () => {
44
- const userAgent = navigator.userAgent || navigator.vendor || window.opera;
45
- return /android|iphone|ipad|ipod|opera mini|iemobile|wpdesktop/i.test(userAgent);
46
- };
package/dist/lib/fzf.js DELETED
@@ -1,117 +0,0 @@
1
- import { Is } from "sidekicker";
2
- export const fuzzyMatch = (text, search) => {
3
- text = String(text).toLocaleLowerCase();
4
- search = String(search).toLocaleLowerCase();
5
- const firstChar = search[0];
6
- const firstCharIndexes = text
7
- .split("")
8
- .map((char, index) => (char === firstChar ? index : false))
9
- .filter((index) => index !== false);
10
- if (firstCharIndexes.length === 0) {
11
- return null;
12
- }
13
- const matchedIndexes = [];
14
- firstCharIndexes.forEach((startingIndex) => {
15
- let index = startingIndex + 1;
16
- const indexes = [startingIndex];
17
- for (let i = 1; i < search.length; i++) {
18
- const letter = search[i];
19
- index = text.indexOf(letter, index);
20
- if (index === -1) {
21
- return;
22
- }
23
- indexes.push(index);
24
- index++;
25
- }
26
- matchedIndexes.push(indexes);
27
- });
28
- if (matchedIndexes.length === 0) {
29
- return null;
30
- }
31
- const bestMatch = matchedIndexes.sort((a, b) => {
32
- if (a.length === 1) {
33
- return a[0] - b[0];
34
- }
35
- const aSpread = a[a.length - 1] - a[0];
36
- const bSpread = b[b.length - 1] - b[0];
37
- return aSpread - bSpread;
38
- })[0];
39
- if (text === search) {
40
- return 1;
41
- }
42
- else if (bestMatch.length > 1) {
43
- return 2 + (bestMatch[bestMatch.length - 1] - bestMatch[0]);
44
- }
45
- return 2 + bestMatch[0];
46
- };
47
- const travel = (path, regexp, obj) => {
48
- const keys = path.split(regexp).filter(Boolean);
49
- let res = obj;
50
- for (const key of keys) {
51
- if (res === null || res === undefined) {
52
- return res;
53
- }
54
- res = res[key];
55
- }
56
- return res;
57
- };
58
- const regexPaths = { basic: /[,[\]]+?/, extend: /[,[\].]+?/ };
59
- const path = (obj, path) => {
60
- const result = travel(path, regexPaths.basic, obj);
61
- if (result !== undefined && result !== obj)
62
- return result;
63
- return travel(path, regexPaths.extend, obj);
64
- };
65
- const onlyNumbers = (str) => str.replace(/[^0-9]/g, "");
66
- const diacritics = (input) => input.normalize("NFD").replace(/[\u0300-\u036f]/g, "");
67
- const strCompare = (text, value, _, match = "FUZZY") => {
68
- if (match === "CONTAINS") {
69
- return text.includes(value);
70
- }
71
- if (match === "EQUAL") {
72
- return text === value;
73
- }
74
- if (match === "CONTAINS_NUMBERS") {
75
- return onlyNumbers(text).includes(onlyNumbers(value));
76
- }
77
- if (match === "STARTS_WITH") {
78
- return text.startsWith(value);
79
- }
80
- if (match === "ENDS_WITH") {
81
- return text.endsWith(value);
82
- }
83
- if (match === "FUZZY") {
84
- const r = fuzzyMatch(text, value);
85
- return r !== null;
86
- }
87
- return false;
88
- };
89
- const compare = (search, value, defaultScore, match = "FUZZY") => Array.isArray(value) ? value.some((x) => strCompare(search, x, defaultScore, match)) : strCompare(search, value, defaultScore, match);
90
- export const fzf = (items, id, keys) => {
91
- if (keys.length === 0) {
92
- return items;
93
- }
94
- const map = new Map();
95
- const remap = keys.map((x) => {
96
- return { ...x, value: Is.array(x.value) ? x.value.map(diacritics) : diacritics(`${x.value}`) };
97
- });
98
- items.forEach((item) => {
99
- const idVal = path(item, id);
100
- remap.forEach((filter) => {
101
- const searchValue = path(item, filter.key);
102
- if (!searchValue)
103
- return;
104
- const target = diacritics(`${filter.value}`.toLocaleLowerCase()).trim();
105
- const search = diacritics(`${searchValue}`.toLocaleLowerCase()).trim();
106
- if (compare(search, target, filter.score, filter.match)) {
107
- return void map.set(idVal, item);
108
- }
109
- if (Is.function(filter.ifNotMatch)) {
110
- const result = filter.ifNotMatch(target, search);
111
- if (result)
112
- map.set(idVal, item);
113
- }
114
- });
115
- });
116
- return Array.from(map.values());
117
- };
@@ -1,14 +0,0 @@
1
- export const keyboardKeys = {
2
- ArrowUp: "ArrowUp",
3
- ArrowDown: "ArrowDown",
4
- ArrowLeft: "ArrowLeft",
5
- ArrowRight: "ArrowRight",
6
- };
7
- export class KeyboardArea {
8
- set = new Set();
9
- key(key, callback) {
10
- const fn = (e) => (e.key === key ? callback(e) : undefined);
11
- return () => this.set.delete(fn);
12
- }
13
- onKeyDown(_) { }
14
- }
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};