uneventful 0.0.6 → 0.0.7

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/README.md CHANGED
@@ -146,7 +146,7 @@ Second, you can also *turn streams into signals*, by passing them to `cached()`.
146
146
  But wait, there's more: Unlike most libraries' "effects", Uneventful's rules *start asynchronously* and can be *independently scheduled*. This means, for example, that it's easy to make rules that run only in, say, animation frames:
147
147
 
148
148
  ```ts
149
- import { rule } from "uneventful";
149
+ import { rule } from "uneventful/signals";
150
150
 
151
151
  /**
152
152
  * An alternate version of rule() that runs in animation frames
@@ -185,7 +185,7 @@ So far, we've highlighted just a handful of Uneventful's coolest and most impact
185
185
  - Play well with state charts, or ignore the charts and just express interactivity directly in code!
186
186
  - Easily control the *timing* of operations, building advanced debouncing and sampling with basic async operators like `sleep()` or by defining rules tied to a scheduler
187
187
 
188
- And at the same time, this has actually been a pretty superficial tour: we haven't gotten into a lot of things like how to actually *use* signals or abort jobs or any other details, really. For those, you'll currently have to dig through the [API Reference](https://uneventful.js.org/modules.html), but there should be more tutorials and guides as time goes on.
188
+ And at the same time, this has actually been a pretty superficial tour: we haven't gotten into a lot of things like how to actually *use* signals or abort jobs or any other details, really. For those, you'll currently have to dig through the [API Reference](https://uneventful.js.org/modules/uneventful.html), but there should be more tutorials and guides as time goes on.
189
189
 
190
190
  (Also, at some point you'll be able to use the "Calibre Connect" Obsidian plugin I'm working on as an example of how to use these things to create responsive search and tame Electron WebFrames while keeping track of whether a connection to a remote server is available, handling logins and background processes and integrating a plugin to a larger application, not to mention controlling lots of features via settings.)
191
191
 
package/dist/utils.d.ts CHANGED
@@ -52,7 +52,7 @@ declare class CallableObject<T extends AnyFunction> extends Function {
52
52
  }
53
53
  interface CallableObject<T extends AnyFunction> extends T {
54
54
  }
55
- declare const CallableObject: () => any;
55
+ declare const CallableObject: any;
56
56
  declare const apply: typeof Reflect.apply;
57
57
 
58
58
  export { CallableObject, apply, isFunction, setMap };
package/dist/utils.mjs CHANGED
@@ -5,13 +5,13 @@ function setMap(map, key, val) {
5
5
  function isFunction(f) {
6
6
  return typeof f === "function";
7
7
  }
8
- const CallableObject = () => Object.assign(
8
+ const CallableObject = /* @__PURE__ */ (() => Object.assign(
9
9
  function CallableObject2(fn) {
10
10
  return Object.setPrototypeOf(fn, new.target.prototype);
11
11
  },
12
12
  { prototype: Function.prototype }
13
13
  // No need to have extra prototypes in the chain
14
- );
14
+ ))();
15
15
  const { apply } = Reflect;
16
16
 
17
17
  export { CallableObject, apply, isFunction, setMap };
@@ -1 +1 @@
1
- {"version":3,"file":"utils.mjs","sources":["../src/utils.ts"],"sourcesContent":["/**\n * Utilities that aren't part of Uneventful's core feature set, but are exposed\n * anyway, because they're boilerplate that can save duplication elsewhere if\n * you happen to need them.\n *\n * @module uneventful/utils\n */\nimport { AnyFunction } from \"./types.ts\";\n\n/**\n * Set a value in a Map or WeakMap, and return the value.\n *\n * Commonly used with constructions like `return map.get(key) ?? setMap(map,\n * key, calculateDefault())`.\n *\n * @template K The type of key accepted by the map\n * @template V The type of value accepted by the map\n */\nexport function setMap<K, V>(map: { set(key: K, val: V): void; }, key: K, val: V) {\n map.set(key, val);\n return val;\n}\n\n/**\n * Is the given value a function? (Shorthand for `typeof f === \"function\"`)\n */\nexport function isFunction(f: any): f is Function {\n return typeof f === \"function\";\n}\n\n/**\n * This class hides the implementation details of inheriting from Function in\n * the documentation. (By default, typedoc exposes all the inherited properties\n * and members, which we don't want. By inheriting from it instead of from\n * Function, we keep the documentation free of unimportant details.)\n *\n * The way this works is that you subclass CallableObject and define a\n * constructor that calls `super(someClosure)` where `someClosure` is a unique\n * function object, which will then pick up any properties or methods defined by\n * the subclass.\n *\n * @template T The call/return signature that instances of the class will\n * implement.\n */\n//@ts-ignore not really a duplicate\nexport declare class CallableObject<T extends AnyFunction> extends Function {\n /**\n * @param fn A unique function or closure, to be passed to super() in a\n * subclass. The function object will gain a prototype from `new.target`,\n * thereby picking up any properties or methods defined by the class,\n * and becoming `this` for the calling constructor.\n *\n * (Note that calling the constructor by any means other than super() from\n * a constructor will result in an error or some other unhelpful result.)\n */\n constructor(fn: T);\n /** @internal */ declare length: number;\n /** @internal */ declare arguments: any;\n /** @internal */ declare caller: Function;\n /** @internal */ declare prototype: any;\n /** @internal */ declare name: string;\n}\n//@ts-ignore CallableObject<T> adheres to the constraint of T in its *implementation*\nexport interface CallableObject<T extends AnyFunction> extends T {\n /** @internal */ [Symbol.hasInstance](value: any): boolean;\n /** @internal */ apply(this: Function, thisArg: any, argArray?: any): any;\n /** @internal */ bind(this: Function, thisArg: any, ...argArray: any[]): any;\n /** @internal */ call(this: Function, thisArg: any, ...argArray: any[]): any;\n /** @internal */ toString(): string;\n}\n//@ts-ignore This is the real implementation of the above declarations\nexport const CallableObject = /* @__PURE__ */ ( () => <typeof CallableObject> Object.assign(\n function CallableObject<T>(fn: T) { return Object.setPrototypeOf(fn, new.target.prototype); },\n {prototype: Function.prototype } // No need to have extra prototypes in the chain\n));\n\nexport const {apply} = Reflect;\n"],"names":[],"mappings":"AAAO,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;AACtC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACpB,EAAE,OAAO,GAAG,CAAC;AACb,CAAC;AACM,SAAS,UAAU,CAAC,CAAC,EAAE;AAC9B,EAAE,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC;AACjC,CAAC;AACW,MAAC,cAAc,GAAG,MAAM,MAAM,CAAC,MAAM;AACjD,EAAE,SAAS,eAAe,CAAC,EAAE,EAAE;AAC/B,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC3D,GAAG;AACH,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE;AACnC;AACA,EAAE;AACU,MAAC,EAAE,KAAK,EAAE,GAAG;;;;"}
1
+ {"version":3,"file":"utils.mjs","sources":["../src/utils.ts"],"sourcesContent":["/**\n * Utilities that aren't part of Uneventful's core feature set, but are exposed\n * anyway, because they're boilerplate that can save duplication elsewhere if\n * you happen to need them.\n *\n * @module uneventful/utils\n */\nimport { AnyFunction } from \"./types.ts\";\n\n/**\n * Set a value in a Map or WeakMap, and return the value.\n *\n * Commonly used with constructions like `return map.get(key) ?? setMap(map,\n * key, calculateDefault())`.\n *\n * @template K The type of key accepted by the map\n * @template V The type of value accepted by the map\n */\nexport function setMap<K, V>(map: { set(key: K, val: V): void; }, key: K, val: V) {\n map.set(key, val);\n return val;\n}\n\n/**\n * Is the given value a function? (Shorthand for `typeof f === \"function\"`)\n */\nexport function isFunction(f: any): f is Function {\n return typeof f === \"function\";\n}\n\n/**\n * This class hides the implementation details of inheriting from Function in\n * the documentation. (By default, typedoc exposes all the inherited properties\n * and members, which we don't want. By inheriting from it instead of from\n * Function, we keep the documentation free of unimportant details.)\n *\n * The way this works is that you subclass CallableObject and define a\n * constructor that calls `super(someClosure)` where `someClosure` is a unique\n * function object, which will then pick up any properties or methods defined by\n * the subclass.\n *\n * @template T The call/return signature that instances of the class will\n * implement.\n */\n//@ts-ignore not really a duplicate\nexport declare class CallableObject<T extends AnyFunction> extends Function {\n /**\n * @param fn A unique function or closure, to be passed to super() in a\n * subclass. The function object will gain a prototype from `new.target`,\n * thereby picking up any properties or methods defined by the class,\n * and becoming `this` for the calling constructor.\n *\n * (Note that calling the constructor by any means other than super() from\n * a constructor will result in an error or some other unhelpful result.)\n */\n constructor(fn: T);\n /** @internal */ declare length: number;\n /** @internal */ declare arguments: any;\n /** @internal */ declare caller: Function;\n /** @internal */ declare prototype: any;\n /** @internal */ declare name: string;\n}\n//@ts-ignore CallableObject<T> adheres to the constraint of T in its *implementation*\nexport interface CallableObject<T extends AnyFunction> extends T {\n /** @internal */ [Symbol.hasInstance](value: any): boolean;\n /** @internal */ apply(this: Function, thisArg: any, argArray?: any): any;\n /** @internal */ bind(this: Function, thisArg: any, ...argArray: any[]): any;\n /** @internal */ call(this: Function, thisArg: any, ...argArray: any[]): any;\n /** @internal */ toString(): string;\n}\n//@ts-ignore This is the real implementation of the above declarations\nexport const CallableObject = /* @__PURE__ */ ( () => <typeof CallableObject> Object.assign(\n function CallableObject<T>(fn: T) { return Object.setPrototypeOf(fn, new.target.prototype); },\n {prototype: Function.prototype } // No need to have extra prototypes in the chain\n))();\n\nexport const {apply} = Reflect;\n"],"names":[],"mappings":"AAAO,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE;AACtC,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AACpB,EAAE,OAAO,GAAG,CAAC;AACb,CAAC;AACM,SAAS,UAAU,CAAC,CAAC,EAAE;AAC9B,EAAE,OAAO,OAAO,CAAC,KAAK,UAAU,CAAC;AACjC,CAAC;AACW,MAAC,cAAc,mBAAmB,CAAC,MAAM,MAAM,CAAC,MAAM;AAClE,EAAE,SAAS,eAAe,CAAC,EAAE,EAAE;AAC/B,IAAI,OAAO,MAAM,CAAC,cAAc,CAAC,EAAE,EAAE,GAAG,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;AAC3D,GAAG;AACH,EAAE,EAAE,SAAS,EAAE,QAAQ,CAAC,SAAS,EAAE;AACnC;AACA,CAAC,IAAI;AACO,MAAC,EAAE,KAAK,EAAE,GAAG;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "uneventful",
3
- "version": "0.0.6",
3
+ "version": "0.0.7",
4
4
  "description": "Declarative, event-driven reactivity: signals, streams, structured concurrency, and easy resource cleanup",
5
5
  "keywords": [
6
6
  "signals",