This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* FilterArray | |
* FilterArray filters the values of an array (generic 1) according to a type (generic 2) | |
*/ | |
export type FilterArray<T extends readonly any[], V> = T extends readonly [infer L, ...infer R] | |
? L extends V | |
? [L, ...FilterArray<R, V>] | |
: [...FilterArray<R, V>] | |
: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generated by dts-bundle v0.7.3 | |
// Dependencies for this module: | |
// ../solid-js/jsx-runtime | |
// ../three | |
// ../utility-types | |
// ../solid-js | |
// ../solid-js/store | |
declare module 'solid-three' { | |
import * as ReactThreeFiber from 'solid-three/three-types'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Vector } from '@ndbx/types'; | |
import { MouseEvent as MouseEventReact } from 'react'; | |
/** | |
* cursor | |
* | |
* @param e MouseEvent | |
* @param callback called every onMouseMove | |
* @returns Promise resolved onMouseUp | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Accessor } from 'solid-js' | |
export function when< | |
TAccessors extends Array<Accessor<any>>, | |
const TValues extends { [TKey in keyof TAccessors]: Exclude<ReturnType<TAccessors[TKey]>, null | undefined | false> } | |
>(...accessors: TAccessors) { | |
function callback<const TResult>(): TValues | undefined | |
function callback<const TResult>(callback: (...values: TValues) => TResult): TResult | undefined | |
function callback<const TResult>(callback?: (...values: TValues) => TResult) { | |
const values = new Array(accessors.length) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const genPadding = (layer: number) => | |
new Array(layer).fill(" ").flat().join(""); | |
function genObject({object}: any, layer: number) { | |
const entries = Object.entries(object); | |
let result = "{\n"; | |
const padding = genPadding(layer); | |
for (const [key, value] of entries) { | |
result += padding; | |
result += `${key}: ${valibotToTs(value, layer + 1)},\n`; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
onCleanup, | |
createMemo, | |
createSignal, | |
type Accessor, | |
createEffect, | |
createResource, | |
} from "solid-js"; | |
function modifyImportPaths(code) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import ts from 'typescript' | |
type Accessor<T> = () => T | |
const tsModules: Record<string, { content: string; version: number }> = {} | |
function modifyImportPaths(code: string) { | |
return code.replace(/import ([^"']+) from ["']([^"']+)["']/g, (match, varName, path) => { | |
if (path.startsWith('blob:') || path.startsWith('http:') || path.startsWith('https:') || path.startsWith('.')) { | |
return `import ${varName} from "${path}"` | |
} else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ArrayInPlace<T = number> extends Array { | |
commands: Command<T>[] = []; | |
constructor(values: T[]) { | |
super(); | |
for (let i = 0; i < Math.floor(values.length / 100_000); i++) { | |
Array.prototype.push.apply( | |
this, | |
values.slice(i * 100_000, (i + 1) * 100_000), | |
); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* array extended with mutable/in-place array-methods | |
*/ | |
class ArrayInPlace<T = number> extends Array { | |
commands: Command<T>[] = []; | |
constructor(values: T[]) { | |
super(); | |
Array.prototype.push.apply(this, values); | |
} |
OlderNewer