@tko/computed 4.0.0-beta1.0 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,16 +1,6 @@
1
- // @tko/computed 🥊 4.0.0-beta1.0 ESM
2
- export {
3
- computed,
4
- isComputed,
5
- isPureComputed,
6
- pureComputed
7
- } from "./computed";
8
- export {
9
- throttleExtender
10
- } from "./throttleExtender";
11
- export {
12
- proxy
13
- } from "./proxy";
14
- export {
15
- when
16
- } from "./when";
1
+ // @tko/computed 🥊 4.0.0 ESM
2
+ "use strict";
3
+ export { computed, isComputed, isPureComputed, pureComputed } from "./computed";
4
+ export { throttleExtender } from "./throttleExtender";
5
+ export { proxy } from "./proxy";
6
+ export { when } from "./when";
package/dist/index.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["//\n// tko.computed - Exports\n//\n// knockout -> tko changes:\n// Deprecates `dependentObservable` (use `computed`)\n//\n\nexport {\n computed,\n isComputed,\n isPureComputed,\n pureComputed\n} from './computed'\n\nexport {\n throttleExtender\n} from './throttleExtender'\n\nexport {\n proxy\n} from './proxy'\n\nexport {\n when\n} from './when'\n"],
5
- "mappings": ";AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIA;AAAA;AAAA;",
4
+ "sourcesContent": ["//\n// tko.computed - Exports\n//\n// knockout -> tko changes:\n// Deprecates `dependentObservable` (use `computed`)\n//\n\nexport { computed, isComputed, isPureComputed, pureComputed } from './computed'\n\nexport type { Computed } from './computed'\n\nexport { throttleExtender } from './throttleExtender'\n\nexport { proxy } from './proxy'\n\nexport { when } from './when'\n"],
5
+ "mappings": ";;AAOA,SAAS,UAAU,YAAY,gBAAgB,oBAAoB;AAInE,SAAS,wBAAwB;AAEjC,SAAS,aAAa;AAEtB,SAAS,YAAY;",
6
6
  "names": []
7
7
  }
package/dist/index.mjs CHANGED
@@ -1,16 +1,6 @@
1
- // @tko/computed 🥊 4.0.0-beta1.0 MJS
2
- export {
3
- computed,
4
- isComputed,
5
- isPureComputed,
6
- pureComputed
7
- } from "./computed";
8
- export {
9
- throttleExtender
10
- } from "./throttleExtender";
11
- export {
12
- proxy
13
- } from "./proxy";
14
- export {
15
- when
16
- } from "./when";
1
+ // @tko/computed 🥊 4.0.0 MJS
2
+ "use strict";
3
+ export { computed, isComputed, isPureComputed, pureComputed } from "./computed";
4
+ export { throttleExtender } from "./throttleExtender";
5
+ export { proxy } from "./proxy";
6
+ export { when } from "./when";
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
- "sourcesContent": ["//\n// tko.computed - Exports\n//\n// knockout -> tko changes:\n// Deprecates `dependentObservable` (use `computed`)\n//\n\nexport {\n computed,\n isComputed,\n isPureComputed,\n pureComputed\n} from './computed'\n\nexport {\n throttleExtender\n} from './throttleExtender'\n\nexport {\n proxy\n} from './proxy'\n\nexport {\n when\n} from './when'\n"],
5
- "mappings": ";AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIA;AAAA;AAAA;",
4
+ "sourcesContent": ["//\n// tko.computed - Exports\n//\n// knockout -> tko changes:\n// Deprecates `dependentObservable` (use `computed`)\n//\n\nexport { computed, isComputed, isPureComputed, pureComputed } from './computed'\n\nexport type { Computed } from './computed'\n\nexport { throttleExtender } from './throttleExtender'\n\nexport { proxy } from './proxy'\n\nexport { when } from './when'\n"],
5
+ "mappings": ";;AAOA,SAAS,UAAU,YAAY,gBAAgB,oBAAoB;AAInE,SAAS,wBAAwB;AAEjC,SAAS,aAAa;AAEtB,SAAS,YAAY;",
6
6
  "names": []
7
7
  }
package/dist/proxy.js CHANGED
@@ -1,14 +1,9 @@
1
- // @tko/computed 🥊 4.0.0-beta1.0 ESM
2
- import {
3
- observable,
4
- observableArray,
5
- unwrap
6
- } from "@tko/observable";
7
- import {
8
- computed
9
- } from "./computed";
10
- const PROXY_SYM = Symbol("Knockout Proxied Object");
11
- const MIRROR_SYM = Symbol("Knockout Proxied Observables");
1
+ // @tko/computed 🥊 4.0.0 ESM
2
+ "use strict";
3
+ import { observable, observableArray, unwrap } from "@tko/observable";
4
+ import { computed } from "./computed";
5
+ const PROXY_SYM = /* @__PURE__ */ Symbol("Knockout Proxied Object");
6
+ const MIRROR_SYM = /* @__PURE__ */ Symbol("Knockout Proxied Observables");
12
7
  function makeComputed(proxy2, fn) {
13
8
  return computed({
14
9
  owner: proxy2,
@@ -75,10 +70,7 @@ export function proxy(object) {
75
70
  return Object.isExtensible(object);
76
71
  },
77
72
  ownKeys() {
78
- return [
79
- ...Object.getOwnPropertyNames(object),
80
- ...Object.getOwnPropertySymbols(object)
81
- ];
73
+ return [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)];
82
74
  }
83
75
  });
84
76
  assignOrUpdate(mirror, object, proxy2);
package/dist/proxy.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/proxy.ts"],
4
- "sourcesContent": ["/**\n * Create an ES\n */\n\nimport {\n observable, observableArray, unwrap\n} from '@tko/observable'\n\nimport {\n computed\n} from './computed'\n\nconst PROXY_SYM = Symbol('Knockout Proxied Object')\nconst MIRROR_SYM = Symbol('Knockout Proxied Observables')\n\nfunction makeComputed (proxy, fn) {\n return computed({\n owner: proxy,\n read: fn,\n write: fn,\n pure: 'pure' in fn ? fn.pure : true,\n deferEvaluation: 'deferEvaluation' in fn ? fn.deferEvaluation : true\n }).extend({ deferred: true })\n}\n\nfunction setOrCreate (mirror, prop, value, proxy) {\n if (!mirror[prop]) {\n const ctr = Array.isArray(value) ? observableArray\n : typeof value === 'function' ? makeComputed.bind(null, proxy)\n : observable\n mirror[prop] = ctr(value)\n } else {\n mirror[prop](value)\n }\n}\n\nfunction assignOrUpdate(mirror, object, proxy) {\n for (const key of Object.keys(object)) {\n setOrCreate(mirror, key, object[key], proxy)\n }\n return object\n}\n\nexport function proxy (object) {\n const mirror = { [PROXY_SYM]: object }\n mirror[MIRROR_SYM] = mirror\n const proxy = new Proxy(function () {}, {\n has (target, prop) { return prop in mirror },\n get (target, prop) { return unwrap(mirror[prop]) },\n set (target, prop, value, receiver) {\n setOrCreate(mirror, prop, value, proxy)\n object[prop] = value\n return true\n },\n deleteProperty (property) {\n delete mirror[property]\n return delete object[property]\n },\n apply (target, thisArg, [props]) {\n if (props) {\n assignOrUpdate(mirror, props, proxy)\n return Object.assign(object, props)\n }\n return object\n },\n getPrototypeOf () { return Object.getPrototypeOf(object) },\n setPrototypeOf (target, proto) { return Object.setPrototypeOf(object, proto) },\n defineProperty (target, prop, desc) { return Object.defineProperty(object, prop, desc) },\n preventExtensions () { return Object.preventExtensions(object) },\n isExtensible () { return Object.isExtensible(object) },\n ownKeys () {\n return [...Object.getOwnPropertyNames(object),\n ...Object.getOwnPropertySymbols(object)]\n }\n })\n assignOrUpdate(mirror, object, proxy)\n return proxy\n}\n\nexport function getObservable (proxied, prop) { return proxied[MIRROR_SYM][prop] }\nexport function peek (proxied, prop) { return getObservable(proxied, prop).peek() }\nexport function isProxied (proxied) { return PROXY_SYM in proxied }\n\nObject.assign(proxy, { getObservable, peek, isProxied })\n"],
5
- "mappings": ";AAIA;AAAA;AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIA,MAAM,YAAY,OAAO,yBAAyB;AAClD,MAAM,aAAa,OAAO,8BAA8B;AAExD,sBAAuB,QAAO,IAAI;AAChC,SAAO,SAAS;AAAA,IACd,OAAO;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM,UAAU,KAAK,GAAG,OAAO;AAAA,IAC/B,iBAAiB,qBAAqB,KAAK,GAAG,kBAAkB;AAAA,EAClE,CAAC,EAAE,OAAO,EAAE,UAAU,KAAK,CAAC;AAC9B;A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E,aAAO,OAAO,eAAe,QAAQ,MAAM,IAAI;AAAA,IAAE;AAAA,IACvF,oBAAqB;AAAE,aAAO,OAAO,kBAAkB,MAAM;AAAA,IAAE;AAAA,IAC/D,eAAgB;AAAE,aAAO,OAAO,aAAa,MAAM;AAAA,IAAE;AAAA,IACrD,UAAW;AACT,aAAO;AAAA,QAAC,GAAG,OAAO,oBAAoB,MAAM;AAAA,QACpC,GAAG,OAAO,sBAAsB,MAAM;AAAA,MAAC;AAAA,IACjD;AAAA,EACF,CAAC;AACD,iBAAe,QAAQ,QAAQ,MAAK;AACpC,SAAO;AACT;AAEO,8BAAwB,SAAS,MAAM;AAAE,SAAO,QAAQ,YAAY;AAAM;AAC1E,qBAAe,SAAS,MAAM;AAAE,SAAO,cAAc,SAAS,IAAI,EAAE,KAAK;AAAE;AAC3E,0BAAoB,SAAS;AAAE,SAAO,aAAa;AAAQ;AAElE,OAAO,OAAO,OAAO,EAAE,eAAe,MAAM,UAAU,CAAC;",
6
- "names": []
4
+ "sourcesContent": ["/**\n * Create an ES\n */\n\nimport { observable, observableArray, unwrap } from '@tko/observable'\n\nimport { computed } from './computed'\n\nconst PROXY_SYM = Symbol('Knockout Proxied Object')\nconst MIRROR_SYM = Symbol('Knockout Proxied Observables')\n\nfunction makeComputed(proxy, fn) {\n return computed({\n owner: proxy,\n read: fn,\n write: fn,\n pure: 'pure' in fn ? fn.pure : true,\n deferEvaluation: 'deferEvaluation' in fn ? fn.deferEvaluation : true\n }).extend({ deferred: true })\n}\n\nfunction setOrCreate(mirror, prop, value, proxy) {\n if (!mirror[prop]) {\n const ctr = Array.isArray(value)\n ? observableArray\n : typeof value === 'function'\n ? makeComputed.bind(null, proxy)\n : observable\n mirror[prop] = ctr(value)\n } else {\n mirror[prop](value)\n }\n}\n\nfunction assignOrUpdate(mirror, object, proxy) {\n for (const key of Object.keys(object)) {\n setOrCreate(mirror, key, object[key], proxy)\n }\n return object\n}\n\nexport function proxy(object) {\n const mirror = { [PROXY_SYM]: object }\n mirror[MIRROR_SYM] = mirror\n const proxy = new Proxy(function () {}, {\n has(target, prop) {\n return prop in mirror\n },\n get(target, prop) {\n return unwrap(mirror[prop])\n },\n set(target, prop, value, receiver) {\n setOrCreate(mirror, prop, value, proxy)\n object[prop] = value\n return true\n },\n deleteProperty(property) {\n delete mirror[property as any]\n return delete object[property as any]\n },\n apply(target, thisArg, [props]) {\n if (props) {\n assignOrUpdate(mirror, props, proxy)\n return Object.assign(object, props)\n }\n return object\n },\n getPrototypeOf() {\n return Object.getPrototypeOf(object)\n },\n setPrototypeOf(target, proto) {\n return Object.setPrototypeOf(object, proto)\n },\n defineProperty(target, prop, desc) {\n return Object.defineProperty(object, prop, desc)\n },\n preventExtensions() {\n return Object.preventExtensions(object)\n },\n isExtensible() {\n return Object.isExtensible(object)\n },\n ownKeys() {\n return [...Object.getOwnPropertyNames(object), ...Object.getOwnPropertySymbols(object)]\n }\n })\n assignOrUpdate(mirror, object, proxy)\n return proxy\n}\n\nexport function getObservable(proxied, prop) {\n return proxied[MIRROR_SYM][prop]\n}\nexport function peek(proxied, prop) {\n return getObservable(proxied, prop).peek()\n}\nexport function isProxied(proxied) {\n return PROXY_SYM in proxied\n}\n\nObject.assign(proxy, { getObservable, peek, isProxied })\n"],
5
+ "mappings": ";;AAIA,SAAS,YAAY,iBAAiB,cAAc;AAEpD,SAAS,gBAAgB;AAEzB,MAAM,YAAY,uBAAO,yBAAyB;AAClD,MAAM,aAAa,uBAAO,8BAA8B;AAExD,SAAS,aAAaA,QAAO,IAAI;AAC/B,SAAO,SAAS;AAAA,IACd,OAAOA;AAAA,IACP,MAAM;AAAA,IACN,OAAO;AAAA,IACP,MAAM,UAAU,KAAK,GAAG,OAAO;AAAA,IAC/B,iBAAiB,qBAAqB,KAAK,GAAG,kBAAkB;AAAA,EAClE,CAAC,EAAE,OAAO,EAAE,UAAU,KAAK,CAAC;AAC9B;AAEA,SAAS,YAAY,QAAQ,MAAM,OAAOA,QAAO;AAC/C,MAAI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,QAAQ,MAAM,MAAM;AACjC,aAAO,OAAO,eAAe,QAAQ,MAAM,IAAI;AAAA,IACjD;AAAA,IACA,oBAAoB;AAClB,aAAO,OAAO,kBAAkB,MAAM;AAAA,IACxC;AAAA,IACA,eAAe;AACb,aAAO,OAAO,aAAa,MAAM;AAAA,IACnC;AAAA,IACA,UAAU;AACR,aAAO,CAAC,GAAG,OAAO,oBAAoB,MAAM,GAAG,GAAG,OAAO,sBAAsB,MAAM,CAAC;AAAA,IACxF;AAAA,EACF,CAAC;AACD,iBAAe,QAAQ,QAAQA,MAAK;AACpC,SAAOA;AACT;AAEO,gBAAS,cAAc,SAAS,MAAM;AAC3C,SAAO,QAAQ,UAAU,EAAE,IAAI;AACjC;AACO,gBAAS,KAAK,SAAS,MAAM;AAClC,SAAO,cAAc,SAAS,IAAI,EAAE,KAAK;AAC3C;AACO,gBAAS,UAAU,SAAS;AACjC,SAAO,aAAa;AACtB;AAEA,OAAO,OAAO,OAAO,EAAE,eAAe,MAAM,UAAU,CAAC;",
6
+ "names": ["proxy"]
7
7
  }
@@ -1,13 +1,10 @@
1
- // @tko/computed 🥊 4.0.0-beta1.0 ESM
2
- import {
3
- extenders
4
- } from "@tko/observable";
5
- import {
6
- computed
7
- } from "./computed";
1
+ // @tko/computed 🥊 4.0.0 ESM
2
+ "use strict";
3
+ import { extenders as baseExtenders } from "@tko/observable";
4
+ import { computed } from "./computed";
8
5
  export function throttleExtender(target, timeout) {
9
6
  target.throttleEvaluation = timeout;
10
- var writeTimeoutInstance = null;
7
+ let writeTimeoutInstance = void 0;
11
8
  return computed({
12
9
  read: target,
13
10
  write: function(value) {
@@ -18,4 +15,5 @@ export function throttleExtender(target, timeout) {
18
15
  }
19
16
  });
20
17
  }
18
+ const extenders = baseExtenders;
21
19
  extenders.throttle = throttleExtender;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/throttleExtender.ts"],
4
- "sourcesContent": ["import {\n extenders\n} from '@tko/observable'\n\nimport {\n computed\n} from './computed'\n\nexport function throttleExtender (target, timeout) {\n // Throttling means two things:\n\n // (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies\n // notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate\n target.throttleEvaluation = timeout\n\n // (2) For writable targets (observables, or writable dependent observables), we throttle *writes*\n // so the target cannot change value synchronously or faster than a certain rate\n var writeTimeoutInstance = null\n return computed({\n read: target,\n write: function (value) {\n clearTimeout(writeTimeoutInstance)\n writeTimeoutInstance = setTimeout(function () {\n target(value)\n }, timeout)\n }\n })\n}\n\nextenders.throttle = throttleExtender\n"],
5
- "mappings": ";AAAA;AAAA;AAAA;AAIA;AAAA;AAAA;AAIO,iCAA2B,QAAQ,SAAS;AAKjD,SAAO,qBAAqB;AAI5B,MAAI,uBAAuB;AAC3B,SAAO,SAAS;AAAA,IACd,MAAM;AAAA,IACN,OAAO,SAAU,OAAO;AACtB,mBAAa,oBAAoB;AACjC,6BAAuB,WAAW,WAAY;AAC5C,eAAO,KAAK;AAAA,MACd,GAAG,OAAO;AAAA,IACZ;AAAA,EACF,CAAC;AACH;AAEA,UAAU,WAAW;",
4
+ "sourcesContent": ["import { extenders as baseExtenders } from '@tko/observable'\nimport { computed } from './computed'\n\nexport function throttleExtender(target: any, timeout: number) {\n // Throttling means two things:\n\n // (1) For dependent observables, we throttle *evaluations* so that, no matter how fast its dependencies\n // notify updates, the target doesn't re-evaluate (and hence doesn't notify) faster than a certain rate\n target.throttleEvaluation = timeout\n\n // (2) For writable targets (observables, or writable dependent observables), we throttle *writes*\n // so the target cannot change value synchronously or faster than a certain rate\n let writeTimeoutInstance: ReturnType<typeof setTimeout> | undefined = undefined\n return computed({\n read: target,\n write: function (value) {\n clearTimeout(writeTimeoutInstance)\n writeTimeoutInstance = setTimeout(function () {\n target(value)\n }, timeout)\n }\n })\n}\n\nconst extenders = baseExtenders\n\nextenders.throttle = throttleExtender\n"],
5
+ "mappings": ";;AAAA,SAAS,aAAa,qBAAqB;AAC3C,SAAS,gBAAgB;AAElB,gBAAS,iBAAiB,QAAa,SAAiB;AAK7D,SAAO,qBAAqB;AAI5B,MAAI,uBAAkE;AACtE,SAAO,SAAS;AAAA,IACd,MAAM;AAAA,IACN,OAAO,SAAU,OAAO;AACtB,mBAAa,oBAAoB;AACjC,6BAAuB,WAAW,WAAY;AAC5C,eAAO,KAAK;AAAA,MACd,GAAG,OAAO;AAAA,IACZ;AAAA,EACF,CAAC;AACH;AAEA,MAAM,YAAY;AAElB,UAAU,WAAW;",
6
6
  "names": []
7
7
  }
package/dist/when.js CHANGED
@@ -1,7 +1,6 @@
1
- // @tko/computed 🥊 4.0.0-beta1.0 ESM
2
- import {
3
- pureComputed
4
- } from "./computed";
1
+ // @tko/computed 🥊 4.0.0 ESM
2
+ "use strict";
3
+ import { pureComputed } from "./computed";
5
4
  function kowhen(predicate, context, resolve) {
6
5
  const observable = pureComputed(predicate, context).extend({ notify: "always" });
7
6
  const subscription = observable.subscribe((value) => {
package/dist/when.js.map CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/when.ts"],
4
- "sourcesContent": ["\nimport {\n pureComputed\n} from './computed'\n\nfunction kowhen (predicate, context, resolve) {\n const observable = pureComputed(predicate, context).extend({notify: 'always'});\n const subscription = observable.subscribe(value => {\n if (value) {\n subscription.dispose()\n resolve(value)\n }\n })\n // In case the initial value is true, process it right away\n observable.notifySubscribers(observable.peek())\n return subscription\n}\n\nexport function when (predicate, callback, context) {\n const whenFn = kowhen.bind(null, predicate, context)\n return callback ? whenFn(callback.bind(context)) : new Promise(whenFn)\n}\n"],
5
- "mappings": ";AACA;AAAA;AAAA;AAIA,gBAAiB,WAAW,SAAS,SAAS;AAC5C,QAAM,aAAa,aAAa,WAAW,OAAO,EAAE,OAAO,EAAC,QAAQ,SAAQ,CAAC;AAC7E,QAAM,eAAe,WAAW,UAAU,WAAS;AACjD,QAAI,OAAO;AACT,mBAAa,QAAQ;AACrB,cAAQ,KAAK;AAAA,IACf;AAAA,EACF,CAAC;AAED,aAAW,kBAAkB,WAAW,KAAK,CAAC;AAC9C,SAAO;AACT;AAEO,qBAAe,WAAW,UAAU,SAAS;AAClD,QAAM,SAAS,OAAO,KAAK,MAAM,WAAW,OAAO;AACnD,SAAO,WAAW,OAAO,SAAS,KAAK,OAAO,CAAC,IAAI,IAAI,QAAQ,MAAM;AACvE;",
4
+ "sourcesContent": ["import { pureComputed } from './computed'\n\nfunction kowhen(predicate, context, resolve) {\n const observable = pureComputed(predicate, context).extend({ notify: 'always' })\n const subscription = observable.subscribe(value => {\n if (value) {\n subscription.dispose()\n resolve(value)\n }\n })\n // In case the initial value is true, process it right away\n observable.notifySubscribers(observable.peek())\n return subscription\n}\n\nexport function when(predicate, callback, context) {\n const whenFn = kowhen.bind(null, predicate, context)\n return callback ? whenFn(callback.bind(context)) : new Promise(whenFn)\n}\n"],
5
+ "mappings": ";;AAAA,SAAS,oBAAoB;AAE7B,SAAS,OAAO,WAAW,SAAS,SAAS;AAC3C,QAAM,aAAa,aAAa,WAAW,OAAO,EAAE,OAAO,EAAE,QAAQ,SAAS,CAAC;AAC/E,QAAM,eAAe,WAAW,UAAU,WAAS;AACjD,QAAI,OAAO;AACT,mBAAa,QAAQ;AACrB,cAAQ,KAAK;AAAA,IACf;AAAA,EACF,CAAC;AAED,aAAW,kBAAkB,WAAW,KAAK,CAAC;AAC9C,SAAO;AACT;AAEO,gBAAS,KAAK,WAAW,UAAU,SAAS;AACjD,QAAM,SAAS,OAAO,KAAK,MAAM,WAAW,OAAO;AACnD,SAAO,WAAW,OAAO,SAAS,KAAK,OAAO,CAAC,IAAI,IAAI,QAAQ,MAAM;AACvE;",
6
6
  "names": []
7
7
  }
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.0.0-beta1.0",
2
+ "version": "4.0.0",
3
3
  "name": "@tko/computed",
4
4
  "description": "TKO Computed Observables",
5
5
  "module": "dist/computed.js",
@@ -8,8 +8,8 @@
8
8
  "helpers/"
9
9
  ],
10
10
  "dependencies": {
11
- "@tko/observable": "^4.0.0-beta1.0",
12
- "@tko/utils": "^4.0.0-beta1.0",
11
+ "@tko/observable": "^4.0.0",
12
+ "@tko/utils": "^4.0.0",
13
13
  "tslib": "^2.2.0"
14
14
  },
15
15
  "repository": {
@@ -43,6 +43,5 @@
43
43
  "import": "./dist/index.js"
44
44
  },
45
45
  "./helpers/*": "./helpers/*"
46
- },
47
- "gitHead": "99114c4deded3fc5dbddd5c7c9c63c845a18263b"
46
+ }
48
47
  }
package/LICENSE DELETED
@@ -1,22 +0,0 @@
1
- The MIT License (MIT) - http://www.opensource.org/licenses/mit-license.php
2
-
3
- Copyright (c) Steven Sanderson, the Knockout.js team, and other contributors
4
- http://knockoutjs.com/
5
-
6
- Permission is hereby granted, free of charge, to any person obtaining a copy
7
- of this software and associated documentation files (the "Software"), to deal
8
- in the Software without restriction, including without limitation the rights
9
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
- copies of the Software, and to permit persons to whom the Software is
11
- furnished to do so, subject to the following conditions:
12
-
13
- The above copyright notice and this permission notice shall be included in
14
- all copies or substantial portions of the Software.
15
-
16
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22
- THE SOFTWARE.