jikan0 0.2.0 → 2.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/README.md CHANGED
@@ -1,19 +1,16 @@
1
- Jikan0 strongly typed exercise timer core library
1
+ # jikan0
2
2
 
3
- Consist of object-oriented Timer interface and functional timer finite state machine API under the hood.
3
+ Convenience exports for the timer engine and stateful adapters.
4
4
 
5
- Timer is modeled as a queue data structure with a `step(n: milliseconds)` function over it.
5
+ ```ts
6
+ import { empty, push, tick } from 'jikan0';
6
7
 
7
- TODO more docs
8
+ const queued = push([{ kind: 'exercise', duration: 1000 }])(empty);
9
+ if (queued.ok) {
10
+ const elapsed = tick(400)(queued.state);
11
+ if (elapsed.ok) console.log(elapsed.state);
12
+ }
13
+ ```
8
14
 
9
- # Publishing
10
-
11
- Npm package exposed API
12
-
13
- `npx nx release p` - will release dependencies
14
-
15
- `npx nx build facade`
16
-
17
- `node tools/scripts/publish.mjs facade 0.0.4 latest`
18
-
19
- used https://github.com/nrwl/nx/issues/4620#issuecomment-1546737883 as build solution for now
15
+ Consumers own state and supply elapsed time. See the [engine](../fsm/README.md)
16
+ and [adapters](../adapters/README.md) for APIs and constraints.
@@ -0,0 +1,5 @@
1
+ export { empty, isEmpty, current, currentNE, tick, push, pop, restart, reset, } from '@jikan0/fsm';
2
+ export { StatefulSimulation as Timer } from '@jikan0/adapters';
3
+ export { MAX_DURATION, MAX_PROGRAM_STAGES, validateDuration, } from '@jikan0/fsm';
4
+ export { createElapsedDriver } from '@jikan0/adapters';
5
+ export type { State, QueueItem, ValidationIssue, TransitionResult, } from '@jikan0/fsm';
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Timer = exports.reset = exports.restart = exports.pop = exports.push = exports.tick = exports.currentNE = exports.current = exports.isEmpty = exports.empty = void 0;
3
+ exports.createElapsedDriver = exports.validateDuration = exports.MAX_PROGRAM_STAGES = exports.MAX_DURATION = exports.Timer = exports.reset = exports.restart = exports.pop = exports.push = exports.tick = exports.currentNE = exports.current = exports.isEmpty = exports.empty = void 0;
4
4
  var fsm_1 = require("@jikan0/fsm");
5
5
  Object.defineProperty(exports, "empty", { enumerable: true, get: function () { return fsm_1.empty; } });
6
6
  Object.defineProperty(exports, "isEmpty", { enumerable: true, get: function () { return fsm_1.isEmpty; } });
@@ -13,4 +13,10 @@ Object.defineProperty(exports, "restart", { enumerable: true, get: function () {
13
13
  Object.defineProperty(exports, "reset", { enumerable: true, get: function () { return fsm_1.reset; } });
14
14
  var adapters_1 = require("@jikan0/adapters");
15
15
  Object.defineProperty(exports, "Timer", { enumerable: true, get: function () { return adapters_1.StatefulSimulation; } });
16
+ var fsm_2 = require("@jikan0/fsm");
17
+ Object.defineProperty(exports, "MAX_DURATION", { enumerable: true, get: function () { return fsm_2.MAX_DURATION; } });
18
+ Object.defineProperty(exports, "MAX_PROGRAM_STAGES", { enumerable: true, get: function () { return fsm_2.MAX_PROGRAM_STAGES; } });
19
+ Object.defineProperty(exports, "validateDuration", { enumerable: true, get: function () { return fsm_2.validateDuration; } });
20
+ var adapters_2 = require("@jikan0/adapters");
21
+ Object.defineProperty(exports, "createElapsedDriver", { enumerable: true, get: function () { return adapters_2.createElapsedDriver; } });
16
22
  //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,mCAUqB;AATnB,4FAAA,KAAK,OAAA;AACL,8FAAA,OAAO,OAAA;AACP,8FAAA,OAAO,OAAA;AACP,gGAAA,SAAS,OAAA;AACT,2FAAA,IAAI,OAAA;AACJ,2FAAA,IAAI,OAAA;AACJ,0FAAA,GAAG,OAAA;AACH,8FAAA,OAAO,OAAA;AACP,4FAAA,KAAK,OAAA;AAGP,6CAA+D;AAAtD,iGAAA,kBAAkB,OAAS;AACpC,mCAIqB;AAHnB,mGAAA,YAAY,OAAA;AACZ,yGAAA,kBAAkB,OAAA;AAClB,uGAAA,gBAAgB,OAAA;AAElB,6CAAuD;AAA9C,+GAAA,mBAAmB,OAAA"}
package/package.json CHANGED
@@ -1,15 +1,40 @@
1
1
  {
2
2
  "name": "jikan0",
3
- "version": "0.2.0",
4
- "dependencies": {
5
- "tslib": "^2.3.0",
6
- "@jikan0/fsm": "1.3.0",
7
- "@jikan0/adapters": "1.3.0"
3
+ "version": "2.0.0",
4
+ "type": "commonjs",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "default": "./dist/index.js"
11
+ }
8
12
  },
13
+ "files": [
14
+ "dist",
15
+ "README.md",
16
+ "LICENSE"
17
+ ],
18
+ "license": "MIT",
19
+ "sideEffects": false,
9
20
  "publishConfig": {
10
- "access": "public"
21
+ "access": "public",
22
+ "registry": "https://registry.npmjs.org/"
11
23
  },
12
- "type": "commonjs",
13
- "main": "./src/index.js",
14
- "typings": "./src/index.d.ts"
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "git+https://github.com/dearlordylord/jikan.git",
27
+ "directory": "facade"
28
+ },
29
+ "scripts": {
30
+ "build": "node ../tools/build-package.cjs",
31
+ "prepack": "cd .. && npx turbo run build --filter=jikan0..."
32
+ },
33
+ "engines": {
34
+ "node": ">=24"
35
+ },
36
+ "dependencies": {
37
+ "@jikan0/adapters": "2.0.0",
38
+ "@jikan0/fsm": "2.0.0"
39
+ }
15
40
  }
package/src/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export { empty, State, QueueItem, isEmpty, current, currentNE, tick, push, pop, restart, reset, } from '@jikan0/fsm';
2
- export { StatefulSimulation as Timer } from '@jikan0/adapters';
package/src/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../facade/src/index.ts"],"names":[],"mappings":";;;AAAA,mCAYqB;AAXnB,4FAAA,KAAK,OAAA;AAGL,8FAAA,OAAO,OAAA;AACP,8FAAA,OAAO,OAAA;AACP,gGAAA,SAAS,OAAA;AACT,2FAAA,IAAI,OAAA;AACJ,2FAAA,IAAI,OAAA;AACJ,0FAAA,GAAG,OAAA;AACH,8FAAA,OAAO,OAAA;AACP,4FAAA,KAAK,OAAA;AAGP,6CAA+D;AAAtD,iGAAA,kBAAkB,OAAS"}