flinker 1.0.7 → 2.0.1

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.
@@ -1,74 +1,64 @@
1
- var RXSubscriber = /** @class */ (function () {
2
- function RXSubscriber(pipeline) {
1
+ export class RXSubscriber {
2
+ constructor(pipeline) {
3
3
  this._isComplete = false;
4
4
  this.isSubscribed = false;
5
5
  this.pipeline = pipeline;
6
6
  }
7
- Object.defineProperty(RXSubscriber.prototype, "isComplete", {
8
- get: function () { return this._isComplete; },
9
- enumerable: false,
10
- configurable: true
11
- });
12
- RXSubscriber.prototype.send = function (value, broadcast) {
13
- var _a;
7
+ get isComplete() { return this._isComplete; }
8
+ send(value, broadcast) {
14
9
  if (!this._isComplete) {
15
- (_a = this.onReceiveCallback) === null || _a === void 0 ? void 0 : _a.call(this, value);
10
+ this.onReceiveCallback?.(value);
16
11
  }
17
- };
18
- RXSubscriber.prototype.sendError = function (e, broadcast) {
19
- var _a;
12
+ }
13
+ sendError(e, broadcast) {
20
14
  if (!this._isComplete) {
21
- (_a = this.onErrorCallback) === null || _a === void 0 ? void 0 : _a.call(this, e);
15
+ this.onErrorCallback?.(e);
22
16
  }
23
- };
24
- RXSubscriber.prototype.sendComplete = function (broadcast) {
25
- var _a;
17
+ }
18
+ sendComplete(broadcast) {
26
19
  if (!this._isComplete) {
27
20
  this._isComplete = true;
28
- (_a = this.onCompleteCallback) === null || _a === void 0 ? void 0 : _a.call(this);
21
+ this.onCompleteCallback?.();
29
22
  this.unsubscribe();
30
23
  }
31
- };
32
- RXSubscriber.prototype.onReceive = function (f) {
24
+ }
25
+ onReceive(f) {
33
26
  if (this.isComplete)
34
27
  throw new Error('RXSubscriber is complete: It can update onReceiveCallback');
35
28
  else if (this.isSubscribed)
36
29
  throw new Error('RXSubscriber can not update onReceiveCallback: subscribe() is already evoked');
37
30
  this.onReceiveCallback = f;
38
31
  return this;
39
- };
40
- RXSubscriber.prototype.onError = function (f) {
32
+ }
33
+ onError(f) {
41
34
  if (this.isComplete)
42
35
  throw new Error('RXSubscriber is complete: It can not update onErrorCallback');
43
36
  else if (this.isSubscribed)
44
37
  throw new Error('RXSubscriber can not update onErrorCallback: subscribe() is already evoked');
45
38
  this.onErrorCallback = f;
46
39
  return this;
47
- };
48
- RXSubscriber.prototype.onComplete = function (f) {
40
+ }
41
+ onComplete(f) {
49
42
  if (this.isComplete)
50
43
  throw new Error('RXSubscriber is complete: It can not update onCompleteCallback');
51
44
  else if (this.isSubscribed)
52
45
  throw new Error('RXSubscriber can not update onCompleteCallback: subscribe() is already evoked');
53
46
  this.onCompleteCallback = f;
54
47
  return this;
55
- };
56
- RXSubscriber.prototype.subscribe = function () {
57
- var _this = this;
48
+ }
49
+ subscribe() {
58
50
  if (this.isSubscribed)
59
51
  throw new Error('RXPipeline has already a subscriber');
60
52
  this.isSubscribed = true;
61
53
  this.pipeline.dispatcher.didSubscribe(this.pipeline);
62
- return function () {
63
- _this.unsubscribe();
54
+ return () => {
55
+ this.unsubscribe();
64
56
  };
65
- };
66
- RXSubscriber.prototype.unsubscribe = function () {
57
+ }
58
+ unsubscribe() {
67
59
  this.onReceiveCallback = undefined;
68
60
  this.onErrorCallback = undefined;
69
61
  this.onCompleteCallback = undefined;
70
62
  this.pipeline.dispatcher.didUnsubscribe(this.pipeline);
71
- };
72
- return RXSubscriber;
73
- }());
74
- export { RXSubscriber };
63
+ }
64
+ }
package/dist/esm/Utils.js CHANGED
@@ -1,60 +1,17 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1
+ export const asyncDelay = async (time) => {
2
+ const p = new Promise(function (resolve) {
3
+ setTimeout(() => {
4
+ resolve('done!');
5
+ }, time);
8
6
  });
7
+ return await p;
9
8
  };
10
- var __generator = (this && this.__generator) || function (thisArg, body) {
11
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
12
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
13
- function verb(n) { return function (v) { return step([n, v]); }; }
14
- function step(op) {
15
- if (f) throw new TypeError("Generator is already executing.");
16
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
17
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
18
- if (y = 0, t) op = [op[0] & 2, t.value];
19
- switch (op[0]) {
20
- case 0: case 1: t = op; break;
21
- case 4: _.label++; return { value: op[1], done: false };
22
- case 5: _.label++; y = op[1]; op = [0]; continue;
23
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
24
- default:
25
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
26
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
27
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
28
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
29
- if (t[2]) _.ops.pop();
30
- _.trys.pop(); continue;
31
- }
32
- op = body.call(thisArg, _);
33
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
34
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
35
- }
36
- };
37
- export var asyncDelay = function (time) { return __awaiter(void 0, void 0, void 0, function () {
38
- var p;
39
- return __generator(this, function (_a) {
40
- switch (_a.label) {
41
- case 0:
42
- p = new Promise(function (resolve) {
43
- setTimeout(function () {
44
- resolve('done!');
45
- }, time);
46
- });
47
- return [4 /*yield*/, p];
48
- case 1: return [2 /*return*/, _a.sent()];
49
- }
50
- });
51
- }); };
52
- export var MD5 = function (string) {
9
+ export const MD5 = function (string) {
53
10
  function RotateLeft(lValue, iShiftBits) {
54
11
  return (lValue << iShiftBits) | (lValue >>> (32 - iShiftBits));
55
12
  }
56
13
  function AddUnsigned(lX, lY) {
57
- var lX4, lY4, lX8, lY8, lResult;
14
+ let lX4, lY4, lX8, lY8, lResult;
58
15
  lX8 = (lX & 0x80000000);
59
16
  lY8 = (lY & 0x80000000);
60
17
  lX4 = (lX & 0x40000000);
@@ -96,14 +53,14 @@ export var MD5 = function (string) {
96
53
  return AddUnsigned(RotateLeft(a, s), b);
97
54
  }
98
55
  function ConvertToWordArray(string) {
99
- var lWordCount;
100
- var lMessageLength = string.length;
101
- var lNumberOfWords_temp1 = lMessageLength + 8;
102
- var lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
103
- var lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
104
- var lWordArray = Array(lNumberOfWords - 1);
105
- var lBytePosition = 0;
106
- var lByteCount = 0;
56
+ let lWordCount;
57
+ const lMessageLength = string.length;
58
+ const lNumberOfWords_temp1 = lMessageLength + 8;
59
+ const lNumberOfWords_temp2 = (lNumberOfWords_temp1 - (lNumberOfWords_temp1 % 64)) / 64;
60
+ const lNumberOfWords = (lNumberOfWords_temp2 + 1) * 16;
61
+ const lWordArray = Array(lNumberOfWords - 1);
62
+ let lBytePosition = 0;
63
+ let lByteCount = 0;
107
64
  while (lByteCount < lMessageLength) {
108
65
  lWordCount = (lByteCount - (lByteCount % 4)) / 4;
109
66
  lBytePosition = (lByteCount % 4) * 8;
@@ -118,10 +75,10 @@ export var MD5 = function (string) {
118
75
  return lWordArray;
119
76
  }
120
77
  function WordToHex(lValue) {
121
- var WordToHexValue = '';
122
- var WordToHexValue_temp = '';
123
- var lByte;
124
- var lCount;
78
+ let WordToHexValue = '';
79
+ let WordToHexValue_temp = '';
80
+ let lByte;
81
+ let lCount;
125
82
  for (lCount = 0; lCount <= 3; lCount++) {
126
83
  lByte = (lValue >>> (lCount * 8)) & 255;
127
84
  WordToHexValue_temp = '0' + lByte.toString(16);
@@ -131,42 +88,42 @@ export var MD5 = function (string) {
131
88
  }
132
89
  function Utf8Encode(string) {
133
90
  string = string.replace(/\r\n/g, '\n');
134
- var utftext = '';
135
- for (var n = 0; n < string.length; n++) {
136
- var c_1 = string.charCodeAt(n);
137
- if (c_1 < 128) {
138
- utftext += String.fromCharCode(c_1);
91
+ let utftext = '';
92
+ for (let n = 0; n < string.length; n++) {
93
+ const c = string.charCodeAt(n);
94
+ if (c < 128) {
95
+ utftext += String.fromCharCode(c);
139
96
  }
140
- else if ((c_1 > 127) && (c_1 < 2048)) {
141
- utftext += String.fromCharCode((c_1 >> 6) | 192);
142
- utftext += String.fromCharCode((c_1 & 63) | 128);
97
+ else if ((c > 127) && (c < 2048)) {
98
+ utftext += String.fromCharCode((c >> 6) | 192);
99
+ utftext += String.fromCharCode((c & 63) | 128);
143
100
  }
144
101
  else {
145
- utftext += String.fromCharCode((c_1 >> 12) | 224);
146
- utftext += String.fromCharCode(((c_1 >> 6) & 63) | 128);
147
- utftext += String.fromCharCode((c_1 & 63) | 128);
102
+ utftext += String.fromCharCode((c >> 12) | 224);
103
+ utftext += String.fromCharCode(((c >> 6) & 63) | 128);
104
+ utftext += String.fromCharCode((c & 63) | 128);
148
105
  }
149
106
  }
150
107
  return utftext;
151
108
  }
152
- var x = [];
153
- var k, AA, BB, CC, DD, a, b, c, d;
154
- var S11 = 7;
155
- var S12 = 12;
156
- var S13 = 17;
157
- var S14 = 22;
158
- var S21 = 5;
159
- var S22 = 9;
160
- var S23 = 14;
161
- var S24 = 20;
162
- var S31 = 4;
163
- var S32 = 11;
164
- var S33 = 16;
165
- var S34 = 23;
166
- var S41 = 6;
167
- var S42 = 10;
168
- var S43 = 15;
169
- var S44 = 21;
109
+ let x = [];
110
+ let k, AA, BB, CC, DD, a, b, c, d;
111
+ const S11 = 7;
112
+ const S12 = 12;
113
+ const S13 = 17;
114
+ const S14 = 22;
115
+ const S21 = 5;
116
+ const S22 = 9;
117
+ const S23 = 14;
118
+ const S24 = 20;
119
+ const S31 = 4;
120
+ const S32 = 11;
121
+ const S33 = 16;
122
+ const S34 = 23;
123
+ const S41 = 6;
124
+ const S42 = 10;
125
+ const S43 = 15;
126
+ const S44 = 21;
170
127
  string = Utf8Encode(string);
171
128
  x = ConvertToWordArray(string);
172
129
  a = 0x67452301;
@@ -247,6 +204,6 @@ export var MD5 = function (string) {
247
204
  c = AddUnsigned(c, CC);
248
205
  d = AddUnsigned(d, DD);
249
206
  }
250
- var temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
207
+ const temp = WordToHex(a) + WordToHex(b) + WordToHex(c) + WordToHex(d);
251
208
  return temp.toLowerCase();
252
209
  };
package/dist/esm/index.js CHANGED
@@ -1,7 +1,6 @@
1
- export { RX, } from "./RX.js";
2
- export { RXPublisher, RXJustComplete, RXJustError, RXDelayedComplete, RXDelayedError, RXEmitter, RXSubject, RXBuffer, RXOperation, RXCombine, RXFrom, RXWaitUntilComplete, RXObservableEntity, RXObservableValue, RXQueueOperator, RXQueue, } from "./RXPublisher.js";
3
- export { observe, observeFrom, observer, JSXSubscriber, ObservableGlobalState, RenderQueueStatus, } from "./RXObserver.js";
4
- export { RXOperator, RXMap, RXFlatMap, RXForEach, RXSequent, RXParallel, RXFilter, RXSpread, RXSkipFirst, RXSkipNullable, RXRemoveDuplicates, RXDebounce, RXReplaceError, } from "./RXOperator.js";
5
- export { RXPipeline } from "./RXPipeline.js";
6
- export { RXSubscriber } from "./RXSubscriber.js";
7
- export { MD5, asyncDelay } from "./Utils.js";
1
+ export { RX, } from "./RX";
2
+ export { RXPublisher, RXJustComplete, RXJustError, RXDelayedComplete, RXDelayedError, RXEmitter, RXSubject, RXBuffer, RXOperation, RXCombine, RXFrom, RXWaitUntilComplete, RXObservableEntity, RXObservableValue, RXQueueOperator, RXQueue, } from "./RXPublisher";
3
+ export { RXOperator, RXMap, RXFlatMap, RXForEach, RXSequent, RXParallel, RXFilter, RXSpread, RXSkipFirst, RXSkipNullable, RXRemoveDuplicates, RXDebounce, RXReplaceError, } from "./RXOperator";
4
+ export { RXPipeline } from "./RXPipeline";
5
+ export { RXSubscriber } from "./RXSubscriber";
6
+ export { MD5, asyncDelay } from "./Utils";
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- export { RXAnySender, RXSender, RX, } from "./RX.js";
2
- export { AnyRXObservable, RXObservable, RXPublisherUID, RXPublisher, RXJustComplete, RXJustError, RXDelayedComplete, RXDelayedError, RXEmitter, RXSubject, RXBuffer, RXOperation, RXCombine, RXFrom, RXWaitUntilComplete, RXObservableEntity, RXObservableValue, RXAnyQueueOperator, RXQueueOperator, RXQueue, } from "./RXPublisher.js";
3
- export { observe, observeFrom, observer, JSXSubscriber, ObservableGlobalState, RenderQueueStatus, } from "./RXObserver.js";
4
- export { RXOperatorProtocol, RXAnyOperator, RXOperator, RXMap, RXFlatMap, RXForEach, RXSequent, RXParallel, RXFilter, RXSpread, RXSkipFirst, RXSkipNullable, RXRemoveDuplicates, RXDebounce, RXReplaceError, } from "./RXOperator.js";
5
- export { RXAnyPipeline, RXPipeline } from "./RXPipeline.js";
6
- export { ErrorMethod, CompleteMethod, SubscribeMethod, RXAnySubscriber, RXSubscriber } from "./RXSubscriber.js";
7
- export { MD5, asyncDelay } from "./Utils.js";
1
+ export { RXAnySender, RXSender, RX, } from "./RX";
2
+ export { AnyRXObservable, RXObservable, RXPublisherUID, RXPublisher, RXJustComplete, RXJustError, RXDelayedComplete, RXDelayedError, RXEmitter, RXSubject, RXBuffer, RXOperation, RXCombine, RXFrom, RXWaitUntilComplete, RXObservableEntity, RXObservableValue, RXAnyQueueOperator, RXQueueOperator, RXQueue, } from "./RXPublisher";
3
+ export { RXOperatorProtocol, RXAnyOperator, RXOperator, RXMap, RXFlatMap, RXForEach, RXSequent, RXParallel, RXFilter, RXSpread, RXSkipFirst, RXSkipNullable, RXRemoveDuplicates, RXDebounce, RXReplaceError, } from "./RXOperator";
4
+ export { RXAnyPipeline, RXPipeline } from "./RXPipeline";
5
+ export { ErrorMethod, CompleteMethod, SubscribeMethod, RXAnySubscriber, RXSubscriber } from "./RXSubscriber";
6
+ export { MD5, asyncDelay } from "./Utils";
package/package.json CHANGED
@@ -1,15 +1,13 @@
1
1
  {
2
2
  "name": "flinker",
3
3
  "description": "RX.ts lib for building frontend apps",
4
- "version": "1.0.7",
4
+ "version": "2.0.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/Dittner/Flinker.git"
8
8
  },
9
9
  "keywords": [
10
- "RX.ts",
11
- "React",
12
- "App state manager"
10
+ "RX.ts"
13
11
  ],
14
12
  "author": "Alexander Dittner",
15
13
  "license": "MIT",
@@ -30,8 +28,8 @@
30
28
  "scripts": {
31
29
  "demo": "PORT=3001 PUBLIC_URL=/ react-scripts start",
32
30
  "test": "jest",
33
- "build": "rm -rf dist && npm run build:esm && npm run build:cjs",
34
- "build:esm": "tsc --module es2015 --target es5 --outDir dist/esm",
31
+ "build": "rm -rf dist && npm run build:esm",
32
+ "build:esm": "tsc --module es2020 --target es2020 --outDir dist/esm",
35
33
  "build:cjs": "tsc --module commonjs --target es5 --outDir dist/cjs"
36
34
  },
37
35
  "eslintConfig": {
@@ -64,9 +62,7 @@
64
62
  "ts-jest": "^29.3.0",
65
63
  "typescript": "^5.8.2",
66
64
  "@types/react": "^19.0.12",
67
- "@types/react-dom": "^19.0.4",
68
- "react": "^19.0.0",
69
- "react-dom": "^19.0.0"
65
+ "@types/react-dom": "^19.0.4"
70
66
  },
71
67
  "directories": {
72
68
  "test": "test"
@@ -1,33 +0,0 @@
1
- import { type AnyRXObservable, type RXObservable } from './RXPublisher.js';
2
- export declare function observe<RXElement extends AnyRXObservable | undefined>(rx: RXElement): RXElement;
3
- export declare function observeFrom(rx: () => AnyRXObservable): void;
4
- export declare function observer<T>(component: (props: T) => React.JSX.Element): (props: T) => React.JSX.Element;
5
- type JSXSubscriberUID = number;
6
- export declare class JSXSubscriber {
7
- static readonly empty: JSXSubscriber;
8
- readonly uid: JSXSubscriberUID;
9
- private readonly buildersSet;
10
- private readonly unsubscribeColl;
11
- renderCycle: number;
12
- initialized: boolean;
13
- readonly forceRenderFunc: (renderCycle: number) => void;
14
- constructor(forceRenderFunc: (renderCycle: number) => void);
15
- private _isDisposed;
16
- get isDisposed(): boolean;
17
- observe<V, E>(b: RXObservable<V, E>): void;
18
- observeFrom(f: () => AnyRXObservable): void;
19
- dispose(): void;
20
- resurrect(): void;
21
- render(renderCycle: number): boolean;
22
- }
23
- export declare class ObservableGlobalState {
24
- static renderCycle: number;
25
- static initializingJSXComponent: JSXSubscriber;
26
- static debug: boolean;
27
- }
28
- export declare enum RenderQueueStatus {
29
- IDLE = "IDLE",
30
- PENDING = "PENDING",
31
- RUNNING = "LOADING"
32
- }
33
- export {};
package/dist/cjs/RX.js DELETED
@@ -1,41 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RX = void 0;
4
- var RXPublisher_js_1 = require("./RXPublisher.js");
5
- var RX = /** @class */ (function () {
6
- function RX() {
7
- }
8
- //--------------------------------------
9
- // STATIC METHODS
10
- //--------------------------------------
11
- RX.combine = function () {
12
- var list = [];
13
- for (var _i = 0; _i < arguments.length; _i++) {
14
- list[_i] = arguments[_i];
15
- }
16
- return new RXPublisher_js_1.RXCombine(list).asObservable;
17
- };
18
- RX.from = function (list) {
19
- return new RXPublisher_js_1.RXFrom(list).asObservable;
20
- };
21
- RX.queue = function () {
22
- return new RXPublisher_js_1.RXQueue();
23
- };
24
- RX.waitUntilComplete = function (list, result) {
25
- return new RXPublisher_js_1.RXWaitUntilComplete(list, result).asObservable;
26
- };
27
- RX.justComplete = function (value) {
28
- return new RXPublisher_js_1.RXJustComplete(value).asObservable;
29
- };
30
- RX.justError = function (error) {
31
- return new RXPublisher_js_1.RXJustError(error).asObservable;
32
- };
33
- RX.delayedComplete = function (ms, value) {
34
- return new RXPublisher_js_1.RXDelayedComplete(ms, value).asObservable;
35
- };
36
- RX.delayedError = function (ms, error) {
37
- return new RXPublisher_js_1.RXDelayedError(ms, error).asObservable;
38
- };
39
- return RX;
40
- }());
41
- exports.RX = RX;