repo_name string | dataset string | owner string | lang string | func_name string | code string | docstring string | url string | sha string |
|---|---|---|---|---|---|---|---|---|
tsdocs | github_2023 | pastelsky | typescript | killAllBullMQProcesses | function killAllBullMQProcesses(processName: string) {
if (process.env.NODE_ENV !== "production") return;
const ageInSeconds = 30;
const command = `ps aux | grep '${processName}' | grep -v grep | awk '{split($10,a,":"); if (a[1] * 60 + a[2] > ${ageInSeconds}) print $2}' | xargs -r kill -9`;
try {
execSync(... | /**
* When pm2 restarts the server, its possible for worker processes to be left behind.
* Here we force kill all such processes
*/ | https://github.com/pastelsky/tsdocs/blob/744da56c879c8b4c3ce976089b1b3274eab64fb9/server/queues.ts#L19-L30 | 744da56c879c8b4c3ce976089b1b3274eab64fb9 |
tsdocs | github_2023 | pastelsky | typescript | wrapPackCommand | const wrapPackCommand = (packagePath: string) =>
`$(npm pack --ignore-scripts ${packagePath} | tail -1)`; | // When operating on a local directory, force npm to copy directory structure | https://github.com/pastelsky/tsdocs/blob/744da56c879c8b4c3ce976089b1b3274eab64fb9/server/package/installation.utils.ts#L16-L17 | 744da56c879c8b4c3ce976089b1b3274eab64fb9 |
tsdocs | github_2023 | pastelsky | typescript | copyAndSymlinkAssets | async function copyAndSymlinkAssets(assetsDir: string, assetFiles: string[]) {
const sharedAssetsDir = path.join(
__dirname,
"..",
"..",
"..",
"docs-shared-assets",
docsVersion,
);
if (!fs.existsSync(sharedAssetsDir)) {
await fs.promises.mkdir(sharedAssetsDir, { recursive: true });
}... | /**
* typedoc generates CSS / JS assets per package.
* This is a problem because a change in CSS overrides or global CSS
* will result in previously cached docs to use the CSS at the time of
* generation instead of the latest version. Here we delete common assets
* in package dirs, and symlink it to a shared direc... | https://github.com/pastelsky/tsdocs/blob/744da56c879c8b4c3ce976089b1b3274eab64fb9/server/package/extractor/doc-generator.tsx#L384-L413 | 744da56c879c8b4c3ce976089b1b3274eab64fb9 |
tsdocs | github_2023 | pastelsky | typescript | patchEscapedName | function patchEscapedName(escapedName: string) {
if (escapedName.includes("node_modules")) {
const startIndex =
escapedName.lastIndexOf("node_modules") + "node_modules".length + 1;
const packagePath = escapedName.substring(startIndex);
const fragments = packagePath.split(path.sep);
if (packageP... | // https://github.com/Gerrit0/typedoc-plugin-missing-exports/issues/12 | https://github.com/pastelsky/tsdocs/blob/744da56c879c8b4c3ce976089b1b3274eab64fb9/server/package/extractor/plugin-add-missing-exports.ts#L40-L54 | 744da56c879c8b4c3ce976089b1b3274eab64fb9 |
tsdocs | github_2023 | pastelsky | typescript | shouldConvertSymbol | function shouldConvertSymbol(
symbol: ts.Symbol,
checker: ts.TypeChecker,
basePath: string,
) {
while (symbol.flags & ts.SymbolFlags.Alias) {
symbol = checker.getAliasedSymbol(symbol);
}
// We're looking at an unknown symbol which is declared in some package without
// type declarations. We know noth... | // append string to file | https://github.com/pastelsky/tsdocs/blob/744da56c879c8b4c3ce976089b1b3274eab64fb9/server/package/extractor/plugin-add-missing-exports.ts#L311-L342 | 744da56c879c8b4c3ce976089b1b3274eab64fb9 |
fabritor-web | github_2023 | sleepy-zone | typescript | getRightPolygonPoints | const getRightPolygonPoints = (num, radius = 100) => {
const d = 360 / num;
const points: {x: number, y: number}[] = [];
for (let i = 0; i < num; i++) {
const y = radius * Math.cos(degree2Radian(i * d));
const x = radius * Math.sin(degree2Radian(i * d));
points.push({ x: -x, y: -y });
}
return poi... | // 中心为 [0,0] 点 | https://github.com/sleepy-zone/fabritor-web/blob/af35a0118362dbbce5036c759ade0d34aec3ff08/src/fabritor/UI/panel/ShapePanel/shape-type-list.tsx#L8-L17 | af35a0118362dbbce5036c759ade0d34aec3ff08 |
multi-agent-postgres-data-analytics | github_2023 | disler | typescript | handleKeyPress | function handleKeyPress(event: React.KeyboardEvent<HTMLInputElement>) {
if (event.key === 'Enter') {
handleSubmit();
}
} | // Function to handle the Enter key press | https://github.com/disler/multi-agent-postgres-data-analytics/blob/b1bfdbb4d798eb0cd8b39066d04717874ee68158/fe-clients/react-ts/src/App.tsx#L25-L29 | b1bfdbb4d798eb0cd8b39066d04717874ee68158 |
multi-agent-postgres-data-analytics | github_2023 | disler | typescript | handleSubmit | function handleSubmit() {
fetch('http://localhost:3000/prompt', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({ prompt }),
})
.then(response => response.json())
.then(data => {
const resultsParsed = {
... | // Function to handle the submit action | https://github.com/disler/multi-agent-postgres-data-analytics/blob/b1bfdbb4d798eb0cd8b39066d04717874ee68158/fe-clients/react-ts/src/App.tsx#L32-L51 | b1bfdbb4d798eb0cd8b39066d04717874ee68158 |
classroomio | github_2023 | classroomio | typescript | _lighten | const _lighten = (hex: string, no: number) => tc(() => lighten(hex, no), hex); | // Handle this functions in a try catch if hex is not valid. | https://github.com/classroomio/classroomio/blob/9317b79afba486d22ad0f2e7c1422c65cf6c2e1b/apps/dashboard/src/lib/utils/functions/theme.ts#L53-L53 | 9317b79afba486d22ad0f2e7c1422c65cf6c2e1b |
fuse | github_2023 | StellateHQ | typescript | getUsers | async function getUsers(ids: string[]): Promise<UserSource[]> {
return ids.map((id) => ({
id,
name: `Peter #${id}`,
avatar_url: `https://i.pravatar.cc/300?u=${id}`,
}))
} | // Fake function to fetch users. In real applications, this would | https://github.com/StellateHQ/fuse/blob/26ea459f0075fa083734033c96014d37b762089a/packages/core/test/fixtures/simple/types/Test.ts#L29-L35 | 26ea459f0075fa083734033c96014d37b762089a |
fuse | github_2023 | StellateHQ | typescript | getUsers | async function getUsers(ids: string[]): Promise<UserSource[]> {
return ids.map((id) => ({
id,
name: `Peter #${id}`,
avatar_url: `https://i.pravatar.cc/300?u=${id}`,
}))
} | // Fake function to fetch users. In real applications, this would | https://github.com/StellateHQ/fuse/blob/26ea459f0075fa083734033c96014d37b762089a/packages/core/test/fixtures/tada/types/Test.ts#L29-L35 | 26ea459f0075fa083734033c96014d37b762089a |
lobe-tts | github_2023 | lobehub | typescript | main | async function main() {
const response = await tts.create(payload);
const mp3Buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync(speechFile, mp3Buffer);
} | // 调用 create 方法来合成语音 | https://github.com/lobehub/lobe-tts/blob/92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4/examples/text-to-speech-on-server/EdgeSpeechTTS.ts#L24-L29 | 92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4 |
lobe-tts | github_2023 | lobehub | typescript | main | async function main() {
const response = await tts.create(payload);
const mp3Buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync(speechFile, mp3Buffer);
} | // 调用 create 方法来合成语音 | https://github.com/lobehub/lobe-tts/blob/92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4/examples/text-to-speech-on-server/MicrosoftTTS.ts#L25-L30 | 92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4 |
lobe-tts | github_2023 | lobehub | typescript | main | async function main() {
const response = await tts.create(payload);
const mp3Buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync(speechFile, mp3Buffer);
} | // 调用 create 方法来合成语音 | https://github.com/lobehub/lobe-tts/blob/92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4/examples/text-to-speech-on-server/OpenAITTS.ts#L21-L26 | 92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4 |
lobe-tts | github_2023 | lobehub | typescript | originHeadersFromReq | async function originHeadersFromReq(req: Request, origin: StaticOrigin | OriginFn) {
const reqOrigin = req.headers.get('Origin') || undefined;
const value = typeof origin === 'function' ? await origin(reqOrigin, req) : origin;
if (!value) return;
return getOriginHeaders(reqOrigin, value);
} | // originHeadersFromReq | https://github.com/lobehub/lobe-tts/blob/92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4/lib/cors.ts#L63-L69 | 92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4 |
lobe-tts | github_2023 | lobehub | typescript | EdgeSpeechTTS.createAudio | createAudio = async (payload: EdgeSpeechPayload): Promise<AudioBuffer> => {
const res = await this.create(payload);
const arrayBuffer = await res.arrayBuffer();
return arrayBufferConvert(arrayBuffer);
} | /**
* Browser only
* @param payload
*/ | https://github.com/lobehub/lobe-tts/blob/92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4/src/core/EdgeSpeechTTS/index.ts | 92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4 |
lobe-tts | github_2023 | lobehub | typescript | convertMarkdownToMdast | const convertMarkdownToMdast = async (md: string) => {
// @ts-ignore
return unified().use(remarkParse).use(remarkGfm).parse(md.trim());
}; | // @ts-ignore | https://github.com/lobehub/lobe-tts/blob/92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4/src/core/utils/cleanContent.ts#L7-L10 | 92a3ca2d0dc7f37477ec1614b62dc444cc2d58d4 |
corvu | github_2023 | corvudev | typescript | AccordionContent | const AccordionContent = <T extends ValidComponent = 'div'>(
props: DynamicProps<T, AccordionContentProps<T>>,
) => {
const context = createMemo(() =>
useInternalAccordionItemContext(props.contextId),
)
return (
<Disclosure.Content<
Component<
Omit<AccordionContentElementProps, keyof Disc... | /** Content of an accordion item. Can be animated.
*
* @data `data-corvu-accordion-content` - Present on every accordion item content element.
* @data `data-expanded` - Present when the accordion item is expanded.
* @data `data-collapsed` - Present when the accordion item is collapsed.
* @css `--corvu-disclosure-c... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/accordion/src/Content.tsx#L34-L56 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | CalendarCell | const CalendarCell = <T extends ValidComponent = 'td'>(
props: DynamicProps<T, CalendarCellProps<T>>,
) => {
return (
<Dynamic<CalendarCellElementProps>
as="td"
// === ElementProps ===
role="presentation"
data-corvu-calendar-cell=""
{...props}
/>
)
} | /** Calendar cell element.
*
* @data `data-corvu-calendar-cell` - Present on every calendar cell element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/calendar/src/Cell.tsx#L24-L36 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | CalendarHeadCell | const CalendarHeadCell = <T extends ValidComponent = 'th'>(
props: DynamicProps<T, CalendarHeadCellProps<T>>,
) => {
return (
<Dynamic<CalendarHeadCellElementProps>
as="th"
// === ElementProps ===
scope="col"
data-corvu-calendar-headcell=""
{...props}
/>
)
} | /** Calendar column header cell.
*
* @data `data-corvu-calendar-headcell` - Present on every calendar headcell element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/calendar/src/HeadCell.tsx#L27-L39 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | CalendarLabel | const CalendarLabel = <T extends ValidComponent = 'h2'>(
props: DynamicProps<T, CalendarLabelProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as CalendarLabelProps, [
'index',
'contextId',
])
const context = createMemo(() =>
useInternalCalendarContext(localProps.contextId),
)
... | /** Label element to announce the calendar to accessibility tools.
*
* @data `data-corvu-calendar-label` - Present on every calendar label element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/calendar/src/Label.tsx#L40-L68 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | CalendarNav | const CalendarNav = <T extends ValidComponent = 'button'>(
props: DynamicProps<T, CalendarNavProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as CalendarNavProps, [
'action',
'contextId',
'onClick',
])
const context = createMemo(() =>
useInternalCalendarContext(localProps.con... | /** Button to navigate the calendar.
*
* @data `data-corvu-calendar-nav` - Present on every calendar nav element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/calendar/src/Nav.tsx#L44-L73 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | CalendarTable | const CalendarTable = <T extends ValidComponent = 'table'>(
props: DynamicProps<T, CalendarTableProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as CalendarTableProps, [
'index',
'contextId',
])
const context = createMemo(() =>
useInternalCalendarContext(localProps.contextId),
... | /** Table element for the calendar grid.
*
* @data `data-corvu-calendar-table` - Present on every calendar table element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/calendar/src/Table.tsx#L37-L64 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DialogClose | const DialogClose = <T extends ValidComponent = 'button'>(
props: DynamicProps<T, DialogCloseProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as DialogCloseProps, [
'contextId',
'onClick',
])
const context = createMemo(() =>
useInternalDialogContext(localProps.contextId),
)
... | /** Close button that changes the open state to false when clicked.
*
* @data `data-corvu-dialog-close` - Present on every dialog close element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/dialog/src/Close.tsx#L41-L71 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DialogDescription | const DialogDescription = <T extends ValidComponent = 'p'>(
props: DynamicProps<T, DialogDescriptionProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as DialogDescriptionProps, [
'contextId',
])
const context = createMemo(() =>
useInternalDialogContext(localProps.contextId),
)
cr... | /** Description element to announce the dialog to accessibility tools.
*
* @data `data-corvu-dialog-description` - Present on every dialog description element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/dialog/src/Description.tsx#L37-L63 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DialogLabel | const DialogLabel = <T extends ValidComponent = 'h2'>(
props: DynamicProps<T, DialogLabelProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as DialogLabelProps, [
'contextId',
])
const context = createMemo(() =>
useInternalDialogContext(localProps.contextId),
)
createEffect(() => ... | /** Label element to announce the dialog to accessibility tools.
*
* @data `data-corvu-dialog-label` - Present on every dialog label element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/dialog/src/Label.tsx#L33-L59 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DialogPortal | const DialogPortal = (
props: DialogPortalProps & ComponentProps<typeof Portal>,
) => {
const [localProps, otherProps] = splitProps(props, [
'forceMount',
'contextId',
])
const context = createMemo(() =>
useInternalDialogContext(localProps.contextId),
)
const show = () =>
some(
conte... | /** Portals its children at the end of the body element to ensure that the dialog always rendered on top. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/dialog/src/Portal.tsx#L19-L44 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DrawerClose | const DrawerClose = <T extends ValidComponent = 'button'>(
props: DynamicProps<T, DrawerCloseProps<T>>,
) => {
return (
<Dialog.Close<
Component<Omit<DrawerCloseElementProps, keyof DialogCloseElementProps>>
>
// === ElementProps ===
data-corvu-drawer-close=""
// === Misc ===
da... | /** Close button that changes the open state to false when clicked.
*
* @data `data-corvu-drawer-close` - Present on every drawer close element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/drawer/src/Close.tsx#L25-L39 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DrawerDescription | const DrawerDescription = <T extends ValidComponent = 'p'>(
props: DynamicProps<T, DrawerDescriptionProps<T>>,
) => {
return (
<Dialog.Description<
Component<
Omit<DrawerDescriptionElementProps, keyof DialogDescriptionElementProps>
>
>
// === ElementProps ===
data-corvu-drawe... | /** Description element to announce the drawer to accessibility tools.
*
* @data `data-corvu-drawer-description` - Present on every drawer description element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/drawer/src/Description.tsx#L27-L43 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DrawerLabel | const DrawerLabel = <T extends ValidComponent = 'h2'>(
props: DynamicProps<T, DrawerLabelProps<T>>,
) => {
return (
<Dialog.Label<
Component<Omit<DrawerLabelElementProps, keyof DialogLabelElementProps>>
>
// === ElementProps ===
data-corvu-drawer-label=""
// === Misc ===
data-c... | /** Label element to announce the drawer to accessibility tools.
*
* @data `data-corvu-drawer-label` - Present on every drawer label element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/drawer/src/Label.tsx#L25-L39 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DrawerRoot | const DrawerRoot: Component<DrawerRootProps> = (props) => {
const defaultedProps = mergeProps(
{
initialOpen: false,
snapPoints: [0, 1],
breakPoints: [null],
defaultSnapPoint: 1,
side: 'bottom' as const,
dampFunction: (distance: number) => 6 * Math.log(distance + 1),
velo... | /** Context wrapper for the drawer. Is required for every drawer you create. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/drawer/src/Root.tsx#L127-L420 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DrawerTrigger | const DrawerTrigger = <T extends ValidComponent = 'button'>(
props: DynamicProps<T, DrawerTriggerProps<T>>,
) => {
return (
<Dialog.Trigger<
Component<
Omit<DrawerTriggerElementProps, keyof DialogTriggerElementProps>
>
>
// === ElementProps ===
data-corvu-drawer-trigger=""
... | /** Button that changes the open state of the drawer when clicked.
*
* @data `data-corvu-drawer-trigger` - Present on every drawer trigger element.
* @data `data-open` - Present when the drawer is open.
* @data `data-closed` - Present when the drawer is closed.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/drawer/src/Trigger.tsx#L28-L44 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | findNearbySnapPoint | const findNearbySnapPoint = (
side: 'upper' | 'lower',
snapPoints: ResolvedSnapPointWithBreakPoints[],
offset: number,
) => {
return snapPoints.reduce(
(
previousSnapPoint: ResolvedSnapPointWithBreakPoints | undefined,
currentSnapPoint,
) => {
if (
side == 'upper' &&
cu... | /**
* Find either the closest snap point above or under the given offset.
* @param side - Whether to find the closest snap point above or under the given offset.
* @param snapPoints - The snap points to search through.
* @param offset - The current offset.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/drawer/src/lib.ts#L122-L151 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | OtpFieldInput | const OtpFieldInput = <T extends ValidComponent = 'input'>(
props: DynamicProps<T, OtpFieldInputProps<T>>,
) => {
const defaultedProps = mergeProps(
{
pattern: '^\\d*$',
noScriptCSSFallback: DEFAULT_NOSCRIPT_CSS_FALLBACK,
},
props as OtpFieldInputProps,
)
const [localProps, otherProps] =... | /** The hidden input element for the OTP Field.
*
* @data `data-corvu-otp-field-input` - Present on every OTP Field input element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/otp-field/src/Input.tsx#L69-L403 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverAnchor | const PopoverAnchor = <T extends ValidComponent = 'div'>(
props: DynamicProps<T, PopoverAnchorProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as PopoverAnchorProps, [
'contextId',
'ref',
])
const context = createMemo(() =>
useInternalPopoverContext(localProps.contextId),
)
... | /** Anchor element to override the floating reference.
*
* @data `data-corvu-popover-anchor` - Present on every popover anchor element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Anchor.tsx#L30-L52 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverArrow | const PopoverArrow = <T extends ValidComponent = 'div'>(
props: DynamicProps<T, PopoverArrowProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as PopoverArrowProps, [
'contextId',
'ref',
])
const context = createMemo(() =>
useInternalPopoverContext(localProps.contextId),
)
ret... | /** Arrow element that automatically points towards the floating reference. Comes with a default arrow svg, but can be overridden by providing your own as the children.
*
* @data `data-corvu-popover-arrow` - Present on every popover arrow element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Arrow.tsx#L44-L65 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverClose | const PopoverClose = <T extends ValidComponent = 'button'>(
props: DynamicProps<T, PopoverCloseProps<T>>,
) => {
return (
<Dialog.Close<
Component<Omit<PopoverCloseElementProps, keyof DialogCloseElementProps>>
>
// === ElementProps ===
data-corvu-popover-close=""
// === Misc ===
... | /** Close button that changes the open state to false when clicked.
*
* @data `data-corvu-popover-close` - Present on every popover close element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Close.tsx#L26-L40 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverContent | const PopoverContent = <T extends ValidComponent = 'div'>(
props: DynamicProps<T, PopoverContentProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as PopoverContentProps, [
'forceMount',
'contextId',
'style',
])
const context = createMemo(() =>
useInternalPopoverContext(localPr... | /** Content of the popover. Can be animated.
*
* @data `data-corvu-popover-content` - Present on every popover content element.
* @data `data-open` - Present when the popover is open.
* @data `data-closed` - Present when the popover is closed.
* @data `data-placement` - Current placement of the popover.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Content.tsx#L39-L77 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverDescription | const PopoverDescription = <T extends ValidComponent = 'p'>(
props: DynamicProps<T, PopoverDescriptionProps<T>>,
) => {
return (
<Dialog.Description<
Component<
Omit<
PopoverDescriptionElementProps,
keyof DialogDescriptionElementProps
>
>
>
// === Elemen... | /** Description element to announce the popover to accessibility tools.
*
* @data `data-corvu-popover-description` - Present on every popover description element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Description.tsx#L28-L47 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverLabel | const PopoverLabel = <T extends ValidComponent = 'h2'>(
props: DynamicProps<T, PopoverLabelProps<T>>,
) => {
return (
<Dialog.Label<
Component<Omit<PopoverLabelElementProps, keyof DialogLabelElementProps>>
>
// === ElementProps ===
data-corvu-popover-label=""
// === Misc ===
da... | /** Label element to announce the popover to accessibility tools.
*
* @data `data-corvu-popover-label` - Present on every popover label element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Label.tsx#L25-L39 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverOverlay | const PopoverOverlay = <T extends ValidComponent = 'div'>(
props: DynamicProps<T, PopoverOverlayProps<T>>,
) => {
return (
<Dialog.Overlay<
Component<
Omit<PopoverOverlayElementProps, keyof DialogOverlayElementProps>
>
>
// === ElementProps ===
data-corvu-popover-overlay=""
... | /** Component which can be used to create a faded background. Can be animated.
*
* @data `data-corvu-popover-overlay` - Present on every popover overlay element.
* @data `data-open` - Present when the popover is open.
* @data `data-closed` - Present when the popover is closed.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Overlay.tsx#L27-L43 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverRoot | const PopoverRoot: Component<PopoverRootProps> = (props) => {
const defaultedProps = mergeProps(
{
placement: 'bottom' as const,
strategy: 'absolute' as const,
floatingOptions: {
flip: true,
shift: true,
},
modal: false,
closeOnOutsidePointer: true,
},
p... | /** Context wrapper for the popover. Is required for every popover you create. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Root.tsx#L65-L167 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | PopoverTrigger | const PopoverTrigger = <T extends ValidComponent = 'button'>(
props: DynamicProps<T, PopoverTriggerProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as PopoverTriggerProps, [
'ref',
'contextId',
])
const dialogContext = createMemo(() =>
Dialog.useContext(localProps.contextId),
)... | /** Button that changes the open state of the popover when clicked.
*
* @data `data-corvu-popover-trigger` - Present on every popover trigger element.
* @data `data-open` - Present when the popover is open.
* @data `data-closed` - Present when the popover is closed.
* @data `data-placement` - Current placement of ... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/popover/src/Trigger.tsx#L39-L74 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | registerHandle | const registerHandle = (handle: Handle): HandleCallbacks => {
handles.push(handle)
for (const handle of handles) {
for (const compareHandle of handles) {
if (
handle.orientation === compareHandle.orientation ||
handle.element === compareHandle.element
) {
continue
}
... | /**
* Registers a resize handle and returns callback functions to handle drag events.
* Handles need to be registered globally so we can detect intersections across resizable instances.
* The cursor style has to be handled globally too.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/resizable/src/lib/handleManager.ts#L25-L148 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | getDistributablePercentage | const getDistributablePercentage = (props: {
desiredPercentage: number
initialSizes: number[]
collapsible: boolean
resizeActions: {
precedingPanels: PanelInstance[]
followingPanels: PanelInstance[]
negate?: boolean
}[]
resizableData: {
rootSize: number
}
}) => {
let distributablePercenta... | /**
* Calculates the distributable percentage for the given desired percentage and resize actions.
* @param desiredPercentage - The desired percentage to distribute.
* @param initialSizes - The initial sizes of the panels.
* @param collapsible - Whether the panels are allowed to collapse to distribute the percentag... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/resizable/src/lib/resize.ts#L15-L100 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | distributePercentage | const distributePercentage = (props: {
desiredPercentage: number
side: 'preceding' | 'following'
panels: PanelInstance[]
initialSizes: number[]
initialSizesStartIndex: number
collapsible: boolean
rootSize: number
}): [number, number[], boolean] => {
props.desiredPercentage = fixToPrecision(props.desired... | /**
* Tries to distribute the desired percentage to the given panels. Doesn't actually resize the panels and is used to calculate the distributable percentage.
* @param desiredPercentage - The desired percentage to distribute.
* @param side - Whether the panels are preceding or following the handle.
* @param panels... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/resizable/src/lib/resize.ts#L113-L267 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | getResizeDirection | const getResizeDirection = (props: {
side: 'preceding' | 'following'
desiredPercentage: number
}) => {
switch (props.side) {
case 'preceding':
return props.desiredPercentage >= 0
? 'precedingIncreasing'
: 'precedingDecreasing'
case 'following':
return props.desiredPercentage >=... | /**
* Figure out the resize direction based on the desired percentage and side.
* @param side - Whether the panels to resize are preceding or following the handle.
* @param desiredPercentage - The desired percentage to resize.
* @returns 'precedingIncreasing' | 'precedingDecreasing' | 'followingIncreasing' | 'follo... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/resizable/src/lib/resize.ts#L275-L289 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | resize | const resize = (props: {
initialSizes: number[]
collapsible: boolean
resizeActions: {
precedingPanels: PanelInstance[]
followingPanels: PanelInstance[]
deltaPercentage: number
}[]
resizableData: {
rootSize: number
orientation: 'horizontal' | 'vertical'
setSizes: Setter<number[]>
}
})... | /**
* Resizes panels based on given resize actions.
* @param initialSizes - The initial sizes of the panels.
* @param collapsible - Whether the panels are allowed to collapse to distribute the percentage.
* @param resizeActions - The resize actions to distribute the percentage.
* @param resizableData - Data relate... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/resizable/src/lib/resize.ts#L298-L346 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | resizePanel | const resizePanel = (props: {
deltaPercentage: number
strategy: ResizeStrategy
panel: PanelInstance
panels: PanelInstance[]
initialSizes: number[]
collapsible: boolean
resizableData: {
rootSize: number
orientation: 'horizontal' | 'vertical'
setSizes: Setter<number[]>
}
}) => {
let [precedi... | /**
* Resizes a panel by using the given strategy.
* @param deltaPercentage - The delta percentage to resize the panel.
* @param strategy - The resize strategy to apply.
* @param panel - The panel to resize.
* @param panels - The panels to resize.
* @param initialSizes - The initial sizes of the panels.
* @param... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/resizable/src/lib/resize.ts#L358-L465 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | deltaResize | const deltaResize = (props: {
deltaPercentage: number
altKey: boolean
handle: HTMLElement
panels: PanelInstance[]
initialSizes: number[]
resizableData: {
rootSize: number
handleCursorStyle: boolean
orientation: 'horizontal' | 'vertical'
setSizes: Setter<number[]>
}
}) => {
if (props.altK... | /**
* Resizes panels based on the given delta percentage. Supports alt key resize mode.
* @param deltaPercentage - The delta percentage to resize the panels.
* #param altKey - Whether the alt key is pressed.
* @param handle - The handle that is being dragged.
* @param panels - The panels to resize.
* @param initi... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/resizable/src/lib/resize.ts#L476-L645 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | Dismissible | const Dismissible: Component<DismissibleProps> = (props) => {
const defaultedProps = mergeProps(
{
dismissibleId: createUniqueId(),
},
props,
)
const memoizedDismissible = createMemo(() => {
const dismissibleContext = useContext(DismissibleContext)
if (dismissibleContext) {
return... | /** A component that can be dismissed by pressing the escape key or clicking outside of it. Can be nested. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-dismissible/src/Dismissible.tsx#L45-L85 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createDismissible | const createDismissible = (props: CreateDismissibleProps) => {
const defaultedProps = mergeProps(
{
dismissOnEscapeKeyDown: true,
dismissOnOutsideFocus: true,
dismissOnOutsidePointer: true,
outsidePointerStrategy: 'pointerup' as const,
noOutsidePointerEvents: true,
},
props,
... | /**
* Creates a dismissible element that can be dismissed by pressing the escape key or clicking/focusing outside of the element.
*
* @param props.element - The element to make dismissible.
* @param props.onDismiss - Callback fired when the element is being dismissed.
* @param props.dismissOnEscapeKeyDown - Whethe... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-dismissible/src/create/dismissible.ts#L73-L131 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createEscapeKeyDown | const createEscapeKeyDown = (props: {
enabled?: MaybeAccessor<boolean>
onEscapeKeyDown: (event: KeyboardEvent) => void
}) => {
const defaultedProps = mergeProps(
{
enabled: true,
},
props,
)
createEffect(() => {
if (!access(defaultedProps.enabled)) {
return
}
document.add... | /**
* Listens for the escape key to be pressed and calls the `onEscapeKeyDown` callback.
*
* @param props.enabled - Whether the listener is enabled. *Default = `true`*
* @param props.onEscapeKeyDown - Callback fired when the escape key is pressed.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-dismissible/src/create/escapeKeyDown.ts#L10-L38 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createNoPointerEvents | const createNoPointerEvents = (props: { enabled?: MaybeAccessor<boolean> }) => {
const defaultedProps = mergeProps(
{
enabled: true,
},
props,
)
createEffect(() => {
const { body } = document
if (!access(defaultedProps.enabled)) return
createStyle({
key: 'no-pointer-events',... | /**
* Disables pointer events on the `<body>` element.
*
* @param props.enabled - Whether pointer events should be disabled. * Default = `true`*
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-dismissible/src/create/noPointerEvents.ts#L10-L31 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createOutsideFocus | const createOutsideFocus = (props: {
element: MaybeAccessor<HTMLElement | null>
enabled?: MaybeAccessor<boolean>
onFocus: (event: CustomEvent) => void
ignorePointerEvents?: MaybeAccessor<boolean>
}) => {
const defaultedProps = mergeProps(
{
enabled: true,
ignorePointerEvents: false,
},
... | /**
* Calls the `onFocus` callback when a `focusin` event occurs outside of the given element.
*
* @param props.element - The element to check if the focus event occurred inside of.
* @param props.enabled - Whether the listener is enabled. *Default = `true`*
* @param props.onFocus - Callback fired when a focus eve... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-dismissible/src/create/outsideFocus.ts#L16-L68 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createOutsidePointer | const createOutsidePointer = (props: {
element: MaybeAccessor<HTMLElement | null>
enabled?: MaybeAccessor<boolean>
strategy?: MaybeAccessor<'pointerdown' | 'pointerup'>
ignore?: MaybeAccessor<(HTMLElement | null)[]>
onPointer: (event: PointerEvent) => void
}) => {
const defaultedProps = mergeProps(
{
... | /**
* Calls the `onPointer` callback when a `pointerdown` or `pointerup` event occurs outside of the given element.
*
* @param props.element - The element to check if the pointer down event occurred inside of.
* @param props.enabled - Whether the listener is enabled. *Default = `true`*
* @param props.strategy - Wh... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-dismissible/src/create/outsidePointer.ts#L14-L60 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createFocusTrap | const createFocusTrap = (props: {
element: MaybeAccessor<HTMLElement | null>
enabled?: MaybeAccessor<boolean>
observeChanges?: MaybeAccessor<boolean>
initialFocusElement?: MaybeAccessor<HTMLElement | null>
restoreFocus?: MaybeAccessor<boolean>
finalFocusElement?: MaybeAccessor<HTMLElement | null>
onInitia... | /**
* Traps focus inside the given element. Is aware of changes being made to the DOM tree inside the focus trap by using a `MutationObserver`.
*
* @param props.element - Element to trap focus in.
* @param props.enabled - If the focus trap is enabled. *Default = `true`*
* @param props.observeChanges - Whether to w... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-focus-trap/src/focusTrap.ts#L31-L235 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createList | const createList = <T>(props: {
items: MaybeAccessor<T[]>
initialActive?: T | null
orientation?: MaybeAccessor<'vertical' | 'horizontal'>
loop?: MaybeAccessor<boolean>
textDirection?: MaybeAccessor<'ltr' | 'rtl'>
handleTab?: MaybeAccessor<boolean>
vimMode?: MaybeAccessor<boolean>
vimKeys?: MaybeAccessor... | /**
* Creates a keyboard navigable list.
*
* @param props.items The items in the list. Should be in the same order as they appear in the DOM.
* @param props.initialActive The initially active item. *Default = `null`*
* @param props.orientation The orientation of the list. *Default = `'vertical'`*
* @param props.l... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-list/src/list.ts#L25-L150 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createMultiList | const createMultiList = <T>(props: {
items: MaybeAccessor<T[]>
initialCursor?: T | null
initialActive?: T[]
initialSelected?: T[]
orientation?: MaybeAccessor<'vertical' | 'horizontal'>
loop?: MaybeAccessor<boolean>
textDirection?: MaybeAccessor<'ltr' | 'rtl'>
handleTab?: MaybeAccessor<boolean>
vimMode... | /**
* Creates a keyboard navigable multiselect list.
*
* @param props.items The items in the list. Should be in the same order as they appear in the DOM.
* @param props.initialCursor The initially focused item. *Default = `null`*
* @param props.initialActive The initially active items. *Default = `[]`*
* @param p... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-list/src/multi-list.ts#L35-L256 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createPersistent | const createPersistent = (component: () => JSX.Element) => {
let owner: Owner
let memoizedComponent: Accessor<JSX.Element> | undefined
return () => {
if (!memoizedComponent) {
const currentOwner = getOwner()
if (currentOwner) owner = { ...currentOwner }
memoizedComponent = createMemo(() => ... | /**
* Creates a persistent component that keeps its state and elements cached when removed from the DOM.
* @param component The component to persist.
* @returns An accessor that returns the persisted component.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-persistent/src/persistent.ts#L15-L27 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createPresence | const createPresence = (props: {
show: MaybeAccessor<boolean>
element: MaybeAccessor<HTMLElement | null>
onStateChange?: (state: 'present' | 'hiding' | 'hidden') => void
}): {
present: Accessor<boolean>
state: Accessor<'present' | 'hiding' | 'hidden'>
} => {
const refStyles = createMemo(() => {
const el... | /**
* Manages the presence of an element in the DOM while being aware of pending animations.
*
* @param props.show - Whether the presence is showing.
* @param props.element - The element which animations should be tracked.
* @param props.onStateChange - Callback fired when the presence state changes.
* @returns `... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-presence/src/presence.ts#L23-L122 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createPreventScroll | const createPreventScroll = (props: {
element?: MaybeAccessor<HTMLElement | null>
enabled?: MaybeAccessor<boolean>
hideScrollbar?: MaybeAccessor<boolean>
preventScrollbarShift?: MaybeAccessor<boolean>
preventScrollbarShiftMode?: MaybeAccessor<'padding' | 'margin'>
restoreScrollPosition?: MaybeAccessor<boole... | /**
* Prevents scroll outside of the given element.
*
* @param props.element - Prevent scroll outside of this element. If the element is `null`, scroll will be prevented on the whole page. *Default = `null`*
* @param props.enabled - Whether scroll should be prevented. *Default = `true`*
* @param props.hideScrollba... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-prevent-scroll/src/preventScroll.ts#L36-L224 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | wouldScroll | const wouldScroll = (
target: HTMLElement,
axis: Axis,
delta: number,
wrapper: HTMLElement | null,
) => {
const targetInWrapper = wrapper !== null && contains(wrapper, target)
const [availableScroll, availableScrollTop] = getScrollAtLocation(
target,
axis,
targetInWrapper ? wrapper : undefined,... | /**
* Checks whether a certain delta on a target would result in scrolling on the given axis.
*
* @param target - The target element.
* @param delta - The delta to check.
* @param axis - The axis to check.
* @param wrapper - The wrapper element. If the target is contained in the wrapper, the function will check i... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/solid-prevent-scroll/src/preventScroll.ts#L245-L268 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | TooltipAnchor | const TooltipAnchor = <T extends ValidComponent = 'div'>(
props: DynamicProps<T, TooltipAnchorProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as TooltipAnchorProps, [
'contextId',
'ref',
])
const context = createMemo(() =>
useInternalTooltipContext(localProps.contextId),
)
... | /** Anchor element to override the floating reference.
*
* @data `data-corvu-tooltip-anchor` - Present on every tooltip anchor element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/tooltip/src/Anchor.tsx#L30-L52 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | TooltipArrow | const TooltipArrow = <T extends ValidComponent = 'div'>(
props: DynamicProps<T, TooltipArrowProps<T>>,
) => {
const [localProps, otherProps] = splitProps(props as TooltipArrowProps, [
'contextId',
'ref',
])
const context = createMemo(() =>
useInternalTooltipContext(localProps.contextId),
)
ret... | /** Arrow element that automatically points towards the floating reference. Comes with a default arrow svg, but can be overridden by providing your own as the children.
*
* @data `data-corvu-tooltip-arrow` - Present on every tooltip arrow element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/tooltip/src/Arrow.tsx#L43-L64 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | TooltipPortal | const TooltipPortal = (
props: TooltipPortalProps & ComponentProps<typeof Portal>,
) => {
const [localProps, otherProps] = splitProps(props, [
'forceMount',
'contextId',
])
const context = createMemo(() =>
useInternalTooltipContext(localProps.contextId),
)
const show = () =>
some(context()... | /** Portals its children at the end of the body element to ensure that the tooltip always rendered on top. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/tooltip/src/Portal.tsx#L19-L39 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | isFunction | const isFunction = <T extends Function = Function>(
value: unknown,
): value is T => {
return typeof value === 'function' && value.length > 0
} | /**!
* Original code for "isButton" by Ariakit.
* MIT License, Copyright (c) Diego Haz
*
* https://github.com/ariakit/ariakit/blob/b26cdee02011d2a6b4b544a80842a6fa4ae9e7c5/packages/ariakit-core/src/utils/dom.ts#L90
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/assertions.ts#L9-L13 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | Fragment | const Fragment: Fragment = (props) => <>{props.children}</>
export default Fragment | /** Component that renders its children without a wrapper node. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/components/Fragment.tsx#L6-L8 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createKeyedContext | const createKeyedContext = <T>(key: string, defaultValue?: T) => {
if (keyedContexts.has(key)) {
return keyedContexts.get(key) as Context<T | undefined>
}
const keyedContext = createContext(defaultValue)
keyedContexts.set(key, keyedContext as Context<unknown>)
return keyedContext
} | /**
* Creates a keyed context that can be obtained and used with `getKeyedContext` and `useKeyedContext`.
*
* @param key - The key of the context.
* @param defaultValue - The default value of the context.
* @returns ```typescript
* Context<T | undefined>
* ```
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/keyedContext.ts#L14-L21 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | getKeyedContext | const getKeyedContext = <T>(key: string) => {
const keyedContext = keyedContexts.get(key)
return keyedContext as Context<T | undefined> | undefined
} | /**
* Gets a keyed context created with `createKeyedContext`.
*
* @param key - The key of the context.
* @returns ```typescript
* Context<T | undefined> | undefined
* ```
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/keyedContext.ts#L31-L34 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | useKeyedContext | const useKeyedContext = <T>(key: string) => {
const keyedContext = keyedContexts.get(key)
if (!keyedContext) return undefined
return useContext(keyedContext) as T | undefined
} | /**
* Use a keyed context created with `createKeyedContext` to receive a scoped state from a parent's Context.Provider.
*
* @param key - The key of the context.
* @returns ```typescript
* T | undefined
* ```
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/keyedContext.ts#L44-L48 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createOnce | const createOnce = <T>(fn: () => T) => {
let result: Accessor<T>
let called = false
return () => {
if (called) {
return result
} else {
called = true
return (result = createMemo(fn))
}
}
} | /**
* Creates a memoized signal when called for the first time.
* @param fn - Function to memoize.
* @returns ```typescript
* () => Accessor<T>
* ```
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/once.ts#L10-L21 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createRegister | const createRegister = <T>(props: {
value: MaybeAccessor<T | undefined>
initialRegistered?: boolean
}) => {
const defaultedProps = mergeProps(
{
initialRegistered: false,
},
props,
)
const [isRegistered, setIsRegistered] = createSignal(
defaultedProps.initialRegistered,
)
const regi... | /**
* Creates a memo which can be registered/unregistered with the returned `register` and `unregister` functions.
*
* @param props.value - The value to memoize.
* @param props.initialRegistered - Whether the value should be registered initially. *Default = `false`*
* @returns ```typescript
* [
* registerable:... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/register.ts#L18-L46 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createStyle | const createStyle = (props: {
key: string
element: HTMLElement
style?: MaybeAccessor<Partial<CSSStyleDeclaration>>
properties?: MaybeAccessor<{ key: string; value: string }[]>
cleanup?: () => void
}) => {
createEffect(() => {
const style = access(props.style) ?? {}
const properties = access(props.pr... | /**
* Modifies the given element's style and reverts it back to its original style when `onCleanup` is called.
*
* @param props.key - Styles with the same key will be tracked together and only reverted once all of them are cleaned up.
* @param props.element - The element to modify the style of.
* @param props.styl... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/style.ts#L22-L79 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | createTagName | const createTagName = (props: {
element: MaybeAccessor<HTMLElement | null>
fallback: string
}) => {
const tagName = createMemo(
() => access(props.element)?.tagName.toLowerCase() ?? props.fallback,
)
return tagName
} | /**
* Returns a memoized signal with the tag name of the element.
*
* @param props.element - The element to get the tag name of.
* @param props.fallback - The fallback tag name to use if the element is `null`.
* @returns ```typescript
* Accessor<string>
* ```
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/tagName.ts#L13-L22 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | calculateSafeAreaPolygon | const calculateSafeAreaPolygon = (points: Point[]) => {
points.sort((a, b) => {
if (a.x < b.x) return -1
else if (a.x > b.x) return +1
else if (a.y < b.y) return -1
else if (a.y > b.y) return +1
else return 0
})
if (points.length <= 1) return points
const upperHull: Point[] = []
for (cons... | // Convex hull algorithm | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/create/tooltip.ts#L393-L441 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | contains | const contains = (wrapper: HTMLElement, target: HTMLElement) => {
if (wrapper.contains(target)) return true
let currentElement: HTMLElement | null = target
while (currentElement) {
if (currentElement === wrapper) return true
// @ts-expect-error: _$host is a custom SolidJS property
currentElement = cur... | /**
* Checks whether an element contains another element.
* Works with SolidJS portals by using their `_$host` property.
*
* @param wrapper - The wrapper element that should contain the target element.
* @param target - The target element.
* @returns Whether the wrapper contains the target element.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/dom/lib.ts#L57-L66 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | Dynamic | const Dynamic = <ElementProps,>(
props: DynamicAttributes<ValidComponent> & ElementProps,
) => {
const [localProps, otherProps] = splitProps(props, ['as'])
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
const cached = createMemo<Function | string>(() => localProps.as ?? 'div')
const m... | /** corvu's version of Solid's `Dynamic` component. Renders as a div by default and can be overridden with the `as` property. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/dynamic/Dynamic.tsx#L12-L30 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | DynamicButton | const DynamicButton = <T extends ValidComponent = 'button'>(
props: DynamicProps<T, DynamicButtonProps<T>>,
) => {
const [ref, setRef] = createSignal<HTMLElement | null>(null)
const [localProps, otherProps] = splitProps(
props as DynamicButtonProps<'button'>,
['ref', 'type'],
)
const tagName = creat... | /** An accessible button that sets `type` and `role` properly based on if it's a native button. */ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/dynamic/DynamicButton.tsx#L30-L60 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | getScrollDimensions | const getScrollDimensions = (
element: HTMLElement,
axis: Axis,
): [number, number, number] => {
switch (axis) {
case 'x':
return [element.clientWidth, element.scrollLeft, element.scrollWidth]
case 'y':
return [element.clientHeight, element.scrollTop, element.scrollHeight]
}
} | /**
* Returns the scroll dimensions of the given element on the given axis.
*
* @param element - The element to check.
* @param axis - The axis to check for.
* @returns The scroll dimensions of the element. `[clientSize, scrollOffset, scrollSize]`
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/scroll/lib.ts#L10-L20 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | isScrollContainer | const isScrollContainer = (element: HTMLElement, axis: Axis | 'both') => {
const styles = getComputedStyle(element)
const overflow = axis === 'x' ? styles.overflowX : styles.overflowY
return (
overflow === 'auto' ||
overflow === 'scroll' ||
// The HTML element is a scroll container if it has overflow... | /**
* Returns true if the given element is a scroll container on the given axis. Scroll containers are elements with `overflow` set to `auto` or `scroll`.
*
* @param element - The element to check.
* @param axis - The axis to check for.
* @returns Whether the element is a scroll container.
*/ | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/scroll/lib.ts#L29-L39 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | getScrollAtLocation | const getScrollAtLocation = (
location: HTMLElement,
axis: Axis,
stopAt?: HTMLElement,
) => {
const directionFactor =
axis === 'x' && window.getComputedStyle(location).direction === 'rtl'
? -1
: 1
let currentElement: HTMLElement | null = location
let availableScroll = 0
let availableScrol... | /**
* Returns the total scroll available at the given location.
*
* @param location - The HTMLElement to check.
* @param axis - The axis to check for.
* @param stopAt - The HTMLElement to stop at when searching up the tree for scrollable elements. Defaults to the body element. Works with SolidJS portals by using t... | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/packages/utils/src/scroll/lib.ts#L49-L88 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
corvu | github_2023 | corvudev | typescript | resolveTypeTopLevel | const resolveTypeTopLevel = (
type: Type,
nestLevel = 1,
parameters?: ParamVariant[],
): string => {
let typeName = ''
if (parameters) {
const params: {
name: string
type: string
}[] = []
for (const parameter of parameters) {
params.push({
name: parameter.name,
ty... | // Resolve type but don't resolve references | https://github.com/corvudev/corvu/blob/dd6ba1d11bb611bfeee991193e95ec9f1de25c87/web/src/lib/typedoc/resolve/lib.ts#L100-L235 | dd6ba1d11bb611bfeee991193e95ec9f1de25c87 |
overlayed | github_2023 | overlayeddev | typescript | isTelemetryEnabled | const isTelemetryEnabled = () => {
return import.meta.env.VITE_AXIOM_TOKEN && Config.get("telemetry");
}; | // NOTE: allow opt-out of tracking from the settings UI | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/metrics.ts#L21-L23 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | sortUserList | const sortUserList = (myId: string | undefined, users: VoiceStateUser[]) => {
const sortedUserArray = Object.entries(users).sort((a, b) => {
if (a[1].user.id === myId) return -1;
if (b[1].user.id === myId) return 1;
// THIS Is for lexicographical sorting
return a[1].nick.localeCompare(b[1].nick);
}... | // sort discord users by name and myself on top | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/store.ts#L57-L72 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | sortOverlayedUsers | const sortOverlayedUsers = (myId: string | undefined, users: Record<string, OverlayedUser>) => {
const sortedUserArray = Object.entries(users).sort((a, b) => {
if (a[1].id === myId) return -1;
if (b[1].id === myId) return 1;
// THIS Is for lexicographical sorting
return a[1].username.localeCompare(b[... | // sort internal app state users by name and me on top | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/store.ts#L75-L90 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | renderCheeseMicIcon | function renderCheeseMicIcon() {
let icon = null;
if (selfMuted) {
icon = <MicOff className={muted ? "fill-red-600" : "fill-neutral-400"} />;
}
if (selfDeafened) {
icon = <HeadphonesOff className={deafened ? "fill-red-600" : "fill-neutral-400"} />;
}
if (muted) {
icon = <Mic... | // TODO: use tw merge so this looks better i guess | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/components/user.tsx#L25-L55 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.init | async init(navigate: NavigateFunction) {
console.log("Init web socket manager");
this.disconnect();
this._navigate = navigate;
this.version = await getVersion();
const connectionUrl = `${WEBSOCKET_URL}/?v=1&client_id=${APP_ID}`;
try {
this.socket = await WebSocket.connect(connectionUrl, ... | /**
* Setup the websocket connection and listen for messages
*/ | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L105-L137 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.store | private get store(): AppState & AppActions {
return appStore.getState();
} | // we have to call the store to get the latest values | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L145-L147 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.authenticate | private authenticate() {
this.send({
args: {
client_id: APP_ID,
scopes: [
"identify",
"rpc",
// TODO: when we need soundboard we can enable these scopes
// "guilds",
// "rpc.notifications.read",
// TODO: how do you use other scopes 🤔... | /**
* Authenticate with discord by having the user approve the app
*/ | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L152-L174 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.unpin | private async unpin() {
// unpin the overlay if there is an error
return invoke("set_pin", {
value: false,
});
} | // TODO: this could live as a generic util and not on this class if we ever need it elsewhere | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L184-L189 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.onMessage | private async onMessage(event: Message) {
// TODO: this has to be a bug in the upstream lib, we should get a proper code
// and not have to check the raw dawg string to see if something is wrong
if (typeof event === "string" && (event as string).includes("Connection reset without closing handshake")) {
... | /**
* Message listener when we get message from discord
* @param payload a JSON object of the parsed message
*/ | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L195-L390 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.requestUserChannel | private requestUserChannel() {
this.send({
cmd: RPCCommand.GET_SELECTED_VOICE_CHANNEL,
});
} | /**
* Request to get the current channel the user is in
* The client will respond with the GET_SELECTED_VOICE_CHANNEL event
*
*/ | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L397-L401 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.getSoundBoardItems | public async getSoundBoardItems() {
await this.send({
cmd: RPCCommand.GET_SOUNDBOARD_SOUNDS,
});
return this.soundBoardItemsResolver.promise;
} | /** Get the soundboard items */ | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L404-L410 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.send | public send(payload: DiscordPayload) {
return this.socket?.send(
JSON.stringify({
...payload,
nonce: uuid.v4(),
})
);
} | /**
* Send a message to discord
* @param payload {DiscordPayload} the payload to send
*/ | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L416-L423 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | SocketManager.channelEvents | channelEvents(cmd: RPCCommand.SUBSCRIBE | RPCCommand.UNSUBSCRIBE, channelId: string) {
SUBSCRIBABLE_EVENTS.forEach(eventName =>
this.send({
cmd,
args: { channel_id: channelId },
evt: eventName,
})
);
} | /**
* These method will allow you to sub/unsub to channel events
* that are defined in SUBSCRIBABLE_EVENTS
* @param cmd {RPCCommand} SUBSCRIBE or SUBSCRIBE
* @param channelId The channel to subscribe to events in
*/ | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/rpc/manager.ts#L431-L439 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
overlayed | github_2023 | overlayeddev | typescript | onStorageChange | const onStorageChange = (e: StorageEvent) => {
if (e.key === "user_data" && e.newValue) {
setUser(JSON.parse(e.newValue));
}
if (e.key === "discord_access_token_expiry" && e.newValue) {
setTokenExpires(e.newValue);
}
}; | // TODO: these should have keys that are shared from perhaps and abstraction | https://github.com/overlayeddev/overlayed/blob/f01f51813bbacf6252586d631b11619d0bbb96f9/apps/desktop/src/views/settings/account.tsx#L112-L120 | f01f51813bbacf6252586d631b11619d0bbb96f9 |
my-fingerprint | github_2023 | omegaee | typescript | genDefaultLocalStorage | const genDefaultLocalStorage = (): LocalStorage => {
const manifest = chrome.runtime.getManifest()
const defaultHook: DefaultHookMode = { type: HookType.default }
const browserHook: RandomHookMode = { type: HookType.browser }
const customSeed = genRandomSeed();
return {
version: manifest.version,
con... | /**
* 生成默认配置
*/ | https://github.com/omegaee/my-fingerprint/blob/5177a7f0e061bef5ca76e08cd4aa5e9ecf61ff04/src/background/index.ts#L37-L79 | 5177a7f0e061bef5ca76e08cd4aa5e9ecf61ff04 |
my-fingerprint | github_2023 | omegaee | typescript | getLocalStorage | const getLocalStorage = async (): Promise<LocalStorageObject> => {
if (localStorage) {
return localStorage
} else {
return await initLocalConfig()
}
} | /**
* 获取配置
*/ | https://github.com/omegaee/my-fingerprint/blob/5177a7f0e061bef5ca76e08cd4aa5e9ecf61ff04/src/background/index.ts#L105-L111 | 5177a7f0e061bef5ca76e08cd4aa5e9ecf61ff04 |
my-fingerprint | github_2023 | omegaee | typescript | getNewVersion | const getNewVersion = async () => {
if (newVersion) {
return newVersion
} else {
const data = await fetch('https://api.github.com/repos/omegaee/my-fingerprint/releases/latest').then(data => data.json())
newVersion = data.tag_name
return newVersion
}
} | /**
* 获取最新版本号
*/ | https://github.com/omegaee/my-fingerprint/blob/5177a7f0e061bef5ca76e08cd4aa5e9ecf61ff04/src/background/index.ts#L116-L124 | 5177a7f0e061bef5ca76e08cd4aa5e9ecf61ff04 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.