Comparing version 0.3.18 to 0.3.19-1
@@ -1,1 +0,128 @@ | ||
//# sourceMappingURL=index.d.ts.map | ||
declare module 'bitecs' { | ||
export type Type = | ||
'i8' | | ||
'ui8' | | ||
'ui8c' | | ||
'i16' | | ||
'ui16' | | ||
'i32' | | ||
'ui32' | | ||
'f32' | | ||
'f64' | ||
export type ListType = readonly [Type, number]; | ||
export const Types: { | ||
i8: "i8" | ||
ui8: "ui8" | ||
ui8c: "ui8c" | ||
i16: "i16" | ||
ui16: "ui16" | ||
i32: "i32" | ||
ui32: "ui32" | ||
f32: "f32" | ||
f64: "f64" | ||
}; | ||
export type TypedArray = | ||
Uint8Array | | ||
Int8Array | | ||
Uint8Array | | ||
Uint8ClampedArray | | ||
Int16Array | | ||
Uint16Array | | ||
Int32Array | | ||
Uint32Array | | ||
Float32Array | | ||
Float64Array | ||
export type ArrayByType = { | ||
[Types.i8]: Int8Array; | ||
[Types.ui8]: Uint8Array; | ||
[Types.ui8c]: Uint8ClampedArray; | ||
[Types.i16]: Int16Array; | ||
[Types.ui16]: Uint16Array; | ||
[Types.i32]: Int32Array; | ||
[Types.ui32]: Uint32Array; | ||
[Types.f32]: Float32Array; | ||
[Types.f64]: Float64Array; | ||
} | ||
export enum DESERIALIZE_MODE { | ||
REPLACE, | ||
APPEND, | ||
MAP | ||
} | ||
export type ComponentType<T extends ISchema> = { | ||
[key in keyof T]: T[key] extends Type | ||
? ArrayByType[T[key]] | ||
: T[key] extends [infer RT, number] | ||
? RT extends Type | ||
? Array<ArrayByType[RT]> | ||
: unknown | ||
: T[key] extends ISchema | ||
? ComponentType<T[key]> | ||
: unknown; | ||
}; | ||
export interface IWorld { | ||
[key: string]: any | ||
} | ||
export interface ISchema { | ||
[key: string]: Type | ListType | ISchema | ||
} | ||
export interface IComponentProp { | ||
[key: string]: TypedArray | Array<TypedArray> | ||
} | ||
export interface IComponent { | ||
[key: string]: TypedArray | IComponentProp | ||
} | ||
export type Component = IComponent | ComponentType<ISchema> | ||
export type QueryModifier = (c: (IComponent | IComponentProp)[]) => (world: IWorld) => IComponent | QueryModifier | ||
export type Query = (world: IWorld, clearDiff?: Boolean) => number[] | ||
export type System = (world: IWorld, ...args: any[]) => IWorld | ||
export type Serializer = (target: IWorld | number[]) => ArrayBuffer | ||
export type Deserializer = (world: IWorld, packet: ArrayBuffer, mode?: DESERIALIZE_MODE) => void | ||
export function setDefaultSize(size: number): void | ||
export function createWorld(): IWorld | ||
export function resetWorld(world: IWorld): IWorld | ||
export function deleteWorld(world: IWorld): void | ||
export function addEntity(world: IWorld): number | ||
export function removeEntity(world: IWorld, eid: number): void | ||
export function registerComponent(world: IWorld, component: Component): void | ||
export function registerComponents(world: IWorld, components: Component[]): void | ||
export function defineComponent<T extends ISchema>(schema?: T): ComponentType<T> | ||
export function addComponent(world: IWorld, component: Component, eid: number, reset?: boolean): void | ||
export function removeComponent(world: IWorld, component: Component, eid: number, reset?: boolean): void | ||
export function hasComponent(world: IWorld, component: Component, eid: number): boolean | ||
export function getEntityComponents(world: IWorld, eid: number): Component[] | ||
export function defineQuery(components: (Component | QueryModifier)[]): Query | ||
export function Changed(c: Component): Component | QueryModifier | ||
export function Not(c: Component): Component | QueryModifier | ||
export function enterQuery(query: Query): Query | ||
export function exitQuery(query: Query): Query | ||
export function resetChangedQuery(world: IWorld, query: Query): Query | ||
export function removeQuery(world: IWorld, query: Query): Query | ||
export function commitRemovals(world: IWorld): void | ||
export function defineSystem(update: (world: IWorld, ...args: any[]) => IWorld): System | ||
export function defineSerializer(target: IWorld | Component[] | IComponentProp[] | QueryModifier, maxBytes?: number): Serializer | ||
export function defineDeserializer(target: IWorld | Component[] | IComponentProp[] | QueryModifier): Deserializer | ||
export function pipe(...fns: ((...args: any[]) => any)[]): (...input: any[]) => any | ||
export const parentArray: Symbol | ||
} |
@@ -106,4 +106,4 @@ declare module 'bitecs' { | ||
export function defineComponent<T extends ISchema>(schema?: T): ComponentType<T> | ||
export function addComponent(world: IWorld, component: Component, eid: number): void | ||
export function removeComponent(world: IWorld, component: Component, eid: number): void | ||
export function addComponent(world: IWorld, component: Component, eid: number, reset?: boolean): void | ||
export function removeComponent(world: IWorld, component: Component, eid: number, reset?: boolean): void | ||
export function hasComponent(world: IWorld, component: Component, eid: number): boolean | ||
@@ -110,0 +110,0 @@ export function getEntityComponents(world: IWorld, eid: number): Component[] |
{ | ||
"name": "bitecs", | ||
"version": "0.3.18", | ||
"version": "0.3.19-1", | ||
"description": "Functional, minimal, data-driven, ultra-high performance ECS library written in Javascript", | ||
@@ -38,3 +38,3 @@ "license": "MPL-2.0", | ||
"docs": "node scripts/docs.js", | ||
"dist": "npm run test && npm run build -- -t && npm run docs" | ||
"dist": "npm run test && npm run build && npm run docs" | ||
}, | ||
@@ -41,0 +41,0 @@ "devDependencies": { |
@@ -108,5 +108,3 @@ import { strictEqual } from 'assert' | ||
ents = notFooBarQuery(world) | ||
strictEqual(ents.length, 2) | ||
strictEqual(ents[0], 0) | ||
strictEqual(ents[1], 1) | ||
strictEqual(ents.length, 0) | ||
@@ -139,7 +137,6 @@ // and notFooQuery should have eid 1 | ||
// notFooBarQuery should have eid 0 and 1 | ||
// notFooBarQuery should only have eid 0 | ||
ents = notFooBarQuery(world) | ||
strictEqual(ents.length, 2) | ||
strictEqual(ents.length, 1) | ||
strictEqual(ents[0], 0) | ||
strictEqual(ents[1], 1) | ||
@@ -154,6 +151,5 @@ | ||
ents = notFooBarQuery(world) | ||
strictEqual(ents.length, 3) | ||
strictEqual(ents.length, 2) | ||
strictEqual(ents[0], 0) | ||
strictEqual(ents[1], 1) | ||
strictEqual(ents[2], 2) | ||
strictEqual(ents[1], 2) | ||
@@ -160,0 +156,0 @@ // and notFooQuery should have eid 1, 0, & 2 |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
257495
2727
0
22