ctrl-fx 0.1.0 → 0.1.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.
- package/README.md +13 -0
- package/dist/chunk-DZAR6PTR.js +3966 -0
- package/dist/chunk-KNHJPAIU.js +1800 -0
- package/dist/chunk-NSWOTCDU.js +916 -0
- package/dist/chunk-PKBMQBKP.js +7 -0
- package/dist/chunk-XICUXW4T.js +252 -0
- package/dist/db/index.d.ts +218 -16
- package/dist/db/index.js +53 -19
- package/dist/dom/index.d.ts +2 -248
- package/dist/dom/index.js +30 -266
- package/dist/effects.d.ts +2 -580
- package/dist/effects.js +111 -1556
- package/dist/index-fpCmXVEu.d.ts +1391 -0
- package/dist/index.d.ts +2 -41
- package/dist/index.js +18 -78
- package/dist/router.d.ts +11 -12
- package/dist/router.js +57 -68
- package/dist/testing.d.ts +66 -60
- package/dist/testing.js +39 -158
- package/dist/webcomponent.d.ts +7 -4
- package/dist/webcomponent.js +48 -40
- package/package.json +4 -3
- package/dist/clipboard.d.ts +0 -7
- package/dist/clipboard.d.ts.map +0 -1
- package/dist/clipboard.js +0 -3
- package/dist/db/effects.d.ts +0 -78
- package/dist/db/effects.d.ts.map +0 -1
- package/dist/db/effects.js +0 -98
- package/dist/db/errors.d.ts +0 -21
- package/dist/db/errors.d.ts.map +0 -1
- package/dist/db/errors.js +0 -13
- package/dist/db/index.d.ts.map +0 -1
- package/dist/db/keypath.d.ts +0 -40
- package/dist/db/keypath.d.ts.map +0 -1
- package/dist/db/keypath.js +0 -20
- package/dist/db/setup.d.ts +0 -83
- package/dist/db/setup.d.ts.map +0 -1
- package/dist/db/setup.js +0 -100
- package/dist/db/testdb.d.ts +0 -19
- package/dist/db/testdb.d.ts.map +0 -1
- package/dist/db/testdb.js +0 -34
- package/dist/dom/attrs.d.ts +0 -67
- package/dist/dom/attrs.d.ts.map +0 -1
- package/dist/dom/attrs.js +0 -154
- package/dist/dom/components.d.ts +0 -43
- package/dist/dom/components.d.ts.map +0 -1
- package/dist/dom/components.js +0 -86
- package/dist/dom/elems.d.ts +0 -121
- package/dist/dom/elems.d.ts.map +0 -1
- package/dist/dom/elems.js +0 -52
- package/dist/dom/events.d.ts +0 -232
- package/dist/dom/events.d.ts.map +0 -1
- package/dist/dom/events.js +0 -289
- package/dist/dom/index.d.ts.map +0 -1
- package/dist/dom/nodeid.d.ts +0 -9
- package/dist/dom/nodeid.d.ts.map +0 -1
- package/dist/dom/nodeid.js +0 -27
- package/dist/dom/svg.d.ts +0 -23
- package/dist/dom/svg.d.ts.map +0 -1
- package/dist/dom/svg.js +0 -1
- package/dist/dom/views.d.ts +0 -60
- package/dist/dom/views.d.ts.map +0 -1
- package/dist/dom/views.js +0 -154
- package/dist/effects.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/internal/clipboard.d.ts +0 -5
- package/dist/internal/clipboard.d.ts.map +0 -1
- package/dist/internal/clipboard.js +0 -33
- package/dist/internal/cmpmgr.d.ts +0 -46
- package/dist/internal/cmpmgr.d.ts.map +0 -1
- package/dist/internal/cmpmgr.js +0 -561
- package/dist/internal/dbmgr.d.ts +0 -11
- package/dist/internal/dbmgr.d.ts.map +0 -1
- package/dist/internal/dbmgr.js +0 -200
- package/dist/internal/dominterpreter.d.ts +0 -5
- package/dist/internal/dominterpreter.d.ts.map +0 -1
- package/dist/internal/dominterpreter.js +0 -337
- package/dist/internal/eventmgr.d.ts +0 -41
- package/dist/internal/eventmgr.d.ts.map +0 -1
- package/dist/internal/eventmgr.js +0 -696
- package/dist/internal/index.d.ts +0 -19
- package/dist/internal/index.d.ts.map +0 -1
- package/dist/internal/index.js +0 -38
- package/dist/internal/interpreter.d.ts +0 -10
- package/dist/internal/interpreter.d.ts.map +0 -1
- package/dist/internal/interpreter.js +0 -1
- package/dist/internal/locutils.d.ts +0 -4
- package/dist/internal/locutils.d.ts.map +0 -1
- package/dist/internal/locutils.js +0 -22
- package/dist/internal/net.d.ts +0 -4
- package/dist/internal/net.d.ts.map +0 -1
- package/dist/internal/net.js +0 -64
- package/dist/internal/realdom.d.ts +0 -249
- package/dist/internal/realdom.d.ts.map +0 -1
- package/dist/internal/realdom.js +0 -1
- package/dist/internal/styleregistry.d.ts +0 -6
- package/dist/internal/styleregistry.d.ts.map +0 -1
- package/dist/internal/styleregistry.js +0 -18
- package/dist/internal/taskreg.d.ts +0 -9
- package/dist/internal/taskreg.d.ts.map +0 -1
- package/dist/internal/taskreg.js +0 -28
- package/dist/internal/testing.d.ts +0 -12
- package/dist/internal/testing.d.ts.map +0 -1
- package/dist/internal/testing.js +0 -974
- package/dist/internal/testinginterpreter.d.ts +0 -10
- package/dist/internal/testinginterpreter.d.ts.map +0 -1
- package/dist/internal/testinginterpreter.js +0 -646
- package/dist/internal/vdom.d.ts +0 -93
- package/dist/internal/vdom.d.ts.map +0 -1
- package/dist/internal/vdom.js +0 -470
- package/dist/json/index.d.ts +0 -5
- package/dist/json/index.d.ts.map +0 -1
- package/dist/json/index.js +0 -2
- package/dist/json/validation.d.ts +0 -28
- package/dist/json/validation.d.ts.map +0 -1
- package/dist/json/validation.js +0 -8
- package/dist/net/fragment.d.ts +0 -10
- package/dist/net/fragment.d.ts.map +0 -1
- package/dist/net/fragment.js +0 -27
- package/dist/net/index.d.ts +0 -42
- package/dist/net/index.d.ts.map +0 -1
- package/dist/net/index.js +0 -60
- package/dist/net/location.d.ts +0 -21
- package/dist/net/location.d.ts.map +0 -1
- package/dist/net/location.js +0 -41
- package/dist/net/path.d.ts +0 -12
- package/dist/net/path.d.ts.map +0 -1
- package/dist/net/path.js +0 -29
- package/dist/net/queryparam.d.ts +0 -10
- package/dist/net/queryparam.d.ts.map +0 -1
- package/dist/net/queryparam.js +0 -34
- package/dist/router.d.ts.map +0 -1
- package/dist/scroll.d.ts +0 -7
- package/dist/scroll.d.ts.map +0 -1
- package/dist/scroll.js +0 -3
- package/dist/testing.d.ts.map +0 -1
- package/dist/utils/apply.d.ts +0 -9
- package/dist/utils/apply.d.ts.map +0 -1
- package/dist/utils/apply.js +0 -10
- package/dist/utils/index.d.ts +0 -22
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -138
- package/dist/utils/lens.d.ts +0 -18
- package/dist/utils/lens.d.ts.map +0 -1
- package/dist/utils/lens.js +0 -27
- package/dist/utils/match.d.ts +0 -17
- package/dist/utils/match.d.ts.map +0 -1
- package/dist/utils/match.js +0 -28
- package/dist/utils/result.d.ts +0 -47
- package/dist/utils/result.d.ts.map +0 -1
- package/dist/utils/result.js +0 -97
- package/dist/webcomponent.d.ts.map +0 -1
package/dist/testing.js
CHANGED
|
@@ -1,159 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
import {
|
|
2
|
+
TestDatabaseData,
|
|
3
|
+
advanceTime,
|
|
4
|
+
appBadgeCount,
|
|
5
|
+
attr,
|
|
6
|
+
clearAppBadge,
|
|
7
|
+
click,
|
|
8
|
+
defaultTestConfig,
|
|
9
|
+
fireCustomEvent,
|
|
10
|
+
newTestData,
|
|
11
|
+
one,
|
|
12
|
+
receiveBroadcast,
|
|
13
|
+
setAppBadge,
|
|
14
|
+
submit,
|
|
15
|
+
testApplication,
|
|
16
|
+
testComponent,
|
|
17
|
+
textInput
|
|
18
|
+
} from "./chunk-DZAR6PTR.js";
|
|
19
|
+
import "./chunk-NSWOTCDU.js";
|
|
20
|
+
import "./chunk-KNHJPAIU.js";
|
|
21
|
+
import "./chunk-XICUXW4T.js";
|
|
22
|
+
import "./chunk-PKBMQBKP.js";
|
|
23
|
+
export {
|
|
24
|
+
TestDatabaseData,
|
|
25
|
+
advanceTime,
|
|
26
|
+
appBadgeCount,
|
|
27
|
+
attr,
|
|
28
|
+
clearAppBadge,
|
|
29
|
+
click,
|
|
30
|
+
defaultTestConfig,
|
|
31
|
+
fireCustomEvent,
|
|
32
|
+
newTestData,
|
|
33
|
+
one,
|
|
34
|
+
receiveBroadcast,
|
|
35
|
+
setAppBadge,
|
|
36
|
+
submit,
|
|
37
|
+
testApplication,
|
|
38
|
+
testComponent,
|
|
39
|
+
textInput
|
|
13
40
|
};
|
|
14
|
-
export function setAppBadge(count) {
|
|
15
|
-
return { _type: 'SetAppBadge', count };
|
|
16
|
-
}
|
|
17
|
-
export function appBadgeCount(operations) {
|
|
18
|
-
if (operations.length > 0) {
|
|
19
|
-
const op = operations[operations.length - 1];
|
|
20
|
-
switch (op._type) {
|
|
21
|
-
case 'ClearAppBadge':
|
|
22
|
-
return 0;
|
|
23
|
-
case 'SetAppBadge':
|
|
24
|
-
return op.count;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
return 0;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/** Creates a TestConfig that throws on any HTTP request. */
|
|
32
|
-
export function defaultTestConfig() {
|
|
33
|
-
return {
|
|
34
|
-
http: {
|
|
35
|
-
handler: (_request, _prior) => {
|
|
36
|
-
throw new Error('No HTTP handler configured in TestConfig.');
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
clock: {
|
|
40
|
-
values: [],
|
|
41
|
-
},
|
|
42
|
-
random: {
|
|
43
|
-
values: [],
|
|
44
|
-
},
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
/** Creates an empty TestData, optionally initialising the `custom` field. */
|
|
48
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
49
|
-
export function newTestData(custom) {
|
|
50
|
-
return {
|
|
51
|
-
window: {
|
|
52
|
-
alerts: [],
|
|
53
|
-
confirms: [],
|
|
54
|
-
confirmResponses: [],
|
|
55
|
-
prompts: [],
|
|
56
|
-
promptResponses: [],
|
|
57
|
-
},
|
|
58
|
-
navigator: {
|
|
59
|
-
appBadgeOperations: [],
|
|
60
|
-
},
|
|
61
|
-
clipboard: {
|
|
62
|
-
content: '',
|
|
63
|
-
writes: [],
|
|
64
|
-
},
|
|
65
|
-
document: {
|
|
66
|
-
title: null,
|
|
67
|
-
},
|
|
68
|
-
http: {
|
|
69
|
-
interactions: [],
|
|
70
|
-
},
|
|
71
|
-
clock: {
|
|
72
|
-
calls: [],
|
|
73
|
-
},
|
|
74
|
-
random: {
|
|
75
|
-
calls: [],
|
|
76
|
-
},
|
|
77
|
-
console: {
|
|
78
|
-
logs: [],
|
|
79
|
-
},
|
|
80
|
-
db: new TestDatabaseData(new Map()),
|
|
81
|
-
storage: {
|
|
82
|
-
local: new Map(),
|
|
83
|
-
session: new Map(),
|
|
84
|
-
},
|
|
85
|
-
navigation: {
|
|
86
|
-
locationHistory: [],
|
|
87
|
-
},
|
|
88
|
-
scroll: {
|
|
89
|
-
windowScrolls: [],
|
|
90
|
-
elementScrolls: [],
|
|
91
|
-
},
|
|
92
|
-
downloads: [],
|
|
93
|
-
broadcasts: {
|
|
94
|
-
sent: [],
|
|
95
|
-
},
|
|
96
|
-
custom: (custom ?? {}),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
/** Simulates a click on the element(s) matching `selector`. */
|
|
100
|
-
export function click(selector) {
|
|
101
|
-
return {
|
|
102
|
-
type: 'Click',
|
|
103
|
-
selector,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
/** Advances the test scheduler clock by `milliseconds`, firing any scheduled tasks that come due. */
|
|
107
|
-
export function advanceTime(milliseconds) {
|
|
108
|
-
return {
|
|
109
|
-
_type: 'AdvanceTime',
|
|
110
|
-
milliseconds,
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
/** Delivers a BroadcastChannel message to any active subscriber on `channel`. */
|
|
114
|
-
export function receiveBroadcast(channel, message) {
|
|
115
|
-
return { _type: 'ReceiveBroadcast', channel, message };
|
|
116
|
-
}
|
|
117
|
-
/** Dispatches a custom DOM event on the element matching `selector`, invoking any `onEvent` handler. */
|
|
118
|
-
export function fireCustomEvent(selector, eventName, detail) {
|
|
119
|
-
return { _type: 'FireCustomEvent', selector, eventName, detail };
|
|
120
|
-
}
|
|
121
|
-
/** Simulates a form submit event on the element(s) matching `selector`. */
|
|
122
|
-
export function submit(selector) {
|
|
123
|
-
return { _type: 'Submit', selector };
|
|
124
|
-
}
|
|
125
|
-
/** Simulates an `input` event on the element(s) matching `selector`. */
|
|
126
|
-
export function textInput(selector, value) {
|
|
127
|
-
return { _type: 'TextInput', selector, value };
|
|
128
|
-
}
|
|
129
|
-
/** Creates an attribute object `{ name, value }` for use with `findOne(...).attrs.toContainEqual(attr(...))`. */
|
|
130
|
-
export function attr(name, value) {
|
|
131
|
-
return { name, value };
|
|
132
|
-
}
|
|
133
|
-
/**
|
|
134
|
-
* Creates a testable wrapper around a `Component`. Use this when testing a
|
|
135
|
-
* component that was created with `component()`. For testing a top-level view
|
|
136
|
-
* function directly, use `testApplication` instead.
|
|
137
|
-
*/
|
|
138
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
139
|
-
export function testComponent(component, config, data) {
|
|
140
|
-
return internalTestcomponent(component, config, data);
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* The main entry point for testing a ctrl-fx application. Wraps a view
|
|
144
|
-
* function and initial state into a `TestableComponent`. Call `.run(...)`
|
|
145
|
-
* with interactions to simulate user actions, then inspect `.state`, `.data`,
|
|
146
|
-
* and the `findOne`/`find` DOM query methods on the result.
|
|
147
|
-
*/
|
|
148
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
|
|
149
|
-
export function testApplication(app, initialState, config, data) {
|
|
150
|
-
const component = toComponent(app, initialState);
|
|
151
|
-
return testComponent(component, config, data);
|
|
152
|
-
}
|
|
153
|
-
/** Selects elements matching `selector`; throws during `run` if none are found. */
|
|
154
|
-
export function one(selector) {
|
|
155
|
-
return {
|
|
156
|
-
_type: 'OneOrMore',
|
|
157
|
-
selector,
|
|
158
|
-
};
|
|
159
|
-
}
|
package/dist/webcomponent.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { C as Component } from './index-fpCmXVEu.js';
|
|
2
|
+
import './db/index.js';
|
|
3
|
+
|
|
2
4
|
/** Options for `defineWebComponent`. */
|
|
3
|
-
|
|
5
|
+
type WebComponentOptions<Event> = {
|
|
4
6
|
/** Maps a typed component event to a DOM custom-event name. */
|
|
5
7
|
events?: (event: Event) => string;
|
|
6
8
|
};
|
|
@@ -11,5 +13,6 @@ export type WebComponentOptions<Event> = {
|
|
|
11
13
|
* @param component the ctrl-fx component to mount
|
|
12
14
|
* @param options optional configuration
|
|
13
15
|
*/
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
declare function defineWebComponent<State, Event>(tagName: string, component: Component<State, void, Event>, options?: WebComponentOptions<Event>): void;
|
|
17
|
+
|
|
18
|
+
export { type WebComponentOptions, defineWebComponent };
|
package/dist/webcomponent.js
CHANGED
|
@@ -1,43 +1,51 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
this._mgr = null;
|
|
1
|
+
import {
|
|
2
|
+
ComponentManager,
|
|
3
|
+
domInterpreter,
|
|
4
|
+
realStyleRegistry
|
|
5
|
+
} from "./chunk-DZAR6PTR.js";
|
|
6
|
+
import "./chunk-NSWOTCDU.js";
|
|
7
|
+
import "./chunk-KNHJPAIU.js";
|
|
8
|
+
import "./chunk-XICUXW4T.js";
|
|
9
|
+
import {
|
|
10
|
+
__publicField
|
|
11
|
+
} from "./chunk-PKBMQBKP.js";
|
|
12
|
+
|
|
13
|
+
// src/webcomponent.ts
|
|
14
|
+
function defineWebComponent(tagName, component, options) {
|
|
15
|
+
class CtrlFxElement extends HTMLElement {
|
|
16
|
+
constructor() {
|
|
17
|
+
super(...arguments);
|
|
18
|
+
__publicField(this, "_mgr", null);
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
const shadow = this.attachShadow({ mode: "open" });
|
|
22
|
+
const mount = document.createElement("div");
|
|
23
|
+
shadow.appendChild(mount);
|
|
24
|
+
this._mgr = new ComponentManager(
|
|
25
|
+
component,
|
|
26
|
+
mount,
|
|
27
|
+
globalThis.window,
|
|
28
|
+
domInterpreter,
|
|
29
|
+
realStyleRegistry(),
|
|
30
|
+
(event) => {
|
|
31
|
+
const eventName = options?.events ? options.events(event) : "event";
|
|
32
|
+
this.dispatchEvent(
|
|
33
|
+
new CustomEvent(eventName, {
|
|
34
|
+
detail: event,
|
|
35
|
+
bubbles: true,
|
|
36
|
+
composed: true
|
|
37
|
+
})
|
|
38
|
+
);
|
|
40
39
|
}
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
disconnectedCallback() {
|
|
43
|
+
this._mgr?.destroy();
|
|
44
|
+
this._mgr = null;
|
|
41
45
|
}
|
|
42
|
-
|
|
46
|
+
}
|
|
47
|
+
customElements.define(tagName, CtrlFxElement);
|
|
43
48
|
}
|
|
49
|
+
export {
|
|
50
|
+
defineWebComponent
|
|
51
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ctrl-fx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "A no-dependency, purely functional TypeScript framework for building web applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"dev": "vite --host",
|
|
28
28
|
"clean": "rm -rf dist",
|
|
29
29
|
"build": "tsc && vite build --config doc/examples/vite.config.ts doc/examples",
|
|
30
|
-
"build:lib": "
|
|
30
|
+
"build:lib": "tsup",
|
|
31
31
|
"preview": "vite preview",
|
|
32
32
|
"test": "vitest run",
|
|
33
33
|
"test:watch": "vitest --watch",
|
|
@@ -74,12 +74,13 @@
|
|
|
74
74
|
},
|
|
75
75
|
"devDependencies": {
|
|
76
76
|
"@eslint/js": "^10.0.1",
|
|
77
|
-
"typedoc": "^0.28.19",
|
|
78
77
|
"eslint": "^10.4.1",
|
|
79
78
|
"highlight.js": "^11.11.1",
|
|
80
79
|
"prettier": "^3.8.3",
|
|
81
80
|
"ts-node": "^10.9.2",
|
|
81
|
+
"tsup": "^8.5.1",
|
|
82
82
|
"tsx": "^4.20.6",
|
|
83
|
+
"typedoc": "^0.28.19",
|
|
83
84
|
"typescript": "~5.8.3",
|
|
84
85
|
"typescript-eslint": "^8.60.0",
|
|
85
86
|
"vitest": "^3.2.4"
|
package/dist/clipboard.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type ClipboardError = {
|
|
2
|
-
_type: 'ClipboardError';
|
|
3
|
-
cause: 'NotAllowed' | 'NotSupported' | 'UnexpectedError';
|
|
4
|
-
message: string;
|
|
5
|
-
};
|
|
6
|
-
export declare function clipboardError(cause: ClipboardError['cause'], message: string): ClipboardError;
|
|
7
|
-
//# sourceMappingURL=clipboard.d.ts.map
|
package/dist/clipboard.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"clipboard.d.ts","sourceRoot":"","sources":["../src/clipboard.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,gBAAgB,CAAA;IACvB,KAAK,EAAE,YAAY,GAAG,cAAc,GAAG,iBAAiB,CAAA;IACxD,OAAO,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,wBAAgB,cAAc,CAC5B,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,EAC9B,OAAO,EAAE,MAAM,GACd,cAAc,CAEhB"}
|
package/dist/clipboard.js
DELETED
package/dist/db/effects.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import type { JsonValue } from '../json';
|
|
2
|
-
import type { ObjectStore } from './index';
|
|
3
|
-
type DbAdd = {
|
|
4
|
-
readonly _type: 'Add';
|
|
5
|
-
readonly objectStore: ObjectStore;
|
|
6
|
-
readonly value: JsonValue;
|
|
7
|
-
};
|
|
8
|
-
type DbPut = {
|
|
9
|
-
readonly _type: 'Put';
|
|
10
|
-
readonly objectStore: ObjectStore;
|
|
11
|
-
readonly value: JsonValue;
|
|
12
|
-
};
|
|
13
|
-
type DbGet = {
|
|
14
|
-
readonly _type: 'Get';
|
|
15
|
-
readonly objectStore: ObjectStore;
|
|
16
|
-
readonly key: IDBValidKey;
|
|
17
|
-
};
|
|
18
|
-
type DbGetAll = {
|
|
19
|
-
readonly _type: 'GetAll';
|
|
20
|
-
readonly objectStore: ObjectStore;
|
|
21
|
-
};
|
|
22
|
-
type DbDelete = {
|
|
23
|
-
readonly _type: 'Delete';
|
|
24
|
-
readonly objectStore: ObjectStore;
|
|
25
|
-
readonly key: IDBValidKey;
|
|
26
|
-
};
|
|
27
|
-
type DbCount = {
|
|
28
|
-
readonly _type: 'Count';
|
|
29
|
-
readonly objectStore: ObjectStore;
|
|
30
|
-
};
|
|
31
|
-
export type DbOperation = DbAdd | DbPut | DbGet | DbGetAll | DbDelete | DbCount;
|
|
32
|
-
type DbReturn<A> = {
|
|
33
|
-
readonly _type: 'Return';
|
|
34
|
-
readonly value: A;
|
|
35
|
-
flatMap<B>(f: (a: A) => DbEffect<B>): DbEffect<B>;
|
|
36
|
-
map<B>(f: (a: A) => B): DbEffect<B>;
|
|
37
|
-
as<B>(b: B): DbEffect<B>;
|
|
38
|
-
void(): DbEffect<void>;
|
|
39
|
-
};
|
|
40
|
-
type DbSuspend<A> = {
|
|
41
|
-
readonly _type: 'Suspend';
|
|
42
|
-
readonly operation: DbOperation;
|
|
43
|
-
flatMap<B>(f: (a: A) => DbEffect<B>): DbEffect<B>;
|
|
44
|
-
map<B>(f: (a: A) => B): DbEffect<B>;
|
|
45
|
-
as<B>(b: B): DbEffect<B>;
|
|
46
|
-
void(): DbEffect<void>;
|
|
47
|
-
};
|
|
48
|
-
type DbChain<A> = {
|
|
49
|
-
readonly _type: 'FlatMap';
|
|
50
|
-
readonly effect: DbEffect<any>;
|
|
51
|
-
readonly next: (x: any) => DbEffect<A>;
|
|
52
|
-
flatMap<B>(f: (a: A) => DbEffect<B>): DbEffect<B>;
|
|
53
|
-
map<B>(f: (a: A) => B): DbEffect<B>;
|
|
54
|
-
as<B>(b: B): DbEffect<B>;
|
|
55
|
-
void(): DbEffect<void>;
|
|
56
|
-
};
|
|
57
|
-
/** A lazy, composable IndexedDB operation that produces a value of type `A`. Chain with `.flatMap`. */
|
|
58
|
-
export type DbEffect<A> = DbReturn<A> | DbSuspend<A> | DbChain<A>;
|
|
59
|
-
/** Lifts a plain value into a `DbEffect` without performing any database operation. */
|
|
60
|
-
export declare function pure<A>(a: A): DbEffect<A>;
|
|
61
|
-
/** A `DbEffect` that does nothing. Useful as a no-op in conditional chains. */
|
|
62
|
-
export declare function noop(): DbEffect<void>;
|
|
63
|
-
/** Runs a `DbEffect` against an interpreter callback. Called by the framework; not needed in application code. */
|
|
64
|
-
export declare function run<A>(effect: DbEffect<A>, interpreter: (op: DbOperation, onComplete: (a: A) => void) => void, onComplete: (a: A) => void): void;
|
|
65
|
-
/** A DbEffect describing an insert of `value` into `objectStore`. Fails if a record with the same key already exists. */
|
|
66
|
-
export declare function add(objectStore: ObjectStore, value: JsonValue): DbEffect<void>;
|
|
67
|
-
/** A DbEffect describing an insert-or-replace of `value` in `objectStore` (upsert). */
|
|
68
|
-
export declare function put(objectStore: ObjectStore, value: JsonValue): DbEffect<void>;
|
|
69
|
-
/** A DbEffect describing a retrieval of the record with `key` from `objectStore`, or `undefined` if not found. */
|
|
70
|
-
export declare function get(objectStore: ObjectStore, key: IDBValidKey): DbEffect<JsonValue | undefined>;
|
|
71
|
-
/** A DbEffect describing a retrieval of all records from `objectStore`. */
|
|
72
|
-
export declare function getAll(objectStore: ObjectStore): DbEffect<JsonValue[]>;
|
|
73
|
-
/** A DbEffect describing the deletion of the record with `key` from `objectStore`. */
|
|
74
|
-
export declare function deleteRecord(objectStore: ObjectStore, key: IDBValidKey): DbEffect<void>;
|
|
75
|
-
/** A DbEffect describing a record count in `objectStore`. */
|
|
76
|
-
export declare function count(objectStore: ObjectStore): DbEffect<number>;
|
|
77
|
-
export {};
|
|
78
|
-
//# sourceMappingURL=effects.d.ts.map
|
package/dist/db/effects.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"effects.d.ts","sourceRoot":"","sources":["../../src/db/effects.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACxC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAC1B,CAAA;AAED,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,WAAW,EAAE,WAAW,CAAA;IACjC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAA;CAC1B,CAAA;AAED,KAAK,KAAK,GAAG;IACX,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;IACrB,QAAQ,CAAC,WAAW,E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|
-
next,
|
|
6
|
-
flatMap(f) {
|
|
7
|
-
return chain(this, f);
|
|
8
|
-
},
|
|
9
|
-
map(f) {
|
|
10
|
-
return chain(this, b => ret(f(b)));
|
|
11
|
-
},
|
|
12
|
-
as(c) {
|
|
13
|
-
return chain(this, _ => ret(c));
|
|
14
|
-
},
|
|
15
|
-
void() {
|
|
16
|
-
return this.map(_ => { });
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
function ret(value) {
|
|
21
|
-
return {
|
|
22
|
-
_type: 'Return',
|
|
23
|
-
value,
|
|
24
|
-
flatMap(f) {
|
|
25
|
-
return chain(this, f);
|
|
26
|
-
},
|
|
27
|
-
map(f) {
|
|
28
|
-
return chain(this, a => ret(f(a)));
|
|
29
|
-
},
|
|
30
|
-
as(b) {
|
|
31
|
-
return chain(this, _ => ret(b));
|
|
32
|
-
},
|
|
33
|
-
void() {
|
|
34
|
-
return this.map(_ => { });
|
|
35
|
-
},
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function suspend(operation) {
|
|
39
|
-
return {
|
|
40
|
-
_type: 'Suspend',
|
|
41
|
-
operation,
|
|
42
|
-
flatMap(f) {
|
|
43
|
-
return chain(this, f);
|
|
44
|
-
},
|
|
45
|
-
map(f) {
|
|
46
|
-
return chain(this, a => ret(f(a)));
|
|
47
|
-
},
|
|
48
|
-
as(b) {
|
|
49
|
-
return chain(this, _ => ret(b));
|
|
50
|
-
},
|
|
51
|
-
void() {
|
|
52
|
-
return this.map(_ => { });
|
|
53
|
-
},
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
/** Lifts a plain value into a `DbEffect` without performing any database operation. */
|
|
57
|
-
export function pure(a) {
|
|
58
|
-
return ret(a);
|
|
59
|
-
}
|
|
60
|
-
/** A `DbEffect` that does nothing. Useful as a no-op in conditional chains. */
|
|
61
|
-
export function noop() {
|
|
62
|
-
return ret(undefined);
|
|
63
|
-
}
|
|
64
|
-
/** Runs a `DbEffect` against an interpreter callback. Called by the framework; not needed in application code. */
|
|
65
|
-
export function run(effect, interpreter, onComplete) {
|
|
66
|
-
switch (effect._type) {
|
|
67
|
-
case 'Return':
|
|
68
|
-
return onComplete(effect.value);
|
|
69
|
-
case 'Suspend':
|
|
70
|
-
return interpreter(effect.operation, onComplete);
|
|
71
|
-
case 'FlatMap':
|
|
72
|
-
return run(effect.effect, interpreter, result => run(effect.next(result), interpreter, onComplete));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
/** A DbEffect describing an insert of `value` into `objectStore`. Fails if a record with the same key already exists. */
|
|
76
|
-
export function add(objectStore, value) {
|
|
77
|
-
return suspend({ _type: 'Add', objectStore, value });
|
|
78
|
-
}
|
|
79
|
-
/** A DbEffect describing an insert-or-replace of `value` in `objectStore` (upsert). */
|
|
80
|
-
export function put(objectStore, value) {
|
|
81
|
-
return suspend({ _type: 'Put', objectStore, value });
|
|
82
|
-
}
|
|
83
|
-
/** A DbEffect describing a retrieval of the record with `key` from `objectStore`, or `undefined` if not found. */
|
|
84
|
-
export function get(objectStore, key) {
|
|
85
|
-
return suspend({ _type: 'Get', objectStore, key });
|
|
86
|
-
}
|
|
87
|
-
/** A DbEffect describing a retrieval of all records from `objectStore`. */
|
|
88
|
-
export function getAll(objectStore) {
|
|
89
|
-
return suspend({ _type: 'GetAll', objectStore });
|
|
90
|
-
}
|
|
91
|
-
/** A DbEffect describing the deletion of the record with `key` from `objectStore`. */
|
|
92
|
-
export function deleteRecord(objectStore, key) {
|
|
93
|
-
return suspend({ _type: 'Delete', objectStore, key });
|
|
94
|
-
}
|
|
95
|
-
/** A DbEffect describing a record count in `objectStore`. */
|
|
96
|
-
export function count(objectStore) {
|
|
97
|
-
return suspend({ _type: 'Count', objectStore });
|
|
98
|
-
}
|
package/dist/db/errors.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
export type DbError = UnexpectedError | NotFoundError | ConstraintError;
|
|
2
|
-
export interface UnexpectedError {
|
|
3
|
-
readonly _type: 'UnexpectedError';
|
|
4
|
-
readonly message?: string;
|
|
5
|
-
readonly cause?: Error;
|
|
6
|
-
}
|
|
7
|
-
export interface NotFoundError {
|
|
8
|
-
readonly _type: 'NotFoundError';
|
|
9
|
-
readonly cause: Error;
|
|
10
|
-
}
|
|
11
|
-
export interface ConstraintError {
|
|
12
|
-
readonly _type: 'ConstraintError';
|
|
13
|
-
readonly cause: Error;
|
|
14
|
-
}
|
|
15
|
-
export declare function unexpectedError(params: {
|
|
16
|
-
cause?: Error;
|
|
17
|
-
message?: string;
|
|
18
|
-
}): DbError;
|
|
19
|
-
export declare function notFoundError(cause: Error): DbError;
|
|
20
|
-
export declare function constraintError(cause: Error): DbError;
|
|
21
|
-
//# sourceMappingURL=errors.d.ts.map
|
package/dist/db/errors.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/db/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,eAAe,GAAG,aAAa,GAAG,eAAe,CAAA;AAEvE,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAA;IACzB,QAAQ,CAAC,KAAK,CAAC,EAAE,KAAK,CAAA;CACvB;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAA;IACjC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAA;CACtB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE;IACtC,KAAK,CAAC,EAAE,KAAK,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,GAAG,OAAO,CAMV;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAEnD;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAErD"}
|
package/dist/db/errors.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function unexpectedError(params) {
|
|
2
|
-
return {
|
|
3
|
-
_type: 'UnexpectedError',
|
|
4
|
-
cause: params.cause,
|
|
5
|
-
message: params.message,
|
|
6
|
-
};
|
|
7
|
-
}
|
|
8
|
-
export function notFoundError(cause) {
|
|
9
|
-
return { _type: 'NotFoundError', cause };
|
|
10
|
-
}
|
|
11
|
-
export function constraintError(cause) {
|
|
12
|
-
return { _type: 'ConstraintError', cause };
|
|
13
|
-
}
|
package/dist/db/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,QAAQ,CAAA;CAAE,CAAA;AAEnD,0BAA0B;AAC1B,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE5C;AAED,wEAAwE;AACxE,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,WAAW,CAAA;CAAE,CAAA;AAEzD,6BAA6B;AAC7B,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAElD;AAED,yEAAyE;AACzE,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,aAAa,CAAA;CAAE,CAAA;AAE7D,qCAAqC;AACrC,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,CAEtD;AAED,kEAAkE;AAClE,MAAM,MAAM,KAAK,GAAG,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAA;AAEjD,+BAA+B;AAC/B,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAE1C;AAED,YAAY,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAA;AACzC,OAAO,EACL,GAAG,EACH,KAAK,EACL,YAAY,EACZ,GAAG,EACH,MAAM,EACN,IAAI,IAAI,MAAM,EACd,IAAI,IAAI,MAAM,EACd,GAAG,GACJ,MAAM,WAAW,CAAA;AAElB,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AAC5C,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,mBAAmB,EACnB,WAAW,GACZ,MAAM,SAAS,CAAA;AAEhB,YAAY,EACV,OAAO,EACP,eAAe,EACf,aAAa,EACb,eAAe,GAChB,MAAM,UAAU,CAAA;AAEjB,OAAO,EACL,iBAAiB,EACjB,KAAK,iBAAiB,EACtB,KAAK,YAAY,EACjB,KAAK,OAAO,EACZ,KAAK,UAAU,EACf,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,KAAK,eAAe,EACpB,UAAU,EACV,cAAc,EACd,SAAS,EACT,eAAe,GAChB,MAAM,WAAW,CAAA;AAElB,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA"}
|
package/dist/db/keypath.d.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
export type AutoIncrementPath = {
|
|
2
|
-
readonly _type: 'AutoIncrement';
|
|
3
|
-
readonly value: string;
|
|
4
|
-
};
|
|
5
|
-
export type ManualPath = {
|
|
6
|
-
readonly _type: 'Manual';
|
|
7
|
-
readonly value: string;
|
|
8
|
-
};
|
|
9
|
-
export type MultiPath = {
|
|
10
|
-
readonly _type: 'Multi';
|
|
11
|
-
readonly first: string;
|
|
12
|
-
readonly second: string;
|
|
13
|
-
readonly rest: readonly string[];
|
|
14
|
-
};
|
|
15
|
-
/** Describes how an object store's primary key is derived from stored values. */
|
|
16
|
-
export type KeyPath = AutoIncrementPath | ManualPath | MultiPath;
|
|
17
|
-
/** Key is stored under `value` and auto-incremented by IndexedDB if absent. */
|
|
18
|
-
export declare function autoIncrementPath(value: string): KeyPath;
|
|
19
|
-
/** Key is read from the `value` property of each stored object; caller must provide it. */
|
|
20
|
-
export declare function manualPath(value: string): KeyPath;
|
|
21
|
-
/** Key is a compound of two or more property paths. */
|
|
22
|
-
export declare function multiPath(first: string, second: string, ...rest: string[]): KeyPath;
|
|
23
|
-
export type SingleIndexPath = {
|
|
24
|
-
readonly _type: 'SingleIndex';
|
|
25
|
-
readonly value: string;
|
|
26
|
-
};
|
|
27
|
-
export type MultiIndexPath = {
|
|
28
|
-
readonly _type: 'MultiIndex';
|
|
29
|
-
readonly first: string;
|
|
30
|
-
readonly second: string;
|
|
31
|
-
readonly rest: readonly string[];
|
|
32
|
-
readonly multiEntry: boolean;
|
|
33
|
-
};
|
|
34
|
-
/** Describes how an IndexedDB index key is derived from stored values. */
|
|
35
|
-
export type IndexKeyPath = SingleIndexPath | MultiIndexPath;
|
|
36
|
-
/** Index key is read from a single property. */
|
|
37
|
-
export declare function singleIndexPath(value: string): IndexKeyPath;
|
|
38
|
-
/** Index key is a compound of two or more properties. Set `multiEntry: true` to index array values individually. */
|
|
39
|
-
export declare function multiIndexPath(first: string, second: string, rest: readonly string[], multiEntry: boolean): IndexKeyPath;
|
|
40
|
-
//# sourceMappingURL=keypath.d.ts.map
|
package/dist/db/keypath.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"keypath.d.ts","sourceRoot":"","sources":["../../src/db/keypath.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,CAAC,KAAK,EAAE,eAAe,CAAA;IAC/B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAA;IACxB,QAAQ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C5B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,UAAU,EAAE,OAAO,GAClB,YAAY,CAEd"}
|
package/dist/db/keypath.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/** Key is stored under `value` and auto-incremented by IndexedDB if absent. */
|
|
2
|
-
export function autoIncrementPath(value) {
|
|
3
|
-
return { _type: 'AutoIncrement', value };
|
|
4
|
-
}
|
|
5
|
-
/** Key is read from the `value` property of each stored object; caller must provide it. */
|
|
6
|
-
export function manualPath(value) {
|
|
7
|
-
return { _type: 'Manual', value };
|
|
8
|
-
}
|
|
9
|
-
/** Key is a compound of two or more property paths. */
|
|
10
|
-
export function multiPath(first, second, ...rest) {
|
|
11
|
-
return { _type: 'Multi', first, second, rest };
|
|
12
|
-
}
|
|
13
|
-
/** Index key is read from a single property. */
|
|
14
|
-
export function singleIndexPath(value) {
|
|
15
|
-
return { _type: 'SingleIndex', value };
|
|
16
|
-
}
|
|
17
|
-
/** Index key is a compound of two or more properties. Set `multiEntry: true` to index array values individually. */
|
|
18
|
-
export function multiIndexPath(first, second, rest, multiEntry) {
|
|
19
|
-
return { _type: 'MultiIndex', first, second, rest, multiEntry };
|
|
20
|
-
}
|