foldkit 0.162.0 → 0.163.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 +4 -4
- package/dist/asyncData/asyncData.d.ts +1 -1
- package/dist/asyncData/asyncData.js +1 -1
- package/dist/devTools/store.d.ts.map +1 -1
- package/dist/devTools/store.js +16 -16
- package/dist/experimental/machine/machine.d.ts +4 -4
- package/dist/experimental/machine/machine.js +3 -3
- package/dist/experimental/server/server.d.ts +9 -6
- package/dist/experimental/server/server.d.ts.map +1 -1
- package/dist/experimental/server/server.js +3 -28
- package/dist/html/index.d.ts +31 -20
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +1 -1
- package/dist/runtime/deepFreeze.d.ts +1 -1
- package/dist/runtime/deepFreeze.js +1 -1
- package/dist/runtime/documentMetadata.d.ts.map +1 -1
- package/dist/runtime/documentMetadata.js +69 -47
- package/dist/runtime/managedResourceFibers.d.ts +1 -1
- package/dist/runtime/managedResourceFibers.d.ts.map +1 -1
- package/dist/runtime/managedResourceFibers.js +3 -2
- package/dist/runtime/subscriptionFibers.d.ts +1 -1
- package/dist/runtime/subscriptionFibers.d.ts.map +1 -1
- package/dist/runtime/subscriptionFibers.js +3 -2
- package/dist/struct/index.d.ts +4 -4
- package/dist/struct/index.d.ts.map +1 -1
- package/dist/struct/index.js +4 -4
- package/dist/struct/public.d.ts +1 -1
- package/dist/struct/public.d.ts.map +1 -1
- package/dist/struct/public.js +1 -1
- package/dist/submodel/submodel.d.ts +3 -3
- package/dist/subscription/fromEvent.d.ts +47 -33
- package/dist/subscription/fromEvent.d.ts.map +1 -1
- package/dist/subscription/fromEvent.js +30 -25
- package/dist/subscription/keyBindings.d.ts +13 -11
- package/dist/subscription/keyBindings.d.ts.map +1 -1
- package/dist/subscription/keyBindings.js +9 -7
- package/dist/subscription/public.d.ts +1 -1
- package/dist/subscription/public.d.ts.map +1 -1
- package/dist/test/apps/bubbling.js +5 -5
- package/dist/test/apps/colorPicker.js +2 -2
- package/dist/test/apps/contentEditableEditor.js +3 -3
- package/dist/test/apps/contextMenu.js +2 -2
- package/dist/test/apps/counter.d.ts.map +1 -1
- package/dist/test/apps/counter.js +8 -5
- package/dist/test/apps/crashOnRender.js +3 -3
- package/dist/test/apps/drafts.js +3 -3
- package/dist/test/apps/feedSocket.js +5 -5
- package/dist/test/apps/fileUpload.js +2 -2
- package/dist/test/apps/focusBoundary.js +3 -3
- package/dist/test/apps/formChild.js +4 -4
- package/dist/test/apps/interactions.js +7 -7
- package/dist/test/apps/keypress.js +3 -3
- package/dist/test/apps/keypressSelf.js +2 -2
- package/dist/test/apps/login.js +7 -7
- package/dist/test/apps/mountPanel.js +4 -4
- package/dist/test/apps/multiRole.js +2 -2
- package/dist/test/apps/pointer.d.ts +5 -1
- package/dist/test/apps/pointer.d.ts.map +1 -1
- package/dist/test/apps/pointer.js +16 -7
- package/dist/test/apps/resumeUpload.js +5 -5
- package/dist/test/apps/scorePanel.js +2 -2
- package/dist/test/apps/selectiveKeys.d.ts.map +1 -1
- package/dist/test/apps/selectiveKeys.js +5 -3
- package/dist/test/apps/uploads.d.ts.map +1 -1
- package/dist/test/apps/uploads.js +13 -7
- package/dist/test/query.js +5 -5
- package/dist/test/scene.d.ts +6 -2
- package/dist/test/scene.d.ts.map +1 -1
- package/dist/test/scene.js +27 -3
- package/dist/update/update.d.ts +4 -4
- package/dist/update/update.js +3 -3
- package/package.json +6 -6
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/subscription/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAErE,YAAY,EACV,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,gBAAgB,CAAA;AAEvB,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,sCAAsC,EACtC,gBAAgB,GACjB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/subscription/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAA;AAErE,YAAY,EACV,UAAU,EACV,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,aAAa,GACd,MAAM,mBAAmB,CAAA;AAE1B,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAEpD,YAAY,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAA;AAE/D,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,gCAAgC,GACjC,MAAM,gBAAgB,CAAA;AAEvB,YAAY,EACV,eAAe,EACf,wBAAwB,EACxB,sCAAsC,EACtC,gBAAgB,GACjB,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,YAAY,EACV,UAAU,EACV,iBAAiB,EACjB,WAAW,EACX,WAAW,GACZ,MAAM,kBAAkB,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Number, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
export const Model = Schema.Struct({
|
|
6
6
|
clicks: Schema.Number,
|
|
@@ -25,16 +25,16 @@ export const initialModel = {
|
|
|
25
25
|
// UPDATE
|
|
26
26
|
export const update = (model, message) => Message.match(message, {
|
|
27
27
|
ClickedChild: () => ({
|
|
28
|
-
model:
|
|
28
|
+
model: modifyFields(model, { childClicks: Number.increment }),
|
|
29
29
|
}),
|
|
30
30
|
ClickedContainer: () => ({
|
|
31
|
-
model:
|
|
31
|
+
model: modifyFields(model, { clicks: Number.increment }),
|
|
32
32
|
}),
|
|
33
33
|
DoubleClickedContainer: () => ({
|
|
34
|
-
model:
|
|
34
|
+
model: modifyFields(model, { doubleClicks: Number.increment }),
|
|
35
35
|
}),
|
|
36
36
|
SubmittedForm: () => ({
|
|
37
|
-
model:
|
|
37
|
+
model: modifyFields(model, { submissions: Number.increment }),
|
|
38
38
|
}),
|
|
39
39
|
});
|
|
40
40
|
// VIEW
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import * as CustomElement from '../../customElement/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// CUSTOM ELEMENT
|
|
6
6
|
export const hexColorPicker = CustomElement.define({
|
|
7
7
|
tag: 'hex-color-picker',
|
|
@@ -23,7 +23,7 @@ export const initialModel = Model.make({ color: '#000000' });
|
|
|
23
23
|
// UPDATE
|
|
24
24
|
export const update = (model, message) => Message.match(message, {
|
|
25
25
|
ChangedColor: ({ value }) => ({
|
|
26
|
-
model:
|
|
26
|
+
model: modifyFields(model, { color: () => value }),
|
|
27
27
|
}),
|
|
28
28
|
});
|
|
29
29
|
// VIEW
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Option, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
export const Model = Schema.Struct({
|
|
6
6
|
body: Schema.String,
|
|
@@ -17,10 +17,10 @@ export const initialModel = {
|
|
|
17
17
|
// UPDATE
|
|
18
18
|
export const update = (model, message) => Message.match(message, {
|
|
19
19
|
UpdatedBody: ({ value }) => ({
|
|
20
|
-
model:
|
|
20
|
+
model: modifyFields(model, { body: () => value }),
|
|
21
21
|
}),
|
|
22
22
|
InsertedText: ({ value }) => ({
|
|
23
|
-
model:
|
|
23
|
+
model: modifyFields(model, { body: body => body + value }),
|
|
24
24
|
}),
|
|
25
25
|
});
|
|
26
26
|
// VIEW
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Number, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
3
|
import { defineTaggedUnion } from '../../schema/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
const ContextMenuSource = Schema.Literals(['Direct', 'Inner', 'Outer']);
|
|
7
7
|
const ContextMenuState = defineTaggedUnion({
|
|
@@ -24,7 +24,7 @@ export const initialModel = Model.make({
|
|
|
24
24
|
// UPDATE
|
|
25
25
|
export const update = (model, message) => Message.match(message, {
|
|
26
26
|
OpenedContextMenu: ({ source }) => ({
|
|
27
|
-
model:
|
|
27
|
+
model: modifyFields(model, {
|
|
28
28
|
contextMenu: () => ContextMenuState.Open({ source }),
|
|
29
29
|
openCount: Number.increment,
|
|
30
30
|
}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../../../src/test/apps/counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEtD,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAG5D,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAIpD,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,OAAO;;;;;QAIE,EAAE;;;;;;;;QAMC,KAAK;;;QACR,KAAK;;EACzB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,eAAO,MAAM,UAAU;;;iBAGrB,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;iBAKzB,CAAA;AAIF,eAAO,MAAM,YAAY,EAAE,KAA6B,CAAA;AAIxD,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"counter.d.ts","sourceRoot":"","sources":["../../../src/test/apps/counter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEtD,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAG5D,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAIpD,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,OAAO;;;;;QAIE,EAAE;;;;;;;;QAMC,KAAK;;;QACR,KAAK;;EACzB,CAAA;AAEF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIzC,eAAO,MAAM,UAAU;;;iBAGrB,CAAA;AAEF,eAAO,MAAM,cAAc;;;;;iBAKzB,CAAA;AAIF,eAAO,MAAM,YAAY,EAAE,KAA6B,CAAA;AAIxD,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCjD,CAAA;AAIJ,eAAO,MAAM,IAAI,UAAW,KAAK,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAe5D,CAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array, Effect, Number, Schema } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
export const Model = Schema.Struct({
|
|
7
7
|
count: Schema.Number,
|
|
@@ -36,17 +36,17 @@ export const initialModel = { count: 0, log: [] };
|
|
|
36
36
|
// UPDATE
|
|
37
37
|
export const update = (model, message) => Message.match(message, {
|
|
38
38
|
ClickedIncrement: () => ({
|
|
39
|
-
model:
|
|
39
|
+
model: modifyFields(model, { count: Number.increment }),
|
|
40
40
|
}),
|
|
41
41
|
ClickedDecrement: () => ({
|
|
42
|
-
model:
|
|
42
|
+
model: modifyFields(model, { count: Number.decrement }),
|
|
43
43
|
}),
|
|
44
44
|
ClickedFetch: () => ({ model, commands: [FetchCount()] }),
|
|
45
45
|
ClickedFetchById: ({ id }) => ({
|
|
46
46
|
model,
|
|
47
47
|
commands: [FetchCountById({ id })],
|
|
48
48
|
}),
|
|
49
|
-
Ticked: () => ({ model:
|
|
49
|
+
Ticked: () => ({ model: modifyFields(model, { count: Number.increment }) }),
|
|
50
50
|
PolledCount: () => ({ model, commands: [FetchCount()] }),
|
|
51
51
|
StartedThreeFetches: () => ({
|
|
52
52
|
model,
|
|
@@ -66,7 +66,10 @@ export const update = (model, message) => Message.match(message, {
|
|
|
66
66
|
],
|
|
67
67
|
}),
|
|
68
68
|
SucceededFetchCount: ({ count }) => ({
|
|
69
|
-
model:
|
|
69
|
+
model: modifyFields(model, {
|
|
70
|
+
count: () => count,
|
|
71
|
+
log: Array.append(count),
|
|
72
|
+
}),
|
|
70
73
|
}),
|
|
71
74
|
FailedFetchCount: () => ({ model }),
|
|
72
75
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array, Effect, Schema } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
export const RawSource = Schema.Struct({
|
|
7
7
|
kind: Schema.Literal('Book'),
|
|
@@ -47,12 +47,12 @@ export const initialModel = { sources: validSources };
|
|
|
47
47
|
export const update = (model, message) => Message.match(message, {
|
|
48
48
|
ClickedReload: () => ({ model, commands: [ReloadSources()] }),
|
|
49
49
|
CompletedReloadSources: ({ sources }) => ({
|
|
50
|
-
model:
|
|
50
|
+
model: modifyFields(model, { sources: () => sources }),
|
|
51
51
|
}),
|
|
52
52
|
SelectedSource: () => ({ model }),
|
|
53
53
|
SubmittedNewSourceId: ({ id }) => {
|
|
54
54
|
const source = Source.make({ kind: 'Book', id });
|
|
55
|
-
return { model:
|
|
55
|
+
return { model: modifyFields(model, { sources: Array.append(source) }) };
|
|
56
56
|
},
|
|
57
57
|
});
|
|
58
58
|
// VIEW
|
package/dist/test/apps/drafts.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Schema } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
export const SaveStatus = Schema.Literals(['Editing', 'Saving', 'Saved']);
|
|
7
7
|
export const Model = Schema.Struct({
|
|
@@ -26,11 +26,11 @@ export const initialModel = { revision: 0, status: 'Editing' };
|
|
|
26
26
|
// UPDATE
|
|
27
27
|
export const update = (model, message) => Message.match(message, {
|
|
28
28
|
ClickedSaveDraft: () => ({
|
|
29
|
-
model:
|
|
29
|
+
model: modifyFields(model, { status: () => 'Saving' }),
|
|
30
30
|
commands: [SaveDraft({ revision: model.revision })],
|
|
31
31
|
}),
|
|
32
32
|
SucceededSaveDraft: () => ({
|
|
33
|
-
model:
|
|
33
|
+
model: modifyFields(model, { status: () => 'Saved' }),
|
|
34
34
|
}),
|
|
35
35
|
});
|
|
36
36
|
// VIEW
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Boolean, Effect, Option, Schema } from 'effect';
|
|
2
2
|
import * as ManagedResource from '../../managedResource/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
export const Model = Schema.Struct({
|
|
7
7
|
isFeedOpen: Schema.Boolean,
|
|
@@ -44,16 +44,16 @@ export const initialModel = Model.make({
|
|
|
44
44
|
// UPDATE
|
|
45
45
|
export const update = (model, message) => Message.match(message, {
|
|
46
46
|
ClickedToggleFeed: () => ({
|
|
47
|
-
model:
|
|
47
|
+
model: modifyFields(model, { isFeedOpen: Boolean.not }),
|
|
48
48
|
}),
|
|
49
49
|
AcquiredFeedSocket: () => ({
|
|
50
|
-
model:
|
|
50
|
+
model: modifyFields(model, { status: () => 'Connected' }),
|
|
51
51
|
}),
|
|
52
52
|
ReleasedFeedSocket: () => ({
|
|
53
|
-
model:
|
|
53
|
+
model: modifyFields(model, { status: () => 'Disconnected' }),
|
|
54
54
|
}),
|
|
55
55
|
FailedAcquireFeedSocket: () => ({
|
|
56
|
-
model:
|
|
56
|
+
model: modifyFields(model, { status: () => 'Failed' }),
|
|
57
57
|
}),
|
|
58
58
|
});
|
|
59
59
|
// VIEW
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import { File } from '../../file/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
export const initialModel = { receivedFiles: [] };
|
|
6
6
|
// MESSAGE
|
|
7
7
|
export const Message = defineMessageUnion({
|
|
@@ -10,7 +10,7 @@ export const Message = defineMessageUnion({
|
|
|
10
10
|
// UPDATE
|
|
11
11
|
export const update = (model, message) => Message.match(message, {
|
|
12
12
|
ReceivedFiles: ({ files }) => ({
|
|
13
|
-
model:
|
|
13
|
+
model: modifyFields(model, { receivedFiles: () => files }),
|
|
14
14
|
}),
|
|
15
15
|
});
|
|
16
16
|
// VIEW
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
const FocusState = Schema.Literals(['Outside', 'Within']);
|
|
6
6
|
export const Model = Schema.Struct({
|
|
@@ -18,10 +18,10 @@ export const initialModel = {
|
|
|
18
18
|
// UPDATE
|
|
19
19
|
export const update = (model, message) => Message.match(message, {
|
|
20
20
|
EnteredFocusRegion: () => ({
|
|
21
|
-
model:
|
|
21
|
+
model: modifyFields(model, { focusState: () => 'Within' }),
|
|
22
22
|
}),
|
|
23
23
|
LeftFocusRegion: () => ({
|
|
24
|
-
model:
|
|
24
|
+
model: modifyFields(model, { focusState: () => 'Outside' }),
|
|
25
25
|
}),
|
|
26
26
|
});
|
|
27
27
|
// VIEW
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Array, Effect, Option, Schema } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
import * as Update from '../../update/index.js';
|
|
6
6
|
// CHILD MODEL
|
|
7
7
|
export const ChildModel = Schema.Struct({
|
|
@@ -67,16 +67,16 @@ export const initialParentModel = {
|
|
|
67
67
|
// PARENT UPDATE
|
|
68
68
|
const foldChildOutMessage = ChildOutMessage.match({
|
|
69
69
|
RequestedSave: ({ id }) => model => ({
|
|
70
|
-
model:
|
|
70
|
+
model: modifyFields(model, { savedIds: Array.append(id) }),
|
|
71
71
|
}),
|
|
72
72
|
RequestedCancel: () => model => ({
|
|
73
|
-
model:
|
|
73
|
+
model: modifyFields(model, { cancelled: () => true }),
|
|
74
74
|
}),
|
|
75
75
|
});
|
|
76
76
|
const foldChildUpdate = Update.foldChild({
|
|
77
77
|
update: childUpdate,
|
|
78
78
|
read: (model) => Option.some(model.child),
|
|
79
|
-
write: (model, nextChild) =>
|
|
79
|
+
write: (model, nextChild) => modifyFields(model, { child: () => nextChild }),
|
|
80
80
|
toParentMessage: message => ParentMessage.GotChildMessage({ message }),
|
|
81
81
|
foldOutMessage: foldChildOutMessage,
|
|
82
82
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Number, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
export const Model = Schema.Struct({
|
|
6
6
|
clicks: Schema.Number,
|
|
@@ -29,22 +29,22 @@ export const initialModel = {
|
|
|
29
29
|
// UPDATE
|
|
30
30
|
export const update = (model, message) => Message.match(message, {
|
|
31
31
|
ClickedButton: () => ({
|
|
32
|
-
model:
|
|
32
|
+
model: modifyFields(model, { clicks: Number.increment }),
|
|
33
33
|
}),
|
|
34
34
|
DoubleClickedButton: () => ({
|
|
35
|
-
model:
|
|
35
|
+
model: modifyFields(model, { doubleClicks: Number.increment }),
|
|
36
36
|
}),
|
|
37
37
|
HoveredTarget: () => ({
|
|
38
|
-
model:
|
|
38
|
+
model: modifyFields(model, { hovered: () => true }),
|
|
39
39
|
}),
|
|
40
40
|
FocusedInput: () => ({
|
|
41
|
-
model:
|
|
41
|
+
model: modifyFields(model, { focused: () => true }),
|
|
42
42
|
}),
|
|
43
43
|
BlurredInput: () => ({
|
|
44
|
-
model:
|
|
44
|
+
model: modifyFields(model, { focused: () => false }),
|
|
45
45
|
}),
|
|
46
46
|
ChangedSelect: ({ value }) => ({
|
|
47
|
-
model:
|
|
47
|
+
model: modifyFields(model, { changed: () => value }),
|
|
48
48
|
}),
|
|
49
49
|
});
|
|
50
50
|
// VIEW
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
export const Model = Schema.Struct({
|
|
6
6
|
lastKey: Schema.String,
|
|
@@ -19,13 +19,13 @@ export const initialModel = {
|
|
|
19
19
|
// UPDATE
|
|
20
20
|
export const update = (model, message) => Message.match(message, {
|
|
21
21
|
PressedKey: ({ key }) => ({
|
|
22
|
-
model:
|
|
22
|
+
model: modifyFields(model, {
|
|
23
23
|
lastKey: () => key,
|
|
24
24
|
isShifted: () => false,
|
|
25
25
|
}),
|
|
26
26
|
}),
|
|
27
27
|
PressedShiftKey: ({ key }) => ({
|
|
28
|
-
model:
|
|
28
|
+
model: modifyFields(model, {
|
|
29
29
|
lastKey: () => key,
|
|
30
30
|
isShifted: () => true,
|
|
31
31
|
}),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
export const Model = Schema.Struct({
|
|
6
6
|
lastKey: Schema.String,
|
|
@@ -16,7 +16,7 @@ export const initialModel = {
|
|
|
16
16
|
// UPDATE
|
|
17
17
|
export const update = (model, message) => Message.match(message, {
|
|
18
18
|
PressedSelfKey: ({ key }) => ({
|
|
19
|
-
model:
|
|
19
|
+
model: modifyFields(model, { lastKey: () => key }),
|
|
20
20
|
}),
|
|
21
21
|
});
|
|
22
22
|
// VIEW
|
package/dist/test/apps/login.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Match, Schema } from 'effect';
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import { defineMessageUnion } from '../../message/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
export const Model = Schema.Struct({
|
|
7
7
|
email: Schema.String,
|
|
@@ -35,26 +35,26 @@ export const initialModel = {
|
|
|
35
35
|
// UPDATE
|
|
36
36
|
export const update = (model, message) => Message.match(message, {
|
|
37
37
|
UpdatedEmail: ({ value }) => ({
|
|
38
|
-
model:
|
|
38
|
+
model: modifyFields(model, { email: () => value }),
|
|
39
39
|
}),
|
|
40
40
|
UpdatedPassword: ({ value }) => ({
|
|
41
|
-
model:
|
|
41
|
+
model: modifyFields(model, { password: () => value }),
|
|
42
42
|
}),
|
|
43
43
|
SubmittedLogin: () => ({
|
|
44
|
-
model:
|
|
44
|
+
model: modifyFields(model, { status: () => 'Submitting' }),
|
|
45
45
|
commands: [Authenticate()],
|
|
46
46
|
}),
|
|
47
47
|
SucceededAuthenticate: ({ username }) => ({
|
|
48
|
-
model:
|
|
48
|
+
model: modifyFields(model, {
|
|
49
49
|
status: () => 'LoggedIn',
|
|
50
50
|
username: () => username,
|
|
51
51
|
}),
|
|
52
52
|
}),
|
|
53
53
|
FailedAuthenticate: ({ error }) => ({
|
|
54
|
-
model:
|
|
54
|
+
model: modifyFields(model, { status: () => 'Error', error: () => error }),
|
|
55
55
|
}),
|
|
56
56
|
ClickedLogout: () => ({
|
|
57
|
-
model:
|
|
57
|
+
model: modifyFields(model, {
|
|
58
58
|
status: () => 'Idle',
|
|
59
59
|
username: () => '',
|
|
60
60
|
email: () => '',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect, Number, Option, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
3
|
import * as Mount from '../../mount/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import { modifyFields } from '../../struct/index.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
export const Model = Schema.Struct({
|
|
7
7
|
isOpen: Schema.Boolean,
|
|
@@ -52,15 +52,15 @@ export const initialModel = {
|
|
|
52
52
|
// UPDATE
|
|
53
53
|
export const update = (model, message) => Message.match(message, {
|
|
54
54
|
ClickedToggle: () => ({
|
|
55
|
-
model:
|
|
55
|
+
model: modifyFields(model, { isOpen: isOpen => !isOpen }),
|
|
56
56
|
}),
|
|
57
57
|
MeasuredPanel: ({ width }) => ({
|
|
58
|
-
model:
|
|
58
|
+
model: modifyFields(model, { measuredWidth: () => Option.some(width) }),
|
|
59
59
|
}),
|
|
60
60
|
CompletedFocusButton: () => ({ model }),
|
|
61
61
|
FailedMountSidebar: () => ({ model }),
|
|
62
62
|
ClickedIncrement: () => ({
|
|
63
|
-
model:
|
|
63
|
+
model: modifyFields(model, { count: Number.increment }),
|
|
64
64
|
}),
|
|
65
65
|
ScrolledTo: () => ({ model }),
|
|
66
66
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Number, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
export const Model = Schema.Struct({ clicks: Schema.Number });
|
|
6
6
|
// MESSAGE
|
|
@@ -12,7 +12,7 @@ export const initialModel = { clicks: 0 };
|
|
|
12
12
|
// UPDATE
|
|
13
13
|
export const update = (model, message) => Message.match(message, {
|
|
14
14
|
ClickedFallback: () => ({
|
|
15
|
-
model:
|
|
15
|
+
model: modifyFields(model, { clicks: Number.increment }),
|
|
16
16
|
}),
|
|
17
17
|
});
|
|
18
18
|
// VIEW
|
|
@@ -1,15 +1,17 @@
|
|
|
1
|
-
import { Schema } from 'effect';
|
|
1
|
+
import { Option, Schema } from 'effect';
|
|
2
2
|
import type { Html, HtmlBuilder } from '../../html/index.js';
|
|
3
3
|
import type * as Update from '../../update/index.js';
|
|
4
4
|
export declare const Model: Schema.Struct<{
|
|
5
5
|
readonly pointerDownCount: Schema.Number;
|
|
6
6
|
readonly pointerUpCount: Schema.Number;
|
|
7
7
|
readonly lastPointerType: Schema.String;
|
|
8
|
+
readonly maybeLastPointerId: Schema.Option<Schema.Number>;
|
|
8
9
|
}>;
|
|
9
10
|
export type Model = typeof Model.Type;
|
|
10
11
|
declare const Message: import("../../schema/index.js").MessageUnion<{
|
|
11
12
|
readonly PressedPointerDown: {
|
|
12
13
|
pointerType: Schema.String;
|
|
14
|
+
pointerId: Schema.Number;
|
|
13
15
|
};
|
|
14
16
|
readonly ReleasedPointerUp: {
|
|
15
17
|
pointerType: Schema.String;
|
|
@@ -22,10 +24,12 @@ export declare const update: (model: Model, message: Message) => Readonly<{
|
|
|
22
24
|
readonly pointerDownCount: number;
|
|
23
25
|
readonly pointerUpCount: number;
|
|
24
26
|
readonly lastPointerType: string;
|
|
27
|
+
readonly maybeLastPointerId: Option.Option<number>;
|
|
25
28
|
};
|
|
26
29
|
commands?: Update.Commands<{
|
|
27
30
|
readonly _tag: "PressedPointerDown";
|
|
28
31
|
readonly pointerType: string;
|
|
32
|
+
readonly pointerId: number;
|
|
29
33
|
} | {
|
|
30
34
|
readonly _tag: "ReleasedPointerUp";
|
|
31
35
|
readonly pointerType: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../../../src/test/apps/pointer.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../../../src/test/apps/pointer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAE/C,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAG5D,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAIpD,eAAO,MAAM,KAAK;;;;;EAKhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,QAAA,MAAM,OAAO;;QACW,WAAW;QAAiB,SAAS;;;QACtC,WAAW;;EAChC,CAAA;AACF,KAAK,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAIlC,eAAO,MAAM,YAAY,EAAE,KAK1B,CAAA;AAID,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;;;;;EAejD,CAAA;AAIJ,eAAO,MAAM,IAAI,UAAW,KAAK,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IA6D5D,CAAA"}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import { Number, Option, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
// MODEL
|
|
5
5
|
export const Model = Schema.Struct({
|
|
6
6
|
pointerDownCount: Schema.Number,
|
|
7
7
|
pointerUpCount: Schema.Number,
|
|
8
8
|
lastPointerType: Schema.String,
|
|
9
|
+
maybeLastPointerId: Schema.Option(Schema.Number),
|
|
9
10
|
});
|
|
10
11
|
// MESSAGE
|
|
11
12
|
const Message = defineMessageUnion({
|
|
12
|
-
PressedPointerDown: { pointerType: Schema.String },
|
|
13
|
+
PressedPointerDown: { pointerType: Schema.String, pointerId: Schema.Number },
|
|
13
14
|
ReleasedPointerUp: { pointerType: Schema.String },
|
|
14
15
|
});
|
|
15
16
|
// INIT
|
|
@@ -17,17 +18,19 @@ export const initialModel = {
|
|
|
17
18
|
pointerDownCount: 0,
|
|
18
19
|
pointerUpCount: 0,
|
|
19
20
|
lastPointerType: '',
|
|
21
|
+
maybeLastPointerId: Option.none(),
|
|
20
22
|
};
|
|
21
23
|
// UPDATE
|
|
22
24
|
export const update = (model, message) => Message.match(message, {
|
|
23
|
-
PressedPointerDown: ({ pointerType }) => ({
|
|
24
|
-
model:
|
|
25
|
+
PressedPointerDown: ({ pointerType, pointerId }) => ({
|
|
26
|
+
model: modifyFields(model, {
|
|
25
27
|
pointerDownCount: Number.increment,
|
|
26
28
|
lastPointerType: () => pointerType,
|
|
29
|
+
maybeLastPointerId: () => Option.some(pointerId),
|
|
27
30
|
}),
|
|
28
31
|
}),
|
|
29
32
|
ReleasedPointerUp: ({ pointerType }) => ({
|
|
30
|
-
model:
|
|
33
|
+
model: modifyFields(model, {
|
|
31
34
|
pointerUpCount: Number.increment,
|
|
32
35
|
lastPointerType: () => pointerType,
|
|
33
36
|
}),
|
|
@@ -38,13 +41,19 @@ export const view = (model, h) => {
|
|
|
38
41
|
return h.div([], [
|
|
39
42
|
h.button([
|
|
40
43
|
h.AriaLabel('pointer target'),
|
|
41
|
-
h.OnPointerDown(pointerType => Option.some(Message.PressedPointerDown({ pointerType }))),
|
|
44
|
+
h.OnPointerDown((pointerType, _button, _screenX, _screenY, _timeStamp, _clientX, _clientY, pointerId) => Option.some(Message.PressedPointerDown({ pointerType, pointerId }))),
|
|
42
45
|
h.OnPointerUp((_screenX, _screenY, pointerType, _timeStamp) => Option.some(Message.ReleasedPointerUp({ pointerType }))),
|
|
43
46
|
], [`down=${model.pointerDownCount} up=${model.pointerUpCount}`]),
|
|
44
47
|
h.div([
|
|
45
48
|
h.AriaLabel('nested target'),
|
|
46
|
-
h.OnPointerDown(pointerType => Option.some(Message.PressedPointerDown({ pointerType }))),
|
|
49
|
+
h.OnPointerDown((pointerType, _button, _screenX, _screenY, _timeStamp, _clientX, _clientY, pointerId) => Option.some(Message.PressedPointerDown({ pointerType, pointerId }))),
|
|
47
50
|
], [h.span([], [`type=${model.lastPointerType}`])]),
|
|
51
|
+
h.span([h.AriaLabel('last pointer id')], [
|
|
52
|
+
Option.match(model.maybeLastPointerId, {
|
|
53
|
+
onNone: () => 'none',
|
|
54
|
+
onSome: globalThis.String,
|
|
55
|
+
}),
|
|
56
|
+
]),
|
|
48
57
|
h.span([h.AriaLabel('no handler')], ['orphan']),
|
|
49
58
|
]);
|
|
50
59
|
};
|
|
@@ -2,7 +2,7 @@ import { Effect, Match, Option, Schema } from 'effect';
|
|
|
2
2
|
import * as Command from '../../command/index.js';
|
|
3
3
|
import * as File from '../../file/index.js';
|
|
4
4
|
import { defineMessageUnion } from '../../message/index.js';
|
|
5
|
-
import {
|
|
5
|
+
import { modifyFields } from '../../struct/index.js';
|
|
6
6
|
// MODEL
|
|
7
7
|
export const Model = Schema.Struct({
|
|
8
8
|
maybeResume: Schema.Option(File.File),
|
|
@@ -41,7 +41,7 @@ export const initialModel = {
|
|
|
41
41
|
export const update = (model, message) => Message.match(message, {
|
|
42
42
|
ClickedChooseResume: () => ({ model, commands: [SelectResume()] }),
|
|
43
43
|
CompletedSelectResume: ({ file }) => ({
|
|
44
|
-
model:
|
|
44
|
+
model: modifyFields(model, {
|
|
45
45
|
maybeResume: () => Option.some(file),
|
|
46
46
|
maybePreviewDataUrl: () => Option.none(),
|
|
47
47
|
readStatus: () => 'Reading',
|
|
@@ -50,16 +50,16 @@ export const update = (model, message) => Message.match(message, {
|
|
|
50
50
|
}),
|
|
51
51
|
CancelledSelectResume: () => ({ model }),
|
|
52
52
|
SucceededReadPreview: ({ dataUrl }) => ({
|
|
53
|
-
model:
|
|
53
|
+
model: modifyFields(model, {
|
|
54
54
|
maybePreviewDataUrl: () => Option.some(dataUrl),
|
|
55
55
|
readStatus: () => 'Idle',
|
|
56
56
|
}),
|
|
57
57
|
}),
|
|
58
58
|
FailedReadPreview: () => ({
|
|
59
|
-
model:
|
|
59
|
+
model: modifyFields(model, { readStatus: () => 'Failed' }),
|
|
60
60
|
}),
|
|
61
61
|
ClickedRemoveResume: () => ({
|
|
62
|
-
model:
|
|
62
|
+
model: modifyFields(model, {
|
|
63
63
|
maybeResume: () => Option.none(),
|
|
64
64
|
maybePreviewDataUrl: () => Option.none(),
|
|
65
65
|
readStatus: () => 'Idle',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Number, Schema } from 'effect';
|
|
2
2
|
import { defineMessageUnion } from '../../message/index.js';
|
|
3
|
-
import {
|
|
3
|
+
import { modifyFields } from '../../struct/index.js';
|
|
4
4
|
import { defineView } from '../../submodel/public.js';
|
|
5
5
|
// MODEL
|
|
6
6
|
export const Model = Schema.Struct({ score: Schema.Number });
|
|
@@ -13,7 +13,7 @@ export const initialModel = Model.make({ score: 0 });
|
|
|
13
13
|
// UPDATE
|
|
14
14
|
export const update = (model, message) => Message.match(message, {
|
|
15
15
|
ClickedIncrement: () => ({
|
|
16
|
-
model:
|
|
16
|
+
model: modifyFields(model, { score: Number.increment }),
|
|
17
17
|
}),
|
|
18
18
|
});
|
|
19
19
|
export const view = defineView((model, viewInputs, h) => h.div([], [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"selectiveKeys.d.ts","sourceRoot":"","sources":["../../../src/test/apps/selectiveKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvD,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAG5D,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAIpD,eAAO,MAAM,KAAK;;EAEhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,OAAO;;;;EAIlB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC;mEACmE;AACnE,eAAO,MAAM,WAAW;;iBAGtB,CAAA;AAIF,eAAO,MAAM,YAAY,EAAE,KAAsB,CAAA;AAIjD,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"selectiveKeys.d.ts","sourceRoot":"","sources":["../../../src/test/apps/selectiveKeys.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAkB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvD,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAG5D,OAAO,KAAK,KAAK,MAAM,MAAM,uBAAuB,CAAA;AAIpD,eAAO,MAAM,KAAK;;EAEhB,CAAA;AACF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,eAAO,MAAM,OAAO;;;;EAIlB,CAAA;AACF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAA;AAEzC;mEACmE;AACnE,eAAO,MAAM,WAAW;;iBAGtB,CAAA;AAIF,eAAO,MAAM,YAAY,EAAE,KAAsB,CAAA;AAIjD,eAAO,MAAM,MAAM,UAAW,KAAK,WAAW,OAAO;;;;;;;;;;;;EAUjD,CAAA;AAIJ,eAAO,MAAM,KAAK,mBAAmB,CAAA;AACrC,eAAO,MAAM,OAAO,yBAAyB,CAAA;AAE7C,eAAO,MAAM,IAAI,UAAW,KAAK,KAAK,WAAW,CAAC,OAAO,CAAC,KAAG,IAY1D,CAAA"}
|