aidos-ui 4.0.4 → 4.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -1
- package/README.md +23 -3
- package/dist/index.d.ts +801 -68
- package/dist/index.js +3934 -68
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +6 -2
- package/dist/jsx-dev-runtime.js +87 -42
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js +2 -2
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/vite-plugin-jss-debug.d.ts +3 -1
- package/dist/vite-plugin-jss-debug.js +57 -74
- package/dist/vite-plugin-jss-debug.js.map +1 -1
- package/package.json +61 -27
- package/.prettierrc +0 -4
- package/CLAUDE.md +0 -72
- package/dist/Badge.d.ts +0 -6
- package/dist/Badge.js +0 -22
- package/dist/Badge.js.map +0 -1
- package/dist/BaseButton.d.ts +0 -14
- package/dist/BaseButton.js +0 -23
- package/dist/BaseButton.js.map +0 -1
- package/dist/BaseInput.d.ts +0 -14
- package/dist/BaseInput.js +0 -15
- package/dist/BaseInput.js.map +0 -1
- package/dist/BaseLink.d.ts +0 -18
- package/dist/BaseLink.js +0 -29
- package/dist/BaseLink.js.map +0 -1
- package/dist/BaseList.d.ts +0 -6
- package/dist/BaseList.js +0 -14
- package/dist/BaseList.js.map +0 -1
- package/dist/BaseListAddOn.d.ts +0 -5
- package/dist/BaseListAddOn.js +0 -7
- package/dist/BaseListAddOn.js.map +0 -1
- package/dist/BaseListItem.d.ts +0 -26
- package/dist/BaseListItem.js +0 -29
- package/dist/BaseListItem.js.map +0 -1
- package/dist/BaseView.d.ts +0 -12
- package/dist/BaseView.js +0 -26
- package/dist/BaseView.js.map +0 -1
- package/dist/Box.d.ts +0 -4
- package/dist/Box.js +0 -6
- package/dist/Box.js.map +0 -1
- package/dist/Button.d.ts +0 -20
- package/dist/Button.js +0 -19
- package/dist/Button.js.map +0 -1
- package/dist/Calendar.d.ts +0 -18
- package/dist/Calendar.js +0 -57
- package/dist/Calendar.js.map +0 -1
- package/dist/Card.d.ts +0 -4
- package/dist/Card.js +0 -14
- package/dist/Card.js.map +0 -1
- package/dist/Checkbox.d.ts +0 -11
- package/dist/Checkbox.js +0 -32
- package/dist/Checkbox.js.map +0 -1
- package/dist/Circle.d.ts +0 -5
- package/dist/Circle.js +0 -12
- package/dist/Circle.js.map +0 -1
- package/dist/Column.d.ts +0 -6
- package/dist/Column.js +0 -7
- package/dist/Column.js.map +0 -1
- package/dist/DarkMode.d.ts +0 -13
- package/dist/DarkMode.js +0 -62
- package/dist/DarkMode.js.map +0 -1
- package/dist/DateInput.d.ts +0 -13
- package/dist/DateInput.js +0 -29
- package/dist/DateInput.js.map +0 -1
- package/dist/DatePicker.d.ts +0 -11
- package/dist/DatePicker.js +0 -34
- package/dist/DatePicker.js.map +0 -1
- package/dist/DatetimeInput.d.ts +0 -13
- package/dist/DatetimeInput.js +0 -31
- package/dist/DatetimeInput.js.map +0 -1
- package/dist/DesignBook.d.ts +0 -1
- package/dist/DesignBook.js +0 -55
- package/dist/DesignBook.js.map +0 -1
- package/dist/Dialog.d.ts +0 -17
- package/dist/Dialog.js +0 -92
- package/dist/Dialog.js.map +0 -1
- package/dist/Dropdown.d.ts +0 -14
- package/dist/Dropdown.js +0 -65
- package/dist/Dropdown.js.map +0 -1
- package/dist/Emitter.d.ts +0 -6
- package/dist/Emitter.js +0 -19
- package/dist/Emitter.js.map +0 -1
- package/dist/FlexLayout.d.ts +0 -11
- package/dist/FlexLayout.js +0 -18
- package/dist/FlexLayout.js.map +0 -1
- package/dist/Icon.d.ts +0 -12
- package/dist/Icon.js +0 -60
- package/dist/Icon.js.map +0 -1
- package/dist/IconButton.d.ts +0 -11
- package/dist/IconButton.js +0 -34
- package/dist/IconButton.js.map +0 -1
- package/dist/IconLink.d.ts +0 -9
- package/dist/IconLink.js +0 -32
- package/dist/IconLink.js.map +0 -1
- package/dist/IconType.d.ts +0 -1
- package/dist/IconType.js +0 -2
- package/dist/IconType.js.map +0 -1
- package/dist/Interactable.d.ts +0 -50
- package/dist/Interactable.js +0 -169
- package/dist/Interactable.js.map +0 -1
- package/dist/JSSComment.d.ts +0 -10
- package/dist/JSSComment.js +0 -52
- package/dist/JSSComment.js.map +0 -1
- package/dist/Link.d.ts +0 -22
- package/dist/Link.js +0 -29
- package/dist/Link.js.map +0 -1
- package/dist/List.d.ts +0 -15
- package/dist/List.js +0 -29
- package/dist/List.js.map +0 -1
- package/dist/ListButtonItem.d.ts +0 -14
- package/dist/ListButtonItem.js +0 -11
- package/dist/ListButtonItem.js.map +0 -1
- package/dist/ListDivider.d.ts +0 -1
- package/dist/ListDivider.js +0 -12
- package/dist/ListDivider.js.map +0 -1
- package/dist/ListHeaderItem.d.ts +0 -10
- package/dist/ListHeaderItem.js +0 -15
- package/dist/ListHeaderItem.js.map +0 -1
- package/dist/ListItem.d.ts +0 -9
- package/dist/ListItem.js +0 -9
- package/dist/ListItem.js.map +0 -1
- package/dist/ListLinkItem.d.ts +0 -16
- package/dist/ListLinkItem.js +0 -11
- package/dist/ListLinkItem.js.map +0 -1
- package/dist/ListSpacer.d.ts +0 -1
- package/dist/ListSpacer.js +0 -13
- package/dist/ListSpacer.js.map +0 -1
- package/dist/MenuIcon.d.ts +0 -5
- package/dist/MenuIcon.js +0 -31
- package/dist/MenuIcon.js.map +0 -1
- package/dist/NextJSRouter.d.ts +0 -1
- package/dist/NextJSRouter.js +0 -37
- package/dist/NextJSRouter.js.map +0 -1
- package/dist/NextJSRouterState.d.ts +0 -38
- package/dist/NextJSRouterState.js +0 -111
- package/dist/NextJSRouterState.js.map +0 -1
- package/dist/OnVisible.d.ts +0 -5
- package/dist/OnVisible.js +0 -28
- package/dist/OnVisible.js.map +0 -1
- package/dist/Popover.d.ts +0 -22
- package/dist/Popover.js +0 -90
- package/dist/Popover.js.map +0 -1
- package/dist/ProgressBar.d.ts +0 -7
- package/dist/ProgressBar.js +0 -42
- package/dist/ProgressBar.js.map +0 -1
- package/dist/ProgressCircle.d.ts +0 -5
- package/dist/ProgressCircle.js +0 -12
- package/dist/ProgressCircle.js.map +0 -1
- package/dist/Providers.d.ts +0 -9
- package/dist/Providers.js +0 -16
- package/dist/Providers.js.map +0 -1
- package/dist/RangeInput.d.ts +0 -14
- package/dist/RangeInput.js +0 -32
- package/dist/RangeInput.js.map +0 -1
- package/dist/ResultOrError.d.ts +0 -13
- package/dist/ResultOrError.js +0 -7
- package/dist/ResultOrError.js.map +0 -1
- package/dist/RootView.d.ts +0 -5
- package/dist/RootView.js +0 -35
- package/dist/RootView.js.map +0 -1
- package/dist/Row.d.ts +0 -6
- package/dist/Row.js +0 -7
- package/dist/Row.js.map +0 -1
- package/dist/Select.d.ts +0 -9
- package/dist/Select.js +0 -17
- package/dist/Select.js.map +0 -1
- package/dist/StackContext.d.ts +0 -8
- package/dist/StackContext.js +0 -25
- package/dist/StackContext.js.map +0 -1
- package/dist/StaticCheckbox.d.ts +0 -16
- package/dist/StaticCheckbox.js +0 -48
- package/dist/StaticCheckbox.js.map +0 -1
- package/dist/Storage.d.ts +0 -13
- package/dist/Storage.js +0 -146
- package/dist/Storage.js.map +0 -1
- package/dist/Stream.d.ts +0 -9
- package/dist/Stream.js +0 -36
- package/dist/Stream.js.map +0 -1
- package/dist/Sublist.d.ts +0 -12
- package/dist/Sublist.js +0 -18
- package/dist/Sublist.js.map +0 -1
- package/dist/SubmitIconInput.d.ts +0 -8
- package/dist/SubmitIconInput.js +0 -25
- package/dist/SubmitIconInput.js.map +0 -1
- package/dist/Tabs.d.ts +0 -23
- package/dist/Tabs.js +0 -39
- package/dist/Tabs.js.map +0 -1
- package/dist/Text.d.ts +0 -25
- package/dist/Text.js +0 -52
- package/dist/Text.js.map +0 -1
- package/dist/TextArea.d.ts +0 -11
- package/dist/TextArea.js +0 -27
- package/dist/TextArea.js.map +0 -1
- package/dist/TextInput.d.ts +0 -15
- package/dist/TextInput.js +0 -61
- package/dist/TextInput.js.map +0 -1
- package/dist/TextInputWithState.d.ts +0 -8
- package/dist/TextInputWithState.js +0 -14
- package/dist/TextInputWithState.js.map +0 -1
- package/dist/TextPairing.d.ts +0 -21
- package/dist/TextPairing.js +0 -26
- package/dist/TextPairing.js.map +0 -1
- package/dist/TimeInput.d.ts +0 -15
- package/dist/TimeInput.js +0 -58
- package/dist/TimeInput.js.map +0 -1
- package/dist/Tooltip.d.ts +0 -11
- package/dist/Tooltip.js +0 -73
- package/dist/Tooltip.js.map +0 -1
- package/dist/aria.d.ts +0 -8
- package/dist/aria.js +0 -42
- package/dist/aria.js.map +0 -1
- package/dist/guid.d.ts +0 -1
- package/dist/guid.js +0 -7
- package/dist/guid.js.map +0 -1
- package/dist/hash.d.ts +0 -1
- package/dist/hash.js +0 -20
- package/dist/hash.js.map +0 -1
- package/dist/isServer.d.ts +0 -1
- package/dist/isServer.js +0 -4
- package/dist/isServer.js.map +0 -1
- package/dist/jss.d.ts +0 -122
- package/dist/jss.js +0 -515
- package/dist/jss.js.map +0 -1
- package/dist/numberToBase.d.ts +0 -1
- package/dist/numberToBase.js +0 -44
- package/dist/numberToBase.js.map +0 -1
- package/dist/stateMachineContextFactory.d.ts +0 -36
- package/dist/stateMachineContextFactory.js +0 -48
- package/dist/stateMachineContextFactory.js.map +0 -1
- package/dist/useCookie.d.ts +0 -9
- package/dist/useCookie.js +0 -67
- package/dist/useCookie.js.map +0 -1
- package/dist/useKeyboard.d.ts +0 -8
- package/dist/useKeyboard.js +0 -26
- package/dist/useKeyboard.js.map +0 -1
- package/dist/useNavigation.d.ts +0 -5
- package/dist/useNavigation.js +0 -79
- package/dist/useNavigation.js.map +0 -1
- package/dist/usePromise.d.ts +0 -1
- package/dist/usePromise.js +0 -12
- package/dist/usePromise.js.map +0 -1
- package/dist/useRefEffect.d.ts +0 -1
- package/dist/useRefEffect.js +0 -15
- package/dist/useRefEffect.js.map +0 -1
- package/jss-debug-loader.mjs +0 -44
- package/next-env.d.ts +0 -6
- package/next.config.js +0 -33
- package/scripts/embeddings.js +0 -93
- package/scripts/openai_embeddings.js +0 -100
- package/scripts/publish.js +0 -28
- package/scripts/test_embeddings.js +0 -47
- package/src/Badge.tsx +0 -36
- package/src/BaseButton.tsx +0 -62
- package/src/BaseInput.tsx +0 -63
- package/src/BaseLink.tsx +0 -80
- package/src/BaseList.tsx +0 -26
- package/src/BaseListAddOn.tsx +0 -10
- package/src/BaseListItem.tsx +0 -119
- package/src/BaseView.tsx +0 -57
- package/src/Box.tsx +0 -20
- package/src/Button.tsx +0 -90
- package/src/Calendar.tsx +0 -123
- package/src/Card.tsx +0 -30
- package/src/Checkbox.tsx +0 -63
- package/src/Circle.tsx +0 -24
- package/src/Column.tsx +0 -12
- package/src/DarkMode.tsx +0 -100
- package/src/DateInput.tsx +0 -63
- package/src/DatePicker.tsx +0 -67
- package/src/DatetimeInput.tsx +0 -64
- package/src/DesignBook.tsx +0 -677
- package/src/Dialog.tsx +0 -150
- package/src/Dropdown.tsx +0 -146
- package/src/Emitter.ts +0 -26
- package/src/FlexLayout.tsx +0 -53
- package/src/Icon.tsx +0 -80
- package/src/IconButton.tsx +0 -81
- package/src/IconLink.tsx +0 -59
- package/src/IconType.ts +0 -787
- package/src/Interactable.tsx +0 -210
- package/src/JSSComment.tsx +0 -56
- package/src/Link.tsx +0 -110
- package/src/List.tsx +0 -58
- package/src/ListButtonItem.tsx +0 -69
- package/src/ListDivider.tsx +0 -13
- package/src/ListHeaderItem.tsx +0 -45
- package/src/ListItem.tsx +0 -24
- package/src/ListLinkItem.tsx +0 -76
- package/src/ListSpacer.tsx +0 -14
- package/src/MenuIcon.tsx +0 -50
- package/src/NextJSRouter.tsx +0 -60
- package/src/NextJSRouterState.tsx +0 -154
- package/src/OnVisible.tsx +0 -42
- package/src/Popover.tsx +0 -145
- package/src/ProgressBar.tsx +0 -63
- package/src/ProgressCircle.tsx +0 -38
- package/src/Providers.tsx +0 -33
- package/src/RangeInput.tsx +0 -82
- package/src/ResultOrError.ts +0 -15
- package/src/RootView.tsx +0 -55
- package/src/Row.tsx +0 -12
- package/src/Select.tsx +0 -39
- package/src/StackContext.tsx +0 -52
- package/src/StaticCheckbox.tsx +0 -72
- package/src/Storage.tsx +0 -198
- package/src/Stream.tsx +0 -50
- package/src/Sublist.tsx +0 -61
- package/src/SubmitIconInput.tsx +0 -45
- package/src/Tabs.tsx +0 -110
- package/src/Text.tsx +0 -111
- package/src/TextArea.tsx +0 -58
- package/src/TextInput.tsx +0 -123
- package/src/TextInputWithState.tsx +0 -32
- package/src/TextPairing.tsx +0 -115
- package/src/TimeInput.tsx +0 -109
- package/src/Tooltip.tsx +0 -109
- package/src/aria.ts +0 -72
- package/src/docs/mdx.tsx +0 -137
- package/src/docs/pages.ts +0 -115
- package/src/docs/searchIndex.ts +0 -1
- package/src/examples/ExampleDialog.tsx +0 -28
- package/src/guid.ts +0 -7
- package/src/hash.ts +0 -21
- package/src/index.ts +0 -68
- package/src/isServer.ts +0 -3
- package/src/jss.tsx +0 -712
- package/src/jsx-dev-runtime.ts +0 -74
- package/src/jsx-runtime.ts +0 -2
- package/src/numberToBase.ts +0 -52
- package/src/pages/Badge.mdx +0 -152
- package/src/pages/Button.mdx +0 -163
- package/src/pages/Calendar.mdx +0 -254
- package/src/pages/Card.mdx +0 -147
- package/src/pages/Checkbox.mdx +0 -131
- package/src/pages/Dialog.mdx +0 -197
- package/src/pages/FlexLayout.mdx +0 -211
- package/src/pages/Hashing.mdx +0 -211
- package/src/pages/Icon.mdx +0 -171
- package/src/pages/IconButton.mdx +0 -155
- package/src/pages/Link.mdx +0 -160
- package/src/pages/List.mdx +0 -262
- package/src/pages/ListHeader.mdx +0 -220
- package/src/pages/Popover.mdx +0 -223
- package/src/pages/ProgressBar.mdx +0 -200
- package/src/pages/ProgressCircle.mdx +0 -218
- package/src/pages/RangeInput.mdx +0 -237
- package/src/pages/Tabs.mdx +0 -281
- package/src/pages/Text.mdx +0 -154
- package/src/pages/TextInput.mdx +0 -235
- package/src/pages/TextPairing.mdx +0 -204
- package/src/pages/TimeInput.mdx +0 -178
- package/src/pages/Tooltip.mdx +0 -115
- package/src/pages/_app.tsx +0 -466
- package/src/pages/_document.tsx +0 -30
- package/src/pages/css-in-js.mdx +0 -240
- package/src/pages/index.mdx +0 -58
- package/src/pages/navigation.mdx +0 -158
- package/src/pages/prism.css +0 -3
- package/src/pages/useCookie.mdx +0 -176
- package/src/pages/useKeyboard.mdx +0 -257
- package/src/pages/useNavigation.mdx +0 -258
- package/src/pages/usePromise.mdx +0 -280
- package/src/pages/useRefEffect.mdx +0 -251
- package/src/stateMachineContextFactory.tsx +0 -111
- package/src/useCookie.tsx +0 -95
- package/src/useKeyboard.tsx +0 -43
- package/src/useNavigation.tsx +0 -89
- package/src/usePromise.tsx +0 -18
- package/src/useRefEffect.tsx +0 -18
- package/src/vite-plugin-jss-debug.ts +0 -77
- package/tsconfig.build.json +0 -23
- package/tsconfig.json +0 -38
package/dist/useCookie.d.ts
DELETED
|
@@ -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
|
package/dist/useCookie.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useCookie.js","sourceRoot":"","sources":["../src/useCookie.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,UAAU,SAAS,CAAC,GAAW;IACnC,OAAO,CACL,QAAQ,CAAC,MAAM;SACZ,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CACrD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS,CACvB,GAAW,EACX,cAAgC,IAAI,CAAC,KAAK;IAE1C,OAAO,QAAQ,CAAC,MAAM;SACnB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;SACtC,GAAG,CAA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G,GAAG,GAAG,IAAI,SAAS,CACnC,YAAY,CACb,aAAa,MAAM,UAAU,CAAC;YAC/B,SAAS,CAAC,YAAY,CAAC,CAAC;QAC1B,CAAC;QACD,iBAAiB,CAAC,OAAO,GAAG,IAAI,CAAC;IACnC,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,MAAM;QACN,WAAW,CAAC,CAAC,CAAgC,EAAE,EAAE;YAC/C,IAAI,OAAO,CAAC,KAAK,UAAU,EAAE,CAAC;gBAC5B,aAAa;gBACb,MAAM,QAAQ,GAA4B,CAAC,CAAC;gBAC5C,SAAS,CAAC,CAAC,SAAS,EAAE,EAAE;oBACtB,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,CAAC,CAAC;oBACrC,QAAQ,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,SAAS,CACnC,QAAQ,CACT,aAAa,MAAM,UAAU,CAAC;oBAC/B,OAAO,QAAQ,CAAC;gBAClB,CAAC,CAAC,CAAC;YACL,CAAC;iBAAM,CAAC;gBACN,SAAS,CAAC,CAAC,CAAC,CAAC;gBACb,QAAQ,CAAC,MAAM,GAAG,GAAG,GAAG,IAAI,SAAS,CAAC,CAAC,CAAC,aAAa,MAAM,UAAU,CAAC;YACxE,CAAC;QACH,CAAC,EAAE,EAAE,CAAC;KACP,CAAC;AACJ,CAAC"}
|
package/dist/useKeyboard.d.ts
DELETED
|
@@ -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;
|
package/dist/useKeyboard.js
DELETED
|
@@ -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
|
package/dist/useKeyboard.js.map
DELETED
|
@@ -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"}
|
package/dist/useNavigation.d.ts
DELETED
package/dist/useNavigation.js
DELETED
|
@@ -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 @@
|
|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C,CAAC;QAE5C,MAAM,QAAQ,GAAG,IAAI,gBAAgB,CAAC,CAAC,YAAY,EAAE,EAAE;YACrD,IAAI,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAClE,MAAM,QAAQ,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;gBACvC,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACxB,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;gBACrC,CAAC;YACH,CAAC;QACH,CAAC,CAAC,CAAC;QACH,QAAQ,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAE5C,OAAO,GAAG,EAAE;YACV,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QACjD,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/usePromise.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function usePromise<T>(promiseFactory: () => Promise<T>, inputs: Array<any>, initialValue: T): [T | null, any];
|
package/dist/usePromise.js
DELETED
|
@@ -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
|
package/dist/usePromise.js.map
DELETED
|
@@ -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"}
|
package/dist/useRefEffect.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function useRefEffect<T>(callback: (root: T) => (() => void) | void): (root: T) => void;
|
package/dist/useRefEffect.js
DELETED
|
@@ -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
|
package/dist/useRefEffect.js.map
DELETED
|
@@ -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"}
|
package/jss-debug-loader.mjs
DELETED
|
@@ -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
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);
|
package/scripts/embeddings.js
DELETED
|
@@ -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
|
-
}
|
package/scripts/publish.js
DELETED
|
@@ -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
|
-
}
|