diff --git a/README.md b/README.md index 0ca29b0475..5d57d62be0 100644 --- a/README.md +++ b/README.md @@ -34,13 +34,18 @@ difficulties, many combining functionality from several packages) in the | [`@thi.ng/api`](./packages/api) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/api.svg)](https://www.npmjs.com/package/@thi.ng/api) | [changelog](./packages/api/CHANGELOG.md) | | [`@thi.ng/associative`](./packages/associative) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/associative.svg)](https://www.npmjs.com/package/@thi.ng/associative) | [changelog](./packages/associative/CHANGELOG.md) | | [`@thi.ng/atom`](./packages/atom) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/atom.svg)](https://www.npmjs.com/package/@thi.ng/atom) | [changelog](./packages/atom/CHANGELOG.md) | +| [`@thi.ng/bench`](./packages/bench) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/bench.svg)](https://www.npmjs.com/package/@thi.ng/bench) | [changelog](./packages/bench/CHANGELOG.md) | | [`@thi.ng/bitstream`](./packages/bitstream) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/bitstream.svg)](https://www.npmjs.com/package/@thi.ng/bitstream) | [changelog](./packages/bitstream/CHANGELOG.md) | | [`@thi.ng/cache`](./packages/cache) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/cache.svg)](https://www.npmjs.com/package/@thi.ng/cache) | [changelog](./packages/cache/CHANGELOG.md) | | [`@thi.ng/checks`](./packages/checks) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/checks.svg)](https://www.npmjs.com/package/@thi.ng/checks) | [changelog](./packages/checks/CHANGELOG.md) | +| [`@thi.ng/compare`](./packages/compare) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/compare.svg)](https://www.npmjs.com/package/@thi.ng/compare) | [changelog](./packages/compare/CHANGELOG.md) | | [`@thi.ng/csp`](./packages/csp) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/csp.svg)](https://www.npmjs.com/package/@thi.ng/csp) | [changelog](./packages/csp/CHANGELOG.md) | | [`@thi.ng/dcons`](./packages/dcons) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/dcons.svg)](https://www.npmjs.com/package/@thi.ng/dcons) | [changelog](./packages/dcons/CHANGELOG.md) | | [`@thi.ng/dgraph`](./packages/dgraph) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/dgraph.svg)](https://www.npmjs.com/package/@thi.ng/dgraph) | [changelog](./packages/dgraph/CHANGELOG.md) | | [`@thi.ng/diff`](./packages/diff) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/diff.svg)](https://www.npmjs.com/package/@thi.ng/diff) | [changelog](./packages/diff/CHANGELOG.md) | +| [`@thi.ng/dot`](./packages/dot) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/dot.svg)](https://www.npmjs.com/package/@thi.ng/dot) | [changelog](./packages/dot/CHANGELOG.md) | +| [`@thi.ng/equiv`](./packages/equiv) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/equiv.svg)](https://www.npmjs.com/package/@thi.ng/equiv) | [changelog](./packages/equiv/CHANGELOG.md) | +| [`@thi.ng/errors`](./packages/errors) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/errors.svg)](https://www.npmjs.com/package/@thi.ng/errors) | [changelog](./packages/errors/CHANGELOG.md) | | [`@thi.ng/hdom`](./packages/hdom) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/hdom.svg)](https://www.npmjs.com/package/@thi.ng/hdom) | [changelog](./packages/hdom/CHANGELOG.md) | | [`@thi.ng/hdom-components`](./packages/hdom-components) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/hdom-components.svg)](https://www.npmjs.com/package/@thi.ng/hdom-components) | [changelog](./packages/hdom-components/CHANGELOG.md) | | [`@thi.ng/heaps`](./packages/heaps) | [![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/heaps.svg)](https://www.npmjs.com/package/@thi.ng/heaps) | [changelog](./packages/heaps/CHANGELOG.md) | diff --git a/assets/deps.png b/assets/deps.png index 475f844856..59c423c631 100644 Binary files a/assets/deps.png and b/assets/deps.png differ diff --git a/examples/README.md b/examples/README.md index d9b6b289bb..479a292469 100644 --- a/examples/README.md +++ b/examples/README.md @@ -12,14 +12,15 @@ If you want to [contribute](../CONTRIBUTING.md) an example, please get in touch | 4 | [devcards](./devcards) | multiple app instances with/without shared state | atom, hdom | intermediate | | 5 | [hdom-basics](./hdom-basics) | hello world | hdom, hiccup | basic | | 6 | [hdom-benchmark](./hdom-benchmark) | hdom rendering perf / stress test, canvas FPS counter | hdom, rstream, transducers | intermediate | -| 7 | [interceptor-basics](./hdom-benchmark) | event handling w/ interceptors and side effects | atom, hdom, interceptors | intermediate | -| 8 | [json-components](./json-components) | JSON->component transformation, live editor | hdom, transducers | intermediate | -| 9 | [login-form](./login-form) | basic SPA without router | atom, hdom | intermediate | -| 10 | [pointfree-svg](./pointfree-svg) | generate SVG using pointfree DSL | hiccup, hiccup-svg, pointfree-lang | intermediate | -| 11 | [router-basics](./router-basics) | complete mini SPA | atom, hdom, interceptors, router | advanced | -| 12 | [rstream-dataflow](./rstream-dataflow) | dataflow graph | atom, hdom, rstream, rstream-gestures, rstream-graph, transducers | intermediate | -| 13 | [rstream-grid](./rstream-grid) | dataflow graph svg gen | atom, hdom, hiccup-svg, interceptors, rstream-graph, transducers | advanced | -| 14 | [svg-particles](./svg-particles) | hdom SVG generation / animation | hdom, transducers | basic | -| 15 | [svg-waveform](./svg-waveform) | hdom SVG generation / undo history | atom, hdom, hiccup-svg, interceptors, iterators | intermediate | -| 16 | [todo-list](./todo-list) | Canonical Todo list with undo/redo | atom, hdom, transducers | intermediate | -| 17 | [webgl](./webgl) | Canvas component handling | hdom, hdom-components | basic | +| 7 | [hdom-theme-adr-0003](./hdom-theme-adr-0003) | hdom themed components proposal | hdom | intermediate | +| 8 | [interceptor-basics](./hdom-benchmark) | event handling w/ interceptors and side effects | atom, hdom, interceptors | intermediate | +| 9 | [json-components](./json-components) | JSON->component transformation, live editor | hdom, transducers | intermediate | +| 10 | [login-form](./login-form) | basic SPA without router | atom, hdom | intermediate | +| 11 | [pointfree-svg](./pointfree-svg) | generate SVG using pointfree DSL | hiccup, hiccup-svg, pointfree-lang | intermediate | +| 12 | [router-basics](./router-basics) | complete mini SPA | atom, hdom, interceptors, router | advanced | +| 13 | [rstream-dataflow](./rstream-dataflow) | dataflow graph | atom, hdom, rstream, rstream-gestures, rstream-graph, transducers | intermediate | +| 14 | [rstream-grid](./rstream-grid) | dataflow graph svg gen | atom, hdom, hiccup-svg, interceptors, rstream-graph, transducers | advanced | +| 15 | [svg-particles](./svg-particles) | hdom SVG generation / animation | hdom, transducers | basic | +| 16 | [svg-waveform](./svg-waveform) | hdom SVG generation / undo history | atom, hdom, hiccup-svg, interceptors, iterators | intermediate | +| 17 | [todo-list](./todo-list) | Canonical Todo list with undo/redo | atom, hdom, transducers | intermediate | +| 18 | [webgl](./webgl) | Canvas component handling | hdom, hdom-components | basic | diff --git a/examples/async-effect/src/index.ts b/examples/async-effect/src/index.ts index a439077830..f7f1af5a9f 100644 --- a/examples/async-effect/src/index.ts +++ b/examples/async-effect/src/index.ts @@ -1,6 +1,11 @@ import { IObjectOf } from "@thi.ng/api/api"; import { start } from "@thi.ng/hdom/start"; -import { EventDef, EffectDef, FX_DISPATCH_ASYNC, FX_DISPATCH_NOW } from "@thi.ng/interceptors/api"; +import { + EffectDef, + EventDef, + FX_DISPATCH_ASYNC, + FX_DISPATCH_NOW +} from "@thi.ng/interceptors/api"; import { EventBus } from "@thi.ng/interceptors/event-bus"; import { valueSetter } from "@thi.ng/interceptors/interceptors"; diff --git a/examples/cellular-automata/src/index.ts b/examples/cellular-automata/src/index.ts index a174f33c82..475a9384b8 100644 --- a/examples/cellular-automata/src/index.ts +++ b/examples/cellular-automata/src/index.ts @@ -1,16 +1,15 @@ import { start } from "@thi.ng/hdom"; import { dropdown, DropDownOption } from "@thi.ng/hdom-components/dropdown"; - -import { transduce } from "@thi.ng/transducers/transduce"; -import { step } from "@thi.ng/transducers/step"; import { comp } from "@thi.ng/transducers/func/comp"; import { lookup2d } from "@thi.ng/transducers/func/lookup"; import { range2d } from "@thi.ng/transducers/iter/range2d"; import { repeatedly } from "@thi.ng/transducers/iter/repeatedly"; import { push } from "@thi.ng/transducers/rfn/push"; import { str } from "@thi.ng/transducers/rfn/str"; +import { step } from "@thi.ng/transducers/step"; +import { transduce } from "@thi.ng/transducers/transduce"; import { bits } from "@thi.ng/transducers/xform/bits"; -import { convolve2d, buildKernel2d } from "@thi.ng/transducers/xform/convolve"; +import { buildKernel2d, convolve2d } from "@thi.ng/transducers/xform/convolve"; import { map } from "@thi.ng/transducers/xform/map"; import { multiplex } from "@thi.ng/transducers/xform/multiplex"; import { partition } from "@thi.ng/transducers/xform/partition"; diff --git a/examples/hdom-theme-adr-0003/.gitignore b/examples/hdom-theme-adr-0003/.gitignore new file mode 100644 index 0000000000..9c418ce79f --- /dev/null +++ b/examples/hdom-theme-adr-0003/.gitignore @@ -0,0 +1,3 @@ +node_modules +yarn.lock +*.js diff --git a/examples/hdom-theme-adr-0003/README.md b/examples/hdom-theme-adr-0003/README.md new file mode 100644 index 0000000000..bd79eb22d5 --- /dev/null +++ b/examples/hdom-theme-adr-0003/README.md @@ -0,0 +1,21 @@ +# hdom-theme-adr-0003 + +[Live demo](http://demo.thi.ng/umbrella/hdom-theme-adr-0003/) + +WIP demo of themed component proposal discussed in +[ADR-0003](https://github.com/thi-ng/umbrella/blob/develop/packages/hdom-components/adr/0003-component-configuration-via-context.md). + +``` +git clone https://github.com/thi-ng/umbrella.git +cd umbrella/examples/hdom-theme-adr-0003 +yarn install +yarn start +``` + +## Authors + +- Karsten Schmidt + +## License + +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/examples/hdom-theme-adr-0003/index.html b/examples/hdom-theme-adr-0003/index.html new file mode 100644 index 0000000000..64a2beda5b --- /dev/null +++ b/examples/hdom-theme-adr-0003/index.html @@ -0,0 +1,23 @@ + + + + + + + + hdom-theme-adr-0003 + + + + + +
+ + + + \ No newline at end of file diff --git a/examples/hdom-theme-adr-0003/package.json b/examples/hdom-theme-adr-0003/package.json new file mode 100644 index 0000000000..cc21c4b9da --- /dev/null +++ b/examples/hdom-theme-adr-0003/package.json @@ -0,0 +1,22 @@ +{ + "name": "hdom-theme", + "version": "0.0.1", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "build": "webpack --mode production --display-reasons --display-modules", + "start": "webpack-dev-server --open --mode development --devtool inline-source-map" + }, + "devDependencies": { + "ts-loader": "^4.3.0", + "typescript": "^2.8.3", + "webpack": "^4.8.1", + "webpack-cli": "^2.1.3", + "webpack-dev-server": "^3.1.4" + }, + "dependencies": { + "@thi.ng/api": "latest", + "@thi.ng/hdom": "latest" + } +} \ No newline at end of file diff --git a/examples/hdom-theme-adr-0003/src/index.ts b/examples/hdom-theme-adr-0003/src/index.ts new file mode 100644 index 0000000000..feaef66d73 --- /dev/null +++ b/examples/hdom-theme-adr-0003/src/index.ts @@ -0,0 +1,147 @@ +import { IObjectOf } from "@thi.ng/api/api"; +import { start } from "@thi.ng/hdom/start"; +import { getIn, Path } from "@thi.ng/paths"; + +interface ButtonBehavior { + /** + * Element name to use for enabled buttons. + * Default: "a" + */ + tag: string; + /** + * Element name to use for disabled buttons. + * Default: "span" + */ + tagDisabled: string; + /** + * Default attribs, always injected for active button states + * and overridable at runtime. + * Default: `{ href: "#", role: "button" }` + */ + attribs: IObjectOf; +} + +interface ButtonArgs { + /** + * Click event handler to be wrapped with preventDefault() call + */ + onclick: EventListener; + /** + * Disabled flag. Used to determine themed version. + */ + disabled: boolean; + /** + * Selected flag. Used to determine themed version. + */ + selected: boolean; + /** + * Link target. + */ + href: string; +} + +const button = (themeCtxPath: Path, behavior?: Partial) => { + // init with defaults + behavior = { + tag: "a", + tagDisabled: "span", + ...behavior + }; + behavior.attribs = { href: "#", role: "button", ...behavior.attribs }; + // return component function as closure + return (ctx: any, args: Partial, ...body: any[]) => { + // lookup component theme config in context + const theme = getIn(ctx, themeCtxPath); + if (args.disabled) { + return [behavior.tagDisabled, { + ...behavior.attribs, + ...theme.disabled, + ...args, + }, ...body]; + } else { + const attribs = { + ...behavior.attribs, + ...theme[args.selected ? "selected" : "default"], + ...args + }; + if (args && args.onclick && (args.href == null || args.href === "#")) { + attribs.onclick = (e) => (e.preventDefault(), args.onclick(e)); + } + return [behavior.tag, attribs, ...body]; + } + }; +}; + +const link = (ctx: any, href: string, body: any) => + ["a", { ...ctx.theme.link, href }, body]; + +const lightTheme = { + id: "light", + body: { + class: "vh-100 bg-white dark-gray pa3 sans-serif" + }, + link: { + class: "link dim b black" + }, + button: { + default: { + class: "dib link mr2 ph3 pv2 bg-lightest-blue blue hover-bg-blue hover-white bg-animate br-pill" + }, + selected: { + class: "dib link mr2 ph3 pv2 bg-gold washed-yellow hover-bg-orange hover-gold bg-animate br-pill" + }, + disabled: { + class: "dib mr2 ph3 pv2 bg-moon-gray gray br-pill" + } + } +}; + +const darkTheme = { + id: "dark", + body: { + class: "vh-100 bg-black moon-gray pa3 sans-serif" + }, + link: { + class: "link dim b light-silver" + }, + button: { + default: { + class: "dib link mr2 ph3 pv2 blue hover-lightest-blue hover-b--current br3 ba b--blue" + }, + selected: { + class: "dib link mr2 ph3 pv2 red hover-gold hover-b--current br3 ba b--red" + }, + disabled: { + class: "dib mr2 ph3 pv2 mid-gray br3 ba b--mid-gray" + } + } +}; + +// source: https://fontawesome.com +const icon = + ["svg", { class: "mr1", width: "1rem", viewBox: "0 0 576 512", fill: "currentcolor" }, + ["path", { d: "M576 24v127.984c0 21.461-25.96 31.98-40.971 16.971l-35.707-35.709-243.523 243.523c-9.373 9.373-24.568 9.373-33.941 0l-22.627-22.627c-9.373-9.373-9.373-24.569 0-33.941L442.756 76.676l-35.703-35.705C391.982 25.9 402.656 0 424.024 0H552c13.255 0 24 10.745 24 24zM407.029 270.794l-16 16A23.999 23.999 0 0 0 384 303.765V448H64V128h264a24.003 24.003 0 0 0 16.97-7.029l16-16C376.089 89.851 365.381 64 344 64H48C21.49 64 0 85.49 0 112v352c0 26.51 21.49 48 48 48h352c26.51 0 48-21.49 48-48V287.764c0-21.382-25.852-32.09-40.971-16.97z" }]]; + +const ctx = { theme: darkTheme }; + +const toggleTheme = () => { + ctx.theme = ctx.theme === lightTheme ? darkTheme : lightTheme; +} + +const bt = button("theme.button"); +const btFixed = button("theme.button", { attribs: { style: { width: "8rem" } } }); + +const app = (ctx) => + ["div", ctx.theme.body, + "Current theme: ", ctx.theme.id, + ["p", + [bt, { onclick: toggleTheme }, "Toggle"], + [bt, { href: "https://github.com/thi-ng/umbrella" }, icon, "External"], + [btFixed, { onclick: () => alert("hi"), selected: true }, "Selected"], + [btFixed, { disabled: true }, "Disabled"]], + ["p", + "Please see ", [link, "https://github.com/thi-ng/umbrella/blob/develop/packages/hdom-components/adr/0003-component-configuration-via-context.md", "ADR-0003"], " for details of this approach."], + ["p", [link, "https://github.com/thi-ng/umbrella/blob/develop/examples/hdom-theme-adr-0003", "Source"]] + ]; + +start("app", app, ctx); diff --git a/examples/hdom-theme-adr-0003/tsconfig.json b/examples/hdom-theme-adr-0003/tsconfig.json new file mode 100644 index 0000000000..bd6481a5a6 --- /dev/null +++ b/examples/hdom-theme-adr-0003/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "." + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/examples/hdom-theme-adr-0003/webpack.config.js b/examples/hdom-theme-adr-0003/webpack.config.js new file mode 100644 index 0000000000..e2bf1e8d3a --- /dev/null +++ b/examples/hdom-theme-adr-0003/webpack.config.js @@ -0,0 +1,18 @@ +module.exports = { + entry: "./src/index.ts", + output: { + path: __dirname, + filename: "bundle.js" + }, + resolve: { + extensions: [".ts", ".js"] + }, + module: { + rules: [ + { test: /\.ts$/, use: "ts-loader" } + ] + }, + devServer: { + contentBase: "." + } +}; diff --git a/examples/interceptor-basics/src/index.ts b/examples/interceptor-basics/src/index.ts index a3053ac2eb..75a6ca2558 100644 --- a/examples/interceptor-basics/src/index.ts +++ b/examples/interceptor-basics/src/index.ts @@ -1,9 +1,9 @@ import { IObjectOf } from "@thi.ng/api/api"; +import { start } from "@thi.ng/hdom/start"; import { EffectDef, EventDef, IDispatch } from "@thi.ng/interceptors/api"; import { EV_SET_VALUE, EV_UPDATE_VALUE, FX_DISPATCH_NOW } from "@thi.ng/interceptors/api"; import { EventBus } from "@thi.ng/interceptors/event-bus"; -import { ensureStateLessThan, ensureStateGreaterThan, trace } from "@thi.ng/interceptors/interceptors"; -import { start } from "@thi.ng/hdom/start"; +import { ensureStateGreaterThan, ensureStateLessThan, trace } from "@thi.ng/interceptors/interceptors"; import { Path } from "@thi.ng/paths"; /////////////////////////////////////////////////////////////////////// diff --git a/examples/pointfree-svg/src/index.ts b/examples/pointfree-svg/src/index.ts index 7b7ea2c036..96c4106f18 100644 --- a/examples/pointfree-svg/src/index.ts +++ b/examples/pointfree-svg/src/index.ts @@ -1,10 +1,10 @@ -import * as fs from "fs"; - -import * as svg from "@thi.ng/hiccup-svg"; import { serialize } from "@thi.ng/hiccup"; +import * as svg from "@thi.ng/hiccup-svg"; import { ensureStack, maptos } from "@thi.ng/pointfree"; import { ffi, run } from "@thi.ng/pointfree-lang"; +import * as fs from "fs"; + // rudimentary generic graphics lib & helper words const libsrc = ` ( helper words for forming 2D vectors ) diff --git a/examples/router-basics/src/api.ts b/examples/router-basics/src/api.ts index addd7f2aac..296ce1831c 100644 --- a/examples/router-basics/src/api.ts +++ b/examples/router-basics/src/api.ts @@ -1,9 +1,8 @@ import { IObjectOf } from "@thi.ng/api/api"; -import { ViewTransform, IView } from "@thi.ng/atom/api"; -import { EventDef, EffectDef } from "@thi.ng/interceptors/api"; -import { HTMLRouterConfig, RouteMatch } from "@thi.ng/router/api"; - +import { IView, ViewTransform } from "@thi.ng/atom/api"; +import { EffectDef, EventDef } from "@thi.ng/interceptors/api"; import { EventBus } from "@thi.ng/interceptors/event-bus"; +import { HTMLRouterConfig, RouteMatch } from "@thi.ng/router/api"; // general types defined for the base app diff --git a/examples/router-basics/src/app.ts b/examples/router-basics/src/app.ts index ebb68e62cf..4969d52691 100644 --- a/examples/router-basics/src/app.ts +++ b/examples/router-basics/src/app.ts @@ -1,18 +1,22 @@ import { IObjectOf } from "@thi.ng/api/api"; import { Atom } from "@thi.ng/atom/atom"; import { isArray } from "@thi.ng/checks/is-array"; -import { EventBus } from "@thi.ng/interceptors/event-bus"; -import { valueSetter, trace } from "@thi.ng/interceptors/interceptors"; import { start } from "@thi.ng/hdom"; +import { EventBus } from "@thi.ng/interceptors/event-bus"; +import { trace, valueSetter } from "@thi.ng/interceptors/interceptors"; import { EVENT_ROUTE_CHANGED } from "@thi.ng/router/api"; import { HTMLRouter } from "@thi.ng/router/history"; -import { AppConfig, ViewSpec, AppViews, AppContext } from "./api"; -import * as ev from "./events"; -import * as fx from "./effects"; - -import { nav } from "./components/nav"; +import { + AppConfig, + AppContext, + AppViews, + ViewSpec +} from "./api"; import { debugContainer } from "./components/debug-container"; +import { nav } from "./components/nav"; +import * as fx from "./effects"; +import * as ev from "./events"; /** * Generic base app skeleton. You can use this as basis for your own @@ -44,13 +48,21 @@ export class App { }; this.addViews(this.config.views); this.router = new HTMLRouter(config.router); + // connect router to event bus so that routing events are processed + // as part of the normal batched event processing loop this.router.addListener( EVENT_ROUTE_CHANGED, (e) => this.ctx.bus.dispatch([EVENT_ROUTE_CHANGED, e.value]) ); + // whenever the route has changed, record its details in the app + // state. likewise, when the user or a component triggers a the + // `ROUTE_TO` event we assign the target route details to a side + // effect which will cause a change in the router, which then in + // turn triggers the `EVENT_ROUTE_CHANGED`, completing the + // circle this.ctx.bus.addHandlers({ [EVENT_ROUTE_CHANGED]: valueSetter("route"), - [ev.ROUTE_TO]: (_, [__, route]) => ({ [ev.ROUTE_TO]: route }) + [ev.ROUTE_TO]: (_, [__, route]) => ({ [fx.ROUTE_TO]: route }) }); this.ctx.bus.addEffect( fx.ROUTE_TO, diff --git a/examples/router-basics/src/config.ts b/examples/router-basics/src/config.ts index f2c4c3d0e1..0b15eb161d 100644 --- a/examples/router-basics/src/config.ts +++ b/examples/router-basics/src/config.ts @@ -1,15 +1,20 @@ -import { Event, FX_DISPATCH_ASYNC, FX_DISPATCH_NOW, EV_SET_VALUE, FX_DELAY } from "@thi.ng/interceptors/api"; +import { + EV_SET_VALUE, + Event, + FX_DELAY, + FX_DISPATCH_ASYNC, + FX_DISPATCH_NOW +} from "@thi.ng/interceptors/api"; import { valueUpdater } from "@thi.ng/interceptors/interceptors"; import { AppConfig, StatusType } from "./api"; -import * as ev from "./events"; -import * as fx from "./effects"; -import * as routes from "./routes"; - -import { home } from "./components/home"; import { allUsers } from "./components/all-users"; -import { userProfile } from "./components/user-profile"; import { contact } from "./components/contact"; +import { home } from "./components/home"; +import { userProfile } from "./components/user-profile"; +import * as fx from "./effects"; +import * as ev from "./events"; +import * as routes from "./routes"; // main App configuration export const CONFIG: AppConfig = { diff --git a/examples/rstream-dataflow/src/index.ts b/examples/rstream-dataflow/src/index.ts index 3a4b4cb097..42f7a0b216 100644 --- a/examples/rstream-dataflow/src/index.ts +++ b/examples/rstream-dataflow/src/index.ts @@ -1,13 +1,13 @@ -import { equiv } from "@thi.ng/api/equiv"; import { Atom } from "@thi.ng/atom/atom"; +import { equiv } from "@thi.ng/equiv"; import { start } from "@thi.ng/hdom"; import { getIn } from "@thi.ng/paths"; -import { fromRAF } from "@thi.ng/rstream/from/raf"; -import { walk, toDot } from "@thi.ng/rstream-dot"; +import { toDot, walk } from "@thi.ng/rstream-dot"; import { gestureStream } from "@thi.ng/rstream-gestures"; import { initGraph, node, node1 } from "@thi.ng/rstream-graph/graph"; import { extract } from "@thi.ng/rstream-graph/nodes/extract"; import { mul } from "@thi.ng/rstream-graph/nodes/math"; +import { fromRAF } from "@thi.ng/rstream/from/raf"; import { comp } from "@thi.ng/transducers/func/comp"; import { choices } from "@thi.ng/transducers/iter/choices"; import { dedupe } from "@thi.ng/transducers/xform/dedupe"; diff --git a/examples/rstream-grid/src/components/main.ts b/examples/rstream-grid/src/components/main.ts index 8474453a0e..d93aa09710 100644 --- a/examples/rstream-grid/src/components/main.ts +++ b/examples/rstream-grid/src/components/main.ts @@ -1,7 +1,6 @@ import { AppContext } from "../api"; -import { sidebar } from "./sidebar"; - import { SLIDERS } from "../sliders"; +import { sidebar } from "./sidebar"; export const main = (ctx: AppContext) => { const bar = sidebar(ctx, ...SLIDERS); diff --git a/examples/rstream-grid/src/components/sidebar.ts b/examples/rstream-grid/src/components/sidebar.ts index 9256747aed..59433fc8a4 100644 --- a/examples/rstream-grid/src/components/sidebar.ts +++ b/examples/rstream-grid/src/components/sidebar.ts @@ -1,6 +1,5 @@ import { AppContext } from "../api"; import * as ev from "../events"; - import { buttonGroup } from "./button-group"; import { link } from "./link"; import { slider, SliderOpts } from "./slider"; diff --git a/examples/rstream-grid/src/events.ts b/examples/rstream-grid/src/events.ts index 3868641694..6ba34a9487 100644 --- a/examples/rstream-grid/src/events.ts +++ b/examples/rstream-grid/src/events.ts @@ -1,4 +1,4 @@ -import { EV_UNDO, EV_REDO } from "@thi.ng/interceptors/api"; +import { EV_REDO, EV_UNDO } from "@thi.ng/interceptors/api"; // best practice tip: define event & effect names as consts or enums // and avoid hardcoded strings for more safety and easier refactoring diff --git a/examples/svg-waveform/src/components/waveform.ts b/examples/svg-waveform/src/components/waveform.ts index 2cbc3ddd26..d15de35780 100644 --- a/examples/svg-waveform/src/components/waveform.ts +++ b/examples/svg-waveform/src/components/waveform.ts @@ -5,6 +5,7 @@ import { polyline } from "@thi.ng/hiccup-svg/polyline"; import { map } from "@thi.ng/iterators/map"; import { range } from "@thi.ng/iterators/range"; import { reduce } from "@thi.ng/iterators/reduce"; + import { AppContext } from "../api"; const TAU = Math.PI * 2; diff --git a/examples/todo-list/src/index.ts b/examples/todo-list/src/index.ts index 7b5767714e..64a71c1f3e 100644 --- a/examples/todo-list/src/index.ts +++ b/examples/todo-list/src/index.ts @@ -2,8 +2,8 @@ import { IObjectOf } from "@thi.ng/api/api"; import { Atom, Cursor, History } from "@thi.ng/atom"; import { start } from "@thi.ng/hdom/start"; import { setIn, updateIn } from "@thi.ng/paths"; -import { iterator } from "@thi.ng/transducers/iterator"; import { pairs } from "@thi.ng/transducers/iter/pairs"; +import { iterator } from "@thi.ng/transducers/iterator"; import { map } from "@thi.ng/transducers/xform/map"; interface Task { diff --git a/packages/api/CHANGELOG.md b/packages/api/CHANGELOG.md index 59c27e72e1..101f3bd915 100644 --- a/packages/api/CHANGELOG.md +++ b/packages/api/CHANGELOG.md @@ -3,6 +3,29 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + +# [3.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.2...@thi.ng/api@3.0.0) (2018-05-10) + + +### Code Refactoring + +* **api:** remove obsolete files from package ([f051ca3](https://github.com/thi-ng/umbrella/commit/f051ca3)) + + +### BREAKING CHANGES + +* **api:** @thi.ng/api now only contains type declarations, +decorators and mixins. All other features have been moved +to new dedicated packages: + +- @thi.ng/bench +- @thi.ng/compare +- @thi.ng/equiv +- @thi.ng/errors + + + + ## [2.3.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/api@2.3.1...@thi.ng/api@2.3.2) (2018-05-09) diff --git a/packages/api/README.md b/packages/api/README.md index 36bf085941..8d1704c2e2 100644 --- a/packages/api/README.md +++ b/packages/api/README.md @@ -13,8 +13,6 @@ repository. It defines: - 30+ generic, common interfaces & types - class & method decorators - mixins -- error types -- comparison & equivalence checks ## Installation diff --git a/packages/api/package.json b/packages/api/package.json index 47e0012746..9d0ea80d0d 100644 --- a/packages/api/package.json +++ b/packages/api/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/api", - "version": "2.3.2", + "version": "3.0.0", "description": "Common, generic types & interfaces for thi.ng projects", "main": "./index.js", "typings": "./index.d.ts", @@ -24,7 +24,7 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/checks": "^1.5.2" + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "compare", diff --git a/packages/api/src/decorators/deprecated.ts b/packages/api/src/decorators/deprecated.ts index dcdcccb4b2..463ed21a8a 100644 --- a/packages/api/src/decorators/deprecated.ts +++ b/packages/api/src/decorators/deprecated.ts @@ -1,4 +1,4 @@ -import { illegalArgs } from "../error"; +import { illegalArgs } from "@thi.ng/errors"; /** * Method property decorator factory. Augments original method with diff --git a/packages/api/src/error.ts b/packages/api/src/error.ts deleted file mode 100644 index a28ae7e219..0000000000 --- a/packages/api/src/error.ts +++ /dev/null @@ -1,39 +0,0 @@ -export class IllegalArityError extends Error { - constructor(n: number) { - super(`illegal arity: ${n}`); - } -} - -export class IllegalArgumentError extends Error { - constructor(msg?: any) { - super("illegal argument(s)" + (msg !== undefined ? ": " + msg : "")); - } -} - -export class IllegalStateError extends Error { - constructor(msg?: any) { - super("illegal state" + (msg !== undefined ? ": " + msg : "")); - } -} - -export class UnsupportedOperationError extends Error { - constructor(msg?: any) { - super("unsupported operation" + (msg !== undefined ? ": " + msg : "")); - } -} - -export function illegalArity(n) { - throw new IllegalArityError(n); -} - -export function illegalArgs(msg?: any) { - throw new IllegalArgumentError(msg); -} - -export function illegalState(msg?: any) { - throw new IllegalStateError(msg); -} - -export function unsupported(msg?: any) { - throw new UnsupportedOperationError(msg); -} diff --git a/packages/api/src/index.ts b/packages/api/src/index.ts index c76d4f3aff..4da35daf6f 100644 --- a/packages/api/src/index.ts +++ b/packages/api/src/index.ts @@ -1,13 +1,8 @@ import * as decorators from "./decorators"; import * as mixins from "./mixins"; - -export * from "./api"; -export * from "./bench"; -export * from "./compare"; -export * from "./error"; -export * from "./equiv"; - export { decorators, mixins, } + +export * from "./api"; diff --git a/packages/associative/CHANGELOG.md b/packages/associative/CHANGELOG.md index 1dc46306a5..b885c260d4 100644 --- a/packages/associative/CHANGELOG.md +++ b/packages/associative/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.5.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@0.5.0...@thi.ng/associative@0.5.1) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/associative + # [0.5.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/associative@0.4.6...@thi.ng/associative@0.5.0) (2018-05-09) diff --git a/packages/associative/package.json b/packages/associative/package.json index ee0e738f0f..2dfb72f190 100644 --- a/packages/associative/package.json +++ b/packages/associative/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/associative", - "version": "0.5.0", + "version": "0.5.1", "description": "Alternative Set & Map data type implementations with customizable equality semantics & supporting operations", "main": "./index.js", "typings": "./index.d.ts", @@ -24,9 +24,13 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/dcons": "^0.3.4", - "@thi.ng/iterators": "^4.1.10" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/compare": "^0.1.0", + "@thi.ng/dcons": "^0.3.5", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/iterators": "^4.1.11" }, "keywords": [ "data structures", diff --git a/packages/associative/src/api.ts b/packages/associative/src/api.ts index 9288336aa8..e0bbed6a6a 100644 --- a/packages/associative/src/api.ts +++ b/packages/associative/src/api.ts @@ -35,7 +35,7 @@ export interface EquivSetOpts { * Key equivalence predicate. MUST return truthy result if given * keys are considered equal. * - * Default: `@thi.ng/api/equiv` + * Default: `@thi.ng/equiv` */ equiv: Predicate2; } @@ -57,7 +57,7 @@ export interface SortedMapOpts extends EquivSetOpts { * * Note: The `SortedMap` implementation only uses `<` comparisons. * - * Default: `@thi.ng/api/compare` + * Default: `@thi.ng/compare` */ compare: Comparator; /** diff --git a/packages/associative/src/array-set.ts b/packages/associative/src/array-set.ts index 4c19f8a96c..8138cfe2c8 100644 --- a/packages/associative/src/array-set.ts +++ b/packages/associative/src/array-set.ts @@ -1,5 +1,5 @@ import { Predicate2 } from "@thi.ng/api/api"; -import { equiv } from "@thi.ng/api/equiv"; +import { equiv } from "@thi.ng/equiv"; import { EquivSetOpts, @@ -19,7 +19,7 @@ const __private = new WeakMap, SetProps>(); * An alternative set implementation to the native ES6 Set type. Uses * customizable equality/equivalence predicate and so is more useful * when dealing with structured data. Implements full API of native Set - * and by the default uses `@thi.ng/api/equiv` for equivalence checking. + * and by the default uses `@thi.ng/equiv` for equivalence checking. * * Additionally, the type also implements the `ICopy`, `IEmpty` and * `IEquiv` interfaces itself. diff --git a/packages/associative/src/equiv-map.ts b/packages/associative/src/equiv-map.ts index 1ea94bf492..ae7fc26b1c 100644 --- a/packages/associative/src/equiv-map.ts +++ b/packages/associative/src/equiv-map.ts @@ -4,7 +4,7 @@ import { IEquiv, IObjectOf } from "@thi.ng/api/api"; -import { equiv } from "@thi.ng/api/equiv"; +import { equiv } from "@thi.ng/equiv"; import { EquivMapOpts, @@ -47,7 +47,7 @@ export class EquivMap extends Map implements /** * Creates a new instance with optional initial key-value pairs and * provided options. If no `opts` are given, uses `ArraySet` for - * storing canonical keys and `@thi.ng/api/equiv` for checking key + * storing canonical keys and `@thi.ng/equiv` for checking key * equivalence. * * @param pairs diff --git a/packages/associative/src/ll-set.ts b/packages/associative/src/ll-set.ts index f20af773d1..1567a46a39 100644 --- a/packages/associative/src/ll-set.ts +++ b/packages/associative/src/ll-set.ts @@ -1,5 +1,5 @@ import { Predicate2 } from "@thi.ng/api/api"; -import { equiv } from "@thi.ng/api/equiv"; +import { equiv } from "@thi.ng/equiv"; import { DCons } from "@thi.ng/dcons"; import { @@ -20,7 +20,7 @@ const __private = new WeakMap, SetProps>(); * Similar to `ArraySet`, this class is an alternative implementation of * the native ES6 Set API using a @thi.ng/dcons linked list as backing * store and a customizable value equality / equivalence predicate. By - * the default uses `@thi.ng/api/equiv` for equivalence checking. + * the default uses `@thi.ng/equiv` for equivalence checking. * * Additionally, the type also implements the `ICopy`, `IEmpty` and * `IEquiv` interfaces itself. diff --git a/packages/associative/src/sorted-map.ts b/packages/associative/src/sorted-map.ts index 6adae394c9..76ea48311a 100644 --- a/packages/associative/src/sorted-map.ts +++ b/packages/associative/src/sorted-map.ts @@ -7,9 +7,9 @@ import { IObjectOf, Predicate2 } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; -import { equiv } from "@thi.ng/api/equiv"; -import { illegalArgs } from "@thi.ng/api/error"; +import { compare } from "@thi.ng/compare"; +import { equiv } from "@thi.ng/equiv"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { isArray } from "@thi.ng/checks/is-array"; import { map } from "@thi.ng/iterators/map"; diff --git a/packages/associative/src/sorted-set.ts b/packages/associative/src/sorted-set.ts index c1bf056814..64144c1be5 100644 --- a/packages/associative/src/sorted-set.ts +++ b/packages/associative/src/sorted-set.ts @@ -1,5 +1,5 @@ import { ICompare } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { map } from "@thi.ng/iterators/map"; import { IEquivSet, Pair, SortedSetOpts } from "./api"; diff --git a/packages/atom/CHANGELOG.md b/packages/atom/CHANGELOG.md index 1f5207371e..8b9996facc 100644 --- a/packages/atom/CHANGELOG.md +++ b/packages/atom/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.3.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@1.3.7...@thi.ng/atom@1.3.8) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/atom + ## [1.3.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/atom@1.3.6...@thi.ng/atom@1.3.7) (2018-05-09) diff --git a/packages/atom/package.json b/packages/atom/package.json index 4acdd73373..2bfbee6555 100644 --- a/packages/atom/package.json +++ b/packages/atom/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/atom", - "version": "1.3.7", + "version": "1.3.8", "description": "Mutable wrapper for immutable values", "main": "./index.js", "typings": "./index.d.ts", @@ -11,7 +11,7 @@ "build": "yarn clean && tsc --declaration", "clean": "rm -rf *.js *.d.ts .nyc_output build coverage doc", "cover": "yarn test && nyc report --reporter=lcov", - "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "doc": "typedoc --mode modules --out doc src", "pub": "yarn build && yarn publish --access public", "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" }, @@ -24,8 +24,11 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/paths": "^1.3.4" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/paths": "^1.3.5" }, "keywords": [ "cursor", diff --git a/packages/atom/src/atom.ts b/packages/atom/src/atom.ts index e09b0fb983..90e7549118 100644 --- a/packages/atom/src/atom.ts +++ b/packages/atom/src/atom.ts @@ -1,6 +1,6 @@ import { IEquiv, Predicate, Watch } from "@thi.ng/api/api"; -import { illegalState } from "@thi.ng/api/error"; import { IWatch } from "@thi.ng/api/mixins/iwatch"; +import { illegalState } from "@thi.ng/errors/illegal-state"; import { Path, setIn, updateIn } from "@thi.ng/paths"; import { diff --git a/packages/atom/src/cursor.ts b/packages/atom/src/cursor.ts index 2f9c1c7aeb..e873b7d3b4 100644 --- a/packages/atom/src/cursor.ts +++ b/packages/atom/src/cursor.ts @@ -1,7 +1,8 @@ import { IID, IRelease, Watch } from "@thi.ng/api/api"; -import { illegalArgs, illegalArity } from "@thi.ng/api/error"; import { isArray } from "@thi.ng/checks/is-array"; import { isFunction } from "@thi.ng/checks/is-function"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { getter, Path, setter } from "@thi.ng/paths"; import { @@ -14,6 +15,7 @@ import { import { Atom } from "./atom"; import { View } from "./view"; + /** * A cursor provides read/write access to a path location within a * nested parent state (Atom or another Cursor). Cursors behave like diff --git a/packages/atom/src/history.ts b/packages/atom/src/history.ts index 9c151b2a22..ad27234799 100644 --- a/packages/atom/src/history.ts +++ b/packages/atom/src/history.ts @@ -1,5 +1,5 @@ import { Predicate2, Watch } from "@thi.ng/api/api"; -import { equiv } from "@thi.ng/api/equiv"; +import { equiv } from "@thi.ng/equiv"; import { getIn, Path, diff --git a/packages/atom/src/view.ts b/packages/atom/src/view.ts index a809311755..20bfee3485 100644 --- a/packages/atom/src/view.ts +++ b/packages/atom/src/view.ts @@ -1,4 +1,4 @@ -import { equiv as _equiv } from "@thi.ng/api/equiv"; +import { equiv as _equiv } from "@thi.ng/equiv"; import { getter, Path, toPath } from "@thi.ng/paths"; import { IView, ReadonlyAtom, ViewTransform } from "./api"; @@ -22,7 +22,7 @@ import { IView, ReadonlyAtom, ViewTransform } from "./api"; * regardless of value change). * * Related, the actual value change predicate can be customized. If not - * given, the default `@thi.ng/api/equiv` will be used. + * given, the default `@thi.ng/equiv` will be used. * * ``` * a = new Atom({a: {b: 1}}); diff --git a/packages/bench/.npmignore b/packages/bench/.npmignore new file mode 100644 index 0000000000..d703bda97a --- /dev/null +++ b/packages/bench/.npmignore @@ -0,0 +1,10 @@ +build +coverage +dev +doc +src* +test +.nyc_output +tsconfig.json +*.tgz +*.html diff --git a/packages/bench/CHANGELOG.md b/packages/bench/CHANGELOG.md new file mode 100644 index 0000000000..87a45d48f6 --- /dev/null +++ b/packages/bench/CHANGELOG.md @@ -0,0 +1,12 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +# 0.1.0 (2018-05-10) + + +### Features + +* **bench:** add new package [@thi](https://github.com/thi).ng/bench ([9466d4b](https://github.com/thi-ng/umbrella/commit/9466d4b)) diff --git a/packages/bench/LICENSE b/packages/bench/LICENSE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/packages/bench/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/bench/README.md b/packages/bench/README.md new file mode 100644 index 0000000000..e49cc1a60d --- /dev/null +++ b/packages/bench/README.md @@ -0,0 +1,34 @@ +# @thi.ng/bench + +[![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/bench.svg)](https://www.npmjs.com/package/@thi.ng/bench) + +This project is part of the +[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo. + +## About + +Basic, non-precise benchmarking helpers. + +This feature was previously part of the +[@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) +package. + +## Installation + +``` +yarn add @thi.ng/bench +``` + +## Usage examples + +```typescript +import { timed, bench } from "@thi.ng/bench"; +``` + +## Authors + +- Karsten Schmidt + +## License + +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/packages/bench/package.json b/packages/bench/package.json new file mode 100644 index 0000000000..b87356a9ab --- /dev/null +++ b/packages/bench/package.json @@ -0,0 +1,35 @@ +{ + "name": "@thi.ng/bench", + "version": "0.1.0", + "description": "TODO", + "main": "./index.js", + "typings": "./index.d.ts", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "build": "yarn run clean && tsc --declaration", + "clean": "rm -rf *.js *.d.ts .nyc_output build coverage doc", + "cover": "yarn test && nyc report --reporter=lcov", + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn run build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" + }, + "devDependencies": { + "@types/mocha": "^5.2.0", + "@types/node": "^10.0.6", + "mocha": "^5.1.1", + "nyc": "^11.7.1", + "typedoc": "^0.11.1", + "typescript": "^2.8.3" + }, + "keywords": [ + "benchmark", + "ES6", + "timing", + "typescript" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/api/src/bench.ts b/packages/bench/src/index.ts similarity index 100% rename from packages/api/src/bench.ts rename to packages/bench/src/index.ts diff --git a/packages/bench/test/index.ts b/packages/bench/test/index.ts new file mode 100644 index 0000000000..150b002db2 --- /dev/null +++ b/packages/bench/test/index.ts @@ -0,0 +1,6 @@ +// import * as assert from "assert"; +// import * as bench from "../src/index"; + +describe("bench", () => { + it("tests pending"); +}); diff --git a/packages/bench/test/tsconfig.json b/packages/bench/test/tsconfig.json new file mode 100644 index 0000000000..bcf29ace54 --- /dev/null +++ b/packages/bench/test/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../build" + }, + "include": [ + "./**/*.ts", + "../src/**/*.ts" + ] +} diff --git a/packages/bench/tsconfig.json b/packages/bench/tsconfig.json new file mode 100644 index 0000000000..bd6481a5a6 --- /dev/null +++ b/packages/bench/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "." + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/packages/bitstream/CHANGELOG.md b/packages/bitstream/CHANGELOG.md index e24bfa474e..3987d94108 100644 --- a/packages/bitstream/CHANGELOG.md +++ b/packages/bitstream/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.4.9](https://github.com/thi-ng/umbrella/compare/@thi.ng/bitstream@0.4.8...@thi.ng/bitstream@0.4.9) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/bitstream + ## [0.4.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/bitstream@0.4.7...@thi.ng/bitstream@0.4.8) (2018-05-09) diff --git a/packages/bitstream/package.json b/packages/bitstream/package.json index b07c94a1ef..071211249c 100644 --- a/packages/bitstream/package.json +++ b/packages/bitstream/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/bitstream", - "version": "0.4.8", + "version": "0.4.9", "description": "ES6 iterator based read/write bit streams & support for variable word widths", "main": "./index.js", "typings": "./index.d.ts", @@ -16,7 +16,7 @@ "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" }, "dependencies": { - "@thi.ng/api": "^2.3.2" + "@thi.ng/errors": "^0.1.0" }, "devDependencies": { "@types/mocha": "^5.2.0", diff --git a/packages/bitstream/src/input.ts b/packages/bitstream/src/input.ts index beba95a258..44206ce9b4 100644 --- a/packages/bitstream/src/input.ts +++ b/packages/bitstream/src/input.ts @@ -1,4 +1,4 @@ -import { illegalArgs, illegalState } from "@thi.ng/api/error"; +import { illegalArgs, illegalState } from "@thi.ng/errors"; const U32 = Math.pow(2, 32); diff --git a/packages/bitstream/src/output.ts b/packages/bitstream/src/output.ts index 86abc3acdb..59dddee6b0 100644 --- a/packages/bitstream/src/output.ts +++ b/packages/bitstream/src/output.ts @@ -1,4 +1,4 @@ -import { illegalArgs } from "@thi.ng/api/error"; +import { illegalArgs } from "@thi.ng/errors"; import { BitInputStream } from "./input"; diff --git a/packages/cache/CHANGELOG.md b/packages/cache/CHANGELOG.md index 35b5647504..46f465f6c4 100644 --- a/packages/cache/CHANGELOG.md +++ b/packages/cache/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.2.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/cache@0.2.5...@thi.ng/cache@0.2.6) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/cache + ## [0.2.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/cache@0.2.4...@thi.ng/cache@0.2.5) (2018-05-09) diff --git a/packages/cache/package.json b/packages/cache/package.json index e41a4a7ce5..a57df4fb25 100644 --- a/packages/cache/package.json +++ b/packages/cache/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/cache", - "version": "0.2.5", + "version": "0.2.6", "description": "In-memory cache implementations with ES6 Map-like API and different eviction strategies", "main": "./index.js", "typings": "./index.d.ts", @@ -24,9 +24,9 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/dcons": "^0.3.4", - "@thi.ng/iterators": "^4.1.10" + "@thi.ng/api": "^3.0.0", + "@thi.ng/dcons": "^0.3.5", + "@thi.ng/iterators": "^4.1.11" }, "keywords": [ "cache", diff --git a/packages/compare/.npmignore b/packages/compare/.npmignore new file mode 100644 index 0000000000..d703bda97a --- /dev/null +++ b/packages/compare/.npmignore @@ -0,0 +1,10 @@ +build +coverage +dev +doc +src* +test +.nyc_output +tsconfig.json +*.tgz +*.html diff --git a/packages/compare/CHANGELOG.md b/packages/compare/CHANGELOG.md new file mode 100644 index 0000000000..390a817a59 --- /dev/null +++ b/packages/compare/CHANGELOG.md @@ -0,0 +1,12 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +# 0.1.0 (2018-05-10) + + +### Features + +* **compare:** add new package [@thi](https://github.com/thi).ng/compare ([e4a87c4](https://github.com/thi-ng/umbrella/commit/e4a87c4)) diff --git a/packages/compare/LICENSE b/packages/compare/LICENSE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/packages/compare/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/compare/README.md b/packages/compare/README.md new file mode 100644 index 0000000000..af56b2a337 --- /dev/null +++ b/packages/compare/README.md @@ -0,0 +1,51 @@ +# @thi.ng/compare + +[![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/compare.svg)](https://www.npmjs.com/package/@thi.ng/compare) + +This project is part of the +[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo. + +## About + +General purpose comparator with optional delegation for types +implementing the `@thi.ng/api/ICompare` interface. + +This feature was previously part of the +[@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) +package. + +## Installation + +``` +yarn add @thi.ng/compare +``` + +## Usage examples + +```typescript +import { compare } from "@thi.ng/compare"; + +class Foo { + + x: number; + + constructor(x: number) { + this.x = x; + } + + compare(o: Foo) { + return compare(this.x, o.x); + } +} + +compare(new Foo(1), new Foo(2)); +// -1 +``` + +## Authors + +- Karsten Schmidt + +## License + +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/packages/compare/package.json b/packages/compare/package.json new file mode 100644 index 0000000000..8796e069b3 --- /dev/null +++ b/packages/compare/package.json @@ -0,0 +1,33 @@ +{ + "name": "@thi.ng/compare", + "version": "0.1.0", + "description": "TODO", + "main": "./index.js", + "typings": "./index.d.ts", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "build": "yarn run clean && tsc --declaration", + "clean": "rm -rf *.js *.d.ts .nyc_output build coverage doc", + "cover": "yarn test && nyc report --reporter=lcov", + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn run build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" + }, + "devDependencies": { + "@types/mocha": "^5.2.0", + "@types/node": "^10.0.6", + "mocha": "^5.1.1", + "nyc": "^11.7.1", + "typedoc": "^0.11.1", + "typescript": "^2.8.3" + }, + "keywords": [ + "ES6", + "typescript" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/api/src/compare.ts b/packages/compare/src/index.ts similarity index 100% rename from packages/api/src/compare.ts rename to packages/compare/src/index.ts diff --git a/packages/compare/test/index.ts b/packages/compare/test/index.ts new file mode 100644 index 0000000000..7c77f03d25 --- /dev/null +++ b/packages/compare/test/index.ts @@ -0,0 +1,6 @@ +// import * as assert from "assert"; +// import * as compare from "../src/index"; + +describe("compare", () => { + it("tests pending"); +}); diff --git a/packages/compare/test/tsconfig.json b/packages/compare/test/tsconfig.json new file mode 100644 index 0000000000..bcf29ace54 --- /dev/null +++ b/packages/compare/test/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../build" + }, + "include": [ + "./**/*.ts", + "../src/**/*.ts" + ] +} diff --git a/packages/compare/tsconfig.json b/packages/compare/tsconfig.json new file mode 100644 index 0000000000..bd6481a5a6 --- /dev/null +++ b/packages/compare/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "." + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/packages/csp/CHANGELOG.md b/packages/csp/CHANGELOG.md index b9a541044c..0f59ba1b52 100644 --- a/packages/csp/CHANGELOG.md +++ b/packages/csp/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.3.34](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.33...@thi.ng/csp@0.3.34) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/csp + ## [0.3.33](https://github.com/thi-ng/umbrella/compare/@thi.ng/csp@0.3.32...@thi.ng/csp@0.3.33) (2018-05-09) diff --git a/packages/csp/package.json b/packages/csp/package.json index 7769014f12..c74ea0d76a 100644 --- a/packages/csp/package.json +++ b/packages/csp/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/csp", - "version": "0.3.33", + "version": "0.3.34", "description": "ES6 promise based CSP implementation", "main": "./index.js", "typings": "./index.d.ts", @@ -28,8 +28,11 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/dcons": "^0.3.4", - "@thi.ng/transducers": "^1.8.5" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/dcons": "^0.3.5", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/transducers": "^1.8.6" }, "keywords": [ "async", diff --git a/packages/csp/src/channel.ts b/packages/csp/src/channel.ts index 5ec19a4547..9b8e48bea4 100644 --- a/packages/csp/src/channel.ts +++ b/packages/csp/src/channel.ts @@ -1,5 +1,5 @@ import { Predicate } from "@thi.ng/api/api"; -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { isFunction } from "@thi.ng/checks/is-function"; import { DCons } from "@thi.ng/dcons"; import { Reducer, Transducer } from "@thi.ng/transducers/api"; diff --git a/packages/csp/src/mult.ts b/packages/csp/src/mult.ts index 453bd476b1..a5d09addb7 100644 --- a/packages/csp/src/mult.ts +++ b/packages/csp/src/mult.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { DCons } from "@thi.ng/dcons"; import { Transducer } from "@thi.ng/transducers/api"; diff --git a/packages/csp/src/pubsub.ts b/packages/csp/src/pubsub.ts index de6da8612e..56820e6163 100644 --- a/packages/csp/src/pubsub.ts +++ b/packages/csp/src/pubsub.ts @@ -1,5 +1,5 @@ import { IObjectOf } from "@thi.ng/api/api"; -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { Transducer } from "@thi.ng/transducers/api"; import { IWriteableChannel, TopicFn } from "./api"; diff --git a/packages/dcons/CHANGELOG.md b/packages/dcons/CHANGELOG.md index b9ab4243cc..a63140759a 100644 --- a/packages/dcons/CHANGELOG.md +++ b/packages/dcons/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.3.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@0.3.4...@thi.ng/dcons@0.3.5) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/dcons + ## [0.3.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/dcons@0.3.3...@thi.ng/dcons@0.3.4) (2018-05-09) diff --git a/packages/dcons/package.json b/packages/dcons/package.json index e78533da9d..46a589aa36 100644 --- a/packages/dcons/package.json +++ b/packages/dcons/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dcons", - "version": "0.3.4", + "version": "0.3.5", "description": "Comprehensive doubly linked list structure w/ iterator support", "main": "./index.js", "typings": "./index.d.ts", @@ -24,7 +24,11 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/compare": "^0.1.0", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "datastructure", diff --git a/packages/dcons/src/index.ts b/packages/dcons/src/index.ts index 5274d72afc..fbba90109d 100644 --- a/packages/dcons/src/index.ts +++ b/packages/dcons/src/index.ts @@ -1,7 +1,8 @@ import * as api from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; -import { equiv } from "@thi.ng/api/equiv"; -import { illegalArgs, illegalState } from "@thi.ng/api/error"; +import { compare } from "@thi.ng/compare"; +import { equiv } from "@thi.ng/equiv"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { illegalState } from "@thi.ng/errors/illegal-state"; import { isArrayLike } from "@thi.ng/checks/is-arraylike"; export interface ConsCell { diff --git a/packages/dgraph/CHANGELOG.md b/packages/dgraph/CHANGELOG.md index ff7d29e862..c167567d0b 100644 --- a/packages/dgraph/CHANGELOG.md +++ b/packages/dgraph/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. + +## [0.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@0.2.0...@thi.ng/dgraph@0.2.1) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/dgraph + + +# [0.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@0.1.10...@thi.ng/dgraph@0.2.0) (2018-05-09) + + +### Features + +* **dgraph:** add leaves() & roots() iterators, update sort() ([68ca46d](https://github.com/thi-ng/umbrella/commit/68ca46d)) + + + + ## [0.1.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/dgraph@0.1.9...@thi.ng/dgraph@0.1.10) (2018-05-09) diff --git a/packages/dgraph/package.json b/packages/dgraph/package.json index 745b4cffab..1039a4b149 100644 --- a/packages/dgraph/package.json +++ b/packages/dgraph/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dgraph", - "version": "0.1.10", + "version": "0.2.1", "description": "Type-agnostic directed acyclic graph (DAG) & graph operations", "main": "./index.js", "typings": "./index.d.ts", @@ -24,9 +24,11 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/associative": "^0.5.0", - "@thi.ng/iterators": "^4.1.10" + "@thi.ng/api": "^3.0.0", + "@thi.ng/associative": "^0.5.1", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/iterators": "^4.1.11" }, "keywords": [ "data structure", diff --git a/packages/dgraph/src/index.ts b/packages/dgraph/src/index.ts index 0d56fc3a13..fb200ce05c 100644 --- a/packages/dgraph/src/index.ts +++ b/packages/dgraph/src/index.ts @@ -1,6 +1,6 @@ import { ICopy } from "@thi.ng/api/api"; -import { equiv } from "@thi.ng/api/equiv"; -import { illegalArgs } from "@thi.ng/api/error"; +import { equiv } from "@thi.ng/equiv"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { EquivMap } from "@thi.ng/associative/equiv-map"; import { LLSet } from "@thi.ng/associative/ll-set"; import { union } from "@thi.ng/associative/union"; @@ -97,6 +97,14 @@ export class DGraph implements ); } + leaves(): IterableIterator { + return filter((node: T) => this.isLeaf(node), this.nodes()); + } + + roots(): IterableIterator { + return filter((node: T) => this.isRoot(node), this.nodes()); + } + transitiveDependencies(x: T) { return transitive(this.dependencies, x); } @@ -108,14 +116,14 @@ export class DGraph implements sort() { const sorted: T[] = []; const g = this.copy(); - let queue = new LLSet(filter((node: T) => g.isLeaf(node), g.nodes())); + let queue = new LLSet(g.leaves()); while (true) { if (!queue.size) { return sorted.reverse(); } const node = queue.first(); queue.delete(node); - for (let d of (>g.immediateDependencies(node)).copy()) { + for (let d of [...g.immediateDependencies(node)]) { g.removeEdge(node, d); if (g.isLeaf(d)) { queue.add(d); diff --git a/packages/diff/CHANGELOG.md b/packages/diff/CHANGELOG.md index 154e75e4a5..9a8873fada 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. + +## [1.0.12](https://github.com/thi-ng/umbrella/compare/@thi.ng/diff@1.0.11...@thi.ng/diff@1.0.12) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/diff + ## [1.0.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/diff@1.0.10...@thi.ng/diff@1.0.11) (2018-05-09) diff --git a/packages/diff/package.json b/packages/diff/package.json index 68810d34c2..20fc512d7b 100644 --- a/packages/diff/package.json +++ b/packages/diff/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/diff", - "version": "1.0.11", + "version": "1.0.12", "description": "Array & object Diff", "main": "./index.js", "typings": "./index.d.ts", @@ -22,7 +22,8 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2" + "@thi.ng/api": "^3.0.0", + "@thi.ng/equiv": "^0.1.0" }, "keywords": [ "array", diff --git a/packages/diff/src/array.ts b/packages/diff/src/array.ts index bcd4c29a2c..7d635ed883 100644 --- a/packages/diff/src/array.ts +++ b/packages/diff/src/array.ts @@ -1,4 +1,4 @@ -import { equiv as _equiv } from "@thi.ng/api/equiv"; +import { equiv as _equiv } from "@thi.ng/equiv"; import { ArrayDiff } from "./api"; @@ -10,7 +10,7 @@ import { ArrayDiff } from "./api"; * - https://github.com/cubicdaiya/onp * * Various optimizations, fixes & refactorings. - * By default uses `@thi.ng/api/equiv` for equality checks. + * By default uses `@thi.ng/equiv` for equality checks. */ export function diffArray(_a: T[], _b: T[], equiv = _equiv, linearOnly = false) { const state = >{ diff --git a/packages/diff/src/object.ts b/packages/diff/src/object.ts index 898b74d6a6..91d70d412d 100644 --- a/packages/diff/src/object.ts +++ b/packages/diff/src/object.ts @@ -1,4 +1,4 @@ -import { equiv } from "@thi.ng/api/equiv"; +import { equiv } from "@thi.ng/equiv"; import { ObjectDiff } from "./api"; diff --git a/packages/dot/CHANGELOG.md b/packages/dot/CHANGELOG.md index 1c8bb9e7b9..a54f263997 100644 --- a/packages/dot/CHANGELOG.md +++ b/packages/dot/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.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/dot@0.1.0...@thi.ng/dot@0.1.1) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/dot + # 0.1.0 (2018-05-09) diff --git a/packages/dot/package.json b/packages/dot/package.json index 54c13debb7..3af8d9672c 100644 --- a/packages/dot/package.json +++ b/packages/dot/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/dot", - "version": "0.1.0", + "version": "0.1.1", "description": "TODO", "main": "./index.js", "typings": "./index.d.ts", @@ -24,7 +24,7 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", + "@thi.ng/api": "^3.0.0", "@thi.ng/checks": "^1.5.2" }, "keywords": [ diff --git a/packages/equiv/.npmignore b/packages/equiv/.npmignore new file mode 100644 index 0000000000..d703bda97a --- /dev/null +++ b/packages/equiv/.npmignore @@ -0,0 +1,10 @@ +build +coverage +dev +doc +src* +test +.nyc_output +tsconfig.json +*.tgz +*.html diff --git a/packages/equiv/CHANGELOG.md b/packages/equiv/CHANGELOG.md new file mode 100644 index 0000000000..d8f62ddb11 --- /dev/null +++ b/packages/equiv/CHANGELOG.md @@ -0,0 +1,12 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +# 0.1.0 (2018-05-10) + + +### Features + +* **equiv:** add new package [@thi](https://github.com/thi).ng/equiv ([6d12ae0](https://github.com/thi-ng/umbrella/commit/6d12ae0)) diff --git a/packages/equiv/LICENSE b/packages/equiv/LICENSE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/packages/equiv/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/equiv/README.md b/packages/equiv/README.md new file mode 100644 index 0000000000..23111023fa --- /dev/null +++ b/packages/equiv/README.md @@ -0,0 +1,45 @@ +# @thi.ng/equiv + +[![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/equiv.svg)](https://www.npmjs.com/package/@thi.ng/equiv) + +This project is part of the +[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo. + +## About + +Deep equivalence checking for any data types. Supports: + +- JS primitives +- arrays +- plain objects +- ES6 Sets / Maps +- Date +- RegExp +- types with `.equiv()` implementations + +This feature was previously part of the +[@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) +package. + +## Installation + +``` +yarn add @thi.ng/equiv +``` + +## Usage examples + +```typescript +import { equiv } from "@thi.ng/equiv"; + +equiv({a: {b: [1, 2]}}, {a: {b: [1, 2]}}); +// true +``` + +## Authors + +- Karsten Schmidt + +## License + +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/packages/equiv/package.json b/packages/equiv/package.json new file mode 100644 index 0000000000..3273ae5252 --- /dev/null +++ b/packages/equiv/package.json @@ -0,0 +1,36 @@ +{ + "name": "@thi.ng/equiv", + "version": "0.1.0", + "description": "TODO", + "main": "./index.js", + "typings": "./index.d.ts", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "build": "yarn run clean && tsc --declaration", + "clean": "rm -rf *.js *.d.ts .nyc_output build coverage doc", + "cover": "yarn test && nyc report --reporter=lcov", + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn run build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" + }, + "devDependencies": { + "@types/mocha": "^5.2.0", + "@types/node": "^10.0.6", + "mocha": "^5.1.1", + "nyc": "^11.7.1", + "typedoc": "^0.11.1", + "typescript": "^2.8.3" + }, + "dependencies": { + "@thi.ng/checks": "^1.5.2" + }, + "keywords": [ + "ES6", + "typescript" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/api/src/equiv.ts b/packages/equiv/src/index.ts similarity index 79% rename from packages/api/src/equiv.ts rename to packages/equiv/src/index.ts index d1f31abdd4..b2d94ee1b1 100644 --- a/packages/api/src/equiv.ts +++ b/packages/equiv/src/index.ts @@ -5,7 +5,7 @@ import { isPlainObject } from "@thi.ng/checks/is-plain-object"; import { isRegExp } from "@thi.ng/checks/is-regexp"; import { isSet } from "@thi.ng/checks/is-set"; -export function equiv(a, b): boolean { +export const equiv = (a, b): boolean => { if (a === b) { return true; } @@ -46,27 +46,25 @@ export function equiv(a, b): boolean { } // NaN return (a !== a && b !== b); -} +}; -function equivArrayLike(a: ArrayLike, b: ArrayLike) { +const equivArrayLike = (a: ArrayLike, b: ArrayLike) => { let l = a.length; if (b.length === l) { while (--l >= 0 && equiv(a[l], b[l])); } return l < 0; -} +}; -function equivSet(a: Set, b: Set) { - if (a.size !== b.size) return false; - return equiv([...a.keys()].sort(), [...b.keys()].sort()); -} +const equivSet = (a: Set, b: Set) => + (a.size === b.size) && + equiv([...a.keys()].sort(), [...b.keys()].sort()); -function equivMap(a: Map, b: Map) { - if (a.size !== b.size) return false; - return equiv([...a].sort(), [...b].sort()); -} +const equivMap = (a: Map, b: Map) => + (a.size === b.size) && + equiv([...a].sort(), [...b].sort()); -function equivObject(a, b) { +const equivObject = (a: any, b: any) => { const ka = Object.keys(a); if (ka.length !== Object.keys(b).length) return false; for (let i = ka.length, k; --i >= 0;) { @@ -76,4 +74,4 @@ function equivObject(a, b) { } } return true; -} +}; diff --git a/packages/api/test/index.ts b/packages/equiv/test/index.ts similarity index 98% rename from packages/api/test/index.ts rename to packages/equiv/test/index.ts index ee79e27465..acaae4c6f3 100644 --- a/packages/api/test/index.ts +++ b/packages/equiv/test/index.ts @@ -1,6 +1,6 @@ import * as assert from "assert"; -import { equiv } from "../src/equiv"; +import { equiv } from "../src/"; describe("equiv", () => { diff --git a/packages/equiv/test/tsconfig.json b/packages/equiv/test/tsconfig.json new file mode 100644 index 0000000000..bcf29ace54 --- /dev/null +++ b/packages/equiv/test/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../build" + }, + "include": [ + "./**/*.ts", + "../src/**/*.ts" + ] +} diff --git a/packages/equiv/tsconfig.json b/packages/equiv/tsconfig.json new file mode 100644 index 0000000000..bd6481a5a6 --- /dev/null +++ b/packages/equiv/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "." + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/packages/errors/.npmignore b/packages/errors/.npmignore new file mode 100644 index 0000000000..d703bda97a --- /dev/null +++ b/packages/errors/.npmignore @@ -0,0 +1,10 @@ +build +coverage +dev +doc +src* +test +.nyc_output +tsconfig.json +*.tgz +*.html diff --git a/packages/errors/CHANGELOG.md b/packages/errors/CHANGELOG.md new file mode 100644 index 0000000000..e3d35448d5 --- /dev/null +++ b/packages/errors/CHANGELOG.md @@ -0,0 +1,12 @@ +# Change Log + +All notable changes to this project will be documented in this file. +See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. + + +# 0.1.0 (2018-05-10) + + +### Features + +* **errors:** add new package [@thi](https://github.com/thi).ng/errors ([1e97856](https://github.com/thi-ng/umbrella/commit/1e97856)) diff --git a/packages/errors/LICENSE b/packages/errors/LICENSE new file mode 100644 index 0000000000..8dada3edaf --- /dev/null +++ b/packages/errors/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/packages/errors/README.md b/packages/errors/README.md new file mode 100644 index 0000000000..856e7da542 --- /dev/null +++ b/packages/errors/README.md @@ -0,0 +1,46 @@ +# @thi.ng/errors + +[![npm (scoped)](https://img.shields.io/npm/v/@thi.ng/errors.svg)](https://www.npmjs.com/package/@thi.ng/errors) + +This project is part of the +[@thi.ng/umbrella](https://github.com/thi-ng/umbrella/) monorepo. + +## About + +Custom error types and helper fns used by many packages in this repo. + +This feature was previously part of the +[@thi.ng/api](https://github.com/thi-ng/umbrella/tree/master/packages/api) +package. + +## Installation + +``` +yarn add @thi.ng/errors +``` + +## Usage examples + +```typescript +import * as err from "@thi.ng/errors"; + +err.illegalArity(3) +// Error: illegal arity: 3 + +err.illegalArgs("expected foo"); +// Error: illegal argument(s): expected foo + +err.illegalState("oops"); +// Error: illegal state: oops + +err.unsupported("TODO not yet implemented") +// Error: unsupported operation: TODO not yet implemented +``` + +## Authors + +- Karsten Schmidt + +## License + +© 2018 Karsten Schmidt // Apache Software License 2.0 diff --git a/packages/errors/package.json b/packages/errors/package.json new file mode 100644 index 0000000000..a2b6c4129b --- /dev/null +++ b/packages/errors/package.json @@ -0,0 +1,33 @@ +{ + "name": "@thi.ng/errors", + "version": "0.1.0", + "description": "TODO", + "main": "./index.js", + "typings": "./index.d.ts", + "repository": "https://github.com/thi-ng/umbrella", + "author": "Karsten Schmidt ", + "license": "Apache-2.0", + "scripts": { + "build": "yarn run clean && tsc --declaration", + "clean": "rm -rf *.js *.d.ts .nyc_output build coverage doc", + "cover": "yarn test && nyc report --reporter=lcov", + "doc": "node_modules/.bin/typedoc --mode modules --out doc src", + "pub": "yarn run build && yarn publish --access public", + "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" + }, + "devDependencies": { + "@types/mocha": "^5.2.0", + "@types/node": "^10.0.6", + "mocha": "^5.1.1", + "nyc": "^11.7.1", + "typedoc": "^0.11.1", + "typescript": "^2.8.3" + }, + "keywords": [ + "ES6", + "typescript" + ], + "publishConfig": { + "access": "public" + } +} diff --git a/packages/errors/src/illegal-arguments.ts b/packages/errors/src/illegal-arguments.ts new file mode 100644 index 0000000000..7b3246e1ec --- /dev/null +++ b/packages/errors/src/illegal-arguments.ts @@ -0,0 +1,9 @@ +export class IllegalArgumentError extends Error { + constructor(msg?: any) { + super("illegal argument(s)" + (msg !== undefined ? ": " + msg : "")); + } +} + +export function illegalArgs(msg?: any) { + throw new IllegalArgumentError(msg); +} diff --git a/packages/errors/src/illegal-arity.ts b/packages/errors/src/illegal-arity.ts new file mode 100644 index 0000000000..7b5c166b73 --- /dev/null +++ b/packages/errors/src/illegal-arity.ts @@ -0,0 +1,9 @@ +export class IllegalArityError extends Error { + constructor(n: number) { + super(`illegal arity: ${n}`); + } +} + +export function illegalArity(n) { + throw new IllegalArityError(n); +} diff --git a/packages/errors/src/illegal-state.ts b/packages/errors/src/illegal-state.ts new file mode 100644 index 0000000000..9f2451249c --- /dev/null +++ b/packages/errors/src/illegal-state.ts @@ -0,0 +1,9 @@ +export class IllegalStateError extends Error { + constructor(msg?: any) { + super("illegal state" + (msg !== undefined ? ": " + msg : "")); + } +} + +export function illegalState(msg?: any) { + throw new IllegalStateError(msg); +} diff --git a/packages/errors/src/index.ts b/packages/errors/src/index.ts new file mode 100644 index 0000000000..f4fff5e84e --- /dev/null +++ b/packages/errors/src/index.ts @@ -0,0 +1,4 @@ +export * from "./illegal-arguments"; +export * from "./illegal-arity"; +export * from "./illegal-state"; +export * from "./unsupported"; diff --git a/packages/errors/src/unsupported.ts b/packages/errors/src/unsupported.ts new file mode 100644 index 0000000000..8de7f6efa6 --- /dev/null +++ b/packages/errors/src/unsupported.ts @@ -0,0 +1,9 @@ +export class UnsupportedOperationError extends Error { + constructor(msg?: any) { + super("unsupported operation" + (msg !== undefined ? ": " + msg : "")); + } +} + +export function unsupported(msg?: any) { + throw new UnsupportedOperationError(msg); +} diff --git a/packages/errors/test/index.ts b/packages/errors/test/index.ts new file mode 100644 index 0000000000..10bdfc7a81 --- /dev/null +++ b/packages/errors/test/index.ts @@ -0,0 +1,6 @@ +// import * as assert from "assert"; +// import * as errors from "../src/index"; + +describe("errors", () => { + it("tests pending"); +}); diff --git a/packages/errors/test/tsconfig.json b/packages/errors/test/tsconfig.json new file mode 100644 index 0000000000..bcf29ace54 --- /dev/null +++ b/packages/errors/test/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../../tsconfig.json", + "compilerOptions": { + "outDir": "../build" + }, + "include": [ + "./**/*.ts", + "../src/**/*.ts" + ] +} diff --git a/packages/errors/tsconfig.json b/packages/errors/tsconfig.json new file mode 100644 index 0000000000..bd6481a5a6 --- /dev/null +++ b/packages/errors/tsconfig.json @@ -0,0 +1,9 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "." + }, + "include": [ + "./src/**/*.ts" + ] +} diff --git a/packages/hdom-components/CHANGELOG.md b/packages/hdom-components/CHANGELOG.md index e174aa9ff2..8a70507b2d 100644 --- a/packages/hdom-components/CHANGELOG.md +++ b/packages/hdom-components/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. + +## [2.1.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-components@2.1.0...@thi.ng/hdom-components@2.1.1) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/hdom-components + # [2.1.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom-components@2.0.3...@thi.ng/hdom-components@2.1.0) (2018-05-09) diff --git a/packages/hdom-components/adr/0002-component-configuration.md b/packages/hdom-components/adr/0002-component-configuration.md index 5ca278fd86..a68e2c4ca6 100644 --- a/packages/hdom-components/adr/0002-component-configuration.md +++ b/packages/hdom-components/adr/0002-component-configuration.md @@ -7,6 +7,8 @@ WIP +Amended by [3. Component configuration via context](0003-component-configuration-via-context.md) + ## Context The components provided by this package SHOULD primarily be designed diff --git a/packages/hdom-components/adr/0003-component-configuration-via-context.md b/packages/hdom-components/adr/0003-component-configuration-via-context.md new file mode 100644 index 0000000000..51cdac8021 --- /dev/null +++ b/packages/hdom-components/adr/0003-component-configuration-via-context.md @@ -0,0 +1,185 @@ +# 3. Component configuration via context + +Date: 2018-05-09 + +## Status + +WIP + +Amends [ADR-0002](0002-component-configuration.md) + +## Context + +An alternative configuration procedure to ADR-0002, possibly better +suited for dynamic theming, theme changes and separating the component +configuration between behavioral and stylistic aspects. This new +approach utilizes the hdom context object to retrieve theme attributes, +whereas the previous solution ignored the context object entirely. + +A live demo of the code discussed here is available at: + +[demo.thi.ng/umbrella/hdom-theme-adr-0003](http://demo.thi.ng/umbrella/hdom-theme-adr-0003) + +## Decision + +### Split component configuration + +#### Behavioral aspects + +Component pre-configuration options SHOULD purely consist of behavioral +settings and NOT include any aesthetic / theme oriented options. To +better express this intention, it's recommended to suffix these +interface names with `Behavior`, e.g. `ButtonBehavior`. + +```ts +interface ButtonBehavior { + /** + * Element name to use for enabled buttons. + * Default: "a" + */ + tag: string; + /** + * Element name to use for disabled buttons. + * Default: "span" + */ + tagDisabled: string; + /** + * Default attribs, always injected for active button states + * and overridable at runtime. + * Default: `{ href: "#", role: "button" }` + */ + attribs: IObjectOf; +} +``` + +#### Theme stored in hdom context + +Even though there's work underway to develop a flexble theming system +for hdom components, the components themselves SHOULD be agnostic to +this and only expect to somehow obtain styling attributes from the hdom +context object passed to each component function. How is shown further +below. + +In this example we define a `theme` key in the context object, under +which theme options for all participating components are stored. + +```ts +const ctx = { + ... + theme: { + primaryButton: { + default: { class: ... }, + disabled: { class: ... }, + selected: { class: ... }, + }, + secondaryButton: { + default: { class: ... }, + disabled: { class: ... }, + selected: { class: ... }, + }, + ... + } +}; +``` + +### Component definition + +```ts +import { getIn, Path } from "@thi.ng/paths"; + +/** + * Instance specific runtime args. All optional. + */ +interface ButtonArgs { + /** + * Click event handler to be wrapped with preventDefault() call + */ + onclick: EventListener; + /** + * Disabled flag. Used to determine themed version. + */ + disabled: boolean; + /** + * Selected flag. Used to determine themed version. + */ + selected: boolean; + /** + * Link target. + */ + href: string; +} + +const button = (themeCtxPath: Path, behavior?: Partial) => { + // init with defaults + behavior = { + tag: "a", + tagDisabled: "span", + ...behavior + }; + behavior.attribs = { href: "#", role: "button", ...behavior.attribs }; + // return component function as closure + return (ctx: any, args: Partial, ...body: any[]) => { + // lookup component theme config in context + const theme = getIn(ctx, themeCtxPath); + if (args.disabled) { + return [behavior.tagDisabled, { + ...behavior.attribs, + ...theme.disabled, + ...args, + }, ...body]; + } else { + const attribs = { + ...behavior.attribs, + ...theme[args.selected ? "selected" : "default"], + ...args + }; + if (args && args.onclick && (args.href == null || args.href === "#")) { + attribs.onclick = (e) => (e.preventDefault(), args.onclick(e)); + } + return [behavior.tag, attribs, ...body]; + } + }; +}; +``` + +### Component usage + +```ts +const darkTheme = { + id: "dark", + body: { + class: "vh-100 bg-black moon-gray pa3 sans-serif" + }, + link: { + class: "link dim b light-silver" + }, + button: { + default: { + class: "dib link mr2 ph3 pv2 blue hover-lightest-blue hover-b--current br3 ba b--blue" + }, + selected: { + class: "dib link mr2 ph3 pv2 red hover-gold hover-b--current br3 ba b--red" + }, + disabled: { + class: "dib mr2 ph3 pv2 mid-gray br3 ba b--mid-gray" + } + } +}; + +const bt = button("theme.button"); +const btFixed = button("theme.button", { attribs: { style: { width: "8rem" } } }); + +const app = (ctx) => + ["div", ctx.theme.body, + [bt, { onclick: () => alert("toggle") }, "Toggle"], + [bt, { href: "https://github.com/thi-ng/umbrella" }, "External"], + [btFixed, { onclick: () => alert("hi"), selected: true }, "Selected"], + [btFixed, { disabled: true }, "Disabled"] ]; + +// start app with theme in context +start("app", app, { theme: darkTheme }) +``` + +## Consequences + +Consequences here... diff --git a/packages/hdom-components/package.json b/packages/hdom-components/package.json index f221952dea..9585b40c9a 100644 --- a/packages/hdom-components/package.json +++ b/packages/hdom-components/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hdom-components", - "version": "2.1.0", + "version": "2.1.1", "description": "Raw, skinnable UI & SVG components for @thi.ng/hdom", "main": "./index.js", "typings": "./index.d.ts", @@ -24,8 +24,9 @@ "typescript": "^2.8.3" }, "dependencies": { + "@thi.ng/api": "^3.0.0", "@thi.ng/checks": "^1.5.2", - "@thi.ng/iterators": "^4.1.10", + "@thi.ng/iterators": "^4.1.11", "@types/webgl2": "^0.0.3" }, "keywords": [ diff --git a/packages/hdom-components/src/button-group.ts b/packages/hdom-components/src/button-group.ts index e4c5c42cf7..6640012adb 100644 --- a/packages/hdom-components/src/button-group.ts +++ b/packages/hdom-components/src/button-group.ts @@ -52,6 +52,8 @@ export interface ButtonGroupItem extends Array { [id: number]: any; } +export type ButtonGroup = (_, args: ButtonGroupArgs, ...buttons: ButtonGroupItem[]) => any; + /** * Higher order function to create a new stateless button group * component, pre-configured via user supplied options. The returned @@ -69,7 +71,7 @@ export interface ButtonGroupItem extends Array { * * @param opts */ -export const buttonGroup = (opts: ButtonGroupOpts) => +export const buttonGroup = (opts: ButtonGroupOpts): ButtonGroup => (_, args: ButtonGroupArgs, ...buttons: ButtonGroupItem[]) => ["div", { ...opts.attribs, ...args.attribs }, ...groupBody(opts, args.disabled, buttons)]; diff --git a/packages/hdom/CHANGELOG.md b/packages/hdom/CHANGELOG.md index 00a2d7ca98..60cf7e8713 100644 --- a/packages/hdom/CHANGELOG.md +++ b/packages/hdom/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.16](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@3.0.15...@thi.ng/hdom@3.0.16) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/hdom + ## [3.0.15](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@3.0.14...@thi.ng/hdom@3.0.15) (2018-05-09) diff --git a/packages/hdom/package.json b/packages/hdom/package.json index 71037f1350..a44d35b472 100644 --- a/packages/hdom/package.json +++ b/packages/hdom/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hdom", - "version": "3.0.15", + "version": "3.0.16", "description": "Lightweight vanilla ES6 UI component & virtual DOM system", "main": "./index.js", "typings": "./index.d.ts", @@ -16,7 +16,7 @@ "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" }, "devDependencies": { - "@thi.ng/atom": "^1.3.7", + "@thi.ng/atom": "^1.3.8", "@types/mocha": "^5.2.0", "@types/node": "^10.0.6", "mocha": "^5.1.1", @@ -25,10 +25,12 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/diff": "^1.0.11", - "@thi.ng/hiccup": "^1.3.13", - "@thi.ng/iterators": "^4.1.10" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/diff": "^1.0.12", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/hiccup": "^1.3.14", + "@thi.ng/iterators": "^4.1.11" }, "keywords": [ "browser", @@ -37,8 +39,8 @@ "ES6", "reactive", "typescript", - "ui", - "vdom" + "UI", + "VDOM" ], "publishConfig": { "access": "public" diff --git a/packages/hdom/src/diff.ts b/packages/hdom/src/diff.ts index d122294f6b..496768f4fc 100644 --- a/packages/hdom/src/diff.ts +++ b/packages/hdom/src/diff.ts @@ -1,4 +1,4 @@ -import { equiv } from "@thi.ng/api/equiv"; +import { equiv } from "@thi.ng/equiv"; import * as isa from "@thi.ng/checks/is-array"; import * as iss from "@thi.ng/checks/is-string"; import * as diff from "@thi.ng/diff"; diff --git a/packages/hdom/src/normalize.ts b/packages/hdom/src/normalize.ts index b79e4197a2..0d0e895651 100644 --- a/packages/hdom/src/normalize.ts +++ b/packages/hdom/src/normalize.ts @@ -1,4 +1,4 @@ -import { illegalArgs } from "@thi.ng/api/error"; +import { illegalArgs } from "@thi.ng/errors"; import * as impf from "@thi.ng/checks/implements-function"; import * as isa from "@thi.ng/checks/is-array"; import * as isf from "@thi.ng/checks/is-function"; diff --git a/packages/heaps/CHANGELOG.md b/packages/heaps/CHANGELOG.md index b23695772d..5cc8ad7c71 100644 --- a/packages/heaps/CHANGELOG.md +++ b/packages/heaps/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.2.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/heaps@0.2.6...@thi.ng/heaps@0.2.7) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/heaps + ## [0.2.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/heaps@0.2.5...@thi.ng/heaps@0.2.6) (2018-05-09) diff --git a/packages/heaps/package.json b/packages/heaps/package.json index 7d24c51a29..7ffc6659b9 100644 --- a/packages/heaps/package.json +++ b/packages/heaps/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/heaps", - "version": "0.2.6", + "version": "0.2.7", "description": "Generic binary heap & d-ary heap implementations with customizable ordering", "main": "./index.js", "typings": "./index.d.ts", @@ -24,7 +24,8 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2" + "@thi.ng/api": "^3.0.0", + "@thi.ng/compare": "^0.1.0" }, "keywords": [ "data structure", diff --git a/packages/heaps/src/dheap.ts b/packages/heaps/src/dheap.ts index a33a137694..87c5dea5b1 100644 --- a/packages/heaps/src/dheap.ts +++ b/packages/heaps/src/dheap.ts @@ -1,5 +1,5 @@ import { ICopy, IEmpty } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { DHeapOpts } from "./api"; import { Heap } from "./heap"; @@ -7,7 +7,7 @@ import { Heap } from "./heap"; /** * Generic d-ary heap / priority queue with configurable arity (default * = 4) and ordering via user-supplied comparator. By default, - * implements min-heap ordering and uses @thi.ng/api/compare. The arity + * implements min-heap ordering and uses @thi.ng/compare. The arity * `d` must be >= 2. If `d=2`, the default binary `Heap` implementation * will be faster. * diff --git a/packages/heaps/src/heap.ts b/packages/heaps/src/heap.ts index 98ad30231e..8c8f08abf5 100644 --- a/packages/heaps/src/heap.ts +++ b/packages/heaps/src/heap.ts @@ -4,14 +4,14 @@ import { IEmpty, ILength } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { HeapOpts } from "./api"; /** * Generic binary heap / priority queue with customizable ordering via * user-supplied comparator. By default, implements min-heap ordering - * and uses @thi.ng/api/compare. + * and uses @thi.ng/compare. * * ``` * h = new Heap([20, 5, 10]); diff --git a/packages/heaps/test/dheap.ts b/packages/heaps/test/dheap.ts index 97381b8c38..8dabf81280 100644 --- a/packages/heaps/test/dheap.ts +++ b/packages/heaps/test/dheap.ts @@ -1,6 +1,6 @@ import * as assert from "assert"; import { DHeap } from "../src/index"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; describe("DHeap", () => { diff --git a/packages/heaps/test/heap.ts b/packages/heaps/test/heap.ts index eeaebe72cd..8a90c2ee7c 100644 --- a/packages/heaps/test/heap.ts +++ b/packages/heaps/test/heap.ts @@ -1,6 +1,6 @@ import * as assert from "assert"; import { Heap } from "../src/index"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; describe("Heap", () => { diff --git a/packages/hiccup-css/CHANGELOG.md b/packages/hiccup-css/CHANGELOG.md index c8315686d8..a8f7b37e5b 100644 --- a/packages/hiccup-css/CHANGELOG.md +++ b/packages/hiccup-css/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.16](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-css@0.1.15...@thi.ng/hiccup-css@0.1.16) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/hiccup-css + ## [0.1.15](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-css@0.1.14...@thi.ng/hiccup-css@0.1.15) (2018-05-09) diff --git a/packages/hiccup-css/package.json b/packages/hiccup-css/package.json index 17c5a02a6b..f08339dd38 100644 --- a/packages/hiccup-css/package.json +++ b/packages/hiccup-css/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hiccup-css", - "version": "0.1.15", + "version": "0.1.16", "description": "CSS from nested JS data structures", "main": "./index.js", "typings": "./index.d.ts", @@ -24,8 +24,10 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/transducers": "^1.8.5" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/transducers": "^1.8.6" }, "keywords": [ "clojure", diff --git a/packages/hiccup-css/src/impl.ts b/packages/hiccup-css/src/impl.ts index 86af745069..591ca499fe 100644 --- a/packages/hiccup-css/src/impl.ts +++ b/packages/hiccup-css/src/impl.ts @@ -1,9 +1,9 @@ -import { illegalArgs } from "@thi.ng/api/error"; import { isArray } from "@thi.ng/checks/is-array"; import { isFunction } from "@thi.ng/checks/is-function"; import { isIterable } from "@thi.ng/checks/is-iterable"; import { isPlainObject } from "@thi.ng/checks/is-plain-object"; import { isString } from "@thi.ng/checks/is-string"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { permutations } from "@thi.ng/transducers/iter/permutations"; import { repeat } from "@thi.ng/transducers/iter/repeat"; import { str } from "@thi.ng/transducers/rfn/str"; diff --git a/packages/hiccup-svg/CHANGELOG.md b/packages/hiccup-svg/CHANGELOG.md index 25ed853408..c83122bd54 100644 --- a/packages/hiccup-svg/CHANGELOG.md +++ b/packages/hiccup-svg/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.2.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-svg@0.2.10...@thi.ng/hiccup-svg@0.2.11) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/hiccup-svg + ## [0.2.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup-svg@0.2.9...@thi.ng/hiccup-svg@0.2.10) (2018-05-09) diff --git a/packages/hiccup-svg/package.json b/packages/hiccup-svg/package.json index af6cf06503..8c15374845 100644 --- a/packages/hiccup-svg/package.json +++ b/packages/hiccup-svg/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hiccup-svg", - "version": "0.2.10", + "version": "0.2.11", "description": "SVG element functions for @thi.ng/hiccup & @thi.ng/hdom", "main": "./index.js", "typings": "./index.d.ts", @@ -24,8 +24,7 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/hiccup": "^1.3.13" + "@thi.ng/hiccup": "^1.3.14" }, "keywords": [ "components", diff --git a/packages/hiccup/CHANGELOG.md b/packages/hiccup/CHANGELOG.md index c92f2bcd31..ac0f3550a5 100644 --- a/packages/hiccup/CHANGELOG.md +++ b/packages/hiccup/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.3.14](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@1.3.13...@thi.ng/hiccup@1.3.14) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/hiccup + ## [1.3.13](https://github.com/thi-ng/umbrella/compare/@thi.ng/hiccup@1.3.12...@thi.ng/hiccup@1.3.13) (2018-05-09) diff --git a/packages/hiccup/package.json b/packages/hiccup/package.json index 10b909e3c8..997b9ca03e 100644 --- a/packages/hiccup/package.json +++ b/packages/hiccup/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/hiccup", - "version": "1.3.13", + "version": "1.3.14", "description": "HTML/SVG/XML serialization of nested data structures, iterables & closures", "main": "./index.js", "typings": "./index.d.ts", @@ -16,7 +16,7 @@ "test": "rm -rf build && tsc -p test && nyc mocha build/test/*.js" }, "devDependencies": { - "@thi.ng/atom": "^1.3.7", + "@thi.ng/atom": "^1.3.8", "@types/mocha": "^5.2.0", "@types/node": "^10.0.6", "mocha": "^5.1.1", @@ -25,8 +25,8 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/checks": "^1.5.2" + "@thi.ng/checks": "^1.5.2", + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "clojure", diff --git a/packages/hiccup/src/serialize.ts b/packages/hiccup/src/serialize.ts index a4dcab3fb1..6a3341ae9b 100644 --- a/packages/hiccup/src/serialize.ts +++ b/packages/hiccup/src/serialize.ts @@ -1,4 +1,4 @@ -import { illegalArgs } from "@thi.ng/api/error"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { implementsFunction } from "@thi.ng/checks/implements-function"; import { isFunction } from "@thi.ng/checks/is-function"; import { isPlainObject } from "@thi.ng/checks/is-plain-object"; diff --git a/packages/interceptors/CHANGELOG.md b/packages/interceptors/CHANGELOG.md index 757faae7a0..7da8ad99c6 100644 --- a/packages/interceptors/CHANGELOG.md +++ b/packages/interceptors/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.7.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/interceptors@1.7.0...@thi.ng/interceptors@1.7.1) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/interceptors + # [1.7.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/interceptors@1.6.2...@thi.ng/interceptors@1.7.0) (2018-05-09) diff --git a/packages/interceptors/package.json b/packages/interceptors/package.json index 05b23d6344..e52948927e 100644 --- a/packages/interceptors/package.json +++ b/packages/interceptors/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/interceptors", - "version": "1.7.0", + "version": "1.7.1", "description": "Interceptor based event bus, side effect & immutable state handling", "main": "./index.js", "typings": "./index.d.ts", @@ -24,9 +24,11 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/atom": "^1.3.7", - "@thi.ng/paths": "^1.3.4" + "@thi.ng/api": "^3.0.0", + "@thi.ng/atom": "^1.3.8", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/paths": "^1.3.5" }, "keywords": [ "ES6", diff --git a/packages/interceptors/src/event-bus.ts b/packages/interceptors/src/event-bus.ts index 28b5f2a2bf..575f3061df 100644 --- a/packages/interceptors/src/event-bus.ts +++ b/packages/interceptors/src/event-bus.ts @@ -1,11 +1,11 @@ import { IDeref, IObjectOf } from "@thi.ng/api/api"; -import { illegalArgs } from "@thi.ng/api/error"; import { IAtom } from "@thi.ng/atom/api"; import { Atom } from "@thi.ng/atom/atom"; import { implementsFunction } from "@thi.ng/checks/implements-function"; import { isArray } from "@thi.ng/checks/is-array"; import { isFunction } from "@thi.ng/checks/is-function"; import { isPromise } from "@thi.ng/checks/is-promise"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { setIn, updateIn } from "@thi.ng/paths"; import * as api from "./api"; diff --git a/packages/iterators/CHANGELOG.md b/packages/iterators/CHANGELOG.md index 6ffcb20902..78291444d5 100644 --- a/packages/iterators/CHANGELOG.md +++ b/packages/iterators/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. + +## [4.1.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/iterators@4.1.10...@thi.ng/iterators@4.1.11) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/iterators + ## [4.1.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/iterators@4.1.9...@thi.ng/iterators@4.1.10) (2018-05-09) diff --git a/packages/iterators/package.json b/packages/iterators/package.json index a1deb8177e..30dee1f335 100644 --- a/packages/iterators/package.json +++ b/packages/iterators/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/iterators", - "version": "4.1.10", + "version": "4.1.11", "description": "clojure.core inspired, composable ES6 iterators & generators", "main": "./index.js", "typings": "./index.d.ts", @@ -24,8 +24,9 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/dcons": "^0.3.4" + "@thi.ng/api": "^3.0.0", + "@thi.ng/dcons": "^0.3.5", + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "clojure", diff --git a/packages/iterators/src/ensure.ts b/packages/iterators/src/ensure.ts index d5018b98f0..d56748c40e 100644 --- a/packages/iterators/src/ensure.ts +++ b/packages/iterators/src/ensure.ts @@ -1,4 +1,4 @@ -import { illegalArgs } from "@thi.ng/api/error"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { iterator } from "./iterator"; diff --git a/packages/iterators/src/fnil.ts b/packages/iterators/src/fnil.ts index a3136f1c20..a0643a91ae 100644 --- a/packages/iterators/src/fnil.ts +++ b/packages/iterators/src/fnil.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors"; export function fnil(fn: (...args: any[]) => any, ...ctors: (() => any)[]) { let [cta, ctb, ctc] = ctors; diff --git a/packages/iterators/src/interleave.ts b/packages/iterators/src/interleave.ts index c36488b97c..bc830f399b 100644 --- a/packages/iterators/src/interleave.ts +++ b/packages/iterators/src/interleave.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { cycle } from "./cycle"; import { iterator } from "./iterator"; diff --git a/packages/iterators/src/partition.ts b/packages/iterators/src/partition.ts index 43929c8a2e..0a5e110e79 100644 --- a/packages/iterators/src/partition.ts +++ b/packages/iterators/src/partition.ts @@ -1,4 +1,4 @@ -import { illegalArgs } from "@thi.ng/api/error"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { consume } from "./consume"; import { iterator } from "./iterator"; diff --git a/packages/paths/CHANGELOG.md b/packages/paths/CHANGELOG.md index f09c3c6140..4aa664e8e2 100644 --- a/packages/paths/CHANGELOG.md +++ b/packages/paths/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.3.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/paths@1.3.4...@thi.ng/paths@1.3.5) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/paths + ## [1.3.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/paths@1.3.3...@thi.ng/paths@1.3.4) (2018-05-09) diff --git a/packages/paths/package.json b/packages/paths/package.json index 3143aadb0e..80db32deb3 100644 --- a/packages/paths/package.json +++ b/packages/paths/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/paths", - "version": "1.3.4", + "version": "1.3.5", "description": "immutable, optimized path-based object property / array accessors", "main": "./index.js", "typings": "./index.d.ts", @@ -24,8 +24,8 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/checks": "^1.5.2" + "@thi.ng/checks": "^1.5.2", + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "accessors", diff --git a/packages/paths/src/index.ts b/packages/paths/src/index.ts index c26366a23f..730c4114e2 100644 --- a/packages/paths/src/index.ts +++ b/packages/paths/src/index.ts @@ -1,6 +1,6 @@ -import { illegalArgs } from "@thi.ng/api/error"; import { isArray } from "@thi.ng/checks/is-array"; import { isString } from "@thi.ng/checks/is-string"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; export type Path = PropertyKey | PropertyKey[]; diff --git a/packages/pointfree-lang/CHANGELOG.md b/packages/pointfree-lang/CHANGELOG.md index eb595f72e1..0f792b95ac 100644 --- a/packages/pointfree-lang/CHANGELOG.md +++ b/packages/pointfree-lang/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.2.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree-lang@0.2.7...@thi.ng/pointfree-lang@0.2.8) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/pointfree-lang + ## [0.2.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree-lang@0.2.6...@thi.ng/pointfree-lang@0.2.7) (2018-05-09) diff --git a/packages/pointfree-lang/package.json b/packages/pointfree-lang/package.json index f3bd2f3ea6..400e169120 100644 --- a/packages/pointfree-lang/package.json +++ b/packages/pointfree-lang/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/pointfree-lang", - "version": "0.2.7", + "version": "0.2.8", "description": "Forth style syntax layer/compiler for the @thi.ng/pointfree DSL", "main": "./index.js", "typings": "./index.d.ts", @@ -26,8 +26,9 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/pointfree": "^0.7.7" + "@thi.ng/api": "^3.0.0", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/pointfree": "^0.7.8" }, "keywords": [ "concatenative", diff --git a/packages/pointfree-lang/src/index.ts b/packages/pointfree-lang/src/index.ts index 11a4a4757e..29771fc7a3 100644 --- a/packages/pointfree-lang/src/index.ts +++ b/packages/pointfree-lang/src/index.ts @@ -1,5 +1,6 @@ import { IObjectOf } from "@thi.ng/api/api"; -import { illegalArgs, illegalState } from "@thi.ng/api/error"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { illegalState } from "@thi.ng/errors/illegal-state"; import * as pf from "@thi.ng/pointfree"; import { diff --git a/packages/pointfree/CHANGELOG.md b/packages/pointfree/CHANGELOG.md index b81f1e3eea..a60a813c37 100644 --- a/packages/pointfree/CHANGELOG.md +++ b/packages/pointfree/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.7.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.7.7...@thi.ng/pointfree@0.7.8) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/pointfree + ## [0.7.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/pointfree@0.7.6...@thi.ng/pointfree@0.7.7) (2018-05-09) diff --git a/packages/pointfree/package.json b/packages/pointfree/package.json index e8ec117157..e5e36b1a94 100644 --- a/packages/pointfree/package.json +++ b/packages/pointfree/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/pointfree", - "version": "0.7.7", + "version": "0.7.8", "description": "Pointfree functional composition / Forth style stack execution engine", "main": "./index.js", "typings": "./index.d.ts", @@ -24,7 +24,10 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "composition", diff --git a/packages/pointfree/src/index.ts b/packages/pointfree/src/index.ts index 811fa9e125..8129bd25b5 100644 --- a/packages/pointfree/src/index.ts +++ b/packages/pointfree/src/index.ts @@ -1,9 +1,10 @@ import { IObjectOf } from "@thi.ng/api/api"; -import { equiv as _equiv } from "@thi.ng/api/equiv"; -import { illegalArgs, illegalState } from "@thi.ng/api/error"; import { isArray } from "@thi.ng/checks/is-array"; import { isFunction } from "@thi.ng/checks/is-function"; import { isPlainObject } from "@thi.ng/checks/is-plain-object"; +import { equiv as _equiv } from "@thi.ng/equiv"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { illegalState } from "@thi.ng/errors/illegal-state"; import { Stack, diff --git a/packages/resolve-map/CHANGELOG.md b/packages/resolve-map/CHANGELOG.md index e8c0c18509..8ed64e1fcc 100644 --- a/packages/resolve-map/CHANGELOG.md +++ b/packages/resolve-map/CHANGELOG.md @@ -3,7 +3,35 @@ All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines. - + +## [2.0.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/resolve-map@2.0.0...@thi.ng/resolve-map@2.0.1) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/resolve-map + + +# [2.0.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/resolve-map@1.0.5...@thi.ng/resolve-map@2.0.0) (2018-05-09) + + +### Code Refactoring + +* **resolve-map:** fix [#21](https://github.com/thi-ng/umbrella/issues/21) ([5d2a3fe](https://github.com/thi-ng/umbrella/commit/5d2a3fe)) + + +### BREAKING CHANGES + +* **resolve-map:** update lookup path prefix & separators + +- lookup paths now are prefixed with `@` instead of `->` +- all path segments must be separated by `/` +- update readme & tests + + + + + ## [1.0.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/resolve-map@1.0.4...@thi.ng/resolve-map@1.0.5) (2018-05-09) @@ -11,7 +39,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline **Note:** Version bump only for package @thi.ng/resolve-map - + ## [1.0.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/resolve-map@1.0.3...@thi.ng/resolve-map@1.0.4) (2018-04-29) diff --git a/packages/resolve-map/README.md b/packages/resolve-map/README.md index 099e2f6efc..827caee815 100644 --- a/packages/resolve-map/README.md +++ b/packages/resolve-map/README.md @@ -33,25 +33,28 @@ other refs are recursively resolved (again, provided there are no cycles). Reference values are special strings representing lookup paths of other -values in the object and are prefixed with `->` for relative refs or -`->/` for absolute refs. Relative refs are resolved from currently -visited object and support "../" prefixes to access parent levels. -Absolute refs are always resolved from the root level (the original -object passed to this function). +values in the object and are prefixed with `@` for relative refs or +`@/` for absolute refs and both using `/` as path separator (Note: +trailing slashes are NOT allowed!). Relative refs are resolved from +currently visited object and support "../" prefixes to access any parent +levels. Absolute refs are always resolved from the root level (the +original object passed to this function). ```ts -resolveMap({a: 1, b: {c: "->d", d: "->/a"} }) +resolveMap({a: 1, b: {c: "@d", d: "@/a"} }) // { a: 1, b: { c: 1, d: 1 } } ``` If a value is a function, it is called with a single arg `resolve`, a -function which accepts a path (**without `->` prefix**) to look up other +function which accepts a path (**without `@` prefix**) to look up other values. The return value of the user provided function is used as final value for that key. This mechanism can be used to compute derived values -of other values stored in the object. Function values will always be -called only once. Therefore, in order to associate a function as value -to a key, it needs to be wrapped with an additional function, as shown -for the `e` key in the example below. +of other values stored anywhere in the root object. **Function values +will always be called only once.** Therefore, in order to associate a +function as value to a key, it needs to be wrapped with an additional +function, as shown for the `e` key in the example below. Similarly, if +an actual string value should happen to start with `@`, it needs to be +wrapped in a function (see `f` key below). ```ts // `a` is derived from 1st array element in `b.d` @@ -59,11 +62,12 @@ for the `e` key in the example below. // `b.d[1]` is derived from calling `e(2)` // `e` is a wrapped function res = resolveMap({ - a: (resolve) => resolve("b.c") * 100, - b: { c: "->d.0", d: [2, (resolve) => resolve("../../e")(2) ] }, + a: (resolve) => resolve("b/c") * 100, + b: { c: "@d/0", d: [2, (resolve) => resolve("../../e")(2) ] }, e: () => (x) => x * 10, + f: () => "@foo", }) -// { a: 200, b: { c: 2, d: [ 2, 20 ] }, e: [Function] } +// { a: 200, b: { c: 2, d: [ 2, 20 ] }, e: [Function], f: "@foo" } res.e(2); // 20 @@ -90,18 +94,18 @@ resolveMap({ fontsizes: [12, 16, 20] }, button: { - bg: "->/colors.text", - label: "->/colors.bg", + bg: "@/colors/text", + label: "@/colors/bg", // resolve with abs path inside fn - fontsize: (resolve) => `${resolve("/main.fontsizes.0")}px`, + fontsize: (resolve) => `${resolve("/main/fontsizes/0")}px`, }, buttonPrimary: { - bg: "->/colors.selected", - label: "->/button.label", + bg: "@/colors/selected", + label: "@/button/label", // resolve with relative path inside fn - fontsize: (resolve) => `${resolve("../main.fontsizes.2")}px`, + fontsize: (resolve) => `${resolve("../main/fontsizes/2")}px`, } -}) +}); // { // colors: { // bg: "white", diff --git a/packages/resolve-map/package.json b/packages/resolve-map/package.json index 3bb2f7a57a..6da9612c3e 100644 --- a/packages/resolve-map/package.json +++ b/packages/resolve-map/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/resolve-map", - "version": "1.0.5", + "version": "2.0.1", "description": "DAG resolution of vanilla objects & arrays with internally linked values", "main": "./index.js", "typings": "./index.d.ts", @@ -22,9 +22,9 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", "@thi.ng/checks": "^1.5.2", - "@thi.ng/paths": "^1.3.4" + "@thi.ng/errors": "^0.1.0", + "@thi.ng/paths": "^1.3.5" }, "keywords": [ "configuration", diff --git a/packages/resolve-map/src/index.ts b/packages/resolve-map/src/index.ts index a7f0d12731..cb5b4eadbb 100644 --- a/packages/resolve-map/src/index.ts +++ b/packages/resolve-map/src/index.ts @@ -1,52 +1,57 @@ -import { illegalArgs } from "@thi.ng/api/error"; import { isArray } from "@thi.ng/checks/is-array"; import { isFunction } from "@thi.ng/checks/is-function"; import { isPlainObject } from "@thi.ng/checks/is-plain-object"; import { isString } from "@thi.ng/checks/is-string"; -import { getIn, mutIn, toPath } from "@thi.ng/paths"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { getIn, mutIn } from "@thi.ng/paths"; const SEMAPHORE = Symbol("SEMAPHORE"); /** - * Visits all key-value pairs in depth-first order for given object and - * expands any reference values. Cyclic references are not allowed or - * checked for and if present will cause a stack overflow error. - * However, refs pointing to other refs are recursively resolved (again, - * provided there are no cycles). + * Visits all key-value pairs in depth-first order for given object or + * array, expands any reference values, mutates the original object and + * returns it. Cyclic references are not allowed or checked for and if + * present will cause a stack overflow error. However, refs pointing to + * other refs are recursively resolved (again, provided there are no + * cycles). * * Reference values are special strings representing lookup paths of - * other values in the object and are prefixed with `->` for relative - * refs or `->/` for absolute refs. Relative refs are resolved from - * currently visited object and support "../" prefixes to access parent - * levels. Absolute refs are always resolved from the root level (the - * original object passed to this function). Invalid lookup paths will - * throw an error. + * other values in the object and are prefixed with `@` for relative + * refs or `@/` for absolute refs and both using `/` as path separator + * (Note: trailing slashes are NOT allowed!). Relative refs are resolved + * from currently visited object and support "../" prefixes to access + * any parent levels. Absolute refs are always resolved from the root + * level (the original object passed to this function). * - * ``` - * resolveMap({a: 1, b: {c: "->d", d: "->/a"} }) + * ```ts + * resolveMap({a: 1, b: {c: "@d", d: "@/a"} }) * // { a: 1, b: { c: 1, d: 1 } } * ``` * * If a value is a function, it is called with a single arg `resolve`, a - * function which accepts a path (WITHOUT `->` prefix) to look up other - * values. The return value of the user provided function is used as - * final value for that key. This mechanism can be used to compute - * derived values of other values stored in the object. Function values - * will always be called only once. Therefore, in order to associate a - * function as value to a key, it needs to be wrapped with an additional - * function, as shown for the `e` key in the example below. + * function which accepts a path (**without `@` prefix**) to look up + * other values. The return value of the user provided function is used + * as final value for that key. This mechanism can be used to compute + * derived values of other values stored anywhere in the root object. + * **Function values will always be called only once.** Therefore, in + * order to associate a function as value to a key, it needs to be + * wrapped with an additional function, as shown for the `e` key in the + * example below. Similarly, if an actual string value should happen to + * start with `@`, it needs to be wrapped in a function (see `f` key + * below). * - * ``` + * ```ts * // `a` is derived from 1st array element in `b.d` * // `b.c` is looked up from `b.d[0]` * // `b.d[1]` is derived from calling `e(2)` * // `e` is a wrapped function * res = resolveMap({ - * a: (resolve) => resolve("b.c") * 100, - * b: { c: "->d.0", d: [2, (resolve) => resolve("../../e")(2) ] }, + * a: (resolve) => resolve("b/c") * 100, + * b: { c: "@d/0", d: [2, (resolve) => resolve("../../e")(2) ] }, * e: () => (x) => x * 10, + * f: () => "@foo", * }) - * // { a: 200, b: { c: 2, d: [ 2, 20 ] }, e: [Function] } + * // { a: 200, b: { c: 2, d: [ 2, 20 ] }, e: [Function], f: "@foo" } * * res.e(2); * // 20 @@ -84,9 +89,9 @@ const resolveArray = (arr: any[], root?: any, path: PropertyKey[] = [], resolved const _resolve = (root: any, path: PropertyKey[], resolved: any) => { let v = getIn(root, path), rv = SEMAPHORE; - const pp = path.join("."); + const pp = path.join("/"); if (!resolved[pp]) { - if (isString(v) && v.indexOf("->") === 0) { + if (isString(v) && v.charAt(0) === "@") { rv = _resolve(root, absPath(path, v), resolved); } else if (isPlainObject(v)) { resolveMap(v, root, path, resolved); @@ -104,9 +109,9 @@ const _resolve = (root: any, path: PropertyKey[], resolved: any) => { return v; } -const absPath = (curr: PropertyKey[], q: string, idx = 2): PropertyKey[] => { +const absPath = (curr: PropertyKey[], q: string, idx = 1): PropertyKey[] => { if (q.charAt(idx) === "/") { - return toPath(q.substr(idx + 1)); + return q.substr(idx + 1).split("/"); } curr = curr.slice(0, curr.length - 1); const sub = q.substr(idx).split("/"); @@ -115,7 +120,7 @@ const absPath = (curr: PropertyKey[], q: string, idx = 2): PropertyKey[] => { !curr.length && illegalArgs(`invalid lookup path`); curr.pop(); } else { - return curr.concat(toPath(sub[i])); + return curr.concat(sub.slice(i)); } } !curr.length && illegalArgs(`invalid lookup path`); diff --git a/packages/resolve-map/test/index.ts b/packages/resolve-map/test/index.ts index 7bea83a5d4..ba4bcca815 100644 --- a/packages/resolve-map/test/index.ts +++ b/packages/resolve-map/test/index.ts @@ -5,53 +5,53 @@ describe("resolve-map", () => { it("simple", () => { assert.deepEqual( - resolveMap({ a: 1, b: "->a" }), + resolveMap({ a: 1, b: "@a" }), { a: 1, b: 1 } ); }); it("linked refs", () => { assert.deepEqual( - resolveMap({ a: "->c", b: "->a", c: 1 }), + resolveMap({ a: "@c", b: "@a", c: 1 }), { a: 1, b: 1, c: 1 } ); }); it("array refs", () => { assert.deepEqual( - resolveMap({ a: "->c.1", b: "->a", c: [1, 2] }), + resolveMap({ a: "@c/1", b: "@a", c: [1, 2] }), { a: 2, b: 2, c: [1, 2] } ); }); it("abs vs rel refs", () => { assert.deepEqual( - resolveMap({ a1: { b: 1, c: "->b" }, a2: { b: 2, c: "->b" }, a3: { b: 3, c: "->/a1.b" } }), + resolveMap({ a1: { b: 1, c: "@b" }, a2: { b: 2, c: "@b" }, a3: { b: 3, c: "@/a1/b" } }), { a1: { b: 1, c: 1 }, a2: { b: 2, c: 2 }, a3: { b: 3, c: 1 } } ); }); it("rel parent refs", () => { assert.deepEqual( - resolveMap({ a: { b: { c: "->../c.d", d: "->c", e: "->/c.d" }, c: { d: 1 } }, c: { d: 10 } }), + resolveMap({ a: { b: { c: "@../c/d", d: "@c", e: "@/c/d" }, c: { d: 1 } }, c: { d: 10 } }), { a: { b: { c: 1, d: 1, e: 10 }, c: { d: 1 } }, c: { d: 10 } } ); }) it("cycles", () => { - assert.throws(() => resolveMap({ a: "->a" })); - assert.throws(() => resolveMap({ a: { b: "->b" } })); - assert.throws(() => resolveMap({ a: { b: "->/a" } })); - assert.throws(() => resolveMap({ a: { b: "->/a.b" } })); - assert.throws(() => resolveMap({ a: "->b", b: "->a" })); + assert.throws(() => resolveMap({ a: "@a" })); + assert.throws(() => resolveMap({ a: { b: "@b" } })); + assert.throws(() => resolveMap({ a: { b: "@/a" } })); + assert.throws(() => resolveMap({ a: { b: "@/a/b" } })); + assert.throws(() => resolveMap({ a: "@b", b: "@a" })); }); it("function refs", () => { assert.deepEqual( - resolveMap({ a: (x) => x("b.c") * 10, b: { c: "->d", d: "->/e" }, e: () => 1 }), + resolveMap({ a: (x) => x("b/c") * 10, b: { c: "@d", d: "@/e" }, e: () => 1 }), { a: 10, b: { c: 1, d: 1 }, e: 1 } ); - const res = resolveMap({ a: (x) => x("b.c")() * 10, b: { c: "->d", d: "->/e" }, e: () => () => 1 }); + const res = resolveMap({ a: (x) => x("b/c")() * 10, b: { c: "@d", d: "@/e" }, e: () => () => 1 }); assert.equal(res.a, 10); assert.strictEqual(res.b.c, res.e); assert.strictEqual(res.b.d, res.e); @@ -61,7 +61,7 @@ describe("resolve-map", () => { it("function resolves only once", () => { let n = 0; assert.deepEqual( - resolveMap({ a: (x) => x("b.c"), b: { c: "->d", d: "->/e" }, e: () => (n++ , 1) }), + resolveMap({ a: (x) => x("b/c"), b: { c: "@d", d: "@/e" }, e: () => (n++ , 1) }), { a: 1, b: { c: 1, d: 1 }, e: 1 } ); assert.equal(n, 1); diff --git a/packages/rle-pack/CHANGELOG.md b/packages/rle-pack/CHANGELOG.md index d258719b84..9302929ae9 100644 --- a/packages/rle-pack/CHANGELOG.md +++ b/packages/rle-pack/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.2.18](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@0.2.17...@thi.ng/rle-pack@0.2.18) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rle-pack + ## [0.2.17](https://github.com/thi-ng/umbrella/compare/@thi.ng/rle-pack@0.2.16...@thi.ng/rle-pack@0.2.17) (2018-05-09) diff --git a/packages/rle-pack/package.json b/packages/rle-pack/package.json index 5521329d27..596dfef445 100644 --- a/packages/rle-pack/package.json +++ b/packages/rle-pack/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rle-pack", - "version": "0.2.17", + "version": "0.2.18", "description": "Binary run-length encoding packer w/ flexible repeat bit widths", "main": "./index.js", "typings": "./index.d.ts", @@ -25,7 +25,7 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/bitstream": "^0.4.8" + "@thi.ng/bitstream": "^0.4.9" }, "keywords": [ "binary", diff --git a/packages/router/CHANGELOG.md b/packages/router/CHANGELOG.md index 4a0ae7e73f..5dc15ef252 100644 --- a/packages/router/CHANGELOG.md +++ b/packages/router/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.11](https://github.com/thi-ng/umbrella/compare/@thi.ng/router@0.1.10...@thi.ng/router@0.1.11) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/router + ## [0.1.10](https://github.com/thi-ng/umbrella/compare/@thi.ng/router@0.1.9...@thi.ng/router@0.1.10) (2018-05-09) diff --git a/packages/router/package.json b/packages/router/package.json index 51e2b052af..ebae1dfd11 100644 --- a/packages/router/package.json +++ b/packages/router/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/router", - "version": "0.1.10", + "version": "0.1.11", "description": "Generic router for browser & non-browser based applications", "main": "./index.js", "typings": "./index.d.ts", @@ -23,7 +23,10 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "declarative", diff --git a/packages/router/src/basic.ts b/packages/router/src/basic.ts index b583c38547..2da88c3f25 100644 --- a/packages/router/src/basic.ts +++ b/packages/router/src/basic.ts @@ -4,18 +4,19 @@ import { IObjectOf, Listener } from "@thi.ng/api/api"; -import { equiv } from "@thi.ng/api/equiv"; -import { illegalArgs, illegalArity } from "@thi.ng/api/error"; import * as mixin from "@thi.ng/api/mixins/inotify"; import { isString } from "@thi.ng/checks/is-string"; +import { equiv } from "@thi.ng/equiv"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { + EVENT_ROUTE_CHANGED, Route, RouteMatch, RouteParamValidator, RouterConfig } from "./api"; -import { EVENT_ROUTE_CHANGED } from "./api"; @mixin.INotify export class BasicRouter implements diff --git a/packages/router/src/history.ts b/packages/router/src/history.ts index c23bb852bd..cda5674682 100644 --- a/packages/router/src/history.ts +++ b/packages/router/src/history.ts @@ -1,5 +1,5 @@ -import { equiv } from "@thi.ng/api/equiv"; -import { illegalArity } from "@thi.ng/api/error"; +import { equiv } from "@thi.ng/equiv"; +import { illegalArity } from "@thi.ng/errors"; import { isString } from "@thi.ng/checks/is-string"; import { HTMLRouterConfig, RouteMatch, RouterConfig } from "./api"; diff --git a/packages/rstream-csp/CHANGELOG.md b/packages/rstream-csp/CHANGELOG.md index 344fe13974..57a9ab6997 100644 --- a/packages/rstream-csp/CHANGELOG.md +++ b/packages/rstream-csp/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.65](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.64...@thi.ng/rstream-csp@0.1.65) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rstream-csp + ## [0.1.64](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-csp@0.1.63...@thi.ng/rstream-csp@0.1.64) (2018-05-09) diff --git a/packages/rstream-csp/package.json b/packages/rstream-csp/package.json index c28f06754f..0cba26532b 100644 --- a/packages/rstream-csp/package.json +++ b/packages/rstream-csp/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-csp", - "version": "0.1.64", + "version": "0.1.65", "description": "@thi.ng/csp bridge module for @thi.ng/rstream", "main": "./index.js", "typings": "./index.d.ts", @@ -24,8 +24,8 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/csp": "^0.3.33", - "@thi.ng/rstream": "^1.6.5" + "@thi.ng/csp": "^0.3.34", + "@thi.ng/rstream": "^1.6.6" }, "keywords": [ "bridge", diff --git a/packages/rstream-dot/CHANGELOG.md b/packages/rstream-dot/CHANGELOG.md index 8dc941dfda..a43e662c8c 100644 --- a/packages/rstream-dot/CHANGELOG.md +++ b/packages/rstream-dot/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.2.4](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-dot@0.2.3...@thi.ng/rstream-dot@0.2.4) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rstream-dot + ## [0.2.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-dot@0.2.2...@thi.ng/rstream-dot@0.2.3) (2018-05-09) diff --git a/packages/rstream-dot/package.json b/packages/rstream-dot/package.json index a5a208f9b4..a35d0a842e 100644 --- a/packages/rstream-dot/package.json +++ b/packages/rstream-dot/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-dot", - "version": "0.2.3", + "version": "0.2.4", "description": "Graphviz DOT conversion of @thi.ng/rstream dataflow graph topologies", "main": "./index.js", "typings": "./index.d.ts", @@ -24,9 +24,7 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/rstream": "^1.6.5", - "@thi.ng/transducers": "^1.8.5" + "@thi.ng/rstream": "^1.6.6" }, "keywords": [ "conversion", diff --git a/packages/rstream-gestures/CHANGELOG.md b/packages/rstream-gestures/CHANGELOG.md index 9c7258e415..8bdd6b614f 100644 --- a/packages/rstream-gestures/CHANGELOG.md +++ b/packages/rstream-gestures/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.3.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-gestures@0.3.0...@thi.ng/rstream-gestures@0.3.1) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rstream-gestures + # [0.3.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-gestures@0.2.5...@thi.ng/rstream-gestures@0.3.0) (2018-05-09) diff --git a/packages/rstream-gestures/package.json b/packages/rstream-gestures/package.json index 64dff7eb9b..b12aef0bed 100644 --- a/packages/rstream-gestures/package.json +++ b/packages/rstream-gestures/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-gestures", - "version": "0.3.0", + "version": "0.3.1", "description": "Unified mouse, mouse wheel & single-touch event stream abstraction", "main": "./index.js", "typings": "./index.d.ts", @@ -24,9 +24,9 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/rstream": "^1.6.5", - "@thi.ng/transducers": "^1.8.5" + "@thi.ng/api": "^3.0.0", + "@thi.ng/rstream": "^1.6.6", + "@thi.ng/transducers": "^1.8.6" }, "keywords": [ "dataflow", diff --git a/packages/rstream-graph/CHANGELOG.md b/packages/rstream-graph/CHANGELOG.md index b47e6fc197..1656e6ca9c 100644 --- a/packages/rstream-graph/CHANGELOG.md +++ b/packages/rstream-graph/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.8](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@1.0.7...@thi.ng/rstream-graph@1.0.8) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rstream-graph + + +## [1.0.7](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@1.0.6...@thi.ng/rstream-graph@1.0.7) (2018-05-09) + + + + +**Note:** Version bump only for package @thi.ng/rstream-graph + ## [1.0.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-graph@1.0.5...@thi.ng/rstream-graph@1.0.6) (2018-05-09) diff --git a/packages/rstream-graph/package.json b/packages/rstream-graph/package.json index 5db1288a13..b1ccb5ba07 100644 --- a/packages/rstream-graph/package.json +++ b/packages/rstream-graph/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-graph", - "version": "1.0.6", + "version": "1.0.8", "description": "Declarative dataflow graph construction for @thi.ng/rstream", "main": "./index.js", "typings": "./index.d.ts", @@ -24,11 +24,13 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/paths": "^1.3.4", - "@thi.ng/resolve-map": "^1.0.5", - "@thi.ng/rstream": "^1.6.5", - "@thi.ng/transducers": "^1.8.5" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/paths": "^1.3.5", + "@thi.ng/resolve-map": "^2.0.1", + "@thi.ng/rstream": "^1.6.6", + "@thi.ng/transducers": "^1.8.6" }, "keywords": [ "compute", diff --git a/packages/rstream-graph/src/graph.ts b/packages/rstream-graph/src/graph.ts index f64dc2b71c..3e18841d41 100644 --- a/packages/rstream-graph/src/graph.ts +++ b/packages/rstream-graph/src/graph.ts @@ -1,7 +1,7 @@ import { IObjectOf } from "@thi.ng/api/api"; -import { illegalArgs } from "@thi.ng/api/error"; import { IAtom } from "@thi.ng/atom/api"; import { isString } from "@thi.ng/checks/is-string"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { resolveMap } from "@thi.ng/resolve-map"; import { ISubscribable } from "@thi.ng/rstream/api"; import { fromIterableSync } from "@thi.ng/rstream/from/iterable"; diff --git a/packages/rstream-log/CHANGELOG.md b/packages/rstream-log/CHANGELOG.md index 49f2c67147..43556b0ede 100644 --- a/packages/rstream-log/CHANGELOG.md +++ b/packages/rstream-log/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.16](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@1.0.15...@thi.ng/rstream-log@1.0.16) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rstream-log + ## [1.0.15](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-log@1.0.14...@thi.ng/rstream-log@1.0.15) (2018-05-09) diff --git a/packages/rstream-log/package.json b/packages/rstream-log/package.json index 2638325cf6..b2eea5f15d 100644 --- a/packages/rstream-log/package.json +++ b/packages/rstream-log/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-log", - "version": "1.0.15", + "version": "1.0.16", "description": "Structured, multilevel & hierarchical loggers based on @thi.ng/rstream", "main": "./index.js", "typings": "./index.d.ts", @@ -24,8 +24,11 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/rstream": "^1.6.5" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/rstream": "^1.6.6", + "@thi.ng/transducers": "^1.8.6" }, "keywords": [ "ES6", diff --git a/packages/rstream-log/src/logger.ts b/packages/rstream-log/src/logger.ts index b9fe503def..3c7b723aef 100644 --- a/packages/rstream-log/src/logger.ts +++ b/packages/rstream-log/src/logger.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { ISubscribable } from "@thi.ng/rstream/api"; import { StreamMerge } from "@thi.ng/rstream/stream-merge"; import { Subscription } from "@thi.ng/rstream/subscription"; diff --git a/packages/rstream-log/src/output/file.ts b/packages/rstream-log/src/output/file.ts index b5a919622c..51dbc51ede 100644 --- a/packages/rstream-log/src/output/file.ts +++ b/packages/rstream-log/src/output/file.ts @@ -1,5 +1,5 @@ -import { unsupported } from "@thi.ng/api/error"; import { isNode } from "@thi.ng/checks/is-node"; +import { unsupported } from "@thi.ng/errors/unsupported"; import { ISubscriber } from "@thi.ng/rstream/api"; export function writeFile(path: string): ISubscriber { diff --git a/packages/rstream-query/CHANGELOG.md b/packages/rstream-query/CHANGELOG.md index dd2b0d43ca..b9a952b5d8 100644 --- a/packages/rstream-query/CHANGELOG.md +++ b/packages/rstream-query/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.3.3](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-query@0.3.2...@thi.ng/rstream-query@0.3.3) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rstream-query + ## [0.3.2](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream-query@0.3.1...@thi.ng/rstream-query@0.3.2) (2018-05-09) diff --git a/packages/rstream-query/package.json b/packages/rstream-query/package.json index 33612fb8f2..b74ce13903 100644 --- a/packages/rstream-query/package.json +++ b/packages/rstream-query/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream-query", - "version": "0.3.2", + "version": "0.3.3", "description": "@thi.ng/rstream based triple store & reactive query engine", "main": "./index.js", "typings": "./index.d.ts", @@ -24,11 +24,14 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/associative": "^0.5.0", - "@thi.ng/rstream": "^1.6.5", - "@thi.ng/rstream-dot": "^0.2.3", - "@thi.ng/transducers": "^1.8.5" + "@thi.ng/api": "^3.0.0", + "@thi.ng/associative": "^0.5.1", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/equiv": "^0.1.0", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/rstream": "^1.6.6", + "@thi.ng/rstream-dot": "^0.2.4", + "@thi.ng/transducers": "^1.8.6" }, "keywords": [ "dataflow", diff --git a/packages/rstream-query/src/store.ts b/packages/rstream-query/src/store.ts index 4337dc2ea4..214ddc01d0 100644 --- a/packages/rstream-query/src/store.ts +++ b/packages/rstream-query/src/store.ts @@ -1,8 +1,8 @@ import { IObjectOf } from "@thi.ng/api/api"; -import { equiv } from "@thi.ng/api/equiv"; -import { illegalArgs } from "@thi.ng/api/error"; import { join } from "@thi.ng/associative"; import { intersection } from "@thi.ng/associative/intersection"; +import { equiv } from "@thi.ng/equiv"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { DotOpts, IToDot, diff --git a/packages/rstream/CHANGELOG.md b/packages/rstream/CHANGELOG.md index 915bf7382a..2df12251fe 100644 --- a/packages/rstream/CHANGELOG.md +++ b/packages/rstream/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.6.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@1.6.5...@thi.ng/rstream@1.6.6) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/rstream + ## [1.6.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/rstream@1.6.4...@thi.ng/rstream@1.6.5) (2018-05-09) diff --git a/packages/rstream/package.json b/packages/rstream/package.json index d4036670de..8832af41bb 100644 --- a/packages/rstream/package.json +++ b/packages/rstream/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/rstream", - "version": "1.6.5", + "version": "1.6.6", "description": "Reactive multi-tap streams, dataflow & transformation pipeline constructs", "main": "./index.js", "typings": "./index.d.ts", @@ -24,10 +24,13 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2", - "@thi.ng/associative": "^0.5.0", - "@thi.ng/atom": "^1.3.7", - "@thi.ng/transducers": "^1.8.5" + "@thi.ng/api": "^3.0.0", + "@thi.ng/associative": "^0.5.1", + "@thi.ng/atom": "^1.3.8", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/errors": "^0.1.0", + "@thi.ng/paths": "^1.3.5", + "@thi.ng/transducers": "^1.8.6" }, "keywords": [ "datastructure", diff --git a/packages/rstream/src/from/view.ts b/packages/rstream/src/from/view.ts index 56e2fc5946..4a2b0cceaa 100644 --- a/packages/rstream/src/from/view.ts +++ b/packages/rstream/src/from/view.ts @@ -10,7 +10,7 @@ import { Stream } from "../stream"; * nested value in atom / cursor and yields stream of its value changes. * Views are readonly versions of Cursors and more lightweight. The view * checks for value changes with given `equiv` predicate - * (`@thi.ng/api/equiv` by default). If the predicate returns a falsy + * (`@thi.ng/equiv` by default). If the predicate returns a falsy * result, the new value is emitted on the stream. The first value * emitted is always the (possibly transformed) current value at the * stream's start time (i.e. when the first subscriber attaches). diff --git a/packages/rstream/src/pubsub.ts b/packages/rstream/src/pubsub.ts index e3334397c7..62b0ff888d 100644 --- a/packages/rstream/src/pubsub.ts +++ b/packages/rstream/src/pubsub.ts @@ -1,6 +1,6 @@ import { Predicate2 } from "@thi.ng/api/api"; -import { unsupported } from "@thi.ng/api/error"; import { EquivMap } from "@thi.ng/associative/equiv-map"; +import { unsupported } from "@thi.ng/errors/unsupported"; import { Transducer } from "@thi.ng/transducers/api"; import { DEBUG, ISubscriber } from "./api"; @@ -35,7 +35,7 @@ export interface PubSubOpts { * returned topic. The actual topic (return value from `topic` fn) can * be of any type, apart from `undefined`. Complex topics (e.g objects / * arrays) are allowed and they're matched with registered topics using - * @thi.ng/api/equiv by default (but customizable via `equiv` option). + * @thi.ng/equiv by default (but customizable via `equiv` option). * Each topic can have any number of subscribers. * * If a transducer is specified for the `PubSub`, it is always applied diff --git a/packages/rstream/src/stream.ts b/packages/rstream/src/stream.ts index aa7f9545a8..25fe200173 100644 --- a/packages/rstream/src/stream.ts +++ b/packages/rstream/src/stream.ts @@ -1,5 +1,5 @@ -import { illegalArity } from "@thi.ng/api/error"; import { isString } from "@thi.ng/checks/is-string"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { Transducer } from "@thi.ng/transducers/api"; import { diff --git a/packages/rstream/src/subscription.ts b/packages/rstream/src/subscription.ts index 6958accf7b..93359b86a4 100644 --- a/packages/rstream/src/subscription.ts +++ b/packages/rstream/src/subscription.ts @@ -1,8 +1,9 @@ import { IDeref } from "@thi.ng/api/api"; -import { illegalArity, illegalState } from "@thi.ng/api/error"; import { implementsFunction } from "@thi.ng/checks/implements-function"; import { isFunction } from "@thi.ng/checks/is-function"; import { isString } from "@thi.ng/checks/is-string"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; +import { illegalState } from "@thi.ng/errors/illegal-state"; import { Reducer, SEMAPHORE, Transducer } from "@thi.ng/transducers/api"; import { comp } from "@thi.ng/transducers/func/comp"; import { isReduced, unreduced } from "@thi.ng/transducers/reduced"; diff --git a/packages/transducers/CHANGELOG.md b/packages/transducers/CHANGELOG.md index 70a6208f8c..b8bb12b55e 100644 --- a/packages/transducers/CHANGELOG.md +++ b/packages/transducers/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.8.6](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.8.5...@thi.ng/transducers@1.8.6) (2018-05-10) + + + + +**Note:** Version bump only for package @thi.ng/transducers + ## [1.8.5](https://github.com/thi-ng/umbrella/compare/@thi.ng/transducers@1.8.4...@thi.ng/transducers@1.8.5) (2018-05-09) diff --git a/packages/transducers/package.json b/packages/transducers/package.json index 752273d519..d96d986a31 100644 --- a/packages/transducers/package.json +++ b/packages/transducers/package.json @@ -1,6 +1,6 @@ { "name": "@thi.ng/transducers", - "version": "1.8.5", + "version": "1.8.6", "description": "Lightweight transducer implementations for ES6 / TypeScript", "main": "./index.js", "typings": "./index.d.ts", @@ -24,7 +24,10 @@ "typescript": "^2.8.3" }, "dependencies": { - "@thi.ng/api": "^2.3.2" + "@thi.ng/api": "^3.0.0", + "@thi.ng/checks": "^1.5.2", + "@thi.ng/compare": "^0.1.0", + "@thi.ng/errors": "^0.1.0" }, "keywords": [ "ES6", diff --git a/packages/transducers/src/func/comp.ts b/packages/transducers/src/func/comp.ts index a61a0cf488..c465c1ff53 100644 --- a/packages/transducers/src/func/comp.ts +++ b/packages/transducers/src/func/comp.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { Transducer } from "../api"; diff --git a/packages/transducers/src/func/ensure-iterable.ts b/packages/transducers/src/func/ensure-iterable.ts index b14e0ec9d1..f481c96398 100644 --- a/packages/transducers/src/func/ensure-iterable.ts +++ b/packages/transducers/src/func/ensure-iterable.ts @@ -1,4 +1,4 @@ -import { illegalArgs } from "@thi.ng/api/error"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; export function ensureIterable(x: any): IterableIterator { if (!(x != null && x[Symbol.iterator])) { diff --git a/packages/transducers/src/iter/permutations.ts b/packages/transducers/src/iter/permutations.ts index d4f4b9e1fd..4e27fee9d0 100644 --- a/packages/transducers/src/iter/permutations.ts +++ b/packages/transducers/src/iter/permutations.ts @@ -1,6 +1,6 @@ -import { illegalArgs } from "@thi.ng/api/error"; import { isArray } from "@thi.ng/checks/is-array"; import { isString } from "@thi.ng/checks/is-string"; +import { illegalArgs } from "@thi.ng/errors/illegal-arguments"; import { range } from "./range"; diff --git a/packages/transducers/src/iter/range2d.ts b/packages/transducers/src/iter/range2d.ts index 0bb2e99e76..ee25d9169f 100644 --- a/packages/transducers/src/iter/range2d.ts +++ b/packages/transducers/src/iter/range2d.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { range } from "./range"; diff --git a/packages/transducers/src/iter/range3d.ts b/packages/transducers/src/iter/range3d.ts index 5fc6f154d3..825d89bcef 100644 --- a/packages/transducers/src/iter/range3d.ts +++ b/packages/transducers/src/iter/range3d.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { range } from "./range"; diff --git a/packages/transducers/src/reduce.ts b/packages/transducers/src/reduce.ts index 42f6fca47b..9107eae37e 100644 --- a/packages/transducers/src/reduce.ts +++ b/packages/transducers/src/reduce.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { Reducer } from "./api"; import { isReduced, unreduced } from "./reduced"; diff --git a/packages/transducers/src/rfn/max-compare.ts b/packages/transducers/src/rfn/max-compare.ts index 285723aef3..9700f9861e 100644 --- a/packages/transducers/src/rfn/max-compare.ts +++ b/packages/transducers/src/rfn/max-compare.ts @@ -1,5 +1,5 @@ import { Comparator } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { Reducer } from "../api"; diff --git a/packages/transducers/src/rfn/min-compare.ts b/packages/transducers/src/rfn/min-compare.ts index 850eedddd1..0ca6da21c8 100644 --- a/packages/transducers/src/rfn/min-compare.ts +++ b/packages/transducers/src/rfn/min-compare.ts @@ -1,5 +1,5 @@ import { Comparator } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { Reducer } from "../api"; diff --git a/packages/transducers/src/transduce.ts b/packages/transducers/src/transduce.ts index fefdf9ff5d..f84ab37574 100644 --- a/packages/transducers/src/transduce.ts +++ b/packages/transducers/src/transduce.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { Reducer, Transducer } from "./api"; import { reduce } from "./reduce"; diff --git a/packages/transducers/src/xform/convolve.ts b/packages/transducers/src/xform/convolve.ts index 6ba378d146..f57783ba7f 100644 --- a/packages/transducers/src/xform/convolve.ts +++ b/packages/transducers/src/xform/convolve.ts @@ -1,4 +1,4 @@ -import { illegalArity } from "@thi.ng/api/error"; +import { illegalArity } from "@thi.ng/errors/illegal-arity"; import { ConvolutionKernel2D, Transducer } from "../api"; import { range2d } from "../iter/range2d"; diff --git a/packages/transducers/src/xform/moving-median.ts b/packages/transducers/src/xform/moving-median.ts index bc13427409..5f06031a12 100644 --- a/packages/transducers/src/xform/moving-median.ts +++ b/packages/transducers/src/xform/moving-median.ts @@ -1,5 +1,5 @@ import { Comparator } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { Transducer } from "../api"; import { comp } from "../func/comp"; diff --git a/packages/transducers/src/xform/partition-sort.ts b/packages/transducers/src/xform/partition-sort.ts index 6d29ca9837..b14f69d72e 100644 --- a/packages/transducers/src/xform/partition-sort.ts +++ b/packages/transducers/src/xform/partition-sort.ts @@ -1,5 +1,5 @@ import { Comparator } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { Transducer } from "../api"; import { comp } from "../func/comp"; diff --git a/packages/transducers/src/xform/stream-sort.ts b/packages/transducers/src/xform/stream-sort.ts index cddf1087b8..87c554a6d3 100644 --- a/packages/transducers/src/xform/stream-sort.ts +++ b/packages/transducers/src/xform/stream-sort.ts @@ -1,5 +1,5 @@ import { Comparator } from "@thi.ng/api/api"; -import { compare } from "@thi.ng/api/compare"; +import { compare } from "@thi.ng/compare"; import { Reducer, Transducer } from "../api"; import { binarySearch } from "../func/binary-search";