Skip to content

Commit

Permalink
broad select type to include selections, node, str
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristopherChudzicki committed Mar 27, 2022
1 parent 84519f8 commit 708f728
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 21 deletions.
30 changes: 15 additions & 15 deletions build/esm/primitives/types/traits.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export declare const Traits: {
live: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
};
buffer: {
channels: import("./types_typed").Type<import("./types_typed").Optional<1 | 2 | 3 | 4>, 1 | 2 | 3 | 4>;
channels: import("./types_typed").Type<import("./types_typed").Optional<1 | 4 | 2 | 3>, 1 | 4 | 2 | 3>;
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
fps: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
hurry: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
Expand Down Expand Up @@ -164,12 +164,12 @@ export declare const Traits: {
zOrder: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
geometry: {
points: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
colors: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
points: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
colors: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props> | null>;
};
point: {
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
sizes: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
sizes: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props> | null>;
shape: any;
optical: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
fill: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
Expand All @@ -186,7 +186,7 @@ export declare const Traits: {
mesh: {
fill: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
shaded: import("./types_typed").Type<import("./types_typed").Optional<boolean>, boolean>;
map: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
map: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props> | null>;
lineBias: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
strip: {
Expand Down Expand Up @@ -225,7 +225,7 @@ export declare const Traits: {
sdf: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
label: {
text: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
text: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
outline: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
expand: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
Expand All @@ -236,8 +236,8 @@ export declare const Traits: {
zIndex: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
};
dom: {
points: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
html: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
points: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
html: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
size: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
outline: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
zoom: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
Expand All @@ -251,16 +251,16 @@ export declare const Traits: {
type: any;
};
shader: {
sources: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | null>;
sources: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props> | null>;
language: import("./types_typed").Type<import("./types_typed").Optional<string>, string>;
code: import("./types_typed").Type<import("./types_typed").Optional<string>, string>;
uniforms: import("./types_typed").Type<unknown, unknown>;
};
include: {
shader: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
shader: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
};
operator: {
source: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
source: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
};
spread: {
unit: any;
Expand Down Expand Up @@ -338,18 +338,18 @@ export declare const Traits: {
type: any;
expr: import("./types_typed").Type<unknown, unknown>;
data: any;
channels: import("./types_typed").Type<import("./types_typed").Optional<1 | 2 | 3 | 4>, 1 | 2 | 3 | 4>;
channels: import("./types_typed").Type<import("./types_typed").Optional<1 | 4 | 2 | 3>, 1 | 4 | 2 | 3>;
items: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
width: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
height: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
depth: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
root: {
speed: import("./types_typed").Type<import("./types_typed").Optional<number>, number>;
camera: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
camera: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
};
inherit: {
source: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
source: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
traits: import("./types_typed").Type<import("./types_typed").Optional<string>[], string[]>;
};
rtt: {
Expand Down Expand Up @@ -393,7 +393,7 @@ export declare const Traits: {
seek: import("./types_typed").Type<import("./types_typed").Optional<number>, number | null>;
};
track: {
target: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props>>;
target: import("./types_typed").Type<import("./types_typed").Optional<string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>, string | import("../../types").MathboxNode<keyof import("../../types").Props> | import("../../types").MathboxSelection<keyof import("../../types").Props>>;
script: any;
ease: any;
};
Expand Down
4 changes: 2 additions & 2 deletions build/esm/primitives/types/types_typed.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* specifying types that are only consumed in our source code, but no good for
* specifying types that should be included in the output.
*/
import type { MathboxNode } from "../../types";
import type { MathboxNode, MathboxSelection } from "../../types";
declare type OnInvalid = () => void;
declare type Validate<In, Out> = (value: In, target: unknown, invalid: OnInvalid) => Out;
export interface Type<In, Out> {
Expand Down Expand Up @@ -40,7 +40,7 @@ export declare type TypeGenerators = {
transitionState(defaultValue?: TransitionStates): Type<Optional<TransitionStates>, TransitionStates>;
axis(value?: Axes, allowZero?: false): Type<Optional<Axes>, number>;
axis(value: AxesWithZero, allowZero: true): Type<Optional<AxesWithZero>, number>;
select(defaultValue?: string): Type<Optional<string | MathboxNode>, string | MathboxNode>;
select(defaultValue?: string): Type<Optional<string | MathboxNode | MathboxSelection>, string | MathboxNode | MathboxSelection>;
letters<I, O>(type: Type<I, O>, size?: number, value?: string): Type<Optional<string | I[]>, O[]>;
int(value?: number): Type<Optional<number>, number>;
round(value?: number): Type<Optional<number>, number>;
Expand Down
2 changes: 1 addition & 1 deletion build/esm/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export interface MathboxNode<T extends NodeType = NodeType> {
/**
* @typeParam Type The type(s) of MathBox nodes in this selection.
*/
export interface MathboxSelection<Type extends NodeType> {
export interface MathboxSelection<Type extends NodeType = NodeType> {
/**
* Set properties on all nodes in this selection.
*/
Expand Down
7 changes: 5 additions & 2 deletions src/primitives/types/types_typed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* specifying types that are only consumed in our source code, but no good for
* specifying types that should be included in the output.
*/
import type { MathboxNode } from "../../types";
import type { MathboxNode, MathboxSelection } from "../../types";
import { Types as TypesUntyped } from "./types";

type OnInvalid = () => void;
Expand Down Expand Up @@ -101,7 +101,10 @@ export type TypeGenerators = {
): Type<Optional<AxesWithZero>, number>;
select(
defaultValue?: string
): Type<Optional<string | MathboxNode>, string | MathboxNode>;
): Type<
Optional<string | MathboxNode | MathboxSelection>,
string | MathboxNode | MathboxSelection
>;

letters<I, O>(
type: Type<I, O>,
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ export interface MathboxNode<T extends NodeType = NodeType> {
/**
* @typeParam Type The type(s) of MathBox nodes in this selection.
*/
export interface MathboxSelection<Type extends NodeType> {
export interface MathboxSelection<Type extends NodeType = NodeType> {
/**
* Set properties on all nodes in this selection.
*/
Expand Down

0 comments on commit 708f728

Please sign in to comment.