aidos-ui 4.0.4 → 4.0.5

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 (376) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +23 -3
  3. package/dist/index.d.ts +797 -68
  4. package/dist/index.js +3868 -68
  5. package/dist/index.js.map +1 -1
  6. package/dist/jsx-dev-runtime.d.ts +6 -2
  7. package/dist/jsx-dev-runtime.js +87 -42
  8. package/dist/jsx-dev-runtime.js.map +1 -1
  9. package/dist/jsx-runtime.d.ts +1 -1
  10. package/dist/jsx-runtime.js +2 -2
  11. package/dist/jsx-runtime.js.map +1 -1
  12. package/dist/vite-plugin-jss-debug.d.ts +3 -1
  13. package/dist/vite-plugin-jss-debug.js +57 -74
  14. package/dist/vite-plugin-jss-debug.js.map +1 -1
  15. package/package.json +58 -27
  16. package/.prettierrc +0 -4
  17. package/CLAUDE.md +0 -72
  18. package/dist/Badge.d.ts +0 -6
  19. package/dist/Badge.js +0 -22
  20. package/dist/Badge.js.map +0 -1
  21. package/dist/BaseButton.d.ts +0 -14
  22. package/dist/BaseButton.js +0 -23
  23. package/dist/BaseButton.js.map +0 -1
  24. package/dist/BaseInput.d.ts +0 -14
  25. package/dist/BaseInput.js +0 -15
  26. package/dist/BaseInput.js.map +0 -1
  27. package/dist/BaseLink.d.ts +0 -18
  28. package/dist/BaseLink.js +0 -29
  29. package/dist/BaseLink.js.map +0 -1
  30. package/dist/BaseList.d.ts +0 -6
  31. package/dist/BaseList.js +0 -14
  32. package/dist/BaseList.js.map +0 -1
  33. package/dist/BaseListAddOn.d.ts +0 -5
  34. package/dist/BaseListAddOn.js +0 -7
  35. package/dist/BaseListAddOn.js.map +0 -1
  36. package/dist/BaseListItem.d.ts +0 -26
  37. package/dist/BaseListItem.js +0 -29
  38. package/dist/BaseListItem.js.map +0 -1
  39. package/dist/BaseView.d.ts +0 -12
  40. package/dist/BaseView.js +0 -26
  41. package/dist/BaseView.js.map +0 -1
  42. package/dist/Box.d.ts +0 -4
  43. package/dist/Box.js +0 -6
  44. package/dist/Box.js.map +0 -1
  45. package/dist/Button.d.ts +0 -20
  46. package/dist/Button.js +0 -19
  47. package/dist/Button.js.map +0 -1
  48. package/dist/Calendar.d.ts +0 -18
  49. package/dist/Calendar.js +0 -57
  50. package/dist/Calendar.js.map +0 -1
  51. package/dist/Card.d.ts +0 -4
  52. package/dist/Card.js +0 -14
  53. package/dist/Card.js.map +0 -1
  54. package/dist/Checkbox.d.ts +0 -11
  55. package/dist/Checkbox.js +0 -32
  56. package/dist/Checkbox.js.map +0 -1
  57. package/dist/Circle.d.ts +0 -5
  58. package/dist/Circle.js +0 -12
  59. package/dist/Circle.js.map +0 -1
  60. package/dist/Column.d.ts +0 -6
  61. package/dist/Column.js +0 -7
  62. package/dist/Column.js.map +0 -1
  63. package/dist/DarkMode.d.ts +0 -13
  64. package/dist/DarkMode.js +0 -62
  65. package/dist/DarkMode.js.map +0 -1
  66. package/dist/DateInput.d.ts +0 -13
  67. package/dist/DateInput.js +0 -29
  68. package/dist/DateInput.js.map +0 -1
  69. package/dist/DatePicker.d.ts +0 -11
  70. package/dist/DatePicker.js +0 -34
  71. package/dist/DatePicker.js.map +0 -1
  72. package/dist/DatetimeInput.d.ts +0 -13
  73. package/dist/DatetimeInput.js +0 -31
  74. package/dist/DatetimeInput.js.map +0 -1
  75. package/dist/DesignBook.d.ts +0 -1
  76. package/dist/DesignBook.js +0 -55
  77. package/dist/DesignBook.js.map +0 -1
  78. package/dist/Dialog.d.ts +0 -17
  79. package/dist/Dialog.js +0 -92
  80. package/dist/Dialog.js.map +0 -1
  81. package/dist/Dropdown.d.ts +0 -14
  82. package/dist/Dropdown.js +0 -65
  83. package/dist/Dropdown.js.map +0 -1
  84. package/dist/Emitter.d.ts +0 -6
  85. package/dist/Emitter.js +0 -19
  86. package/dist/Emitter.js.map +0 -1
  87. package/dist/FlexLayout.d.ts +0 -11
  88. package/dist/FlexLayout.js +0 -18
  89. package/dist/FlexLayout.js.map +0 -1
  90. package/dist/Icon.d.ts +0 -12
  91. package/dist/Icon.js +0 -60
  92. package/dist/Icon.js.map +0 -1
  93. package/dist/IconButton.d.ts +0 -11
  94. package/dist/IconButton.js +0 -34
  95. package/dist/IconButton.js.map +0 -1
  96. package/dist/IconLink.d.ts +0 -9
  97. package/dist/IconLink.js +0 -32
  98. package/dist/IconLink.js.map +0 -1
  99. package/dist/IconType.d.ts +0 -1
  100. package/dist/IconType.js +0 -2
  101. package/dist/IconType.js.map +0 -1
  102. package/dist/Interactable.d.ts +0 -50
  103. package/dist/Interactable.js +0 -169
  104. package/dist/Interactable.js.map +0 -1
  105. package/dist/JSSComment.d.ts +0 -10
  106. package/dist/JSSComment.js +0 -52
  107. package/dist/JSSComment.js.map +0 -1
  108. package/dist/Link.d.ts +0 -22
  109. package/dist/Link.js +0 -29
  110. package/dist/Link.js.map +0 -1
  111. package/dist/List.d.ts +0 -15
  112. package/dist/List.js +0 -29
  113. package/dist/List.js.map +0 -1
  114. package/dist/ListButtonItem.d.ts +0 -14
  115. package/dist/ListButtonItem.js +0 -11
  116. package/dist/ListButtonItem.js.map +0 -1
  117. package/dist/ListDivider.d.ts +0 -1
  118. package/dist/ListDivider.js +0 -12
  119. package/dist/ListDivider.js.map +0 -1
  120. package/dist/ListHeaderItem.d.ts +0 -10
  121. package/dist/ListHeaderItem.js +0 -15
  122. package/dist/ListHeaderItem.js.map +0 -1
  123. package/dist/ListItem.d.ts +0 -9
  124. package/dist/ListItem.js +0 -9
  125. package/dist/ListItem.js.map +0 -1
  126. package/dist/ListLinkItem.d.ts +0 -16
  127. package/dist/ListLinkItem.js +0 -11
  128. package/dist/ListLinkItem.js.map +0 -1
  129. package/dist/ListSpacer.d.ts +0 -1
  130. package/dist/ListSpacer.js +0 -13
  131. package/dist/ListSpacer.js.map +0 -1
  132. package/dist/MenuIcon.d.ts +0 -5
  133. package/dist/MenuIcon.js +0 -31
  134. package/dist/MenuIcon.js.map +0 -1
  135. package/dist/NextJSRouter.d.ts +0 -1
  136. package/dist/NextJSRouter.js +0 -37
  137. package/dist/NextJSRouter.js.map +0 -1
  138. package/dist/NextJSRouterState.d.ts +0 -38
  139. package/dist/NextJSRouterState.js +0 -111
  140. package/dist/NextJSRouterState.js.map +0 -1
  141. package/dist/OnVisible.d.ts +0 -5
  142. package/dist/OnVisible.js +0 -28
  143. package/dist/OnVisible.js.map +0 -1
  144. package/dist/Popover.d.ts +0 -22
  145. package/dist/Popover.js +0 -90
  146. package/dist/Popover.js.map +0 -1
  147. package/dist/ProgressBar.d.ts +0 -7
  148. package/dist/ProgressBar.js +0 -42
  149. package/dist/ProgressBar.js.map +0 -1
  150. package/dist/ProgressCircle.d.ts +0 -5
  151. package/dist/ProgressCircle.js +0 -12
  152. package/dist/ProgressCircle.js.map +0 -1
  153. package/dist/Providers.d.ts +0 -9
  154. package/dist/Providers.js +0 -16
  155. package/dist/Providers.js.map +0 -1
  156. package/dist/RangeInput.d.ts +0 -14
  157. package/dist/RangeInput.js +0 -32
  158. package/dist/RangeInput.js.map +0 -1
  159. package/dist/ResultOrError.d.ts +0 -13
  160. package/dist/ResultOrError.js +0 -7
  161. package/dist/ResultOrError.js.map +0 -1
  162. package/dist/RootView.d.ts +0 -5
  163. package/dist/RootView.js +0 -35
  164. package/dist/RootView.js.map +0 -1
  165. package/dist/Row.d.ts +0 -6
  166. package/dist/Row.js +0 -7
  167. package/dist/Row.js.map +0 -1
  168. package/dist/Select.d.ts +0 -9
  169. package/dist/Select.js +0 -17
  170. package/dist/Select.js.map +0 -1
  171. package/dist/StackContext.d.ts +0 -8
  172. package/dist/StackContext.js +0 -25
  173. package/dist/StackContext.js.map +0 -1
  174. package/dist/StaticCheckbox.d.ts +0 -16
  175. package/dist/StaticCheckbox.js +0 -48
  176. package/dist/StaticCheckbox.js.map +0 -1
  177. package/dist/Storage.d.ts +0 -13
  178. package/dist/Storage.js +0 -146
  179. package/dist/Storage.js.map +0 -1
  180. package/dist/Stream.d.ts +0 -9
  181. package/dist/Stream.js +0 -36
  182. package/dist/Stream.js.map +0 -1
  183. package/dist/Sublist.d.ts +0 -12
  184. package/dist/Sublist.js +0 -18
  185. package/dist/Sublist.js.map +0 -1
  186. package/dist/SubmitIconInput.d.ts +0 -8
  187. package/dist/SubmitIconInput.js +0 -25
  188. package/dist/SubmitIconInput.js.map +0 -1
  189. package/dist/Tabs.d.ts +0 -23
  190. package/dist/Tabs.js +0 -39
  191. package/dist/Tabs.js.map +0 -1
  192. package/dist/Text.d.ts +0 -25
  193. package/dist/Text.js +0 -52
  194. package/dist/Text.js.map +0 -1
  195. package/dist/TextArea.d.ts +0 -11
  196. package/dist/TextArea.js +0 -27
  197. package/dist/TextArea.js.map +0 -1
  198. package/dist/TextInput.d.ts +0 -15
  199. package/dist/TextInput.js +0 -61
  200. package/dist/TextInput.js.map +0 -1
  201. package/dist/TextInputWithState.d.ts +0 -8
  202. package/dist/TextInputWithState.js +0 -14
  203. package/dist/TextInputWithState.js.map +0 -1
  204. package/dist/TextPairing.d.ts +0 -21
  205. package/dist/TextPairing.js +0 -26
  206. package/dist/TextPairing.js.map +0 -1
  207. package/dist/TimeInput.d.ts +0 -15
  208. package/dist/TimeInput.js +0 -58
  209. package/dist/TimeInput.js.map +0 -1
  210. package/dist/Tooltip.d.ts +0 -11
  211. package/dist/Tooltip.js +0 -73
  212. package/dist/Tooltip.js.map +0 -1
  213. package/dist/aria.d.ts +0 -8
  214. package/dist/aria.js +0 -42
  215. package/dist/aria.js.map +0 -1
  216. package/dist/guid.d.ts +0 -1
  217. package/dist/guid.js +0 -7
  218. package/dist/guid.js.map +0 -1
  219. package/dist/hash.d.ts +0 -1
  220. package/dist/hash.js +0 -20
  221. package/dist/hash.js.map +0 -1
  222. package/dist/isServer.d.ts +0 -1
  223. package/dist/isServer.js +0 -4
  224. package/dist/isServer.js.map +0 -1
  225. package/dist/jss.d.ts +0 -122
  226. package/dist/jss.js +0 -515
  227. package/dist/jss.js.map +0 -1
  228. package/dist/numberToBase.d.ts +0 -1
  229. package/dist/numberToBase.js +0 -44
  230. package/dist/numberToBase.js.map +0 -1
  231. package/dist/stateMachineContextFactory.d.ts +0 -36
  232. package/dist/stateMachineContextFactory.js +0 -48
  233. package/dist/stateMachineContextFactory.js.map +0 -1
  234. package/dist/useCookie.d.ts +0 -9
  235. package/dist/useCookie.js +0 -67
  236. package/dist/useCookie.js.map +0 -1
  237. package/dist/useKeyboard.d.ts +0 -8
  238. package/dist/useKeyboard.js +0 -26
  239. package/dist/useKeyboard.js.map +0 -1
  240. package/dist/useNavigation.d.ts +0 -5
  241. package/dist/useNavigation.js +0 -79
  242. package/dist/useNavigation.js.map +0 -1
  243. package/dist/usePromise.d.ts +0 -1
  244. package/dist/usePromise.js +0 -12
  245. package/dist/usePromise.js.map +0 -1
  246. package/dist/useRefEffect.d.ts +0 -1
  247. package/dist/useRefEffect.js +0 -15
  248. package/dist/useRefEffect.js.map +0 -1
  249. package/jss-debug-loader.mjs +0 -44
  250. package/next-env.d.ts +0 -6
  251. package/next.config.js +0 -33
  252. package/scripts/embeddings.js +0 -93
  253. package/scripts/openai_embeddings.js +0 -100
  254. package/scripts/publish.js +0 -28
  255. package/scripts/test_embeddings.js +0 -47
  256. package/src/Badge.tsx +0 -36
  257. package/src/BaseButton.tsx +0 -62
  258. package/src/BaseInput.tsx +0 -63
  259. package/src/BaseLink.tsx +0 -80
  260. package/src/BaseList.tsx +0 -26
  261. package/src/BaseListAddOn.tsx +0 -10
  262. package/src/BaseListItem.tsx +0 -119
  263. package/src/BaseView.tsx +0 -57
  264. package/src/Box.tsx +0 -20
  265. package/src/Button.tsx +0 -90
  266. package/src/Calendar.tsx +0 -123
  267. package/src/Card.tsx +0 -30
  268. package/src/Checkbox.tsx +0 -63
  269. package/src/Circle.tsx +0 -24
  270. package/src/Column.tsx +0 -12
  271. package/src/DarkMode.tsx +0 -100
  272. package/src/DateInput.tsx +0 -63
  273. package/src/DatePicker.tsx +0 -67
  274. package/src/DatetimeInput.tsx +0 -64
  275. package/src/DesignBook.tsx +0 -677
  276. package/src/Dialog.tsx +0 -150
  277. package/src/Dropdown.tsx +0 -146
  278. package/src/Emitter.ts +0 -26
  279. package/src/FlexLayout.tsx +0 -53
  280. package/src/Icon.tsx +0 -80
  281. package/src/IconButton.tsx +0 -81
  282. package/src/IconLink.tsx +0 -59
  283. package/src/IconType.ts +0 -787
  284. package/src/Interactable.tsx +0 -210
  285. package/src/JSSComment.tsx +0 -56
  286. package/src/Link.tsx +0 -110
  287. package/src/List.tsx +0 -58
  288. package/src/ListButtonItem.tsx +0 -69
  289. package/src/ListDivider.tsx +0 -13
  290. package/src/ListHeaderItem.tsx +0 -45
  291. package/src/ListItem.tsx +0 -24
  292. package/src/ListLinkItem.tsx +0 -76
  293. package/src/ListSpacer.tsx +0 -14
  294. package/src/MenuIcon.tsx +0 -50
  295. package/src/NextJSRouter.tsx +0 -60
  296. package/src/NextJSRouterState.tsx +0 -154
  297. package/src/OnVisible.tsx +0 -42
  298. package/src/Popover.tsx +0 -145
  299. package/src/ProgressBar.tsx +0 -63
  300. package/src/ProgressCircle.tsx +0 -38
  301. package/src/Providers.tsx +0 -33
  302. package/src/RangeInput.tsx +0 -82
  303. package/src/ResultOrError.ts +0 -15
  304. package/src/RootView.tsx +0 -55
  305. package/src/Row.tsx +0 -12
  306. package/src/Select.tsx +0 -39
  307. package/src/StackContext.tsx +0 -52
  308. package/src/StaticCheckbox.tsx +0 -72
  309. package/src/Storage.tsx +0 -198
  310. package/src/Stream.tsx +0 -50
  311. package/src/Sublist.tsx +0 -61
  312. package/src/SubmitIconInput.tsx +0 -45
  313. package/src/Tabs.tsx +0 -110
  314. package/src/Text.tsx +0 -111
  315. package/src/TextArea.tsx +0 -58
  316. package/src/TextInput.tsx +0 -123
  317. package/src/TextInputWithState.tsx +0 -32
  318. package/src/TextPairing.tsx +0 -115
  319. package/src/TimeInput.tsx +0 -109
  320. package/src/Tooltip.tsx +0 -109
  321. package/src/aria.ts +0 -72
  322. package/src/docs/mdx.tsx +0 -137
  323. package/src/docs/pages.ts +0 -115
  324. package/src/docs/searchIndex.ts +0 -1
  325. package/src/examples/ExampleDialog.tsx +0 -28
  326. package/src/guid.ts +0 -7
  327. package/src/hash.ts +0 -21
  328. package/src/index.ts +0 -68
  329. package/src/isServer.ts +0 -3
  330. package/src/jss.tsx +0 -712
  331. package/src/jsx-dev-runtime.ts +0 -74
  332. package/src/jsx-runtime.ts +0 -2
  333. package/src/numberToBase.ts +0 -52
  334. package/src/pages/Badge.mdx +0 -152
  335. package/src/pages/Button.mdx +0 -163
  336. package/src/pages/Calendar.mdx +0 -254
  337. package/src/pages/Card.mdx +0 -147
  338. package/src/pages/Checkbox.mdx +0 -131
  339. package/src/pages/Dialog.mdx +0 -197
  340. package/src/pages/FlexLayout.mdx +0 -211
  341. package/src/pages/Hashing.mdx +0 -211
  342. package/src/pages/Icon.mdx +0 -171
  343. package/src/pages/IconButton.mdx +0 -155
  344. package/src/pages/Link.mdx +0 -160
  345. package/src/pages/List.mdx +0 -262
  346. package/src/pages/ListHeader.mdx +0 -220
  347. package/src/pages/Popover.mdx +0 -223
  348. package/src/pages/ProgressBar.mdx +0 -200
  349. package/src/pages/ProgressCircle.mdx +0 -218
  350. package/src/pages/RangeInput.mdx +0 -237
  351. package/src/pages/Tabs.mdx +0 -281
  352. package/src/pages/Text.mdx +0 -154
  353. package/src/pages/TextInput.mdx +0 -235
  354. package/src/pages/TextPairing.mdx +0 -204
  355. package/src/pages/TimeInput.mdx +0 -178
  356. package/src/pages/Tooltip.mdx +0 -115
  357. package/src/pages/_app.tsx +0 -466
  358. package/src/pages/_document.tsx +0 -30
  359. package/src/pages/css-in-js.mdx +0 -240
  360. package/src/pages/index.mdx +0 -58
  361. package/src/pages/navigation.mdx +0 -158
  362. package/src/pages/prism.css +0 -3
  363. package/src/pages/useCookie.mdx +0 -176
  364. package/src/pages/useKeyboard.mdx +0 -257
  365. package/src/pages/useNavigation.mdx +0 -258
  366. package/src/pages/usePromise.mdx +0 -280
  367. package/src/pages/useRefEffect.mdx +0 -251
  368. package/src/stateMachineContextFactory.tsx +0 -111
  369. package/src/useCookie.tsx +0 -95
  370. package/src/useKeyboard.tsx +0 -43
  371. package/src/useNavigation.tsx +0 -89
  372. package/src/usePromise.tsx +0 -18
  373. package/src/useRefEffect.tsx +0 -18
  374. package/src/vite-plugin-jss-debug.ts +0 -77
  375. package/tsconfig.build.json +0 -23
  376. package/tsconfig.json +0 -38
@@ -1,9 +0,0 @@
1
- export declare function hasCookie(key: string): boolean;
2
- export declare function getCookie<T>(key: string, deserialize?: (s: string) => T): T;
3
- export declare function useCookie<T, L>(key: string, { initialValue, loadingValue, serialize, deserialize, maxAge, }: {
4
- initialValue: T;
5
- loadingValue: L;
6
- serialize?: (t: T) => string;
7
- deserialize?: (s: string) => T;
8
- maxAge?: number;
9
- }): [T | L, (t: T | ((prevValue: T | L) => T)) => void];
package/dist/useCookie.js DELETED
@@ -1,67 +0,0 @@
1
- import { useState, useCallback, useEffect, useRef } from "react";
2
- import { isServer } from "./isServer";
3
- export function hasCookie(key) {
4
- return (document.cookie
5
- .split(";")
6
- .map((c) => c.trim())
7
- .filter((c) => c.startsWith(`${key}=`)).length > 0);
8
- }
9
- export function getCookie(key, deserialize = JSON.parse) {
10
- return document.cookie
11
- .split(";")
12
- .map((c) => c.trim())
13
- .filter((c) => c.startsWith(`${key}=`))
14
- .map((s) => s.split("=")[1])
15
- .map((s) => deserialize(s))
16
- .reverse()
17
- .pop();
18
- }
19
- export function useCookie(key, { initialValue = null, loadingValue, serialize = JSON.stringify, deserialize = JSON.parse, maxAge = 60 * 60 * 24 * 365, }) {
20
- const initializationRef = useRef(false);
21
- const [cookie, setCookie] = useState(() => {
22
- if (!isServer()) {
23
- const hasPersistedCookie = hasCookie(key);
24
- if (hasPersistedCookie) {
25
- return getCookie(key, deserialize);
26
- }
27
- else {
28
- return loadingValue;
29
- }
30
- }
31
- return loadingValue;
32
- });
33
- useEffect(() => {
34
- if (initializationRef.current === true) {
35
- return;
36
- }
37
- const hasPersistedCookie = hasCookie(key);
38
- if (hasPersistedCookie) {
39
- const persistedCookie = getCookie(key, deserialize);
40
- setCookie(persistedCookie);
41
- }
42
- else {
43
- document.cookie = `${key}=${serialize(initialValue)}; max-age=${maxAge};path=/;`;
44
- setCookie(initialValue);
45
- }
46
- initializationRef.current = true;
47
- }, []);
48
- return [
49
- cookie,
50
- useCallback((t) => {
51
- if (typeof t === "function") {
52
- // @ts-ignore
53
- const callback = t;
54
- setCookie((oldCookie) => {
55
- const newValue = callback(oldCookie);
56
- document.cookie = `${key}=${serialize(newValue)}; max-age=${maxAge};path=/;`;
57
- return newValue;
58
- });
59
- }
60
- else {
61
- setCookie(t);
62
- document.cookie = `${key}=${serialize(t)}; max-age=${maxAge};path=/;`;
63
- }
64
- }, []),
65
- ];
66
- }
67
- //# sourceMappingURL=useCookie.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useCookie.js","sourceRoot":"","sources":["../src/useCookie.tsx"],"names":[],"mappings":"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"}
@@ -1,8 +0,0 @@
1
- export type KeyboardShortcut<T> = {
2
- key: string;
3
- metaKey?: boolean;
4
- ctrlKey?: boolean;
5
- action: (root: T) => void;
6
- onlyWhenFocused?: boolean;
7
- };
8
- export declare function useKeyboard<T extends HTMLElement>(shortcuts: Array<KeyboardShortcut<T>>): (root: T) => void;
@@ -1,26 +0,0 @@
1
- import { useRefEffect } from "./useRefEffect";
2
- export function useKeyboard(shortcuts) {
3
- return useRefEffect((root) => {
4
- const onKeyDown = (e) => {
5
- for (const { metaKey, key, action, ctrlKey, onlyWhenFocused, } of shortcuts) {
6
- if (metaKey && e.metaKey !== true) {
7
- continue;
8
- }
9
- else if (ctrlKey && e.ctrlKey !== true) {
10
- continue;
11
- }
12
- else if (onlyWhenFocused && document.activeElement !== root) {
13
- continue;
14
- }
15
- if (e.key.toLowerCase() === key.toLowerCase()) {
16
- action(root);
17
- }
18
- }
19
- };
20
- window.addEventListener("keydown", onKeyDown);
21
- return () => {
22
- window.removeEventListener("keydown", onKeyDown);
23
- };
24
- });
25
- }
26
- //# sourceMappingURL=useKeyboard.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useKeyboard.js","sourceRoot":"","sources":["../src/useKeyboard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAU9C,MAAM,UAAU,WAAW,CACzB,SAAqC;IAErC,OAAO,YAAY,CAAI,CAAC,IAAO,EAAE,EAAE;QACjC,MAAM,SAAS,GAAG,CAAC,CAAgB,EAAE,EAAE;YACrC,KAAK,MAAM,EACT,OAAO,EACP,GAAG,EACH,MAAM,EACN,OAAO,EACP,eAAe,GAChB,IAAI,SAAS,EAAE,CAAC;gBACf,IAAI,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;oBAClC,SAAS;gBACX,CAAC;qBAAM,IAAI,OAAO,IAAI,CAAC,CAAC,OAAO,KAAK,IAAI,EAAE,CAAC;oBACzC,SAAS;gBACX,CAAC;qBAAM,IAAI,eAAe,IAAI,QAAQ,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;oBAC9D,SAAS;gBACX,CAAC;gBAED,IAAI,CAAC,CAAC,GAAG,CAAC,WAAW,EAAE,KAAK,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC;oBAC9C,MAAM,CAAC,IAAI,CAAC,CAAC;gBACf,CAAC;YACH,CAAC;QACH,CAAC,CAAC;QAEF,MAAM,CAAC,gBAAgB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAE9C,OAAO,GAAG,EAAE;YACV,MAAM,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACnD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -1,5 +0,0 @@
1
- export declare function useNavigation({ autofocus, rowLength, enabled, }?: {
2
- autofocus?: boolean;
3
- rowLength?: number;
4
- enabled?: boolean;
5
- }): (root: HTMLElement) => void;
@@ -1,79 +0,0 @@
1
- import { queryFocusables, focusElement, normalizeElements } from "./aria";
2
- import { useRefEffect } from "./useRefEffect";
3
- export function useNavigation({ autofocus = false, rowLength = 1, enabled = true, } = {}) {
4
- return useRefEffect((root) => {
5
- if (!enabled) {
6
- return;
7
- }
8
- let index = 0;
9
- const elements = queryFocusables(root);
10
- if (elements.length === 0) {
11
- return;
12
- }
13
- if (elements.length !== 0 && autofocus) {
14
- focusElement(elements, index);
15
- }
16
- else {
17
- normalizeElements(elements, index);
18
- }
19
- const onKeyDown = (e) => {
20
- const elements = queryFocusables(root);
21
- if (elements.length === 0) {
22
- return;
23
- }
24
- let newIndex = -1;
25
- if (e.code === "ArrowUp") {
26
- if (index - rowLength < 0) {
27
- newIndex = elements.length - (elements.length % rowLength) + index;
28
- }
29
- else {
30
- newIndex = index - rowLength;
31
- }
32
- }
33
- else if (e.code === "ArrowLeft") {
34
- if (index <= 0) {
35
- newIndex = elements.length - 1;
36
- }
37
- else {
38
- newIndex = index - 1;
39
- }
40
- }
41
- else if (e.code === "ArrowRight") {
42
- if (index >= elements.length - 1) {
43
- newIndex = 0;
44
- }
45
- else {
46
- newIndex = index + 1;
47
- }
48
- }
49
- else if (e.code === "ArrowDown") {
50
- if (index + rowLength > elements.length - 1) {
51
- newIndex = (index + rowLength) % rowLength;
52
- }
53
- else {
54
- newIndex = index + rowLength;
55
- }
56
- }
57
- if (newIndex !== -1 && index !== newIndex) {
58
- index = newIndex;
59
- focusElement(elements, index);
60
- e.preventDefault();
61
- e.stopPropagation();
62
- }
63
- };
64
- root.addEventListener("keydown", onKeyDown);
65
- const observer = new MutationObserver((mutationList) => {
66
- if (mutationList.filter((m) => m.type === "childList").length > 0) {
67
- const elements = queryFocusables(root);
68
- if (elements.length > 0) {
69
- normalizeElements(elements, index);
70
- }
71
- }
72
- });
73
- observer.observe(root, { childList: true });
74
- return () => {
75
- root.removeEventListener("keydown", onKeyDown);
76
- };
77
- });
78
- }
79
- //# sourceMappingURL=useNavigation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useNavigation.js","sourceRoot":"","sources":["../src/useNavigation.tsx"],"names":[],"mappings":"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"}
@@ -1 +0,0 @@
1
- export declare function usePromise<T>(promiseFactory: () => Promise<T>, inputs: Array<any>, initialValue: T): [T | null, any];
@@ -1,12 +0,0 @@
1
- import { useState, useEffect } from "react";
2
- export function usePromise(promiseFactory, inputs, initialValue) {
3
- const [value, setValue] = useState(initialValue);
4
- const [error, setError] = useState(null);
5
- useEffect(() => {
6
- promiseFactory()
7
- .then((value) => setValue(value))
8
- .catch((error) => setError(error));
9
- }, inputs);
10
- return [value, error];
11
- }
12
- //# sourceMappingURL=usePromise.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"usePromise.js","sourceRoot":"","sources":["../src/usePromise.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,UAAU,UAAU,CACxB,cAAgC,EAChC,MAAkB,EAClB,YAAe;IAEf,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;IACjD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAEzC,SAAS,CAAC,GAAG,EAAE;QACb,cAAc,EAAE;aACb,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aAChC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;IACvC,CAAC,EAAE,MAAM,CAAC,CAAC;IAEX,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AACxB,CAAC"}
@@ -1 +0,0 @@
1
- export declare function useRefEffect<T>(callback: (root: T) => (() => void) | void): (root: T) => void;
@@ -1,15 +0,0 @@
1
- import { useRef, useCallback } from "react";
2
- export function useRefEffect(callback) {
3
- const unsubscribeRef = useRef(null);
4
- const refCallback = useCallback((root) => {
5
- if (root === null) {
6
- unsubscribeRef.current && unsubscribeRef.current();
7
- }
8
- else {
9
- const unsubscribe = callback(root);
10
- unsubscribeRef.current = unsubscribe;
11
- }
12
- }, []);
13
- return refCallback;
14
- }
15
- //# sourceMappingURL=useRefEffect.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"useRefEffect.js","sourceRoot":"","sources":["../src/useRefEffect.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE5C,MAAM,UAAU,YAAY,CAC1B,QAA0C;IAE1C,MAAM,cAAc,GAAG,MAAM,CAAsB,IAAI,CAAC,CAAC;IAEzD,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,IAAc,EAAE,EAAE;QACjD,IAAI,IAAI,KAAK,IAAI,EAAE,CAAC;YAClB,cAAc,CAAC,OAAO,IAAI,cAAc,CAAC,OAAO,EAAE,CAAC;QACrD,CAAC;aAAM,CAAC;YACN,MAAM,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;YACnC,cAAc,CAAC,OAAO,GAAG,WAAW,CAAC;QACvC,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,WAAW,CAAC;AACrB,CAAC"}
@@ -1,44 +0,0 @@
1
- import path from "path";
2
-
3
- /**
4
- * Webpack/Turbopack loader that injects component names into toClassnames() calls.
5
- *
6
- * Rewrites:
7
- * toClassnames(jss) → toClassnames(jss, "Card")
8
- *
9
- * The component name is inferred from the filename (Card.tsx → "Card").
10
- */
11
- export default function jssDebugLoader(source) {
12
- if (!source.includes("toClassnames(")) return source;
13
-
14
- const filename = path.basename(this.resourcePath, path.extname(this.resourcePath));
15
- const name = JSON.stringify(filename);
16
- const needle = "toClassnames(";
17
- let result = "";
18
- let i = 0;
19
-
20
- while (i < source.length) {
21
- const idx = source.indexOf(needle, i);
22
- if (idx === -1) {
23
- result += source.slice(i);
24
- break;
25
- }
26
-
27
- result += source.slice(i, idx + needle.length);
28
- i = idx + needle.length;
29
-
30
- let depth = 1;
31
- let j = i;
32
- while (j < source.length && depth > 0) {
33
- const ch = source[j];
34
- if (ch === "(") depth++;
35
- else if (ch === ")") depth--;
36
- if (depth > 0) j++;
37
- }
38
-
39
- result += source.slice(i, j) + ", " + name;
40
- i = j;
41
- }
42
-
43
- return result;
44
- }
package/next-env.d.ts DELETED
@@ -1,6 +0,0 @@
1
- /// <reference types="next" />
2
- /// <reference types="next/image-types/global" />
3
- import "./.next/dev/types/routes.d.ts";
4
-
5
- // NOTE: This file should not be edited
6
- // see https://nextjs.org/docs/pages/api-reference/config/typescript for more information.
package/next.config.js DELETED
@@ -1,33 +0,0 @@
1
- // next.config.js
2
-
3
- import mdx from "@next/mdx";
4
-
5
- const withMDX = mdx({
6
- extension: /\.mdx?$/,
7
- options: {
8
- remarkPlugins: ["remark-gfm"],
9
- rehypePlugins: [],
10
- providerImportSource: "@mdx-js/react",
11
- },
12
- });
13
-
14
- /** @type {import('next').NextConfig} */
15
- const nextConfig = {
16
- pageExtensions: ["ts", "tsx", "js", "jsx", "md", "mdx"],
17
- reactStrictMode: true,
18
- turbopack: {
19
- rules: {
20
- "*.tsx": {
21
- loaders: [{ loader: "./jss-debug-loader.mjs" }],
22
- as: "*.tsx",
23
- },
24
- },
25
- resolveAlias: {
26
- "aidos-ui-jsx/jsx-dev-runtime": "./src/jsx-dev-runtime.ts",
27
- "aidos-ui-jsx/jsx-runtime": "./src/jsx-runtime.ts",
28
- },
29
- },
30
- };
31
-
32
- // Merge MDX config with Next.js config
33
- export default withMDX(nextConfig);
@@ -1,93 +0,0 @@
1
- import { pipeline } from "@xenova/transformers";
2
- import fs from "fs/promises";
3
- import path from "path";
4
- import { fileURLToPath } from "url";
5
- import { unified } from "unified";
6
- import remarkParse from "remark-parse";
7
- import remarkMdx from "remark-mdx";
8
-
9
- const __filename = fileURLToPath(import.meta.url);
10
- const __dirname = path.dirname(__filename);
11
- const __rootdir = path.join(__dirname, "..");
12
- const __pages = path.join(__rootdir, "src", "pages");
13
- const __target = path.join(__rootdir, "src", "docs");
14
-
15
- const generateEmbeddings = await pipeline(
16
- "feature-extraction",
17
- "Xenova/all-MiniLM-L6-v2"
18
- );
19
-
20
- const files = await fs.readdir(__pages);
21
-
22
- const index = [];
23
-
24
- for (const file of files) {
25
- if (path.extname(file) !== ".mdx") {
26
- continue;
27
- }
28
-
29
- const filepath = path.join(__pages, file);
30
- const filename = path.parse(file).name;
31
- const content = await fs.readFile(filepath, "utf-8");
32
- const sections = parseContent(content);
33
-
34
- const embeddings = await Promise.all(
35
- sections.map(async ({ text, heading, headingDepth }) => {
36
- const embedding = await generateEmbeddings(text, {
37
- normalize: true,
38
- pooling: "mean",
39
- });
40
- return {
41
- heading,
42
- headingDepth,
43
- filename,
44
- embedding: Array.from(embedding.data),
45
- };
46
- })
47
- );
48
-
49
- index.push(...embeddings);
50
- }
51
-
52
- await fs.writeFile(
53
- path.join(__target, "searchIndex.ts"),
54
- `export const index = ${JSON.stringify({ index })}`
55
- );
56
-
57
- function parseChildren(children) {
58
- const result = [];
59
-
60
- for (const node of children) {
61
- if (node.type === "text") {
62
- result.push(node.value);
63
- } else if (node.type === "inlineCode") {
64
- result.push(node.value);
65
- } else if (node.type === "link") {
66
- result.push(parseChildren(node.children));
67
- }
68
- }
69
-
70
- return result.join(" ");
71
- }
72
-
73
- function parseContent(content) {
74
- const ast = unified().use(remarkParse).use(remarkMdx).parse(content);
75
- const result = [];
76
- let headingDepth = 1;
77
- let heading = "";
78
-
79
- for (const node of ast.children) {
80
- if (node.type === "paragraph") {
81
- result.push({
82
- text: heading + ": " + parseChildren(node.children),
83
- heading,
84
- headingDepth,
85
- });
86
- } else if (node.type === "heading") {
87
- headingDepth = node.depth;
88
- heading = parseChildren(node.children);
89
- }
90
- }
91
-
92
- return result;
93
- }
@@ -1,100 +0,0 @@
1
- import fs from "fs/promises";
2
- import path from "path";
3
- import { fileURLToPath } from "url";
4
- import { unified } from "unified";
5
- import remarkParse from "remark-parse";
6
- import remarkMdx from "remark-mdx";
7
- import { Configuration, OpenAIApi } from "openai";
8
- import dotenv from "dotenv";
9
-
10
- dotenv.config();
11
-
12
- const __filename = fileURLToPath(import.meta.url);
13
- const __dirname = path.dirname(__filename);
14
- const __rootdir = path.join(__dirname, "..");
15
- const __pages = path.join(__rootdir, "src", "pages");
16
- const __target = path.join(__rootdir, "src", "docs");
17
-
18
- const configuration = new Configuration({
19
- organization: "org-Q89d8tyY2MChQVFEbhp27pB3",
20
- apiKey: process.env.OPENAI_API_KEY,
21
- });
22
- const openai = new OpenAIApi(configuration);
23
-
24
- const files = await fs.readdir(__pages);
25
-
26
- const index = [];
27
-
28
- for (const file of files) {
29
- if (path.extname(file) !== ".mdx") {
30
- continue;
31
- }
32
-
33
- const filepath = path.join(__pages, file);
34
- const filename = path.parse(file).name;
35
- const content = await fs.readFile(filepath, "utf-8");
36
- const sections = parseContent(content);
37
-
38
- const embeddings = await Promise.all(
39
- sections.map(async ({ text, heading, headingDepth }) => {
40
- const embedding = await openai
41
- .createEmbedding({
42
- model: "text-embedding-ada-002",
43
- input: text,
44
- })
45
- .then((response) => response.data[0].embedding);
46
-
47
- return {
48
- heading,
49
- headingDepth,
50
- filename,
51
- embedding: Array.from(embedding.data),
52
- };
53
- })
54
- );
55
-
56
- index.push(...embeddings);
57
- }
58
-
59
- await fs.writeFile(
60
- path.join(__target, "searchIndex.ts"),
61
- `export const index = ${JSON.stringify({ index })}`
62
- );
63
-
64
- function parseChildren(children) {
65
- const result = [];
66
-
67
- for (const node of children) {
68
- if (node.type === "text") {
69
- result.push(node.value);
70
- } else if (node.type === "inlineCode") {
71
- result.push(node.value);
72
- } else if (node.type === "link") {
73
- result.push(parseChildren(node.children));
74
- }
75
- }
76
-
77
- return result.join(" ");
78
- }
79
-
80
- function parseContent(content) {
81
- const ast = unified().use(remarkParse).use(remarkMdx).parse(content);
82
- const result = [];
83
- let headingDepth = 1;
84
- let heading = "";
85
-
86
- for (const node of ast.children) {
87
- if (node.type === "paragraph") {
88
- result.push({
89
- text: heading + ": " + parseChildren(node.children),
90
- heading,
91
- headingDepth,
92
- });
93
- } else if (node.type === "heading") {
94
- headingDepth = node.depth;
95
- heading = parseChildren(node.children);
96
- }
97
- }
98
-
99
- return result;
100
- }
@@ -1,28 +0,0 @@
1
- import { spawnSync } from "child_process";
2
-
3
- async function run() {
4
- const commands = [
5
- ["npm", ["run", "build:lib"]],
6
- ["npm", ["run", "embeddings"]],
7
- ["git", ["add", "--all"]],
8
- ["git", ["commit", "-m", "build:lib"]],
9
- ["npm", ["version", "patch"]],
10
- ["npm", ["publish"]],
11
- ["git", ["push"]],
12
- ].reverse();
13
-
14
- while (commands.length) {
15
- const [command, args = []] = commands.pop();
16
- console.log(`Executing ${command} ${args.join(" ")}`);
17
- const { error, stdout } = spawnSync(command, args);
18
-
19
- if (error) {
20
- console.error(error);
21
- break;
22
- } else {
23
- process.stdout.write(stdout);
24
- }
25
- }
26
- }
27
-
28
- run();
@@ -1,47 +0,0 @@
1
- import { pipeline } from "@xenova/transformers";
2
- import fs from "fs/promises";
3
- import path from "path";
4
- import { fileURLToPath } from "url";
5
-
6
- const __filename = fileURLToPath(import.meta.url);
7
- const __dirname = path.dirname(__filename);
8
- const __rootdir = path.join(__dirname, "..");
9
- const __public = path.join(__rootdir, "public");
10
-
11
- const index = await fs
12
- .readFile(path.join(__public, "index.json"), "utf-8")
13
- .then((data) => JSON.parse(data).index);
14
-
15
- const generateEmbeddings = await pipeline(
16
- "feature-extraction",
17
- "Xenova/all-MiniLM-L6-v2"
18
- );
19
-
20
- const query = "how to install";
21
-
22
- const queryEmbeddings = await generateEmbeddings(query, {
23
- normalize: true,
24
- pooling: "mean",
25
- }).then((embedding) => embedding.data);
26
-
27
- function dot(xs, ys) {
28
- let sum = 0;
29
-
30
- for (let i = 0; i < xs.length; i++) {
31
- sum += xs[i] * ys[i];
32
- }
33
-
34
- return sum;
35
- }
36
-
37
- const results = index
38
- .map((element) => {
39
- return {
40
- ...element,
41
- dot: dot(queryEmbeddings, element.embedding),
42
- };
43
- })
44
- .sort((a, b) => b.dot - a.dot)
45
- .slice(0, 5);
46
-
47
- console.log({ results });
package/src/Badge.tsx DELETED
@@ -1,36 +0,0 @@
1
- import React from "react";
2
-
3
- import { BaseView } from "./BaseView";
4
- import { Color, JSS, Size, getBackground } from "./jss";
5
-
6
- const sizes = {
7
- xsmall: 4,
8
- small: 6,
9
- medium: 12,
10
- large: 18,
11
- xlarge: 24,
12
- };
13
-
14
- export function Badge({
15
- size = "medium",
16
- color = "highlight",
17
- jss,
18
- }: {
19
- size?: Size;
20
- color?: Color;
21
- jss?: JSS;
22
- }) {
23
- return (
24
- <BaseView
25
- jss={[
26
- {
27
- width: sizes[size],
28
- height: sizes[size],
29
- borderRadius: sizes[size] / 2,
30
- },
31
- getBackground(color),
32
- jss,
33
- ]}
34
- />
35
- );
36
- }