//#region ../../node_modules/.pnpm/maverick.js@0.44.1/node_modules/maverick.js/dist/dev/index.d.ts //#region ../../node_modules/.pnpm/@maverick-js+signals@6.0.0/node_modules/@maverick-js/signals/dist/types/symbols.d.ts declare const SCOPE: unique symbol; //#endregion //#region ../../node_modules/.pnpm/@maverick-js+signals@6.0.0/node_modules/@maverick-js/signals/dist/types/types.d.ts interface Computation extends Scope { id?: string | undefined; /** @internal */ _effect: boolean; /** @internal */ _init: boolean; /** @internal */ _value: T; /** @internal */ _sources: Computation[] | null; /** @internal */ _observers: Computation[] | null; /** @internal */ _compute: (() => T) | null; /** @internal */ _changed: (prev: T, next: T) => boolean; /** read */ call(this: Computation): T; } interface ReadSignal { (): T; /** only available during dev. */ node?: Computation; } interface SignalOptions { id?: string; dirty?: (prev: T, next: T) => boolean; } interface WriteSignal extends ReadSignal { /** only available during dev. */ node?: Computation; set: (value: T | NextValue) => T; } interface NextValue { (prevValue: T): T; } interface Scope { [SCOPE]: Scope | null; /** @internal */ _state: number; /** @internal */ _compute: unknown; /** @internal */ _children: Scope | Scope[] | null; /** @internal */ _context: ContextRecord | null; /** @internal */ _handlers: ErrorHandler[] | null; /** @internal */ _disposal: Disposable | Disposable[] | null; append(scope: Scope): void; dispose(): void; } interface Dispose { (): void; } interface Disposable extends Callable {} interface StopEffect { (): void; } interface Callable { call($this: This): Return; } type Maybe = T | void | null | undefined | false; type MaybeStopEffect = Maybe; type ContextRecord = Record; interface ErrorHandler { (error: T): void; } //#endregion //#region ../../node_modules/.pnpm/@maverick-js+signals@6.0.0/node_modules/@maverick-js/signals/dist/types/core.d.ts /** * Creates a computation root which is given a `dispose()` function to dispose of all inner * computations. * * @see {@link https://github.com/maverick-js/signals#root} */ //#endregion //#region src/std/types.d.ts type Equals = (() => T extends X ? 1 : 2) extends (() => (T extends Y ? 1 : 2)) ? A : B; type WritableKeys = NonNullable<{ [P in keyof T]-?: Equals<{ [Q in P]: T[P] }, { -readonly [Q in P]: T[P] }, P> }>[keyof T]; type PickWritable = Pick>; type PickReadonly = Omit>; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/basic.d.ts /** Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes). @category Class */ type Constructor = new (...arguments_: Arguments) => T; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/observable-like.d.ts declare global { // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged. interface SymbolConstructor { readonly observable: symbol; } } /** @remarks The TC39 observable proposal defines a `closed` property, but some implementations (such as xstream) do not as of 10/08/2021. As well, some guidance on making an `Observable` to not include `closed` property. @see https://github.com/tc39/proposal-observable/blob/master/src/Observable.js#L129-L130 @see https://github.com/staltz/xstream/blob/6c22580c1d84d69773ee4b0905df44ad464955b3/src/index.ts#L79-L85 @see https://github.com/benlesh/symbol-observable#making-an-object-observable @category Observable */ //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/optional-keys-of.d.ts /** Extract all optional keys from the given type. This is useful when you want to create a new type that contains different type values for the optional keys only. @example ``` import type {OptionalKeysOf, Except} from 'type-fest'; interface User { name: string; surname: string; luckyNumber?: number; } const REMOVE_FIELD = Symbol('remove field symbol'); type UpdateOperation = Except, OptionalKeysOf> & { [Key in OptionalKeysOf]?: Entity[Key] | typeof REMOVE_FIELD; }; const update1: UpdateOperation = { name: 'Alice' }; const update2: UpdateOperation = { name: 'Bob', luckyNumber: REMOVE_FIELD }; ``` @category Utilities */ type OptionalKeysOf$1 = BaseType extends unknown // For distributing `BaseType` ? (keyof { [Key in keyof BaseType as BaseType extends Record ? never : Key]: never }) & (keyof BaseType) // Intersect with `keyof BaseType` to ensure result of `OptionalKeysOf` is always assignable to `keyof BaseType` : never; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/required-keys-of.d.ts /** Extract all required keys from the given type. This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc... @example ``` import type {RequiredKeysOf} from 'type-fest'; declare function createValidation = RequiredKeysOf>(field: Key, validator: (value: Entity[Key]) => boolean): ValidatorFn; interface User { name: string; surname: string; luckyNumber?: number; } const validator1 = createValidation('name', value => value.length < 25); const validator2 = createValidation('surname', value => value.length < 25); ``` @category Utilities */ type RequiredKeysOf$1 = BaseType extends unknown // For distributing `BaseType` ? Exclude> : never; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-never.d.ts /** Returns a boolean for whether the given type is `never`. @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919 @link https://stackoverflow.com/a/53984913/10292952 @link https://www.zhenghao.io/posts/ts-never Useful in type utilities, such as checking if something does not occur. @example ``` import type {IsNever, And} from 'type-fest'; // https://github.com/andnp/SimplyTyped/blob/master/src/types/strings.ts type AreStringsEqual = And< IsNever> extends true ? true : false, IsNever> extends true ? true : false >; type EndIfEqual = AreStringsEqual extends true ? never : void; function endIfEqual(input: I, output: O): EndIfEqual { if (input === output) { process.exit(0); } } endIfEqual('abc', 'abc'); //=> never endIfEqual('abc', '123'); //=> void ``` @category Type Guard @category Utilities */ type IsNever$1 = [T] extends [never] ? true : false; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-never.d.ts /** An if-else-like type that resolves depending on whether the given type is `never`. @see {@link IsNever} @example ``` import type {IfNever} from 'type-fest'; type ShouldBeTrue = IfNever; //=> true type ShouldBeBar = IfNever<'not never', 'foo', 'bar'>; //=> 'bar' ``` @category Type Guard @category Utilities */ type IfNever = (IsNever$1 extends true ? TypeIfNever : TypeIfNotNever); //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/characters.d.ts type Whitespace = '\u{9}' // '\t' | '\u{A}' // '\n' | '\u{B}' // '\v' | '\u{C}' // '\f' | '\u{D}' // '\r' | '\u{20}' // ' ' | '\u{85}' | '\u{A0}' | '\u{1680}' | '\u{2000}' | '\u{2001}' | '\u{2002}' | '\u{2003}' | '\u{2004}' | '\u{2005}' | '\u{2006}' | '\u{2007}' | '\u{2008}' | '\u{2009}' | '\u{200A}' | '\u{2028}' | '\u{2029}' | '\u{202F}' | '\u{205F}' | '\u{3000}' | '\u{FEFF}'; type WordSeparators = '-' | '_' | Whitespace; type AsciiPunctuation = '!' | '"' | '#' | '$' | '%' | '&' | '\'' | '(' | ')' | '*' | '+' | ',' | '-' | '.' | '/' | ':' | ';' | '<' | '=' | '>' | '?' | '@' | '[' | '\\' | ']' | '^' | '_' | '`' | '{' | '|' | '}' | '~'; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-any.d.ts // Can eventually be replaced with the built-in once this library supports // TS5.4+ only. Tracked in https://github.com/sindresorhus/type-fest/issues/848 type NoInfer$1 = T extends infer U ? U : never; /** Returns a boolean for whether the given type is `any`. @link https://stackoverflow.com/a/49928360/1490091 Useful in type utilities, such as disallowing `any`s to be passed to a function. @example ``` import type {IsAny} from 'type-fest'; const typedObject = {a: 1, b: 2} as const; const anyObject: any = {a: 1, b: 2}; function get extends true ? {} : Record), K extends keyof O = keyof O>(obj: O, key: K) { return obj[key]; } const typedA = get(typedObject, 'a'); //=> 1 const anyA = get(anyObject, 'a'); //=> any ``` @category Type Guard @category Utilities */ type IsAny$1 = 0 extends 1 & NoInfer$1 ? true : false; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-literal.d.ts /** Returns a boolean for whether the given type is a `string` [literal type](https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#literal-types). Useful for: - providing strongly-typed string manipulation functions - constraining strings to be a string literal - type utilities, such as when constructing parsers and ASTs The implementation of this type is inspired by the trick mentioned in this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747). @example ``` import type {IsStringLiteral} from 'type-fest'; type CapitalizedString = IsStringLiteral extends true ? Capitalize : string; // https://github.com/yankeeinlondon/native-dash/blob/master/src/capitalize.ts function capitalize>(input: T): CapitalizedString { return (input.slice(0, 1).toUpperCase() + input.slice(1)) as CapitalizedString; } const output = capitalize('hello, world!'); //=> 'Hello, world!' ``` @example ``` // String types with infinite set of possible values return `false`. import type {IsStringLiteral} from 'type-fest'; type AllUppercaseStrings = IsStringLiteral>; //=> false type StringsStartingWithOn = IsStringLiteral<`on${string}`>; //=> false // This behaviour is particularly useful in string manipulation utilities, as infinite string types often require separate handling. type Length = IsStringLiteral extends false ? number // return `number` for infinite string types : S extends `${string}${infer Tail}` ? Length : Counter['length']; type L1 = Length>; //=> number type L2 = Length<`${number}`>; //=> number ``` @category Type Guard @category Utilities */ type IsStringLiteral = IfNever` produces an index signature, // and since `{}` extends index signatures, the result becomes `false`. T extends string ? {} extends Record ? false : true : false>; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/trim.d.ts /** Remove spaces from the left side. */ type TrimLeft = V extends `${Whitespace}${infer R}` ? TrimLeft : V; /** Remove spaces from the right side. */ type TrimRight = V extends `${infer R}${Whitespace}` ? TrimRight : V; /** Remove leading and trailing spaces from a string. @example ``` import type {Trim} from 'type-fest'; Trim<' foo '> //=> 'foo' ``` @category String @category Template literal */ type Trim = TrimLeft>; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/is-equal.d.ts /** Returns a boolean for whether the two given types are equal. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 Use-cases: - If you want to make a conditional branch based on the result of a comparison of two types. @example ``` import type {IsEqual} from 'type-fest'; // This type returns a boolean for whether the given array includes the given item. // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. type Includes = Value extends readonly [Value[0], ...infer rest] ? IsEqual extends true ? true : Includes : false; ``` @category Type Guard @category Utilities */ //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/string.d.ts /** Returns a boolean for whether the given string `S` starts with the given string `SearchString`. @example ``` StartsWith<'abcde', 'abc'>; //=> true StartsWith<'abcde', 'bc'>; //=> false StartsWith; //=> never StartsWith<'abcde', string>; //=> never ``` @category String @category Template literal */ type StartsWith = string extends S | SearchString ? never : S extends `${SearchString}${infer T}` ? true : false; /** Returns a boolean for whether the string is lowercased. */ type IsLowerCase = T extends Lowercase ? true : false; /** Returns a boolean for whether the string is uppercased. */ type IsUpperCase = T extends Uppercase ? true : false; /** Returns a boolean for whether the string is numeric. This type is a workaround for [Microsoft/TypeScript#46109](https://github.com/microsoft/TypeScript/issues/46109#issuecomment-930307987). */ type IsNumeric = T extends `${number}` ? Trim extends T ? true : false : false; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/simplify.d.ts /** Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability. @example ``` import type {Simplify} from 'type-fest'; type PositionProps = { top: number; left: number; }; type SizeProps = { width: number; height: number; }; // In your editor, hovering over `Props` will show a flattened object with all the properties. type Props = Simplify; ``` Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface. If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify` if you can't re-declare the `value`. @example ``` import type {Simplify} from 'type-fest'; interface SomeInterface { foo: number; bar?: string; baz: number | undefined; } type SomeType = { foo: number; bar?: string; baz: number | undefined; }; const literal = {foo: 123, bar: 'hello', baz: 456}; const someType: SomeType = literal; const someInterface: SomeInterface = literal; function fn(object: Record): void {} fn(literal); // Good: literal object type is sealed fn(someType); // Good: type is sealed fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened fn(someInterface as Simplify); // Good: transform an `interface` into a `type` ``` @link https://github.com/microsoft/TypeScript/issues/15300 @see SimplifyDeep @category Object */ type Simplify$1 = { [KeyType in keyof T]: T[KeyType] } & {}; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/omit-index-signature.d.ts /** Omit any index signatures from the given object type, leaving only explicitly defined properties. This is the counterpart of `PickIndexSignature`. Use-cases: - Remove overly permissive signatures from third-party types. This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747). It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`. (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.) ``` const indexed: Record = {}; // Allowed const keyed: Record<'foo', unknown> = {}; // Error // => TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar ``` Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another: ``` type Indexed = {} extends Record ? '✅ `{}` is assignable to `Record`' : '❌ `{}` is NOT assignable to `Record`'; // => '✅ `{}` is assignable to `Record`' type Keyed = {} extends Record<'foo' | 'bar', unknown> ? "✅ `{}` is assignable to `Record<'foo' | 'bar', unknown>`" : "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`"; // => "❌ `{}` is NOT assignable to `Record<'foo' | 'bar', unknown>`" ``` Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`... ``` import type {OmitIndexSignature} from 'type-fest'; type OmitIndexSignature = { [KeyType in keyof ObjectType // Map each key of `ObjectType`... ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature == Foo`. }; ``` ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record`)... ``` import type {OmitIndexSignature} from 'type-fest'; type OmitIndexSignature = { [KeyType in keyof ObjectType // Is `{}` assignable to `Record`? as {} extends Record ? ... // ✅ `{}` is assignable to `Record` : ... // ❌ `{}` is NOT assignable to `Record` ]: ObjectType[KeyType]; }; ``` If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it. @example ``` import type {OmitIndexSignature} from 'type-fest'; interface Example { // These index signatures will be removed. [x: string]: any [x: number]: any [x: symbol]: any [x: `head-${string}`]: string [x: `${string}-tail`]: string [x: `head-${string}-tail`]: string [x: `${bigint}`]: string [x: `embedded-${number}`]: string // These explicitly defined keys will remain. foo: 'bar'; qux?: 'baz'; } type ExampleWithoutIndexSignatures = OmitIndexSignature; // => { foo: 'bar'; qux?: 'baz' | undefined; } ``` @see PickIndexSignature @category Object */ type OmitIndexSignature$1 = { [KeyType in keyof ObjectType as {} extends Record ? never : KeyType]: ObjectType[KeyType] }; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pick-index-signature.d.ts /** Pick only index signatures from the given object type, leaving out all explicitly defined properties. This is the counterpart of `OmitIndexSignature`. @example ``` import type {PickIndexSignature} from 'type-fest'; declare const symbolKey: unique symbol; type Example = { // These index signatures will remain. [x: string]: unknown; [x: number]: unknown; [x: symbol]: unknown; [x: `head-${string}`]: string; [x: `${string}-tail`]: string; [x: `head-${string}-tail`]: string; [x: `${bigint}`]: string; [x: `embedded-${number}`]: string; // These explicitly defined keys will be removed. ['kebab-case-key']: string; [symbolKey]: string; foo: 'bar'; qux?: 'baz'; }; type ExampleIndexSignature = PickIndexSignature; // { // [x: string]: unknown; // [x: number]: unknown; // [x: symbol]: unknown; // [x: `head-${string}`]: string; // [x: `${string}-tail`]: string; // [x: `head-${string}-tail`]: string; // [x: `${bigint}`]: string; // [x: `embedded-${number}`]: string; // } ``` @see OmitIndexSignature @category Object */ type PickIndexSignature$1 = { [KeyType in keyof ObjectType as {} extends Record ? KeyType : never]: ObjectType[KeyType] }; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/merge.d.ts // Merges two objects without worrying about index signatures. type SimpleMerge$1 = { [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source; /** Merge two types into a new type. Keys of the second type overrides keys of the first type. @example ``` import type {Merge} from 'type-fest'; interface Foo { [x: string]: unknown; [x: number]: unknown; foo: string; bar: symbol; } type Bar = { [x: number]: number; [x: symbol]: unknown; bar: Date; baz: boolean; }; export type FooBar = Merge; // => { // [x: string]: unknown; // [x: number]: number; // [x: symbol]: unknown; // foo: string; // bar: Date; // baz: boolean; // } ``` @category Object */ type Merge$1 = Simplify$1, PickIndexSignature$1> & SimpleMerge$1, OmitIndexSignature$1>>; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/if-any.d.ts /** An if-else-like type that resolves depending on whether the given type is `any`. @see {@link IsAny} @example ``` import type {IfAny} from 'type-fest'; type ShouldBeTrue = IfAny; //=> true type ShouldBeBar = IfAny<'not any', 'foo', 'bar'>; //=> 'bar' ``` @category Type Guard @category Utilities */ type IfAny = (IsAny$1 extends true ? TypeIfAny : TypeIfNotAny); //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/internal/object.d.ts /** Merges user specified options with default options. @example ``` type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false}; type SpecifiedOptions = {leavesOnly: true}; type Result = ApplyDefaultOptions; //=> {maxRecursionDepth: 10; leavesOnly: true} ``` @example ``` // Complains if default values are not provided for optional options type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10}; type SpecifiedOptions = {}; type Result = ApplyDefaultOptions; // ~~~~~~~~~~~~~~~~~~~ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'. ``` @example ``` // Complains if an option's default type does not conform to the expected type type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'}; type SpecifiedOptions = {}; type Result = ApplyDefaultOptions; // ~~~~~~~~~~~~~~~~~~~ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'. ``` @example ``` // Complains if an option's specified type does not conform to the expected type type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false}; type SpecifiedOptions = {leavesOnly: 'yes'}; type Result = ApplyDefaultOptions; // ~~~~~~~~~~~~~~~~ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'. ``` */ type ApplyDefaultOptions$1, RequiredKeysOf$1> & Partial, never>>>, SpecifiedOptions extends Options> = IfAny ? Extract extends never ? Key : never : Key]: SpecifiedOptions[Key] }> & Required> // `& Required` ensures that `ApplyDefaultOptions` is always assignable to `Required` >>; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/except.d.ts /** Filter out keys from an object. Returns `never` if `Exclude` is strictly equal to `Key`. Returns `never` if `Key` extends `Exclude`. Returns `Key` otherwise. @example ``` type Filtered = Filter<'foo', 'foo'>; //=> never ``` @example ``` type Filtered = Filter<'bar', string>; //=> never ``` @example ``` type Filtered = Filter<'bar', 'foo'>; //=> 'bar' ``` @see {Except} */ //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/conditional-keys.d.ts /** Extract the keys from a type where the value type of the key extends the given `Condition`. Internally this is used for the `ConditionalPick` and `ConditionalExcept` types. @example ``` import type {ConditionalKeys} from 'type-fest'; interface Example { a: string; b: string | number; c?: string; d: {}; } type StringKeysOnly = ConditionalKeys; //=> 'a' ``` To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below. @example ``` import type {ConditionalKeys} from 'type-fest'; type StringKeysAndUndefined = ConditionalKeys; //=> 'a' | 'c' ``` @category Object */ type ConditionalKeys = { // Map through all the keys of the given base type. // Convert the produced object into a union type of the keys which passed the conditional test. [Key in keyof Base]-?: // Pick only keys with types extending the given `Condition` type. Base[Key] extends Condition // Retain this key // If the value for the key extends never, only include it if `Condition` also extends never ? IfNever, Key> // Discard this key since the condition fails. : never }[keyof Base]; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/conditional-except.d.ts /** Exclude keys from a shape that matches the given `Condition`. This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties. @example ``` import type {Primitive, ConditionalExcept} from 'type-fest'; class Awesome { name: string; successes: number; failures: bigint; run() {} } type ExceptPrimitivesFromAwesome = ConditionalExcept; //=> {run: () => void} ``` @example ``` import type {ConditionalExcept} from 'type-fest'; interface Example { a: string; b: string | number; c: () => void; d: {}; } type NonStringKeysOnly = ConditionalExcept; //=> {b: string | number; c: () => void; d: {}} ``` @category Object */ //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/conditional-pick.d.ts /** Pick keys from the shape that matches the given `Condition`. This is useful when you want to create a new type from a specific subset of an existing type. For example, you might want to pick all the primitive properties from a class and form a new automatically derived type. @example ``` import type {Primitive, ConditionalPick} from 'type-fest'; class Awesome { name: string; successes: number; failures: bigint; run() {} } type PickPrimitivesFromAwesome = ConditionalPick; //=> {name: string; successes: number; failures: bigint} ``` @example ``` import type {ConditionalPick} from 'type-fest'; interface Example { a: string; b: string | number; c: () => void; d: {}; } type StringKeysOnly = ConditionalPick; //=> {a: string} ``` @category Object */ type ConditionalPick = Pick>; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/words.d.ts type SkipEmptyWord = Word extends '' ? [] : [Word]; type RemoveLastCharacter = Sentence extends `${infer LeftSide}${Character}` ? SkipEmptyWord : never; /** Words options. @see {@link Words} */ type WordsOptions = { /** Split on numeric sequence. @default true @example ``` type Example1 = Words<'p2pNetwork', {splitOnNumbers: true}>; //=> ["p", "2", "p", "Network"] type Example2 = Words<'p2pNetwork', {splitOnNumbers: false}>; //=> ["p2p", "Network"] ``` */ splitOnNumbers?: boolean; }; type DefaultWordsOptions = { splitOnNumbers: true; }; /** Split a string (almost) like Lodash's `_.words()` function. - Split on each word that begins with a capital letter. - Split on each {@link WordSeparators}. - Split on numeric sequence. @example ``` import type {Words} from 'type-fest'; type Words0 = Words<'helloWorld'>; //=> ['hello', 'World'] type Words1 = Words<'helloWORLD'>; //=> ['hello', 'WORLD'] type Words2 = Words<'hello-world'>; //=> ['hello', 'world'] type Words3 = Words<'--hello the_world'>; //=> ['hello', 'the', 'world'] type Words4 = Words<'lifeIs42'>; //=> ['life', 'Is', '42'] type Words5 = Words<'p2pNetwork', {splitOnNumbers: false}>; //=> ['p2p', 'Network'] ``` @category Change case @category Template literal */ type Words = WordsImplementation>; type WordsImplementation, LastCharacter extends string = '', CurrentWord extends string = ''> = Sentence extends `${infer FirstCharacter}${infer RemainingCharacters}` ? FirstCharacter extends WordSeparators // Skip word separator ? [...SkipEmptyWord, ...WordsImplementation] : LastCharacter extends '' // Fist char of word ? WordsImplementation // Case change: non-numeric to numeric : [false, true] extends [IsNumeric, IsNumeric] ? Options['splitOnNumbers'] extends true // Split on number: push word ? [...SkipEmptyWord, ...WordsImplementation] // No split on number: concat word : WordsImplementation // Case change: numeric to non-numeric : [true, false] extends [IsNumeric, IsNumeric] ? Options['splitOnNumbers'] extends true // Split on number: push word ? [...SkipEmptyWord, ...WordsImplementation] // No split on number: concat word : WordsImplementation // No case change: concat word : [true, true] extends [IsNumeric, IsNumeric] ? WordsImplementation // Case change: lower to upper, push word : [true, true] extends [IsLowerCase, IsUpperCase] ? [...SkipEmptyWord, ...WordsImplementation] // Case change: upper to lower, brings back the last character, push word : [true, true] extends [IsUpperCase, IsLowerCase] ? [...RemoveLastCharacter, ...WordsImplementation] // No case change: concat word : WordsImplementation : [...SkipEmptyWord]; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/camel-case.d.ts /** CamelCase options. @see {@link CamelCase} */ //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/delimiter-case.d.ts type DefaultDelimiterCaseOptions = Merge$1; /** Convert an array of words to delimiter case starting with a delimiter with input capitalization. */ type DelimiterCaseFromArray = Words extends [infer FirstWord extends string, ...infer RemainingWords extends string[]] ? DelimiterCaseFromArray extends true ? '' : Delimiter}${FirstWord}`> : OutputString; type RemoveFirstLetter = S extends `${infer _}${infer Rest}` ? Rest : ''; /** Convert a string literal to a custom string delimiter casing. This can be useful when, for example, converting a camel-cased object property to an oddly cased one. @see KebabCase @see SnakeCase @example ``` import type {DelimiterCase} from 'type-fest'; // Simple const someVariable: DelimiterCase<'fooBar', '#'> = 'foo#bar'; const someVariableNoSplitOnNumbers: DelimiterCase<'p2pNetwork', '#', {splitOnNumbers: false}> = 'p2p#network'; // Advanced type OddlyCasedProperties = { [K in keyof T as DelimiterCase]: T[K] }; interface SomeOptions { dryRun: boolean; includeFile: string; foo: number; } const rawCliOptions: OddlyCasedProperties = { 'dry#run': true, 'include#file': 'bar.js', foo: 123 }; ``` @category Change case @category Template literal */ type DelimiterCase = Value extends string ? IsStringLiteral extends false ? Value : Lowercase>, Delimiter>>> : Value; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/kebab-case.d.ts /** Convert a string literal to kebab-case. This can be useful when, for example, converting a camel-cased object property to a kebab-cased CSS class name or a command-line flag. @example ``` import type {KebabCase} from 'type-fest'; // Simple const someVariable: KebabCase<'fooBar'> = 'foo-bar'; const someVariableNoSplitOnNumbers: KebabCase<'p2pNetwork', {splitOnNumbers: false}> = 'p2p-network'; // Advanced type KebabCasedProperties = { [K in keyof T as KebabCase]: T[K] }; interface CliOptions { dryRun: boolean; includeFile: string; foo: number; } const rawCliOptions: KebabCasedProperties = { 'dry-run': true, 'include-file': 'bar.js', foo: 123 }; ``` @category Change case @category Template literal */ type KebabCase = DelimiterCase>; //#endregion //#region ../../node_modules/.pnpm/type-fest@4.41.0/node_modules/type-fest/source/pascal-case.d.ts /** Converts a string literal to pascal-case. @example ``` import type {PascalCase} from 'type-fest'; // Simple const someVariable: PascalCase<'foo-bar'> = 'FooBar'; // Advanced type PascalCaseProps = { [K in keyof T as PascalCase]: T[K] }; interface RawOptions { 'dry-run': boolean; 'full_family_name': string; foo: number; } const dbResult: CamelCasedProperties = { DryRun: true, FullFamilyName: 'bar.js', Foo: 123 }; ``` @category Change case @category Template literal */ //#endregion //#region src/core/types.d.ts type Observable = T | ReadSignal; type ObservableRecord = { [P in keyof T]: Observable }; type Stringify

= P extends string ? P : never; type LowercaseRecord = { [P in keyof T as Lowercase>]?: T[P] | null }; type KebabCaseRecord = { [P in keyof T as KebabCase

]: T[P] | null }; type ReadSignalRecord> = { [Prop in keyof Props]: ReadSignal }; type WriteSignalRecord> = { [Prop in keyof Props]: WriteSignal }; type AnyRecord = { [name: string]: any; }; interface EventHandler { (this: never, event: E): void; } type TargetedEventHandler = EventHandler>; type TargetedEvent = Omit & { readonly currentTarget: T; }; //#endregion //#region src/element/types.d.ts type AttrValue = string | number | boolean | null | undefined; interface AttrsRecord { [attrName: string]: AttrValue; } interface HTMLAttrs extends HTMLAttrsRecord {} type HTMLAttrsRecord = LowercaseRecord>; interface HTMLProperties { accept?: string; acceptCharset?: string; accessKey?: string; action?: string; allow?: string; allowFullScreen?: boolean; allowTransparency?: boolean; alt?: string; as?: string; async?: boolean; autocomplete?: string; autoComplete?: string; autocorrect?: string; autoCorrect?: string; autofocus?: boolean; autoFocus?: boolean; autoPlay?: boolean; capture?: boolean | string; cellPadding?: number | string; cellSpacing?: number | string; charSet?: string; challenge?: string; checked?: boolean; cite?: string; class?: string; className?: string; cols?: number; colSpan?: number; content?: string; contentEditable?: boolean; contextMenu?: string; controls?: boolean; controlsList?: string; coords?: string; crossOrigin?: string; data?: string; dateTime?: string; default?: boolean; defaultChecked?: boolean; defaultValue?: string; defer?: boolean; dir?: 'auto' | 'rtl' | 'ltr'; disabled?: boolean; disableRemotePlayback?: boolean; download?: any; decoding?: 'sync' | 'async' | 'auto'; draggable?: boolean; encType?: string; enterkeyhint?: 'enter' | 'done' | 'go' | 'next' | 'previous' | 'search' | 'send'; form?: string; formAction?: string; formEncType?: string; formMethod?: string; formNoValidate?: boolean; formTarget?: string; frameBorder?: number | string; headers?: string; height?: number | string; hidden?: boolean; high?: number; href?: string; hrefLang?: string; for?: string; htmlFor?: string; httpEquiv?: string; icon?: string; id?: string; inputMode?: string; integrity?: string; is?: string; keyParams?: string; keyType?: string; kind?: string; label?: string; lang?: string; list?: string; loading?: 'eager' | 'lazy'; loop?: boolean; low?: number; manifest?: string; marginHeight?: number; marginWidth?: number; max?: number | string; maxLength?: number; media?: string; mediaGroup?: string; method?: string; min?: number | string; minLength?: number; multiple?: boolean; muted?: boolean; name?: string; nomodule?: boolean; nonce?: string; noValidate?: boolean; open?: boolean; optimum?: number; part?: string; pattern?: string; ping?: string; placeholder?: string; playsInline?: boolean; poster?: string; preload?: string; radioGroup?: string; readonly?: boolean; readOnly?: boolean; referrerpolicy?: 'no-referrer' | 'no-referrer-when-downgrade' | 'origin' | 'origin-when-cross-origin' | 'same-origin' | 'strict-origin' | 'strict-origin-when-cross-origin' | 'unsafe-url'; rel?: string; required?: boolean; reversed?: boolean; role?: string; rows?: number; rowSpan?: number; sandbox?: string; scope?: string; scoped?: boolean; scrolling?: string; seamless?: boolean; selected?: boolean; shape?: string; size?: number; sizes?: string; slot?: string; span?: number; spellcheck?: boolean; spellCheck?: boolean; src?: string; srcset?: string; srcDoc?: string; srcLang?: string; srcSet?: string; start?: number; step?: number | string; style?: string; summary?: string; tabIndex?: number; target?: string; title?: string; type?: string; useMap?: string; value?: string | string[] | number; volume?: string | number; width?: number | string; wmode?: string; wrap?: string; autocapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters'; autoCapitalize?: 'off' | 'none' | 'on' | 'sentences' | 'words' | 'characters'; disablePictureInPicture?: boolean; results?: number; translate?: 'yes' | 'no'; about?: string; datatype?: string; inlist?: any; prefix?: string; property?: string; resource?: string; typeof?: string; vocab?: string; itemProp?: string; itemScope?: boolean; itemType?: string; itemID?: string; itemRef?: string; } interface ARIAAttributes { 'aria-autocomplete'?: 'none' | 'inline' | 'list' | 'both'; 'aria-checked'?: 'true' | 'false' | 'mixed'; 'aria-disabled'?: 'true' | 'false'; 'aria-errormessage'?: string; 'aria-expanded'?: 'true' | 'false'; 'aria-haspopup'?: 'true' | 'false' | 'menu' | 'listbox' | 'tree' | 'grid' | 'dialog'; 'aria-hidden'?: 'true' | 'false'; 'aria-invalid'?: 'grammar' | 'false' | 'spelling' | 'true'; 'aria-label'?: string; 'aria-level'?: number; 'aria-modal'?: 'true' | 'false'; 'aria-multiline'?: 'true' | 'false'; 'aria-multiselectable'?: 'true' | 'false'; 'aria-orientation'?: 'horizontal' | 'vertical'; 'aria-placeholder'?: string; 'aria-pressed'?: 'true' | 'false' | 'mixed'; 'aria-readonly'?: 'true' | 'false'; 'aria-required'?: 'true' | 'false'; 'aria-selected'?: 'true' | 'false'; 'aria-sort'?: 'ascending' | 'descending' | 'none' | 'other'; 'aria-valuemin'?: number; 'aria-valuemax'?: number; 'aria-valuenow'?: number; 'aria-valuetext'?: string; 'aria-busy'?: 'true' | 'false'; 'aria-live'?: 'assertive' | 'polite' | 'off'; 'aria-relevant'?: 'all' | 'additions' | 'removals' | 'text' | 'additions text'; 'aria-atomic'?: 'true' | 'false'; 'aria-dropeffect'?: 'copy' | 'execute' | 'link' | 'move' | 'none' | 'popup'; 'aria-grabbed'?: 'true' | 'false'; 'aria-activedescendant'?: string; 'aria-colcount'?: number; 'aria-colindex'?: number; 'aria-colspan'?: number; 'aria-controls'?: string; 'aria-describedby'?: string; 'aria-description'?: string; 'aria-details'?: string; 'aria-flowto'?: string; 'aria-labelledby'?: string; 'aria-owns'?: string; 'aria-posinet'?: number; 'aria-rowcount'?: number; 'aria-rowindex'?: number; 'aria-rowspan'?: number; 'aria-setsize'?: number; 'aria-current'?: 'page' | 'step' | 'location' | 'date' | 'time' | 'true' | 'false'; 'aria-keyshortcuts'?: string; 'aria-roledescription'?: string; } type CSSValue = string | number | false | null | undefined; type AnyCSSProperty = { [key: string]: CSSValue; }; type CSSProperties = AnyCSSProperty & { [P in keyof Omit]?: CSSValue } & { cssText?: string | null; }; interface CSSStyles extends KebabCaseRecord {} interface ElementAttributesRecord extends ObservableRecord, ObservableRecord, ObservableRecord {} interface ElementStylesRecord extends ObservableRecord {} type ElementCSSVarsRecord = { [Var in keyof CSSVars as `--${Var & string}`]: Observable }; //#endregion //#region src/core/signals.d.ts /** * Invokes the given function each time any of the signals that are read inside are updated * (i.e., their value changes). The effect is immediately invoked on initialization. * * @see {@link https://github.com/maverick-js/signals#effect} */ //#endregion //#region src/core/state.d.ts /** * Converts objects into signals. The factory stores the initial object and enables producing new * objects where each value in the provided object becomes a signal. * * @example * ```ts * const factory = new State({ * foo: 0, * bar: '...', * get baz() { * return this.foo + 1; * } * }); * * console.log(factory.record); // logs `{ foo: 0, bar: '...' }` * * const $state = factory.create(); * * effect(() => console.log($state.foo())); * // Run effect ^ * $state.foo.set(1); * * // Reset all values * factory.reset($state); * ``` */ declare class State { #private; readonly id: symbol; readonly record: Record; constructor(record: Record); create(): Store; reset(record: Store, filter?: (key: keyof Record) => boolean): void; } type Store = { readonly [P in keyof PickReadonly]: ReadSignal } & { readonly [P in keyof PickWritable]: WriteSignal }; //#endregion //#region src/element/attrs.d.ts type AttributeValue = string | null; type Attributes = { [P in keyof Props]?: string | false | Attribute }; interface AttributeConverter { (value: AttributeValue): Value; } interface Attribute extends SignalOptions { /** * Whether the property is associated with an attribute, or a custom name for the associated * attribute. By default this is `true` and the attribute name is inferred by kebab-casing the * property name. */ attr?: string | false; /** * Convert between an attribute value and property value. If not specified it will be inferred * from the initial value. */ converter?: AttributeConverter; } interface MaverickElementConstructor { readonly observedAttributes: string[]; readonly attrs?: Attributes>; new (): MaverickElement; } type MaverickElement> = Omit & InferComponentMembers & HostElement & { addEventListener(type: K, listener: (this: T, ev: E[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: K, listener: (this: T, ev: HTMLElementEventMap[K]) => any, options?: boolean | AddEventListenerOptions): void; addEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void; removeEventListener(type: K, listener: (this: T, ev: E[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: K, listener: (this: T, ev: HTMLElementEventMap[K]) => any, options?: boolean | EventListenerOptions): void; removeEventListener(type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions): void; }; interface HostElement { /** * Whether this component should be kept-alive on DOM disconnection. If `true`, all child * host elements will also be kept alive and the instance will need to be manually destroyed. Do * note, this can be prevented by setting `forwardKeepAlive` to ``false`. * * Important to note that if a parent element is kept alive, calling destroy will also destroy * all child element instances. * * ```ts * // Destroy this component and all children. * element.destroy(); * ``` */ keepAlive: boolean; /** * If this is `false`, children will _not_ adopt the `keepAlive` state of this element. * * @defaultValue true */ forwardKeepAlive: boolean; /** Component instance. */ readonly $: T; readonly scope: Scope; readonly attachScope: Scope | null; readonly connectScope: Scope | null; /** @internal */ readonly $props: ReadSignalRecord>; /** @internal */ readonly $state: Store>; /** * This object contains the state of the component. * * ```ts * const el = document.querySelector('foo-el'); * el.state.foo; * ``` */ readonly state: InferComponentState extends Record ? never : Readonly>; /** * Enables subscribing to live updates of component state. * * @example * ```ts * const el = document.querySelector('foo-el'); * el.subscribe(({ foo, bar }) => { * // Re-run when the value of foo or bar changes. * }); * ``` */ subscribe: InferComponentState extends Record ? never : (callback: (state: Readonly>) => Maybe) => Dispose; /** * Destroys the underlying component instance. */ destroy(): void; } //#endregion //#region src/std/event.d.ts declare const EVENT: Constructor, DOM_EVENT: unique symbol; interface DOMEventInit extends EventInit { readonly detail: Detail; readonly trigger?: Event; } declare class DOMEvent extends EVENT { [DOM_EVENT]: boolean; /** * The event detail. */ readonly detail: Detail; /** * The event trigger chain. */ readonly triggers: EventTriggers; /** * The preceding event that was responsible for this event being fired. */ get trigger(): Event | undefined; /** * The origin event that lead to this event being fired. */ get originEvent(): Event | undefined; /** * Whether the origin event was triggered by the user. * * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Event/isTrusted} */ get isOriginTrusted(): boolean; constructor(type: string, ...init: Detail extends void | undefined | never ? [init?: Partial>] : [init: DOMEventInit]); } declare class EventTriggers implements Iterable { readonly chain: Event[]; get source(): Event | undefined; get origin(): Event | undefined; /** * Appends the event to the end of the chain. */ add(event: Event): void; /** * Removes the event from the chain and returns it (if found). */ remove(event: Event): Event | undefined; /** * Returns whether the chain contains the given `event`. */ has(event: Event): boolean; /** * Returns whether the chain contains the given event type. */ hasType(type: string): boolean; /** * Returns the first event with the given `type` found in the chain. */ findType(type: string): Event | undefined; /** * Walks an event chain on a given `event`, and invokes the given `callback` for each trigger event. */ walk(callback: (event: Event) => NonNullable | void): [event: Event, value: NonNullable] | undefined; [Symbol.iterator](): Iterator; } /** * Whether the given `event` is a `DOMEvent` class. */ /** * Walks an event chain on a given `event`, and invokes the given `callback` for each trigger event. * @deprecated - Use `event.triggers.walk(callback)` */ declare function walkTriggerEventChain(event: Event, callback: (event: Event) => NonNullable | void): [event: Event, value: NonNullable] | undefined; /** * Attempts to find a trigger event with a given `eventType` on the event chain. * @deprecated - Use `event.triggers.findType('')` */ declare function findTriggerEvent(event: Event, type: string): Event | undefined; /** * Whether a trigger event with the given `eventType` exists can be found in the event chain. * @deprecated - Use `event.triggers.hasType('')` */ declare function hasTriggerEvent(event: Event, type: string): boolean; /** * Appends the given `trigger` to the event chain. * @deprecated - Use `event.triggers.add(event)` */ declare function appendTriggerEvent(event: DOMEvent, trigger?: Event): void; type InferEventDetail = T extends { detail: infer Detail; } ? Detail : T extends DOMEvent ? Detail : T extends DOMEventInit ? Detail : unknown; type EventCallback = ((event: T) => void) | { handleEvent(event: T): void; } | null; declare class EventsTarget extends EventTarget { /** @internal type only */ $ts__events?: Events; addEventListener(type: Type & string, callback: EventCallback, options?: boolean | AddEventListenerOptions | undefined): void; removeEventListener(type: Type & string, callback: EventCallback, options?: boolean | AddEventListenerOptions | undefined): void; } declare function isPointerEvent(event: Event | undefined): event is PointerEvent; declare function isKeyboardEvent(event: Event | undefined): event is KeyboardEvent; declare function isKeyboardClick(event: Event | undefined): boolean; //#endregion //#region src/std/unit.d.ts //#endregion //#region src/element/server/server-element.d.ts interface ServerElement extends Pick { readonly classList: Pick; readonly style: Pick & { toString(): string; }; } //#endregion //#region src/core/symbols.d.ts declare const ON_DISPATCH: unique symbol; //#endregion //#region src/core/instance.d.ts interface LifecycleHooks { onSetup?(): void; onAttach?(el: HTMLElement): void; onConnect?(el: HTMLElement): void; onDestroy?(el: HTMLElement): void; } interface InstanceInit { scope?: Scope | null; props?: Readonly> | null; } declare class Instance { #private; /** @internal type only */ $ts__events?: Events; /** @internal type only */ $ts__vars?: CSSVars; [ON_DISPATCH]?: ((event: Event) => void) | null; readonly $el: WriteSignal; el: HTMLElement | null; scope: Scope | null; attachScope: Scope | null; connectScope: Scope | null; component: Component | null; destroyed: boolean; props: WriteSignalRecord; attrs: ElementAttributesRecord | null; styles: ElementStylesRecord | null; state: Readonly; $state: any; constructor(Component: ComponentConstructor>, scope: Scope, init?: InstanceInit); setup(): void; attach(el: HTMLElement | ServerElement): void; detach(): void; connect(): void; disconnect(): void; destroy(): void; addHooks(target: LifecycleHooks): void; } //#endregion //#region src/core/controller.d.ts declare class ViewController extends EventTarget { /** @internal */ $$: Instance; get el(): HTMLElement | null; get $el(): HTMLElement | null; get scope(): Scope; get attachScope(): Scope | null; get connectScope(): Scope | null; /** @internal */ get $props(): ReadSignalRecord; /** @internal */ get $state(): WriteSignalRecord; get state(): Readonly; constructor(); attach({ $$ }: { $$: Instance; }): this; addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | AddEventListenerOptions | undefined): void; removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: boolean | EventListenerOptions | undefined): void; /** * The given callback is invoked when the component is ready to be set up. * * - This hook will run once. * - This hook is called both client-side and server-side. * - It's safe to use context inside this hook. * - The host element has not attached yet - wait for `onAttach`. */ protected onSetup?(): void; /** * The given callback is invoked when the component instance has attached to a host element. * * - This hook can run more than once as the component attaches/detaches from a host element. * - This hook may be called while the host element is not connected to the DOM yet. * - This hook is called both client-side and server-side. */ protected onAttach?(el: HTMLElement): void; /** * The given callback is invoked when the host element has connected to the DOM. * * - This hook can run more than once as the host disconnects and re-connects to the DOM. * - If a function is returned it will be invoked when the host disconnects from the DOM. */ protected onConnect?(el: HTMLElement): void; /** * The given callback is invoked when the component is destroyed. * * - This hook will only run once when the component is finally destroyed. * - This hook may be called before being attached to a host element. * - This hook is called both client-side and server-side. */ protected onDestroy?(): void; /** * This method can be used to specify attributes that should be set on the host element. Any * attributes that are assigned to a function will be considered a signal and updated accordingly. */ protected setAttributes(attributes: ElementAttributesRecord): void; /** * This method can be used to specify styles that should set be set on the host element. Any * styles that are assigned to a function will be considered a signal and updated accordingly. */ protected setStyles(styles: ElementStylesRecord): void; /** * This method is used to satisfy the CSS variables contract specified on the current * component. Other CSS variables can be set via the `setStyles` method. */ protected setCSSVars(vars: ElementCSSVarsRecord): void; /** * Type-safe utility for creating component DOM events. */ createEvent(type: Type & string, ...init: Events[Type] extends DOMEvent ? Events[Type]['detail'] extends void | undefined | never ? [init?: Partial['detail']>] : [init: DOMEventInit] : never): Events[Type]; /** * Creates a `DOMEvent` and dispatches it from the host element. This method is typed to * match all component events. */ dispatch(type: Type, ...init: Type extends Event ? [init?: never] : Type extends keyof Events ? Events[Type] extends DOMEvent ? Events[Type]['detail'] extends void | undefined | never ? [init?: Partial>] : [init: DOMEventInit] : [init?: never] : [init?: never]): boolean; dispatchEvent(event: Event): boolean; /** * Adds an event listener for the given `type` and returns a function which can be invoked to * remove the event listener. * * - The listener is removed if the current scope is disposed. * - This method is safe to use on the server (noop). */ listen(type: Type & string, handler: TargetedEventHandler, options?: AddEventListenerOptions | boolean): Dispose; } //#endregion //#region src/core/component.d.ts declare class Component extends ViewController { subscribe(callback: (state: Readonly) => Maybe): StopEffect; destroy(): void; } interface AnyComponent extends Component {} interface ComponentConstructor { readonly props?: InferComponentProps; readonly state?: State>; new (): T; } type InferComponentProps = T extends Component ? Props : {}; type InferComponentState = T extends Component ? State : {}; type InferComponentEvents = T extends Component ? Events : {}; type InferComponentMembers = T extends Component ? Omit & Omit : {}; //#endregion //#region src/core/context.d.ts interface Context { id: symbol; provide?: () => T; } //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/union-to-intersection.d.ts /** Convert a union type to an intersection type. Inspired by [this Stack Overflow answer](https://stackoverflow.com/a/50375286/2172153). @example ``` import type {UnionToIntersection} from 'type-fest'; type Union = {the(): void} | {great(arg: string): void} | {escape: boolean}; type Intersection = UnionToIntersection; //=> {the(): void} & {great(arg: string): void} & {escape: boolean} ``` @category Type */ type UnionToIntersection = (// `extends unknown` is always going to be the case and is used to convert the // `Union` into a [distributive conditional // type](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html#distributive-conditional-types). Union extends unknown // The union type is used as the only argument to a function since the union // of function arguments is an intersection. ? (distributedUnion: Union) => void // This won't happen. : never // Infer the `Intersection` type since TypeScript represents the positional // arguments of unions of functions as an intersection of the union. ) extends ((mergedIntersection: infer Intersection) => void) // The `& Union` is to ensure result of `UnionToIntersection` is always assignable to `A | B` ? Intersection & Union : never; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/keys-of-union.d.ts /** Create a union of all keys from a given type, even those exclusive to specific union members. Unlike the native `keyof` keyword, which returns keys present in **all** union members, this type returns keys from **any** member. @link https://stackoverflow.com/a/49402091 @example ``` import type {KeysOfUnion} from 'type-fest'; type A = { common: string; a: number; }; type B = { common: string; b: string; }; type C = { common: string; c: boolean; }; type Union = A | B | C; type CommonKeys = keyof Union; //=> 'common' type AllKeys = KeysOfUnion; //=> 'common' | 'a' | 'b' | 'c' ``` @category Object */ type KeysOfUnion = // Hack to fix https://github.com/sindresorhus/type-fest/issues/1008 keyof UnionToIntersection : never>; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-any.d.ts /** Returns a boolean for whether the given type is `any`. @link https://stackoverflow.com/a/49928360/1490091 Useful in type utilities, such as disallowing `any`s to be passed to a function. @example ``` import type {IsAny} from 'type-fest'; const typedObject = {a: 1, b: 2} as const; const anyObject: any = {a: 1, b: 2}; function get extends true ? {} : Record), K extends keyof O = keyof O>(object: O, key: K) { return object[key]; } const typedA = get(typedObject, 'a'); //=> 1 const anyA = get(anyObject, 'a'); //=> any ``` @category Type Guard @category Utilities */ type IsAny = 0 extends 1 & NoInfer ? true : false; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-optional-key-of.d.ts /** Returns a boolean for whether the given key is an optional key of type. This is useful when writing utility types or schema validators that need to differentiate `optional` keys. @example ``` import type {IsOptionalKeyOf} from 'type-fest'; type User = { name: string; surname: string; luckyNumber?: number; }; type Admin = { name: string; surname?: string; }; type T1 = IsOptionalKeyOf; //=> true type T2 = IsOptionalKeyOf; //=> false type T3 = IsOptionalKeyOf; //=> boolean type T4 = IsOptionalKeyOf; //=> false type T5 = IsOptionalKeyOf; //=> boolean ``` @category Type Guard @category Utilities */ type IsOptionalKeyOf = IsAny extends true ? never : Key extends keyof Type ? Type extends Record ? false : true : false; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/optional-keys-of.d.ts /** Extract all optional keys from the given type. This is useful when you want to create a new type that contains different type values for the optional keys only. @example ``` import type {OptionalKeysOf, Except} from 'type-fest'; type User = { name: string; surname: string; luckyNumber?: number; }; const REMOVE_FIELD = Symbol('remove field symbol'); type UpdateOperation = Except, OptionalKeysOf> & { [Key in OptionalKeysOf]?: Entity[Key] | typeof REMOVE_FIELD; }; const update1: UpdateOperation = { name: 'Alice', }; const update2: UpdateOperation = { name: 'Bob', luckyNumber: REMOVE_FIELD, }; ``` @category Utilities */ type OptionalKeysOf = Type extends unknown // For distributing `Type` ? (keyof { [Key in keyof Type as IsOptionalKeyOf extends false ? never : Key]: never }) & keyof Type // Intersect with `keyof Type` to ensure result of `OptionalKeysOf` is always assignable to `keyof Type` : never; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/required-keys-of.d.ts /** Extract all required keys from the given type. This is useful when you want to create a new type that contains different type values for the required keys only or use the list of keys for validation purposes, etc... @example ``` import type {RequiredKeysOf} from 'type-fest'; declare function createValidation< Entity extends object, Key extends RequiredKeysOf = RequiredKeysOf, >(field: Key, validator: (value: Entity[Key]) => boolean): (entity: Entity) => boolean; type User = { name: string; surname: string; luckyNumber?: number; }; const validator1 = createValidation('name', value => value.length < 25); const validator2 = createValidation('surname', value => value.length < 25); // @ts-expect-error const validator3 = createValidation('luckyNumber', value => value > 0); // Error: Argument of type '"luckyNumber"' is not assignable to parameter of type '"name" | "surname"'. ``` @category Utilities */ type RequiredKeysOf = Type extends unknown // For distributing `Type` ? Exclude> : never; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-never.d.ts /** Returns a boolean for whether the given type is `never`. @link https://github.com/microsoft/TypeScript/issues/31751#issuecomment-498526919 @link https://stackoverflow.com/a/53984913/10292952 @link https://www.zhenghao.io/posts/ts-never Useful in type utilities, such as checking if something does not occur. @example ``` import type {IsNever, And} from 'type-fest'; type A = IsNever; //=> true type B = IsNever; //=> false type C = IsNever; //=> false type D = IsNever; //=> false type E = IsNever; //=> false type F = IsNever; //=> false ``` @example ``` import type {IsNever} from 'type-fest'; type IsTrue = T extends true ? true : false; // When a distributive conditional is instantiated with `never`, the entire conditional results in `never`. type A = IsTrue; //=> never // If you don't want that behaviour, you can explicitly add an `IsNever` check before the distributive conditional. type IsTrueFixed = IsNever extends true ? false : T extends true ? true : false; type B = IsTrueFixed; //=> false ``` @category Type Guard @category Utilities */ type IsNever = [T] extends [never] ? true : false; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/if.d.ts /** An if-else-like type that resolves depending on whether the given `boolean` type is `true` or `false`. Use-cases: - You can use this in combination with `Is*` types to create an if-else-like experience. For example, `If, 'is any', 'not any'>`. Note: - Returns a union of if branch and else branch if the given type is `boolean` or `any`. For example, `If` will return `'Y' | 'N'`. - Returns the else branch if the given type is `never`. For example, `If` will return `'N'`. @example ``` import type {If} from 'type-fest'; type A = If; //=> 'yes' type B = If; //=> 'no' type C = If; //=> 'yes' | 'no' type D = If; //=> 'yes' | 'no' type E = If; //=> 'no' ``` @example ``` import type {If, IsAny, IsNever} from 'type-fest'; type A = If, 'is any', 'not any'>; //=> 'not any' type B = If, 'is never', 'not never'>; //=> 'is never' ``` @example ``` import type {If, IsEqual} from 'type-fest'; type IfEqual = If, IfBranch, ElseBranch>; type A = IfEqual; //=> 'equal' type B = IfEqual; //=> 'not equal' ``` Note: Sometimes using the `If` type can make an implementation non–tail-recursive, which can impact performance. In such cases, it’s better to use a conditional directly. Refer to the following example: @example ``` import type {If, IsEqual, StringRepeat} from 'type-fest'; type HundredZeroes = StringRepeat<'0', 100>; // The following implementation is not tail recursive type Includes = S extends `${infer First}${infer Rest}` ? If, 'found', Includes> : 'not found'; // Hence, instantiations with long strings will fail // @ts-expect-error type Fails = Includes; // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // Error: Type instantiation is excessively deep and possibly infinite. // However, if we use a simple conditional instead of `If`, the implementation becomes tail-recursive type IncludesWithoutIf = S extends `${infer First}${infer Rest}` ? IsEqual extends true ? 'found' : IncludesWithoutIf : 'not found'; // Now, instantiations with long strings will work type Works = IncludesWithoutIf; //=> 'not found' ``` @category Type Guard @category Utilities */ type If = IsNever extends true ? ElseBranch : Type extends true ? IfBranch : ElseBranch; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/unknown-array.d.ts /** Represents an array with `unknown` value. Use case: You want a type that all arrays can be assigned to, but you don't care about the value. @example ``` import type {UnknownArray} from 'type-fest'; type IsArray = T extends UnknownArray ? true : false; type A = IsArray<['foo']>; //=> true type B = IsArray; //=> true type C = IsArray; //=> false ``` @category Type @category Array */ type UnknownArray = readonly unknown[]; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/array.d.ts /** Returns whether the given array `T` is readonly. */ type IsArrayReadonly = If, false, T extends unknown[] ? false : true>; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/simplify.d.ts /** Useful to flatten the type output to improve type hints shown in editors. And also to transform an interface into a type to aide with assignability. @example ``` import type {Simplify} from 'type-fest'; type PositionProps = { top: number; left: number; }; type SizeProps = { width: number; height: number; }; // In your editor, hovering over `Props` will show a flattened object with all the properties. type Props = Simplify; ``` Sometimes it is desired to pass a value as a function argument that has a different type. At first inspection it may seem assignable, and then you discover it is not because the `value`'s type definition was defined as an interface. In the following example, `fn` requires an argument of type `Record`. If the value is defined as a literal, then it is assignable. And if the `value` is defined as type using the `Simplify` utility the value is assignable. But if the `value` is defined as an interface, it is not assignable because the interface is not sealed and elsewhere a non-string property could be added to the interface. If the type definition must be an interface (perhaps it was defined in a third-party npm package), then the `value` can be defined as `const value: Simplify = ...`. Then `value` will be assignable to the `fn` argument. Or the `value` can be cast as `Simplify` if you can't re-declare the `value`. @example ``` import type {Simplify} from 'type-fest'; interface SomeInterface { foo: number; bar?: string; baz: number | undefined; } type SomeType = { foo: number; bar?: string; baz: number | undefined; }; const literal = {foo: 123, bar: 'hello', baz: 456}; const someType: SomeType = literal; const someInterface: SomeInterface = literal; declare function fn(object: Record): void; fn(literal); // Good: literal object type is sealed fn(someType); // Good: type is sealed // @ts-expect-error fn(someInterface); // Error: Index signature for type 'string' is missing in type 'someInterface'. Because `interface` can be re-opened fn(someInterface as Simplify); // Good: transform an `interface` into a `type` ``` @link https://github.com/microsoft/TypeScript/issues/15300 @see {@link SimplifyDeep} @category Object */ type Simplify = { [KeyType in keyof T]: T[KeyType] } & {}; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/is-equal.d.ts /** Returns a boolean for whether the two given types are equal. @link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650 @link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796 Use-cases: - If you want to make a conditional branch based on the result of a comparison of two types. @example ``` import type {IsEqual} from 'type-fest'; // This type returns a boolean for whether the given array includes the given item. // `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal. type Includes = Value extends readonly [Value[0], ...infer rest] ? IsEqual extends true ? true : Includes : false; ``` @category Type Guard @category Utilities */ type IsEqual = [A] extends [B] ? [B] extends [A] ? _IsEqual : false : false; // This version fails the `equalWrappedTupleIntersectionToBeNeverAndNeverExpanded` test in `test-d/is-equal.ts`. type _IsEqual = (() => G extends A & G | G ? 1 : 2) extends (() => G extends B & G | G ? 1 : 2) ? true : false; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/omit-index-signature.d.ts /** Omit any index signatures from the given object type, leaving only explicitly defined properties. This is the counterpart of `PickIndexSignature`. Use-cases: - Remove overly permissive signatures from third-party types. This type was taken from this [StackOverflow answer](https://stackoverflow.com/a/68261113/420747). It relies on the fact that an empty object (`{}`) is assignable to an object with just an index signature, like `Record`, but not to an object with explicitly defined keys, like `Record<'foo' | 'bar', unknown>`. (The actual value type, `unknown`, is irrelevant and could be any type. Only the key type matters.) ``` const indexed: Record = {}; // Allowed // @ts-expect-error const keyed: Record<'foo', unknown> = {}; // Error // TS2739: Type '{}' is missing the following properties from type 'Record<"foo" | "bar", unknown>': foo, bar ``` Instead of causing a type error like the above, you can also use a [conditional type](https://www.typescriptlang.org/docs/handbook/2/conditional-types.html) to test whether a type is assignable to another: ``` type Indexed = {} extends Record ? '✅ `{}` is assignable to `Record`' : '❌ `{}` is NOT assignable to `Record`'; type IndexedResult = Indexed; //=> '✅ `{}` is assignable to `Record`' type Keyed = {} extends Record<'foo' | 'bar', unknown> ? '✅ `{}` is assignable to `Record<\'foo\' | \'bar\', unknown>`' : '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`'; type KeyedResult = Keyed; //=> '❌ `{}` is NOT assignable to `Record<\'foo\' | \'bar\', unknown>`' ``` Using a [mapped type](https://www.typescriptlang.org/docs/handbook/2/mapped-types.html#further-exploration), you can then check for each `KeyType` of `ObjectType`... ``` type OmitIndexSignature = { [KeyType in keyof ObjectType // Map each key of `ObjectType`... ]: ObjectType[KeyType]; // ...to its original value, i.e. `OmitIndexSignature == Foo`. }; ``` ...whether an empty object (`{}`) would be assignable to an object with that `KeyType` (`Record`)... ``` type OmitIndexSignature = { [KeyType in keyof ObjectType // Is `{}` assignable to `Record`? as {} extends Record ? never // ✅ `{}` is assignable to `Record` : KeyType // ❌ `{}` is NOT assignable to `Record` ]: ObjectType[KeyType]; }; ``` If `{}` is assignable, it means that `KeyType` is an index signature and we want to remove it. If it is not assignable, `KeyType` is a "real" key and we want to keep it. @example ``` import type {OmitIndexSignature} from 'type-fest'; type Example = { // These index signatures will be removed. [x: string]: any; [x: number]: any; [x: symbol]: any; [x: `head-${string}`]: string; [x: `${string}-tail`]: string; [x: `head-${string}-tail`]: string; [x: `${bigint}`]: string; [x: `embedded-${number}`]: string; // These explicitly defined keys will remain. foo: 'bar'; qux?: 'baz'; }; type ExampleWithoutIndexSignatures = OmitIndexSignature; //=> {foo: 'bar'; qux?: 'baz'} ``` @see {@link PickIndexSignature} @category Object */ type OmitIndexSignature = { [KeyType in keyof ObjectType as {} extends Record ? never : KeyType]: ObjectType[KeyType] }; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/pick-index-signature.d.ts /** Pick only index signatures from the given object type, leaving out all explicitly defined properties. This is the counterpart of `OmitIndexSignature`. @example ``` import type {PickIndexSignature} from 'type-fest'; declare const symbolKey: unique symbol; type Example = { // These index signatures will remain. [x: string]: unknown; [x: number]: unknown; [x: symbol]: unknown; [x: `head-${string}`]: string; [x: `${string}-tail`]: string; [x: `head-${string}-tail`]: string; [x: `${bigint}`]: string; [x: `embedded-${number}`]: string; // These explicitly defined keys will be removed. ['kebab-case-key']: string; [symbolKey]: string; foo: 'bar'; qux?: 'baz'; }; type ExampleIndexSignature = PickIndexSignature; // { // [x: string]: unknown; // [x: number]: unknown; // [x: symbol]: unknown; // [x: `head-${string}`]: string; // [x: `${string}-tail`]: string; // [x: `head-${string}-tail`]: string; // [x: `${bigint}`]: string; // [x: `embedded-${number}`]: string; // } ``` @see {@link OmitIndexSignature} @category Object */ type PickIndexSignature = { [KeyType in keyof ObjectType as {} extends Record ? KeyType : never]: ObjectType[KeyType] }; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/merge.d.ts // Merges two objects without worrying about index signatures. type SimpleMerge = Simplify<{ [Key in keyof Destination as Key extends keyof Source ? never : Key]: Destination[Key] } & Source>; /** Merge two types into a new type. Keys of the second type overrides keys of the first type. This is different from the TypeScript `&` (intersection) operator. With `&`, conflicting property types are intersected, which often results in `never`. For example, `{a: string} & {a: number}` makes `a` become `string & number`, which resolves to `never`. With `Merge`, the second type's keys cleanly override the first, so `Merge<{a: string}, {a: number}>` gives `{a: number}` as expected. `Merge` also produces a flattened type (via `Simplify`), making it more readable in IDE tooltips compared to `A & B`. @example ``` import type {Merge} from 'type-fest'; type Foo = { a: string; b: number; }; type Bar = { a: number; // Conflicts with Foo['a'] c: boolean; }; // With `&`, `a` becomes `string & number` which is `never`. Not what you want. type WithIntersection = (Foo & Bar)['a']; //=> never // With `Merge`, `a` is cleanly overridden to `number`. type WithMerge = Merge['a']; //=> number ``` @example ``` import type {Merge} from 'type-fest'; type Foo = { [x: string]: unknown; [x: number]: unknown; foo: string; bar: symbol; }; type Bar = { [x: number]: number; [x: symbol]: unknown; bar: Date; baz: boolean; }; export type FooBar = Merge; //=> { // [x: string]: unknown; // [x: number]: number; // [x: symbol]: unknown; // foo: string; // bar: Date; // baz: boolean; // } ``` Note: If you want a merge type that more accurately reflects the runtime behavior of object spread or `Object.assign`, refer to the {@link ObjectMerge} type. @see {@link ObjectMerge} @category Object */ type Merge = Destination extends unknown // For distributing `Destination` ? Source extends unknown // For distributing `Source` ? If, Destination, _Merge> : never // Should never happen : never; // Should never happen type _Merge = Simplify, PickIndexSignature> & SimpleMerge, OmitIndexSignature>>; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/internal/object.d.ts /** Works similar to the built-in `Pick` utility type, except for the following differences: - Distributes over union types and allows picking keys from any member of the union type. - Primitives types are returned as-is. - Picks all keys if `Keys` is `any`. - Doesn't pick `number` from a `string` index signature. @example ``` type ImageUpload = { url: string; size: number; thumbnailUrl: string; }; type VideoUpload = { url: string; duration: number; encodingFormat: string; }; // Distributes over union types and allows picking keys from any member of the union type type MediaDisplay = HomomorphicPick; //=> {url: string; size: number} | {url: string; duration: number} // Primitive types are returned as-is type Primitive = HomomorphicPick; //=> string | number // Picks all keys if `Keys` is `any` type Any = HomomorphicPick<{a: 1; b: 2} | {c: 3}, any>; //=> {a: 1; b: 2} | {c: 3} // Doesn't pick `number` from a `string` index signature type IndexSignature = HomomorphicPick<{[k: string]: unknown}, number>; //=> {} */ type HomomorphicPick> = { [P in keyof T as Extract]: T[P] }; /** Merges user specified options with default options. @example ``` type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false}; type SpecifiedOptions = {leavesOnly: true}; type Result = ApplyDefaultOptions; //=> {maxRecursionDepth: 10; leavesOnly: true} ``` @example ``` // Complains if default values are not provided for optional options type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10}; type SpecifiedOptions = {}; type Result = ApplyDefaultOptions; // ~~~~~~~~~~~~~~~~~~~ // Property 'leavesOnly' is missing in type 'DefaultPathsOptions' but required in type '{ maxRecursionDepth: number; leavesOnly: boolean; }'. ``` @example ``` // Complains if an option's default type does not conform to the expected type type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: 'no'}; type SpecifiedOptions = {}; type Result = ApplyDefaultOptions; // ~~~~~~~~~~~~~~~~~~~ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'. ``` @example ``` // Complains if an option's specified type does not conform to the expected type type PathsOptions = {maxRecursionDepth?: number; leavesOnly?: boolean}; type DefaultPathsOptions = {maxRecursionDepth: 10; leavesOnly: false}; type SpecifiedOptions = {leavesOnly: 'yes'}; type Result = ApplyDefaultOptions; // ~~~~~~~~~~~~~~~~ // Types of property 'leavesOnly' are incompatible. Type 'string' is not assignable to type 'boolean'. ``` */ type ApplyDefaultOptions, RequiredKeysOf> & Partial, never>>>, SpecifiedOptions extends Options> = If, Defaults, If, Defaults, Simplify ? undefined extends SpecifiedOptions[Key] ? never : Key : Key]: SpecifiedOptions[Key] }> & Required>>>; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/except.d.ts /** Filter out keys from an object. Returns `never` if `Exclude` is strictly equal to `Key`. Returns `never` if `Key` extends `Exclude`. Returns `Key` otherwise. @example ``` type Filtered = Filter<'foo', 'foo'>; //=> never ``` @example ``` type Filtered = Filter<'bar', string>; //=> never ``` @example ``` type Filtered = Filter<'bar', 'foo'>; //=> 'bar' ``` @see {Except} */ type Filter = IsEqual extends true ? never : (KeyType extends ExcludeType ? never : KeyType); type ExceptOptions = { /** Disallow assigning non-specified properties. Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`. @default false */ requireExactProps?: boolean; }; type DefaultExceptOptions = { requireExactProps: false; }; /** Create a type from an object type without certain keys. We recommend setting the `requireExactProps` option to `true`. This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically. This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)). @example ``` import type {Except} from 'type-fest'; type Foo = { a: number; b: string; }; type FooWithoutA = Except; //=> {b: string} // @ts-expect-error const fooWithoutA: FooWithoutA = {a: 1, b: '2'}; // errors: 'a' does not exist in type '{ b: string; }' type FooWithoutB = Except; //=> {a: number} & Partial> // @ts-expect-error const fooWithoutB: FooWithoutB = {a: 1, b: '2'}; // errors at 'b': Type 'string' is not assignable to type 'undefined'. // The `Omit` utility type doesn't work when omitting specific keys from objects containing index signatures. // Consider the following example: type UserData = { [metadata: string]: string; email: string; name: string; role: 'admin' | 'user'; }; // `Omit` clearly doesn't behave as expected in this case: type PostPayload = Omit; //=> {[x: string]: string; [x: number]: string} // In situations like this, `Except` works better. // It simply removes the `email` key while preserving all the other keys. type PostPayloadFixed = Except; //=> {[x: string]: string; name: string; role: 'admin' | 'user'} ``` @category Object */ type Except = _Except>; type _Except> = { [KeyType in keyof ObjectType as Filter]: ObjectType[KeyType] } & (Options['requireExactProps'] extends true ? Partial> : {}); //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/writable.d.ts /** Create a writable version of the given array type. */ type WritableArray = ArrayType extends readonly [] ? [] : ArrayType extends readonly [...infer U, infer V] ? [...U, V] : ArrayType extends readonly [infer U, ...infer V] ? [U, ...V] : ArrayType extends ReadonlyArray ? U[] : ArrayType; /** Create a type that strips `readonly` from the given type. Inverse of `Readonly`. The 2nd argument will be ignored if the input type is not an object. Note: This type can make readonly `Set` and `Map` writable. This behavior is different from `Readonly` (as of TypeScript 5.2.2). See: https://github.com/microsoft/TypeScript/issues/29655 This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509), or to define a single model where the only thing that changes is whether or not some of the keys are writable. @example ``` import type {Writable} from 'type-fest'; type Foo = { readonly a: number; readonly b: readonly string[]; // To show that only the mutability status of the properties, not their values, are affected. readonly c: boolean; }; const writableFoo: Writable = {a: 1, b: ['2'], c: true}; writableFoo.a = 3; // @ts-expect-error writableFoo.b[0] = 'new value'; // Will still fail as the value of property "b" is still a readonly type. writableFoo.b = ['something']; // Will work as the "b" property itself is no longer readonly. type SomeWritable = Writable; //=> {readonly a: number; b: readonly string[]; c: boolean} // Also supports array const readonlyArray: readonly number[] = [1, 2, 3]; // @ts-expect-error readonlyArray.push(4); // Will fail as the array itself is readonly. const writableArray: Writable = readonlyArray as Writable; writableArray.push(4); // Will work as the array itself is now writable. ``` @category Object */ type Writable = BaseType extends ReadonlyMap ? Map : BaseType extends ReadonlySet ? Set : BaseType extends readonly unknown[] // Handle array ? WritableArray // Handle object : Simplify< // Pick just the keys that are not writable from the base type. Except // Pick the keys that should be writable from the base type and make them writable by removing the `readonly` modifier from the key. & { -readonly [KeyType in keyof Pick]: Pick[KeyType] }>; //#endregion //#region ../../node_modules/.pnpm/type-fest@5.6.0/node_modules/type-fest/source/set-required.d.ts /** Create a type that makes the given keys required, while keeping the remaining keys as is. Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required. @example ``` import type {SetRequired} from 'type-fest'; type Foo = { a?: number; b: string; c?: boolean; }; type SomeRequired = SetRequired; //=> {a?: number; b: string; c: boolean} // Set specific indices in an array to be required. type ArrayExample = SetRequired<[number?, number?, number?], 0 | 1>; //=> [number, number, number?] ``` @category Object */ type SetRequired = (BaseType extends ((...arguments_: never) => any) ? (...arguments_: Parameters) => ReturnType : unknown) & _SetRequired; type _SetRequired = BaseType extends UnknownArray ? SetArrayRequired extends infer ResultantArray ? If, Readonly, ResultantArray> : never : Simplify< // Pick just the keys that are optional from the base type. Except // Pick the keys that should be required from the base type and make them required. & Required>>; /** Remove the optional modifier from the specified keys in an array. */ type SetArrayRequired = TArray extends unknown // For distributing `TArray` when it's a union ? keyof TArray & `${number}` extends never // Exit if `TArray` is empty (e.g., []), or // `TArray` contains no non-rest elements preceding the rest element (e.g., `[...string[]]` or `[...string[], string]`). ? [...Accumulator, ...TArray] : TArray extends readonly [(infer First)?, ...infer Rest] ? '0' extends OptionalKeysOf // If the first element of `TArray` is optional ? `${Counter['length']}` extends `${Keys & (string | number)}` // If the current index needs to be required ? SetArrayRequired // If the current element is optional, but it doesn't need to be required, // then we can exit early, since no further elements can now be made required. : [...Accumulator, ...TArray] : SetArrayRequired : never // Should never happen, since `[(infer F)?, ...infer R]` is a top-type for arrays. : never; // Should never happen //#endregion //#region ../../node_modules/.pnpm/maverick.js@0.44.1/node_modules/maverick.js/dist/dev/element.d.ts //#region src/element/define.d.ts declare function defineCustomElement(element: CustomElementConstructor, throws?: boolean): void; interface CustomElementConstructor { readonly tagName: string; new (): HTMLElement; } //#endregion //#endregion export { Attributes, Component, Context, DOMEvent, type Dispose, EventsTarget, InferEventDetail, MaverickElementConstructor, type MaybeStopEffect, type ReadSignal, ReadSignalRecord, type Scope, SetRequired, State, Store, ViewController, Writable, type WriteSignal, appendTriggerEvent, defineCustomElement, findTriggerEvent, hasTriggerEvent, isKeyboardClick, isKeyboardEvent, isPointerEvent, walkTriggerEventChain };