diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..2e1fa2d52e --- /dev/null +++ b/.prettierignore @@ -0,0 +1 @@ +*.md \ No newline at end of file diff --git a/README.md b/README.md index a6a550a02c..1e2eb67a20 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,16 @@ There's a steadily growing number (40+) of standalone examples (different complexities, often combining functionality from several packages) in the [examples](./examples) directory. +## Blog posts + +- [How to UI in 2018](https://medium.com/@thi.ng/how-to-ui-in-2018-ac2ae02acdf3) + +- "Of umbrellas, transducers, reactive streams & mushrooms" (ongoing series): + - [Part 1 - Project & series overview](https://medium.com/@thi.ng/of-umbrellas-transducers-reactive-streams-mushrooms-pt-1-a8717ce3a170) + - [Part 2 - HOFs, Transducers, Reducers](https://medium.com/@thi.ng/of-umbrellas-transducers-reactive-streams-mushrooms-pt-2-9c540beb0023) + - [Part 3 - Convolution, 1D/2D Cellular automata](https://medium.com/@thi.ng/of-umbrellas-transducers-reactive-streams-mushrooms-pt-3-a1c4e621db9b) + - [Part 4 - Disjoint Sets, Graph analysis, Signed Distance Fields](https://medium.com/@thi.ng/of-umbrellas-transducers-reactive-streams-mushrooms-pt-4-62d8e71e5603) + ## Projects ### Fundamentals diff --git a/examples/canvas-dial/src/dial.ts b/examples/canvas-dial/src/dial.ts index 1e1236e2fb..14fab20cc5 100644 --- a/examples/canvas-dial/src/dial.ts +++ b/examples/canvas-dial/src/dial.ts @@ -4,11 +4,7 @@ import { isString } from "@thi.ng/checks"; import { canvas2D } from "@thi.ng/hdom-components"; import { fitClamped } from "@thi.ng/math"; import { Subscription } from "@thi.ng/rstream"; -import { - GestureEvent, - gestureStream, - GestureType -} from "@thi.ng/rstream-gestures"; +import { GestureEvent, gestureStream, GestureType } from "@thi.ng/rstream-gestures"; import { heading, sub2 } from "@thi.ng/vectors"; /** @@ -68,7 +64,7 @@ export interface DialOpts { /** * Label formatter. No label will be displayed, if missing. */ - label: (x: number) => string; + label: Fn; /** * Label Y offset from `cy` * Default: 0 diff --git a/examples/cellular-automata/src/index.ts b/examples/cellular-automata/src/index.ts index cdf6078870..65513fc610 100644 --- a/examples/cellular-automata/src/index.ts +++ b/examples/cellular-automata/src/index.ts @@ -4,9 +4,8 @@ import { buildKernel2d, comp, convolve2d, - lookup2d, map, - multiplex, + mapIndexed, partition, push, range2d, @@ -83,11 +82,8 @@ export const convolve = ( ) => transduce( comp( - multiplex( - convolve2d({ src, width, height, kernel, wrap }), - map(lookup2d(src, width)) - ), - map(lookup2d(rules, rstride)) + convolve2d({ src, width, height, kernel, wrap }), + mapIndexed((i, x) => rules[x + src[i] * rstride]) ), push(), range2d(width, height) diff --git a/examples/devcards/src/index.ts b/examples/devcards/src/index.ts index eb6e38f891..b7b55fd658 100644 --- a/examples/devcards/src/index.ts +++ b/examples/devcards/src/index.ts @@ -1,3 +1,4 @@ +import { Fn } from "@thi.ng/api"; import { IAtom } from "@thi.ng/atom"; import { Atom, Cursor } from "@thi.ng/atom"; import { start } from "@thi.ng/hdom"; @@ -65,8 +66,8 @@ interface SliderOpts { min: number; max: number; step?: number; - label: (val) => any; - onchange?: (e) => void; + label: Fn; + onchange?: EventListener; } /** @@ -129,16 +130,14 @@ function bmi(state: IAtom) { ]; // derived view of bmi value to translate it into english - const bmiClass = state.addView( - "bmi", - (bmi: number) => - bmi > thresh[3][0] - ? thresh[3][1] - : bmi > thresh[2][0] - ? thresh[2][1] - : bmi > thresh[1][0] - ? thresh[1][1] - : thresh[0][1] + const bmiClass = state.addView("bmi", (bmi: number) => + bmi > thresh[3][0] + ? thresh[3][1] + : bmi > thresh[2][0] + ? thresh[2][1] + : bmi > thresh[1][0] + ? thresh[1][1] + : thresh[0][1] ); // another derived view to create SVG visualization diff --git a/examples/hdom-dropdown-fuzzy/src/dropdown.ts b/examples/hdom-dropdown-fuzzy/src/dropdown.ts index 7ccd780d6c..ca60e224a7 100644 --- a/examples/hdom-dropdown-fuzzy/src/dropdown.ts +++ b/examples/hdom-dropdown-fuzzy/src/dropdown.ts @@ -1,8 +1,8 @@ -import { IObjectOf } from "@thi.ng/api"; +import { Fn, IObjectOf } from "@thi.ng/api"; import { ReadonlyAtom } from "@thi.ng/atom"; import { isString } from "@thi.ng/checks"; import { appLink } from "@thi.ng/hdom-components"; -import { EventBus, EV_SET_VALUE, EV_TOGGLE_VALUE } from "@thi.ng/interceptors"; +import { EV_SET_VALUE, EV_TOGGLE_VALUE, EventBus } from "@thi.ng/interceptors"; import { getIn, Path } from "@thi.ng/paths"; export interface BaseContext { @@ -14,7 +14,7 @@ export interface DropdownArgs { state: DropdownState; statePath: Path; ontoggle: EventListener; - onchange: (id: any) => EventListener; + onchange: Fn; attribs: IObjectOf; hoverLabel: any; openLabel: any; diff --git a/examples/hdom-dropdown/src/dropdown.ts b/examples/hdom-dropdown/src/dropdown.ts index fe1bc9f411..3e684bc587 100644 --- a/examples/hdom-dropdown/src/dropdown.ts +++ b/examples/hdom-dropdown/src/dropdown.ts @@ -1,4 +1,4 @@ -import { IObjectOf } from "@thi.ng/api"; +import { Fn, IObjectOf } from "@thi.ng/api"; import { ReadonlyAtom } from "@thi.ng/atom"; import { appLink } from "@thi.ng/hdom-components"; import { EV_SET_VALUE, EV_TOGGLE_VALUE, EventBus } from "@thi.ng/interceptors"; @@ -13,7 +13,7 @@ export interface DropdownArgs { state: DropdownState; statePath: Path; ontoggle: EventListener; - onchange: (id: any) => EventListener; + onchange: Fn; attribs: IObjectOf; hoverLabel: any; onmouseover: EventListener; diff --git a/examples/wolfram/.gitignore b/examples/wolfram/.gitignore new file mode 100644 index 0000000000..0c5abcab62 --- /dev/null +++ b/examples/wolfram/.gitignore @@ -0,0 +1,5 @@ +.cache +out +node_modules +yarn.lock +*.js diff --git a/examples/wolfram/README.md b/examples/wolfram/README.md new file mode 100644 index 0000000000..9a345a30b4 --- /dev/null +++ b/examples/wolfram/README.md @@ -0,0 +1,13 @@ +# wolfram + +[Live demo](http://demo.thi.ng/umbrella/wolfram/) + +Please refer to the [example build instructions](https://github.com/thi-ng/umbrella/wiki/Example-build-instructions) on the wiki. + +## Authors + +- Karsten Schmidt + +## License + +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/examples/wolfram/index.html b/examples/wolfram/index.html new file mode 100644 index 0000000000..d972fd0273 --- /dev/null +++ b/examples/wolfram/index.html @@ -0,0 +1,16 @@ + + + + + + + wolfram + + + + +
+ + + diff --git a/examples/wolfram/package.json b/examples/wolfram/package.json new file mode 100644 index 0000000000..b93b8374ae --- /dev/null +++ b/examples/wolfram/package.json @@ -0,0 +1,32 @@ +{ + "name": "wolfram", + "version": "0.0.1", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "clean": "rm -rf .cache build out", + "build": "yarn clean && parcel build index.html -d out --public-url ./ --no-source-maps --no-cache --detailed-report --experimental-scope-hoisting", + "start": "parcel index.html -p 8080 --open" + }, + "devDependencies": { + "parcel-bundler": "^1.11.0", + "rimraf": "^2.6.3", + "terser": "^3.14.1", + "typescript": "^3.2.2" + }, + "dependencies": { + "@thi.ng/api": "latest", + "@thi.ng/hdom-components": "latest", + "@thi.ng/rstream": "latest", + "@thi.ng/transducers": "latest", + "@thi.ng/transducers-binary": "latest", + "@thi.ng/transducers-hdom": "latest" + }, + "browserslist": [ + "last 3 Chrome versions" + ], + "browser": { + "process": false + } +} diff --git a/examples/wolfram/src/download.ts b/examples/wolfram/src/download.ts new file mode 100644 index 0000000000..1097e53bbf --- /dev/null +++ b/examples/wolfram/src/download.ts @@ -0,0 +1,29 @@ +/** + * Helper function to trigger download of given `src` string as local + * file with filename `name` and mime `type`. Wraps `src` as blob and + * creates an object URL for download. By default, the URL auto-expires + * after 10 seconds to free up memory. + * + * @param name + * @param src + * @param type + * @param expire + */ +export function download( + name: string, + src: string, + type = "image/svg", + expire = 10000 +) { + const blob = new Blob([src], { type }); + const uri = URL.createObjectURL(blob); + const a = document.createElement("a"); + a.download = name; + a.href = uri; + document.body.appendChild(a); + a.click(); + document.body.removeChild(a); + if (uri.indexOf("blob:") === 0) { + setTimeout(() => URL.revokeObjectURL(uri), expire); + } +} diff --git a/examples/wolfram/src/index.ts b/examples/wolfram/src/index.ts new file mode 100644 index 0000000000..c52a0baa6a --- /dev/null +++ b/examples/wolfram/src/index.ts @@ -0,0 +1,171 @@ +import { dropdown } from "@thi.ng/hdom-components"; +import { + fromIterable, + fromRAF, + metaStream, + sidechainToggle, + stream, + sync +} from "@thi.ng/rstream"; +import { + buildKernel1d, + comp, + convolve1d, + filter, + flatten, + iterator1, + lookup1d, + map, + range, + range2d, + reducer, + scan, + slidingWindow, + str, + transduce, + zip +} from "@thi.ng/transducers"; +import { bits, randomBits } from "@thi.ng/transducers-binary"; +import { updateDOM } from "@thi.ng/transducers-hdom"; +import { download } from "./download"; + +const WIDTH = 160; +const HEIGHT = 32; + +const resetCA = () => [...randomBits(0.25, WIDTH)]; + +const evolveCA = (src, { kernel, rule, reset }) => + reset + ? resetCA() + : [ + ...iterator1( + comp( + convolve1d({ + src, + kernel, + width: src.length, + wrap: true + }), + map(lookup1d(rule)) + ), + range(src.length) + ) + ]; + +const triggerReset = () => + wolfram.add(fromIterable([true, false], 16), "reset"); + +const triggerOBJExport = () => objExport.next(1); + +const setRule = (e) => { + rule.next(parseInt(e.target.value)); + triggerReset(); +}; + +const setKernel = (e) => kernel.next(parseInt(e.target.value)); + +const app = ({ id, ksize, sim }) => [ + "div.sans-serif.ma3", + [ + "div", + "Rule:", + [ + "input.w4.h2.mh3.pa2", + { + type: "number", + value: id, + oninput: setRule + } + ], + "Kernel:", + [ + dropdown, + { class: "h2 pa2 mh3", onchange: setKernel }, + [[3, "3"], [5, "5"]], + ksize + ], + [ + "button.mr3.pa2", + { + onclick: triggerReset + }, + "Reset" + ], + [ + "button.mr3.pa2", + { + onclick: triggerOBJExport + }, + "Export OBJ" + ], + [ + "a.link.blue", + { + href: + "https://en.wikipedia.org/wiki/Elementary_cellular_automaton#Random_initial_state" + }, + "Wikipedia" + ] + ], + ["pre.f7.code", sim] +]; + +const rule = stream(); +const kernel = stream(); +const objExport = metaStream(() => fromIterable([true, false], 17)); + +const wolfram = sync({ + src: { + rule: rule.transform(map((x) => [...bits(32, false, [x])])), + kernel: kernel.transform( + map((x) => buildKernel1d([1, 2, 4, 8, 16], x)) + ), + _: fromRAF() + }, + xform: scan(reducer(resetCA, evolveCA)) +}); + +const main = sync({ + src: { + id: rule, + ksize: kernel, + sim: wolfram.transform( + map((gen) => gen.map((x) => " █"[x]).join("")), + slidingWindow(HEIGHT), + map((win: string[]) => win.join("\n")) + ) + } +}).transform(map(app), updateDOM()); + +// Wavefront OBJ 3D pointcloud export +// attached as second subscription to wolfram stream +// uses `objExport` metastream as toggle switch to produce OBJ file +// and trigger download +wolfram + // always collect new generations + // history length same as WIDTH to export square area + .transform(slidingWindow(WIDTH)) + // sidechainToggle is only letting new values through if enabled by + // objExport stream + .subscribe(sidechainToggle(objExport, false)) + // actual OBJ conversion & export + .transform( + map((grid) => + transduce( + comp(filter((t) => !!t[1]), map(([[x, y]]) => `v ${x} ${y} 0`)), + str("\n"), + zip(range2d(WIDTH, WIDTH), flatten(grid)) + ) + ), + map((obj: string) => + download(`ca-${rule.deref()}.obj`, obj, "text/plain") + ) + ); + +rule.next(105); +kernel.next(3); + +if (process.env.NODE_ENV !== "production") { + const hot = (module).hot; + hot && hot.dispose(() => main.done()); +} diff --git a/examples/wolfram/tsconfig.json b/examples/wolfram/tsconfig.json new file mode 100644 index 0000000000..bbf112cc18 --- /dev/null +++ b/examples/wolfram/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": ".", + "target": "es6", + "sourceMap": true + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/package.json b/package.json index 1dc905d799..0c72de9261 100644 --- a/package.json +++ b/package.json @@ -5,6 +5,7 @@ ], "devDependencies": { "benchmark": "^2.1.4", + "file-loader": "^3.0.1", "gzip-size": "^5.0.0", "lerna": "^3.8.5", "mocha": "^5.2.0", @@ -14,12 +15,11 @@ "rollup": "^1.1.0", "rollup-plugin-cleanup": "^3.1.0", "terser": "^3.14.1", + "ts-loader": "^5.3.3", "tslint": "^5.12.0", "typescript": "^3.2.2", "webpack": "^4.28.1", - "webpack-cli": "^3.2.1", - "ts-loader": "^5.3.3", - "file-loader": "^3.0.1" + "webpack-cli": "^3.2.1" }, "scripts": { "bootstrap": "lerna bootstrap", @@ -33,4 +33,4 @@ "test": "yarn build && yarn test:only", "test:only": "lerna run test" } -} \ No newline at end of file +} diff --git a/packages/adjacency/CHANGELOG.md b/packages/adjacency/CHANGELOG.md index 1262495d70..6e5a572ec8 100644 --- a/packages/adjacency/CHANGELOG.md +++ b/packages/adjacency/CHANGELOG.md @@ -3,6 +3,41 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/adjacency@0.1.6...@thi.ng/adjacency@0.1.7) (2019-03-18) + + +### Performance Improvements + +* **adjacency:** update subsets() to use canonical() ([0918c5b](https://github.com/thi-ng/umbrella/commit/0918c5b)) + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/adjacency@0.1.5...@thi.ng/adjacency@0.1.6) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/adjacency + + + + + +## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/adjacency@0.1.4...@thi.ng/adjacency@0.1.5) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/adjacency + + + + + +## [0.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/adjacency@0.1.3...@thi.ng/adjacency@0.1.4) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/adjacency + + + + + ## [0.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/adjacency@0.1.2...@thi.ng/adjacency@0.1.3) (2019-03-01) **Note:** Version bump only for package @thi.ng/adjacency diff --git a/packages/adjacency/package.json b/packages/adjacency/package.json index 2e90bdc5e7..ee8e5bf6b8 100644 --- a/packages/adjacency/package.json +++ b/packages/adjacency/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/adjacency", - "version": "0.1.3", + "version": "0.1.7", "description": "Sparse & bitwise adjacency matrices for directed / undirected graphs", "module": "./index.js", "main": "./lib/index.js", @@ -24,7 +24,7 @@ "pub": "yarn build && yarn publish --access public" }, "devDependencies": { - "@thi.ng/vectors": "^2.3.2", + "@thi.ng/vectors": "^2.4.3", "@types/mocha": "^5.2.5", "@types/node": "^10.12.15", "mocha": "^5.2.0", @@ -33,12 +33,12 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", + "@thi.ng/api": "^5.1.0", "@thi.ng/binary": "^1.0.3", - "@thi.ng/bitfield": "^0.1.1", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/dcons": "^2.0.7", - "@thi.ng/sparse": "^0.1.3" + "@thi.ng/bitfield": "^0.1.2", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/dcons": "^2.0.11", + "@thi.ng/sparse": "^0.1.7" }, "keywords": [ "adjacency", diff --git a/packages/adjacency/src/disjoint-set.ts b/packages/adjacency/src/disjoint-set.ts index ac4679c152..bc5f1e4a50 100644 --- a/packages/adjacency/src/disjoint-set.ts +++ b/packages/adjacency/src/disjoint-set.ts @@ -85,10 +85,7 @@ export class DisjointSet { const sets: Map = new Map(); const roots = this.roots; for (let i = roots.length; --i >= 0; ) { - let id = i; - while (id !== roots[id]) { - id = roots[roots[id]]; - } + const id = this.canonical(i); const s = sets.get(id); if (s) { s.push(i); diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index f70232035b..9e19b2b13f 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [5.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.3...@thi.ng/api@5.1.0) (2019-03-10) + + +### Features + +* **api:** add additional Fn arities ([33c7dfe](https://github.com/thi-ng/umbrella/commit/33c7dfe)) +* **api:** add more Fn type aliases, update existing ([3707e61](https://github.com/thi-ng/umbrella/commit/3707e61)) + + + + + ## [5.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@5.0.2...@thi.ng/api@5.0.3) (2019-03-01) **Note:** Version bump only for package @thi.ng/api diff --git a/packages/api/package.json b/packages/api/package.json index 8b39950a0f..48b39a86e5 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/api", - "version": "5.0.3", + "version": "5.1.0", "description": "Common, generic types & interfaces for thi.ng projects", "module": "./index.js", "main": "./lib/index.js", diff --git a/packages/api/src/api.ts b/packages/api/src/api.ts index 4de4c170cd..4cd4585891 100644 --- a/packages/api/src/api.ts +++ b/packages/api/src/api.ts @@ -6,15 +6,12 @@ export const EVENT_DISABLE = "disable"; export const SEMAPHORE = Symbol(); +export const NO_OP = () => {}; + /** - * Generic 2-element comparator function type alias. Must follow this - * contract and return: - * - * - negative if `a < b` - * - zero if `a == b` - * - positive if `a > b` + * A no-arg function, returning T. */ -export type Comparator = (a: T, b: T) => number; +export type Fn0 = () => T; /** * A single arg function from A => B. @@ -32,14 +29,186 @@ export type Fn2 = (a: A, b: B) => C; export type Fn3 = (a: A, b: B, c: C) => D; /** - * A vararg arg function to type T. + * A 4-arg function from A,B,C,D => E. + */ +export type Fn4 = (a: A, b: B, c: C, d: D) => E; + +/** + * A 5-arg function from A,B,C,D,E => F. + */ +export type Fn5 = (a: A, b: B, c: C, d: D, e: E) => F; + +/** + * A 6-arg function from A,B,C,D,E,F => G. + */ +export type Fn6 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F +) => G; + +/** + * A 7-arg function from A,B,C,D,E,F,G => H. + */ +export type Fn7 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G +) => H; + +/** + * A 8-arg function from A,B,C,D,E,F,G,H => I. + */ +export type Fn8 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G, + h: H +) => I; + +/** + * A 9-arg function from A,B,C,D,E,F,G,H,I => J. + */ +export type Fn9 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G, + h: H, + i: I +) => J; + +/** + * A 10-arg function from A,B,C,D,E,F,G,H,I,J => K. + */ +export type Fn10 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G, + h: H, + i: I, + j: J +) => K; + +export type FnO = (a: A, ...xs: any[]) => B; + +export type FnO2 = (a: A, b: B, ...xs: any[]) => C; + +export type FnO3 = (a: A, b: B, c: C, ...xs: any[]) => D; + +export type FnO4 = (a: A, b: B, c: C, d: D, ...xs: any[]) => E; + +export type FnO5 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + ...xs: any[] +) => F; + +export type FnO6 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + ...xs: any[] +) => G; + +export type FnO7 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G, + ...xs: any[] +) => H; + +export type FnO8 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G, + h: H, + ...xs: any[] +) => I; + +export type FnO9 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G, + h: H, + i: I, + ...xs: any[] +) => J; + +export type FnO10 = ( + a: A, + b: B, + c: C, + d: D, + e: E, + f: F, + g: G, + h: H, + i: I, + j: J, + ...xs: any[] +) => K; + +/** + * An untyped vararg arg function to type T. */ export type FnAny = (...xs: any[]) => T; +/** + * An typed vararg arg function from A => B. + */ +export type FnAnyT = (...xs: A[]) => B; + +/** + * Generic 2-element comparator function type alias. Must follow this + * contract and return: + * + * - negative if `a < b` + * - zero if `a == b` + * - positive if `a > b` + */ +export type Comparator = Fn2; + /** * Event listener. */ -export type Listener = (e: Event) => void; +export type Listener = Fn; export type NumericArray = number[] | TypedArray; @@ -56,22 +225,22 @@ export type Pair = [K, V]; /** * Predicate function mapping given value to true/false. */ -export type Predicate = (a: T) => boolean; +export type Predicate = Fn; /** * Predicate function mapping given args to true/false. */ -export type Predicate2 = (a: T, b: T) => boolean; +export type Predicate2 = Fn2; /** * Higher order `Predicate` builder. Possibly stateful. */ -export type StatefulPredicate = () => Predicate; +export type StatefulPredicate = Fn0>; /** * Higher order `Predicate2` builder. Possibly stateful. */ -export type StatefulPredicate2 = () => Predicate2; +export type StatefulPredicate2 = Fn0>; export type TypedArray = | Float32Array @@ -97,8 +266,8 @@ export type Watch = (id: string, oldState: T, newState: T) => void; export interface IAssociative { assoc(key: K, val: V): T; assocIn(key: K[], val: V): T; - update(key: K, f: (v: V) => V): T; - updateIn(key: K[], f: (v: V) => V): T; + update(key: K, f: Fn): T; + updateIn(key: K[], f: Fn): T; } /** diff --git a/packages/api/src/assert.ts b/packages/api/src/assert.ts index 7e2ddf117e..5e18eebbaf 100644 --- a/packages/api/src/assert.ts +++ b/packages/api/src/assert.ts @@ -1,3 +1,5 @@ +import { NO_OP } from "./api"; + /** * Takes a `test` result or predicate function without args and throws * error with given `msg` if test failed (i.e. is falsy). The function @@ -13,4 +15,4 @@ export const assert = throw new Error(msg); } } - : () => {}; + : NO_OP; diff --git a/packages/api/src/mixins/iwatch.ts b/packages/api/src/mixins/iwatch.ts index 672775b0d4..26b351e13c 100644 --- a/packages/api/src/mixins/iwatch.ts +++ b/packages/api/src/mixins/iwatch.ts @@ -1,11 +1,8 @@ -import { IWatch } from "../api"; +import { Fn3, IWatch } from "../api"; import { mixin } from "../mixin"; export const IWatchMixin = mixin(>{ - addWatch( - id: string, - fn: (id: string, oldState: any, newState: any) => void - ) { + addWatch(id: string, fn: Fn3) { this._watches = this._watches || {}; if (this._watches[id]) { return false; diff --git a/packages/api/test/mixins.ts b/packages/api/test/mixins.ts index 70e4798de2..27c1e8fc3c 100644 --- a/packages/api/test/mixins.ts +++ b/packages/api/test/mixins.ts @@ -1,18 +1,21 @@ import * as assert from "assert"; - -import { Event, INotify, EVENT_ALL } from "../src/api"; +import { + Event, + EVENT_ALL, + INotify, + Listener +} from "../src/api"; import { INotifyMixin } from "../src/mixins/inotify"; -describe("mixins", () => { +describe("mixins", () => { it("INotify", () => { - @INotifyMixin class Foo implements INotify { - addListener(_: string, __: (e: Event) => void, ___?: any): boolean { + addListener(_: string, __: Listener, ___?: any): boolean { throw new Error(); } - removeListener(_: string, __: (e: Event) => void, ___?: any): boolean { + removeListener(_: string, __: Listener, ___?: any): boolean { throw new Error(); } notify(_: Event) { @@ -22,8 +25,8 @@ describe("mixins", () => { const res: any = {}; const foo = new Foo(); - const l = (e) => res[e.id] = e.value; - const lall = (e) => res[EVENT_ALL] = e.value; + const l = (e) => (res[e.id] = e.value); + const lall = (e) => (res[EVENT_ALL] = e.value); assert.doesNotThrow(() => foo.addListener("x", l)); assert.doesNotThrow(() => foo.addListener(EVENT_ALL, lall)); foo.notify({ id: "x", value: 1 }); @@ -35,4 +38,4 @@ describe("mixins", () => { foo.notify({ id: "x", value: 3 }); assert.deepEqual(res, { x: 1, [EVENT_ALL]: 2 }); }); -}); \ No newline at end of file +}); diff --git a/packages/arrays/CHANGELOG.md b/packages/arrays/CHANGELOG.md index c30343b9ec..469797e2a0 100644 --- a/packages/arrays/CHANGELOG.md +++ b/packages/arrays/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.1.3...@thi.ng/arrays@0.1.4) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/arrays + + + + + +## [0.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.1.2...@thi.ng/arrays@0.1.3) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/arrays + + + + + +## [0.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.1.1...@thi.ng/arrays@0.1.2) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/arrays + + + + + ## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/arrays@0.1.0...@thi.ng/arrays@0.1.1) (2019-03-01) **Note:** Version bump only for package @thi.ng/arrays diff --git a/packages/arrays/package.json b/packages/arrays/package.json index 99de3a24de..55c1b1179a 100644 --- a/packages/arrays/package.json +++ b/packages/arrays/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/arrays", - "version": "0.1.1", + "version": "0.1.4", "description": "Array / Arraylike utilities", "module": "./index.js", "main": "./lib/index.js", @@ -32,12 +32,12 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", "@thi.ng/compare": "^1.0.3", "@thi.ng/equiv": "^1.0.3", "@thi.ng/errors": "^1.0.3", - "@thi.ng/random": "^1.1.1" + "@thi.ng/random": "^1.1.2" }, "keywords": [ "arrays", diff --git a/packages/associative/CHANGELOG.md b/packages/associative/CHANGELOG.md index e67ff2e8ac..7a822c2f70 100644 --- a/packages/associative/CHANGELOG.md +++ b/packages/associative/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@1.0.10...@thi.ng/associative@1.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/associative + + + + + +## [1.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@1.0.9...@thi.ng/associative@1.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/associative + + + + + +## [1.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@1.0.8...@thi.ng/associative@1.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/associative + + + + + +## [1.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@1.0.7...@thi.ng/associative@1.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/associative + + + + + ## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@1.0.6...@thi.ng/associative@1.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/associative diff --git a/packages/associative/package.json b/packages/associative/package.json index 2f52863cc0..98bd8e80ba 100644 --- a/packages/associative/package.json +++ b/packages/associative/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/associative", - "version": "1.0.7", + "version": "1.0.11", "description": "Alternative Set & Map data type implementations with customizable equality semantics & supporting operations", "module": "./index.js", "main": "./lib/index.js", @@ -32,13 +32,13 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", "@thi.ng/compare": "^1.0.3", - "@thi.ng/dcons": "^2.0.7", + "@thi.ng/dcons": "^2.0.11", "@thi.ng/equiv": "^1.0.3", "@thi.ng/errors": "^1.0.3", - "@thi.ng/transducers": "^5.1.1" + "@thi.ng/transducers": "^5.2.2" }, "keywords": [ "data structures", diff --git a/packages/associative/src/array-set.ts b/packages/associative/src/array-set.ts index 333f60f0e3..1ba446cff1 100644 --- a/packages/associative/src/array-set.ts +++ b/packages/associative/src/array-set.ts @@ -1,4 +1,9 @@ -import { Pair, Predicate2, SEMAPHORE } from "@thi.ng/api"; +import { + Fn3, + Pair, + Predicate2, + SEMAPHORE +} from "@thi.ng/api"; import { equiv } from "@thi.ng/equiv"; import { EquivSetOpts, IEquivSet } from "./api"; @@ -131,7 +136,7 @@ export class ArraySet extends Set implements IEquivSet { return true; } - forEach(fn: (val: T, val2: T, set: Set) => void, thisArg?: any) { + forEach(fn: Fn3, void>, thisArg?: any) { const vals = __private.get(this).vals; for (let i = vals.length - 1; i >= 0; i--) { const v = vals[i]; diff --git a/packages/associative/src/equiv-map.ts b/packages/associative/src/equiv-map.ts index 9594417779..b30b7cf184 100644 --- a/packages/associative/src/equiv-map.ts +++ b/packages/associative/src/equiv-map.ts @@ -1,4 +1,5 @@ import { + Fn3, ICopy, IEmpty, IEquiv, @@ -134,7 +135,7 @@ export class EquivMap extends Map return this; } - forEach(fn: (val: V, key: K, map: Map) => void, thisArg?: any) { + forEach(fn: Fn3, void>, thisArg?: any) { for (let pair of __private.get(this).map) { fn.call(thisArg, pair[1], pair[0], this); } diff --git a/packages/associative/src/ll-set.ts b/packages/associative/src/ll-set.ts index 6b329a92b9..172ef5ec1b 100644 --- a/packages/associative/src/ll-set.ts +++ b/packages/associative/src/ll-set.ts @@ -1,4 +1,9 @@ -import { Pair, Predicate2, SEMAPHORE } from "@thi.ng/api"; +import { + Fn3, + Pair, + Predicate2, + SEMAPHORE +} from "@thi.ng/api"; import { DCons } from "@thi.ng/dcons"; import { equiv } from "@thi.ng/equiv"; import { EquivSetOpts, IEquivSet } from "./api"; @@ -139,7 +144,7 @@ export class LLSet extends Set implements IEquivSet { return true; } - forEach(fn: (val: T, val2: T, set: Set) => void, thisArg?: any) { + forEach(fn: Fn3, void>, thisArg?: any) { let i = __private.get(this).vals.head; while (i) { fn.call(thisArg, i.value, i.value, this); diff --git a/packages/associative/src/merge-with.ts b/packages/associative/src/merge-with.ts index 352da4393a..85e67c341a 100644 --- a/packages/associative/src/merge-with.ts +++ b/packages/associative/src/merge-with.ts @@ -1,8 +1,8 @@ -import { IObjectOf } from "@thi.ng/api"; +import { Fn2, IObjectOf } from "@thi.ng/api"; import { copy } from "./utils"; export const mergeMapWith = ( - f: (a: V, b: V) => V, + f: Fn2, dest: Map, ...xs: Map[] ) => { @@ -20,7 +20,7 @@ export const mergeMapWith = ( }; export const mergeObjWith = ( - f: (a: T, b: T) => T, + f: Fn2, dest: IObjectOf, ...xs: IObjectOf[] ) => { diff --git a/packages/associative/src/sorted-map.ts b/packages/associative/src/sorted-map.ts index b99155bd7e..f0237e2fee 100644 --- a/packages/associative/src/sorted-map.ts +++ b/packages/associative/src/sorted-map.ts @@ -1,5 +1,6 @@ import { Comparator, + Fn3, ICompare, ICopy, IEmpty, @@ -179,7 +180,7 @@ export class SortedMap extends Map } } - forEach(fn: (val: V, key: K, map: Map) => void, thisArg?: any) { + forEach(fn: Fn3, void>, thisArg?: any) { for (let p of this) { fn.call(thisArg, p[1], p[0], this); } diff --git a/packages/associative/src/sorted-set.ts b/packages/associative/src/sorted-set.ts index 30ef7e30f3..5fff2a3e4c 100644 --- a/packages/associative/src/sorted-set.ts +++ b/packages/associative/src/sorted-set.ts @@ -1,4 +1,4 @@ -import { ICompare, Pair } from "@thi.ng/api"; +import { Fn3, ICompare, Pair } from "@thi.ng/api"; import { compare } from "@thi.ng/compare"; import { IReducible, map, ReductionFn } from "@thi.ng/transducers"; import { IEquivSet, SortedSetOpts } from "./api"; @@ -148,7 +148,7 @@ export class SortedSet extends Set return this; } - forEach(fn: (val: T, val2: T, set: Set) => void, thisArg?: any): void { + forEach(fn: Fn3, void>, thisArg?: any): void { for (let p of this) { fn.call(thisArg, p[0], p[0], this); } diff --git a/packages/atom/CHANGELOG.md b/packages/atom/CHANGELOG.md index 489c3e91d9..732e09697f 100644 --- a/packages/atom/CHANGELOG.md +++ b/packages/atom/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@2.0.6...@thi.ng/atom@2.0.7) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/atom + + + + + +## [2.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@2.0.5...@thi.ng/atom@2.0.6) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/atom + + + + + +## [2.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@2.0.4...@thi.ng/atom@2.0.5) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/atom + + + + + ## [2.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@2.0.3...@thi.ng/atom@2.0.4) (2019-03-01) **Note:** Version bump only for package @thi.ng/atom diff --git a/packages/atom/package.json b/packages/atom/package.json index 64d3c87204..aa66706583 100644 --- a/packages/atom/package.json +++ b/packages/atom/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/atom", - "version": "2.0.4", + "version": "2.0.7", "description": "Mutable wrappers for nested immutable values w/ optional undo/redo history", "module": "./index.js", "main": "./lib/index.js", @@ -32,11 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", "@thi.ng/equiv": "^1.0.3", "@thi.ng/errors": "^1.0.3", - "@thi.ng/paths": "^2.0.4" + "@thi.ng/paths": "^2.0.6" }, "keywords": [ "derived views", diff --git a/packages/atom/src/cursor.ts b/packages/atom/src/cursor.ts index 8e349bce97..17996f1d15 100644 --- a/packages/atom/src/cursor.ts +++ b/packages/atom/src/cursor.ts @@ -1,4 +1,10 @@ -import { IID, IRelease, Watch } from "@thi.ng/api"; +import { + Fn, + Fn2, + IID, + IRelease, + Watch +} from "@thi.ng/api"; import { isArray, isFunction } from "@thi.ng/checks"; import { illegalArgs, illegalArity } from "@thi.ng/errors"; import { getter, Path, setter } from "@thi.ng/paths"; @@ -43,15 +49,15 @@ export class Cursor implements IAtom, IID, IRelease { parent: IAtom; protected local: Atom; - protected lookup: (s: any) => T; + protected lookup: Fn; protected selfUpdate: boolean; constructor(opts: CursorOpts); constructor(parent: IAtom, path: Path); constructor( parent: IAtom, - lookup: (s: any) => T, - update: (s: any, v: T) => any + lookup: Fn, + update: Fn2 ); constructor(...args: any[]) { let parent, id, lookup, update, validate, opts: CursorOpts; diff --git a/packages/atom/src/history.ts b/packages/atom/src/history.ts index c3718590ed..7d60296d13 100644 --- a/packages/atom/src/history.ts +++ b/packages/atom/src/history.ts @@ -1,6 +1,7 @@ import { Event, INotifyMixin, + Listener, Predicate2, Watch } from "@thi.ng/api"; @@ -256,11 +257,11 @@ export class History implements IHistory { return true; } - addListener(_: string, __: (e: Event) => void, ___?: any): boolean { + addListener(_: string, __: Listener, ___?: any): boolean { return false; } - removeListener(_: string, __: (e: Event) => void, ___?: any): boolean { + removeListener(_: string, __: Listener, ___?: any): boolean { return false; } diff --git a/packages/bencode/CHANGELOG.md b/packages/bencode/CHANGELOG.md index 4b46137578..c133b63583 100644 --- a/packages/bencode/CHANGELOG.md +++ b/packages/bencode/CHANGELOG.md @@ -3,6 +3,54 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.2.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/bencode@0.2.8...@thi.ng/bencode@0.2.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/bencode + + + + + +## [0.2.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/bencode@0.2.7...@thi.ng/bencode@0.2.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/bencode + + + + + +## [0.2.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/bencode@0.2.6...@thi.ng/bencode@0.2.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/bencode + + + + + +## [0.2.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/bencode@0.2.5...@thi.ng/bencode@0.2.6) (2019-03-05) + +**Note:** Version bump only for package @thi.ng/bencode + + + + + +## [0.2.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/bencode@0.2.4...@thi.ng/bencode@0.2.5) (2019-03-04) + +**Note:** Version bump only for package @thi.ng/bencode + + + + + +## [0.2.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/bencode@0.2.3...@thi.ng/bencode@0.2.4) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/bencode + + + + + ## [0.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/bencode@0.2.2...@thi.ng/bencode@0.2.3) (2019-03-01) **Note:** Version bump only for package @thi.ng/bencode diff --git a/packages/bencode/package.json b/packages/bencode/package.json index fee74e37ca..b0bf9441e1 100644 --- a/packages/bencode/package.json +++ b/packages/bencode/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/bencode", - "version": "0.2.3", + "version": "0.2.9", "description": "Bencode binary encoder / decoder with optional UTF8 encoding", "module": "./index.js", "main": "./lib/index.js", @@ -32,13 +32,13 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/arrays": "^0.1.1", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/defmulti": "^1.0.3", + "@thi.ng/api": "^5.1.0", + "@thi.ng/arrays": "^0.1.4", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/defmulti": "^1.0.4", "@thi.ng/errors": "^1.0.3", - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/transducers-binary": "^0.2.2" + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/transducers-binary": "^0.3.4" }, "keywords": [ "bencode", diff --git a/packages/bitfield/CHANGELOG.md b/packages/bitfield/CHANGELOG.md index 550c4b51d5..c98c0cfbb5 100644 --- a/packages/bitfield/CHANGELOG.md +++ b/packages/bitfield/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/bitfield@0.1.1...@thi.ng/bitfield@0.1.2) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/bitfield + + + + + ## [0.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/bitfield@0.1.0...@thi.ng/bitfield@0.1.1) (2019-03-01) **Note:** Version bump only for package @thi.ng/bitfield diff --git a/packages/bitfield/package.json b/packages/bitfield/package.json index 6da98046a2..b927d7dc81 100644 --- a/packages/bitfield/package.json +++ b/packages/bitfield/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/bitfield", - "version": "0.1.1", + "version": "0.1.2", "description": "1D / 2D bit field implementations", "module": "./index.js", "main": "./lib/index.js", @@ -32,9 +32,9 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", + "@thi.ng/api": "^5.1.0", "@thi.ng/binary": "^1.0.3", - "@thi.ng/strings": "^1.0.4" + "@thi.ng/strings": "^1.0.5" }, "keywords": [ "1D", diff --git a/packages/cache/CHANGELOG.md b/packages/cache/CHANGELOG.md index de6ecdee42..3a28f69a5b 100644 --- a/packages/cache/CHANGELOG.md +++ b/packages/cache/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/cache@1.0.10...@thi.ng/cache@1.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/cache + + + + + +## [1.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/cache@1.0.9...@thi.ng/cache@1.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/cache + + + + + +## [1.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/cache@1.0.8...@thi.ng/cache@1.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/cache + + + + + +## [1.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/cache@1.0.7...@thi.ng/cache@1.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/cache + + + + + ## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/cache@1.0.6...@thi.ng/cache@1.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/cache diff --git a/packages/cache/package.json b/packages/cache/package.json index 9235099af1..e07f7eb6b7 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/cache", - "version": "1.0.7", + "version": "1.0.11", "description": "In-memory cache implementations with ES6 Map-like API and different eviction strategies", "module": "./index.js", "main": "./lib/index.js", @@ -32,9 +32,9 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/dcons": "^2.0.7", - "@thi.ng/transducers": "^5.1.1" + "@thi.ng/api": "^5.1.0", + "@thi.ng/dcons": "^2.0.11", + "@thi.ng/transducers": "^5.2.2" }, "keywords": [ "cache", diff --git a/packages/cache/src/api.ts b/packages/cache/src/api.ts index 0fb31166a9..c353d8a788 100644 --- a/packages/cache/src/api.ts +++ b/packages/cache/src/api.ts @@ -1,4 +1,7 @@ import { + Fn, + Fn0, + Fn2, ICopy, IEmpty, ILength, @@ -16,7 +19,7 @@ export interface ICache has(key: K): boolean; get(key: K, notFound?: V): V; set(key: K, val: V): V; - getSet(key: K, fn: () => Promise): Promise; + getSet(key: K, fn: Fn0>): Promise; delete(key: K): boolean; entries(): IterableIterator]>>; @@ -25,10 +28,10 @@ export interface ICache } export interface CacheOpts { - ksize: (k: K) => number; - vsize: (v: V) => number; - release: (k: K, v: V) => void; - map: () => Map; + ksize: Fn; + vsize: Fn; + release: Fn2; + map: Fn0>; maxlen: number; maxsize: number; } diff --git a/packages/cache/src/lru.ts b/packages/cache/src/lru.ts index 1e945c7968..2dbfe5adde 100644 --- a/packages/cache/src/lru.ts +++ b/packages/cache/src/lru.ts @@ -1,3 +1,4 @@ +import { Fn0 } from "@thi.ng/api"; import { ConsCell, DCons } from "@thi.ng/dcons"; import { map } from "@thi.ng/transducers"; import { CacheEntry, CacheOpts, ICache } from "./api"; @@ -124,7 +125,7 @@ export class LRUCache implements ICache { return this; } - getSet(key: K, retrieve: () => Promise): Promise { + getSet(key: K, retrieve: Fn0>): Promise { const e = this.map.get(key); if (e) { return Promise.resolve(this.resetEntry(e)); diff --git a/packages/cache/src/tlru.ts b/packages/cache/src/tlru.ts index 0f67b522e0..c13b0c0466 100644 --- a/packages/cache/src/tlru.ts +++ b/packages/cache/src/tlru.ts @@ -1,3 +1,4 @@ +import { Fn0 } from "@thi.ng/api"; import { ConsCell, DCons } from "@thi.ng/dcons"; import { CacheEntry, CacheOpts } from "./api"; import { LRUCache } from "./lru"; @@ -76,11 +77,7 @@ export class TLRUCache extends LRUCache { return value; } - getSet( - key: K, - retrieve: () => Promise, - ttl = this.opts.ttl - ): Promise { + getSet(key: K, retrieve: Fn0>, ttl = this.opts.ttl): Promise { const e = this.get(key); if (e) { return Promise.resolve(e); diff --git a/packages/checks/AUTHORS.md b/packages/checks/AUTHORS.md new file mode 100644 index 0000000000..63da9e3bda --- /dev/null +++ b/packages/checks/AUTHORS.md @@ -0,0 +1,8 @@ +## Maintainer + +- Karsten Schmidt (@postspectacular) + +## Contributors + +- Gavin Cannizzaro (@gavinpc-mindgrub) +- Jay Zawrotny (@eccentric-j) diff --git a/packages/checks/CHANGELOG.md b/packages/checks/CHANGELOG.md index 99f95d33f4..1234695d03 100644 --- a/packages/checks/CHANGELOG.md +++ b/packages/checks/CHANGELOG.md @@ -3,6 +3,25 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/checks@2.1.2...@thi.ng/checks@2.1.3) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/checks + + + + + +## [2.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/checks@2.1.1...@thi.ng/checks@2.1.2) (2019-03-12) + + +### Bug Fixes + +* **checks:** fix [#77](https://github.com/thi-ng/umbrella/issues/77), update & minor optimization isPlainObject() ([47ac88a](https://github.com/thi-ng/umbrella/commit/47ac88a)) + + + + + ## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/checks@2.1.0...@thi.ng/checks@2.1.1) (2019-03-01) **Note:** Version bump only for package @thi.ng/checks diff --git a/packages/checks/package.json b/packages/checks/package.json index 36e5356c00..6df9a869e9 100644 --- a/packages/checks/package.json +++ b/packages/checks/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/checks", - "version": "2.1.1", + "version": "2.1.3", "description": "Single-function sub-modules for type, feature & value checks", "module": "./index.js", "main": "./lib/index.js", diff --git a/packages/checks/src/is-plain-object.ts b/packages/checks/src/is-plain-object.ts index bc6025367c..c4cbc08863 100644 --- a/packages/checks/src/is-plain-object.ts +++ b/packages/checks/src/is-plain-object.ts @@ -1,4 +1,4 @@ -const OBJP = Object.getPrototypeOf({}); +const OBJP = Object.getPrototypeOf; /** * Similar to `isObject()`, but also checks if prototype is that of @@ -7,9 +7,10 @@ const OBJP = Object.getPrototypeOf({}); * @param x */ export const isPlainObject = (x: any): x is object => { - let proto; + let p; return ( - Object.prototype.toString.call(x) === "[object Object]" && - ((proto = Object.getPrototypeOf(x)), proto === null || proto === OBJP) + x != null && + typeof x === "object" && + ((p = OBJP(x)) === null || OBJP(p) === null) ); }; diff --git a/packages/checks/test/index.ts b/packages/checks/test/index.ts index c70a02cc61..7e6b24f135 100644 --- a/packages/checks/test/index.ts +++ b/packages/checks/test/index.ts @@ -1,5 +1,5 @@ import * as assert from "assert"; - +import * as vm from "vm"; import { existsAndNotNull } from "../src/exists-not-null"; import { implementsFunction } from "../src/implements-function"; import { isArray } from "../src/is-array"; @@ -12,8 +12,7 @@ import { isSymbol } from "../src/is-symbol"; import { isTransferable } from "../src/is-transferable"; import { isTypedArray } from "../src/is-typedarray"; -describe("checks", function () { - +describe("checks", function() { it("existsAndNotNull", () => { assert.ok(existsAndNotNull([]), "empty array"); assert.ok(existsAndNotNull(new Uint8Array(1)), "typedarray"); @@ -66,7 +65,7 @@ describe("checks", function () { }); it("isObject", () => { - function Foo() { }; + function Foo() {} assert.ok(isObject([]), "empty array"); assert.ok(isObject(new Uint8Array(1)), "typedarray"); assert.ok(isObject({}), "obj"); @@ -79,10 +78,16 @@ describe("checks", function () { }); it("isPlainObject", () => { - function Foo() { }; + const ctxClass = vm.runInNewContext("class A {}; new A();"); + const ctxObj = vm.runInNewContext("({})"); + + function Foo() {} + assert.ok(isPlainObject({}), "obj"); + assert.ok(isPlainObject(Object.create(null)), "obj"); assert.ok(isPlainObject(new Object()), "obj ctor"); assert.ok(!isPlainObject(Foo), "fn"); + assert.ok(!isPlainObject((function*() {})()), "generator"); assert.ok(!isPlainObject(new Foo()), "class"); assert.ok(!isPlainObject([]), "empty array"); assert.ok(!isPlainObject(new Uint8Array(1)), "typedarray"); @@ -90,6 +95,8 @@ describe("checks", function () { assert.ok(!isPlainObject(0), "zero"); assert.ok(!isPlainObject(null), "null"); assert.ok(!isPlainObject(undefined), "null"); + assert.ok(isPlainObject(ctxObj), "vm ctx obj"); + assert.ok(!isPlainObject(ctxClass), "vm ctx class"); }); it("isString", () => { @@ -142,5 +149,4 @@ describe("checks", function () { assert.ok(!isTransferable(null), "null"); assert.ok(!isTransferable(undefined), "undefined"); }); - }); diff --git a/packages/color/CHANGELOG.md b/packages/color/CHANGELOG.md index 35f95f1ea8..2de017e92d 100644 --- a/packages/color/CHANGELOG.md +++ b/packages/color/CHANGELOG.md @@ -3,6 +3,49 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.13](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.1.12...@thi.ng/color@0.1.13) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/color + + + + + +## [0.1.12](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.1.11...@thi.ng/color@0.1.12) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/color + + + + + +## [0.1.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.1.10...@thi.ng/color@0.1.11) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/color + + + + + +## [0.1.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.1.9...@thi.ng/color@0.1.10) (2019-03-04) + + +### Bug Fixes + +* **color:** add/update luminanceRGB/luminanceInt, add to re-exports ([566cf02](https://github.com/thi-ng/umbrella/commit/566cf02)) + + + + + +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.1.8...@thi.ng/color@0.1.9) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/color + + + + + ## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/color@0.1.7...@thi.ng/color@0.1.8) (2019-03-01) **Note:** Version bump only for package @thi.ng/color diff --git a/packages/color/package.json b/packages/color/package.json index 160f29acaa..218111b44b 100644 --- a/packages/color/package.json +++ b/packages/color/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/color", - "version": "0.1.8", + "version": "0.1.13", "description": "Raw, array-based, color ops, conversions, opt. type wrappers, multi-color gradients", "module": "./index.js", "main": "./lib/index.js", @@ -32,14 +32,14 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/compose": "^1.1.2", - "@thi.ng/defmulti": "^1.0.3", + "@thi.ng/api": "^5.1.0", + "@thi.ng/compose": "^1.2.0", + "@thi.ng/defmulti": "^1.0.4", "@thi.ng/errors": "^1.0.3", - "@thi.ng/math": "^1.1.1", - "@thi.ng/strings": "^1.0.4", - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/math": "^1.2.0", + "@thi.ng/strings": "^1.0.5", + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "alpha", diff --git a/packages/color/src/index.ts b/packages/color/src/index.ts index 413f74e6bb..1749075203 100644 --- a/packages/color/src/index.ts +++ b/packages/color/src/index.ts @@ -45,6 +45,7 @@ export * from "./closest-hue"; export * from "./cosine-gradients"; export * from "./invert"; export * from "./luminance"; +export * from "./luminance-rgb"; export * from "./mix"; export * from "./porter-duff"; export * from "./premultiply"; diff --git a/packages/color/src/luminance-rgb.ts b/packages/color/src/luminance-rgb.ts index 993dd44b83..fb5f0f5232 100644 --- a/packages/color/src/luminance-rgb.ts +++ b/packages/color/src/luminance-rgb.ts @@ -1,5 +1,5 @@ import { dot3 } from "@thi.ng/vectors"; -import { INV8BIT, ReadonlyColor, RGB_LUMINANCE } from "./api"; +import { ReadonlyColor, RGB_LUMINANCE } from "./api"; export const luminanceRGB = (rgb: ReadonlyColor, weights = RGB_LUMINANCE) => dot3(rgb, weights); @@ -7,6 +7,5 @@ export const luminanceRGB = (rgb: ReadonlyColor, weights = RGB_LUMINANCE) => export const luminanceInt = (rgb: number) => (((rgb >>> 16) & 0xff) * 76 + ((rgb >>> 8) & 0xff) * 150 + - (rgb & 0xff) * 29) * - INV8BIT * - INV8BIT; + (rgb & 0xff) * 29) / + 0xfe01; diff --git a/packages/color/src/porter-duff.ts b/packages/color/src/porter-duff.ts index 08f376e230..114d7b6170 100644 --- a/packages/color/src/porter-duff.ts +++ b/packages/color/src/porter-duff.ts @@ -1,3 +1,4 @@ +import { Fn2, Fn3 } from "@thi.ng/api"; import { setC4, setN4 } from "@thi.ng/vectors"; import { Color, ReadonlyColor } from "./api"; import { postmultiply, premultiply } from "./premultiply"; @@ -24,7 +25,7 @@ import { postmultiply, premultiply } from "./premultiply"; * @param z factor of "dest" region */ export const porterDuff = ( - f: (s: number, d: number) => number, + f: Fn2, x: 0 | 1, y: 0 | 1, z: 0 | 1 @@ -36,9 +37,9 @@ export const porterDuff = ( : (s: number, d: number, sda: number, sy: number) => f(s, d) * sda + s * sy : z - ? (s: number, d: number, sda: number, _, sz: number) => - f(s, d) * sda + d * sz - : (s: number, d: number, sda: number) => f(s, d) * sda; + ? (s: number, d: number, sda: number, _, sz: number) => + f(s, d) * sda + d * sz + : (s: number, d: number, sda: number) => f(s, d) * sda; return (out: Color, src: ReadonlyColor, dest: ReadonlyColor) => { const sa = src[3]; const da = dest[3]; @@ -68,7 +69,7 @@ export const porterDuffP = ( out: Color, src: ReadonlyColor, dest: ReadonlyColor, - mode: (out: Color, src: ReadonlyColor, dest: ReadonlyColor) => Color + mode: Fn3 ) => postmultiply( null, diff --git a/packages/compose/CHANGELOG.md b/packages/compose/CHANGELOG.md index a665b5adf1..eb47f59714 100644 --- a/packages/compose/CHANGELOG.md +++ b/packages/compose/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [1.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/compose@1.1.2...@thi.ng/compose@1.2.0) (2019-03-10) + + +### Features + +* **compose:** add complement() ([5a5a2d1](https://github.com/thi-ng/umbrella/commit/5a5a2d1)) +* **compose:** add trampoline() ([9e4c171](https://github.com/thi-ng/umbrella/commit/9e4c171)) + + + + + ## [1.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/compose@1.1.1...@thi.ng/compose@1.1.2) (2019-03-01) **Note:** Version bump only for package @thi.ng/compose diff --git a/packages/compose/README.md b/packages/compose/README.md index f611b4f75c..a92e174ba6 100644 --- a/packages/compose/README.md +++ b/packages/compose/README.md @@ -9,12 +9,12 @@ This project is part of the -- [About](#about) -- [Installation](#installation) -- [Dependencies](#dependencies) -- [Usage examples](#usage-examples) -- [Authors](#authors) -- [License](#license) +- [About](#about) +- [Installation](#installation) +- [Dependencies](#dependencies) +- [Usage examples](#usage-examples) +- [Authors](#authors) +- [License](#license) @@ -22,12 +22,13 @@ This project is part of the Functional composition helpers: -- [comp()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts) -- [compL()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts#L52) -- [juxt()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/juxt.ts) -- [partial()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/partial.ts) -- [threadFirst()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-first.ts) -- [threadLast()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-last.ts) +- [comp()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts) +- [compL()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/comp.ts#L52) +- [juxt()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/juxt.ts) +- [partial()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/partial.ts) +- [threadFirst()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-first.ts) +- [threadLast()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/thread-last.ts) +- [trampoline()](https://github.com/thi-ng/umbrella/tree/master/packages/compose/src/trampoline.ts) ## Installation @@ -37,8 +38,8 @@ yarn add @thi.ng/compose ## Dependencies -- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) -- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/master/packages/errors) +- [@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) +- [@thi.ng/errors](https://github.com/thi-ng/umbrella/tree/master/packages/errors) ## Usage examples @@ -48,7 +49,7 @@ import { comp, compL, juxt } from "@thi.ng/compose"; ## Authors -- Karsten Schmidt +- Karsten Schmidt ## License diff --git a/packages/compose/package.json b/packages/compose/package.json index e069567b0b..42e4eca58e 100644 --- a/packages/compose/package.json +++ b/packages/compose/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/compose", - "version": "1.1.2", + "version": "1.2.0", "description": "Arity-optimized functional composition helpers", "module": "./index.js", "main": "./lib/index.js", @@ -32,7 +32,7 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", + "@thi.ng/api": "^5.1.0", "@thi.ng/errors": "^1.0.3" }, "keywords": [ diff --git a/packages/compose/src/complement.ts b/packages/compose/src/complement.ts new file mode 100644 index 0000000000..fc46e935da --- /dev/null +++ b/packages/compose/src/complement.ts @@ -0,0 +1,37 @@ +import { + Fn, + Fn0, + Fn2, + Fn3, + Fn4, + Fn5, + Fn6, + Fn7, + Fn8, + FnAny +} from "@thi.ng/api"; + +export function complement(f: Fn0): Fn0; +export function complement(f: Fn): Fn; +export function complement(f: Fn2): Fn2; +export function complement( + f: Fn3 +): Fn3; +export function complement( + f: Fn4 +): Fn4; +export function complement( + f: Fn5 +): Fn5; +export function complement( + f: Fn6 +): Fn6; +export function complement( + f: Fn7 +): Fn7; +export function complement( + f: Fn8 +): Fn8; +export function complement(f: FnAny) { + return (...xs) => !f(...xs); +} diff --git a/packages/compose/src/delay.ts b/packages/compose/src/delay.ts index a1b470ef1f..2483936400 100644 --- a/packages/compose/src/delay.ts +++ b/packages/compose/src/delay.ts @@ -1,13 +1,13 @@ -import { IDeref } from "@thi.ng/api"; +import { Fn0, IDeref } from "@thi.ng/api"; -export const delay = (body: () => T) => new Delay(body); +export const delay = (body: Fn0) => new Delay(body); export class Delay implements IDeref { value: T; - protected body: () => T; + protected body: Fn0; protected realized: boolean; - constructor(body: () => T) { + constructor(body: Fn0) { this.body = body; this.realized = false; } diff --git a/packages/compose/src/index.ts b/packages/compose/src/index.ts index f9c76d4c74..330397535b 100644 --- a/packages/compose/src/index.ts +++ b/packages/compose/src/index.ts @@ -1,4 +1,5 @@ export * from "./comp"; +export * from "./complement"; export * from "./constantly"; export * from "./delay"; export * from "./delayed"; @@ -7,3 +8,4 @@ export * from "./juxt"; export * from "./partial"; export * from "./thread-first"; export * from "./thread-last"; +export * from "./trampoline"; diff --git a/packages/compose/src/partial.ts b/packages/compose/src/partial.ts index 615cc84739..49f1eb2ecc 100644 --- a/packages/compose/src/partial.ts +++ b/packages/compose/src/partial.ts @@ -1,46 +1,50 @@ +import { + FnAny, + FnO, + FnO2, + FnO3, + FnO4, + FnO5, + FnO6, + FnO7, + FnO8 +} from "@thi.ng/api"; import { illegalArgs } from "@thi.ng/errors"; -export function partial( - fn: (a: A, ...args: any[]) => T, - a: A -): (...args: any[]) => T; -export function partial( - fn: (a: A, b: B, ...args: any[]) => T, - a: A, - b: B -): (...args: any[]) => T; +export function partial(fn: FnO, a: A): FnAny; +export function partial(fn: FnO2, a: A, b: B): FnAny; export function partial( - fn: (a: A, b: B, c: C, ...args: any[]) => T, + fn: FnO3, a: A, b: B, c: C -): (...args: any[]) => T; +): FnAny; export function partial( - fn: (a: A, b: B, c: C, d: D, ...args: any[]) => T, + fn: FnO4, a: A, b: B, c: C, d: D -): (...args: any[]) => T; +): FnAny; export function partial( - fn: (a: A, b: B, c: C, d: D, e: E, ...args: any[]) => T, + fn: FnO5, a: A, b: B, c: C, d: D, e: E -): (...args: any[]) => T; +): FnAny; export function partial( - fn: (a: A, b: B, c: C, d: D, e: E, f: F, ...args: any[]) => T, + fn: FnO6, a: A, b: B, c: C, d: D, e: E, f: F -): (...args: any[]) => T; +): FnAny; export function partial( - fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, ...args: any[]) => T, + fn: FnO7, a: A, b: B, c: C, @@ -48,9 +52,9 @@ export function partial( e: E, f: F, g: G -): (...args: any[]) => T; +): FnAny; export function partial( - fn: (a: A, b: B, c: C, d: D, e: E, f: F, g: G, h: H, ...args: any[]) => T, + fn: FnO8, a: A, b: B, c: C, @@ -59,7 +63,7 @@ export function partial( f: F, g: G, h: H -): (...args: any[]) => T; +): FnAny; export function partial(fn, ...args: any[]) { let [a, b, c, d, e, f, g, h] = args; switch (args.length) { diff --git a/packages/compose/src/trampoline.ts b/packages/compose/src/trampoline.ts new file mode 100644 index 0000000000..2dd86302f0 --- /dev/null +++ b/packages/compose/src/trampoline.ts @@ -0,0 +1,35 @@ +import { Fn0 } from "@thi.ng/api"; + +/** + * Takes a function returning either a no-arg function (thunk) or its + * already realized (non-function) result. Re-executes thunk for as long + * as it returns another function/thunk. Once a non-function result has + * been produced, `trampoline` returns that value itself. If the final + * result should be function, it needs to wrapped (e.g. as a 1-elem + * array). + * + * This function should be used for non-stack consuming recursion. I.e. + * a trampoline is a form of continuation passing style and only ever + * consumes max. 2 extra stack frames, independent from recursion depth. + * + * ``` + * const countdown = (acc, x) => + * x >= 0 ? + * () => (acc.push(x), countdown(acc, x-1)) : + * acc; + * + * trampoline(countdown([], 4)) + * // [ 4, 3, 2, 1, 0 ] + * + * trampoline(countdown([], -1)) + * // [] + * ``` + * + * @param f + */ +export const trampoline = (f: T | Fn0>) => { + while (typeof f === "function") { + f = (f)(); + } + return f; +}; diff --git a/packages/csp/CHANGELOG.md b/packages/csp/CHANGELOG.md index d73465759c..64210378aa 100644 --- a/packages/csp/CHANGELOG.md +++ b/packages/csp/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@1.0.10...@thi.ng/csp@1.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/csp + + + + + +## [1.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@1.0.9...@thi.ng/csp@1.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/csp + + + + + +## [1.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@1.0.8...@thi.ng/csp@1.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/csp + + + + + +## [1.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@1.0.7...@thi.ng/csp@1.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/csp + + + + + ## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@1.0.6...@thi.ng/csp@1.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/csp diff --git a/packages/csp/package.json b/packages/csp/package.json index 6714827be8..57c7b7f7cc 100644 --- a/packages/csp/package.json +++ b/packages/csp/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/csp", - "version": "1.0.7", + "version": "1.0.11", "description": "ES6 promise based CSP implementation", "module": "./index.js", "main": "./lib/index.js", @@ -36,12 +36,12 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/arrays": "^0.1.1", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/dcons": "^2.0.7", + "@thi.ng/api": "^5.1.0", + "@thi.ng/arrays": "^0.1.4", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/dcons": "^2.0.11", "@thi.ng/errors": "^1.0.3", - "@thi.ng/transducers": "^5.1.1" + "@thi.ng/transducers": "^5.2.2" }, "keywords": [ "async", diff --git a/packages/csp/src/api.ts b/packages/csp/src/api.ts index b6a0101857..5a9533415c 100644 --- a/packages/csp/src/api.ts +++ b/packages/csp/src/api.ts @@ -1,4 +1,9 @@ -import { IID, ILength, IRelease } from "@thi.ng/api"; +import { + Fn, + IID, + ILength, + IRelease +} from "@thi.ng/api"; import { Channel } from "./channel"; export const enum State { @@ -13,8 +18,8 @@ export const enum State { // export const __State = (exports).State; export interface ChannelItem { - value: () => Promise; - resolve: (success: boolean) => void; + value(): Promise; + resolve(success: boolean): void; } export interface IBuffer extends ILength, IRelease { @@ -41,6 +46,6 @@ export interface IReadWriteableChannel extends IReadableChannel, IWriteableChannel {} -export type TopicFn = (x: T) => string; +export type TopicFn = Fn; export type ErrorHandler = (e: Error, chan: Channel, val?: any) => void; diff --git a/packages/csp/src/channel.ts b/packages/csp/src/channel.ts index efb20be895..28bd441d0b 100644 --- a/packages/csp/src/channel.ts +++ b/packages/csp/src/channel.ts @@ -1,4 +1,4 @@ -import { Predicate } from "@thi.ng/api"; +import { Fn, Fn0, Predicate } from "@thi.ng/api"; import { shuffle } from "@thi.ng/arrays"; import { isFunction } from "@thi.ng/checks"; import { DCons } from "@thi.ng/dcons"; @@ -28,7 +28,7 @@ export class Channel implements IReadWriteableChannel { return chan; } - static repeatedly(fn: () => T, delay?: number) { + static repeatedly(fn: Fn0, delay?: number) { const chan = new Channel(delay ? delayed(delay) : null); chan.produce(fn); return chan; @@ -417,7 +417,7 @@ export class Channel implements IReadWriteableChannel { ); } - consume(fn: (x: T) => any = (x: T) => console.log(this.id, ":", x)) { + consume(fn: Fn = (x) => console.log(this.id, ":", x)) { return (async () => { let x; while (((x = null), (x = await this.read())) !== undefined) { @@ -427,7 +427,7 @@ export class Channel implements IReadWriteableChannel { })(); } - produce(fn: () => T, close = true) { + produce(fn: Fn0, close = true) { return (async () => { while (!this.isClosed()) { const val = await fn(); @@ -440,9 +440,7 @@ export class Channel implements IReadWriteableChannel { })(); } - consumeWhileReadable( - fn: (x: T) => any = (x: T) => console.log(this.id, ":", x) - ) { + consumeWhileReadable(fn: Fn = (x) => console.log(this.id, ":", x)) { return (async () => { let x; while (this.isReadable()) { diff --git a/packages/dcons/CHANGELOG.md b/packages/dcons/CHANGELOG.md index 907a7c9a96..02d863c04a 100644 --- a/packages/dcons/CHANGELOG.md +++ b/packages/dcons/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@2.0.10...@thi.ng/dcons@2.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/dcons + + + + + +## [2.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@2.0.9...@thi.ng/dcons@2.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/dcons + + + + + +## [2.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@2.0.8...@thi.ng/dcons@2.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/dcons + + + + + +## [2.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@2.0.7...@thi.ng/dcons@2.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/dcons + + + + + ## [2.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@2.0.6...@thi.ng/dcons@2.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/dcons diff --git a/packages/dcons/package.json b/packages/dcons/package.json index a73f83430a..f94063b9f9 100644 --- a/packages/dcons/package.json +++ b/packages/dcons/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dcons", - "version": "2.0.7", + "version": "2.0.11", "description": "Comprehensive doubly linked list structure w/ iterator support", "module": "./index.js", "main": "./lib/index.js", @@ -32,12 +32,12 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", "@thi.ng/compare": "^1.0.3", "@thi.ng/equiv": "^1.0.3", "@thi.ng/errors": "^1.0.3", - "@thi.ng/transducers": "^5.1.1" + "@thi.ng/transducers": "^5.2.2" }, "keywords": [ "datastructure", diff --git a/packages/dcons/src/index.ts b/packages/dcons/src/index.ts index 88504c67fd..b22dc28502 100644 --- a/packages/dcons/src/index.ts +++ b/packages/dcons/src/index.ts @@ -1,5 +1,6 @@ import { Comparator, + Fn, ICompare, ICopy, IEmpty, @@ -437,7 +438,7 @@ export class DCons } } - map(fn: (x: T) => R) { + map(fn: Fn) { const res = new DCons(); let cell = this.head; while (cell) { @@ -457,12 +458,12 @@ export class DCons return res; } - reduce(rfn: (acc: R, x: T) => R, initial: R) { + reduce(rfn: ReductionFn, initial: R) { let acc: R = initial; let cell = this.head; while (cell) { // TODO add early termination support - acc = rfn(acc, cell.value); + acc = rfn(acc, cell.value); cell = cell.next; } return acc; @@ -529,8 +530,8 @@ export class DCons cell.value != null ? cell.value.toString() : cell.value === undefined - ? "undefined" - : "null" + ? "undefined" + : "null" ); cell = cell.next; } diff --git a/packages/defmulti/CHANGELOG.md b/packages/defmulti/CHANGELOG.md index afe6129e30..5b8c91bd58 100644 --- a/packages/defmulti/CHANGELOG.md +++ b/packages/defmulti/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/defmulti@1.0.3...@thi.ng/defmulti@1.0.4) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/defmulti + + + + + ## [1.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/defmulti@1.0.2...@thi.ng/defmulti@1.0.3) (2019-03-01) **Note:** Version bump only for package @thi.ng/defmulti diff --git a/packages/defmulti/package.json b/packages/defmulti/package.json index 56bc011f05..5a9a51486e 100644 --- a/packages/defmulti/package.json +++ b/packages/defmulti/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/defmulti", - "version": "1.0.3", + "version": "1.0.4", "description": "Dynamically extensible multiple dispatch via user supplied dispatch function.", "module": "./index.js", "main": "./lib/index.js", @@ -32,7 +32,7 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", + "@thi.ng/api": "^5.1.0", "@thi.ng/errors": "^1.0.3" }, "keywords": [ diff --git a/packages/defmulti/src/index.ts b/packages/defmulti/src/index.ts index 3e3802285f..9cabfaa801 100644 --- a/packages/defmulti/src/index.ts +++ b/packages/defmulti/src/index.ts @@ -1,16 +1,27 @@ -import { IObjectOf } from "@thi.ng/api"; -import { illegalArgs, unsupported, illegalArity } from "@thi.ng/errors"; +import { + Fn, + Fn2, + Fn3, + Fn4, + Fn5, + Fn6, + Fn7, + Fn8, + FnAny, + IObjectOf +} from "@thi.ng/api"; +import { illegalArgs, illegalArity, unsupported } from "@thi.ng/errors"; export const DEFAULT: unique symbol = Symbol(); -export type DispatchFn = (...args) => PropertyKey; -export type DispatchFn1 = (a: A) => PropertyKey; +export type DispatchFn = FnAny; +export type DispatchFn1 = Fn; export type DispatchFn1O = (a: A, b?: B) => PropertyKey; -export type DispatchFn2 = (a: A, b: B) => PropertyKey; +export type DispatchFn2 = Fn2; export type DispatchFn2O = (a: A, b: B, c?: C) => PropertyKey; -export type DispatchFn3 = (a: A, b: B, c: C) => PropertyKey; +export type DispatchFn3 = Fn3; export type DispatchFn3O = (a: A, b: B, c: C, d?: D) => PropertyKey; -export type DispatchFn4 = (a: A, b: B, c: C, d: D) => PropertyKey; +export type DispatchFn4 = Fn4; export type DispatchFn4O = ( a: A, b: B, @@ -18,13 +29,7 @@ export type DispatchFn4O = ( d: D, e?: E ) => PropertyKey; -export type DispatchFn5 = ( - a: A, - b: B, - c: C, - d: D, - e: E -) => PropertyKey; +export type DispatchFn5 = Fn5; export type DispatchFn5O = ( a: A, b: B, @@ -33,14 +38,7 @@ export type DispatchFn5O = ( e: E, f?: F ) => PropertyKey; -export type DispatchFn6 = ( - a: A, - b: B, - c: C, - d: D, - e: E, - f: F -) => PropertyKey; +export type DispatchFn6 = Fn6; export type DispatchFn6O = ( a: A, b: B, @@ -50,15 +48,16 @@ export type DispatchFn6O = ( f: F, g?: G ) => PropertyKey; -export type DispatchFn7 = ( - a: A, - b: B, - c: C, - d: D, - e: E, - f: F, - g: G -) => PropertyKey; +export type DispatchFn7 = Fn7< + A, + B, + C, + D, + E, + F, + G, + PropertyKey +>; export type DispatchFn7O = ( a: A, b: B, @@ -69,16 +68,17 @@ export type DispatchFn7O = ( g: G, h?: H ) => PropertyKey; -export type DispatchFn8 = ( - a: A, - b: B, - c: C, - d: D, - e: E, - f: F, - g: G, - h: H -) => PropertyKey; +export type DispatchFn8 = Fn8< + A, + B, + C, + D, + E, + F, + G, + H, + PropertyKey +>; export type DispatchFn8O = ( a: A, b: B, @@ -91,14 +91,14 @@ export type DispatchFn8O = ( i?: I ) => PropertyKey; -export type Implementation = (...args: any[]) => T; -export type Implementation1 = (a: A) => T; +export type Implementation = FnAny; +export type Implementation1 = Fn; export type Implementation1O = (a: A, b?: B) => T; -export type Implementation2 = (a: A, b: B) => T; +export type Implementation2 = Fn2; export type Implementation2O = (a: A, b: B, c?: C) => T; -export type Implementation3 = (a: A, b: B, c: C) => T; +export type Implementation3 = Fn3; export type Implementation3O = (a: A, b: B, c: C, d?: D) => T; -export type Implementation4 = (a: A, b: B, c: C, d: D) => T; +export type Implementation4 = Fn4; export type Implementation4O = ( a: A, b: B, @@ -106,13 +106,7 @@ export type Implementation4O = ( d: D, e?: E ) => T; -export type Implementation5 = ( - a: A, - b: B, - c: C, - d: D, - e: E -) => T; +export type Implementation5 = Fn5; export type Implementation5O = ( a: A, b: B, @@ -121,14 +115,7 @@ export type Implementation5O = ( e: E, f?: F ) => T; -export type Implementation6 = ( - a: A, - b: B, - c: C, - d: D, - e: E, - f: F -) => T; +export type Implementation6 = Fn6; export type Implementation6O = ( a: A, b: B, @@ -138,15 +125,16 @@ export type Implementation6O = ( f: F, g?: G ) => T; -export type Implementation7 = ( - a: A, - b: B, - c: C, - d: D, - e: E, - f: F, - g: G -) => T; +export type Implementation7 = Fn7< + A, + B, + C, + D, + E, + F, + G, + T +>; export type Implementation7O = ( a: A, b: B, @@ -157,16 +145,17 @@ export type Implementation7O = ( g: G, h?: H ) => T; -export type Implementation8 = ( - a: A, - b: B, - c: C, - d: D, - e: E, - f: F, - g: G, - h: H -) => T; +export type Implementation8 = Fn8< + A, + B, + C, + D, + E, + F, + G, + H, + T +>; export type Implementation8O = ( a: A, b: B, diff --git a/packages/dgraph/CHANGELOG.md b/packages/dgraph/CHANGELOG.md index 1d9c222a8d..57bf995ce1 100644 --- a/packages/dgraph/CHANGELOG.md +++ b/packages/dgraph/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@1.0.10...@thi.ng/dgraph@1.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/dgraph + + + + + +## [1.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@1.0.9...@thi.ng/dgraph@1.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/dgraph + + + + + +## [1.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@1.0.8...@thi.ng/dgraph@1.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/dgraph + + + + + +## [1.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@1.0.7...@thi.ng/dgraph@1.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/dgraph + + + + + ## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@1.0.6...@thi.ng/dgraph@1.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/dgraph diff --git a/packages/dgraph/package.json b/packages/dgraph/package.json index 254dc42732..b502c00f25 100644 --- a/packages/dgraph/package.json +++ b/packages/dgraph/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dgraph", - "version": "1.0.7", + "version": "1.0.11", "description": "Type-agnostic directed acyclic graph (DAG) & graph operations", "module": "./index.js", "main": "./lib/index.js", @@ -32,11 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/associative": "^1.0.7", + "@thi.ng/api": "^5.1.0", + "@thi.ng/associative": "^1.0.11", "@thi.ng/equiv": "^1.0.3", "@thi.ng/errors": "^1.0.3", - "@thi.ng/transducers": "^5.1.1" + "@thi.ng/transducers": "^5.2.2" }, "keywords": [ "data structure", diff --git a/packages/diff/CHANGELOG.md b/packages/diff/CHANGELOG.md index a20c88509d..f7b1685445 100644 --- a/packages/diff/CHANGELOG.md +++ b/packages/diff/CHANGELOG.md @@ -3,6 +3,14 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/diff@3.0.3...@thi.ng/diff@3.0.4) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/diff + + + + + ## [3.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/diff@3.0.2...@thi.ng/diff@3.0.3) (2019-03-01) **Note:** Version bump only for package @thi.ng/diff diff --git a/packages/diff/package.json b/packages/diff/package.json index ca57debfdc..392237a3ae 100644 --- a/packages/diff/package.json +++ b/packages/diff/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/diff", - "version": "3.0.3", + "version": "3.0.4", "description": "Array & object Diff", "module": "./index.js", "main": "./lib/index.js", @@ -31,7 +31,7 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", + "@thi.ng/api": "^5.1.0", "@thi.ng/equiv": "^1.0.3" }, "keywords": [ diff --git a/packages/dot/CHANGELOG.md b/packages/dot/CHANGELOG.md index e5b3fca643..7431ada17a 100644 --- a/packages/dot/CHANGELOG.md +++ b/packages/dot/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/dot@1.0.6...@thi.ng/dot@1.0.7) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/dot + + + + + +## [1.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/dot@1.0.5...@thi.ng/dot@1.0.6) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/dot + + + + + +## [1.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/dot@1.0.4...@thi.ng/dot@1.0.5) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/dot + + + + + ## [1.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/dot@1.0.3...@thi.ng/dot@1.0.4) (2019-03-01) **Note:** Version bump only for package @thi.ng/dot diff --git a/packages/dot/package.json b/packages/dot/package.json index 0a64abcaa6..6318fd1183 100644 --- a/packages/dot/package.json +++ b/packages/dot/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dot", - "version": "1.0.4", + "version": "1.0.7", "description": "Graphviz DOM abstraction as vanilla JS objects & serialization to DOT format", "module": "./index.js", "main": "./lib/index.js", @@ -32,8 +32,8 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1" + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3" }, "keywords": [ "ES6", diff --git a/packages/dsp/CHANGELOG.md b/packages/dsp/CHANGELOG.md index 8386511389..6b4c7157d7 100644 --- a/packages/dsp/CHANGELOG.md +++ b/packages/dsp/CHANGELOG.md @@ -3,6 +3,22 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@1.0.4...@thi.ng/dsp@1.0.5) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/dsp + + + + + +## [1.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@1.0.3...@thi.ng/dsp@1.0.4) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/dsp + + + + + ## [1.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/dsp@1.0.2...@thi.ng/dsp@1.0.3) (2019-03-01) **Note:** Version bump only for package @thi.ng/dsp diff --git a/packages/dsp/package.json b/packages/dsp/package.json index 81f1df2e8c..fc36b40476 100644 --- a/packages/dsp/package.json +++ b/packages/dsp/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dsp", - "version": "1.0.3", + "version": "1.0.5", "description": "Assorted DSP utils, oscillators etc.", "module": "./index.js", "main": "./lib/index.js", @@ -32,7 +32,8 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/math": "^1.1.1" + "@thi.ng/api": "^5.1.0", + "@thi.ng/math": "^1.2.0" }, "keywords": [ "additive", diff --git a/packages/dsp/src/osc.ts b/packages/dsp/src/osc.ts index 181e93f352..0a81d8bffd 100644 --- a/packages/dsp/src/osc.ts +++ b/packages/dsp/src/osc.ts @@ -1,4 +1,11 @@ -import { fract, HALF_PI, mix as _mix, TAU, wrap01 } from "@thi.ng/math"; +import { Fn } from "@thi.ng/api"; +import { + fract, + HALF_PI, + mix as _mix, + TAU, + wrap01 +} from "@thi.ng/math"; import { StatelessOscillator } from "./api"; export class Oscillator implements Iterable { @@ -112,8 +119,8 @@ export const mix = ( export const additive = ( osc: StatelessOscillator, - freqFn: (i: number) => number, - ampFn: (i: number) => number, + freqFn: Fn, + ampFn: Fn, n: number ) => (phase: number, freq: number, amp = 1, dc = 0) => { let y = 0; @@ -172,5 +179,5 @@ export const polyBLEP = (eps: number, x: number) => x < eps ? ((x /= eps), x + x - x * x - 1) : x > 1 - eps - ? ((x = (x - 1) / eps), x * x + x + x + 1) - : 0; + ? ((x = (x - 1) / eps), x * x + x + x + 1) + : 0; diff --git a/packages/fsm/CHANGELOG.md b/packages/fsm/CHANGELOG.md index dd3fbb9c92..b0a446ea7f 100644 --- a/packages/fsm/CHANGELOG.md +++ b/packages/fsm/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/fsm@2.1.6...@thi.ng/fsm@2.1.7) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/fsm + + + + + +## [2.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/fsm@2.1.5...@thi.ng/fsm@2.1.6) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/fsm + + + + + +## [2.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/fsm@2.1.4...@thi.ng/fsm@2.1.5) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/fsm + + + + + +## [2.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/fsm@2.1.3...@thi.ng/fsm@2.1.4) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/fsm + + + + + ## [2.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/fsm@2.1.2...@thi.ng/fsm@2.1.3) (2019-03-01) **Note:** Version bump only for package @thi.ng/fsm diff --git a/packages/fsm/package.json b/packages/fsm/package.json index 32f1ee818d..11b5e42a48 100644 --- a/packages/fsm/package.json +++ b/packages/fsm/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/fsm", - "version": "2.1.3", + "version": "2.1.7", "description": "Composable primitives for building declarative, transducer based Finite-State machines & parsers for arbitrary data streams", "module": "./index.js", "main": "./lib/index.js", @@ -32,11 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/arrays": "^0.1.1", + "@thi.ng/api": "^5.1.0", + "@thi.ng/arrays": "^0.1.4", "@thi.ng/equiv": "^1.0.3", "@thi.ng/errors": "^1.0.3", - "@thi.ng/transducers": "^5.1.1" + "@thi.ng/transducers": "^5.2.2" }, "keywords": [ "ES6", diff --git a/packages/fsm/src/fsm.ts b/packages/fsm/src/fsm.ts index 660b42b164..614e742d11 100644 --- a/packages/fsm/src/fsm.ts +++ b/packages/fsm/src/fsm.ts @@ -1,12 +1,12 @@ -import { IObjectOf } from "@thi.ng/api"; +import { Fn2, IObjectOf } from "@thi.ng/api"; import { illegalArgs, illegalState } from "@thi.ng/errors"; import { ensureReduced, isReduced, + iterator, Reducer, Transducer, - unreduced, - iterator + unreduced } from "@thi.ng/transducers"; import { Match, Matcher } from "./api"; @@ -44,20 +44,20 @@ export function fsm( states: IObjectOf>, ctx: C, initial: string | number, - update?: (ctx: C, x: T) => void + update?: Fn2 ): Transducer; export function fsm( states: IObjectOf>, ctx: C, initial: string | number, - update?: (ctx: C, x: T) => void, + update?: Fn2, src?: Iterable ): IterableIterator; export function fsm( states: IObjectOf>, ctx: C, initial: string | number = "start", - update?: (ctx: C, x: T) => void, + update?: Fn2, src?: Iterable ) { return src diff --git a/packages/geom-accel/CHANGELOG.md b/packages/geom-accel/CHANGELOG.md index 781884e565..f9db9f0998 100644 --- a/packages/geom-accel/CHANGELOG.md +++ b/packages/geom-accel/CHANGELOG.md @@ -3,6 +3,41 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-accel@1.1.8...@thi.ng/geom-accel@1.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-accel + + + + + +## [1.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-accel@1.1.7...@thi.ng/geom-accel@1.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-accel + + + + + +## [1.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-accel@1.1.6...@thi.ng/geom-accel@1.1.7) (2019-03-10) + + +### Bug Fixes + +* **geom-accel:** fix/update existing point search in add()/select*() ([8186f12](https://github.com/thi-ng/umbrella/commit/8186f12)) + + + + + +## [1.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-accel@1.1.5...@thi.ng/geom-accel@1.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-accel + + + + + ## [1.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-accel@1.1.4...@thi.ng/geom-accel@1.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-accel diff --git a/packages/geom-accel/package.json b/packages/geom-accel/package.json index bf9b7b7656..e8c0d6800a 100644 --- a/packages/geom-accel/package.json +++ b/packages/geom-accel/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-accel", - "version": "1.1.5", + "version": "1.1.9", "description": "nD spatial indexing data structures", "module": "./index.js", "main": "./lib/index.js", @@ -32,13 +32,13 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/arrays": "^0.1.1", - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/heaps": "^1.0.4", - "@thi.ng/math": "^1.1.1", - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/api": "^5.1.0", + "@thi.ng/arrays": "^0.1.4", + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/heaps": "^1.0.5", + "@thi.ng/math": "^1.2.0", + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-accel/src/kdtree.ts b/packages/geom-accel/src/kdtree.ts index 094f0d10ab..7ef1b7fcaa 100644 --- a/packages/geom-accel/src/kdtree.ts +++ b/packages/geom-accel/src/kdtree.ts @@ -94,17 +94,17 @@ export class KdTree const search = ( node: KdNode, parent: KdNode - ): KdNode | false => + ): KdNode => node - ? distSq(p, node.k) > eps - ? search(p[node.d] < node.k[node.d] ? node.l : node.r, node) - : false + ? search(p[node.d] < node.k[node.d] ? node.l : node.r, node) : parent; - const parent = search(this.root, null); - if (parent === false) return false; - if (parent == null) { - this.root = new KdNode(null, 0, p, v); - } else { + let parent: KdNode; + if (this.root) { + parent = nearest1(p, [eps * eps, null], [], this.dim, this.root)[1]; + if (parent) { + return false; + } + parent = search(this.root, null); const dim = parent.d; parent[p[dim] < parent.k[dim] ? "l" : "r"] = new KdNode( parent, @@ -112,6 +112,8 @@ export class KdTree p, v ); + } else { + this.root = new KdNode(null, 0, p, v); } this._length++; return true; @@ -160,7 +162,7 @@ export class KdTree if (maxNum === 1) { const sel = nearest1( q, - [maxDist != null ? maxDist : Infinity, null], + [maxDist != null ? maxDist * maxDist : Infinity, null], [], this.dim, this.root @@ -182,7 +184,7 @@ export class KdTree if (maxNum === 1) { const sel = nearest1( q, - [maxDist != null ? maxDist : Infinity, null], + [maxDist != null ? maxDist * maxDist : Infinity, null], [], this.dim, this.root @@ -204,7 +206,7 @@ export class KdTree if (maxNum === 1) { const sel = nearest1( q, - [maxDist != null ? maxDist : Infinity, null], + [maxDist != null ? maxDist * maxDist : Infinity, null], [], this.dim, this.root @@ -363,10 +365,10 @@ const nearest = ( let best = !node.r ? node.l : !node.l - ? node.r - : q[ndim] < p[ndim] - ? node.l - : node.r; + ? node.r + : q[ndim] < p[ndim] + ? node.l + : node.r; nearest(q, acc, tmp, dims, maxNum, best); if (!acc.length || ndist < acc.peek()[0]) { if (acc.length >= maxNum) { @@ -413,10 +415,10 @@ const nearest1 = ( let best = !node.r ? node.l : !node.l - ? node.r - : q[ndim] < p[ndim] - ? node.l - : node.r; + ? node.r + : q[ndim] < p[ndim] + ? node.l + : node.r; nearest1(q, acc, tmp, dims, best); if (ndist < acc[0]) { acc[0] = ndist; diff --git a/packages/geom-api/CHANGELOG.md b/packages/geom-api/CHANGELOG.md index e33b0b8ebf..4dd2703395 100644 --- a/packages/geom-api/CHANGELOG.md +++ b/packages/geom-api/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-api@0.1.7...@thi.ng/geom-api@0.1.8) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-api + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-api@0.1.6...@thi.ng/geom-api@0.1.7) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-api + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-api@0.1.5...@thi.ng/geom-api@0.1.6) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-api + + + + + +## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-api@0.1.4...@thi.ng/geom-api@0.1.5) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-api + + + + + ## [0.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-api@0.1.3...@thi.ng/geom-api@0.1.4) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-api diff --git a/packages/geom-api/package.json b/packages/geom-api/package.json index 43ff402df4..6ff1646e02 100644 --- a/packages/geom-api/package.json +++ b/packages/geom-api/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-api", - "version": "0.1.4", + "version": "0.1.8", "description": "Shared type & interface declarations for @thi.ng/geom packages", "module": "./index.js", "main": "./lib/index.js", @@ -32,8 +32,8 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/api": "^5.1.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "ES6", diff --git a/packages/geom-arc/CHANGELOG.md b/packages/geom-arc/CHANGELOG.md index 563f562a7d..a0265d21c2 100644 --- a/packages/geom-arc/CHANGELOG.md +++ b/packages/geom-arc/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-arc@0.1.8...@thi.ng/geom-arc@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-arc + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-arc@0.1.7...@thi.ng/geom-arc@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-arc + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-arc@0.1.6...@thi.ng/geom-arc@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-arc + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-arc@0.1.5...@thi.ng/geom-arc@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-arc + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-arc@0.1.4...@thi.ng/geom-arc@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-arc diff --git a/packages/geom-arc/package.json b/packages/geom-arc/package.json index eaf0cc4889..8c89e8be32 100644 --- a/packages/geom-arc/package.json +++ b/packages/geom-arc/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-arc", - "version": "0.1.5", + "version": "0.1.9", "description": "2D circular / elliptic arc operations", "module": "./index.js", "main": "./lib/index.js", @@ -32,11 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/checks": "^2.1.1", - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/geom-resample": "^0.1.5", - "@thi.ng/math": "^1.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/checks": "^2.1.3", + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/geom-resample": "^0.1.9", + "@thi.ng/math": "^1.2.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-clip/CHANGELOG.md b/packages/geom-clip/CHANGELOG.md index 50babf83df..2a8818167a 100644 --- a/packages/geom-clip/CHANGELOG.md +++ b/packages/geom-clip/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip@0.0.10...@thi.ng/geom-clip@0.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-clip + + + + + +## [0.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip@0.0.9...@thi.ng/geom-clip@0.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-clip + + + + + +## [0.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip@0.0.8...@thi.ng/geom-clip@0.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-clip + + + + + +## [0.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip@0.0.7...@thi.ng/geom-clip@0.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-clip + + + + + ## [0.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-clip@0.0.6...@thi.ng/geom-clip@0.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-clip diff --git a/packages/geom-clip/package.json b/packages/geom-clip/package.json index 8f3799f365..44ee7accac 100644 --- a/packages/geom-clip/package.json +++ b/packages/geom-clip/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-clip", - "version": "0.0.7", + "version": "0.0.11", "description": "2D line & convex polygon clipping (Liang-Barsky / Sutherland-Hodgeman)", "module": "./index.js", "main": "./lib/index.js", @@ -32,10 +32,10 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/geom-isec": "^0.1.5", - "@thi.ng/geom-poly-utils": "^0.1.5", - "@thi.ng/math": "^1.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/geom-isec": "^0.1.9", + "@thi.ng/geom-poly-utils": "^0.1.9", + "@thi.ng/math": "^1.2.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-closest-point/CHANGELOG.md b/packages/geom-closest-point/CHANGELOG.md index aecf0f8009..e8a77c61d6 100644 --- a/packages/geom-closest-point/CHANGELOG.md +++ b/packages/geom-closest-point/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-closest-point@0.1.8...@thi.ng/geom-closest-point@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-closest-point + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-closest-point@0.1.7...@thi.ng/geom-closest-point@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-closest-point + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-closest-point@0.1.6...@thi.ng/geom-closest-point@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-closest-point + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-closest-point@0.1.5...@thi.ng/geom-closest-point@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-closest-point + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-closest-point@0.1.4...@thi.ng/geom-closest-point@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-closest-point diff --git a/packages/geom-closest-point/package.json b/packages/geom-closest-point/package.json index 8ed71afe93..2a37b0d6bf 100644 --- a/packages/geom-closest-point/package.json +++ b/packages/geom-closest-point/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-closest-point", - "version": "0.1.5", + "version": "0.1.9", "description": "Closest point / proximity helpers", "module": "./index.js", "main": "./lib/index.js", @@ -32,7 +32,7 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "ES6", diff --git a/packages/geom-hull/CHANGELOG.md b/packages/geom-hull/CHANGELOG.md index 3cb3508ae1..b3a83f1293 100644 --- a/packages/geom-hull/CHANGELOG.md +++ b/packages/geom-hull/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.10...@thi.ng/geom-hull@0.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-hull + + + + + +## [0.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.9...@thi.ng/geom-hull@0.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-hull + + + + + +## [0.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.8...@thi.ng/geom-hull@0.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-hull + + + + + +## [0.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.7...@thi.ng/geom-hull@0.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-hull + + + + + ## [0.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-hull@0.0.6...@thi.ng/geom-hull@0.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-hull diff --git a/packages/geom-hull/package.json b/packages/geom-hull/package.json index 3e696d64ab..782a863634 100644 --- a/packages/geom-hull/package.json +++ b/packages/geom-hull/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-hull", - "version": "0.0.7", + "version": "0.0.11", "description": "Fast 2D convex hull (Graham Scan)", "module": "./index.js", "main": "./lib/index.js", @@ -32,8 +32,8 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/math": "^1.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/math": "^1.2.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-isec/CHANGELOG.md b/packages/geom-isec/CHANGELOG.md index d7da44e5bb..52cb40f105 100644 --- a/packages/geom-isec/CHANGELOG.md +++ b/packages/geom-isec/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isec@0.1.8...@thi.ng/geom-isec@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-isec + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isec@0.1.7...@thi.ng/geom-isec@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-isec + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isec@0.1.6...@thi.ng/geom-isec@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-isec + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isec@0.1.5...@thi.ng/geom-isec@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-isec + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isec@0.1.4...@thi.ng/geom-isec@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-isec diff --git a/packages/geom-isec/package.json b/packages/geom-isec/package.json index 324f7accca..700a502b49 100644 --- a/packages/geom-isec/package.json +++ b/packages/geom-isec/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-isec", - "version": "0.1.5", + "version": "0.1.9", "description": "2D/3D shape intersection checks", "module": "./index.js", "main": "./lib/index.js", @@ -32,10 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/geom-closest-point": "^0.1.5", - "@thi.ng/math": "^1.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/api": "^5.1.0", + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/geom-closest-point": "^0.1.9", + "@thi.ng/math": "^1.2.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-isec/src/ray-rect.ts b/packages/geom-isec/src/ray-rect.ts index d20594fd5e..f7829b817c 100644 --- a/packages/geom-isec/src/ray-rect.ts +++ b/packages/geom-isec/src/ray-rect.ts @@ -1,3 +1,4 @@ +import { Fn4 } from "@thi.ng/api"; import { IntersectionType } from "@thi.ng/geom-api"; import { maddN, ReadonlyVec } from "@thi.ng/vectors"; import { NONE } from "./api"; @@ -29,7 +30,7 @@ const rayRect = ( (p = rpos[1]), (d = 1 / dir[1]); t1 = (bmin[1] - p) * d; t2 = (bmax[1] - p) * d; - return [max(tmin, min(t1, t2)), min(tmax, max(t1, t2))]; + return <[number, number]>[max(tmin, min(t1, t2)), min(tmax, max(t1, t2))]; }; /** @@ -60,16 +61,17 @@ const rayBox = ( t2 = (bmax[2] - p) * d; tmin = max(tmin, min(t1, t2)); tmax = min(tmax, max(t1, t2)); - return [max(tmin, min(t1, t2)), min(tmax, max(t1, t2))]; + return <[number, number]>[max(tmin, min(t1, t2)), min(tmax, max(t1, t2))]; }; const intersectWith = ( - fn: ( - a: ReadonlyVec, - b: ReadonlyVec, - c: ReadonlyVec, - d: ReadonlyVec - ) => number[] + fn: Fn4< + ReadonlyVec, + ReadonlyVec, + ReadonlyVec, + ReadonlyVec, + [number, number] + > ) => ( rpos: ReadonlyVec, dir: ReadonlyVec, diff --git a/packages/geom-isoline/CHANGELOG.md b/packages/geom-isoline/CHANGELOG.md index ae36606669..d9a7b9179e 100644 --- a/packages/geom-isoline/CHANGELOG.md +++ b/packages/geom-isoline/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isoline@0.1.8...@thi.ng/geom-isoline@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-isoline + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isoline@0.1.7...@thi.ng/geom-isoline@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-isoline + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isoline@0.1.6...@thi.ng/geom-isoline@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-isoline + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isoline@0.1.5...@thi.ng/geom-isoline@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-isoline + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-isoline@0.1.4...@thi.ng/geom-isoline@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-isoline diff --git a/packages/geom-isoline/package.json b/packages/geom-isoline/package.json index dcccbf0938..d65a355f79 100644 --- a/packages/geom-isoline/package.json +++ b/packages/geom-isoline/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-isoline", - "version": "0.1.5", + "version": "0.1.9", "description": "Fast 2D contour line extraction / generation", "module": "./index.js", "main": "./lib/index.js", @@ -32,8 +32,8 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-poly-utils/CHANGELOG.md b/packages/geom-poly-utils/CHANGELOG.md index 70e527455f..1b21561dd5 100644 --- a/packages/geom-poly-utils/CHANGELOG.md +++ b/packages/geom-poly-utils/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.8...@thi.ng/geom-poly-utils@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-poly-utils + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.7...@thi.ng/geom-poly-utils@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-poly-utils + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.6...@thi.ng/geom-poly-utils@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-poly-utils + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.5...@thi.ng/geom-poly-utils@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-poly-utils + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-poly-utils@0.1.4...@thi.ng/geom-poly-utils@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-poly-utils diff --git a/packages/geom-poly-utils/package.json b/packages/geom-poly-utils/package.json index 43790b92b6..e808a5281d 100644 --- a/packages/geom-poly-utils/package.json +++ b/packages/geom-poly-utils/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-poly-utils", - "version": "0.1.5", + "version": "0.1.9", "description": "Polygon / triangle analysis & processing utilities", "module": "./index.js", "main": "./lib/index.js", @@ -33,9 +33,9 @@ }, "dependencies": { "@thi.ng/errors": "^1.0.3", - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/math": "^1.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/math": "^1.2.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-resample/CHANGELOG.md b/packages/geom-resample/CHANGELOG.md index 8d43fe9900..1e6cecacd4 100644 --- a/packages/geom-resample/CHANGELOG.md +++ b/packages/geom-resample/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-resample@0.1.8...@thi.ng/geom-resample@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-resample + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-resample@0.1.7...@thi.ng/geom-resample@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-resample + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-resample@0.1.6...@thi.ng/geom-resample@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-resample + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-resample@0.1.5...@thi.ng/geom-resample@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-resample + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-resample@0.1.4...@thi.ng/geom-resample@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-resample diff --git a/packages/geom-resample/package.json b/packages/geom-resample/package.json index 5bd0822f26..711e219cce 100644 --- a/packages/geom-resample/package.json +++ b/packages/geom-resample/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-resample", - "version": "0.1.5", + "version": "0.1.9", "description": "Customizable nD polyline interpolation, re-sampling, splitting & nearest point computation", "module": "./index.js", "main": "./lib/index.js", @@ -32,11 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/checks": "^2.1.1", - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/geom-closest-point": "^0.1.5", - "@thi.ng/math": "^1.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/checks": "^2.1.3", + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/geom-closest-point": "^0.1.9", + "@thi.ng/math": "^1.2.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-splines/CHANGELOG.md b/packages/geom-splines/CHANGELOG.md index cb574783e1..5591871297 100644 --- a/packages/geom-splines/CHANGELOG.md +++ b/packages/geom-splines/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-splines@0.1.8...@thi.ng/geom-splines@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-splines + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-splines@0.1.7...@thi.ng/geom-splines@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-splines + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-splines@0.1.6...@thi.ng/geom-splines@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-splines + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-splines@0.1.5...@thi.ng/geom-splines@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-splines + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-splines@0.1.4...@thi.ng/geom-splines@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-splines diff --git a/packages/geom-splines/package.json b/packages/geom-splines/package.json index 617bdeccd8..3dfa5abc84 100644 --- a/packages/geom-splines/package.json +++ b/packages/geom-splines/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-splines", - "version": "0.1.5", + "version": "0.1.9", "description": "nD cubic & quadratic curve analysis, conversion, interpolation, splitting", "module": "./index.js", "main": "./lib/index.js", @@ -32,12 +32,12 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/checks": "^2.1.1", - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/geom-arc": "^0.1.5", - "@thi.ng/geom-resample": "^0.1.5", - "@thi.ng/math": "^1.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/checks": "^2.1.3", + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/geom-arc": "^0.1.9", + "@thi.ng/geom-resample": "^0.1.9", + "@thi.ng/math": "^1.2.0", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-subdiv-curve/CHANGELOG.md b/packages/geom-subdiv-curve/CHANGELOG.md index cc21814c39..5fb4e1b196 100644 --- a/packages/geom-subdiv-curve/CHANGELOG.md +++ b/packages/geom-subdiv-curve/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-subdiv-curve@0.1.7...@thi.ng/geom-subdiv-curve@0.1.8) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-subdiv-curve + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-subdiv-curve@0.1.6...@thi.ng/geom-subdiv-curve@0.1.7) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-subdiv-curve + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-subdiv-curve@0.1.5...@thi.ng/geom-subdiv-curve@0.1.6) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-subdiv-curve + + + + + +## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-subdiv-curve@0.1.4...@thi.ng/geom-subdiv-curve@0.1.5) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-subdiv-curve + + + + + ## [0.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-subdiv-curve@0.1.3...@thi.ng/geom-subdiv-curve@0.1.4) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-subdiv-curve diff --git a/packages/geom-subdiv-curve/package.json b/packages/geom-subdiv-curve/package.json index fa2e1c9a6f..69e9c355bf 100644 --- a/packages/geom-subdiv-curve/package.json +++ b/packages/geom-subdiv-curve/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-subdiv-curve", - "version": "0.1.4", + "version": "0.1.8", "description": "Freely customizable, iterative subdivision curves for open / closed input geometries", "module": "./index.js", "main": "./lib/index.js", @@ -32,9 +32,9 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-tessellate/CHANGELOG.md b/packages/geom-tessellate/CHANGELOG.md index 44c4f6e2ef..fb2a455867 100644 --- a/packages/geom-tessellate/CHANGELOG.md +++ b/packages/geom-tessellate/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-tessellate@0.1.8...@thi.ng/geom-tessellate@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-tessellate + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-tessellate@0.1.7...@thi.ng/geom-tessellate@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-tessellate + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-tessellate@0.1.6...@thi.ng/geom-tessellate@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-tessellate + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-tessellate@0.1.5...@thi.ng/geom-tessellate@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-tessellate + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-tessellate@0.1.4...@thi.ng/geom-tessellate@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-tessellate diff --git a/packages/geom-tessellate/package.json b/packages/geom-tessellate/package.json index 43805d56ce..469f73be22 100644 --- a/packages/geom-tessellate/package.json +++ b/packages/geom-tessellate/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-tessellate", - "version": "0.1.5", + "version": "0.1.9", "description": "2D/3D polygon tessellators", "module": "./index.js", "main": "./lib/index.js", @@ -32,12 +32,12 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/checks": "^2.1.1", - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/geom-isec": "^0.1.5", - "@thi.ng/geom-poly-utils": "^0.1.5", - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/checks": "^2.1.3", + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/geom-isec": "^0.1.9", + "@thi.ng/geom-poly-utils": "^0.1.9", + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom-voronoi/CHANGELOG.md b/packages/geom-voronoi/CHANGELOG.md index 93dc6cc62f..b87268e4b6 100644 --- a/packages/geom-voronoi/CHANGELOG.md +++ b/packages/geom-voronoi/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [0.1.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-voronoi@0.1.8...@thi.ng/geom-voronoi@0.1.9) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom-voronoi + + + + + +## [0.1.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-voronoi@0.1.7...@thi.ng/geom-voronoi@0.1.8) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom-voronoi + + + + + +## [0.1.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-voronoi@0.1.6...@thi.ng/geom-voronoi@0.1.7) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom-voronoi + + + + + +## [0.1.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-voronoi@0.1.5...@thi.ng/geom-voronoi@0.1.6) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom-voronoi + + + + + ## [0.1.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom-voronoi@0.1.4...@thi.ng/geom-voronoi@0.1.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom-voronoi diff --git a/packages/geom-voronoi/package.json b/packages/geom-voronoi/package.json index 6d6467454b..2babfe76d9 100644 --- a/packages/geom-voronoi/package.json +++ b/packages/geom-voronoi/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom-voronoi", - "version": "0.1.5", + "version": "0.1.9", "description": "Fast, incremental 2D Delaunay & Voronoi mesh implementation", "module": "./index.js", "main": "./lib/index.js", @@ -32,14 +32,14 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/geom-clip": "^0.0.7", - "@thi.ng/geom-isec": "^0.1.5", - "@thi.ng/geom-poly-utils": "^0.1.5", - "@thi.ng/math": "^1.1.1", + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/geom-clip": "^0.0.11", + "@thi.ng/geom-isec": "^0.1.9", + "@thi.ng/geom-poly-utils": "^0.1.9", + "@thi.ng/math": "^1.2.0", "@thi.ng/quad-edge": "^0.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/geom/CHANGELOG.md b/packages/geom/CHANGELOG.md index 6469e57100..951cbe6ef8 100644 --- a/packages/geom/CHANGELOG.md +++ b/packages/geom/CHANGELOG.md @@ -3,6 +3,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.2.14](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.2.13...@thi.ng/geom@1.2.14) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/geom + + + + + +## [1.2.13](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.2.12...@thi.ng/geom@1.2.13) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/geom + + + + + +## [1.2.12](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.2.11...@thi.ng/geom@1.2.12) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/geom + + + + + +## [1.2.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.2.10...@thi.ng/geom@1.2.11) (2019-03-04) + +**Note:** Version bump only for package @thi.ng/geom + + + + + +## [1.2.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.2.9...@thi.ng/geom@1.2.10) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/geom + + + + + ## [1.2.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/geom@1.2.8...@thi.ng/geom@1.2.9) (2019-03-01) **Note:** Version bump only for package @thi.ng/geom diff --git a/packages/geom/package.json b/packages/geom/package.json index 54ed50c071..484ddb801b 100644 --- a/packages/geom/package.json +++ b/packages/geom/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/geom", - "version": "1.2.9", + "version": "1.2.14", "description": "2D geometry types, polymorphic operations, SVG generation", "module": "./index.js", "main": "./lib/index.js", @@ -32,31 +32,31 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/arrays": "^0.1.1", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/compose": "^1.1.2", - "@thi.ng/defmulti": "^1.0.3", + "@thi.ng/api": "^5.1.0", + "@thi.ng/arrays": "^0.1.4", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/compose": "^1.2.0", + "@thi.ng/defmulti": "^1.0.4", "@thi.ng/equiv": "^1.0.3", "@thi.ng/errors": "^1.0.3", - "@thi.ng/geom-api": "^0.1.4", - "@thi.ng/geom-arc": "^0.1.5", - "@thi.ng/geom-clip": "^0.0.7", - "@thi.ng/geom-closest-point": "^0.1.5", - "@thi.ng/geom-hull": "^0.0.7", - "@thi.ng/geom-isec": "^0.1.5", - "@thi.ng/geom-poly-utils": "^0.1.5", - "@thi.ng/geom-resample": "^0.1.5", - "@thi.ng/geom-splines": "^0.1.5", - "@thi.ng/geom-subdiv-curve": "^0.1.4", - "@thi.ng/geom-tessellate": "^0.1.5", - "@thi.ng/hiccup": "^3.1.1", - "@thi.ng/hiccup-svg": "^3.1.9", - "@thi.ng/math": "^1.1.1", - "@thi.ng/matrices": "^0.1.8", - "@thi.ng/random": "^1.1.1", - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/vectors": "^2.3.2" + "@thi.ng/geom-api": "^0.1.8", + "@thi.ng/geom-arc": "^0.1.9", + "@thi.ng/geom-clip": "^0.0.11", + "@thi.ng/geom-closest-point": "^0.1.9", + "@thi.ng/geom-hull": "^0.0.11", + "@thi.ng/geom-isec": "^0.1.9", + "@thi.ng/geom-poly-utils": "^0.1.9", + "@thi.ng/geom-resample": "^0.1.9", + "@thi.ng/geom-splines": "^0.1.9", + "@thi.ng/geom-subdiv-curve": "^0.1.8", + "@thi.ng/geom-tessellate": "^0.1.9", + "@thi.ng/hiccup": "^3.1.4", + "@thi.ng/hiccup-svg": "^3.1.14", + "@thi.ng/math": "^1.2.0", + "@thi.ng/matrices": "^0.1.12", + "@thi.ng/random": "^1.1.2", + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/vectors": "^2.4.3" }, "keywords": [ "2D", diff --git a/packages/hdom-canvas/CHANGELOG.md b/packages/hdom-canvas/CHANGELOG.md index 84ec9ed6eb..a7c7d3e059 100644 --- a/packages/hdom-canvas/CHANGELOG.md +++ b/packages/hdom-canvas/CHANGELOG.md @@ -3,6 +3,46 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [2.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.0.6...@thi.ng/hdom-canvas@2.0.7) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/hdom-canvas + + + + + +## [2.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.0.5...@thi.ng/hdom-canvas@2.0.6) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/hdom-canvas + + + + + +## [2.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.0.4...@thi.ng/hdom-canvas@2.0.5) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/hdom-canvas + + + + + +## [2.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.0.3...@thi.ng/hdom-canvas@2.0.4) (2019-03-04) + +**Note:** Version bump only for package @thi.ng/hdom-canvas + + + + + +## [2.0.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.0.2...@thi.ng/hdom-canvas@2.0.3) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/hdom-canvas + + + + + ## [2.0.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-canvas@2.0.1...@thi.ng/hdom-canvas@2.0.2) (2019-03-01) **Note:** Version bump only for package @thi.ng/hdom-canvas diff --git a/packages/hdom-canvas/package.json b/packages/hdom-canvas/package.json index 67a1d5885a..ae8e378db4 100644 --- a/packages/hdom-canvas/package.json +++ b/packages/hdom-canvas/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hdom-canvas", - "version": "2.0.2", + "version": "2.0.7", "description": "Declarative canvas scenegraph & visualization for @thi.ng/hdom", "module": "./index.js", "main": "./lib/index.js", @@ -32,11 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/color": "^0.1.8", - "@thi.ng/diff": "^3.0.3", - "@thi.ng/hdom": "^7.1.2" + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/color": "^0.1.13", + "@thi.ng/diff": "^3.0.4", + "@thi.ng/hdom": "^7.2.0" }, "keywords": [ "ES6", diff --git a/packages/hdom-canvas/src/index.ts b/packages/hdom-canvas/src/index.ts index 0979223248..f0ae748493 100644 --- a/packages/hdom-canvas/src/index.ts +++ b/packages/hdom-canvas/src/index.ts @@ -1,4 +1,4 @@ -import { IObjectOf } from "@thi.ng/api"; +import { IObjectOf, NO_OP } from "@thi.ng/api"; import { isArray, isArrayLike, @@ -8,7 +8,12 @@ import { } from "@thi.ng/checks"; import { asCSS, ColorMode, ReadonlyColor } from "@thi.ng/color"; import { diffArray, DiffMode } from "@thi.ng/diff"; -import { equiv, HDOMImplementation, HDOMOpts, releaseTree } from "@thi.ng/hdom"; +import { + equiv, + HDOMImplementation, + HDOMOpts, + releaseTree +} from "@thi.ng/hdom"; interface DrawState { attribs: IObjectOf; @@ -109,7 +114,7 @@ const CTX_ATTRIBS = { * @param shapes shape components */ export const canvas = { - render: (_, attribs, ...body: any[]) => { + render(_, attribs, ...body: any[]) { const cattribs = { ...attribs }; delete cattribs.__diff; delete cattribs.__normalize; @@ -223,16 +228,14 @@ export const diffTree = ( } }; -const NOOP = () => {}; - export const IMPL: HDOMImplementation = { createTree, normalizeTree, diffTree, - hydrateTree: NOOP, - getElementById: NOOP, - createElement: NOOP, - createTextElement: NOOP + hydrateTree: NO_OP, + getElementById: NO_OP, + createElement: NO_OP, + createTextElement: NO_OP }; const walk = ( @@ -418,12 +421,12 @@ const resolveColor = (state: DrawState, v: any) => ? state.grads[v.substr(1)] : v : isArrayLike(v) - ? isNumber((v).mode) - ? asCSS(v) - : asCSS(v, ColorMode.RGBA) - : isNumber(v) - ? asCSS(v, ColorMode.INT32) - : v; + ? isNumber((v).mode) + ? asCSS(v) + : asCSS(v, ColorMode.RGBA) + : isNumber(v) + ? asCSS(v, ColorMode.INT32) + : v; const applyTransform = ( ctx: CanvasRenderingContext2D, diff --git a/packages/hdom-components/CHANGELOG.md b/packages/hdom-components/CHANGELOG.md index ddc4f7102b..18a6b0a27c 100644 --- a/packages/hdom-components/CHANGELOG.md +++ b/packages/hdom-components/CHANGELOG.md @@ -3,6 +3,38 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [3.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-components@3.0.10...@thi.ng/hdom-components@3.0.11) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/hdom-components + + + + + +## [3.0.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-components@3.0.9...@thi.ng/hdom-components@3.0.10) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/hdom-components + + + + + +## [3.0.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-components@3.0.8...@thi.ng/hdom-components@3.0.9) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/hdom-components + + + + + +## [3.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-components@3.0.7...@thi.ng/hdom-components@3.0.8) (2019-03-03) + +**Note:** Version bump only for package @thi.ng/hdom-components + + + + + ## [3.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-components@3.0.6...@thi.ng/hdom-components@3.0.7) (2019-03-01) **Note:** Version bump only for package @thi.ng/hdom-components diff --git a/packages/hdom-components/package.json b/packages/hdom-components/package.json index c664fc7644..a9e238fdaa 100644 --- a/packages/hdom-components/package.json +++ b/packages/hdom-components/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hdom-components", - "version": "3.0.7", + "version": "3.0.11", "description": "Raw, skinnable UI & SVG components for @thi.ng/hdom", "module": "./index.js", "main": "./lib/index.js", @@ -32,11 +32,11 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/math": "^1.1.1", - "@thi.ng/transducers": "^5.1.1", - "@thi.ng/transducers-stats": "^1.0.7", + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/math": "^1.2.0", + "@thi.ng/transducers": "^5.2.2", + "@thi.ng/transducers-stats": "^1.0.11", "@types/webgl2": "^0.0.4" }, "keywords": [ diff --git a/packages/hdom-components/src/canvas.ts b/packages/hdom-components/src/canvas.ts index 865343041d..394b7a0f1e 100644 --- a/packages/hdom-components/src/canvas.ts +++ b/packages/hdom-components/src/canvas.ts @@ -20,28 +20,23 @@ export interface CanvasHandlers { /** * user init handler (called only once when canvas first) */ - init: (el: HTMLCanvasElement, ctx: T, hctx?: any, ...args: any[]) => void; + init(el: HTMLCanvasElement, ctx: T, hctx?: any, ...args: any[]): void; /** * update handler (called for each hdom update iteration) */ - update: ( + update( el: HTMLCanvasElement, ctx: T, hctx?: any, time?: number, frame?: number, ...args: any[] - ) => void; + ): void; /** * release handler (called only once when canvas element is removed * from DOM) */ - release: ( - el: HTMLCanvasElement, - ctx: T, - hctx?: any, - ...args: any[] - ) => void; + release(el: HTMLCanvasElement, ctx: T, hctx?: any, ...args: any[]): void; } /** @@ -92,7 +87,7 @@ const _canvas = ( * * ``` * const glcanvas = canvasWebGL({ - * render: (canv, gl, hctx, time, frame, ...args) => { + * render(canv, gl, hctx, time, frame, ...args) { * const col = 0.5 + 0.5 * Math.sin(time); * gl.clearColor(col, col, col, 1); * } diff --git a/packages/hdom-components/src/pager.ts b/packages/hdom-components/src/pager.ts index e92e7cd168..0c95a72ced 100644 --- a/packages/hdom-components/src/pager.ts +++ b/packages/hdom-components/src/pager.ts @@ -26,36 +26,36 @@ export interface PagerOpts { * one-based. The currently active page ID is only provided for * special highlighting cases (optional). */ - button: ( + button( page: number, curr: number, max: number, label: any, disabled: boolean - ) => any; + ): any; /** * Pager root component function. Receives all 3 button groups as * arguments. Optional. Default: `["div.pager", ...body]` */ - root: (ctx: any, ...body: any[]) => any; + root(ctx: any, ...body: any[]): any; /** * Component function to provide wrapper for the first / prev nav * button group. The `first` / `prev` args are button components. * Optional. Default: `["div.pager-prev", first, prev]` */ - groupPrev: (ctx: any, first: any, prev: any) => any; + groupPrev(ctx: any, first: any, prev: any): any; /** * Component function to provide wrapper for the page buttons group. * The `buttons` argument is an array of button components. * Optional. Default: `["div.pager-pages", ...buttons]` */ - groupPages: (ctx: any, buttons: any[]) => any; + groupPages(ctx: any, buttons: any[]): any; /** * Component function to provide wrapper for the next / last nav * button group. The `next` / `last` args are button components. * Optional. Default: `["div.pager-next", next, last]` */ - groupNext: (ctx: any, next: any, last: any) => any; + groupNext(ctx: any, next: any, last: any): any; /** * Page increment for prev / next page buttons. Default: 1 */ diff --git a/packages/hdom-mock/CHANGELOG.md b/packages/hdom-mock/CHANGELOG.md index 4a1abfc226..10914e3742 100644 --- a/packages/hdom-mock/CHANGELOG.md +++ b/packages/hdom-mock/CHANGELOG.md @@ -3,6 +3,30 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +## [1.0.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-mock@1.0.7...@thi.ng/hdom-mock@1.0.8) (2019-03-18) + +**Note:** Version bump only for package @thi.ng/hdom-mock + + + + + +## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-mock@1.0.6...@thi.ng/hdom-mock@1.0.7) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/hdom-mock + + + + + +## [1.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-mock@1.0.5...@thi.ng/hdom-mock@1.0.6) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/hdom-mock + + + + + ## [1.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-mock@1.0.4...@thi.ng/hdom-mock@1.0.5) (2019-03-01) **Note:** Version bump only for package @thi.ng/hdom-mock diff --git a/packages/hdom-mock/package.json b/packages/hdom-mock/package.json index 472832a2eb..133e551b5d 100644 --- a/packages/hdom-mock/package.json +++ b/packages/hdom-mock/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hdom-mock", - "version": "1.0.5", + "version": "1.0.8", "description": "Mock base implementation for @thi.ng/hdom API", "module": "./index.js", "main": "./lib/index.js", @@ -32,9 +32,9 @@ "typescript": "^3.2.2" }, "dependencies": { - "@thi.ng/api": "^5.0.3", - "@thi.ng/checks": "^2.1.1", - "@thi.ng/hdom": "^7.1.2" + "@thi.ng/api": "^5.1.0", + "@thi.ng/checks": "^2.1.3", + "@thi.ng/hdom": "^7.2.0" }, "keywords": [ "ES6", diff --git a/packages/hdom/CHANGELOG.md b/packages/hdom/CHANGELOG.md index 9d98f40618..b0424eaf6e 100644 --- a/packages/hdom/CHANGELOG.md +++ b/packages/hdom/CHANGELOG.md @@ -3,6 +3,33 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. +# [7.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@7.1.4...@thi.ng/hdom@7.2.0) (2019-03-18) + + +### Features + +* **hdom:** support more input el types in updateValueAttrib() ([8813344](https://github.com/thi-ng/umbrella/commit/8813344)) + + + + + +## [7.1.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@7.1.3...@thi.ng/hdom@7.1.4) (2019-03-12) + +**Note:** Version bump only for package @thi.ng/hdom + + + + + +## [7.1.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@7.1.2...@thi.ng/hdom@7.1.3) (2019-03-10) + +**Note:** Version bump only for package @thi.ng/hdom + + + + + ## [7.1.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@7.1.1...@thi.ng/hdom@7.1.2) (2019-03-01) **Note:** Version bump only for package @thi.ng/hdom diff --git a/packages/hdom/README.md b/packages/hdom/README.md index 3b9b9de335..e582589682 100644 --- a/packages/hdom/README.md +++ b/packages/hdom/README.md @@ -49,6 +49,7 @@ This project is part of the - [createTree()](#createtree) - [hydrateTree()](#hydratetree) - [User context](#user-context) + - [`value` attribute handling](#value-attribute-handling) - [Behavior control attributes](#behavior-control-attributes) - [Benchmarks](#benchmarks) - [Authors](#authors) @@ -1162,42 +1163,54 @@ const app = [ start(app, { ctx }); ``` +### `value` attribute handling + +hdom automatically saves & restores the cursor position when updating +the `value` attribute of an `` element w/ text content or +`