foldkit 0.136.0 → 0.138.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/dist/command/index.d.ts +5 -0
- package/dist/command/index.d.ts.map +1 -1
- package/dist/command/index.js +13 -3
- package/dist/dom/dom.d.ts +13 -0
- package/dist/dom/dom.d.ts.map +1 -1
- package/dist/dom/dom.js +13 -0
- package/dist/file/select.d.ts +2 -2
- package/dist/file/select.js +2 -2
- package/dist/html/index.d.ts +1 -1
- package/dist/html/index.d.ts.map +1 -1
- package/dist/render/commit.d.ts +44 -0
- package/dist/render/commit.d.ts.map +1 -0
- package/dist/render/commit.js +58 -0
- package/dist/render/render.d.ts +12 -7
- package/dist/render/render.d.ts.map +1 -1
- package/dist/render/render.js +45 -17
- package/dist/runtime/public.d.ts +1 -0
- package/dist/runtime/public.d.ts.map +1 -1
- package/dist/runtime/runtime.d.ts +20 -9
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +1013 -789
- package/dist/runtime/viewTransition.d.ts +69 -0
- package/dist/runtime/viewTransition.d.ts.map +1 -0
- package/dist/runtime/viewTransition.js +37 -0
- package/dist/test/apps/attributes.js +1 -1
- package/dist/test/apps/crashOnRender.d.ts +3 -3
- package/dist/test/apps/crashOnRender.d.ts.map +1 -1
- package/dist/test/apps/crashOnRender.js +7 -5
- package/dist/test/apps/formChild.d.ts +5 -5
- package/dist/test/apps/formChild.d.ts.map +1 -1
- package/dist/test/apps/formChild.js +5 -5
- package/dist/test/apps/mountPanel.js +1 -1
- package/dist/test/apps/resumeUpload.d.ts +3 -3
- package/dist/test/apps/resumeUpload.d.ts.map +1 -1
- package/dist/test/apps/resumeUpload.js +5 -5
- package/package.json +1 -1
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { Option } from 'effect';
|
|
2
|
+
/** Context passed to the `viewTransition` predicate before each live render.
|
|
3
|
+
*
|
|
4
|
+
* A View Transition animates between two states, so the predicate is given
|
|
5
|
+
* both. `previousModel` is the Model behind the DOM on screen, the state the
|
|
6
|
+
* browser is about to snapshot. `model` is the Model the pending render will
|
|
7
|
+
* paint. Direction is the pair: comparing the two says where the application
|
|
8
|
+
* is going and where it came from, with no route history kept in the Model.
|
|
9
|
+
*
|
|
10
|
+
* `previousModel` is always a real painted state rather than an `Option`. The
|
|
11
|
+
* predicate only runs once a Message has dirtied the Model, and the initial
|
|
12
|
+
* render completes before any Message is processed.
|
|
13
|
+
*
|
|
14
|
+
* `message` is the Message that dirtied the Model for this frame. The runtime
|
|
15
|
+
* coalesces a burst of dispatches into one render frame, so the predicate
|
|
16
|
+
* sees the last dirtying Message before the frame. */
|
|
17
|
+
export type ViewTransitionContext<Model, Message> = Readonly<{
|
|
18
|
+
previousModel: Model;
|
|
19
|
+
model: Model;
|
|
20
|
+
message: Message;
|
|
21
|
+
}>;
|
|
22
|
+
/** What the `viewTransition` predicate returns for a render. `false` renders
|
|
23
|
+
* plainly. `true` wraps the render in `document.startViewTransition`.
|
|
24
|
+
* `{ types }` additionally tags the transition so CSS can scope animations
|
|
25
|
+
* via `:active-view-transition-type(...)`. */
|
|
26
|
+
export type ViewTransitionDecision = boolean | Readonly<{
|
|
27
|
+
types: ReadonlyArray<string>;
|
|
28
|
+
}>;
|
|
29
|
+
/** Decides, per render, whether the DOM update should run inside a View
|
|
30
|
+
* Transition. The predicate is total over the Message union, so animation is
|
|
31
|
+
* opted into per Message: return `true` for the ones worth animating and
|
|
32
|
+
* `false` for everything else. */
|
|
33
|
+
export type ViewTransitionConfig<Model, Message> = (context: ViewTransitionContext<Model, Message>) => ViewTransitionDecision;
|
|
34
|
+
/** The slice of the DOM `ViewTransition` handle the runtime consumes. `ready`
|
|
35
|
+
* and `finished` are optional: the runtime only ever attaches rejection
|
|
36
|
+
* handlers to them, so a handle that omits them stays valid. */
|
|
37
|
+
export type ViewTransitionHandle = Readonly<{
|
|
38
|
+
updateCallbackDone: Promise<void>;
|
|
39
|
+
skipTransition: () => void;
|
|
40
|
+
ready?: Promise<void>;
|
|
41
|
+
finished?: Promise<void>;
|
|
42
|
+
}>;
|
|
43
|
+
/**
|
|
44
|
+
* Attaches no-op rejection handlers to a transition's promises.
|
|
45
|
+
*
|
|
46
|
+
* The browser rejects `ready` whenever a transition is skipped, and skipping
|
|
47
|
+
* is routine rather than exceptional: a second navigation lands mid-animation,
|
|
48
|
+
* the document is hidden, or the runtime skips the transition itself while
|
|
49
|
+
* tearing down. The runtime never awaits any of these promises, so without a
|
|
50
|
+
* handler every skip surfaces as an unhandled rejection and lands in whatever
|
|
51
|
+
* the application wired to `window.onunhandledrejection`, turning a purely
|
|
52
|
+
* cosmetic animation into an error report.
|
|
53
|
+
*/
|
|
54
|
+
export declare const __silenceViewTransitionRejections: (handle: ViewTransitionHandle) => void;
|
|
55
|
+
/** Starts a View Transition around `update`. Injected into the render path so
|
|
56
|
+
* tests can fake the browser API. */
|
|
57
|
+
export type StartViewTransition = (update: () => void, maybeTypes: Option.Option<ReadonlyArray<string>>) => ViewTransitionHandle;
|
|
58
|
+
/** Feature-detects `document.startViewTransition`, returning `Option.none()`
|
|
59
|
+
* where the API is unavailable so the runtime falls through to plain
|
|
60
|
+
* renders. Transition types are newer than the API itself, so when the
|
|
61
|
+
* running browser only supports the callback form the types are dropped and
|
|
62
|
+
* the transition still runs untyped. */
|
|
63
|
+
export declare const __resolveStartViewTransition: () => Option.Option<StartViewTransition>;
|
|
64
|
+
/** Normalizes a `ViewTransitionDecision` into "skip" (`Option.none()`) or
|
|
65
|
+
* "transition, with these types" so the render path branches once. */
|
|
66
|
+
export declare const __decideViewTransition: <Model, Message>(decide: ViewTransitionConfig<Model, Message>, context: ViewTransitionContext<Model, Message>) => Option.Option<Readonly<{
|
|
67
|
+
maybeTypes: Option.Option<ReadonlyArray<string>>;
|
|
68
|
+
}>>;
|
|
69
|
+
//# sourceMappingURL=viewTransition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"viewTrans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AmB,CAoBpC,CAAA;AAEH;uEACuE;AACvE,eAAO,MAAM,sBAAsB,GAAI,KAAK,EAAE,OAAO,EACnD,QAAQ,oBAAoB,CAAC,KAAK,EAAE,OAAO,CAAC,EAC5C,SAAS,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,KAC7C,MAAM,CAAC,MAAM,CACd,QAAQ,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC,CAa7D,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Match, Option, pipe } from 'effect';
|
|
2
|
+
/**
|
|
3
|
+
* Attaches no-op rejection handlers to a transition's promises.
|
|
4
|
+
*
|
|
5
|
+
* The browser rejects `ready` whenever a transition is skipped, and skipping
|
|
6
|
+
* is routine rather than exceptional: a second navigation lands mid-animation,
|
|
7
|
+
* the document is hidden, or the runtime skips the transition itself while
|
|
8
|
+
* tearing down. The runtime never awaits any of these promises, so without a
|
|
9
|
+
* handler every skip surfaces as an unhandled rejection and lands in whatever
|
|
10
|
+
* the application wired to `window.onunhandledrejection`, turning a purely
|
|
11
|
+
* cosmetic animation into an error report.
|
|
12
|
+
*/
|
|
13
|
+
export const __silenceViewTransitionRejections = (handle) => {
|
|
14
|
+
const ignore = () => { };
|
|
15
|
+
handle.ready?.catch(ignore);
|
|
16
|
+
handle.finished?.catch(ignore);
|
|
17
|
+
handle.updateCallbackDone.catch(ignore);
|
|
18
|
+
};
|
|
19
|
+
/** Feature-detects `document.startViewTransition`, returning `Option.none()`
|
|
20
|
+
* where the API is unavailable so the runtime falls through to plain
|
|
21
|
+
* renders. Transition types are newer than the API itself, so when the
|
|
22
|
+
* running browser only supports the callback form the types are dropped and
|
|
23
|
+
* the transition still runs untyped. */
|
|
24
|
+
export const __resolveStartViewTransition = () => {
|
|
25
|
+
if (typeof document.startViewTransition !== 'function') {
|
|
26
|
+
return Option.none();
|
|
27
|
+
}
|
|
28
|
+
const isTypesSupported = typeof ViewTransition !== 'undefined' &&
|
|
29
|
+
'types' in ViewTransition.prototype;
|
|
30
|
+
return Option.some((update, maybeTypes) => pipe(maybeTypes, Option.filter(() => isTypesSupported), Option.match({
|
|
31
|
+
onNone: () => document.startViewTransition(update),
|
|
32
|
+
onSome: types => document.startViewTransition({ update, types: [...types] }),
|
|
33
|
+
})));
|
|
34
|
+
};
|
|
35
|
+
/** Normalizes a `ViewTransitionDecision` into "skip" (`Option.none()`) or
|
|
36
|
+
* "transition, with these types" so the render path branches once. */
|
|
37
|
+
export const __decideViewTransition = (decide, context) => Match.value(decide(context)).pipe(Match.withReturnType(), Match.when(false, () => Option.none()), Match.when(true, () => Option.some({ maybeTypes: Option.none() })), Match.orElse(({ types }) => Option.some({ maybeTypes: Option.some(types) })));
|
|
@@ -11,5 +11,5 @@ export const update = (model, message) => M.value(message).pipe(M.withReturnType
|
|
|
11
11
|
const TEST_ID = 'attribute-host';
|
|
12
12
|
export const testId = TEST_ID;
|
|
13
13
|
export const view = (model, h) => {
|
|
14
|
-
return h.div([h.DataAttribute('testid', TEST_ID), model.attribute]
|
|
14
|
+
return h.div([h.DataAttribute('testid', TEST_ID), model.attribute]);
|
|
15
15
|
};
|
|
@@ -19,7 +19,7 @@ export declare const Model: S.Struct<{
|
|
|
19
19
|
}>;
|
|
20
20
|
export type Model = typeof Model.Type;
|
|
21
21
|
export declare const ClickedReload: import("../../schema/index.js").CallableTaggedStruct<"ClickedReload", {}>;
|
|
22
|
-
export declare const
|
|
22
|
+
export declare const CompletedReloadSources: import("../../schema/index.js").CallableTaggedStruct<"CompletedReloadSources", {
|
|
23
23
|
sources: S.$Array<S.Struct<{
|
|
24
24
|
readonly kind: S.Literal<"Book">;
|
|
25
25
|
readonly id: S.String;
|
|
@@ -34,7 +34,7 @@ export declare const SelectedSource: import("../../schema/index.js").CallableTag
|
|
|
34
34
|
export declare const SubmittedNewSourceId: import("../../schema/index.js").CallableTaggedStruct<"SubmittedNewSourceId", {
|
|
35
35
|
id: S.String;
|
|
36
36
|
}>;
|
|
37
|
-
export declare const Message: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"ClickedReload", {}>, import("../../schema/index.js").CallableTaggedStruct<"
|
|
37
|
+
export declare const Message: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"ClickedReload", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedReloadSources", {
|
|
38
38
|
sources: S.$Array<S.Struct<{
|
|
39
39
|
readonly kind: S.Literal<"Book">;
|
|
40
40
|
readonly id: S.String;
|
|
@@ -50,7 +50,7 @@ export declare const Message: S.Union<readonly [import("../../schema/index.js").
|
|
|
50
50
|
export type Message = typeof Message.Type;
|
|
51
51
|
export declare const reloadedSources: ReadonlyArray<RawSource>;
|
|
52
52
|
export declare const ReloadSources: Command.CommandDefinitionNoArgs<"ReloadSources", Effect.Effect<{
|
|
53
|
-
readonly _tag: "
|
|
53
|
+
readonly _tag: "CompletedReloadSources";
|
|
54
54
|
readonly sources: readonly {
|
|
55
55
|
readonly kind: "Book";
|
|
56
56
|
readonly id: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crashOnRender.d.ts","sourceRoot":"","sources":["../../../src/test/apps/crashOnRender.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAc,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAE/D,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAMhE,eAAO,MAAM,SAAS;;;EAGpB,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAK7C,eAAO,MAAM,MAAM;;;EAGjB,CAAA;AACF,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC,eAAO,MAAM,KAAK;;;;;EAEhB,CAAA;AAC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AE,KAAiC,CAAA;AAI5D,eAAO,MAAM,MAAM,GACjB,OAAO,KAAK,EACZ,SAAS,OAAO,KACf,SAAS,CAAC,KAAK,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAiBxD,CAAA;AAIH,eAAO,MAAM,IAAI,GAAI,OAAO,KAAK,EAAE,GAAG,WAAW,CAAC,OAAO,CAAC,KAAG,QA4B5D,CAAA"}
|
|
@@ -19,12 +19,14 @@ export const Model = S.Struct({
|
|
|
19
19
|
});
|
|
20
20
|
// MESSAGE
|
|
21
21
|
export const ClickedReload = m('ClickedReload');
|
|
22
|
-
export const
|
|
22
|
+
export const CompletedReloadSources = m('CompletedReloadSources', {
|
|
23
|
+
sources: S.Array(RawSource),
|
|
24
|
+
});
|
|
23
25
|
export const SelectedSource = m('SelectedSource', { source: Source });
|
|
24
26
|
export const SubmittedNewSourceId = m('SubmittedNewSourceId', { id: S.String });
|
|
25
27
|
export const Message = S.Union([
|
|
26
28
|
ClickedReload,
|
|
27
|
-
|
|
29
|
+
CompletedReloadSources,
|
|
28
30
|
SelectedSource,
|
|
29
31
|
SubmittedNewSourceId,
|
|
30
32
|
]);
|
|
@@ -36,8 +38,8 @@ export const reloadedSources = [
|
|
|
36
38
|
{ kind: 'Book', id: '' },
|
|
37
39
|
];
|
|
38
40
|
export const ReloadSources = Command.define('ReloadSources', {
|
|
39
|
-
messages: [
|
|
40
|
-
execute: Effect.succeed(
|
|
41
|
+
messages: [CompletedReloadSources],
|
|
42
|
+
execute: Effect.succeed(CompletedReloadSources({ sources: reloadedSources })),
|
|
41
43
|
});
|
|
42
44
|
// INIT
|
|
43
45
|
export const validSources = [
|
|
@@ -50,7 +52,7 @@ export const initialModel = { sources: validSources };
|
|
|
50
52
|
// UPDATE
|
|
51
53
|
export const update = (model, message) => M.value(message).pipe(M.withReturnType(), M.tagsExhaustive({
|
|
52
54
|
ClickedReload: () => [model, [ReloadSources()]],
|
|
53
|
-
|
|
55
|
+
CompletedReloadSources: ({ sources }) => [
|
|
54
56
|
evo(model, { sources: () => sources }),
|
|
55
57
|
[],
|
|
56
58
|
],
|
|
@@ -9,10 +9,10 @@ export declare const SucceededSubmit: import("../../schema/index.js").CallableTa
|
|
|
9
9
|
id: S.String;
|
|
10
10
|
}>;
|
|
11
11
|
export declare const CancelledForm: import("../../schema/index.js").CallableTaggedStruct<"CancelledForm", {}>;
|
|
12
|
-
export declare const
|
|
12
|
+
export declare const CompletedResetForm: import("../../schema/index.js").CallableTaggedStruct<"CompletedResetForm", {}>;
|
|
13
13
|
export declare const ChildMessage: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"SubmittedForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"SucceededSubmit", {
|
|
14
14
|
id: S.String;
|
|
15
|
-
}>, import("../../schema/index.js").CallableTaggedStruct<"CancelledForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"
|
|
15
|
+
}>, import("../../schema/index.js").CallableTaggedStruct<"CancelledForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedResetForm", {}>]>;
|
|
16
16
|
export type ChildMessage = typeof ChildMessage.Type;
|
|
17
17
|
export declare const RequestedSave: import("../../schema/index.js").CallableTaggedStruct<"RequestedSave", {
|
|
18
18
|
id: S.String;
|
|
@@ -27,7 +27,7 @@ export declare const SubmitForm: Command.CommandDefinitionNoArgs<"SubmitForm", E
|
|
|
27
27
|
readonly id: string;
|
|
28
28
|
}, never, never>>;
|
|
29
29
|
export declare const ResetForm: Command.CommandDefinitionNoArgs<"ResetForm", Effect.Effect<{
|
|
30
|
-
readonly _tag: "
|
|
30
|
+
readonly _tag: "CompletedResetForm";
|
|
31
31
|
}, never, never>>;
|
|
32
32
|
export declare const initialChildModel: ChildModel;
|
|
33
33
|
export declare const childUpdate: (_model: ChildModel, message: ChildMessage) => readonly [ChildModel, ReadonlyArray<Command.Command<ChildMessage>>, Option.Option<ChildOutMessage>];
|
|
@@ -42,13 +42,13 @@ export type ParentModel = typeof ParentModel.Type;
|
|
|
42
42
|
export declare const GotChildMessage: import("../../schema/index.js").CallableTaggedStruct<"GotChildMessage", {
|
|
43
43
|
message: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"SubmittedForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"SucceededSubmit", {
|
|
44
44
|
id: S.String;
|
|
45
|
-
}>, import("../../schema/index.js").CallableTaggedStruct<"CancelledForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"
|
|
45
|
+
}>, import("../../schema/index.js").CallableTaggedStruct<"CancelledForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedResetForm", {}>]>;
|
|
46
46
|
}>;
|
|
47
47
|
export declare const CompletedParentReset: import("../../schema/index.js").CallableTaggedStruct<"CompletedParentReset", {}>;
|
|
48
48
|
export declare const ParentMessage: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"GotChildMessage", {
|
|
49
49
|
message: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"SubmittedForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"SucceededSubmit", {
|
|
50
50
|
id: S.String;
|
|
51
|
-
}>, import("../../schema/index.js").CallableTaggedStruct<"CancelledForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"
|
|
51
|
+
}>, import("../../schema/index.js").CallableTaggedStruct<"CancelledForm", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedResetForm", {}>]>;
|
|
52
52
|
}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedParentReset", {}>]>;
|
|
53
53
|
export type ParentMessage = typeof ParentMessage.Type;
|
|
54
54
|
export declare const initialParentModel: ParentModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formChild.d.ts","sourceRoot":"","sources":["../../../src/test/apps/formChild.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAc,MAAM,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,K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EACV,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC,EAC5C,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CA4B7B,CAAA;AAIH,eAAO,MAAM,WAAW;;;;;;EAItB,CAAA;AACF,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAIjD,eAAO,MAAM,eAAe;;;;EAE1B,CAAA;AACF,eAAO,MAAM,oBAAoB,kFAA4B,CAAA;AAE7D,eAAO,MAAM,aAAa;;;;sFAAmD,CAAA;AAC7E,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAIrD,eAAO,MAAM,kBAAkB,EAAE,WAIhC,CAAA;AAID,eAAO,MAAM,YAAY,GACvB,aAAa,WAAW,EACxB,SAAS,aAAa,KACrB,SAAS,CAAC,WAAW,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAqCpE,CAAA"}
|
|
@@ -9,12 +9,12 @@ export const ChildModel = S.Struct({
|
|
|
9
9
|
export const SubmittedForm = m('SubmittedForm');
|
|
10
10
|
export const SucceededSubmit = m('SucceededSubmit', { id: S.String });
|
|
11
11
|
export const CancelledForm = m('CancelledForm');
|
|
12
|
-
export const
|
|
12
|
+
export const CompletedResetForm = m('CompletedResetForm');
|
|
13
13
|
export const ChildMessage = S.Union([
|
|
14
14
|
SubmittedForm,
|
|
15
15
|
SucceededSubmit,
|
|
16
16
|
CancelledForm,
|
|
17
|
-
|
|
17
|
+
CompletedResetForm,
|
|
18
18
|
]);
|
|
19
19
|
// CHILD OUT MESSAGE
|
|
20
20
|
export const RequestedSave = m('RequestedSave', { id: S.String });
|
|
@@ -26,8 +26,8 @@ export const SubmitForm = Command.define('SubmitForm', {
|
|
|
26
26
|
execute: Effect.sync(() => SucceededSubmit({ id: 'abc' })),
|
|
27
27
|
});
|
|
28
28
|
export const ResetForm = Command.define('ResetForm', {
|
|
29
|
-
messages: [
|
|
30
|
-
execute: Effect.sync(() =>
|
|
29
|
+
messages: [CompletedResetForm],
|
|
30
|
+
execute: Effect.sync(() => CompletedResetForm()),
|
|
31
31
|
});
|
|
32
32
|
// CHILD INIT
|
|
33
33
|
export const initialChildModel = { status: 'Idle' };
|
|
@@ -48,7 +48,7 @@ export const childUpdate = (_model, message) => M.value(message).pipe(M.withRetu
|
|
|
48
48
|
[],
|
|
49
49
|
Option.some(RequestedCancel()),
|
|
50
50
|
],
|
|
51
|
-
|
|
51
|
+
CompletedResetForm: () => [{ status: 'Idle' }, [], Option.none()],
|
|
52
52
|
}));
|
|
53
53
|
// PARENT MODEL
|
|
54
54
|
export const ParentModel = S.Struct({
|
|
@@ -88,5 +88,5 @@ export const twoPanelView = (model, h) => {
|
|
|
88
88
|
* pending Mount's args). The chosen `offset` flows through `ScrollList`'s
|
|
89
89
|
* args and is observable on the rendered Mount marker. */
|
|
90
90
|
export const scrollListView = (offset, h) => {
|
|
91
|
-
return h.div([h.Class('scroll-list')], [h.div([h.Key('list'), h.OnMount(ScrollList({ offset }))]
|
|
91
|
+
return h.div([h.Class('scroll-list')], [h.div([h.Key('list'), h.OnMount(ScrollList({ offset }))])]);
|
|
92
92
|
};
|
|
@@ -8,7 +8,7 @@ export declare const Model: S.Struct<{
|
|
|
8
8
|
}>;
|
|
9
9
|
export type Model = typeof Model.Type;
|
|
10
10
|
export declare const ClickedChooseResume: import("../../schema/index.js").CallableTaggedStruct<"ClickedChooseResume", {}>;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const CompletedSelectResume: import("../../schema/index.js").CallableTaggedStruct<"CompletedSelectResume", {
|
|
12
12
|
file: S.Schema<File>;
|
|
13
13
|
}>;
|
|
14
14
|
export declare const CancelledSelectResume: import("../../schema/index.js").CallableTaggedStruct<"CancelledSelectResume", {}>;
|
|
@@ -17,7 +17,7 @@ export declare const SucceededReadPreview: import("../../schema/index.js").Calla
|
|
|
17
17
|
}>;
|
|
18
18
|
export declare const FailedReadPreview: import("../../schema/index.js").CallableTaggedStruct<"FailedReadPreview", {}>;
|
|
19
19
|
export declare const ClickedRemoveResume: import("../../schema/index.js").CallableTaggedStruct<"ClickedRemoveResume", {}>;
|
|
20
|
-
export declare const Message: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"ClickedChooseResume", {}>, import("../../schema/index.js").CallableTaggedStruct<"
|
|
20
|
+
export declare const Message: S.Union<readonly [import("../../schema/index.js").CallableTaggedStruct<"ClickedChooseResume", {}>, import("../../schema/index.js").CallableTaggedStruct<"CompletedSelectResume", {
|
|
21
21
|
file: S.Schema<File>;
|
|
22
22
|
}>, import("../../schema/index.js").CallableTaggedStruct<"CancelledSelectResume", {}>, import("../../schema/index.js").CallableTaggedStruct<"SucceededReadPreview", {
|
|
23
23
|
dataUrl: S.String;
|
|
@@ -26,7 +26,7 @@ export type Message = typeof Message.Type;
|
|
|
26
26
|
export declare const SelectResume: Command.CommandDefinitionNoArgs<"SelectResume", Effect.Effect<{
|
|
27
27
|
readonly _tag: "CancelledSelectResume";
|
|
28
28
|
} | {
|
|
29
|
-
readonly _tag: "
|
|
29
|
+
readonly _tag: "CompletedSelectResume";
|
|
30
30
|
readonly file: File;
|
|
31
31
|
}, never, never>>;
|
|
32
32
|
export declare const ReadResumePreview: Command.CommandDefinitionWithArgs<"ReadResumePreview", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumeUpload.d.ts","sourceRoot":"","sources":["../../../src/test/apps/resumeUpload.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAsB,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAEhE,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAA;AAEjD,OAAO,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAM5D,eAAO,MAAM,KAAK;;;;EAIhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAI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@@ -11,7 +11,7 @@ export const Model = S.Struct({
|
|
|
11
11
|
});
|
|
12
12
|
// MESSAGE
|
|
13
13
|
export const ClickedChooseResume = m('ClickedChooseResume');
|
|
14
|
-
export const
|
|
14
|
+
export const CompletedSelectResume = m('CompletedSelectResume', {
|
|
15
15
|
file: File.File,
|
|
16
16
|
});
|
|
17
17
|
export const CancelledSelectResume = m('CancelledSelectResume');
|
|
@@ -22,7 +22,7 @@ export const FailedReadPreview = m('FailedReadPreview');
|
|
|
22
22
|
export const ClickedRemoveResume = m('ClickedRemoveResume');
|
|
23
23
|
export const Message = S.Union([
|
|
24
24
|
ClickedChooseResume,
|
|
25
|
-
|
|
25
|
+
CompletedSelectResume,
|
|
26
26
|
CancelledSelectResume,
|
|
27
27
|
SucceededReadPreview,
|
|
28
28
|
FailedReadPreview,
|
|
@@ -30,10 +30,10 @@ export const Message = S.Union([
|
|
|
30
30
|
]);
|
|
31
31
|
// COMMAND
|
|
32
32
|
export const SelectResume = Command.define('SelectResume', {
|
|
33
|
-
messages: [
|
|
33
|
+
messages: [CompletedSelectResume, CancelledSelectResume],
|
|
34
34
|
execute: File.select(['application/pdf']).pipe(Effect.map(Option.match({
|
|
35
35
|
onNone: () => CancelledSelectResume(),
|
|
36
|
-
onSome: file =>
|
|
36
|
+
onSome: file => CompletedSelectResume({ file }),
|
|
37
37
|
}))),
|
|
38
38
|
});
|
|
39
39
|
export const ReadResumePreview = Command.define('ReadResumePreview', {
|
|
@@ -49,7 +49,7 @@ export const initialModel = {
|
|
|
49
49
|
};
|
|
50
50
|
export const update = (model, message) => M.value(message).pipe(M.withReturnType(), M.tagsExhaustive({
|
|
51
51
|
ClickedChooseResume: () => [model, [SelectResume()]],
|
|
52
|
-
|
|
52
|
+
CompletedSelectResume: ({ file }) => [
|
|
53
53
|
evo(model, {
|
|
54
54
|
maybeResume: () => Option.some(file),
|
|
55
55
|
maybePreviewDataUrl: () => Option.none(),
|