@quenk/frontend 0.20.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.
Files changed (38) hide show
  1. package/README.md +19 -0
  2. package/lib/app/display.d.ts +140 -0
  3. package/lib/app/display.js +167 -0
  4. package/lib/app/display.js.map +1 -0
  5. package/lib/app/index.d.ts +26 -0
  6. package/lib/app/index.js +29 -0
  7. package/lib/app/index.js.map +1 -0
  8. package/lib/app/model/http.d.ts +147 -0
  9. package/lib/app/model/http.js +184 -0
  10. package/lib/app/model/http.js.map +1 -0
  11. package/lib/app/model/index.d.ts +36 -0
  12. package/lib/app/model/index.js +3 -0
  13. package/lib/app/model/index.js.map +1 -0
  14. package/lib/app/router/hash.d.ts +143 -0
  15. package/lib/app/router/hash.js +178 -0
  16. package/lib/app/router/hash.js.map +1 -0
  17. package/lib/app/router/index.d.ts +49 -0
  18. package/lib/app/router/index.js +3 -0
  19. package/lib/app/router/index.js.map +1 -0
  20. package/lib/app/scene/dialog/alert.d.ts +13 -0
  21. package/lib/app/scene/dialog/alert.js +18 -0
  22. package/lib/app/scene/dialog/alert.js.map +1 -0
  23. package/lib/app/scene/dialog/confirm.d.ts +39 -0
  24. package/lib/app/scene/dialog/confirm.js +36 -0
  25. package/lib/app/scene/dialog/confirm.js.map +1 -0
  26. package/lib/app/scene/dialog/index.d.ts +65 -0
  27. package/lib/app/scene/dialog/index.js +71 -0
  28. package/lib/app/scene/dialog/index.js.map +1 -0
  29. package/lib/app/scene/director.d.ts +90 -0
  30. package/lib/app/scene/director.js +111 -0
  31. package/lib/app/scene/director.js.map +1 -0
  32. package/lib/app/scene/index.d.ts +66 -0
  33. package/lib/app/scene/index.js +50 -0
  34. package/lib/app/scene/index.js.map +1 -0
  35. package/lib/app/search/filters.d.ts +258 -0
  36. package/lib/app/search/filters.js +372 -0
  37. package/lib/app/search/filters.js.map +1 -0
  38. package/package.json +35 -0
@@ -0,0 +1,39 @@
1
+ import { Address } from '@quenk/potoo/lib/actor/address';
2
+ import { Runtime } from '@quenk/potoo/lib/actor/system/vm/runtime';
3
+ import { Dialog, DialogEventFunc, DialogEventHandler, DialogEvent } from './';
4
+ /**
5
+ * ConfirmDialogEventHandler is the allowed types for confirm dialog event
6
+ * targets.
7
+ */
8
+ export type ConfirmDialogEventTarget = DialogEventFunc | Address | DialogEventHandler;
9
+ /**
10
+ * ConfirmDialogEventHandler is an object that can receive confirm dialog events.
11
+ */
12
+ export interface ConfirmDialogEventHandler extends DialogEventHandler {
13
+ /**
14
+ * onAccept is called when the dialog is closed positively..
15
+ */
16
+ onAccept(e: DialogConfirmed): void;
17
+ }
18
+ /**
19
+ * DialogConfirmed indicates
20
+ */
21
+ export declare class DialogConfirmed extends DialogEvent {
22
+ }
23
+ /**
24
+ * ConfirmDialog provides a dialog actor oriented towards the confirmation of
25
+ * some action or event.
26
+ *
27
+ * Use it to display forms or information that needs to be confirmed before
28
+ * committed. Use the accept() method for confirmation or close() for cancel.
29
+ */
30
+ export declare abstract class ConfirmDialog extends Dialog {
31
+ runtime: Runtime;
32
+ display: Address;
33
+ target: ConfirmDialogEventTarget;
34
+ constructor(runtime: Runtime, display: Address, target?: ConfirmDialogEventTarget);
35
+ /**
36
+ * confirm the dialog firing an event to the target.
37
+ */
38
+ confirm(): void;
39
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ConfirmDialog = exports.DialogConfirmed = void 0;
4
+ const display_1 = require("../../display");
5
+ const _1 = require("./");
6
+ /**
7
+ * DialogConfirmed indicates
8
+ */
9
+ class DialogConfirmed extends _1.DialogEvent {
10
+ }
11
+ exports.DialogConfirmed = DialogConfirmed;
12
+ /**
13
+ * ConfirmDialog provides a dialog actor oriented towards the confirmation of
14
+ * some action or event.
15
+ *
16
+ * Use it to display forms or information that needs to be confirmed before
17
+ * committed. Use the accept() method for confirmation or close() for cancel.
18
+ */
19
+ class ConfirmDialog extends _1.Dialog {
20
+ constructor(runtime, display, target = '?') {
21
+ super(runtime, display, target);
22
+ this.runtime = runtime;
23
+ this.display = display;
24
+ this.target = target;
25
+ }
26
+ /**
27
+ * confirm the dialog firing an event to the target.
28
+ */
29
+ confirm() {
30
+ this.tell(this.display, new display_1.Close(this.name));
31
+ this.fire(new DialogConfirmed(this.name));
32
+ this.exit();
33
+ }
34
+ }
35
+ exports.ConfirmDialog = ConfirmDialog;
36
+ //# sourceMappingURL=confirm.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"confirm.js","sourceRoot":"","sources":["../../../../src/app/scene/dialog/confirm.ts"],"names":[],"mappings":";;;AAGA,2CAAsC;AACtC,yBAKY;AAwBZ;;GAEG;AACH,MAAa,eAAgB,SAAQ,cAAW;CAAI;AAApD,0CAAoD;AAEpD;;;;;;GAMG;AACH,MAAsB,aAAc,SAAQ,SAAM;IAE9C,YACW,OAAgB,EAChB,OAAgB,EAChB,SAAmC,GAAG;QAE7C,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;QAJzB,YAAO,GAAP,OAAO,CAAS;QAChB,YAAO,GAAP,OAAO,CAAS;QAChB,WAAM,GAAN,MAAM,CAAgC;IAIjD,CAAC;IAED;;OAEG;IACH,OAAO;QAEH,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,eAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9C,IAAI,CAAC,IAAI,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,EAAE,CAAC;IAEhB,CAAC;CAEJ;AAtBD,sCAsBC"}
@@ -0,0 +1,65 @@
1
+ import { Runtime } from '@quenk/potoo/lib/actor/system/vm/runtime';
2
+ import { Address } from '@quenk/potoo/lib/actor/address';
3
+ import { AppScene } from '../';
4
+ /**
5
+ * DialogName indicates the name of a dialog.
6
+ */
7
+ export type DialogName = string;
8
+ /**
9
+ * DialogEventTarget is the allowed types for dialog event targets.
10
+ */
11
+ export type DialogEventTarget = DialogEventFunc | Address | DialogEventHandler;
12
+ /**
13
+ * DialogEventFunc can be invoked to receive dialog events.
14
+ */
15
+ export type DialogEventFunc = (e: DialogEvent) => void;
16
+ /**
17
+ * DialogEventHandler is an object that can receive dialog events.
18
+ */
19
+ export interface DialogEventHandler {
20
+ /**
21
+ * onClose is invoked when the dialog is closed.
22
+ */
23
+ onClose(e: DialogEvent): void;
24
+ }
25
+ /**
26
+ * DialogEvent is the base class of event classes used to indicate a change in
27
+ * a dialog's lifecycle.
28
+ *
29
+ * A basic dialog's lifecycle is open -> closed. However no events are fired for
30
+ * open.
31
+ */
32
+ export declare abstract class DialogEvent {
33
+ name: DialogName;
34
+ constructor(name: DialogName);
35
+ }
36
+ /**
37
+ * DialogClosed indicates a dialog has been closed.
38
+ */
39
+ export declare class DialogClosed extends DialogEvent {
40
+ }
41
+ /**
42
+ * Dialog provides an actor meant to serve as the "controller" for a dialog
43
+ * view displayed to the user.
44
+ *
45
+ * It does not concern itself with the details of actually getting the view on
46
+ * screen, instead it leaves that up to the provided display actor's address.
47
+ * If a handler is provided, it will receive an event when the dialog closes.
48
+ */
49
+ export declare abstract class Dialog extends AppScene {
50
+ runtime: Runtime;
51
+ display: Address;
52
+ target: DialogEventTarget;
53
+ constructor(runtime: Runtime, display: Address, target?: DialogEventTarget);
54
+ /**
55
+ * fire an event to the [[DialogEventTarget]].
56
+ */
57
+ fire(e: DialogEvent): void;
58
+ /**
59
+ * close this dialog.
60
+ *
61
+ * Tells the display to close the view and will exit this actor.
62
+ */
63
+ close(): void;
64
+ run(): Promise<void>;
65
+ }
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dialog = exports.DialogClosed = exports.DialogEvent = void 0;
4
+ const type_1 = require("@quenk/noni/lib/data/type");
5
+ const display_1 = require("../../display");
6
+ const __1 = require("../");
7
+ /**
8
+ * DialogEvent is the base class of event classes used to indicate a change in
9
+ * a dialog's lifecycle.
10
+ *
11
+ * A basic dialog's lifecycle is open -> closed. However no events are fired for
12
+ * open.
13
+ */
14
+ class DialogEvent {
15
+ constructor(name) {
16
+ this.name = name;
17
+ }
18
+ }
19
+ exports.DialogEvent = DialogEvent;
20
+ /**
21
+ * DialogClosed indicates a dialog has been closed.
22
+ */
23
+ class DialogClosed extends DialogEvent {
24
+ }
25
+ exports.DialogClosed = DialogClosed;
26
+ /**
27
+ * Dialog provides an actor meant to serve as the "controller" for a dialog
28
+ * view displayed to the user.
29
+ *
30
+ * It does not concern itself with the details of actually getting the view on
31
+ * screen, instead it leaves that up to the provided display actor's address.
32
+ * If a handler is provided, it will receive an event when the dialog closes.
33
+ */
34
+ class Dialog extends __1.AppScene {
35
+ constructor(runtime, display, target = '?') {
36
+ super(runtime);
37
+ this.runtime = runtime;
38
+ this.display = display;
39
+ this.target = target;
40
+ }
41
+ /**
42
+ * fire an event to the [[DialogEventTarget]].
43
+ */
44
+ fire(e) {
45
+ if ((0, type_1.isString)(this.target)) {
46
+ this.tell(this.target, e);
47
+ }
48
+ else if ((0, type_1.isFunction)(this.target)) {
49
+ this.target(e);
50
+ }
51
+ else if ((0, type_1.isObject)(this.target)) {
52
+ // Todo: This is too specific, maybe onEvent instead?
53
+ this.target.onClose(e);
54
+ }
55
+ }
56
+ /**
57
+ * close this dialog.
58
+ *
59
+ * Tells the display to close the view and will exit this actor.
60
+ */
61
+ close() {
62
+ this.tell(this.display, new display_1.Close(this.name));
63
+ this.fire(new DialogClosed(this.name));
64
+ this.exit();
65
+ }
66
+ async run() {
67
+ this.tell(this.display, new display_1.Show(this.name, this.view, this.self));
68
+ }
69
+ }
70
+ exports.Dialog = Dialog;
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/app/scene/dialog/index.ts"],"names":[],"mappings":";;;AAAA,oDAA2E;AAK3E,2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AG;QAEL,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvE,CAAC;CAEJ;AAhDD,wBAgDC"}
@@ -0,0 +1,90 @@
1
+ import { Default, TypeCase } from '@quenk/noni/lib/control/match/case';
2
+ import { Object } from '@quenk/noni/lib/data/jsonx';
3
+ import { Address } from '@quenk/potoo/lib/actor/address';
4
+ import { Immutable } from '@quenk/potoo/lib/actor/framework/resident';
5
+ import { Runtime } from '@quenk/potoo/lib/actor/system/vm/runtime';
6
+ import { Spawnable } from '@quenk/potoo/lib/actor/template';
7
+ /**
8
+ * SceneId is an identifier used to indicate which scene should be shown.
9
+ *
10
+ * This is not necessarily an actor address but can be.
11
+ */
12
+ export type SceneId = string;
13
+ /**
14
+ * SceneProvider is a function that takes a Signal and returns a Spawnable
15
+ * for creating the scene actor.
16
+ */
17
+ export type SceneProvider = (sig: Signal) => Spawnable;
18
+ /**
19
+ * SceneMap maps an identifier to a provider.
20
+ */
21
+ export interface SceneMap {
22
+ [key: SceneId]: SceneProvider;
23
+ }
24
+ /**
25
+ * Next signals to the SceneDirector that a new scene actor should be given
26
+ * control.
27
+ */
28
+ export declare class Next {
29
+ scene: SceneId;
30
+ data: Object;
31
+ /**
32
+ * @param scene - The scene to be shown.
33
+ * @param data - Optional data to be passed to the scene.
34
+ */
35
+ constructor(scene: SceneId, data?: Object);
36
+ }
37
+ /**
38
+ * Signal hints to the receiving scene actor that in now has control
39
+ * and can stream messages to put up its view.
40
+ *
41
+ * @param director - The address of the SceneDirector that will forward
42
+ * the views to the display.
43
+ * @param data - Payload sourced from the original request to advance the
44
+ * scene. This is meant to be payloads from hash router etc.
45
+ */
46
+ export declare class Signal {
47
+ director: Address;
48
+ data: Object;
49
+ constructor(director: Address, data: Object);
50
+ }
51
+ /**
52
+ * Reload the scene.
53
+ *
54
+ * This will act as though a new request to show the scene has been created.
55
+ */
56
+ export declare class Reload {
57
+ target: Address;
58
+ constructor(target: Address);
59
+ }
60
+ /**
61
+ * Supervisor acts on behalf of the SceneDirector to the scene actor.
62
+ *
63
+ * This pattern is used so that messages sent after the scene has changed can
64
+ * be ignored (by killing off the supervisor thus terminating the communication
65
+ * line).
66
+ */
67
+ export declare class Supervisor extends Immutable {
68
+ runtime: Runtime;
69
+ provider: SceneProvider;
70
+ director: Address;
71
+ display: Address;
72
+ request: Next;
73
+ constructor(runtime: Runtime, provider: SceneProvider, director: Address, display: Address, request: Next);
74
+ actor: string;
75
+ selectors(): (TypeCase<typeof Reload, Promise<void>> | Default<Promise<void>>)[];
76
+ run(): Promise<void>;
77
+ }
78
+ /**
79
+ * SceneDirector acts as an implementation independent router between Scene
80
+ * classes.
81
+ */
82
+ export declare class SceneDirector extends Immutable {
83
+ runtime: Runtime;
84
+ display: Address;
85
+ scenes: SceneMap;
86
+ current: Address;
87
+ constructor(runtime: Runtime, display: Address, scenes: SceneMap, current?: Address);
88
+ onNext: (msg: Next) => Promise<void>;
89
+ selectors(): TypeCase<typeof Next, Promise<void>>[];
90
+ }
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SceneDirector = exports.Supervisor = exports.Reload = exports.Signal = exports.Next = void 0;
4
+ const case_1 = require("@quenk/noni/lib/control/match/case");
5
+ const resident_1 = require("@quenk/potoo/lib/actor/framework/resident");
6
+ /**
7
+ * Next signals to the SceneDirector that a new scene actor should be given
8
+ * control.
9
+ */
10
+ class Next {
11
+ /**
12
+ * @param scene - The scene to be shown.
13
+ * @param data - Optional data to be passed to the scene.
14
+ */
15
+ constructor(scene, data = {}) {
16
+ this.scene = scene;
17
+ this.data = data;
18
+ }
19
+ }
20
+ exports.Next = Next;
21
+ /**
22
+ * Signal hints to the receiving scene actor that in now has control
23
+ * and can stream messages to put up its view.
24
+ *
25
+ * @param director - The address of the SceneDirector that will forward
26
+ * the views to the display.
27
+ * @param data - Payload sourced from the original request to advance the
28
+ * scene. This is meant to be payloads from hash router etc.
29
+ */
30
+ class Signal {
31
+ constructor(director, data) {
32
+ this.director = director;
33
+ this.data = data;
34
+ }
35
+ }
36
+ exports.Signal = Signal;
37
+ /**
38
+ * Reload the scene.
39
+ *
40
+ * This will act as though a new request to show the scene has been created.
41
+ */
42
+ class Reload {
43
+ constructor(target) {
44
+ this.target = target;
45
+ }
46
+ }
47
+ exports.Reload = Reload;
48
+ /**
49
+ * Supervisor acts on behalf of the SceneDirector to the scene actor.
50
+ *
51
+ * This pattern is used so that messages sent after the scene has changed can
52
+ * be ignored (by killing off the supervisor thus terminating the communication
53
+ * line).
54
+ */
55
+ class Supervisor extends resident_1.Immutable {
56
+ constructor(runtime, provider, director, display, request) {
57
+ super(runtime);
58
+ this.runtime = runtime;
59
+ this.provider = provider;
60
+ this.director = director;
61
+ this.display = display;
62
+ this.request = request;
63
+ this.actor = '?';
64
+ }
65
+ selectors() {
66
+ return [
67
+ new case_1.TypeCase(Reload, async () => {
68
+ this.tell(this.director, this.request);
69
+ }),
70
+ new case_1.Default(async (m) => {
71
+ this.tell(this.display, m);
72
+ })
73
+ ];
74
+ }
75
+ async run() {
76
+ let lock = new Signal(this.self, this.request.data);
77
+ this.actor = await this.spawn(this.provider(lock));
78
+ }
79
+ }
80
+ exports.Supervisor = Supervisor;
81
+ /**
82
+ * SceneDirector acts as an implementation independent router between Scene
83
+ * classes.
84
+ */
85
+ class SceneDirector extends resident_1.Immutable {
86
+ constructor(runtime, display, scenes, current = '') {
87
+ super(runtime);
88
+ this.runtime = runtime;
89
+ this.display = display;
90
+ this.scenes = scenes;
91
+ this.current = current;
92
+ this.onNext = async (msg) => {
93
+ if (this.current) {
94
+ await this.kill(this.current);
95
+ }
96
+ let provider = this.scenes[msg.scene];
97
+ if (provider) {
98
+ this.current = await this.spawn(rt => new Supervisor(rt, provider, this.self, this.display, msg));
99
+ }
100
+ else {
101
+ //TODO: 404 page
102
+ console.warn(`No scene exists for ${msg.scene}!`, this.scenes);
103
+ }
104
+ };
105
+ }
106
+ selectors() {
107
+ return [new case_1.TypeCase(Next, this.onNext)];
108
+ }
109
+ }
110
+ exports.SceneDirector = SceneDirector;
111
+ //# sourceMappingURL=director.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"director.js","sourceRoot":"","sources":["../../../src/app/scene/director.ts"],"names":[],"mappings":";;;AAAA,6DAAuE;AAIvE,wEAAsE;AAwBtE;;;GAGG;AACH,MAAa,IAAI;IACb;;;OAGG;IACH,YACW,KAAc,EACd,OAAe,EAAE;QADjB,UAAK,GAAL,KAAK,CAAS;QACd,SAAI,GAAJ,IAAI,CAAa;IACzB,CAAC;CACP;AATD,oBASC;AAED;;;;;;;;GAQG;AACH,MAAa,MAAM;IACf,YACW,QAAiB,EACjB,IAAY;QADZ,aAAQ,GAAR,QAAQ,CAAS;QACjB,SAAI,GAAJ,IAAI,CAAQ;IACpB,CAAC;CACP;AALD,wBAKC;AAED;;;;GAIG;AACH,MAAa,MAAM;IACf,YAAmB,MAAe;QAAf,WAAM,GAAN,MAAM,CAAS;IAAG,CAAC;CACzC;AAFD,wBAEC;AAGD;;;;;;GAMG;AACH,MAAa,UAAW,SAAQ,oBAAS;IACrC,YACW,OAAgB,EAChB,QAAuB,EACvB,QAAiB,EACjB,OAAgB,EAChB,OAAa;QAEpB,KAAK,CAAC,OAAO,CAAC,CAAC;QANR,YAAO,GAAP,OAAO,CAAS;QAChB,aAAQ,GAAR,QAAQ,CAAe;QACvB,aAAQ,GAAR,QAAQ,CAAS;QACjB,YAAO,GAAP,OAAO,CAAS;QAChB,YAAO,GAAP,OAAO,CAAM;QAKxB,UAAK,GAAG,GAAG,CAAC;IAFZ,CAAC;IAID,SAAS;QACL,OAAO;YACH,IAAI,eAAQ,CAAC,MAAM,EAAE,KAAK,IAAI,EAAE;gBAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAA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,CAAC;YACN,CAAC;iBAAM,CAAC;gBACJ,gBAAgB;gBAChB,OAAO,CAAC,IAAI,CAAC,uBAAuB,GAAG,CAAC,KAAK,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;YACnE,CAAC;QACL,CAAC,CAAC;IAjBF,CAAC;IAmBD,SAAS;QACL,OAAO,CAAC,IAAI,eAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;CACJ;AA9BD,sCA8BC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * In a Jouvert application, scenes are actors that produce the primary content
3
+ * to display to the user.
4
+ *
5
+ * The content produced by all the scene actors in an application essentially
6
+ * provide the application's UI. The actors themselves serve as the controllers
7
+ * of the application's logic.
8
+ *
9
+ * This toolkit provides 3 main types of scene actors:
10
+ *
11
+ * 1. [[MainScene]] - These are actors that provide the main views in an
12
+ * application such as a dashboard or a user profile.
13
+ * These typically coordinate the other types of scenes to
14
+ * provide the appropriate UI at the right time.
15
+ *
16
+ * 2. [[FormScene]] - These are specialised to support the content of one or
17
+ * more HTML forms and have methods for setting and
18
+ * validating values.
19
+ *
20
+ * 3. [[DialogScene]] - These scenes are controllers intended for modal dialog
21
+ * content.
22
+ *
23
+ * In a typical Jouvert application, these actors send their content via a
24
+ * [[Show]] message to a display which is usually the address of a
25
+ * [[Display]] instance. Scene actors are meant to be spawned on demand and
26
+ * usually send this message as part of their run() method.
27
+ */
28
+ import { Address } from '@quenk/potoo/lib/actor/address';
29
+ import { Api } from '@quenk/potoo/lib/actor/api';
30
+ import { Immutable } from '@quenk/potoo/lib/actor/framework/resident';
31
+ import { View } from '@quenk/wml';
32
+ /**
33
+ * Scene is the parent interface of all scenes found with an application.
34
+ *
35
+ * The properties of this interface are largely meant for interaction with the
36
+ * display actor(s).
37
+ */
38
+ export interface Scene extends Api {
39
+ /**
40
+ * name used to identify the Scene mainly used by the display actor.
41
+ */
42
+ name: string;
43
+ /**
44
+ * view sent to the display actor to render content.
45
+ */
46
+ view: View;
47
+ /**
48
+ * display content will be sent to.
49
+ */
50
+ display: Address;
51
+ }
52
+ /**
53
+ * BaseAppScene that provides a basis for more specialized AppScenes.
54
+ *
55
+ * This class only sends content to the display actor when run.
56
+ */
57
+ export declare abstract class AppScene extends Immutable implements Scene {
58
+ abstract name: string;
59
+ abstract view: View;
60
+ abstract display: Address;
61
+ /**
62
+ * show the AppScene by sending a message to the display.
63
+ */
64
+ show(): void;
65
+ run(): Promise<void>;
66
+ }
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ /**
3
+ * In a Jouvert application, scenes are actors that produce the primary content
4
+ * to display to the user.
5
+ *
6
+ * The content produced by all the scene actors in an application essentially
7
+ * provide the application's UI. The actors themselves serve as the controllers
8
+ * of the application's logic.
9
+ *
10
+ * This toolkit provides 3 main types of scene actors:
11
+ *
12
+ * 1. [[MainScene]] - These are actors that provide the main views in an
13
+ * application such as a dashboard or a user profile.
14
+ * These typically coordinate the other types of scenes to
15
+ * provide the appropriate UI at the right time.
16
+ *
17
+ * 2. [[FormScene]] - These are specialised to support the content of one or
18
+ * more HTML forms and have methods for setting and
19
+ * validating values.
20
+ *
21
+ * 3. [[DialogScene]] - These scenes are controllers intended for modal dialog
22
+ * content.
23
+ *
24
+ * In a typical Jouvert application, these actors send their content via a
25
+ * [[Show]] message to a display which is usually the address of a
26
+ * [[Display]] instance. Scene actors are meant to be spawned on demand and
27
+ * usually send this message as part of their run() method.
28
+ */
29
+ Object.defineProperty(exports, "__esModule", { value: true });
30
+ exports.AppScene = void 0;
31
+ const resident_1 = require("@quenk/potoo/lib/actor/framework/resident");
32
+ const display_1 = require("app/display");
33
+ /**
34
+ * BaseAppScene that provides a basis for more specialized AppScenes.
35
+ *
36
+ * This class only sends content to the display actor when run.
37
+ */
38
+ class AppScene extends resident_1.Immutable {
39
+ /**
40
+ * show the AppScene by sending a message to the display.
41
+ */
42
+ show() {
43
+ this.tell(this.display, new display_1.Show(this.name, this.view, this.self));
44
+ }
45
+ async run() {
46
+ this.show();
47
+ }
48
+ }
49
+ exports.AppScene = AppScene;
50
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/app/scene/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;;;AAIH,wEAAsE;AAGtE,yCAAmC;AA2BnC;;;;GAIG;AACH,MAAsB,QAClB,SAAQ,oBAAS;IASjB;;OAEG;IACH,IAAI;QAEA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAEvE,CAAC;IAED,KAAK,CAAC,GAAG;QAEL,IAAI,CAAC,IAAI,EAAE,CAAC;IAEhB,CAAC;CAEJ;AAzBD,4BAyBC"}