plggmatic 0.2.1 → 0.2.2
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/Catalog/index.d.ts +17 -0
- package/dist/Catalog/index.d.ts.map +1 -0
- package/dist/Catalog/model/tool.d.ts +101 -0
- package/dist/Catalog/model/tool.d.ts.map +1 -0
- package/dist/Catalog/usecase/adapter.d.ts +81 -0
- package/dist/Catalog/usecase/adapter.d.ts.map +1 -0
- package/dist/Catalog/usecase/catalog.d.ts +43 -0
- package/dist/Catalog/usecase/catalog.d.ts.map +1 -0
- package/dist/Catalog/usecase/runFlow.d.ts +77 -0
- package/dist/Catalog/usecase/runFlow.d.ts.map +1 -0
- package/dist/Component/index.d.ts +28 -0
- package/dist/Component/index.d.ts.map +1 -0
- package/dist/Component/model/interaction.d.ts +41 -0
- package/dist/Component/model/interaction.d.ts.map +1 -0
- package/dist/Component/model/navItem.d.ts +16 -0
- package/dist/Component/model/navItem.d.ts.map +1 -0
- package/dist/Component/usecase/breadcrumb.d.ts +26 -0
- package/dist/Component/usecase/breadcrumb.d.ts.map +1 -0
- package/dist/Component/usecase/button.d.ts +27 -0
- package/dist/Component/usecase/button.d.ts.map +1 -0
- package/dist/Component/usecase/checkbox.d.ts +20 -0
- package/dist/Component/usecase/checkbox.d.ts.map +1 -0
- package/dist/Component/usecase/colHead.d.ts +28 -0
- package/dist/Component/usecase/colHead.d.ts.map +1 -0
- package/dist/Component/usecase/confirmDialog.d.ts +25 -0
- package/dist/Component/usecase/confirmDialog.d.ts.map +1 -0
- package/dist/Component/usecase/navTree.d.ts +21 -0
- package/dist/Component/usecase/navTree.d.ts.map +1 -0
- package/dist/Component/usecase/selectInput.d.ts +28 -0
- package/dist/Component/usecase/selectInput.d.ts.map +1 -0
- package/dist/Component/usecase/textArea.d.ts +22 -0
- package/dist/Component/usecase/textArea.d.ts.map +1 -0
- package/dist/Component/usecase/textInput.d.ts +23 -0
- package/dist/Component/usecase/textInput.d.ts.map +1 -0
- package/dist/Component/usecase/textLink.d.ts +26 -0
- package/dist/Component/usecase/textLink.d.ts.map +1 -0
- package/dist/Component/usecase/themeToggle.d.ts +70 -0
- package/dist/Component/usecase/themeToggle.d.ts.map +1 -0
- package/dist/Component/usecase/toast.d.ts +32 -0
- package/dist/Component/usecase/toast.d.ts.map +1 -0
- package/dist/Component/usecase/typography.d.ts +33 -0
- package/dist/Component/usecase/typography.d.ts.map +1 -0
- package/dist/Declare/model/Action.d.ts +91 -0
- package/dist/Declare/model/Action.d.ts.map +1 -0
- package/dist/Declare/model/Adapter.d.ts +107 -0
- package/dist/Declare/model/Adapter.d.ts.map +1 -0
- package/dist/Declare/model/Collection.d.ts +55 -0
- package/dist/Declare/model/Collection.d.ts.map +1 -0
- package/dist/Declare/model/Declaration.d.ts +27 -0
- package/dist/Declare/model/Declaration.d.ts.map +1 -0
- package/dist/Declare/model/Menu.d.ts +21 -0
- package/dist/Declare/model/Menu.d.ts.map +1 -0
- package/dist/Declare/model/Query.d.ts +56 -0
- package/dist/Declare/model/Query.d.ts.map +1 -0
- package/dist/Declare/model/Row.d.ts +129 -0
- package/dist/Declare/model/Row.d.ts.map +1 -0
- package/dist/Declare/model/Source.d.ts +83 -0
- package/dist/Declare/model/Source.d.ts.map +1 -0
- package/dist/Declare/usecase/apply.d.ts +23 -0
- package/dist/Declare/usecase/apply.d.ts.map +1 -0
- package/dist/Declare/usecase/project.d.ts +66 -0
- package/dist/Declare/usecase/project.d.ts.map +1 -0
- package/dist/Declare/usecase/reconcile.d.ts +63 -0
- package/dist/Declare/usecase/reconcile.d.ts.map +1 -0
- package/dist/Flow/model/forms.d.ts +45 -0
- package/dist/Flow/model/forms.d.ts.map +1 -0
- package/dist/Flow/model/run.d.ts +74 -0
- package/dist/Flow/model/run.d.ts.map +1 -0
- package/dist/Flow/model/script.d.ts +279 -0
- package/dist/Flow/model/script.d.ts.map +1 -0
- package/dist/Flow/usecase/interpret.d.ts +17 -0
- package/dist/Flow/usecase/interpret.d.ts.map +1 -0
- package/dist/Flow/usecase/read.d.ts +46 -0
- package/dist/Flow/usecase/read.d.ts.map +1 -0
- package/dist/Form/index.d.ts +14 -0
- package/dist/Form/index.d.ts.map +1 -0
- package/dist/Form/model/control.d.ts +9 -0
- package/dist/Form/model/control.d.ts.map +1 -0
- package/dist/Form/model/submission.d.ts +30 -0
- package/dist/Form/model/submission.d.ts.map +1 -0
- package/dist/Form/usecase/controlParts.d.ts +30 -0
- package/dist/Form/usecase/controlParts.d.ts.map +1 -0
- package/dist/Form/usecase/formView.d.ts +21 -0
- package/dist/Form/usecase/formView.d.ts.map +1 -0
- package/dist/Form/usecase/parseForm.d.ts +28 -0
- package/dist/Form/usecase/parseForm.d.ts.map +1 -0
- package/dist/Layout/index.d.ts +16 -0
- package/dist/Layout/index.d.ts.map +1 -0
- package/dist/Layout/model/pane.d.ts +15 -0
- package/dist/Layout/model/pane.d.ts.map +1 -0
- package/dist/Layout/usecase/combinators.d.ts +49 -0
- package/dist/Layout/usecase/combinators.d.ts.map +1 -0
- package/dist/Meta/model/identity.d.ts +16 -0
- package/dist/Meta/model/identity.d.ts.map +1 -0
- package/dist/Render/index.d.ts +17 -0
- package/dist/Render/index.d.ts.map +1 -0
- package/dist/Render/model/mode.d.ts +13 -0
- package/dist/Render/model/mode.d.ts.map +1 -0
- package/dist/Render/model/screen.d.ts +27 -0
- package/dist/Render/model/screen.d.ts.map +1 -0
- package/dist/Render/usecase/multiColumn.d.ts +52 -0
- package/dist/Render/usecase/multiColumn.d.ts.map +1 -0
- package/dist/Render/usecase/parts.d.ts +56 -0
- package/dist/Render/usecase/parts.d.ts.map +1 -0
- package/dist/Render/usecase/renderMode.d.ts +17 -0
- package/dist/Render/usecase/renderMode.d.ts.map +1 -0
- package/dist/Render/usecase/singleColumn.d.ts +20 -0
- package/dist/Render/usecase/singleColumn.d.ts.map +1 -0
- package/dist/Schedule/model/Model.d.ts +103 -0
- package/dist/Schedule/model/Model.d.ts.map +1 -0
- package/dist/Schedule/model/Msg.d.ts +131 -0
- package/dist/Schedule/model/Msg.d.ts.map +1 -0
- package/dist/Schedule/model/Scene.d.ts +190 -0
- package/dist/Schedule/model/Scene.d.ts.map +1 -0
- package/dist/Schedule/model/View.d.ts +54 -0
- package/dist/Schedule/model/View.d.ts.map +1 -0
- package/dist/Schedule/usecase/chain.d.ts +16 -0
- package/dist/Schedule/usecase/chain.d.ts.map +1 -0
- package/dist/Schedule/usecase/codec.d.ts +44 -0
- package/dist/Schedule/usecase/codec.d.ts.map +1 -0
- package/dist/Schedule/usecase/lower.d.ts +45 -0
- package/dist/Schedule/usecase/lower.d.ts.map +1 -0
- package/dist/Schedule/usecase/scene.d.ts +16 -0
- package/dist/Schedule/usecase/scene.d.ts.map +1 -0
- package/dist/Schedule/usecase/schedule.d.ts +72 -0
- package/dist/Schedule/usecase/schedule.d.ts.map +1 -0
- package/dist/Schedule/usecase/update.d.ts +39 -0
- package/dist/Schedule/usecase/update.d.ts.map +1 -0
- package/dist/Style/index.d.ts +30 -0
- package/dist/Style/index.d.ts.map +1 -0
- package/dist/Style/model/appearance.d.ts +23 -0
- package/dist/Style/model/appearance.d.ts.map +1 -0
- package/dist/Style/model/breakpoint.d.ts +43 -0
- package/dist/Style/model/breakpoint.d.ts.map +1 -0
- package/dist/Style/model/hexColor.d.ts +24 -0
- package/dist/Style/model/hexColor.d.ts.map +1 -0
- package/dist/Style/model/metric.d.ts +35 -0
- package/dist/Style/model/metric.d.ts.map +1 -0
- package/dist/Style/model/palette.d.ts +38 -0
- package/dist/Style/model/palette.d.ts.map +1 -0
- package/dist/Style/model/scheme.d.ts +26 -0
- package/dist/Style/model/scheme.d.ts.map +1 -0
- package/dist/Style/model/syntax.d.ts +54 -0
- package/dist/Style/model/syntax.d.ts.map +1 -0
- package/dist/Style/model/theme.d.ts +58 -0
- package/dist/Style/model/theme.d.ts.map +1 -0
- package/dist/Style/model/token.d.ts +142 -0
- package/dist/Style/model/token.d.ts.map +1 -0
- package/dist/Style/model/typography.d.ts +83 -0
- package/dist/Style/model/typography.d.ts.map +1 -0
- package/dist/Style/model/zIndex.d.ts +25 -0
- package/dist/Style/model/zIndex.d.ts.map +1 -0
- package/dist/Style/usecase/appearanceScript.d.ts +43 -0
- package/dist/Style/usecase/appearanceScript.d.ts.map +1 -0
- package/dist/Style/usecase/chromeCss.d.ts +41 -0
- package/dist/Style/usecase/chromeCss.d.ts.map +1 -0
- package/dist/Style/usecase/contrast.d.ts +3 -0
- package/dist/Style/usecase/contrast.d.ts.map +1 -0
- package/dist/Style/usecase/metricCss.d.ts +17 -0
- package/dist/Style/usecase/metricCss.d.ts.map +1 -0
- package/dist/Style/usecase/reducedMotion.d.ts +20 -0
- package/dist/Style/usecase/reducedMotion.d.ts.map +1 -0
- package/dist/Style/usecase/schemeCss.d.ts +25 -0
- package/dist/Style/usecase/schemeCss.d.ts.map +1 -0
- package/dist/Style/usecase/syntaxCss.d.ts +14 -0
- package/dist/Style/usecase/syntaxCss.d.ts.map +1 -0
- package/dist/Style/usecase/utilities.d.ts +98 -0
- package/dist/Style/usecase/utilities.d.ts.map +1 -0
- package/dist/brand.d.ts +29 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/index.d.ts +53 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.es.js +4427 -0
- package/dist/styleEntry.d.ts +29 -0
- package/dist/styleEntry.d.ts.map +1 -0
- package/dist/styleEntry.es.js +1036 -0
- package/package.json +4 -1
package/dist/index.es.js
ADDED
|
@@ -0,0 +1,4427 @@
|
|
|
1
|
+
import * as __ext0 from "plgg";
|
|
2
|
+
import * as __ext1 from "plgg-ir-language";
|
|
3
|
+
import * as __ext2 from "plgg-ir-syntax";
|
|
4
|
+
import * as __ext3 from "plgg-view";
|
|
5
|
+
import * as __ext4 from "plgg-view/client";
|
|
6
|
+
import * as __ext5 from "plgg-view/style";
|
|
7
|
+
const __externals = {
|
|
8
|
+
"plgg": __ext0,
|
|
9
|
+
"plgg-ir-language": __ext1,
|
|
10
|
+
"plgg-ir-syntax": __ext2,
|
|
11
|
+
"plgg-view": __ext3,
|
|
12
|
+
"plgg-view/client": __ext4,
|
|
13
|
+
"plgg-view/style": __ext5
|
|
14
|
+
};
|
|
15
|
+
const __modules = {
|
|
16
|
+
"src/index.ts": function (module, exports, require) {
|
|
17
|
+
"use strict";
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.mediaValue = exports.refValue = exports.momentValue = exports.flagValue = exports.numValue = exports.textValue = exports.fieldOf = exports.field = exports.renderMode = exports.singleColumn = exports.crumbsOf = exports.multiColumnWith = exports.multiColumn = exports.currentScreen = exports.toggleMode = exports.modes = exports.formView = exports.errorFor = exports.parseForm = exports.isPending = exports.pendingSubmission = exports.idleSubmission = exports.controlKinds = exports.toaster = exports.toast = exports.tones = exports.confirmDialog = exports.checkbox = exports.selectInput = exports.textArea = exports.textInput = exports.breadcrumb = exports.colHead = exports.navTree = exports.prose = exports.heading = exports.textLink = exports.button = exports.pressDim = exports.hoverDim = exports.focusRing = exports.asidePane = exports.mainPane = exports.navPane = exports.pane = exports.column = exports.row = exports.landmarkTag = exports.cssPrefix = exports.frameworkName = void 0;
|
|
20
|
+
exports.choiceOf = exports.slotOf = exports.emptyModel = exports.declare = exports.menu = exports.menuEntry = exports.actionById = exports.collectionById = exports.collection = exports.permits = exports.isDestructive = exports.action = exports.confirm = exports.immediate = exports.matchesChoice = exports.matchesQuery = exports.queryChoice = exports.query = exports.applyVia = exports.projectRow = exports.projection = exports.projectField = exports.asFlag = exports.asMoment = exports.asNum = exports.asText = exports.unusedAdapter$ = exports.noDefaultAdapter$ = exports.unknownAdapter$ = exports.diagnosticSeverity = exports.reconcile = exports.resolveAdapter = exports.named = exports.hostAdapter = exports.effect = exports.scope = exports.actor = exports.adapter = exports.dynamic = exports.async = exports.sync = exports.makeRow = exports.refTarget = exports.fieldText = exports.mediaValue$ = exports.refValue$ = exports.momentValue$ = exports.flagValue$ = exports.numValue$ = exports.textValue$ = void 0;
|
|
21
|
+
exports.stalled = exports.rejected = exports.runFlow = exports.flowSchemaOf = exports.flowHost = exports.catalogOf = exports.rowCap = exports.runFlow$ = exports.emit$ = exports.enumArg$ = exports.textArg$ = exports.nullary$ = exports.tool = exports.runFlowEffect = exports.emit = exports.enumArg = exports.textArg = exports.nullary = exports.resumeFlow = exports.startFlow = exports.readFlow = exports.flowSchema = exports.defaultFuel = exports.schedule = exports.sceneToUrl = exports.parseUrl = exports.detailLevel$ = exports.boardLevel$ = exports.listLevel$ = exports.menuLevel$ = exports.failed = exports.loaded = exports.cancelAction = exports.confirmAction = exports.requestAction = exports.queryChoiceInput = exports.queryInput = exports.select = exports.openMenu = exports.urlChanged = exports.navigate = exports.sliceOf = exports.focusedView = exports.binding = exports.detailView$ = exports.listView$ = exports.menuView$ = exports.detailView = exports.listView = exports.menuView = void 0;
|
|
22
|
+
exports.pragmaticThemeWithPalette = exports.pragmaticTheme = exports.themeToggleCss = exports.themeToggleClass = exports.staticThemeToggle = exports.themeToggle = exports.inertModelContext = exports.detectModelContext = exports.invokeWith = exports.syncCatalog = exports.diffCatalog = exports.descriptorOf = exports.ran$ = exports.stalled$ = exports.rejected$ = exports.ran = void 0;
|
|
23
|
+
var identity_1 = require("src/Meta/model/identity.ts");
|
|
24
|
+
Object.defineProperty(exports, "frameworkName", { enumerable: true, get: function () { return identity_1.frameworkName; } });
|
|
25
|
+
Object.defineProperty(exports, "cssPrefix", { enumerable: true, get: function () { return identity_1.cssPrefix; } });
|
|
26
|
+
var Layout_1 = require("src/Layout/index.ts");
|
|
27
|
+
Object.defineProperty(exports, "landmarkTag", { enumerable: true, get: function () { return Layout_1.landmarkTag; } });
|
|
28
|
+
Object.defineProperty(exports, "row", { enumerable: true, get: function () { return Layout_1.row; } });
|
|
29
|
+
Object.defineProperty(exports, "column", { enumerable: true, get: function () { return Layout_1.column; } });
|
|
30
|
+
Object.defineProperty(exports, "pane", { enumerable: true, get: function () { return Layout_1.pane; } });
|
|
31
|
+
Object.defineProperty(exports, "navPane", { enumerable: true, get: function () { return Layout_1.navPane; } });
|
|
32
|
+
Object.defineProperty(exports, "mainPane", { enumerable: true, get: function () { return Layout_1.mainPane; } });
|
|
33
|
+
Object.defineProperty(exports, "asidePane", { enumerable: true, get: function () { return Layout_1.asidePane; } });
|
|
34
|
+
var Component_1 = require("src/Component/index.ts");
|
|
35
|
+
Object.defineProperty(exports, "focusRing", { enumerable: true, get: function () { return Component_1.focusRing; } });
|
|
36
|
+
Object.defineProperty(exports, "hoverDim", { enumerable: true, get: function () { return Component_1.hoverDim; } });
|
|
37
|
+
Object.defineProperty(exports, "pressDim", { enumerable: true, get: function () { return Component_1.pressDim; } });
|
|
38
|
+
Object.defineProperty(exports, "button", { enumerable: true, get: function () { return Component_1.button; } });
|
|
39
|
+
Object.defineProperty(exports, "textLink", { enumerable: true, get: function () { return Component_1.textLink; } });
|
|
40
|
+
Object.defineProperty(exports, "heading", { enumerable: true, get: function () { return Component_1.heading; } });
|
|
41
|
+
Object.defineProperty(exports, "prose", { enumerable: true, get: function () { return Component_1.prose; } });
|
|
42
|
+
Object.defineProperty(exports, "navTree", { enumerable: true, get: function () { return Component_1.navTree; } });
|
|
43
|
+
Object.defineProperty(exports, "colHead", { enumerable: true, get: function () { return Component_1.colHead; } });
|
|
44
|
+
Object.defineProperty(exports, "breadcrumb", { enumerable: true, get: function () { return Component_1.breadcrumb; } });
|
|
45
|
+
Object.defineProperty(exports, "textInput", { enumerable: true, get: function () { return Component_1.textInput; } });
|
|
46
|
+
Object.defineProperty(exports, "textArea", { enumerable: true, get: function () { return Component_1.textArea; } });
|
|
47
|
+
Object.defineProperty(exports, "selectInput", { enumerable: true, get: function () { return Component_1.selectInput; } });
|
|
48
|
+
Object.defineProperty(exports, "checkbox", { enumerable: true, get: function () { return Component_1.checkbox; } });
|
|
49
|
+
Object.defineProperty(exports, "confirmDialog", { enumerable: true, get: function () { return Component_1.confirmDialog; } });
|
|
50
|
+
Object.defineProperty(exports, "tones", { enumerable: true, get: function () { return Component_1.tones; } });
|
|
51
|
+
Object.defineProperty(exports, "toast", { enumerable: true, get: function () { return Component_1.toast; } });
|
|
52
|
+
Object.defineProperty(exports, "toaster", { enumerable: true, get: function () { return Component_1.toaster; } });
|
|
53
|
+
var Form_1 = require("src/Form/index.ts");
|
|
54
|
+
Object.defineProperty(exports, "controlKinds", { enumerable: true, get: function () { return Form_1.controlKinds; } });
|
|
55
|
+
Object.defineProperty(exports, "idleSubmission", { enumerable: true, get: function () { return Form_1.idleSubmission; } });
|
|
56
|
+
Object.defineProperty(exports, "pendingSubmission", { enumerable: true, get: function () { return Form_1.pendingSubmission; } });
|
|
57
|
+
Object.defineProperty(exports, "isPending", { enumerable: true, get: function () { return Form_1.isPending; } });
|
|
58
|
+
Object.defineProperty(exports, "parseForm", { enumerable: true, get: function () { return Form_1.parseForm; } });
|
|
59
|
+
Object.defineProperty(exports, "errorFor", { enumerable: true, get: function () { return Form_1.errorFor; } });
|
|
60
|
+
Object.defineProperty(exports, "formView", { enumerable: true, get: function () { return Form_1.formView; } });
|
|
61
|
+
var Render_1 = require("src/Render/index.ts");
|
|
62
|
+
Object.defineProperty(exports, "modes", { enumerable: true, get: function () { return Render_1.modes; } });
|
|
63
|
+
Object.defineProperty(exports, "toggleMode", { enumerable: true, get: function () { return Render_1.toggleMode; } });
|
|
64
|
+
Object.defineProperty(exports, "currentScreen", { enumerable: true, get: function () { return Render_1.currentScreen; } });
|
|
65
|
+
Object.defineProperty(exports, "multiColumn", { enumerable: true, get: function () { return Render_1.multiColumn; } });
|
|
66
|
+
Object.defineProperty(exports, "multiColumnWith", { enumerable: true, get: function () { return Render_1.multiColumnWith; } });
|
|
67
|
+
Object.defineProperty(exports, "crumbsOf", { enumerable: true, get: function () { return Render_1.crumbsOf; } });
|
|
68
|
+
Object.defineProperty(exports, "singleColumn", { enumerable: true, get: function () { return Render_1.singleColumn; } });
|
|
69
|
+
Object.defineProperty(exports, "renderMode", { enumerable: true, get: function () { return Render_1.renderMode; } });
|
|
70
|
+
var Row_1 = require("src/Declare/model/Row.ts");
|
|
71
|
+
Object.defineProperty(exports, "field", { enumerable: true, get: function () { return Row_1.field; } });
|
|
72
|
+
Object.defineProperty(exports, "fieldOf", { enumerable: true, get: function () { return Row_1.fieldOf; } });
|
|
73
|
+
Object.defineProperty(exports, "textValue", { enumerable: true, get: function () { return Row_1.textValue; } });
|
|
74
|
+
Object.defineProperty(exports, "numValue", { enumerable: true, get: function () { return Row_1.numValue; } });
|
|
75
|
+
Object.defineProperty(exports, "flagValue", { enumerable: true, get: function () { return Row_1.flagValue; } });
|
|
76
|
+
Object.defineProperty(exports, "momentValue", { enumerable: true, get: function () { return Row_1.momentValue; } });
|
|
77
|
+
Object.defineProperty(exports, "refValue", { enumerable: true, get: function () { return Row_1.refValue; } });
|
|
78
|
+
Object.defineProperty(exports, "mediaValue", { enumerable: true, get: function () { return Row_1.mediaValue; } });
|
|
79
|
+
Object.defineProperty(exports, "textValue$", { enumerable: true, get: function () { return Row_1.textValue$; } });
|
|
80
|
+
Object.defineProperty(exports, "numValue$", { enumerable: true, get: function () { return Row_1.numValue$; } });
|
|
81
|
+
Object.defineProperty(exports, "flagValue$", { enumerable: true, get: function () { return Row_1.flagValue$; } });
|
|
82
|
+
Object.defineProperty(exports, "momentValue$", { enumerable: true, get: function () { return Row_1.momentValue$; } });
|
|
83
|
+
Object.defineProperty(exports, "refValue$", { enumerable: true, get: function () { return Row_1.refValue$; } });
|
|
84
|
+
Object.defineProperty(exports, "mediaValue$", { enumerable: true, get: function () { return Row_1.mediaValue$; } });
|
|
85
|
+
Object.defineProperty(exports, "fieldText", { enumerable: true, get: function () { return Row_1.fieldText; } });
|
|
86
|
+
Object.defineProperty(exports, "refTarget", { enumerable: true, get: function () { return Row_1.refTarget; } });
|
|
87
|
+
Object.defineProperty(exports, "makeRow", { enumerable: true, get: function () { return Row_1.row; } });
|
|
88
|
+
var Source_1 = require("src/Declare/model/Source.ts");
|
|
89
|
+
Object.defineProperty(exports, "sync", { enumerable: true, get: function () { return Source_1.sync; } });
|
|
90
|
+
Object.defineProperty(exports, "async", { enumerable: true, get: function () { return Source_1.async; } });
|
|
91
|
+
Object.defineProperty(exports, "dynamic", { enumerable: true, get: function () { return Source_1.dynamic; } });
|
|
92
|
+
Object.defineProperty(exports, "adapter", { enumerable: true, get: function () { return Source_1.adapter; } });
|
|
93
|
+
var Adapter_1 = require("src/Declare/model/Adapter.ts");
|
|
94
|
+
Object.defineProperty(exports, "actor", { enumerable: true, get: function () { return Adapter_1.actor; } });
|
|
95
|
+
Object.defineProperty(exports, "scope", { enumerable: true, get: function () { return Adapter_1.scope; } });
|
|
96
|
+
Object.defineProperty(exports, "effect", { enumerable: true, get: function () { return Adapter_1.effect; } });
|
|
97
|
+
Object.defineProperty(exports, "hostAdapter", { enumerable: true, get: function () { return Adapter_1.hostAdapter; } });
|
|
98
|
+
Object.defineProperty(exports, "named", { enumerable: true, get: function () { return Adapter_1.named; } });
|
|
99
|
+
Object.defineProperty(exports, "resolveAdapter", { enumerable: true, get: function () { return Adapter_1.resolveAdapter; } });
|
|
100
|
+
var reconcile_1 = require("src/Declare/usecase/reconcile.ts");
|
|
101
|
+
Object.defineProperty(exports, "reconcile", { enumerable: true, get: function () { return reconcile_1.reconcile; } });
|
|
102
|
+
Object.defineProperty(exports, "diagnosticSeverity", { enumerable: true, get: function () { return reconcile_1.diagnosticSeverity; } });
|
|
103
|
+
Object.defineProperty(exports, "unknownAdapter$", { enumerable: true, get: function () { return reconcile_1.unknownAdapter$; } });
|
|
104
|
+
Object.defineProperty(exports, "noDefaultAdapter$", { enumerable: true, get: function () { return reconcile_1.noDefaultAdapter$; } });
|
|
105
|
+
Object.defineProperty(exports, "unusedAdapter$", { enumerable: true, get: function () { return reconcile_1.unusedAdapter$; } });
|
|
106
|
+
var project_1 = require("src/Declare/usecase/project.ts");
|
|
107
|
+
Object.defineProperty(exports, "asText", { enumerable: true, get: function () { return project_1.asText; } });
|
|
108
|
+
Object.defineProperty(exports, "asNum", { enumerable: true, get: function () { return project_1.asNum; } });
|
|
109
|
+
Object.defineProperty(exports, "asMoment", { enumerable: true, get: function () { return project_1.asMoment; } });
|
|
110
|
+
Object.defineProperty(exports, "asFlag", { enumerable: true, get: function () { return project_1.asFlag; } });
|
|
111
|
+
Object.defineProperty(exports, "projectField", { enumerable: true, get: function () { return project_1.projectField; } });
|
|
112
|
+
Object.defineProperty(exports, "projection", { enumerable: true, get: function () { return project_1.projection; } });
|
|
113
|
+
Object.defineProperty(exports, "projectRow", { enumerable: true, get: function () { return project_1.projectRow; } });
|
|
114
|
+
var apply_1 = require("src/Declare/usecase/apply.ts");
|
|
115
|
+
Object.defineProperty(exports, "applyVia", { enumerable: true, get: function () { return apply_1.applyVia; } });
|
|
116
|
+
var Query_1 = require("src/Declare/model/Query.ts");
|
|
117
|
+
Object.defineProperty(exports, "query", { enumerable: true, get: function () { return Query_1.query; } });
|
|
118
|
+
Object.defineProperty(exports, "queryChoice", { enumerable: true, get: function () { return Query_1.queryChoice; } });
|
|
119
|
+
Object.defineProperty(exports, "matchesQuery", { enumerable: true, get: function () { return Query_1.matchesQuery; } });
|
|
120
|
+
Object.defineProperty(exports, "matchesChoice", { enumerable: true, get: function () { return Query_1.matchesChoice; } });
|
|
121
|
+
var Action_1 = require("src/Declare/model/Action.ts");
|
|
122
|
+
Object.defineProperty(exports, "immediate", { enumerable: true, get: function () { return Action_1.immediate; } });
|
|
123
|
+
Object.defineProperty(exports, "confirm", { enumerable: true, get: function () { return Action_1.confirm; } });
|
|
124
|
+
Object.defineProperty(exports, "action", { enumerable: true, get: function () { return Action_1.action; } });
|
|
125
|
+
Object.defineProperty(exports, "isDestructive", { enumerable: true, get: function () { return Action_1.isDestructive; } });
|
|
126
|
+
Object.defineProperty(exports, "permits", { enumerable: true, get: function () { return Action_1.permits; } });
|
|
127
|
+
var Collection_1 = require("src/Declare/model/Collection.ts");
|
|
128
|
+
Object.defineProperty(exports, "collection", { enumerable: true, get: function () { return Collection_1.collection; } });
|
|
129
|
+
Object.defineProperty(exports, "collectionById", { enumerable: true, get: function () { return Collection_1.collectionById; } });
|
|
130
|
+
Object.defineProperty(exports, "actionById", { enumerable: true, get: function () { return Collection_1.actionById; } });
|
|
131
|
+
var Menu_1 = require("src/Declare/model/Menu.ts");
|
|
132
|
+
Object.defineProperty(exports, "menuEntry", { enumerable: true, get: function () { return Menu_1.menuEntry; } });
|
|
133
|
+
Object.defineProperty(exports, "menu", { enumerable: true, get: function () { return Menu_1.menu; } });
|
|
134
|
+
var Declaration_1 = require("src/Declare/model/Declaration.ts");
|
|
135
|
+
Object.defineProperty(exports, "declare", { enumerable: true, get: function () { return Declaration_1.declare; } });
|
|
136
|
+
var Model_1 = require("src/Schedule/model/Model.ts");
|
|
137
|
+
Object.defineProperty(exports, "emptyModel", { enumerable: true, get: function () { return Model_1.emptyModel; } });
|
|
138
|
+
Object.defineProperty(exports, "slotOf", { enumerable: true, get: function () { return Model_1.slotOf; } });
|
|
139
|
+
Object.defineProperty(exports, "choiceOf", { enumerable: true, get: function () { return Model_1.choiceOf; } });
|
|
140
|
+
var View_1 = require("src/Schedule/model/View.ts");
|
|
141
|
+
Object.defineProperty(exports, "menuView", { enumerable: true, get: function () { return View_1.menuView; } });
|
|
142
|
+
Object.defineProperty(exports, "listView", { enumerable: true, get: function () { return View_1.listView; } });
|
|
143
|
+
Object.defineProperty(exports, "detailView", { enumerable: true, get: function () { return View_1.detailView; } });
|
|
144
|
+
Object.defineProperty(exports, "menuView$", { enumerable: true, get: function () { return View_1.menuView$; } });
|
|
145
|
+
Object.defineProperty(exports, "listView$", { enumerable: true, get: function () { return View_1.listView$; } });
|
|
146
|
+
Object.defineProperty(exports, "detailView$", { enumerable: true, get: function () { return View_1.detailView$; } });
|
|
147
|
+
Object.defineProperty(exports, "binding", { enumerable: true, get: function () { return View_1.binding; } });
|
|
148
|
+
var lower_1 = require("src/Schedule/usecase/lower.ts");
|
|
149
|
+
Object.defineProperty(exports, "focusedView", { enumerable: true, get: function () { return lower_1.focusedView; } });
|
|
150
|
+
Object.defineProperty(exports, "sliceOf", { enumerable: true, get: function () { return lower_1.sliceOf; } });
|
|
151
|
+
var Msg_1 = require("src/Schedule/model/Msg.ts");
|
|
152
|
+
Object.defineProperty(exports, "navigate", { enumerable: true, get: function () { return Msg_1.navigate; } });
|
|
153
|
+
Object.defineProperty(exports, "urlChanged", { enumerable: true, get: function () { return Msg_1.urlChanged; } });
|
|
154
|
+
Object.defineProperty(exports, "openMenu", { enumerable: true, get: function () { return Msg_1.openMenu; } });
|
|
155
|
+
Object.defineProperty(exports, "select", { enumerable: true, get: function () { return Msg_1.select; } });
|
|
156
|
+
Object.defineProperty(exports, "queryInput", { enumerable: true, get: function () { return Msg_1.queryInput; } });
|
|
157
|
+
Object.defineProperty(exports, "queryChoiceInput", { enumerable: true, get: function () { return Msg_1.queryChoiceInput; } });
|
|
158
|
+
Object.defineProperty(exports, "requestAction", { enumerable: true, get: function () { return Msg_1.requestAction; } });
|
|
159
|
+
Object.defineProperty(exports, "confirmAction", { enumerable: true, get: function () { return Msg_1.confirmAction; } });
|
|
160
|
+
Object.defineProperty(exports, "cancelAction", { enumerable: true, get: function () { return Msg_1.cancelAction; } });
|
|
161
|
+
Object.defineProperty(exports, "loaded", { enumerable: true, get: function () { return Msg_1.loaded; } });
|
|
162
|
+
Object.defineProperty(exports, "failed", { enumerable: true, get: function () { return Msg_1.failed; } });
|
|
163
|
+
var Scene_1 = require("src/Schedule/model/Scene.ts");
|
|
164
|
+
Object.defineProperty(exports, "menuLevel$", { enumerable: true, get: function () { return Scene_1.menuLevel$; } });
|
|
165
|
+
Object.defineProperty(exports, "listLevel$", { enumerable: true, get: function () { return Scene_1.listLevel$; } });
|
|
166
|
+
Object.defineProperty(exports, "boardLevel$", { enumerable: true, get: function () { return Scene_1.boardLevel$; } });
|
|
167
|
+
Object.defineProperty(exports, "detailLevel$", { enumerable: true, get: function () { return Scene_1.detailLevel$; } });
|
|
168
|
+
var codec_1 = require("src/Schedule/usecase/codec.ts");
|
|
169
|
+
Object.defineProperty(exports, "parseUrl", { enumerable: true, get: function () { return codec_1.parseUrl; } });
|
|
170
|
+
Object.defineProperty(exports, "sceneToUrl", { enumerable: true, get: function () { return codec_1.toUrl; } });
|
|
171
|
+
var schedule_1 = require("src/Schedule/usecase/schedule.ts");
|
|
172
|
+
Object.defineProperty(exports, "schedule", { enumerable: true, get: function () { return schedule_1.schedule; } });
|
|
173
|
+
var run_1 = require("src/Flow/model/run.ts");
|
|
174
|
+
Object.defineProperty(exports, "defaultFuel", { enumerable: true, get: function () { return run_1.defaultFuel; } });
|
|
175
|
+
var forms_1 = require("src/Flow/model/forms.ts");
|
|
176
|
+
Object.defineProperty(exports, "flowSchema", { enumerable: true, get: function () { return forms_1.flowSchema; } });
|
|
177
|
+
var read_1 = require("src/Flow/usecase/read.ts");
|
|
178
|
+
Object.defineProperty(exports, "readFlow", { enumerable: true, get: function () { return read_1.readFlow; } });
|
|
179
|
+
var interpret_1 = require("src/Flow/usecase/interpret.ts");
|
|
180
|
+
Object.defineProperty(exports, "startFlow", { enumerable: true, get: function () { return interpret_1.startFlow; } });
|
|
181
|
+
Object.defineProperty(exports, "resumeFlow", { enumerable: true, get: function () { return interpret_1.resumeFlow; } });
|
|
182
|
+
var Catalog_1 = require("src/Catalog/index.ts");
|
|
183
|
+
Object.defineProperty(exports, "nullary", { enumerable: true, get: function () { return Catalog_1.nullary; } });
|
|
184
|
+
Object.defineProperty(exports, "textArg", { enumerable: true, get: function () { return Catalog_1.textArg; } });
|
|
185
|
+
Object.defineProperty(exports, "enumArg", { enumerable: true, get: function () { return Catalog_1.enumArg; } });
|
|
186
|
+
Object.defineProperty(exports, "emit", { enumerable: true, get: function () { return Catalog_1.emit; } });
|
|
187
|
+
Object.defineProperty(exports, "runFlowEffect", { enumerable: true, get: function () { return Catalog_1.runFlowEffect; } });
|
|
188
|
+
Object.defineProperty(exports, "tool", { enumerable: true, get: function () { return Catalog_1.tool; } });
|
|
189
|
+
Object.defineProperty(exports, "nullary$", { enumerable: true, get: function () { return Catalog_1.nullary$; } });
|
|
190
|
+
Object.defineProperty(exports, "textArg$", { enumerable: true, get: function () { return Catalog_1.textArg$; } });
|
|
191
|
+
Object.defineProperty(exports, "enumArg$", { enumerable: true, get: function () { return Catalog_1.enumArg$; } });
|
|
192
|
+
Object.defineProperty(exports, "emit$", { enumerable: true, get: function () { return Catalog_1.emit$; } });
|
|
193
|
+
Object.defineProperty(exports, "runFlow$", { enumerable: true, get: function () { return Catalog_1.runFlow$; } });
|
|
194
|
+
Object.defineProperty(exports, "rowCap", { enumerable: true, get: function () { return Catalog_1.rowCap; } });
|
|
195
|
+
Object.defineProperty(exports, "catalogOf", { enumerable: true, get: function () { return Catalog_1.catalogOf; } });
|
|
196
|
+
Object.defineProperty(exports, "flowHost", { enumerable: true, get: function () { return Catalog_1.flowHost; } });
|
|
197
|
+
Object.defineProperty(exports, "flowSchemaOf", { enumerable: true, get: function () { return Catalog_1.flowSchemaOf; } });
|
|
198
|
+
Object.defineProperty(exports, "runFlow", { enumerable: true, get: function () { return Catalog_1.runFlow; } });
|
|
199
|
+
Object.defineProperty(exports, "rejected", { enumerable: true, get: function () { return Catalog_1.rejected; } });
|
|
200
|
+
Object.defineProperty(exports, "stalled", { enumerable: true, get: function () { return Catalog_1.stalled; } });
|
|
201
|
+
Object.defineProperty(exports, "ran", { enumerable: true, get: function () { return Catalog_1.ran; } });
|
|
202
|
+
Object.defineProperty(exports, "rejected$", { enumerable: true, get: function () { return Catalog_1.rejected$; } });
|
|
203
|
+
Object.defineProperty(exports, "stalled$", { enumerable: true, get: function () { return Catalog_1.stalled$; } });
|
|
204
|
+
Object.defineProperty(exports, "ran$", { enumerable: true, get: function () { return Catalog_1.ran$; } });
|
|
205
|
+
Object.defineProperty(exports, "descriptorOf", { enumerable: true, get: function () { return Catalog_1.descriptorOf; } });
|
|
206
|
+
Object.defineProperty(exports, "diffCatalog", { enumerable: true, get: function () { return Catalog_1.diffCatalog; } });
|
|
207
|
+
Object.defineProperty(exports, "syncCatalog", { enumerable: true, get: function () { return Catalog_1.syncCatalog; } });
|
|
208
|
+
Object.defineProperty(exports, "invokeWith", { enumerable: true, get: function () { return Catalog_1.invokeWith; } });
|
|
209
|
+
Object.defineProperty(exports, "detectModelContext", { enumerable: true, get: function () { return Catalog_1.detectModelContext; } });
|
|
210
|
+
Object.defineProperty(exports, "inertModelContext", { enumerable: true, get: function () { return Catalog_1.inertModelContext; } });
|
|
211
|
+
var themeToggle_1 = require("src/Component/usecase/themeToggle.ts");
|
|
212
|
+
Object.defineProperty(exports, "themeToggle", { enumerable: true, get: function () { return themeToggle_1.themeToggle; } });
|
|
213
|
+
Object.defineProperty(exports, "staticThemeToggle", { enumerable: true, get: function () { return themeToggle_1.staticThemeToggle; } });
|
|
214
|
+
Object.defineProperty(exports, "themeToggleClass", { enumerable: true, get: function () { return themeToggle_1.themeToggleClass; } });
|
|
215
|
+
Object.defineProperty(exports, "themeToggleCss", { enumerable: true, get: function () { return themeToggle_1.themeToggleCss; } });
|
|
216
|
+
var brand_1 = require("src/brand.ts");
|
|
217
|
+
Object.defineProperty(exports, "pragmaticTheme", { enumerable: true, get: function () { return brand_1.pragmaticTheme; } });
|
|
218
|
+
Object.defineProperty(exports, "pragmaticThemeWithPalette", { enumerable: true, get: function () { return brand_1.pragmaticThemeWithPalette; } });
|
|
219
|
+
|
|
220
|
+
},
|
|
221
|
+
"src/Meta/model/identity.ts": function (module, exports, require) {
|
|
222
|
+
"use strict";
|
|
223
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
224
|
+
exports.cssPrefix = exports.frameworkName = void 0;
|
|
225
|
+
exports.frameworkName = "plggmatic";
|
|
226
|
+
exports.cssPrefix = "pm";
|
|
227
|
+
|
|
228
|
+
},
|
|
229
|
+
"src/Layout/index.ts": function (module, exports, require) {
|
|
230
|
+
"use strict";
|
|
231
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
232
|
+
exports.asidePane = exports.mainPane = exports.navPane = exports.pane = exports.column = exports.row = exports.landmarkTag = void 0;
|
|
233
|
+
var pane_1 = require("src/Layout/model/pane.ts");
|
|
234
|
+
Object.defineProperty(exports, "landmarkTag", { enumerable: true, get: function () { return pane_1.landmarkTag; } });
|
|
235
|
+
var combinators_1 = require("src/Layout/usecase/combinators.ts");
|
|
236
|
+
Object.defineProperty(exports, "row", { enumerable: true, get: function () { return combinators_1.row; } });
|
|
237
|
+
Object.defineProperty(exports, "column", { enumerable: true, get: function () { return combinators_1.column; } });
|
|
238
|
+
Object.defineProperty(exports, "pane", { enumerable: true, get: function () { return combinators_1.pane; } });
|
|
239
|
+
Object.defineProperty(exports, "navPane", { enumerable: true, get: function () { return combinators_1.navPane; } });
|
|
240
|
+
Object.defineProperty(exports, "mainPane", { enumerable: true, get: function () { return combinators_1.mainPane; } });
|
|
241
|
+
Object.defineProperty(exports, "asidePane", { enumerable: true, get: function () { return combinators_1.asidePane; } });
|
|
242
|
+
|
|
243
|
+
},
|
|
244
|
+
"src/Layout/model/pane.ts": function (module, exports, require) {
|
|
245
|
+
"use strict";
|
|
246
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
247
|
+
exports.landmarkTag = void 0;
|
|
248
|
+
const LANDMARK = {
|
|
249
|
+
navigation: "nav",
|
|
250
|
+
main: "main",
|
|
251
|
+
complementary: "aside",
|
|
252
|
+
};
|
|
253
|
+
const landmarkTag = (role) => LANDMARK[role];
|
|
254
|
+
exports.landmarkTag = landmarkTag;
|
|
255
|
+
|
|
256
|
+
},
|
|
257
|
+
"src/Layout/usecase/combinators.ts": function (module, exports, require) {
|
|
258
|
+
"use strict";
|
|
259
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
260
|
+
exports.asidePane = exports.mainPane = exports.navPane = exports.pane = exports.column = exports.row = void 0;
|
|
261
|
+
const plgg_view_1 = require("plgg-view");
|
|
262
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
263
|
+
const pane_1 = require("src/Layout/model/pane.ts");
|
|
264
|
+
const row = (parts, children) => (0, plgg_view_1.el)("div", [(0, styleEntry_1.style_)("pm-row", styleEntry_1.flex, ...parts)], children);
|
|
265
|
+
exports.row = row;
|
|
266
|
+
const column = (parts, children) => (0, plgg_view_1.el)("div", [(0, styleEntry_1.style_)("pm-col", styleEntry_1.flexCol, ...parts)], children);
|
|
267
|
+
exports.column = column;
|
|
268
|
+
const pane = (role) => (parts, children) => (0, plgg_view_1.el)((0, pane_1.landmarkTag)(role), [(0, styleEntry_1.style_)("pm-pane", ...parts)], children);
|
|
269
|
+
exports.pane = pane;
|
|
270
|
+
exports.navPane = (0, exports.pane)("navigation");
|
|
271
|
+
exports.mainPane = (0, exports.pane)("main");
|
|
272
|
+
exports.asidePane = (0, exports.pane)("complementary");
|
|
273
|
+
|
|
274
|
+
},
|
|
275
|
+
"src/styleEntry.ts": function (module, exports, require) {
|
|
276
|
+
"use strict";
|
|
277
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
278
|
+
if (k2 === undefined) k2 = k;
|
|
279
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
280
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
281
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
282
|
+
}
|
|
283
|
+
Object.defineProperty(o, k2, desc);
|
|
284
|
+
}) : (function(o, m, k, k2) {
|
|
285
|
+
if (k2 === undefined) k2 = k;
|
|
286
|
+
o[k2] = m[k];
|
|
287
|
+
}));
|
|
288
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
289
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
290
|
+
};
|
|
291
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
292
|
+
exports.zIndex = exports.lineHeight = exports.weight = exports.fluid = exports.basis = exports.outline = exports.borderColor = exports.border = exports.textColor = exports.color = exports.bg = exports.zValue = exports.zBands = exports.metricVar = exports.metricValue = exports.metrics = exports.maxWidth = exports.minWidth = exports.breakpointPx = exports.breakpoints = exports.sansFontStack = exports.typeScale = exports.semibold = exports.medium = exports.regular = exports.fontWeights = exports.typeRoles = exports.applyScheme = exports.injectAppearanceScript = exports.appearanceInitScript = exports.decideScheme = exports.appearanceStorageKey = exports.contrastRatio = exports.hex = exports.paletteHex = exports.asPalette = exports.defaultPalette = exports.asHexColor = exports.colorVar = exports.colorHex = exports.schemes = exports.variants = exports.semanticRoles = exports.neutrals = exports.colors = exports.defaultTheme = exports.themeToggleCss = exports.themeToggleClass = exports.staticThemeToggle = exports.themeToggle = void 0;
|
|
293
|
+
exports.pragmaticThemeWithPalette = exports.pragmaticTheme = exports.syntaxCss = exports.reducedMotionCss = exports.metricCss = exports.chromeCss = exports.schemeCssOf = exports.schemeCss = exports.syntaxVar = exports.syntaxHex = exports.syntaxPalette = exports.syntaxKinds = exports.measure = exports.typeStyle = void 0;
|
|
294
|
+
__exportStar(require("plgg-view/style"), exports);
|
|
295
|
+
var themeToggle_1 = require("src/Component/usecase/themeToggle.ts");
|
|
296
|
+
Object.defineProperty(exports, "themeToggle", { enumerable: true, get: function () { return themeToggle_1.themeToggle; } });
|
|
297
|
+
Object.defineProperty(exports, "staticThemeToggle", { enumerable: true, get: function () { return themeToggle_1.staticThemeToggle; } });
|
|
298
|
+
Object.defineProperty(exports, "themeToggleClass", { enumerable: true, get: function () { return themeToggle_1.themeToggleClass; } });
|
|
299
|
+
Object.defineProperty(exports, "themeToggleCss", { enumerable: true, get: function () { return themeToggle_1.themeToggleCss; } });
|
|
300
|
+
var Style_1 = require("src/Style/index.ts");
|
|
301
|
+
Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return Style_1.defaultTheme; } });
|
|
302
|
+
Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return Style_1.colors; } });
|
|
303
|
+
Object.defineProperty(exports, "neutrals", { enumerable: true, get: function () { return Style_1.neutrals; } });
|
|
304
|
+
Object.defineProperty(exports, "semanticRoles", { enumerable: true, get: function () { return Style_1.semanticRoles; } });
|
|
305
|
+
Object.defineProperty(exports, "variants", { enumerable: true, get: function () { return Style_1.variants; } });
|
|
306
|
+
Object.defineProperty(exports, "schemes", { enumerable: true, get: function () { return Style_1.schemes; } });
|
|
307
|
+
Object.defineProperty(exports, "colorHex", { enumerable: true, get: function () { return Style_1.colorHex; } });
|
|
308
|
+
Object.defineProperty(exports, "colorVar", { enumerable: true, get: function () { return Style_1.colorVar; } });
|
|
309
|
+
Object.defineProperty(exports, "asHexColor", { enumerable: true, get: function () { return Style_1.asHexColor; } });
|
|
310
|
+
Object.defineProperty(exports, "defaultPalette", { enumerable: true, get: function () { return Style_1.defaultPalette; } });
|
|
311
|
+
Object.defineProperty(exports, "asPalette", { enumerable: true, get: function () { return Style_1.asPalette; } });
|
|
312
|
+
Object.defineProperty(exports, "paletteHex", { enumerable: true, get: function () { return Style_1.paletteHex; } });
|
|
313
|
+
Object.defineProperty(exports, "hex", { enumerable: true, get: function () { return Style_1.hex; } });
|
|
314
|
+
Object.defineProperty(exports, "contrastRatio", { enumerable: true, get: function () { return Style_1.contrastRatio; } });
|
|
315
|
+
Object.defineProperty(exports, "appearanceStorageKey", { enumerable: true, get: function () { return Style_1.appearanceStorageKey; } });
|
|
316
|
+
Object.defineProperty(exports, "decideScheme", { enumerable: true, get: function () { return Style_1.decideScheme; } });
|
|
317
|
+
Object.defineProperty(exports, "appearanceInitScript", { enumerable: true, get: function () { return Style_1.appearanceInitScript; } });
|
|
318
|
+
Object.defineProperty(exports, "injectAppearanceScript", { enumerable: true, get: function () { return Style_1.injectAppearanceScript; } });
|
|
319
|
+
Object.defineProperty(exports, "applyScheme", { enumerable: true, get: function () { return Style_1.applyScheme; } });
|
|
320
|
+
Object.defineProperty(exports, "typeRoles", { enumerable: true, get: function () { return Style_1.typeRoles; } });
|
|
321
|
+
Object.defineProperty(exports, "fontWeights", { enumerable: true, get: function () { return Style_1.fontWeights; } });
|
|
322
|
+
Object.defineProperty(exports, "regular", { enumerable: true, get: function () { return Style_1.regular; } });
|
|
323
|
+
Object.defineProperty(exports, "medium", { enumerable: true, get: function () { return Style_1.medium; } });
|
|
324
|
+
Object.defineProperty(exports, "semibold", { enumerable: true, get: function () { return Style_1.semibold; } });
|
|
325
|
+
Object.defineProperty(exports, "typeScale", { enumerable: true, get: function () { return Style_1.typeScale; } });
|
|
326
|
+
Object.defineProperty(exports, "sansFontStack", { enumerable: true, get: function () { return Style_1.sansFontStack; } });
|
|
327
|
+
Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return Style_1.breakpoints; } });
|
|
328
|
+
Object.defineProperty(exports, "breakpointPx", { enumerable: true, get: function () { return Style_1.breakpointPx; } });
|
|
329
|
+
Object.defineProperty(exports, "minWidth", { enumerable: true, get: function () { return Style_1.minWidth; } });
|
|
330
|
+
Object.defineProperty(exports, "maxWidth", { enumerable: true, get: function () { return Style_1.maxWidth; } });
|
|
331
|
+
Object.defineProperty(exports, "metrics", { enumerable: true, get: function () { return Style_1.metrics; } });
|
|
332
|
+
Object.defineProperty(exports, "metricValue", { enumerable: true, get: function () { return Style_1.metricValue; } });
|
|
333
|
+
Object.defineProperty(exports, "metricVar", { enumerable: true, get: function () { return Style_1.metricVar; } });
|
|
334
|
+
Object.defineProperty(exports, "zBands", { enumerable: true, get: function () { return Style_1.zBands; } });
|
|
335
|
+
Object.defineProperty(exports, "zValue", { enumerable: true, get: function () { return Style_1.zValue; } });
|
|
336
|
+
Object.defineProperty(exports, "bg", { enumerable: true, get: function () { return Style_1.bg; } });
|
|
337
|
+
Object.defineProperty(exports, "color", { enumerable: true, get: function () { return Style_1.color; } });
|
|
338
|
+
Object.defineProperty(exports, "textColor", { enumerable: true, get: function () { return Style_1.textColor; } });
|
|
339
|
+
Object.defineProperty(exports, "border", { enumerable: true, get: function () { return Style_1.border; } });
|
|
340
|
+
Object.defineProperty(exports, "borderColor", { enumerable: true, get: function () { return Style_1.borderColor; } });
|
|
341
|
+
Object.defineProperty(exports, "outline", { enumerable: true, get: function () { return Style_1.outline; } });
|
|
342
|
+
Object.defineProperty(exports, "basis", { enumerable: true, get: function () { return Style_1.basis; } });
|
|
343
|
+
Object.defineProperty(exports, "fluid", { enumerable: true, get: function () { return Style_1.fluid; } });
|
|
344
|
+
Object.defineProperty(exports, "weight", { enumerable: true, get: function () { return Style_1.weight; } });
|
|
345
|
+
Object.defineProperty(exports, "lineHeight", { enumerable: true, get: function () { return Style_1.lineHeight; } });
|
|
346
|
+
Object.defineProperty(exports, "zIndex", { enumerable: true, get: function () { return Style_1.zIndex; } });
|
|
347
|
+
Object.defineProperty(exports, "typeStyle", { enumerable: true, get: function () { return Style_1.typeStyle; } });
|
|
348
|
+
Object.defineProperty(exports, "measure", { enumerable: true, get: function () { return Style_1.measure; } });
|
|
349
|
+
Object.defineProperty(exports, "syntaxKinds", { enumerable: true, get: function () { return Style_1.syntaxKinds; } });
|
|
350
|
+
Object.defineProperty(exports, "syntaxPalette", { enumerable: true, get: function () { return Style_1.syntaxPalette; } });
|
|
351
|
+
Object.defineProperty(exports, "syntaxHex", { enumerable: true, get: function () { return Style_1.syntaxHex; } });
|
|
352
|
+
Object.defineProperty(exports, "syntaxVar", { enumerable: true, get: function () { return Style_1.syntaxVar; } });
|
|
353
|
+
Object.defineProperty(exports, "schemeCss", { enumerable: true, get: function () { return Style_1.schemeCss; } });
|
|
354
|
+
Object.defineProperty(exports, "schemeCssOf", { enumerable: true, get: function () { return Style_1.schemeCssOf; } });
|
|
355
|
+
Object.defineProperty(exports, "chromeCss", { enumerable: true, get: function () { return Style_1.chromeCss; } });
|
|
356
|
+
Object.defineProperty(exports, "metricCss", { enumerable: true, get: function () { return Style_1.metricCss; } });
|
|
357
|
+
Object.defineProperty(exports, "reducedMotionCss", { enumerable: true, get: function () { return Style_1.reducedMotionCss; } });
|
|
358
|
+
Object.defineProperty(exports, "syntaxCss", { enumerable: true, get: function () { return Style_1.syntaxCss; } });
|
|
359
|
+
var brand_1 = require("src/brand.ts");
|
|
360
|
+
Object.defineProperty(exports, "pragmaticTheme", { enumerable: true, get: function () { return brand_1.pragmaticTheme; } });
|
|
361
|
+
Object.defineProperty(exports, "pragmaticThemeWithPalette", { enumerable: true, get: function () { return brand_1.pragmaticThemeWithPalette; } });
|
|
362
|
+
|
|
363
|
+
},
|
|
364
|
+
"src/Component/usecase/themeToggle.ts": function (module, exports, require) {
|
|
365
|
+
"use strict";
|
|
366
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
367
|
+
exports.themeToggleCss = exports.staticThemeToggle = exports.themeToggleClass = exports.themeToggle = void 0;
|
|
368
|
+
const plgg_view_1 = require("plgg-view");
|
|
369
|
+
const Style_1 = require("src/Style/index.ts");
|
|
370
|
+
const style_1 = require("plgg-view/style");
|
|
371
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
372
|
+
const cvar = (0, Style_1.colorVar)(Style_1.defaultTheme);
|
|
373
|
+
const SUN_D = "M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zM11 1h2v3h-2zm0 19h2v3h-2zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2zM4 11v2H1v-2z";
|
|
374
|
+
const MOON_D = "M9.822 2.238a9 9 0 0 0 11.94 11.94C20.768 18.654 16.775 22 12 22 6.477 22 2 17.523 2 12c0-4.775 3.346-8.768 7.822-9.762z";
|
|
375
|
+
const icon = (d) => (0, plgg_view_1.svg)([
|
|
376
|
+
(0, plgg_view_1.attr)("viewBox", "0 0 24 24"),
|
|
377
|
+
(0, plgg_view_1.attr)("width", "18"),
|
|
378
|
+
(0, plgg_view_1.attr)("height", "18"),
|
|
379
|
+
(0, plgg_view_1.attr)("fill", "currentColor"),
|
|
380
|
+
(0, plgg_view_1.attr)("aria-hidden", "true"),
|
|
381
|
+
], [(0, plgg_view_1.path)([(0, plgg_view_1.attr)("d", d)], [])]);
|
|
382
|
+
const themeToggle = (props) => (0, plgg_view_1.button)([
|
|
383
|
+
(0, plgg_view_1.type_)("button"),
|
|
384
|
+
(0, plgg_view_1.attr)("aria-label", props.scheme === "light"
|
|
385
|
+
? "Switch to dark mode"
|
|
386
|
+
: "Switch to light mode"),
|
|
387
|
+
(0, plgg_view_1.onClick)(props.toggle),
|
|
388
|
+
(0, style_1.style_)((0, Style_1.bg)("surface"), (0, Style_1.textColor)("text"), Style_1.border, (0, style_1.rounded)("full"), (0, style_1.p)(2), style_1.pointer, interaction_1.focusRing, interaction_1.hoverDim),
|
|
389
|
+
], [
|
|
390
|
+
props.scheme === "light"
|
|
391
|
+
? icon(SUN_D)
|
|
392
|
+
: icon(MOON_D),
|
|
393
|
+
]);
|
|
394
|
+
exports.themeToggle = themeToggle;
|
|
395
|
+
exports.themeToggleClass = "pm-theme-toggle";
|
|
396
|
+
const SUN_CLASS = "pm-sun";
|
|
397
|
+
const MOON_CLASS = "pm-moon";
|
|
398
|
+
const staticIcon = (cls, d) => (0, plgg_view_1.svg)([
|
|
399
|
+
(0, plgg_view_1.class_)(cls),
|
|
400
|
+
(0, plgg_view_1.attr)("viewBox", "0 0 24 24"),
|
|
401
|
+
(0, plgg_view_1.attr)("fill", "currentColor"),
|
|
402
|
+
(0, plgg_view_1.attr)("aria-hidden", "true"),
|
|
403
|
+
], [(0, plgg_view_1.path)([(0, plgg_view_1.attr)("d", d)], [])]);
|
|
404
|
+
exports.staticThemeToggle = (0, plgg_view_1.button)([
|
|
405
|
+
(0, plgg_view_1.type_)("button"),
|
|
406
|
+
(0, plgg_view_1.attr)("aria-label", "Toggle dark mode"),
|
|
407
|
+
(0, plgg_view_1.class_)(exports.themeToggleClass),
|
|
408
|
+
], [
|
|
409
|
+
staticIcon(SUN_CLASS, SUN_D),
|
|
410
|
+
staticIcon(MOON_CLASS, MOON_D),
|
|
411
|
+
]);
|
|
412
|
+
exports.themeToggleCss = `.${exports.themeToggleClass}{display:inline-flex;` +
|
|
413
|
+
`align-items:center;justify-content:center;` +
|
|
414
|
+
`width:38px;height:38px;border-radius:50%;` +
|
|
415
|
+
`border:1px solid ${cvar("border")};` +
|
|
416
|
+
`background:${cvar("surface")};` +
|
|
417
|
+
`color:${cvar("text")};padding:0;` +
|
|
418
|
+
`cursor:pointer;transition:background-color ` +
|
|
419
|
+
`0.15s,border-color 0.15s}` +
|
|
420
|
+
`.${exports.themeToggleClass}:hover{border-color:` +
|
|
421
|
+
`${cvar("primary-base")}}` +
|
|
422
|
+
`.${exports.themeToggleClass}:focus-visible{outline:2px ` +
|
|
423
|
+
`solid ${cvar("primary-base")};` +
|
|
424
|
+
`outline-offset:2px}` +
|
|
425
|
+
`.${SUN_CLASS},.${MOON_CLASS}{width:18px;` +
|
|
426
|
+
`height:18px;display:block}` +
|
|
427
|
+
`.${exports.themeToggleClass} .${MOON_CLASS}{display:none}` +
|
|
428
|
+
`html.dark .${exports.themeToggleClass} .${SUN_CLASS}` +
|
|
429
|
+
`{display:none}` +
|
|
430
|
+
`html.dark .${exports.themeToggleClass} .${MOON_CLASS}` +
|
|
431
|
+
`{display:block}`;
|
|
432
|
+
|
|
433
|
+
},
|
|
434
|
+
"src/Style/index.ts": function (module, exports, require) {
|
|
435
|
+
"use strict";
|
|
436
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
437
|
+
exports.schemeCssOf = exports.schemeCss = exports.measure = exports.typeStyle = exports.zIndex = exports.weight = exports.lineHeight = exports.fluid = exports.basis = exports.outline = exports.borderColor = exports.border = exports.textColor = exports.color = exports.bg = exports.contrastRatio = exports.applyScheme = exports.injectAppearanceScript = exports.appearanceInitScript = exports.decideScheme = exports.appearanceStorageKey = exports.hex = exports.colorHex = exports.paletteHex = exports.asPalette = exports.defaultPalette = exports.asHexColor = exports.zValue = exports.zBands = exports.metricVar = exports.metricValue = exports.metrics = exports.maxWidth = exports.minWidth = exports.breakpointPx = exports.breakpoints = exports.sansFontStack = exports.typeScale = exports.semibold = exports.medium = exports.regular = exports.fontWeights = exports.typeRoles = exports.schemes = exports.defaultTheme = exports.colorVar = exports.variants = exports.semanticRoles = exports.neutrals = exports.colors = void 0;
|
|
438
|
+
exports.syntaxCss = exports.syntaxVar = exports.syntaxHex = exports.syntaxPalette = exports.syntaxKinds = exports.reducedMotionCss = exports.metricCss = exports.chromeCss = void 0;
|
|
439
|
+
var token_1 = require("src/Style/model/token.ts");
|
|
440
|
+
Object.defineProperty(exports, "colors", { enumerable: true, get: function () { return token_1.colors; } });
|
|
441
|
+
Object.defineProperty(exports, "neutrals", { enumerable: true, get: function () { return token_1.neutrals; } });
|
|
442
|
+
Object.defineProperty(exports, "semanticRoles", { enumerable: true, get: function () { return token_1.semanticRoles; } });
|
|
443
|
+
Object.defineProperty(exports, "variants", { enumerable: true, get: function () { return token_1.variants; } });
|
|
444
|
+
Object.defineProperty(exports, "colorVar", { enumerable: true, get: function () { return token_1.colorVar; } });
|
|
445
|
+
var theme_1 = require("src/Style/model/theme.ts");
|
|
446
|
+
Object.defineProperty(exports, "defaultTheme", { enumerable: true, get: function () { return theme_1.defaultTheme; } });
|
|
447
|
+
var scheme_1 = require("src/Style/model/scheme.ts");
|
|
448
|
+
Object.defineProperty(exports, "schemes", { enumerable: true, get: function () { return scheme_1.schemes; } });
|
|
449
|
+
var typography_1 = require("src/Style/model/typography.ts");
|
|
450
|
+
Object.defineProperty(exports, "typeRoles", { enumerable: true, get: function () { return typography_1.typeRoles; } });
|
|
451
|
+
Object.defineProperty(exports, "fontWeights", { enumerable: true, get: function () { return typography_1.fontWeights; } });
|
|
452
|
+
Object.defineProperty(exports, "regular", { enumerable: true, get: function () { return typography_1.regular; } });
|
|
453
|
+
Object.defineProperty(exports, "medium", { enumerable: true, get: function () { return typography_1.medium; } });
|
|
454
|
+
Object.defineProperty(exports, "semibold", { enumerable: true, get: function () { return typography_1.semibold; } });
|
|
455
|
+
Object.defineProperty(exports, "typeScale", { enumerable: true, get: function () { return typography_1.typeScale; } });
|
|
456
|
+
Object.defineProperty(exports, "sansFontStack", { enumerable: true, get: function () { return typography_1.sansFontStack; } });
|
|
457
|
+
var breakpoint_1 = require("src/Style/model/breakpoint.ts");
|
|
458
|
+
Object.defineProperty(exports, "breakpoints", { enumerable: true, get: function () { return breakpoint_1.breakpoints; } });
|
|
459
|
+
Object.defineProperty(exports, "breakpointPx", { enumerable: true, get: function () { return breakpoint_1.breakpointPx; } });
|
|
460
|
+
Object.defineProperty(exports, "minWidth", { enumerable: true, get: function () { return breakpoint_1.minWidth; } });
|
|
461
|
+
Object.defineProperty(exports, "maxWidth", { enumerable: true, get: function () { return breakpoint_1.maxWidth; } });
|
|
462
|
+
var metric_1 = require("src/Style/model/metric.ts");
|
|
463
|
+
Object.defineProperty(exports, "metrics", { enumerable: true, get: function () { return metric_1.metrics; } });
|
|
464
|
+
Object.defineProperty(exports, "metricValue", { enumerable: true, get: function () { return metric_1.metricValue; } });
|
|
465
|
+
Object.defineProperty(exports, "metricVar", { enumerable: true, get: function () { return metric_1.metricVar; } });
|
|
466
|
+
var zIndex_1 = require("src/Style/model/zIndex.ts");
|
|
467
|
+
Object.defineProperty(exports, "zBands", { enumerable: true, get: function () { return zIndex_1.zBands; } });
|
|
468
|
+
Object.defineProperty(exports, "zValue", { enumerable: true, get: function () { return zIndex_1.zValue; } });
|
|
469
|
+
var hexColor_1 = require("src/Style/model/hexColor.ts");
|
|
470
|
+
Object.defineProperty(exports, "asHexColor", { enumerable: true, get: function () { return hexColor_1.asHexColor; } });
|
|
471
|
+
var palette_1 = require("src/Style/model/palette.ts");
|
|
472
|
+
Object.defineProperty(exports, "defaultPalette", { enumerable: true, get: function () { return palette_1.defaultPalette; } });
|
|
473
|
+
Object.defineProperty(exports, "asPalette", { enumerable: true, get: function () { return palette_1.asPalette; } });
|
|
474
|
+
Object.defineProperty(exports, "paletteHex", { enumerable: true, get: function () { return palette_1.paletteHex; } });
|
|
475
|
+
Object.defineProperty(exports, "colorHex", { enumerable: true, get: function () { return palette_1.colorHex; } });
|
|
476
|
+
Object.defineProperty(exports, "hex", { enumerable: true, get: function () { return palette_1.hex; } });
|
|
477
|
+
var appearance_1 = require("src/Style/model/appearance.ts");
|
|
478
|
+
Object.defineProperty(exports, "appearanceStorageKey", { enumerable: true, get: function () { return appearance_1.appearanceStorageKey; } });
|
|
479
|
+
Object.defineProperty(exports, "decideScheme", { enumerable: true, get: function () { return appearance_1.decideScheme; } });
|
|
480
|
+
var appearanceScript_1 = require("src/Style/usecase/appearanceScript.ts");
|
|
481
|
+
Object.defineProperty(exports, "appearanceInitScript", { enumerable: true, get: function () { return appearanceScript_1.appearanceInitScript; } });
|
|
482
|
+
Object.defineProperty(exports, "injectAppearanceScript", { enumerable: true, get: function () { return appearanceScript_1.injectAppearanceScript; } });
|
|
483
|
+
Object.defineProperty(exports, "applyScheme", { enumerable: true, get: function () { return appearanceScript_1.applyScheme; } });
|
|
484
|
+
var contrast_1 = require("src/Style/usecase/contrast.ts");
|
|
485
|
+
Object.defineProperty(exports, "contrastRatio", { enumerable: true, get: function () { return contrast_1.contrastRatio; } });
|
|
486
|
+
var utilities_1 = require("src/Style/usecase/utilities.ts");
|
|
487
|
+
Object.defineProperty(exports, "bg", { enumerable: true, get: function () { return utilities_1.bg; } });
|
|
488
|
+
Object.defineProperty(exports, "color", { enumerable: true, get: function () { return utilities_1.color; } });
|
|
489
|
+
Object.defineProperty(exports, "textColor", { enumerable: true, get: function () { return utilities_1.textColor; } });
|
|
490
|
+
Object.defineProperty(exports, "border", { enumerable: true, get: function () { return utilities_1.border; } });
|
|
491
|
+
Object.defineProperty(exports, "borderColor", { enumerable: true, get: function () { return utilities_1.borderColor; } });
|
|
492
|
+
Object.defineProperty(exports, "outline", { enumerable: true, get: function () { return utilities_1.outline; } });
|
|
493
|
+
Object.defineProperty(exports, "basis", { enumerable: true, get: function () { return utilities_1.basis; } });
|
|
494
|
+
Object.defineProperty(exports, "fluid", { enumerable: true, get: function () { return utilities_1.fluid; } });
|
|
495
|
+
Object.defineProperty(exports, "lineHeight", { enumerable: true, get: function () { return utilities_1.lineHeight; } });
|
|
496
|
+
Object.defineProperty(exports, "weight", { enumerable: true, get: function () { return utilities_1.weight; } });
|
|
497
|
+
Object.defineProperty(exports, "zIndex", { enumerable: true, get: function () { return utilities_1.zIndex; } });
|
|
498
|
+
Object.defineProperty(exports, "typeStyle", { enumerable: true, get: function () { return utilities_1.typeStyle; } });
|
|
499
|
+
Object.defineProperty(exports, "measure", { enumerable: true, get: function () { return utilities_1.measure; } });
|
|
500
|
+
var schemeCss_1 = require("src/Style/usecase/schemeCss.ts");
|
|
501
|
+
Object.defineProperty(exports, "schemeCss", { enumerable: true, get: function () { return schemeCss_1.schemeCss; } });
|
|
502
|
+
Object.defineProperty(exports, "schemeCssOf", { enumerable: true, get: function () { return schemeCss_1.schemeCssOf; } });
|
|
503
|
+
var chromeCss_1 = require("src/Style/usecase/chromeCss.ts");
|
|
504
|
+
Object.defineProperty(exports, "chromeCss", { enumerable: true, get: function () { return chromeCss_1.chromeCss; } });
|
|
505
|
+
var metricCss_1 = require("src/Style/usecase/metricCss.ts");
|
|
506
|
+
Object.defineProperty(exports, "metricCss", { enumerable: true, get: function () { return metricCss_1.metricCss; } });
|
|
507
|
+
var reducedMotion_1 = require("src/Style/usecase/reducedMotion.ts");
|
|
508
|
+
Object.defineProperty(exports, "reducedMotionCss", { enumerable: true, get: function () { return reducedMotion_1.reducedMotionCss; } });
|
|
509
|
+
var syntax_1 = require("src/Style/model/syntax.ts");
|
|
510
|
+
Object.defineProperty(exports, "syntaxKinds", { enumerable: true, get: function () { return syntax_1.syntaxKinds; } });
|
|
511
|
+
Object.defineProperty(exports, "syntaxPalette", { enumerable: true, get: function () { return syntax_1.syntaxPalette; } });
|
|
512
|
+
Object.defineProperty(exports, "syntaxHex", { enumerable: true, get: function () { return syntax_1.syntaxHex; } });
|
|
513
|
+
Object.defineProperty(exports, "syntaxVar", { enumerable: true, get: function () { return syntax_1.syntaxVar; } });
|
|
514
|
+
var syntaxCss_1 = require("src/Style/usecase/syntaxCss.ts");
|
|
515
|
+
Object.defineProperty(exports, "syntaxCss", { enumerable: true, get: function () { return syntaxCss_1.syntaxCss; } });
|
|
516
|
+
|
|
517
|
+
},
|
|
518
|
+
"src/Style/model/token.ts": function (module, exports, require) {
|
|
519
|
+
"use strict";
|
|
520
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
521
|
+
exports.colorVar = exports.colors = exports.neutrals = exports.variants = exports.semanticRoles = void 0;
|
|
522
|
+
exports.semanticRoles = [
|
|
523
|
+
"primary",
|
|
524
|
+
"success",
|
|
525
|
+
"danger",
|
|
526
|
+
"warning",
|
|
527
|
+
"info",
|
|
528
|
+
];
|
|
529
|
+
exports.variants = [
|
|
530
|
+
"base",
|
|
531
|
+
"text",
|
|
532
|
+
"surface",
|
|
533
|
+
"border",
|
|
534
|
+
];
|
|
535
|
+
exports.neutrals = [
|
|
536
|
+
"surface",
|
|
537
|
+
"surface-2",
|
|
538
|
+
"text",
|
|
539
|
+
"muted",
|
|
540
|
+
"border",
|
|
541
|
+
];
|
|
542
|
+
exports.colors = [
|
|
543
|
+
...exports.semanticRoles.flatMap((r) => exports.variants.map((v) => `${r}-${v}`)),
|
|
544
|
+
...exports.neutrals,
|
|
545
|
+
];
|
|
546
|
+
const colorVar = (theme) => (c) => `var(--${theme.prefix}-${c})`;
|
|
547
|
+
exports.colorVar = colorVar;
|
|
548
|
+
|
|
549
|
+
},
|
|
550
|
+
"src/Style/model/theme.ts": function (module, exports, require) {
|
|
551
|
+
"use strict";
|
|
552
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
553
|
+
exports.defaultTheme = void 0;
|
|
554
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
555
|
+
const palette_1 = require("src/Style/model/palette.ts");
|
|
556
|
+
const metric_1 = require("src/Style/model/metric.ts");
|
|
557
|
+
const typography_1 = require("src/Style/model/typography.ts");
|
|
558
|
+
const syntax_1 = require("src/Style/model/syntax.ts");
|
|
559
|
+
const zIndex_1 = require("src/Style/model/zIndex.ts");
|
|
560
|
+
const appearance_1 = require("src/Style/model/appearance.ts");
|
|
561
|
+
exports.defaultTheme = {
|
|
562
|
+
prefix: identity_1.cssPrefix,
|
|
563
|
+
palette: palette_1.defaultPalette,
|
|
564
|
+
metrics: metric_1.metricTable,
|
|
565
|
+
typeScale: typography_1.typeScale,
|
|
566
|
+
syntax: syntax_1.syntaxPalette,
|
|
567
|
+
zBands: zIndex_1.zBandTable,
|
|
568
|
+
storageKey: appearance_1.appearanceStorageKey,
|
|
569
|
+
};
|
|
570
|
+
|
|
571
|
+
},
|
|
572
|
+
"src/Style/model/palette.ts": function (module, exports, require) {
|
|
573
|
+
"use strict";
|
|
574
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
575
|
+
exports.hex = exports.asPalette = exports.colorHex = exports.paletteHex = exports.defaultPalette = void 0;
|
|
576
|
+
const plgg_1 = require("plgg");
|
|
577
|
+
const token_1 = require("src/Style/model/token.ts");
|
|
578
|
+
const scheme_1 = require("src/Style/model/scheme.ts");
|
|
579
|
+
const hexColor_1 = require("src/Style/model/hexColor.ts");
|
|
580
|
+
Object.defineProperty(exports, "hex", { enumerable: true, get: function () { return hexColor_1.hex; } });
|
|
581
|
+
const rowOf = (get) => ({
|
|
582
|
+
surface: get("surface"),
|
|
583
|
+
"surface-2": get("surface-2"),
|
|
584
|
+
text: get("text"),
|
|
585
|
+
muted: get("muted"),
|
|
586
|
+
border: get("border"),
|
|
587
|
+
"primary-base": get("primary-base"),
|
|
588
|
+
"primary-text": get("primary-text"),
|
|
589
|
+
"primary-surface": get("primary-surface"),
|
|
590
|
+
"primary-border": get("primary-border"),
|
|
591
|
+
"success-base": get("success-base"),
|
|
592
|
+
"success-text": get("success-text"),
|
|
593
|
+
"success-surface": get("success-surface"),
|
|
594
|
+
"success-border": get("success-border"),
|
|
595
|
+
"danger-base": get("danger-base"),
|
|
596
|
+
"danger-text": get("danger-text"),
|
|
597
|
+
"danger-surface": get("danger-surface"),
|
|
598
|
+
"danger-border": get("danger-border"),
|
|
599
|
+
"warning-base": get("warning-base"),
|
|
600
|
+
"warning-text": get("warning-text"),
|
|
601
|
+
"warning-surface": get("warning-surface"),
|
|
602
|
+
"warning-border": get("warning-border"),
|
|
603
|
+
"info-base": get("info-base"),
|
|
604
|
+
"info-text": get("info-text"),
|
|
605
|
+
"info-surface": get("info-surface"),
|
|
606
|
+
"info-border": get("info-border"),
|
|
607
|
+
});
|
|
608
|
+
const paletteOf = (get) => ({
|
|
609
|
+
light: rowOf((c) => get("light", c)),
|
|
610
|
+
dark: rowOf((c) => get("dark", c)),
|
|
611
|
+
});
|
|
612
|
+
const DEFAULT_RAW = {
|
|
613
|
+
light: {
|
|
614
|
+
surface: "#ffffff",
|
|
615
|
+
"surface-2": "#f6f6f7",
|
|
616
|
+
text: "#1f1f22",
|
|
617
|
+
muted: "#5b5b61",
|
|
618
|
+
border: "#ededee",
|
|
619
|
+
"primary-base": "#111111",
|
|
620
|
+
"primary-text": "#111111",
|
|
621
|
+
"primary-surface": "#f6f6f7",
|
|
622
|
+
"primary-border": "#767679",
|
|
623
|
+
"success-base": "#047857",
|
|
624
|
+
"success-text": "#065f46",
|
|
625
|
+
"success-surface": "#ecfdf5",
|
|
626
|
+
"success-border": "#059669",
|
|
627
|
+
"danger-base": "#b91c1c",
|
|
628
|
+
"danger-text": "#991b1b",
|
|
629
|
+
"danger-surface": "#fef2f2",
|
|
630
|
+
"danger-border": "#dc2626",
|
|
631
|
+
"warning-base": "#92400e",
|
|
632
|
+
"warning-text": "#78350f",
|
|
633
|
+
"warning-surface": "#fffbeb",
|
|
634
|
+
"warning-border": "#b45309",
|
|
635
|
+
"info-base": "#1d4ed8",
|
|
636
|
+
"info-text": "#1e40af",
|
|
637
|
+
"info-surface": "#eff6ff",
|
|
638
|
+
"info-border": "#2563eb",
|
|
639
|
+
},
|
|
640
|
+
dark: {
|
|
641
|
+
surface: "#1b1b1f",
|
|
642
|
+
"surface-2": "#202127",
|
|
643
|
+
text: "#dfdfe4",
|
|
644
|
+
muted: "#8d8d95",
|
|
645
|
+
border: "#262629",
|
|
646
|
+
"primary-base": "#f4f4f4",
|
|
647
|
+
"primary-text": "#f4f4f4",
|
|
648
|
+
"primary-surface": "#202127",
|
|
649
|
+
"primary-border": "#8a8a90",
|
|
650
|
+
"success-base": "#34d399",
|
|
651
|
+
"success-text": "#34d399",
|
|
652
|
+
"success-surface": "#022c22",
|
|
653
|
+
"success-border": "#34d399",
|
|
654
|
+
"danger-base": "#f87171",
|
|
655
|
+
"danger-text": "#f87171",
|
|
656
|
+
"danger-surface": "#450a0a",
|
|
657
|
+
"danger-border": "#f87171",
|
|
658
|
+
"warning-base": "#fbbf24",
|
|
659
|
+
"warning-text": "#fbbf24",
|
|
660
|
+
"warning-surface": "#451a03",
|
|
661
|
+
"warning-border": "#fbbf24",
|
|
662
|
+
"info-base": "#60a5fa",
|
|
663
|
+
"info-text": "#60a5fa",
|
|
664
|
+
"info-surface": "#172554",
|
|
665
|
+
"info-border": "#60a5fa",
|
|
666
|
+
},
|
|
667
|
+
};
|
|
668
|
+
const mint = (s) => (0, plgg_1.box)("HexColor")(s);
|
|
669
|
+
exports.defaultPalette = paletteOf((scheme, c) => mint(DEFAULT_RAW[scheme][c]));
|
|
670
|
+
const paletteHex = (palette, scheme, c) => palette[scheme][c];
|
|
671
|
+
exports.paletteHex = paletteHex;
|
|
672
|
+
const colorHex = (scheme, c) => exports.defaultPalette[scheme][c];
|
|
673
|
+
exports.colorHex = colorHex;
|
|
674
|
+
const at = (obj, key) => typeof obj === "object" &&
|
|
675
|
+
obj !== null &&
|
|
676
|
+
key in obj
|
|
677
|
+
? new Map(Object.entries(obj)).get(key)
|
|
678
|
+
: undefined;
|
|
679
|
+
const asPalette = (value) => {
|
|
680
|
+
const cell = (scheme, c) => {
|
|
681
|
+
const row = at(value, scheme);
|
|
682
|
+
if (row === undefined) {
|
|
683
|
+
return (0, plgg_1.err)((0, plgg_1.invalidError)({
|
|
684
|
+
message: `palette missing scheme: ${scheme}`,
|
|
685
|
+
}));
|
|
686
|
+
}
|
|
687
|
+
const cast = (0, hexColor_1.asHexColor)(at(row, c));
|
|
688
|
+
return (0, plgg_1.isErr)(cast)
|
|
689
|
+
? (0, plgg_1.err)((0, plgg_1.invalidError)({
|
|
690
|
+
message: `palette invalid at ${scheme}.${c}`,
|
|
691
|
+
}))
|
|
692
|
+
: cast;
|
|
693
|
+
};
|
|
694
|
+
for (const scheme of scheme_1.schemes) {
|
|
695
|
+
for (const c of token_1.colors) {
|
|
696
|
+
const r = cell(scheme, c);
|
|
697
|
+
if ((0, plgg_1.isErr)(r)) {
|
|
698
|
+
return r;
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
return (0, plgg_1.ok)(paletteOf((scheme, c) => {
|
|
703
|
+
const r = cell(scheme, c);
|
|
704
|
+
return (0, plgg_1.isOk)(r)
|
|
705
|
+
? r.content
|
|
706
|
+
: mint("#000000");
|
|
707
|
+
}));
|
|
708
|
+
};
|
|
709
|
+
exports.asPalette = asPalette;
|
|
710
|
+
|
|
711
|
+
},
|
|
712
|
+
"src/Style/model/scheme.ts": function (module, exports, require) {
|
|
713
|
+
"use strict";
|
|
714
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
715
|
+
exports.schemes = void 0;
|
|
716
|
+
exports.schemes = [
|
|
717
|
+
"light",
|
|
718
|
+
"dark",
|
|
719
|
+
];
|
|
720
|
+
|
|
721
|
+
},
|
|
722
|
+
"src/Style/model/hexColor.ts": function (module, exports, require) {
|
|
723
|
+
"use strict";
|
|
724
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
725
|
+
exports.hex = exports.asHexColor = exports.isHexColor = void 0;
|
|
726
|
+
const plgg_1 = require("plgg");
|
|
727
|
+
const HEX = /^#[0-9a-f]{6}$/;
|
|
728
|
+
const normalize = (value) => (0, plgg_1.isSoftStr)(value) &&
|
|
729
|
+
HEX.test(value.toLowerCase())
|
|
730
|
+
? value.toLowerCase()
|
|
731
|
+
: undefined;
|
|
732
|
+
const is = (value) => (0, plgg_1.isBoxWithTag)("HexColor")(value) &&
|
|
733
|
+
(0, plgg_1.isSoftStr)(value.content) &&
|
|
734
|
+
HEX.test(value.content);
|
|
735
|
+
exports.isHexColor = is;
|
|
736
|
+
const asHexColor = (value) => {
|
|
737
|
+
if (is(value)) {
|
|
738
|
+
return (0, plgg_1.ok)(value);
|
|
739
|
+
}
|
|
740
|
+
const norm = normalize(value);
|
|
741
|
+
return norm === undefined
|
|
742
|
+
? (0, plgg_1.err)((0, plgg_1.invalidError)({
|
|
743
|
+
message: `Value is not a #rrggbb hex color: ${String(value)}`,
|
|
744
|
+
}))
|
|
745
|
+
: (0, plgg_1.ok)((0, plgg_1.box)("HexColor")(norm));
|
|
746
|
+
};
|
|
747
|
+
exports.asHexColor = asHexColor;
|
|
748
|
+
const hex = (c) => c.content;
|
|
749
|
+
exports.hex = hex;
|
|
750
|
+
|
|
751
|
+
},
|
|
752
|
+
"src/Style/model/metric.ts": function (module, exports, require) {
|
|
753
|
+
"use strict";
|
|
754
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
755
|
+
exports.metricVar = exports.metricValue = exports.metricTable = exports.metrics = void 0;
|
|
756
|
+
exports.metrics = [
|
|
757
|
+
"shell-max",
|
|
758
|
+
"sidebar",
|
|
759
|
+
"measure",
|
|
760
|
+
"rail",
|
|
761
|
+
];
|
|
762
|
+
exports.metricTable = {
|
|
763
|
+
"shell-max": "1440px",
|
|
764
|
+
sidebar: "256px",
|
|
765
|
+
measure: "48rem",
|
|
766
|
+
rail: "48px",
|
|
767
|
+
};
|
|
768
|
+
const metricValue = (m) => exports.metricTable[m];
|
|
769
|
+
exports.metricValue = metricValue;
|
|
770
|
+
const metricVar = (theme) => (m) => `var(--${theme.prefix}-${m})`;
|
|
771
|
+
exports.metricVar = metricVar;
|
|
772
|
+
|
|
773
|
+
},
|
|
774
|
+
"src/Style/model/typography.ts": function (module, exports, require) {
|
|
775
|
+
"use strict";
|
|
776
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
777
|
+
exports.sansFontStack = exports.typeScale = exports.semibold = exports.medium = exports.regular = exports.fontWeights = exports.typeRoles = void 0;
|
|
778
|
+
const plgg_1 = require("plgg");
|
|
779
|
+
exports.typeRoles = ["h1", "h2", "h3", "h4", "body"];
|
|
780
|
+
exports.fontWeights = [400, 500, 600];
|
|
781
|
+
exports.regular = 400;
|
|
782
|
+
exports.medium = 500;
|
|
783
|
+
exports.semibold = 600;
|
|
784
|
+
exports.typeScale = {
|
|
785
|
+
h1: {
|
|
786
|
+
size: "1.875rem",
|
|
787
|
+
lineHeight: "1.25",
|
|
788
|
+
weight: 400,
|
|
789
|
+
compact: (0, plgg_1.some)({
|
|
790
|
+
size: "1.75rem",
|
|
791
|
+
lineHeight: (0, plgg_1.some)("1.25"),
|
|
792
|
+
}),
|
|
793
|
+
},
|
|
794
|
+
h2: {
|
|
795
|
+
size: "1.5rem",
|
|
796
|
+
lineHeight: "1.3",
|
|
797
|
+
weight: 400,
|
|
798
|
+
compact: (0, plgg_1.some)({
|
|
799
|
+
size: "1.375rem",
|
|
800
|
+
lineHeight: (0, plgg_1.some)("1.3"),
|
|
801
|
+
}),
|
|
802
|
+
},
|
|
803
|
+
h3: {
|
|
804
|
+
size: "1.1875rem",
|
|
805
|
+
lineHeight: "1.45",
|
|
806
|
+
weight: 400,
|
|
807
|
+
compact: (0, plgg_1.some)({
|
|
808
|
+
size: "1.125rem",
|
|
809
|
+
lineHeight: (0, plgg_1.none)(),
|
|
810
|
+
}),
|
|
811
|
+
},
|
|
812
|
+
h4: {
|
|
813
|
+
size: "1.0625rem",
|
|
814
|
+
lineHeight: "1.5",
|
|
815
|
+
weight: 400,
|
|
816
|
+
compact: (0, plgg_1.none)(),
|
|
817
|
+
},
|
|
818
|
+
body: {
|
|
819
|
+
size: "1rem",
|
|
820
|
+
lineHeight: "1.75",
|
|
821
|
+
weight: 400,
|
|
822
|
+
compact: (0, plgg_1.none)(),
|
|
823
|
+
},
|
|
824
|
+
};
|
|
825
|
+
exports.sansFontStack = `"Inter",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif,"Apple Color Emoji","Segoe UI Emoji"`;
|
|
826
|
+
|
|
827
|
+
},
|
|
828
|
+
"src/Style/model/syntax.ts": function (module, exports, require) {
|
|
829
|
+
"use strict";
|
|
830
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
831
|
+
exports.syntaxVar = exports.syntaxHex = exports.syntaxPalette = exports.syntaxKinds = void 0;
|
|
832
|
+
const plgg_1 = require("plgg");
|
|
833
|
+
exports.syntaxKinds = [
|
|
834
|
+
"keyword",
|
|
835
|
+
"string",
|
|
836
|
+
"number",
|
|
837
|
+
"comment",
|
|
838
|
+
"regex",
|
|
839
|
+
"template",
|
|
840
|
+
"punctuation",
|
|
841
|
+
];
|
|
842
|
+
const RAW = {
|
|
843
|
+
light: {
|
|
844
|
+
keyword: "#cf222e",
|
|
845
|
+
string: "#0a3069",
|
|
846
|
+
number: "#0550ae",
|
|
847
|
+
comment: "#656d76",
|
|
848
|
+
regex: "#116329",
|
|
849
|
+
template: "#0a3069",
|
|
850
|
+
punctuation: "#57606a",
|
|
851
|
+
},
|
|
852
|
+
dark: {
|
|
853
|
+
keyword: "#ff7b72",
|
|
854
|
+
string: "#a5d6ff",
|
|
855
|
+
number: "#79c0ff",
|
|
856
|
+
comment: "#8b949e",
|
|
857
|
+
regex: "#7ee787",
|
|
858
|
+
template: "#a5d6ff",
|
|
859
|
+
punctuation: "#c9d1d9",
|
|
860
|
+
},
|
|
861
|
+
};
|
|
862
|
+
const rowOf = (get) => ({
|
|
863
|
+
keyword: get("keyword"),
|
|
864
|
+
string: get("string"),
|
|
865
|
+
number: get("number"),
|
|
866
|
+
comment: get("comment"),
|
|
867
|
+
regex: get("regex"),
|
|
868
|
+
template: get("template"),
|
|
869
|
+
punctuation: get("punctuation"),
|
|
870
|
+
});
|
|
871
|
+
const mint = (s) => (0, plgg_1.box)("HexColor")(s);
|
|
872
|
+
exports.syntaxPalette = {
|
|
873
|
+
light: rowOf((k) => mint(RAW.light[k])),
|
|
874
|
+
dark: rowOf((k) => mint(RAW.dark[k])),
|
|
875
|
+
};
|
|
876
|
+
const syntaxHex = (scheme, k) => exports.syntaxPalette[scheme][k];
|
|
877
|
+
exports.syntaxHex = syntaxHex;
|
|
878
|
+
const syntaxVar = (theme) => (k) => `var(--${theme.prefix}-code-${k})`;
|
|
879
|
+
exports.syntaxVar = syntaxVar;
|
|
880
|
+
|
|
881
|
+
},
|
|
882
|
+
"src/Style/model/zIndex.ts": function (module, exports, require) {
|
|
883
|
+
"use strict";
|
|
884
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
885
|
+
exports.zValue = exports.zBandTable = exports.zBands = void 0;
|
|
886
|
+
exports.zBands = [
|
|
887
|
+
"content",
|
|
888
|
+
"chrome",
|
|
889
|
+
"backdrop",
|
|
890
|
+
"overlay",
|
|
891
|
+
];
|
|
892
|
+
exports.zBandTable = {
|
|
893
|
+
content: 1,
|
|
894
|
+
chrome: 30,
|
|
895
|
+
backdrop: 40,
|
|
896
|
+
overlay: 50,
|
|
897
|
+
};
|
|
898
|
+
const zValue = (b) => exports.zBandTable[b];
|
|
899
|
+
exports.zValue = zValue;
|
|
900
|
+
|
|
901
|
+
},
|
|
902
|
+
"src/Style/model/appearance.ts": function (module, exports, require) {
|
|
903
|
+
"use strict";
|
|
904
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
905
|
+
exports.decideScheme = exports.appearanceStorageKey = void 0;
|
|
906
|
+
const plgg_1 = require("plgg");
|
|
907
|
+
exports.appearanceStorageKey = "vp-appearance";
|
|
908
|
+
const decideScheme = (stored, prefersDark) => (0, plgg_1.matchOption)(() => (prefersDark ? "dark" : "light"), (value) => value === "dark"
|
|
909
|
+
? "dark"
|
|
910
|
+
: value === "light"
|
|
911
|
+
? "light"
|
|
912
|
+
: prefersDark
|
|
913
|
+
? "dark"
|
|
914
|
+
: "light")(stored);
|
|
915
|
+
exports.decideScheme = decideScheme;
|
|
916
|
+
|
|
917
|
+
},
|
|
918
|
+
"src/Style/model/breakpoint.ts": function (module, exports, require) {
|
|
919
|
+
"use strict";
|
|
920
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
921
|
+
exports.maxWidth = exports.minWidth = exports.breakpointPx = exports.breakpoints = void 0;
|
|
922
|
+
exports.breakpoints = ["sm", "snap", "lg"];
|
|
923
|
+
const WIDTH = {
|
|
924
|
+
sm: 640,
|
|
925
|
+
snap: 900,
|
|
926
|
+
lg: 1024,
|
|
927
|
+
};
|
|
928
|
+
const breakpointPx = (b) => WIDTH[b];
|
|
929
|
+
exports.breakpointPx = breakpointPx;
|
|
930
|
+
const minWidth = (b) => `(min-width:${WIDTH[b]}px)`;
|
|
931
|
+
exports.minWidth = minWidth;
|
|
932
|
+
const maxWidth = (b) => `(max-width:${WIDTH[b] - 1}px)`;
|
|
933
|
+
exports.maxWidth = maxWidth;
|
|
934
|
+
|
|
935
|
+
},
|
|
936
|
+
"src/Style/usecase/appearanceScript.ts": function (module, exports, require) {
|
|
937
|
+
"use strict";
|
|
938
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
939
|
+
exports.applyScheme = exports.injectAppearanceScript = exports.appearanceInitScript = void 0;
|
|
940
|
+
const appearance_1 = require("src/Style/model/appearance.ts");
|
|
941
|
+
exports.appearanceInitScript = `try{var k=localStorage.getItem(${JSON.stringify(appearance_1.appearanceStorageKey)});var d=k==="dark"||(k!=="light"&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches);if(d){document.documentElement.classList.add("dark");}}catch(e){}`;
|
|
942
|
+
const injectAppearanceScript = (html) => html.includes("</head>")
|
|
943
|
+
? html.replace("</head>", `<script>${exports.appearanceInitScript}</script></head>`)
|
|
944
|
+
: html;
|
|
945
|
+
exports.injectAppearanceScript = injectAppearanceScript;
|
|
946
|
+
const applyScheme = (scheme, root, storage) => {
|
|
947
|
+
if (scheme === "dark") {
|
|
948
|
+
root.classList.add("dark");
|
|
949
|
+
}
|
|
950
|
+
else {
|
|
951
|
+
root.classList.remove("dark");
|
|
952
|
+
}
|
|
953
|
+
try {
|
|
954
|
+
storage.setItem(appearance_1.appearanceStorageKey, scheme);
|
|
955
|
+
}
|
|
956
|
+
catch {
|
|
957
|
+
}
|
|
958
|
+
};
|
|
959
|
+
exports.applyScheme = applyScheme;
|
|
960
|
+
|
|
961
|
+
},
|
|
962
|
+
"src/Style/usecase/contrast.ts": function (module, exports, require) {
|
|
963
|
+
"use strict";
|
|
964
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
965
|
+
exports.contrastRatio = void 0;
|
|
966
|
+
const hexColor_1 = require("src/Style/model/hexColor.ts");
|
|
967
|
+
const channel = (b) => {
|
|
968
|
+
const s = b / 255;
|
|
969
|
+
return s <= 0.03928
|
|
970
|
+
? s / 12.92
|
|
971
|
+
: Math.pow((s + 0.055) / 1.055, 2.4);
|
|
972
|
+
};
|
|
973
|
+
const luminance = (h) => {
|
|
974
|
+
const r = parseInt(h.slice(1, 3), 16);
|
|
975
|
+
const g = parseInt(h.slice(3, 5), 16);
|
|
976
|
+
const b = parseInt(h.slice(5, 7), 16);
|
|
977
|
+
return (0.2126 * channel(r) +
|
|
978
|
+
0.7152 * channel(g) +
|
|
979
|
+
0.0722 * channel(b));
|
|
980
|
+
};
|
|
981
|
+
const contrastRatio = (a, b) => {
|
|
982
|
+
const la = luminance((0, hexColor_1.hex)(a)) + 0.05;
|
|
983
|
+
const lb = luminance((0, hexColor_1.hex)(b)) + 0.05;
|
|
984
|
+
return la > lb ? la / lb : lb / la;
|
|
985
|
+
};
|
|
986
|
+
exports.contrastRatio = contrastRatio;
|
|
987
|
+
|
|
988
|
+
},
|
|
989
|
+
"src/Style/usecase/utilities.ts": function (module, exports, require) {
|
|
990
|
+
"use strict";
|
|
991
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
992
|
+
exports.measure = exports.typeStyle = exports.zIndex = exports.weight = exports.lineHeight = exports.fluid = exports.basis = exports.outline = exports.borderColor = exports.border = exports.textColor = exports.color = exports.bg = void 0;
|
|
993
|
+
const style_1 = require("plgg-view/style");
|
|
994
|
+
const token_1 = require("src/Style/model/token.ts");
|
|
995
|
+
const typography_1 = require("src/Style/model/typography.ts");
|
|
996
|
+
const metric_1 = require("src/Style/model/metric.ts");
|
|
997
|
+
const zIndex_1 = require("src/Style/model/zIndex.ts");
|
|
998
|
+
const theme_1 = require("src/Style/model/theme.ts");
|
|
999
|
+
const cvar = (0, token_1.colorVar)(theme_1.defaultTheme);
|
|
1000
|
+
const mvar = (0, metric_1.metricVar)(theme_1.defaultTheme);
|
|
1001
|
+
const bg = (c) => (0, style_1.decl)("background-color", cvar(c));
|
|
1002
|
+
exports.bg = bg;
|
|
1003
|
+
const color = (c) => (0, style_1.decl)("color", cvar(c));
|
|
1004
|
+
exports.color = color;
|
|
1005
|
+
exports.textColor = exports.color;
|
|
1006
|
+
exports.border = [
|
|
1007
|
+
...(0, style_1.decl)("border-width", "1px"),
|
|
1008
|
+
...(0, style_1.decl)("border-style", "solid"),
|
|
1009
|
+
...(0, style_1.decl)("border-color", cvar("border")),
|
|
1010
|
+
];
|
|
1011
|
+
const borderColor = (c) => (0, style_1.decl)("border-color", cvar(c));
|
|
1012
|
+
exports.borderColor = borderColor;
|
|
1013
|
+
const outline = (c) => (0, style_1.decl)("outline", `2px solid ${cvar(c)}`);
|
|
1014
|
+
exports.outline = outline;
|
|
1015
|
+
const basis = (w) => [
|
|
1016
|
+
...(0, style_1.decl)("flex", `0 0 ${w}`),
|
|
1017
|
+
...(0, style_1.decl)("width", w),
|
|
1018
|
+
];
|
|
1019
|
+
exports.basis = basis;
|
|
1020
|
+
exports.fluid = [
|
|
1021
|
+
...(0, style_1.decl)("flex", "1 1 auto"),
|
|
1022
|
+
...(0, style_1.decl)("min-width", "0"),
|
|
1023
|
+
];
|
|
1024
|
+
const lineHeight = (lh) => (0, style_1.decl)("line-height", lh);
|
|
1025
|
+
exports.lineHeight = lineHeight;
|
|
1026
|
+
const weight = (w) => (0, style_1.decl)("font-weight", `${w}`);
|
|
1027
|
+
exports.weight = weight;
|
|
1028
|
+
const zIndex = (b) => (0, style_1.decl)("z-index", `${(0, zIndex_1.zValue)(b)}`);
|
|
1029
|
+
exports.zIndex = zIndex;
|
|
1030
|
+
const typeStyle = (role) => [
|
|
1031
|
+
...(0, style_1.decl)("font-size", typography_1.typeScale[role].size),
|
|
1032
|
+
...(0, exports.lineHeight)(typography_1.typeScale[role].lineHeight),
|
|
1033
|
+
...(0, exports.weight)(typography_1.typeScale[role].weight),
|
|
1034
|
+
];
|
|
1035
|
+
exports.typeStyle = typeStyle;
|
|
1036
|
+
exports.measure = (0, style_1.decl)("max-width", mvar("measure"));
|
|
1037
|
+
|
|
1038
|
+
},
|
|
1039
|
+
"src/Style/usecase/schemeCss.ts": function (module, exports, require) {
|
|
1040
|
+
"use strict";
|
|
1041
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1042
|
+
exports.schemeCssOf = exports.schemeCss = void 0;
|
|
1043
|
+
const token_1 = require("src/Style/model/token.ts");
|
|
1044
|
+
const palette_1 = require("src/Style/model/palette.ts");
|
|
1045
|
+
const theme_1 = require("src/Style/model/theme.ts");
|
|
1046
|
+
const varsFor = (palette, scheme, prefix) => token_1.colors
|
|
1047
|
+
.map((c) => `--${prefix}-${c}:${(0, palette_1.hex)((0, palette_1.paletteHex)(palette, scheme, c))};`)
|
|
1048
|
+
.join("");
|
|
1049
|
+
const schemeCss = (theme) => `:root{${varsFor(theme.palette, "light", theme.prefix)}}html.dark{${varsFor(theme.palette, "dark", theme.prefix)}}`;
|
|
1050
|
+
exports.schemeCss = schemeCss;
|
|
1051
|
+
const schemeCssOf = (palette) => (0, exports.schemeCss)({ ...theme_1.defaultTheme, palette });
|
|
1052
|
+
exports.schemeCssOf = schemeCssOf;
|
|
1053
|
+
|
|
1054
|
+
},
|
|
1055
|
+
"src/Style/usecase/chromeCss.ts": function (module, exports, require) {
|
|
1056
|
+
"use strict";
|
|
1057
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1058
|
+
exports.chromeCss = void 0;
|
|
1059
|
+
const token_1 = require("src/Style/model/token.ts");
|
|
1060
|
+
const metric_1 = require("src/Style/model/metric.ts");
|
|
1061
|
+
const zIndex_1 = require("src/Style/model/zIndex.ts");
|
|
1062
|
+
const breakpoint_1 = require("src/Style/model/breakpoint.ts");
|
|
1063
|
+
const chromeCss = (theme) => {
|
|
1064
|
+
const p = theme.prefix;
|
|
1065
|
+
const cvar = (0, token_1.colorVar)(theme);
|
|
1066
|
+
const mvar = (0, metric_1.metricVar)(theme);
|
|
1067
|
+
return (`.${p}-row{background:${cvar("surface-2")};}` +
|
|
1068
|
+
`.${p}-col{background:${cvar("surface")};border-right:1px solid ${cvar("border")};}` +
|
|
1069
|
+
`.${p}-colhead{position:sticky;top:0;z-index:${(0, zIndex_1.zValue)("content")};display:flex;align-items:center;justify-content:space-between;gap:0.5rem;height:40px;padding:0 0.75rem;background:${cvar("surface-2")};border-bottom:1px solid ${cvar("border")};}` +
|
|
1070
|
+
`.${p}-colhead-title{font-size:0.85rem;font-weight:600;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;text-decoration:none;color:inherit;}` +
|
|
1071
|
+
`.${p}-colhead-link{margin-left:auto;color:${cvar("primary-base")};text-decoration:none;line-height:1;padding:0.35rem 0.55rem;border:1px solid ${cvar("border")};border-radius:0.375rem;background:${cvar("surface")};font-size:0.8rem;font-weight:600;white-space:nowrap;}` +
|
|
1072
|
+
`.${p}-colhead-link:hover{background:${cvar("primary-base")};border-color:${cvar("primary-base")};color:${cvar("surface")};}` +
|
|
1073
|
+
`.${p}-close{color:${cvar("muted")};text-decoration:none;line-height:1;padding:0.25rem 0.4rem;border-radius:0.25rem;}` +
|
|
1074
|
+
`.${p}-close:hover{background:${cvar("primary-base")};color:${cvar("surface")};}` +
|
|
1075
|
+
`.${p}-crumbs{display:flex;align-items:center;gap:0.4rem;min-width:0;overflow:hidden;white-space:nowrap;font-size:0.85rem;color:${cvar("muted")};}` +
|
|
1076
|
+
`.${p}-crumbs a{color:${cvar("muted")};text-decoration:none;padding:0.15rem 0.4rem;border-radius:0.25rem;}` +
|
|
1077
|
+
`.${p}-crumbs a:hover{background:${cvar("primary-base")};color:${cvar("surface")};}` +
|
|
1078
|
+
`.${p}-crumb-here{color:${cvar("text")};font-weight:500;overflow:hidden;text-overflow:ellipsis;}` +
|
|
1079
|
+
`.${p}-crumb-sep{color:${cvar("border")};}` +
|
|
1080
|
+
`.${p}-list{list-style:none;margin:0.75rem;padding:0.4rem;border:1px solid ${cvar("border")};border-radius:0.5rem;background:${cvar("surface-2")};}` +
|
|
1081
|
+
`.${p}-list-item{margin:0;}` +
|
|
1082
|
+
`.${p}-list-item+.${p}-list-item{margin-top:0.35rem;}` +
|
|
1083
|
+
`.${p}-row-link{display:block;color:${cvar("text")};text-decoration:none;padding:0.45rem 0.55rem;border:1px solid ${cvar("border")};border-radius:0.375rem;background:${cvar("surface")};}` +
|
|
1084
|
+
`.${p}-row-link:hover{border-color:${cvar("primary-base")};}` +
|
|
1085
|
+
`.${p}-pane a[aria-current="page"]{background:${cvar("primary-base")};color:${cvar("surface")};}` +
|
|
1086
|
+
`@media ${(0, breakpoint_1.minWidth)("snap")}{.${p}-row{height:calc(100vh - ${mvar("rail")});overflow:hidden;}.${p}-col{height:calc(100vh - ${mvar("rail")});overflow-y:auto;}}` +
|
|
1087
|
+
`@media ${(0, breakpoint_1.maxWidth)("snap")}{.${p}-row{overflow-x:auto;overscroll-behavior-x:contain;scroll-snap-type:x mandatory;}.${p}-col{scroll-snap-align:start;scroll-snap-stop:always;}.${p}-row::after{content:"";flex:0 0 100vw;}}`);
|
|
1088
|
+
};
|
|
1089
|
+
exports.chromeCss = chromeCss;
|
|
1090
|
+
|
|
1091
|
+
},
|
|
1092
|
+
"src/Style/usecase/metricCss.ts": function (module, exports, require) {
|
|
1093
|
+
"use strict";
|
|
1094
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1095
|
+
exports.metricCss = void 0;
|
|
1096
|
+
const metric_1 = require("src/Style/model/metric.ts");
|
|
1097
|
+
const metricCss = (theme) => `:root{${metric_1.metrics
|
|
1098
|
+
.map((m) => `--${theme.prefix}-${m}:${theme.metrics[m]};`)
|
|
1099
|
+
.join("")}}`;
|
|
1100
|
+
exports.metricCss = metricCss;
|
|
1101
|
+
|
|
1102
|
+
},
|
|
1103
|
+
"src/Style/usecase/reducedMotion.ts": function (module, exports, require) {
|
|
1104
|
+
"use strict";
|
|
1105
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1106
|
+
exports.reducedMotionCss = void 0;
|
|
1107
|
+
exports.reducedMotionCss = `@media (prefers-reduced-motion:reduce){html{scroll-behavior:auto}main{scroll-behavior:auto}}`;
|
|
1108
|
+
|
|
1109
|
+
},
|
|
1110
|
+
"src/Style/usecase/syntaxCss.ts": function (module, exports, require) {
|
|
1111
|
+
"use strict";
|
|
1112
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1113
|
+
exports.syntaxCss = void 0;
|
|
1114
|
+
const hexColor_1 = require("src/Style/model/hexColor.ts");
|
|
1115
|
+
const syntax_1 = require("src/Style/model/syntax.ts");
|
|
1116
|
+
const varsFor = (theme, scheme) => syntax_1.syntaxKinds
|
|
1117
|
+
.map((k) => `--${theme.prefix}-code-${k}:${(0, hexColor_1.hex)(theme.syntax[scheme][k])};`)
|
|
1118
|
+
.join("");
|
|
1119
|
+
const rulesFor = (theme) => syntax_1.syntaxKinds
|
|
1120
|
+
.map((k) => k === "comment"
|
|
1121
|
+
? `.tok-${k}{color:${(0, syntax_1.syntaxVar)(theme)(k)};font-style:italic}`
|
|
1122
|
+
: `.tok-${k}{color:${(0, syntax_1.syntaxVar)(theme)(k)}}`)
|
|
1123
|
+
.join("");
|
|
1124
|
+
const syntaxCss = (theme) => `:root{${varsFor(theme, "light")}}html.dark{${varsFor(theme, "dark")}}` +
|
|
1125
|
+
rulesFor(theme);
|
|
1126
|
+
exports.syntaxCss = syntaxCss;
|
|
1127
|
+
|
|
1128
|
+
},
|
|
1129
|
+
"src/Component/model/interaction.ts": function (module, exports, require) {
|
|
1130
|
+
"use strict";
|
|
1131
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1132
|
+
exports.pressDim = exports.hoverDim = exports.focusRing = void 0;
|
|
1133
|
+
const Style_1 = require("src/Style/index.ts");
|
|
1134
|
+
const style_1 = require("plgg-view/style");
|
|
1135
|
+
exports.focusRing = {
|
|
1136
|
+
selector: ":focus-visible",
|
|
1137
|
+
styles: [
|
|
1138
|
+
...(0, Style_1.outline)("primary-base"),
|
|
1139
|
+
...(0, style_1.decl)("outline-offset", "2px"),
|
|
1140
|
+
],
|
|
1141
|
+
};
|
|
1142
|
+
exports.hoverDim = {
|
|
1143
|
+
selector: ":hover",
|
|
1144
|
+
styles: (0, style_1.decl)("opacity", "0.9"),
|
|
1145
|
+
};
|
|
1146
|
+
exports.pressDim = {
|
|
1147
|
+
selector: ":active",
|
|
1148
|
+
styles: (0, style_1.decl)("opacity", "0.8"),
|
|
1149
|
+
};
|
|
1150
|
+
|
|
1151
|
+
},
|
|
1152
|
+
"src/brand.ts": function (module, exports, require) {
|
|
1153
|
+
"use strict";
|
|
1154
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1155
|
+
exports.pragmaticThemeWithPalette = exports.pragmaticTheme = void 0;
|
|
1156
|
+
const Style_1 = require("src/Style/index.ts");
|
|
1157
|
+
const plgg_1 = require("plgg");
|
|
1158
|
+
exports.pragmaticTheme = Style_1.defaultTheme;
|
|
1159
|
+
const pragmaticThemeWithPalette = (paletteInput) => (0, plgg_1.matchResult)((e) => (0, plgg_1.err)(e), (palette) => (0, plgg_1.ok)({ ...exports.pragmaticTheme, palette }))((0, Style_1.asPalette)(paletteInput));
|
|
1160
|
+
exports.pragmaticThemeWithPalette = pragmaticThemeWithPalette;
|
|
1161
|
+
|
|
1162
|
+
},
|
|
1163
|
+
"src/Component/index.ts": function (module, exports, require) {
|
|
1164
|
+
"use strict";
|
|
1165
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1166
|
+
exports.toaster = exports.toast = exports.tones = exports.confirmDialog = exports.checkbox = exports.selectInput = exports.textArea = exports.textInput = exports.breadcrumb = exports.colHead = exports.navTree = exports.themeToggleCss = exports.themeToggleClass = exports.staticThemeToggle = exports.themeToggle = exports.prose = exports.heading = exports.textLink = exports.button = exports.pressDim = exports.hoverDim = exports.focusRing = void 0;
|
|
1167
|
+
var interaction_1 = require("src/Component/model/interaction.ts");
|
|
1168
|
+
Object.defineProperty(exports, "focusRing", { enumerable: true, get: function () { return interaction_1.focusRing; } });
|
|
1169
|
+
Object.defineProperty(exports, "hoverDim", { enumerable: true, get: function () { return interaction_1.hoverDim; } });
|
|
1170
|
+
Object.defineProperty(exports, "pressDim", { enumerable: true, get: function () { return interaction_1.pressDim; } });
|
|
1171
|
+
var button_1 = require("src/Component/usecase/button.ts");
|
|
1172
|
+
Object.defineProperty(exports, "button", { enumerable: true, get: function () { return button_1.button; } });
|
|
1173
|
+
var textLink_1 = require("src/Component/usecase/textLink.ts");
|
|
1174
|
+
Object.defineProperty(exports, "textLink", { enumerable: true, get: function () { return textLink_1.textLink; } });
|
|
1175
|
+
var typography_1 = require("src/Component/usecase/typography.ts");
|
|
1176
|
+
Object.defineProperty(exports, "heading", { enumerable: true, get: function () { return typography_1.heading; } });
|
|
1177
|
+
Object.defineProperty(exports, "prose", { enumerable: true, get: function () { return typography_1.prose; } });
|
|
1178
|
+
var themeToggle_1 = require("src/Component/usecase/themeToggle.ts");
|
|
1179
|
+
Object.defineProperty(exports, "themeToggle", { enumerable: true, get: function () { return themeToggle_1.themeToggle; } });
|
|
1180
|
+
Object.defineProperty(exports, "staticThemeToggle", { enumerable: true, get: function () { return themeToggle_1.staticThemeToggle; } });
|
|
1181
|
+
Object.defineProperty(exports, "themeToggleClass", { enumerable: true, get: function () { return themeToggle_1.themeToggleClass; } });
|
|
1182
|
+
Object.defineProperty(exports, "themeToggleCss", { enumerable: true, get: function () { return themeToggle_1.themeToggleCss; } });
|
|
1183
|
+
var navTree_1 = require("src/Component/usecase/navTree.ts");
|
|
1184
|
+
Object.defineProperty(exports, "navTree", { enumerable: true, get: function () { return navTree_1.navTree; } });
|
|
1185
|
+
var colHead_1 = require("src/Component/usecase/colHead.ts");
|
|
1186
|
+
Object.defineProperty(exports, "colHead", { enumerable: true, get: function () { return colHead_1.colHead; } });
|
|
1187
|
+
var breadcrumb_1 = require("src/Component/usecase/breadcrumb.ts");
|
|
1188
|
+
Object.defineProperty(exports, "breadcrumb", { enumerable: true, get: function () { return breadcrumb_1.breadcrumb; } });
|
|
1189
|
+
var textInput_1 = require("src/Component/usecase/textInput.ts");
|
|
1190
|
+
Object.defineProperty(exports, "textInput", { enumerable: true, get: function () { return textInput_1.textInput; } });
|
|
1191
|
+
var textArea_1 = require("src/Component/usecase/textArea.ts");
|
|
1192
|
+
Object.defineProperty(exports, "textArea", { enumerable: true, get: function () { return textArea_1.textArea; } });
|
|
1193
|
+
var selectInput_1 = require("src/Component/usecase/selectInput.ts");
|
|
1194
|
+
Object.defineProperty(exports, "selectInput", { enumerable: true, get: function () { return selectInput_1.selectInput; } });
|
|
1195
|
+
var checkbox_1 = require("src/Component/usecase/checkbox.ts");
|
|
1196
|
+
Object.defineProperty(exports, "checkbox", { enumerable: true, get: function () { return checkbox_1.checkbox; } });
|
|
1197
|
+
var confirmDialog_1 = require("src/Component/usecase/confirmDialog.ts");
|
|
1198
|
+
Object.defineProperty(exports, "confirmDialog", { enumerable: true, get: function () { return confirmDialog_1.confirmDialog; } });
|
|
1199
|
+
var toast_1 = require("src/Component/usecase/toast.ts");
|
|
1200
|
+
Object.defineProperty(exports, "tones", { enumerable: true, get: function () { return toast_1.tones; } });
|
|
1201
|
+
Object.defineProperty(exports, "toast", { enumerable: true, get: function () { return toast_1.toast; } });
|
|
1202
|
+
Object.defineProperty(exports, "toaster", { enumerable: true, get: function () { return toast_1.toaster; } });
|
|
1203
|
+
|
|
1204
|
+
},
|
|
1205
|
+
"src/Component/usecase/button.ts": function (module, exports, require) {
|
|
1206
|
+
"use strict";
|
|
1207
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1208
|
+
exports.button = void 0;
|
|
1209
|
+
const plgg_view_1 = require("plgg-view");
|
|
1210
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1211
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1212
|
+
const button = (props) => (0, plgg_view_1.button)([
|
|
1213
|
+
(0, plgg_view_1.type_)("button"),
|
|
1214
|
+
...(props.disabled
|
|
1215
|
+
? [(0, plgg_view_1.attr)("disabled", "")]
|
|
1216
|
+
: [(0, plgg_view_1.onClick)(props.onPress)]),
|
|
1217
|
+
(0, styleEntry_1.style_)((0, styleEntry_1.bg)("primary-base"), (0, styleEntry_1.textColor)("surface"), (0, styleEntry_1.px)(4), (0, styleEntry_1.py)(2), (0, styleEntry_1.rounded)("md"), (0, styleEntry_1.weight)(styleEntry_1.medium), interaction_1.focusRing, ...(props.disabled
|
|
1218
|
+
? [
|
|
1219
|
+
(0, styleEntry_1.decl)("cursor", "not-allowed"),
|
|
1220
|
+
(0, styleEntry_1.decl)("opacity", "0.6"),
|
|
1221
|
+
]
|
|
1222
|
+
: [styleEntry_1.pointer, interaction_1.hoverDim, interaction_1.pressDim])),
|
|
1223
|
+
], [(0, plgg_view_1.text)(props.label)]);
|
|
1224
|
+
exports.button = button;
|
|
1225
|
+
|
|
1226
|
+
},
|
|
1227
|
+
"src/Component/usecase/textLink.ts": function (module, exports, require) {
|
|
1228
|
+
"use strict";
|
|
1229
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1230
|
+
exports.textLink = void 0;
|
|
1231
|
+
const plgg_view_1 = require("plgg-view");
|
|
1232
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1233
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1234
|
+
const textLink = (props) => (0, plgg_view_1.a)([
|
|
1235
|
+
(0, plgg_view_1.href)(props.to),
|
|
1236
|
+
...(props.external
|
|
1237
|
+
? [
|
|
1238
|
+
(0, plgg_view_1.attr)("target", "_blank"),
|
|
1239
|
+
(0, plgg_view_1.attr)("rel", "noopener noreferrer"),
|
|
1240
|
+
(0, plgg_view_1.attr)("aria-label", `${props.label} (opens in a new tab)`),
|
|
1241
|
+
]
|
|
1242
|
+
: []),
|
|
1243
|
+
(0, styleEntry_1.style_)((0, styleEntry_1.textColor)("primary-text"), (0, styleEntry_1.decl)("text-decoration", "underline"), interaction_1.focusRing, interaction_1.hoverDim),
|
|
1244
|
+
], [
|
|
1245
|
+
(0, plgg_view_1.text)(props.external
|
|
1246
|
+
? `${props.label} ↗`
|
|
1247
|
+
: props.label),
|
|
1248
|
+
]);
|
|
1249
|
+
exports.textLink = textLink;
|
|
1250
|
+
|
|
1251
|
+
},
|
|
1252
|
+
"src/Component/usecase/typography.ts": function (module, exports, require) {
|
|
1253
|
+
"use strict";
|
|
1254
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1255
|
+
exports.prose = exports.heading = void 0;
|
|
1256
|
+
const plgg_view_1 = require("plgg-view");
|
|
1257
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1258
|
+
const levelEl = (level) => {
|
|
1259
|
+
switch (level) {
|
|
1260
|
+
case 1:
|
|
1261
|
+
return plgg_view_1.h1;
|
|
1262
|
+
case 2:
|
|
1263
|
+
return plgg_view_1.h2;
|
|
1264
|
+
case 3:
|
|
1265
|
+
return plgg_view_1.h3;
|
|
1266
|
+
case 4:
|
|
1267
|
+
return plgg_view_1.h4;
|
|
1268
|
+
}
|
|
1269
|
+
};
|
|
1270
|
+
const LEVEL_ROLE = {
|
|
1271
|
+
1: "h1",
|
|
1272
|
+
2: "h2",
|
|
1273
|
+
3: "h3",
|
|
1274
|
+
4: "h4",
|
|
1275
|
+
};
|
|
1276
|
+
const heading = (level, content) => levelEl(level)([
|
|
1277
|
+
(0, styleEntry_1.style_)((0, styleEntry_1.typeStyle)(LEVEL_ROLE[level]), (0, styleEntry_1.textColor)("text")),
|
|
1278
|
+
], [(0, plgg_view_1.text)(content)]);
|
|
1279
|
+
exports.heading = heading;
|
|
1280
|
+
const prose = (body) => (0, plgg_view_1.div)([
|
|
1281
|
+
(0, styleEntry_1.style_)((0, styleEntry_1.textColor)("text"), (0, styleEntry_1.typeStyle)("body"), styleEntry_1.measure),
|
|
1282
|
+
], body);
|
|
1283
|
+
exports.prose = prose;
|
|
1284
|
+
|
|
1285
|
+
},
|
|
1286
|
+
"src/Component/usecase/navTree.ts": function (module, exports, require) {
|
|
1287
|
+
"use strict";
|
|
1288
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1289
|
+
exports.navTree = void 0;
|
|
1290
|
+
const plgg_1 = require("plgg");
|
|
1291
|
+
const plgg_view_1 = require("plgg-view");
|
|
1292
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1293
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1294
|
+
const navTree = (items, activePath) => {
|
|
1295
|
+
const label = (item) => (0, plgg_1.matchOption)(() => (0, plgg_view_1.span)([(0, styleEntry_1.style_)((0, styleEntry_1.textColor)("muted"))], [(0, plgg_view_1.text)(item.label)]), (to) => (0, plgg_view_1.a)([
|
|
1296
|
+
(0, plgg_view_1.href)(to),
|
|
1297
|
+
...(to === activePath
|
|
1298
|
+
? [(0, plgg_view_1.attr)("aria-current", "page")]
|
|
1299
|
+
: []),
|
|
1300
|
+
(0, styleEntry_1.style_)((0, styleEntry_1.textColor)("text"), interaction_1.focusRing, interaction_1.hoverDim),
|
|
1301
|
+
], [(0, plgg_view_1.text)(item.label)]))(item.href);
|
|
1302
|
+
const renderItem = (item) => (0, plgg_view_1.li)([], item.children.length === 0
|
|
1303
|
+
? [label(item)]
|
|
1304
|
+
: [label(item), list(item.children)]);
|
|
1305
|
+
const list = (nodes) => (0, plgg_view_1.ul)([(0, styleEntry_1.style_)(styleEntry_1.listNone, (0, styleEntry_1.p)(0), (0, styleEntry_1.pl)(3))], nodes.map(renderItem));
|
|
1306
|
+
return list(items);
|
|
1307
|
+
};
|
|
1308
|
+
exports.navTree = navTree;
|
|
1309
|
+
|
|
1310
|
+
},
|
|
1311
|
+
"src/Component/usecase/colHead.ts": function (module, exports, require) {
|
|
1312
|
+
"use strict";
|
|
1313
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1314
|
+
exports.colHead = void 0;
|
|
1315
|
+
const plgg_1 = require("plgg");
|
|
1316
|
+
const plgg_view_1 = require("plgg-view");
|
|
1317
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1318
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1319
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1320
|
+
const colHead = (props) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-colhead`)], [
|
|
1321
|
+
(0, plgg_1.matchOption)(() => (0, plgg_view_1.span)([
|
|
1322
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-colhead-title`),
|
|
1323
|
+
], [(0, plgg_view_1.text)(props.title)]), (to) => (0, plgg_view_1.a)([
|
|
1324
|
+
(0, plgg_view_1.href)(to),
|
|
1325
|
+
(0, plgg_view_1.attr)("aria-label", `Reset to ${props.title}`),
|
|
1326
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-colhead-title`, interaction_1.focusRing),
|
|
1327
|
+
], [(0, plgg_view_1.text)(props.title)]))(props.close),
|
|
1328
|
+
...props.links.map((link) => (0, plgg_view_1.a)([
|
|
1329
|
+
(0, plgg_view_1.href)(link.href),
|
|
1330
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-colhead-link`, interaction_1.focusRing),
|
|
1331
|
+
], [(0, plgg_view_1.text)(link.label)])),
|
|
1332
|
+
]);
|
|
1333
|
+
exports.colHead = colHead;
|
|
1334
|
+
|
|
1335
|
+
},
|
|
1336
|
+
"src/Component/usecase/breadcrumb.ts": function (module, exports, require) {
|
|
1337
|
+
"use strict";
|
|
1338
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1339
|
+
exports.breadcrumb = void 0;
|
|
1340
|
+
const plgg_1 = require("plgg");
|
|
1341
|
+
const plgg_view_1 = require("plgg-view");
|
|
1342
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1343
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1344
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1345
|
+
const breadcrumb = (crumbs) => {
|
|
1346
|
+
const last = crumbs.length - 1;
|
|
1347
|
+
return (0, plgg_view_1.slot)([
|
|
1348
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-crumbs`),
|
|
1349
|
+
(0, plgg_view_1.attr)("aria-label", "Breadcrumb"),
|
|
1350
|
+
], crumbs.flatMap((crumb, i) => {
|
|
1351
|
+
const label = i === last
|
|
1352
|
+
? (0, plgg_view_1.span)([
|
|
1353
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-crumb-here`),
|
|
1354
|
+
], [(0, plgg_view_1.text)(crumb.label)])
|
|
1355
|
+
: (0, plgg_1.matchOption)(() => (0, plgg_view_1.span)([], [(0, plgg_view_1.text)(crumb.label)]), (to) => (0, plgg_view_1.a)([
|
|
1356
|
+
(0, plgg_view_1.href)(to),
|
|
1357
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-crumb-link`, interaction_1.focusRing),
|
|
1358
|
+
], [(0, plgg_view_1.text)(crumb.label)]))(crumb.to);
|
|
1359
|
+
return i === 0
|
|
1360
|
+
? [label]
|
|
1361
|
+
: [
|
|
1362
|
+
(0, plgg_view_1.span)([
|
|
1363
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-crumb-sep`),
|
|
1364
|
+
(0, plgg_view_1.attr)("aria-hidden", "true"),
|
|
1365
|
+
], [(0, plgg_view_1.text)("›")]),
|
|
1366
|
+
label,
|
|
1367
|
+
];
|
|
1368
|
+
}));
|
|
1369
|
+
};
|
|
1370
|
+
exports.breadcrumb = breadcrumb;
|
|
1371
|
+
|
|
1372
|
+
},
|
|
1373
|
+
"src/Component/usecase/textInput.ts": function (module, exports, require) {
|
|
1374
|
+
"use strict";
|
|
1375
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1376
|
+
exports.textInput = void 0;
|
|
1377
|
+
const plgg_1 = require("plgg");
|
|
1378
|
+
const plgg_view_1 = require("plgg-view");
|
|
1379
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1380
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1381
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1382
|
+
const controlParts_1 = require("src/Form/usecase/controlParts.ts");
|
|
1383
|
+
const textInput = (props) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field`)], [
|
|
1384
|
+
(0, controlParts_1.fieldLabel)(props.name, props.label),
|
|
1385
|
+
(0, plgg_view_1.input)([
|
|
1386
|
+
(0, plgg_view_1.id_)(props.name),
|
|
1387
|
+
(0, plgg_view_1.name_)(props.name),
|
|
1388
|
+
(0, plgg_view_1.type_)("text"),
|
|
1389
|
+
(0, plgg_view_1.value_)(props.value),
|
|
1390
|
+
...(0, plgg_1.matchOption)(() => [], (p) => [(0, plgg_view_1.placeholder_)(p)])(props.placeholder),
|
|
1391
|
+
...(0, controlParts_1.errorAria)(props.name, props.error),
|
|
1392
|
+
...(0, plgg_view_1.disabled_)(props.disabled),
|
|
1393
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-input`, interaction_1.focusRing, ...(props.disabled
|
|
1394
|
+
? [`${identity_1.cssPrefix}-disabled`]
|
|
1395
|
+
: [interaction_1.hoverDim])),
|
|
1396
|
+
(0, plgg_view_1.onInput)(props.onInput),
|
|
1397
|
+
], []),
|
|
1398
|
+
...(0, controlParts_1.fieldError)(props.name, props.error),
|
|
1399
|
+
]);
|
|
1400
|
+
exports.textInput = textInput;
|
|
1401
|
+
|
|
1402
|
+
},
|
|
1403
|
+
"src/Form/usecase/controlParts.ts": function (module, exports, require) {
|
|
1404
|
+
"use strict";
|
|
1405
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1406
|
+
exports.fieldError = exports.errorAria = exports.errorId = exports.fieldLabel = void 0;
|
|
1407
|
+
const plgg_1 = require("plgg");
|
|
1408
|
+
const plgg_view_1 = require("plgg-view");
|
|
1409
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1410
|
+
const fieldLabel = (name, labelText) => (0, plgg_view_1.label)([
|
|
1411
|
+
(0, plgg_view_1.for_)(name),
|
|
1412
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-label`),
|
|
1413
|
+
], [(0, plgg_view_1.text)(labelText)]);
|
|
1414
|
+
exports.fieldLabel = fieldLabel;
|
|
1415
|
+
const errorId = (name) => `${name}-error`;
|
|
1416
|
+
exports.errorId = errorId;
|
|
1417
|
+
const errorAria = (name, error) => (0, plgg_1.isSome)(error)
|
|
1418
|
+
? [
|
|
1419
|
+
(0, plgg_view_1.attr)("aria-invalid", "true"),
|
|
1420
|
+
(0, plgg_view_1.attr)("aria-describedby", (0, exports.errorId)(name)),
|
|
1421
|
+
]
|
|
1422
|
+
: [];
|
|
1423
|
+
exports.errorAria = errorAria;
|
|
1424
|
+
const fieldError = (name, error) => (0, plgg_1.matchOption)(() => [], (msg) => [
|
|
1425
|
+
(0, plgg_view_1.span)([
|
|
1426
|
+
(0, plgg_view_1.id_)((0, exports.errorId)(name)),
|
|
1427
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-error`),
|
|
1428
|
+
(0, plgg_view_1.attr)("role", "alert"),
|
|
1429
|
+
], [(0, plgg_view_1.text)(msg)]),
|
|
1430
|
+
])(error);
|
|
1431
|
+
exports.fieldError = fieldError;
|
|
1432
|
+
|
|
1433
|
+
},
|
|
1434
|
+
"src/Component/usecase/textArea.ts": function (module, exports, require) {
|
|
1435
|
+
"use strict";
|
|
1436
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1437
|
+
exports.textArea = void 0;
|
|
1438
|
+
const plgg_1 = require("plgg");
|
|
1439
|
+
const plgg_view_1 = require("plgg-view");
|
|
1440
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1441
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1442
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1443
|
+
const controlParts_1 = require("src/Form/usecase/controlParts.ts");
|
|
1444
|
+
const textArea = (props) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field`)], [
|
|
1445
|
+
(0, controlParts_1.fieldLabel)(props.name, props.label),
|
|
1446
|
+
(0, plgg_view_1.textarea)([
|
|
1447
|
+
(0, plgg_view_1.id_)(props.name),
|
|
1448
|
+
(0, plgg_view_1.name_)(props.name),
|
|
1449
|
+
(0, plgg_view_1.value_)(props.value),
|
|
1450
|
+
...(0, plgg_1.matchOption)(() => [], (p) => [(0, plgg_view_1.placeholder_)(p)])(props.placeholder),
|
|
1451
|
+
...(0, controlParts_1.errorAria)(props.name, props.error),
|
|
1452
|
+
...(0, plgg_view_1.disabled_)(props.disabled),
|
|
1453
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-input`, interaction_1.focusRing, ...(props.disabled
|
|
1454
|
+
? [`${identity_1.cssPrefix}-disabled`]
|
|
1455
|
+
: [interaction_1.hoverDim])),
|
|
1456
|
+
(0, plgg_view_1.onInput)(props.onInput),
|
|
1457
|
+
], [(0, plgg_view_1.text)(props.value)]),
|
|
1458
|
+
...(0, controlParts_1.fieldError)(props.name, props.error),
|
|
1459
|
+
]);
|
|
1460
|
+
exports.textArea = textArea;
|
|
1461
|
+
|
|
1462
|
+
},
|
|
1463
|
+
"src/Component/usecase/selectInput.ts": function (module, exports, require) {
|
|
1464
|
+
"use strict";
|
|
1465
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1466
|
+
exports.selectInput = void 0;
|
|
1467
|
+
const plgg_view_1 = require("plgg-view");
|
|
1468
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1469
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1470
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1471
|
+
const controlParts_1 = require("src/Form/usecase/controlParts.ts");
|
|
1472
|
+
const selectInput = (props) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field`)], [
|
|
1473
|
+
(0, controlParts_1.fieldLabel)(props.name, props.label),
|
|
1474
|
+
(0, plgg_view_1.select)([
|
|
1475
|
+
(0, plgg_view_1.id_)(props.name),
|
|
1476
|
+
(0, plgg_view_1.name_)(props.name),
|
|
1477
|
+
...(0, controlParts_1.errorAria)(props.name, props.error),
|
|
1478
|
+
...(0, plgg_view_1.disabled_)(props.disabled),
|
|
1479
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-input`, interaction_1.focusRing),
|
|
1480
|
+
(0, plgg_view_1.onChange)(props.onChange),
|
|
1481
|
+
], props.options.map((o) => (0, plgg_view_1.option)([
|
|
1482
|
+
(0, plgg_view_1.attr)("value", o.value),
|
|
1483
|
+
...(o.value === props.value
|
|
1484
|
+
? [(0, plgg_view_1.attr)("selected", "")]
|
|
1485
|
+
: []),
|
|
1486
|
+
], [(0, plgg_view_1.text)(o.label)]))),
|
|
1487
|
+
...(0, controlParts_1.fieldError)(props.name, props.error),
|
|
1488
|
+
]);
|
|
1489
|
+
exports.selectInput = selectInput;
|
|
1490
|
+
|
|
1491
|
+
},
|
|
1492
|
+
"src/Component/usecase/checkbox.ts": function (module, exports, require) {
|
|
1493
|
+
"use strict";
|
|
1494
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1495
|
+
exports.checkbox = void 0;
|
|
1496
|
+
const plgg_view_1 = require("plgg-view");
|
|
1497
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1498
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1499
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1500
|
+
const checkbox = (props) => (0, plgg_view_1.slot)([
|
|
1501
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field ${identity_1.cssPrefix}-check`),
|
|
1502
|
+
], [
|
|
1503
|
+
(0, plgg_view_1.input)([
|
|
1504
|
+
(0, plgg_view_1.id_)(props.name),
|
|
1505
|
+
(0, plgg_view_1.name_)(props.name),
|
|
1506
|
+
(0, plgg_view_1.type_)("checkbox"),
|
|
1507
|
+
...(0, plgg_view_1.checked_)(props.checked),
|
|
1508
|
+
...(0, plgg_view_1.disabled_)(props.disabled),
|
|
1509
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-checkbox`, interaction_1.focusRing, ...(props.disabled
|
|
1510
|
+
? [`${identity_1.cssPrefix}-disabled`]
|
|
1511
|
+
: [])),
|
|
1512
|
+
(0, plgg_view_1.onChange)(() => props.onToggle),
|
|
1513
|
+
], []),
|
|
1514
|
+
(0, plgg_view_1.label)([
|
|
1515
|
+
(0, plgg_view_1.for_)(props.name),
|
|
1516
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-check-label`),
|
|
1517
|
+
], [(0, plgg_view_1.text)(props.label)]),
|
|
1518
|
+
]);
|
|
1519
|
+
exports.checkbox = checkbox;
|
|
1520
|
+
|
|
1521
|
+
},
|
|
1522
|
+
"src/Component/usecase/confirmDialog.ts": function (module, exports, require) {
|
|
1523
|
+
"use strict";
|
|
1524
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1525
|
+
exports.confirmDialog = void 0;
|
|
1526
|
+
const plgg_view_1 = require("plgg-view");
|
|
1527
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1528
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1529
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1530
|
+
const TITLE_ID = `${identity_1.cssPrefix}-dialog-title`;
|
|
1531
|
+
const confirmDialog = (props) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-modal`)], [
|
|
1532
|
+
(0, plgg_view_1.slot)([
|
|
1533
|
+
(0, plgg_view_1.key)("backdrop"),
|
|
1534
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-backdrop`),
|
|
1535
|
+
(0, plgg_view_1.onClick)(props.onCancel),
|
|
1536
|
+
], []),
|
|
1537
|
+
(0, plgg_view_1.slot)([
|
|
1538
|
+
(0, plgg_view_1.key)("dialog"),
|
|
1539
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-dialog`),
|
|
1540
|
+
(0, plgg_view_1.attr)("role", "dialog"),
|
|
1541
|
+
(0, plgg_view_1.attr)("aria-modal", "true"),
|
|
1542
|
+
(0, plgg_view_1.attr)("aria-labelledby", TITLE_ID),
|
|
1543
|
+
], [
|
|
1544
|
+
(0, plgg_view_1.h2)([(0, plgg_view_1.id_)(TITLE_ID)], [(0, plgg_view_1.text)(props.title)]),
|
|
1545
|
+
(0, plgg_view_1.p)([], [(0, plgg_view_1.text)(props.body)]),
|
|
1546
|
+
(0, plgg_view_1.slot)([
|
|
1547
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-dialog-actions`),
|
|
1548
|
+
], [
|
|
1549
|
+
(0, plgg_view_1.button)([
|
|
1550
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-btn`, interaction_1.focusRing),
|
|
1551
|
+
(0, plgg_view_1.onClick)(props.onCancel),
|
|
1552
|
+
], [(0, plgg_view_1.text)(props.cancelLabel)]),
|
|
1553
|
+
(0, plgg_view_1.button)([
|
|
1554
|
+
(0, styleEntry_1.style_)(props.destructive
|
|
1555
|
+
? `${identity_1.cssPrefix}-btn ${identity_1.cssPrefix}-btn-danger`
|
|
1556
|
+
: `${identity_1.cssPrefix}-btn`, interaction_1.focusRing),
|
|
1557
|
+
(0, plgg_view_1.onClick)(props.onConfirm),
|
|
1558
|
+
], [(0, plgg_view_1.text)(props.confirmLabel)]),
|
|
1559
|
+
]),
|
|
1560
|
+
]),
|
|
1561
|
+
]);
|
|
1562
|
+
exports.confirmDialog = confirmDialog;
|
|
1563
|
+
|
|
1564
|
+
},
|
|
1565
|
+
"src/Component/usecase/toast.ts": function (module, exports, require) {
|
|
1566
|
+
"use strict";
|
|
1567
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1568
|
+
exports.toaster = exports.toast = exports.tones = void 0;
|
|
1569
|
+
const plgg_view_1 = require("plgg-view");
|
|
1570
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1571
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1572
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1573
|
+
exports.tones = [
|
|
1574
|
+
"success",
|
|
1575
|
+
"danger",
|
|
1576
|
+
"warning",
|
|
1577
|
+
"info",
|
|
1578
|
+
];
|
|
1579
|
+
const toast = (props) => (0, plgg_view_1.slot)([
|
|
1580
|
+
(0, plgg_view_1.key)(props.id),
|
|
1581
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-toast ${identity_1.cssPrefix}-toast-${props.tone}`),
|
|
1582
|
+
(0, plgg_view_1.attr)("role", "status"),
|
|
1583
|
+
(0, plgg_view_1.attr)("aria-live", props.tone === "danger"
|
|
1584
|
+
? "assertive"
|
|
1585
|
+
: "polite"),
|
|
1586
|
+
], [
|
|
1587
|
+
(0, plgg_view_1.span)([], [(0, plgg_view_1.text)(props.message)]),
|
|
1588
|
+
(0, plgg_view_1.button)([
|
|
1589
|
+
(0, plgg_view_1.attr)("aria-label", "Dismiss"),
|
|
1590
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-toast-close`, interaction_1.focusRing),
|
|
1591
|
+
(0, plgg_view_1.onClick)(props.onDismiss),
|
|
1592
|
+
], [(0, plgg_view_1.text)("×")]),
|
|
1593
|
+
]);
|
|
1594
|
+
exports.toast = toast;
|
|
1595
|
+
const toaster = (toasts) => (0, plgg_view_1.slot)([
|
|
1596
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-toaster`),
|
|
1597
|
+
(0, plgg_view_1.attr)("aria-live", "polite"),
|
|
1598
|
+
], toasts.map((t) => (0, exports.toast)(t)));
|
|
1599
|
+
exports.toaster = toaster;
|
|
1600
|
+
|
|
1601
|
+
},
|
|
1602
|
+
"src/Form/index.ts": function (module, exports, require) {
|
|
1603
|
+
"use strict";
|
|
1604
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1605
|
+
exports.formView = exports.errorFor = exports.parseForm = exports.isPending = exports.pendingSubmission = exports.idleSubmission = exports.controlKinds = void 0;
|
|
1606
|
+
var control_1 = require("src/Form/model/control.ts");
|
|
1607
|
+
Object.defineProperty(exports, "controlKinds", { enumerable: true, get: function () { return control_1.controlKinds; } });
|
|
1608
|
+
var submission_1 = require("src/Form/model/submission.ts");
|
|
1609
|
+
Object.defineProperty(exports, "idleSubmission", { enumerable: true, get: function () { return submission_1.idleSubmission; } });
|
|
1610
|
+
Object.defineProperty(exports, "pendingSubmission", { enumerable: true, get: function () { return submission_1.pendingSubmission; } });
|
|
1611
|
+
Object.defineProperty(exports, "isPending", { enumerable: true, get: function () { return submission_1.isPending; } });
|
|
1612
|
+
var parseForm_1 = require("src/Form/usecase/parseForm.ts");
|
|
1613
|
+
Object.defineProperty(exports, "parseForm", { enumerable: true, get: function () { return parseForm_1.parseForm; } });
|
|
1614
|
+
Object.defineProperty(exports, "errorFor", { enumerable: true, get: function () { return parseForm_1.errorFor; } });
|
|
1615
|
+
var formView_1 = require("src/Form/usecase/formView.ts");
|
|
1616
|
+
Object.defineProperty(exports, "formView", { enumerable: true, get: function () { return formView_1.formView; } });
|
|
1617
|
+
|
|
1618
|
+
},
|
|
1619
|
+
"src/Form/model/control.ts": function (module, exports, require) {
|
|
1620
|
+
"use strict";
|
|
1621
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1622
|
+
exports.controlKinds = void 0;
|
|
1623
|
+
exports.controlKinds = ["text", "textarea", "select", "checkbox"];
|
|
1624
|
+
|
|
1625
|
+
},
|
|
1626
|
+
"src/Form/model/submission.ts": function (module, exports, require) {
|
|
1627
|
+
"use strict";
|
|
1628
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1629
|
+
exports.isPending = exports.pendingSubmission$ = exports.idleSubmission$ = exports.pendingSubmission = exports.idleSubmission = void 0;
|
|
1630
|
+
const plgg_1 = require("plgg");
|
|
1631
|
+
const idleSubmission = () => (0, plgg_1.icon)("Idle");
|
|
1632
|
+
exports.idleSubmission = idleSubmission;
|
|
1633
|
+
const pendingSubmission = () => (0, plgg_1.icon)("Pending");
|
|
1634
|
+
exports.pendingSubmission = pendingSubmission;
|
|
1635
|
+
const idleSubmission$ = () => (0, plgg_1.pattern)("Idle")();
|
|
1636
|
+
exports.idleSubmission$ = idleSubmission$;
|
|
1637
|
+
const pendingSubmission$ = () => (0, plgg_1.pattern)("Pending")();
|
|
1638
|
+
exports.pendingSubmission$ = pendingSubmission$;
|
|
1639
|
+
const isPending = (s) => (0, plgg_1.match)(s)([(0, exports.idleSubmission$)(), () => false], [(0, exports.pendingSubmission$)(), () => true]);
|
|
1640
|
+
exports.isPending = isPending;
|
|
1641
|
+
|
|
1642
|
+
},
|
|
1643
|
+
"src/Form/usecase/parseForm.ts": function (module, exports, require) {
|
|
1644
|
+
"use strict";
|
|
1645
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1646
|
+
exports.errorFor = exports.parseForm = void 0;
|
|
1647
|
+
const plgg_1 = require("plgg");
|
|
1648
|
+
const parseForm = (specs, draftOf) => {
|
|
1649
|
+
const acc = specs.reduce((a, spec) => (0, plgg_1.matchResult)((e) => ({
|
|
1650
|
+
payload: a.payload,
|
|
1651
|
+
errors: [
|
|
1652
|
+
...a.errors,
|
|
1653
|
+
[spec.name, (0, plgg_1.plggErrorMessage)(e)],
|
|
1654
|
+
],
|
|
1655
|
+
}), (v) => ({
|
|
1656
|
+
payload: {
|
|
1657
|
+
...a.payload,
|
|
1658
|
+
[spec.name]: v,
|
|
1659
|
+
},
|
|
1660
|
+
errors: a.errors,
|
|
1661
|
+
}))(spec.cast(draftOf(spec.name))), { payload: {}, errors: [] });
|
|
1662
|
+
return acc.errors.length === 0
|
|
1663
|
+
? (0, plgg_1.ok)(acc.payload)
|
|
1664
|
+
: (0, plgg_1.err)(acc.errors);
|
|
1665
|
+
};
|
|
1666
|
+
exports.parseForm = parseForm;
|
|
1667
|
+
const errorFor = (errors, name) => (0, plgg_1.pipe)((0, plgg_1.fromNullable)(errors.find(([n]) => n === name)), (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), ([, msg]) => (0, plgg_1.some)(msg)));
|
|
1668
|
+
exports.errorFor = errorFor;
|
|
1669
|
+
|
|
1670
|
+
},
|
|
1671
|
+
"src/Form/usecase/formView.ts": function (module, exports, require) {
|
|
1672
|
+
"use strict";
|
|
1673
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1674
|
+
exports.formView = void 0;
|
|
1675
|
+
const plgg_view_1 = require("plgg-view");
|
|
1676
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1677
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1678
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1679
|
+
const formView = (props) => (0, plgg_view_1.form)([
|
|
1680
|
+
(0, plgg_view_1.onSubmit)(props.onSubmit),
|
|
1681
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-form`),
|
|
1682
|
+
], [
|
|
1683
|
+
...props.fields,
|
|
1684
|
+
(0, plgg_view_1.button)([
|
|
1685
|
+
(0, plgg_view_1.type_)("submit"),
|
|
1686
|
+
...(0, plgg_view_1.disabled_)(props.submitting),
|
|
1687
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-btn ${identity_1.cssPrefix}-btn-primary`, interaction_1.focusRing, ...(props.submitting
|
|
1688
|
+
? [`${identity_1.cssPrefix}-disabled`]
|
|
1689
|
+
: [interaction_1.hoverDim])),
|
|
1690
|
+
], [
|
|
1691
|
+
(0, plgg_view_1.text)(props.submitting
|
|
1692
|
+
? "Submitting…"
|
|
1693
|
+
: props.submitLabel),
|
|
1694
|
+
]),
|
|
1695
|
+
]);
|
|
1696
|
+
exports.formView = formView;
|
|
1697
|
+
|
|
1698
|
+
},
|
|
1699
|
+
"src/Render/index.ts": function (module, exports, require) {
|
|
1700
|
+
"use strict";
|
|
1701
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1702
|
+
exports.renderMode = exports.singleColumn = exports.crumbsOf = exports.multiColumnWith = exports.multiColumn = exports.currentScreen = exports.toggleMode = exports.modes = void 0;
|
|
1703
|
+
var mode_1 = require("src/Render/model/mode.ts");
|
|
1704
|
+
Object.defineProperty(exports, "modes", { enumerable: true, get: function () { return mode_1.modes; } });
|
|
1705
|
+
Object.defineProperty(exports, "toggleMode", { enumerable: true, get: function () { return mode_1.toggleMode; } });
|
|
1706
|
+
var screen_1 = require("src/Render/model/screen.ts");
|
|
1707
|
+
Object.defineProperty(exports, "currentScreen", { enumerable: true, get: function () { return screen_1.currentScreen; } });
|
|
1708
|
+
var multiColumn_1 = require("src/Render/usecase/multiColumn.ts");
|
|
1709
|
+
Object.defineProperty(exports, "multiColumn", { enumerable: true, get: function () { return multiColumn_1.multiColumn; } });
|
|
1710
|
+
Object.defineProperty(exports, "multiColumnWith", { enumerable: true, get: function () { return multiColumn_1.multiColumnWith; } });
|
|
1711
|
+
Object.defineProperty(exports, "crumbsOf", { enumerable: true, get: function () { return multiColumn_1.crumbsOf; } });
|
|
1712
|
+
var singleColumn_1 = require("src/Render/usecase/singleColumn.ts");
|
|
1713
|
+
Object.defineProperty(exports, "singleColumn", { enumerable: true, get: function () { return singleColumn_1.singleColumn; } });
|
|
1714
|
+
var renderMode_1 = require("src/Render/usecase/renderMode.ts");
|
|
1715
|
+
Object.defineProperty(exports, "renderMode", { enumerable: true, get: function () { return renderMode_1.renderMode; } });
|
|
1716
|
+
|
|
1717
|
+
},
|
|
1718
|
+
"src/Render/model/mode.ts": function (module, exports, require) {
|
|
1719
|
+
"use strict";
|
|
1720
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1721
|
+
exports.toggleMode = exports.modes = void 0;
|
|
1722
|
+
exports.modes = [
|
|
1723
|
+
"multiColumn",
|
|
1724
|
+
"singleColumn",
|
|
1725
|
+
];
|
|
1726
|
+
const toggleMode = (m) => m === "multiColumn"
|
|
1727
|
+
? "singleColumn"
|
|
1728
|
+
: "multiColumn";
|
|
1729
|
+
exports.toggleMode = toggleMode;
|
|
1730
|
+
|
|
1731
|
+
},
|
|
1732
|
+
"src/Render/model/screen.ts": function (module, exports, require) {
|
|
1733
|
+
"use strict";
|
|
1734
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1735
|
+
exports.currentScreen = void 0;
|
|
1736
|
+
const plgg_1 = require("plgg");
|
|
1737
|
+
const currentScreen = (scene) => (0, plgg_1.fromNullable)(scene.levels[scene.levels.length - 1]);
|
|
1738
|
+
exports.currentScreen = currentScreen;
|
|
1739
|
+
|
|
1740
|
+
},
|
|
1741
|
+
"src/Render/usecase/multiColumn.ts": function (module, exports, require) {
|
|
1742
|
+
"use strict";
|
|
1743
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1744
|
+
exports.crumbsOf = exports.multiColumnWith = exports.multiColumn = void 0;
|
|
1745
|
+
const plgg_1 = require("plgg");
|
|
1746
|
+
const plgg_view_1 = require("plgg-view");
|
|
1747
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1748
|
+
const combinators_1 = require("src/Layout/usecase/combinators.ts");
|
|
1749
|
+
const breadcrumb_1 = require("src/Component/usecase/breadcrumb.ts");
|
|
1750
|
+
const colHead_1 = require("src/Component/usecase/colHead.ts");
|
|
1751
|
+
const Scene_1 = require("src/Schedule/model/Scene.ts");
|
|
1752
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1753
|
+
const parts_1 = require("src/Render/usecase/parts.ts");
|
|
1754
|
+
const multiColumn = (scene) => (0, exports.multiColumnWith)(scene, {
|
|
1755
|
+
mapMsg: (msg) => msg,
|
|
1756
|
+
});
|
|
1757
|
+
exports.multiColumn = multiColumn;
|
|
1758
|
+
const multiColumnWith = (scene, options) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-scheduler`)], [
|
|
1759
|
+
...(options.omitBreadcrumb === true
|
|
1760
|
+
? []
|
|
1761
|
+
: [(0, breadcrumb_1.breadcrumb)((0, exports.crumbsOf)(scene))]),
|
|
1762
|
+
...(0, parts_1.confirmOverlay)(scene.confirm).map(mapScheduler(options)),
|
|
1763
|
+
(0, combinators_1.row)([], [
|
|
1764
|
+
...scene.levels
|
|
1765
|
+
.slice(0, 1)
|
|
1766
|
+
.map((level) => columnFor(level, options)),
|
|
1767
|
+
...(options.afterMenu ?? []).map(extraColumn),
|
|
1768
|
+
...scene.levels
|
|
1769
|
+
.slice(1)
|
|
1770
|
+
.map((level) => columnFor(level, options)),
|
|
1771
|
+
...(options.extraColumns ?? []).map(extraColumn),
|
|
1772
|
+
]),
|
|
1773
|
+
]);
|
|
1774
|
+
exports.multiColumnWith = multiColumnWith;
|
|
1775
|
+
const titleOf = (level) => (0, plgg_1.match)(level)([
|
|
1776
|
+
(0, Scene_1.menuLevel$)(),
|
|
1777
|
+
({ content }) => content.title,
|
|
1778
|
+
], [
|
|
1779
|
+
(0, Scene_1.listLevel$)(),
|
|
1780
|
+
({ content }) => content.title,
|
|
1781
|
+
], [
|
|
1782
|
+
(0, Scene_1.boardLevel$)(),
|
|
1783
|
+
({ content }) => content.title,
|
|
1784
|
+
], [
|
|
1785
|
+
(0, Scene_1.detailLevel$)(),
|
|
1786
|
+
({ content }) => content.title,
|
|
1787
|
+
]);
|
|
1788
|
+
const backOf = (level) => (0, plgg_1.match)(level)([(0, Scene_1.menuLevel$)(), () => (0, plgg_1.none)()], [
|
|
1789
|
+
(0, Scene_1.listLevel$)(),
|
|
1790
|
+
({ content }) => content.back,
|
|
1791
|
+
], [
|
|
1792
|
+
(0, Scene_1.boardLevel$)(),
|
|
1793
|
+
({ content }) => content.back,
|
|
1794
|
+
], [
|
|
1795
|
+
(0, Scene_1.detailLevel$)(),
|
|
1796
|
+
({ content }) => content.back,
|
|
1797
|
+
]);
|
|
1798
|
+
const crumbsOf = (scene) => scene.levels.map((level, i) => ({
|
|
1799
|
+
label: titleOf(level),
|
|
1800
|
+
to: (0, plgg_1.pipe)((0, plgg_1.fromNullable)(scene.levels[i + 1]), (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (next) => backOf(next))),
|
|
1801
|
+
}));
|
|
1802
|
+
exports.crumbsOf = crumbsOf;
|
|
1803
|
+
const detailBody = (collection, detailRow, fields, actions) => (0, plgg_1.matchOption)(() => [
|
|
1804
|
+
(0, plgg_view_1.span)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-hint`)], [(0, plgg_view_1.text)("Not found")]),
|
|
1805
|
+
], (r) => [
|
|
1806
|
+
(0, parts_1.detailFields)(fields),
|
|
1807
|
+
...(0, parts_1.actionRow)(collection, (0, plgg_1.some)(r.id), actions),
|
|
1808
|
+
])(detailRow);
|
|
1809
|
+
const headerLinks = (collection, options) => (options.headerLinks ?? [])
|
|
1810
|
+
.filter((link) => link.collection === collection)
|
|
1811
|
+
.map((link) => ({
|
|
1812
|
+
label: link.label,
|
|
1813
|
+
href: link.href,
|
|
1814
|
+
active: link.active ?? false,
|
|
1815
|
+
}));
|
|
1816
|
+
const listActions = (collection, options) => {
|
|
1817
|
+
const links = headerLinks(collection, options);
|
|
1818
|
+
return links.length === 0
|
|
1819
|
+
? []
|
|
1820
|
+
: [
|
|
1821
|
+
(0, plgg_view_1.slot)([
|
|
1822
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-list-actions`),
|
|
1823
|
+
], links.map((link) => (0, plgg_view_1.a)([
|
|
1824
|
+
(0, plgg_view_1.href)(link.href),
|
|
1825
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-list-action`),
|
|
1826
|
+
...(link.active
|
|
1827
|
+
? [
|
|
1828
|
+
(0, plgg_view_1.attr)("aria-current", "page"),
|
|
1829
|
+
]
|
|
1830
|
+
: []),
|
|
1831
|
+
], [(0, plgg_view_1.text)(link.label)]))),
|
|
1832
|
+
];
|
|
1833
|
+
};
|
|
1834
|
+
const mapScheduler = (options) => (node) => (0, plgg_view_1.mapHtml)(options.mapMsg)(node);
|
|
1835
|
+
const columnFor = (level, options) => (0, plgg_1.match)(level)([
|
|
1836
|
+
(0, Scene_1.menuLevel$)(),
|
|
1837
|
+
({ content }) => (0, combinators_1.column)([(0, styleEntry_1.basis)("220px")], [
|
|
1838
|
+
(0, combinators_1.navPane)([], [
|
|
1839
|
+
(0, colHead_1.colHead)({
|
|
1840
|
+
title: content.title,
|
|
1841
|
+
close: (0, plgg_1.none)(),
|
|
1842
|
+
links: [],
|
|
1843
|
+
}),
|
|
1844
|
+
(0, plgg_view_1.slot)([
|
|
1845
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-menu-body`),
|
|
1846
|
+
], [
|
|
1847
|
+
mapScheduler(options)((0, parts_1.menuNav)(content.entries)),
|
|
1848
|
+
]),
|
|
1849
|
+
]),
|
|
1850
|
+
]),
|
|
1851
|
+
], [
|
|
1852
|
+
(0, Scene_1.listLevel$)(),
|
|
1853
|
+
({ content }) => (0, combinators_1.column)([(0, styleEntry_1.basis)("300px")], [
|
|
1854
|
+
(0, combinators_1.asidePane)([], [
|
|
1855
|
+
(0, plgg_view_1.slot)([
|
|
1856
|
+
(0, plgg_view_1.key)(`list-${content.collection}`),
|
|
1857
|
+
(0, plgg_view_1.fadeIn)(150),
|
|
1858
|
+
], [
|
|
1859
|
+
(0, colHead_1.colHead)({
|
|
1860
|
+
title: content.title,
|
|
1861
|
+
close: content.back,
|
|
1862
|
+
links: [],
|
|
1863
|
+
}),
|
|
1864
|
+
...listActions(content.collection, options),
|
|
1865
|
+
...(0, parts_1.queryField)(content.query).map(mapScheduler(options)),
|
|
1866
|
+
...(0, parts_1.loadingHint)(content.loading).map(mapScheduler(options)),
|
|
1867
|
+
...(0, parts_1.errorHint)(content.error).map(mapScheduler(options)),
|
|
1868
|
+
mapScheduler(options)((0, parts_1.rowList)(content.rows)),
|
|
1869
|
+
...(0, parts_1.actionRow)(content.collection, (0, plgg_1.none)(), content.actions).map(mapScheduler(options)),
|
|
1870
|
+
]),
|
|
1871
|
+
]),
|
|
1872
|
+
]),
|
|
1873
|
+
], [
|
|
1874
|
+
(0, Scene_1.boardLevel$)(),
|
|
1875
|
+
({ content }) => (0, combinators_1.column)([styleEntry_1.fluid], [
|
|
1876
|
+
(0, combinators_1.mainPane)([], [
|
|
1877
|
+
(0, plgg_view_1.slot)([
|
|
1878
|
+
(0, plgg_view_1.key)(`board-${content.collection}`),
|
|
1879
|
+
(0, plgg_view_1.fadeIn)(150),
|
|
1880
|
+
], [
|
|
1881
|
+
(0, colHead_1.colHead)({
|
|
1882
|
+
title: content.title,
|
|
1883
|
+
close: content.back,
|
|
1884
|
+
links: [],
|
|
1885
|
+
}),
|
|
1886
|
+
...(0, parts_1.loadingHint)(content.loading).map(mapScheduler(options)),
|
|
1887
|
+
...(0, parts_1.errorHint)(content.error).map(mapScheduler(options)),
|
|
1888
|
+
mapScheduler(options)((0, parts_1.tileGrid)(content.tiles)),
|
|
1889
|
+
]),
|
|
1890
|
+
]),
|
|
1891
|
+
]),
|
|
1892
|
+
], [
|
|
1893
|
+
(0, Scene_1.detailLevel$)(),
|
|
1894
|
+
({ content }) => (0, combinators_1.column)([styleEntry_1.fluid], [
|
|
1895
|
+
(0, combinators_1.mainPane)([], [
|
|
1896
|
+
(0, plgg_view_1.slot)([
|
|
1897
|
+
(0, plgg_view_1.key)(`detail-${(0, plgg_1.getOr)("_")(detailKey(content.row))}`),
|
|
1898
|
+
(0, plgg_view_1.fadeIn)(150),
|
|
1899
|
+
], [
|
|
1900
|
+
(0, colHead_1.colHead)({
|
|
1901
|
+
title: content.title,
|
|
1902
|
+
close: content.back,
|
|
1903
|
+
links: [],
|
|
1904
|
+
}),
|
|
1905
|
+
...detailBody(content.collection, content.row, content.fields, content.actions).map(mapScheduler(options)),
|
|
1906
|
+
]),
|
|
1907
|
+
]),
|
|
1908
|
+
]),
|
|
1909
|
+
]);
|
|
1910
|
+
const extraColumn = (extra) => (0, combinators_1.column)([styleEntry_1.fluid], [
|
|
1911
|
+
(0, combinators_1.mainPane)([], [
|
|
1912
|
+
(0, plgg_view_1.slot)([(0, plgg_view_1.key)(extra.key), (0, plgg_view_1.fadeIn)(150)], [
|
|
1913
|
+
(0, colHead_1.colHead)({
|
|
1914
|
+
title: extra.title,
|
|
1915
|
+
close: extra.close,
|
|
1916
|
+
links: [],
|
|
1917
|
+
}),
|
|
1918
|
+
...extra.body,
|
|
1919
|
+
]),
|
|
1920
|
+
]),
|
|
1921
|
+
]);
|
|
1922
|
+
const detailKey = (detailRow) => (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (r) => (0, plgg_1.some)(r.id))(detailRow);
|
|
1923
|
+
|
|
1924
|
+
},
|
|
1925
|
+
"src/Schedule/model/Scene.ts": function (module, exports, require) {
|
|
1926
|
+
"use strict";
|
|
1927
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1928
|
+
exports.detailLevel$ = exports.boardLevel$ = exports.listLevel$ = exports.menuLevel$ = exports.detailLevel = exports.boardLevel = exports.listLevel = exports.menuLevel = void 0;
|
|
1929
|
+
const plgg_1 = require("plgg");
|
|
1930
|
+
const menuLevel = (title, entries) => (0, plgg_1.box)("MenuLevel")({ title, entries });
|
|
1931
|
+
exports.menuLevel = menuLevel;
|
|
1932
|
+
const listLevel = (l) => (0, plgg_1.box)("ListLevel")(l);
|
|
1933
|
+
exports.listLevel = listLevel;
|
|
1934
|
+
const boardLevel = (l) => (0, plgg_1.box)("BoardLevel")(l);
|
|
1935
|
+
exports.boardLevel = boardLevel;
|
|
1936
|
+
const detailLevel = (l) => (0, plgg_1.box)("DetailLevel")(l);
|
|
1937
|
+
exports.detailLevel = detailLevel;
|
|
1938
|
+
const menuLevel$ = () => (0, plgg_1.pattern)("MenuLevel")();
|
|
1939
|
+
exports.menuLevel$ = menuLevel$;
|
|
1940
|
+
const listLevel$ = () => (0, plgg_1.pattern)("ListLevel")();
|
|
1941
|
+
exports.listLevel$ = listLevel$;
|
|
1942
|
+
const boardLevel$ = () => (0, plgg_1.pattern)("BoardLevel")();
|
|
1943
|
+
exports.boardLevel$ = boardLevel$;
|
|
1944
|
+
const detailLevel$ = () => (0, plgg_1.pattern)("DetailLevel")();
|
|
1945
|
+
exports.detailLevel$ = detailLevel$;
|
|
1946
|
+
|
|
1947
|
+
},
|
|
1948
|
+
"src/Render/usecase/parts.ts": function (module, exports, require) {
|
|
1949
|
+
"use strict";
|
|
1950
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1951
|
+
exports.backControl = exports.detailFields = exports.errorHint = exports.loadingHint = exports.menuNav = exports.tileGrid = exports.rowList = exports.rowItem = exports.queryField = exports.actionRow = exports.confirmOverlay = void 0;
|
|
1952
|
+
const plgg_1 = require("plgg");
|
|
1953
|
+
const plgg_view_1 = require("plgg-view");
|
|
1954
|
+
const styleEntry_1 = require("src/styleEntry.ts");
|
|
1955
|
+
const navTree_1 = require("src/Component/usecase/navTree.ts");
|
|
1956
|
+
const interaction_1 = require("src/Component/model/interaction.ts");
|
|
1957
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
1958
|
+
const confirmDialog_1 = require("src/Component/usecase/confirmDialog.ts");
|
|
1959
|
+
const Msg_1 = require("src/Schedule/model/Msg.ts");
|
|
1960
|
+
const Row_1 = require("src/Declare/model/Row.ts");
|
|
1961
|
+
const confirmOverlay = (confirm) => (0, plgg_1.matchOption)(() => [], (c) => [
|
|
1962
|
+
(0, confirmDialog_1.confirmDialog)({
|
|
1963
|
+
title: c.destructive
|
|
1964
|
+
? "Confirm deletion"
|
|
1965
|
+
: "Please confirm",
|
|
1966
|
+
body: c.prompt,
|
|
1967
|
+
confirmLabel: "Confirm",
|
|
1968
|
+
cancelLabel: "Cancel",
|
|
1969
|
+
destructive: c.destructive,
|
|
1970
|
+
onConfirm: (0, Msg_1.confirmAction)(),
|
|
1971
|
+
onCancel: (0, Msg_1.cancelAction)(),
|
|
1972
|
+
}),
|
|
1973
|
+
])(confirm);
|
|
1974
|
+
exports.confirmOverlay = confirmOverlay;
|
|
1975
|
+
const actionRow = (collection, target, actions) => actions.length === 0
|
|
1976
|
+
? []
|
|
1977
|
+
: [
|
|
1978
|
+
(0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-actions`)], actions.map((ab) => (0, plgg_view_1.button)([
|
|
1979
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-btn`, interaction_1.focusRing),
|
|
1980
|
+
(0, plgg_view_1.onClick)((0, Msg_1.requestAction)(collection, ab.id, target)),
|
|
1981
|
+
], [(0, plgg_view_1.text)(ab.label)]))),
|
|
1982
|
+
];
|
|
1983
|
+
exports.actionRow = actionRow;
|
|
1984
|
+
const choiceSelect = (c) => (0, plgg_view_1.select)([
|
|
1985
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-query-choice`),
|
|
1986
|
+
(0, plgg_view_1.attr)("aria-label", c.label),
|
|
1987
|
+
(0, plgg_view_1.onChange)((v) => (0, Msg_1.queryChoiceInput)(c.id, v)),
|
|
1988
|
+
], [
|
|
1989
|
+
(0, plgg_view_1.option)([
|
|
1990
|
+
(0, plgg_view_1.attr)("value", ""),
|
|
1991
|
+
...(c.value === ""
|
|
1992
|
+
? [(0, plgg_view_1.attr)("selected", "")]
|
|
1993
|
+
: []),
|
|
1994
|
+
], [(0, plgg_view_1.text)("Any")]),
|
|
1995
|
+
...c.options.map((o) => (0, plgg_view_1.option)([
|
|
1996
|
+
(0, plgg_view_1.attr)("value", o),
|
|
1997
|
+
...(o === c.value
|
|
1998
|
+
? [(0, plgg_view_1.attr)("selected", "")]
|
|
1999
|
+
: []),
|
|
2000
|
+
], [(0, plgg_view_1.text)(o)])),
|
|
2001
|
+
]);
|
|
2002
|
+
const queryField = (q) => (0, plgg_1.matchOption)(() => [], (state) => [
|
|
2003
|
+
(0, plgg_view_1.input)([
|
|
2004
|
+
(0, plgg_view_1.attr)("type", "search"),
|
|
2005
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-query`),
|
|
2006
|
+
(0, plgg_view_1.attr)("value", state.text),
|
|
2007
|
+
(0, plgg_view_1.attr)("placeholder", state.placeholder),
|
|
2008
|
+
(0, plgg_view_1.onInput)((v) => (0, Msg_1.queryInput)(v)),
|
|
2009
|
+
], []),
|
|
2010
|
+
...state.choices.map(choiceSelect),
|
|
2011
|
+
])(q);
|
|
2012
|
+
exports.queryField = queryField;
|
|
2013
|
+
const rowItem = (r) => (0, plgg_view_1.li)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-list-item`)], [
|
|
2014
|
+
(0, plgg_view_1.a)([
|
|
2015
|
+
(0, plgg_view_1.href)(r.href),
|
|
2016
|
+
...(r.active
|
|
2017
|
+
? [(0, plgg_view_1.attr)("aria-current", "page")]
|
|
2018
|
+
: []),
|
|
2019
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-row-link`, interaction_1.focusRing),
|
|
2020
|
+
], [(0, plgg_view_1.text)(r.row.label)]),
|
|
2021
|
+
]);
|
|
2022
|
+
exports.rowItem = rowItem;
|
|
2023
|
+
const rowList = (rows) => (0, plgg_view_1.ul)([(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-list`)], rows.map(exports.rowItem));
|
|
2024
|
+
exports.rowList = rowList;
|
|
2025
|
+
const tileBody = (t) => [
|
|
2026
|
+
(0, plgg_view_1.span)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-tile-label`)], [(0, plgg_view_1.text)(t.label)]),
|
|
2027
|
+
(0, plgg_view_1.span)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-tile-caption`)], [(0, plgg_view_1.text)(t.caption)]),
|
|
2028
|
+
];
|
|
2029
|
+
const tileItem = (t) => (0, plgg_view_1.li)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-tile`)], [
|
|
2030
|
+
(0, plgg_1.matchOption)(() => (0, plgg_view_1.span)([
|
|
2031
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-tile-body`),
|
|
2032
|
+
], tileBody(t)), (to) => (0, plgg_view_1.a)([
|
|
2033
|
+
(0, plgg_view_1.href)(to),
|
|
2034
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-tile-link`, interaction_1.focusRing),
|
|
2035
|
+
], tileBody(t)))(t.href),
|
|
2036
|
+
]);
|
|
2037
|
+
const tileGrid = (tiles) => (0, plgg_view_1.ul)([(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-board`)], tiles.map(tileItem));
|
|
2038
|
+
exports.tileGrid = tileGrid;
|
|
2039
|
+
const menuNav = (entries) => (0, navTree_1.navTree)(entries.map((e) => ({
|
|
2040
|
+
label: e.label,
|
|
2041
|
+
href: (0, plgg_1.some)(e.href),
|
|
2042
|
+
children: [],
|
|
2043
|
+
})), (0, plgg_1.matchOption)(() => "", (e) => e.href)(activeEntry(entries)));
|
|
2044
|
+
exports.menuNav = menuNav;
|
|
2045
|
+
const activeEntry = (entries) => {
|
|
2046
|
+
const hit = entries.find((e) => e.active);
|
|
2047
|
+
return hit === undefined ? (0, plgg_1.none)() : (0, plgg_1.some)(hit);
|
|
2048
|
+
};
|
|
2049
|
+
const loadingHint = (loading) => loading
|
|
2050
|
+
? [
|
|
2051
|
+
(0, plgg_view_1.span)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-hint`)], [(0, plgg_view_1.text)("Loading…")]),
|
|
2052
|
+
]
|
|
2053
|
+
: [];
|
|
2054
|
+
exports.loadingHint = loadingHint;
|
|
2055
|
+
const errorHint = (error) => (0, plgg_1.matchOption)(() => [], (e) => [
|
|
2056
|
+
(0, plgg_view_1.span)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-error`)], [(0, plgg_view_1.text)(`Failed: ${e}`)]),
|
|
2057
|
+
])(error);
|
|
2058
|
+
exports.errorHint = errorHint;
|
|
2059
|
+
const valueNode = (value, refHref) => (0, plgg_1.match)(value)([
|
|
2060
|
+
(0, Row_1.textValue$)(),
|
|
2061
|
+
({ content }) => (0, plgg_view_1.text)(content),
|
|
2062
|
+
], [
|
|
2063
|
+
(0, Row_1.numValue$)(),
|
|
2064
|
+
() => (0, plgg_view_1.span)([
|
|
2065
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-num`),
|
|
2066
|
+
], [(0, plgg_view_1.text)((0, Row_1.fieldText)(value))]),
|
|
2067
|
+
], [
|
|
2068
|
+
(0, Row_1.flagValue$)(),
|
|
2069
|
+
() => (0, plgg_view_1.span)([
|
|
2070
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-flag`),
|
|
2071
|
+
], [(0, plgg_view_1.text)((0, Row_1.fieldText)(value))]),
|
|
2072
|
+
], [
|
|
2073
|
+
(0, Row_1.momentValue$)(),
|
|
2074
|
+
() => (0, plgg_view_1.span)([
|
|
2075
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-moment`),
|
|
2076
|
+
], [(0, plgg_view_1.text)((0, Row_1.fieldText)(value))]),
|
|
2077
|
+
], [
|
|
2078
|
+
(0, Row_1.refValue$)(),
|
|
2079
|
+
({ content }) => (0, plgg_1.matchOption)(() => (0, plgg_view_1.text)(content.label), (to) => (0, plgg_view_1.a)([
|
|
2080
|
+
(0, plgg_view_1.href)(to),
|
|
2081
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-field-ref`, interaction_1.focusRing),
|
|
2082
|
+
], [(0, plgg_view_1.text)(content.label)]))(refHref),
|
|
2083
|
+
], [
|
|
2084
|
+
(0, Row_1.mediaValue$)(),
|
|
2085
|
+
({ content }) => (0, plgg_view_1.img)([
|
|
2086
|
+
(0, plgg_view_1.attr)("src", content.src),
|
|
2087
|
+
(0, plgg_view_1.attr)("alt", content.alt),
|
|
2088
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-media`),
|
|
2089
|
+
], []),
|
|
2090
|
+
]);
|
|
2091
|
+
const detailFields = (fields) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-fields`)], fields.map((f) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field`)], f.label === ""
|
|
2092
|
+
? [valueNode(f.value, f.href)]
|
|
2093
|
+
: [
|
|
2094
|
+
(0, plgg_view_1.span)([
|
|
2095
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-label`),
|
|
2096
|
+
], [(0, plgg_view_1.text)(f.label)]),
|
|
2097
|
+
(0, plgg_view_1.span)([
|
|
2098
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-field-value`),
|
|
2099
|
+
], [valueNode(f.value, f.href)]),
|
|
2100
|
+
])));
|
|
2101
|
+
exports.detailFields = detailFields;
|
|
2102
|
+
const backControl = (back) => (0, plgg_1.matchOption)(() => [], (to) => [
|
|
2103
|
+
(0, plgg_view_1.a)([
|
|
2104
|
+
(0, plgg_view_1.href)(to),
|
|
2105
|
+
(0, plgg_view_1.attr)("aria-label", "Back"),
|
|
2106
|
+
(0, styleEntry_1.style_)(`${identity_1.cssPrefix}-back`, interaction_1.focusRing),
|
|
2107
|
+
], [(0, plgg_view_1.text)("← Back")]),
|
|
2108
|
+
])(back);
|
|
2109
|
+
exports.backControl = backControl;
|
|
2110
|
+
|
|
2111
|
+
},
|
|
2112
|
+
"src/Schedule/model/Msg.ts": function (module, exports, require) {
|
|
2113
|
+
"use strict";
|
|
2114
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2115
|
+
exports.failed$ = exports.loaded$ = exports.cancelAction$ = exports.confirmAction$ = exports.requestAction$ = exports.queryChoiceInput$ = exports.queryInput$ = exports.select$ = exports.openMenu$ = exports.urlChanged$ = exports.navigate$ = exports.failed = exports.loaded = exports.cancelAction = exports.confirmAction = exports.requestAction = exports.queryChoiceInput = exports.queryInput = exports.select = exports.openMenu = exports.urlChanged = exports.navigate = void 0;
|
|
2116
|
+
const plgg_1 = require("plgg");
|
|
2117
|
+
const navigate = (to, bindings) => (0, plgg_1.box)("Navigate")({ to, with: bindings });
|
|
2118
|
+
exports.navigate = navigate;
|
|
2119
|
+
const urlChanged = (url) => (0, plgg_1.box)("UrlChanged")(url);
|
|
2120
|
+
exports.urlChanged = urlChanged;
|
|
2121
|
+
const openMenu = (collection) => (0, plgg_1.box)("OpenMenu")(collection);
|
|
2122
|
+
exports.openMenu = openMenu;
|
|
2123
|
+
const select = (level, id) => (0, plgg_1.box)("Select")({ level, id });
|
|
2124
|
+
exports.select = select;
|
|
2125
|
+
const queryInput = (text) => (0, plgg_1.box)("QueryInput")(text);
|
|
2126
|
+
exports.queryInput = queryInput;
|
|
2127
|
+
const queryChoiceInput = (choice, value) => (0, plgg_1.box)("QueryChoiceInput")({ choice, value });
|
|
2128
|
+
exports.queryChoiceInput = queryChoiceInput;
|
|
2129
|
+
const requestAction = (collection, action, target) => (0, plgg_1.box)("RequestAction")({
|
|
2130
|
+
collection,
|
|
2131
|
+
action,
|
|
2132
|
+
target,
|
|
2133
|
+
});
|
|
2134
|
+
exports.requestAction = requestAction;
|
|
2135
|
+
const confirmAction = () => (0, plgg_1.icon)("ConfirmAction");
|
|
2136
|
+
exports.confirmAction = confirmAction;
|
|
2137
|
+
const cancelAction = () => (0, plgg_1.icon)("CancelAction");
|
|
2138
|
+
exports.cancelAction = cancelAction;
|
|
2139
|
+
const loaded = (collection, rows) => (0, plgg_1.box)("Loaded")({ collection, rows });
|
|
2140
|
+
exports.loaded = loaded;
|
|
2141
|
+
const failed = (collection, error) => (0, plgg_1.box)("Failed")({ collection, error });
|
|
2142
|
+
exports.failed = failed;
|
|
2143
|
+
const navigate$ = () => (0, plgg_1.pattern)("Navigate")();
|
|
2144
|
+
exports.navigate$ = navigate$;
|
|
2145
|
+
const urlChanged$ = () => (0, plgg_1.pattern)("UrlChanged")();
|
|
2146
|
+
exports.urlChanged$ = urlChanged$;
|
|
2147
|
+
const openMenu$ = () => (0, plgg_1.pattern)("OpenMenu")();
|
|
2148
|
+
exports.openMenu$ = openMenu$;
|
|
2149
|
+
const select$ = () => (0, plgg_1.pattern)("Select")();
|
|
2150
|
+
exports.select$ = select$;
|
|
2151
|
+
const queryInput$ = () => (0, plgg_1.pattern)("QueryInput")();
|
|
2152
|
+
exports.queryInput$ = queryInput$;
|
|
2153
|
+
const queryChoiceInput$ = () => (0, plgg_1.pattern)("QueryChoiceInput")();
|
|
2154
|
+
exports.queryChoiceInput$ = queryChoiceInput$;
|
|
2155
|
+
const requestAction$ = () => (0, plgg_1.pattern)("RequestAction")();
|
|
2156
|
+
exports.requestAction$ = requestAction$;
|
|
2157
|
+
const confirmAction$ = () => (0, plgg_1.pattern)("ConfirmAction")();
|
|
2158
|
+
exports.confirmAction$ = confirmAction$;
|
|
2159
|
+
const cancelAction$ = () => (0, plgg_1.pattern)("CancelAction")();
|
|
2160
|
+
exports.cancelAction$ = cancelAction$;
|
|
2161
|
+
const loaded$ = () => (0, plgg_1.pattern)("Loaded")();
|
|
2162
|
+
exports.loaded$ = loaded$;
|
|
2163
|
+
const failed$ = () => (0, plgg_1.pattern)("Failed")();
|
|
2164
|
+
exports.failed$ = failed$;
|
|
2165
|
+
|
|
2166
|
+
},
|
|
2167
|
+
"src/Declare/model/Row.ts": function (module, exports, require) {
|
|
2168
|
+
"use strict";
|
|
2169
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2170
|
+
exports.fieldText = exports.refTarget = exports.row = exports.fieldOf = exports.field = exports.mediaValue$ = exports.refValue$ = exports.momentValue$ = exports.flagValue$ = exports.numValue$ = exports.textValue$ = exports.mediaValue = exports.refValue = exports.momentValue = exports.flagValue = exports.numValue = exports.textValue = void 0;
|
|
2171
|
+
const plgg_1 = require("plgg");
|
|
2172
|
+
const textValue = (value) => (0, plgg_1.box)("Text")(value);
|
|
2173
|
+
exports.textValue = textValue;
|
|
2174
|
+
const numValue = (value, unit) => (0, plgg_1.box)("Num")({
|
|
2175
|
+
value,
|
|
2176
|
+
unit: (0, plgg_1.fromNullable)(unit),
|
|
2177
|
+
});
|
|
2178
|
+
exports.numValue = numValue;
|
|
2179
|
+
const flagValue = (value) => (0, plgg_1.box)("Flag")(value);
|
|
2180
|
+
exports.flagValue = flagValue;
|
|
2181
|
+
const momentValue = (value) => (0, plgg_1.box)("Moment")(value);
|
|
2182
|
+
exports.momentValue = momentValue;
|
|
2183
|
+
const refValue = (collection, id, label) => (0, plgg_1.box)("Reference")({ collection, id, label });
|
|
2184
|
+
exports.refValue = refValue;
|
|
2185
|
+
const mediaValue = (src, alt) => (0, plgg_1.box)("Media")({ src, alt });
|
|
2186
|
+
exports.mediaValue = mediaValue;
|
|
2187
|
+
const textValue$ = () => (0, plgg_1.pattern)("Text")();
|
|
2188
|
+
exports.textValue$ = textValue$;
|
|
2189
|
+
const numValue$ = () => (0, plgg_1.pattern)("Num")();
|
|
2190
|
+
exports.numValue$ = numValue$;
|
|
2191
|
+
const flagValue$ = () => (0, plgg_1.pattern)("Flag")();
|
|
2192
|
+
exports.flagValue$ = flagValue$;
|
|
2193
|
+
const momentValue$ = () => (0, plgg_1.pattern)("Moment")();
|
|
2194
|
+
exports.momentValue$ = momentValue$;
|
|
2195
|
+
const refValue$ = () => (0, plgg_1.pattern)("Reference")();
|
|
2196
|
+
exports.refValue$ = refValue$;
|
|
2197
|
+
const mediaValue$ = () => (0, plgg_1.pattern)("Media")();
|
|
2198
|
+
exports.mediaValue$ = mediaValue$;
|
|
2199
|
+
const field = (label, value) => ({ label, value: (0, exports.textValue)(value) });
|
|
2200
|
+
exports.field = field;
|
|
2201
|
+
const fieldOf = (label, value) => ({ label, value });
|
|
2202
|
+
exports.fieldOf = fieldOf;
|
|
2203
|
+
const row = (id, label, fields = []) => ({ id, label, fields });
|
|
2204
|
+
exports.row = row;
|
|
2205
|
+
const refTarget = (value) => (0, plgg_1.match)(value)([
|
|
2206
|
+
(0, exports.textValue$)(),
|
|
2207
|
+
() => (0, plgg_1.none)(),
|
|
2208
|
+
], [
|
|
2209
|
+
(0, exports.numValue$)(),
|
|
2210
|
+
() => (0, plgg_1.none)(),
|
|
2211
|
+
], [
|
|
2212
|
+
(0, exports.flagValue$)(),
|
|
2213
|
+
() => (0, plgg_1.none)(),
|
|
2214
|
+
], [
|
|
2215
|
+
(0, exports.momentValue$)(),
|
|
2216
|
+
() => (0, plgg_1.none)(),
|
|
2217
|
+
], [
|
|
2218
|
+
(0, exports.refValue$)(),
|
|
2219
|
+
({ content }) => (0, plgg_1.some)({
|
|
2220
|
+
collection: content.collection,
|
|
2221
|
+
id: content.id,
|
|
2222
|
+
}),
|
|
2223
|
+
], [
|
|
2224
|
+
(0, exports.mediaValue$)(),
|
|
2225
|
+
() => (0, plgg_1.none)(),
|
|
2226
|
+
]);
|
|
2227
|
+
exports.refTarget = refTarget;
|
|
2228
|
+
const fieldText = (value) => (0, plgg_1.match)(value)([
|
|
2229
|
+
(0, exports.textValue$)(),
|
|
2230
|
+
({ content }) => content,
|
|
2231
|
+
], [
|
|
2232
|
+
(0, exports.numValue$)(),
|
|
2233
|
+
({ content }) => (0, plgg_1.matchOption)(() => content.value, (unit) => `${content.value} ${unit}`)(content.unit),
|
|
2234
|
+
], [
|
|
2235
|
+
(0, exports.flagValue$)(),
|
|
2236
|
+
({ content }) => content ? "✓" : "—",
|
|
2237
|
+
], [
|
|
2238
|
+
(0, exports.momentValue$)(),
|
|
2239
|
+
({ content }) => content,
|
|
2240
|
+
], [
|
|
2241
|
+
(0, exports.refValue$)(),
|
|
2242
|
+
({ content }) => content.label,
|
|
2243
|
+
], [
|
|
2244
|
+
(0, exports.mediaValue$)(),
|
|
2245
|
+
({ content }) => content.alt,
|
|
2246
|
+
]);
|
|
2247
|
+
exports.fieldText = fieldText;
|
|
2248
|
+
|
|
2249
|
+
},
|
|
2250
|
+
"src/Render/usecase/singleColumn.ts": function (module, exports, require) {
|
|
2251
|
+
"use strict";
|
|
2252
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2253
|
+
exports.singleColumn = void 0;
|
|
2254
|
+
const plgg_1 = require("plgg");
|
|
2255
|
+
const plgg_view_1 = require("plgg-view");
|
|
2256
|
+
const combinators_1 = require("src/Layout/usecase/combinators.ts");
|
|
2257
|
+
const typography_1 = require("src/Component/usecase/typography.ts");
|
|
2258
|
+
const Scene_1 = require("src/Schedule/model/Scene.ts");
|
|
2259
|
+
const identity_1 = require("src/Meta/model/identity.ts");
|
|
2260
|
+
const screen_1 = require("src/Render/model/screen.ts");
|
|
2261
|
+
const parts_1 = require("src/Render/usecase/parts.ts");
|
|
2262
|
+
const singleColumn = (scene) => (0, plgg_view_1.slot)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-single`)], [
|
|
2263
|
+
...(0, parts_1.confirmOverlay)(scene.confirm),
|
|
2264
|
+
(0, plgg_1.matchOption)(() => (0, combinators_1.column)([], [
|
|
2265
|
+
(0, plgg_view_1.span)([
|
|
2266
|
+
(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-hint`),
|
|
2267
|
+
], [(0, plgg_view_1.text)("Nothing to show")]),
|
|
2268
|
+
]), (screen) => screenView(screen))((0, screen_1.currentScreen)(scene)),
|
|
2269
|
+
]);
|
|
2270
|
+
exports.singleColumn = singleColumn;
|
|
2271
|
+
const screenView = (screen) => (0, plgg_1.match)(screen)([
|
|
2272
|
+
(0, Scene_1.menuLevel$)(),
|
|
2273
|
+
({ content }) => (0, combinators_1.column)([], [
|
|
2274
|
+
(0, combinators_1.navPane)([], [
|
|
2275
|
+
screenTitle(content.title),
|
|
2276
|
+
(0, parts_1.menuNav)(content.entries),
|
|
2277
|
+
]),
|
|
2278
|
+
]),
|
|
2279
|
+
], [
|
|
2280
|
+
(0, Scene_1.listLevel$)(),
|
|
2281
|
+
({ content }) => (0, combinators_1.column)([], [
|
|
2282
|
+
(0, combinators_1.mainPane)([], [
|
|
2283
|
+
...(0, parts_1.backControl)(content.back),
|
|
2284
|
+
screenTitle(content.title),
|
|
2285
|
+
...(0, parts_1.queryField)(content.query),
|
|
2286
|
+
...(0, parts_1.loadingHint)(content.loading),
|
|
2287
|
+
...(0, parts_1.errorHint)(content.error),
|
|
2288
|
+
(0, parts_1.rowList)(content.rows),
|
|
2289
|
+
...(0, parts_1.actionRow)(content.collection, (0, plgg_1.none)(), content.actions),
|
|
2290
|
+
]),
|
|
2291
|
+
]),
|
|
2292
|
+
], [
|
|
2293
|
+
(0, Scene_1.boardLevel$)(),
|
|
2294
|
+
({ content }) => (0, combinators_1.column)([], [
|
|
2295
|
+
(0, combinators_1.mainPane)([], [
|
|
2296
|
+
...(0, parts_1.backControl)(content.back),
|
|
2297
|
+
screenTitle(content.title),
|
|
2298
|
+
...(0, parts_1.loadingHint)(content.loading),
|
|
2299
|
+
...(0, parts_1.errorHint)(content.error),
|
|
2300
|
+
(0, parts_1.tileGrid)(content.tiles),
|
|
2301
|
+
]),
|
|
2302
|
+
]),
|
|
2303
|
+
], [
|
|
2304
|
+
(0, Scene_1.detailLevel$)(),
|
|
2305
|
+
({ content }) => (0, combinators_1.column)([], [
|
|
2306
|
+
(0, combinators_1.mainPane)([], [
|
|
2307
|
+
...(0, parts_1.backControl)(content.back),
|
|
2308
|
+
screenTitle(content.title),
|
|
2309
|
+
...detailBody(content.collection, content.row, content.fields, content.actions),
|
|
2310
|
+
]),
|
|
2311
|
+
]),
|
|
2312
|
+
]);
|
|
2313
|
+
const screenTitle = (title) => (0, typography_1.heading)(2, title);
|
|
2314
|
+
const detailBody = (collection, detailRow, fields, actions) => (0, plgg_1.matchOption)(() => [
|
|
2315
|
+
(0, plgg_view_1.span)([(0, plgg_view_1.attr)("class", `${identity_1.cssPrefix}-hint`)], [(0, plgg_view_1.text)("Not found")]),
|
|
2316
|
+
], (r) => [
|
|
2317
|
+
(0, parts_1.detailFields)(fields),
|
|
2318
|
+
...(0, parts_1.actionRow)(collection, (0, plgg_1.some)(r.id), actions),
|
|
2319
|
+
])(detailRow);
|
|
2320
|
+
|
|
2321
|
+
},
|
|
2322
|
+
"src/Render/usecase/renderMode.ts": function (module, exports, require) {
|
|
2323
|
+
"use strict";
|
|
2324
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2325
|
+
exports.renderMode = void 0;
|
|
2326
|
+
const multiColumn_1 = require("src/Render/usecase/multiColumn.ts");
|
|
2327
|
+
const singleColumn_1 = require("src/Render/usecase/singleColumn.ts");
|
|
2328
|
+
const renderMode = (mode) => (scene) => {
|
|
2329
|
+
switch (mode) {
|
|
2330
|
+
case "multiColumn":
|
|
2331
|
+
return (0, multiColumn_1.multiColumn)(scene);
|
|
2332
|
+
case "singleColumn":
|
|
2333
|
+
return (0, singleColumn_1.singleColumn)(scene);
|
|
2334
|
+
}
|
|
2335
|
+
};
|
|
2336
|
+
exports.renderMode = renderMode;
|
|
2337
|
+
|
|
2338
|
+
},
|
|
2339
|
+
"src/Declare/model/Source.ts": function (module, exports, require) {
|
|
2340
|
+
"use strict";
|
|
2341
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2342
|
+
exports.adapter$ = exports.dynamic$ = exports.async$ = exports.sync$ = exports.adapter = exports.dynamic = exports.async = exports.sync = void 0;
|
|
2343
|
+
const plgg_1 = require("plgg");
|
|
2344
|
+
const sync = (read) => (0, plgg_1.box)("Sync")(read);
|
|
2345
|
+
exports.sync = sync;
|
|
2346
|
+
const async = (read) => (0, plgg_1.box)("Async")(read);
|
|
2347
|
+
exports.async = async;
|
|
2348
|
+
const dynamic = () => (0, plgg_1.box)("Dynamic")(null);
|
|
2349
|
+
exports.dynamic = dynamic;
|
|
2350
|
+
const adapter = (name) => (0, plgg_1.box)("Adapter")((0, plgg_1.fromNullable)(name));
|
|
2351
|
+
exports.adapter = adapter;
|
|
2352
|
+
const sync$ = () => (0, plgg_1.pattern)("Sync")();
|
|
2353
|
+
exports.sync$ = sync$;
|
|
2354
|
+
const async$ = () => (0, plgg_1.pattern)("Async")();
|
|
2355
|
+
exports.async$ = async$;
|
|
2356
|
+
const dynamic$ = () => (0, plgg_1.pattern)("Dynamic")();
|
|
2357
|
+
exports.dynamic$ = dynamic$;
|
|
2358
|
+
const adapter$ = () => (0, plgg_1.pattern)("Adapter")();
|
|
2359
|
+
exports.adapter$ = adapter$;
|
|
2360
|
+
|
|
2361
|
+
},
|
|
2362
|
+
"src/Declare/model/Adapter.ts": function (module, exports, require) {
|
|
2363
|
+
"use strict";
|
|
2364
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2365
|
+
exports.resolveAdapter = exports.named = exports.hostAdapter = exports.effect = exports.scope = exports.actor = void 0;
|
|
2366
|
+
const plgg_1 = require("plgg");
|
|
2367
|
+
const actor = (id, roles = []) => ({ id, roles });
|
|
2368
|
+
exports.actor = actor;
|
|
2369
|
+
const scope = (collection, path) => ({ collection, path });
|
|
2370
|
+
exports.scope = scope;
|
|
2371
|
+
const effect = (e) => ({
|
|
2372
|
+
collection: e.collection,
|
|
2373
|
+
verb: e.verb,
|
|
2374
|
+
target: e.target,
|
|
2375
|
+
payload: (0, plgg_1.pipe)((0, plgg_1.fromNullable)(e.payload), (0, plgg_1.getOr)([])),
|
|
2376
|
+
});
|
|
2377
|
+
exports.effect = effect;
|
|
2378
|
+
const hostAdapter = (a) => ({
|
|
2379
|
+
read: a.read,
|
|
2380
|
+
apply: a.apply,
|
|
2381
|
+
});
|
|
2382
|
+
exports.hostAdapter = hostAdapter;
|
|
2383
|
+
const named = (name, adapter) => ({ name, adapter });
|
|
2384
|
+
exports.named = named;
|
|
2385
|
+
const pick = (na) => (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (n) => (0, plgg_1.some)(n.adapter))(na);
|
|
2386
|
+
const resolveAdapter = (registry, name) => (0, plgg_1.matchOption)(() => registry.length === 1
|
|
2387
|
+
? pick((0, plgg_1.fromNullable)(registry[0]))
|
|
2388
|
+
: (0, plgg_1.none)(), (nm) => pick((0, plgg_1.fromNullable)(registry.find((r) => r.name === nm))))(name);
|
|
2389
|
+
exports.resolveAdapter = resolveAdapter;
|
|
2390
|
+
|
|
2391
|
+
},
|
|
2392
|
+
"src/Declare/usecase/reconcile.ts": function (module, exports, require) {
|
|
2393
|
+
"use strict";
|
|
2394
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2395
|
+
exports.reconcile = exports.diagnosticSeverity = exports.unusedAdapter$ = exports.noDefaultAdapter$ = exports.unknownAdapter$ = exports.unusedAdapter = exports.noDefaultAdapter = exports.unknownAdapter = void 0;
|
|
2396
|
+
const plgg_1 = require("plgg");
|
|
2397
|
+
const Source_1 = require("src/Declare/model/Source.ts");
|
|
2398
|
+
const unknownAdapter = (collection, name) => (0, plgg_1.box)("UnknownAdapter")({ collection, name });
|
|
2399
|
+
exports.unknownAdapter = unknownAdapter;
|
|
2400
|
+
const noDefaultAdapter = (collection, registered) => (0, plgg_1.box)("NoDefaultAdapter")({
|
|
2401
|
+
collection,
|
|
2402
|
+
registered,
|
|
2403
|
+
});
|
|
2404
|
+
exports.noDefaultAdapter = noDefaultAdapter;
|
|
2405
|
+
const unusedAdapter = (name) => (0, plgg_1.box)("UnusedAdapter")({ name });
|
|
2406
|
+
exports.unusedAdapter = unusedAdapter;
|
|
2407
|
+
const unknownAdapter$ = () => (0, plgg_1.pattern)("UnknownAdapter")();
|
|
2408
|
+
exports.unknownAdapter$ = unknownAdapter$;
|
|
2409
|
+
const noDefaultAdapter$ = () => (0, plgg_1.pattern)("NoDefaultAdapter")();
|
|
2410
|
+
exports.noDefaultAdapter$ = noDefaultAdapter$;
|
|
2411
|
+
const unusedAdapter$ = () => (0, plgg_1.pattern)("UnusedAdapter")();
|
|
2412
|
+
exports.unusedAdapter$ = unusedAdapter$;
|
|
2413
|
+
const diagnosticSeverity = (d) => (0, plgg_1.match)(d)([
|
|
2414
|
+
(0, exports.unknownAdapter$)(),
|
|
2415
|
+
() => "error",
|
|
2416
|
+
], [
|
|
2417
|
+
(0, exports.noDefaultAdapter$)(),
|
|
2418
|
+
() => "error",
|
|
2419
|
+
], [
|
|
2420
|
+
(0, exports.unusedAdapter$)(),
|
|
2421
|
+
() => "warning",
|
|
2422
|
+
]);
|
|
2423
|
+
exports.diagnosticSeverity = diagnosticSeverity;
|
|
2424
|
+
const bindingOf = (source) => (0, plgg_1.match)(source)([
|
|
2425
|
+
(0, Source_1.sync$)(),
|
|
2426
|
+
() => (0, plgg_1.none)(),
|
|
2427
|
+
], [
|
|
2428
|
+
(0, Source_1.async$)(),
|
|
2429
|
+
() => (0, plgg_1.none)(),
|
|
2430
|
+
], [
|
|
2431
|
+
(0, Source_1.dynamic$)(),
|
|
2432
|
+
() => (0, plgg_1.none)(),
|
|
2433
|
+
], [
|
|
2434
|
+
(0, Source_1.adapter$)(),
|
|
2435
|
+
({ content }) => (0, plgg_1.some)(content),
|
|
2436
|
+
]);
|
|
2437
|
+
const reconcile = (declaration, registry) => {
|
|
2438
|
+
const bindings = declaration.collections.flatMap((c) => (0, plgg_1.matchOption)(() => [], (name) => [
|
|
2439
|
+
{ collection: c.id, name },
|
|
2440
|
+
])(bindingOf(c.source)));
|
|
2441
|
+
const bindErrors = bindings.flatMap((b) => (0, plgg_1.matchOption)(() => registry.length === 1
|
|
2442
|
+
? []
|
|
2443
|
+
: [
|
|
2444
|
+
(0, exports.noDefaultAdapter)(b.collection, registry.length),
|
|
2445
|
+
], (nm) => registry.some((r) => r.name === nm)
|
|
2446
|
+
? []
|
|
2447
|
+
: [(0, exports.unknownAdapter)(b.collection, nm)])(b.name));
|
|
2448
|
+
const usedNames = bindings.flatMap((b) => (0, plgg_1.matchOption)(() => [], (nm) => [nm])(b.name));
|
|
2449
|
+
const defaultUsed = registry.length === 1 &&
|
|
2450
|
+
bindings.some((b) => (0, plgg_1.isNone)(b.name));
|
|
2451
|
+
const unusedWarnings = registry
|
|
2452
|
+
.filter((r) => !usedNames.includes(r.name) &&
|
|
2453
|
+
!(registry.length === 1 && defaultUsed))
|
|
2454
|
+
.map((r) => (0, exports.unusedAdapter)(r.name));
|
|
2455
|
+
return [...bindErrors, ...unusedWarnings];
|
|
2456
|
+
};
|
|
2457
|
+
exports.reconcile = reconcile;
|
|
2458
|
+
|
|
2459
|
+
},
|
|
2460
|
+
"src/Declare/usecase/project.ts": function (module, exports, require) {
|
|
2461
|
+
"use strict";
|
|
2462
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2463
|
+
exports.projectRow = exports.projection = exports.projectField = exports.asFlag = exports.asMoment = exports.asNum = exports.asText = void 0;
|
|
2464
|
+
const plgg_1 = require("plgg");
|
|
2465
|
+
const Row_1 = require("src/Declare/model/Row.ts");
|
|
2466
|
+
const asText = () => (0, plgg_1.icon)("AsText");
|
|
2467
|
+
exports.asText = asText;
|
|
2468
|
+
const asNum = (unit) => (0, plgg_1.box)("AsNum")((0, plgg_1.fromNullable)(unit));
|
|
2469
|
+
exports.asNum = asNum;
|
|
2470
|
+
const asMoment = () => (0, plgg_1.icon)("AsMoment");
|
|
2471
|
+
exports.asMoment = asMoment;
|
|
2472
|
+
const asFlag = () => (0, plgg_1.icon)("AsFlag");
|
|
2473
|
+
exports.asFlag = asFlag;
|
|
2474
|
+
const asText$ = () => (0, plgg_1.pattern)("AsText")();
|
|
2475
|
+
const asNum$ = () => (0, plgg_1.pattern)("AsNum")();
|
|
2476
|
+
const asMoment$ = () => (0, plgg_1.pattern)("AsMoment")();
|
|
2477
|
+
const asFlag$ = () => (0, plgg_1.pattern)("AsFlag")();
|
|
2478
|
+
const truthy = [
|
|
2479
|
+
"true",
|
|
2480
|
+
"1",
|
|
2481
|
+
"yes",
|
|
2482
|
+
"✓",
|
|
2483
|
+
];
|
|
2484
|
+
const lower = (as, raw) => (0, plgg_1.match)(as)([asText$(), () => (0, Row_1.textValue)(raw)], [
|
|
2485
|
+
asNum$(),
|
|
2486
|
+
({ content }) => (0, plgg_1.matchOption)(() => (0, Row_1.numValue)(raw), (unit) => (0, Row_1.numValue)(raw, unit))(content),
|
|
2487
|
+
], [
|
|
2488
|
+
asMoment$(),
|
|
2489
|
+
() => (0, Row_1.momentValue)(raw),
|
|
2490
|
+
], [
|
|
2491
|
+
asFlag$(),
|
|
2492
|
+
() => (0, Row_1.flagValue)(truthy.includes(raw.toLowerCase())),
|
|
2493
|
+
]);
|
|
2494
|
+
const projectField = (label, key, as) => ({ label, key, as });
|
|
2495
|
+
exports.projectField = projectField;
|
|
2496
|
+
const projection = (p) => ({
|
|
2497
|
+
id: p.id,
|
|
2498
|
+
label: p.label,
|
|
2499
|
+
fields: (0, plgg_1.pipe)((0, plgg_1.fromNullable)(p.fields), (0, plgg_1.getOr)([])),
|
|
2500
|
+
});
|
|
2501
|
+
exports.projection = projection;
|
|
2502
|
+
const valueOf = (record, key) => (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), ([, value]) => (0, plgg_1.fromNullable)(value))((0, plgg_1.fromNullable)(record.find(([k]) => k === key)));
|
|
2503
|
+
const projectRow = (spec) => (record) => (0, Row_1.row)((0, plgg_1.pipe)(valueOf(record, spec.id), (0, plgg_1.getOr)("")), (0, plgg_1.pipe)(valueOf(record, spec.label), (0, plgg_1.getOr)("")), spec.fields.flatMap((fp) => (0, plgg_1.matchOption)(() => [], (raw) => [
|
|
2504
|
+
(0, Row_1.fieldOf)(fp.label, lower(fp.as, raw)),
|
|
2505
|
+
])(valueOf(record, fp.key))));
|
|
2506
|
+
exports.projectRow = projectRow;
|
|
2507
|
+
|
|
2508
|
+
},
|
|
2509
|
+
"src/Declare/usecase/apply.ts": function (module, exports, require) {
|
|
2510
|
+
"use strict";
|
|
2511
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2512
|
+
exports.applyVia = void 0;
|
|
2513
|
+
const plgg_1 = require("plgg");
|
|
2514
|
+
const client_1 = require("plgg-view/client");
|
|
2515
|
+
const Msg_1 = require("src/Schedule/model/Msg.ts");
|
|
2516
|
+
const applyVia = (adapter, actor, collection, build) => (target) => (0, client_1.cmdEffect)(() => adapter.apply(build(target), actor).then((0, plgg_1.matchResult)((e) => (0, Msg_1.failed)(collection, e.message), (ok) => (0, Msg_1.loaded)(ok.collection, ok.rows))));
|
|
2517
|
+
exports.applyVia = applyVia;
|
|
2518
|
+
|
|
2519
|
+
},
|
|
2520
|
+
"src/Declare/model/Query.ts": function (module, exports, require) {
|
|
2521
|
+
"use strict";
|
|
2522
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2523
|
+
exports.matchesChoice = exports.matchesQuery = exports.query = exports.queryChoice = void 0;
|
|
2524
|
+
const Row_1 = require("src/Declare/model/Row.ts");
|
|
2525
|
+
const queryChoice = (id, label, field, options) => ({ id, label, field, options });
|
|
2526
|
+
exports.queryChoice = queryChoice;
|
|
2527
|
+
const query = (placeholder, choices = []) => ({ placeholder, choices });
|
|
2528
|
+
exports.query = query;
|
|
2529
|
+
const matchesQuery = (text, label) => text === "" ||
|
|
2530
|
+
label
|
|
2531
|
+
.toLowerCase()
|
|
2532
|
+
.includes(text.toLowerCase());
|
|
2533
|
+
exports.matchesQuery = matchesQuery;
|
|
2534
|
+
const matchesChoice = (chosen, field, row) => chosen === "" ||
|
|
2535
|
+
row.fields.some((f) => f.label === field &&
|
|
2536
|
+
(0, Row_1.fieldText)(f.value) === chosen);
|
|
2537
|
+
exports.matchesChoice = matchesChoice;
|
|
2538
|
+
|
|
2539
|
+
},
|
|
2540
|
+
"src/Declare/model/Action.ts": function (module, exports, require) {
|
|
2541
|
+
"use strict";
|
|
2542
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2543
|
+
exports.isDestructive = exports.permits = exports.action = exports.confirm$ = exports.immediate$ = exports.confirm = exports.immediate = void 0;
|
|
2544
|
+
const plgg_1 = require("plgg");
|
|
2545
|
+
const immediate = () => (0, plgg_1.icon)("Immediate");
|
|
2546
|
+
exports.immediate = immediate;
|
|
2547
|
+
const confirm = (prompt, destructive = false) => (0, plgg_1.box)("Confirm")({ prompt, destructive });
|
|
2548
|
+
exports.confirm = confirm;
|
|
2549
|
+
const immediate$ = () => (0, plgg_1.pattern)("Immediate")();
|
|
2550
|
+
exports.immediate$ = immediate$;
|
|
2551
|
+
const confirm$ = () => (0, plgg_1.pattern)("Confirm")();
|
|
2552
|
+
exports.confirm$ = confirm$;
|
|
2553
|
+
const action = (a) => ({
|
|
2554
|
+
id: a.id,
|
|
2555
|
+
label: a.label,
|
|
2556
|
+
verb: a.verb,
|
|
2557
|
+
confirm: a.confirm,
|
|
2558
|
+
run: a.run,
|
|
2559
|
+
authorize: (0, plgg_1.fromNullable)(a.authorize),
|
|
2560
|
+
});
|
|
2561
|
+
exports.action = action;
|
|
2562
|
+
const permits = (action, actor, subject) => (0, plgg_1.matchOption)(() => true, (fn) => (0, plgg_1.matchOption)(() => false, (ac) => fn(ac, subject))(actor))(action.authorize);
|
|
2563
|
+
exports.permits = permits;
|
|
2564
|
+
const isDestructive = (c) => (0, plgg_1.match)(c)([(0, exports.immediate$)(), () => false], [
|
|
2565
|
+
(0, exports.confirm$)(),
|
|
2566
|
+
({ content }) => content.destructive,
|
|
2567
|
+
]);
|
|
2568
|
+
exports.isDestructive = isDestructive;
|
|
2569
|
+
|
|
2570
|
+
},
|
|
2571
|
+
"src/Declare/model/Collection.ts": function (module, exports, require) {
|
|
2572
|
+
"use strict";
|
|
2573
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2574
|
+
exports.actionById = exports.collectionById = exports.collection = void 0;
|
|
2575
|
+
const plgg_1 = require("plgg");
|
|
2576
|
+
const Source_1 = require("src/Declare/model/Source.ts");
|
|
2577
|
+
const erase = (source, toRow) => (0, plgg_1.match)(source)([
|
|
2578
|
+
(0, Source_1.sync$)(),
|
|
2579
|
+
({ content }) => (0, plgg_1.box)("Sync")((path) => content(path).map(toRow)),
|
|
2580
|
+
], [
|
|
2581
|
+
(0, Source_1.async$)(),
|
|
2582
|
+
({ content }) => (0, plgg_1.box)("Async")((path) => content(path).then((0, plgg_1.mapResult)((items) => items.map(toRow)))),
|
|
2583
|
+
], [
|
|
2584
|
+
(0, Source_1.dynamic$)(),
|
|
2585
|
+
() => (0, plgg_1.box)("Dynamic")(null),
|
|
2586
|
+
], [
|
|
2587
|
+
(0, Source_1.adapter$)(),
|
|
2588
|
+
({ content }) => (0, plgg_1.box)("Adapter")(content),
|
|
2589
|
+
]);
|
|
2590
|
+
const collection = (c) => ({
|
|
2591
|
+
id: c.id,
|
|
2592
|
+
title: c.title,
|
|
2593
|
+
source: erase(c.source, c.toRow),
|
|
2594
|
+
child: (0, plgg_1.fromNullable)(c.child),
|
|
2595
|
+
query: (0, plgg_1.fromNullable)(c.query),
|
|
2596
|
+
actions: (0, plgg_1.pipe)((0, plgg_1.fromNullable)(c.actions), (0, plgg_1.getOr)([])),
|
|
2597
|
+
board: (0, plgg_1.pipe)((0, plgg_1.fromNullable)(c.board), (0, plgg_1.getOr)(false)),
|
|
2598
|
+
});
|
|
2599
|
+
exports.collection = collection;
|
|
2600
|
+
const collectionById = (collections, id) => (0, plgg_1.fromNullable)(collections.find((c) => c.id === id));
|
|
2601
|
+
exports.collectionById = collectionById;
|
|
2602
|
+
const actionById = (c, id) => (0, plgg_1.fromNullable)(c.actions.find((a) => a.id === id));
|
|
2603
|
+
exports.actionById = actionById;
|
|
2604
|
+
|
|
2605
|
+
},
|
|
2606
|
+
"src/Declare/model/Menu.ts": function (module, exports, require) {
|
|
2607
|
+
"use strict";
|
|
2608
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2609
|
+
exports.menu = exports.menuEntry = void 0;
|
|
2610
|
+
const menuEntry = (label, collection) => ({ label, collection });
|
|
2611
|
+
exports.menuEntry = menuEntry;
|
|
2612
|
+
const menu = (entries) => ({ entries });
|
|
2613
|
+
exports.menu = menu;
|
|
2614
|
+
|
|
2615
|
+
},
|
|
2616
|
+
"src/Declare/model/Declaration.ts": function (module, exports, require) {
|
|
2617
|
+
"use strict";
|
|
2618
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2619
|
+
exports.declare = void 0;
|
|
2620
|
+
const declare = (d) => d;
|
|
2621
|
+
exports.declare = declare;
|
|
2622
|
+
|
|
2623
|
+
},
|
|
2624
|
+
"src/Schedule/model/Model.ts": function (module, exports, require) {
|
|
2625
|
+
"use strict";
|
|
2626
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2627
|
+
exports.setSlot = exports.slotOf = exports.choiceOf = exports.emptyModel = exports.failedSlot$ = exports.loadedSlot$ = exports.loading$ = exports.idle$ = exports.failedSlot = exports.loadedSlot = exports.loading = exports.idle = void 0;
|
|
2628
|
+
const plgg_1 = require("plgg");
|
|
2629
|
+
const idle = () => (0, plgg_1.icon)("Idle");
|
|
2630
|
+
exports.idle = idle;
|
|
2631
|
+
const loading = () => (0, plgg_1.icon)("Loading");
|
|
2632
|
+
exports.loading = loading;
|
|
2633
|
+
const loadedSlot = (rows) => (0, plgg_1.box)("Loaded")(rows);
|
|
2634
|
+
exports.loadedSlot = loadedSlot;
|
|
2635
|
+
const failedSlot = (error) => (0, plgg_1.box)("Failed")(error);
|
|
2636
|
+
exports.failedSlot = failedSlot;
|
|
2637
|
+
const idle$ = () => (0, plgg_1.pattern)("Idle")();
|
|
2638
|
+
exports.idle$ = idle$;
|
|
2639
|
+
const loading$ = () => (0, plgg_1.pattern)("Loading")();
|
|
2640
|
+
exports.loading$ = loading$;
|
|
2641
|
+
const loadedSlot$ = () => (0, plgg_1.pattern)("Loaded")();
|
|
2642
|
+
exports.loadedSlot$ = loadedSlot$;
|
|
2643
|
+
const failedSlot$ = () => (0, plgg_1.pattern)("Failed")();
|
|
2644
|
+
exports.failedSlot$ = failedSlot$;
|
|
2645
|
+
const emptyModel = (base) => ({
|
|
2646
|
+
base,
|
|
2647
|
+
root: (0, plgg_1.none)(),
|
|
2648
|
+
path: [],
|
|
2649
|
+
query: "",
|
|
2650
|
+
queryChoices: [],
|
|
2651
|
+
slots: [],
|
|
2652
|
+
pending: (0, plgg_1.none)(),
|
|
2653
|
+
});
|
|
2654
|
+
exports.emptyModel = emptyModel;
|
|
2655
|
+
const choiceOf = (model, choice) => (0, plgg_1.pipe)((0, plgg_1.fromNullable)(model.queryChoices.find(([id]) => id === choice)), (0, plgg_1.matchOption)(() => "", ([, value]) => value));
|
|
2656
|
+
exports.choiceOf = choiceOf;
|
|
2657
|
+
const slotOf = (model, collection) => (0, plgg_1.pipe)((0, plgg_1.fromNullable)(model.slots.find(([id]) => id === collection)), (0, plgg_1.matchOption)(() => (0, exports.idle)(), ([, slot]) => slot));
|
|
2658
|
+
exports.slotOf = slotOf;
|
|
2659
|
+
const setSlot = (model, collection, slot) => ({
|
|
2660
|
+
...model,
|
|
2661
|
+
slots: [
|
|
2662
|
+
...model.slots.filter(([id]) => id !== collection),
|
|
2663
|
+
[collection, slot],
|
|
2664
|
+
],
|
|
2665
|
+
});
|
|
2666
|
+
exports.setSlot = setSlot;
|
|
2667
|
+
|
|
2668
|
+
},
|
|
2669
|
+
"src/Schedule/model/View.ts": function (module, exports, require) {
|
|
2670
|
+
"use strict";
|
|
2671
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2672
|
+
exports.binding = exports.detailView$ = exports.listView$ = exports.menuView$ = exports.detailView = exports.listView = exports.menuView = void 0;
|
|
2673
|
+
const plgg_1 = require("plgg");
|
|
2674
|
+
const menuView = () => (0, plgg_1.icon)("MenuView");
|
|
2675
|
+
exports.menuView = menuView;
|
|
2676
|
+
const listView = (collection) => (0, plgg_1.box)("ListView")(collection);
|
|
2677
|
+
exports.listView = listView;
|
|
2678
|
+
const detailView = (collection) => (0, plgg_1.box)("DetailView")(collection);
|
|
2679
|
+
exports.detailView = detailView;
|
|
2680
|
+
const menuView$ = () => (0, plgg_1.pattern)("MenuView")();
|
|
2681
|
+
exports.menuView$ = menuView$;
|
|
2682
|
+
const listView$ = () => (0, plgg_1.pattern)("ListView")();
|
|
2683
|
+
exports.listView$ = listView$;
|
|
2684
|
+
const detailView$ = () => (0, plgg_1.pattern)("DetailView")();
|
|
2685
|
+
exports.detailView$ = detailView$;
|
|
2686
|
+
const binding = (collection, id) => ({ collection, id });
|
|
2687
|
+
exports.binding = binding;
|
|
2688
|
+
|
|
2689
|
+
},
|
|
2690
|
+
"src/Schedule/usecase/lower.ts": function (module, exports, require) {
|
|
2691
|
+
"use strict";
|
|
2692
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2693
|
+
exports.sliceOf = exports.focusedView = void 0;
|
|
2694
|
+
const plgg_1 = require("plgg");
|
|
2695
|
+
const View_1 = require("src/Schedule/model/View.ts");
|
|
2696
|
+
const chain_1 = require("src/Schedule/usecase/chain.ts");
|
|
2697
|
+
const focusedView = (declaration) => (root, path) => (0, plgg_1.matchOption)(() => (0, View_1.menuView)(), (r) => viewAt((0, chain_1.chainCollections)(declaration, (0, plgg_1.some)(r)), r, path.length))(root);
|
|
2698
|
+
exports.focusedView = focusedView;
|
|
2699
|
+
const viewAt = (chain, root, depth) => (0, plgg_1.pipe)((0, plgg_1.fromNullable)(chain[depth]), (0, plgg_1.matchOption)(() => beyondChain(chain, root, depth), (c) => (0, View_1.listView)(c.id)));
|
|
2700
|
+
const beyondChain = (chain, root, depth) => (0, plgg_1.pipe)((0, plgg_1.fromNullable)(chain[chain.length - 1]), (0, plgg_1.matchOption)(() => (0, View_1.listView)(root), (last) => depth === chain.length
|
|
2701
|
+
? (0, plgg_1.matchOption)(() => (0, View_1.detailView)(last.id), (childId) => (0, View_1.listView)(childId))(last.child)
|
|
2702
|
+
:
|
|
2703
|
+
(0, View_1.listView)(last.id)));
|
|
2704
|
+
const sliceOf = (to, bindings) => (0, plgg_1.match)(to)([
|
|
2705
|
+
(0, View_1.menuView$)(),
|
|
2706
|
+
() => ({
|
|
2707
|
+
root: (0, plgg_1.none)(),
|
|
2708
|
+
path: [],
|
|
2709
|
+
query: "",
|
|
2710
|
+
}),
|
|
2711
|
+
], [
|
|
2712
|
+
(0, View_1.listView$)(),
|
|
2713
|
+
({ content }) => towards(content, bindings),
|
|
2714
|
+
], [
|
|
2715
|
+
(0, View_1.detailView$)(),
|
|
2716
|
+
({ content }) => towards(content, bindings),
|
|
2717
|
+
]);
|
|
2718
|
+
exports.sliceOf = sliceOf;
|
|
2719
|
+
const towards = (collection, bindings) => ({
|
|
2720
|
+
root: (0, plgg_1.some)((0, plgg_1.pipe)((0, plgg_1.fromNullable)(bindings[0]), (0, plgg_1.matchOption)(() => collection, (b) => b.collection))),
|
|
2721
|
+
path: bindings.map((b) => b.id),
|
|
2722
|
+
query: "",
|
|
2723
|
+
});
|
|
2724
|
+
|
|
2725
|
+
},
|
|
2726
|
+
"src/Schedule/usecase/chain.ts": function (module, exports, require) {
|
|
2727
|
+
"use strict";
|
|
2728
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2729
|
+
exports.ancestorPath = exports.chainCollections = void 0;
|
|
2730
|
+
const plgg_1 = require("plgg");
|
|
2731
|
+
const Collection_1 = require("src/Declare/model/Collection.ts");
|
|
2732
|
+
const chainCollections = (declaration, root) => (0, plgg_1.matchOption)(() => [], (id) => followChain(declaration, id))(root);
|
|
2733
|
+
exports.chainCollections = chainCollections;
|
|
2734
|
+
const followChain = (declaration, id) => (0, plgg_1.matchOption)(() => [], (c) => [
|
|
2735
|
+
c,
|
|
2736
|
+
...(0, plgg_1.matchOption)(() => [], (childId) => followChain(declaration, childId))(c.child),
|
|
2737
|
+
])((0, Collection_1.collectionById)(declaration.collections, id));
|
|
2738
|
+
const ancestorPath = (path, n) => path.slice(0, n);
|
|
2739
|
+
exports.ancestorPath = ancestorPath;
|
|
2740
|
+
|
|
2741
|
+
},
|
|
2742
|
+
"src/Schedule/usecase/codec.ts": function (module, exports, require) {
|
|
2743
|
+
"use strict";
|
|
2744
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2745
|
+
exports.hrefFor = exports.toUrl = exports.parseUrl = void 0;
|
|
2746
|
+
const plgg_1 = require("plgg");
|
|
2747
|
+
const client_1 = require("plgg-view/client");
|
|
2748
|
+
const parseUrl = (url) => {
|
|
2749
|
+
const params = new URLSearchParams(url.search);
|
|
2750
|
+
const rawPath = (0, plgg_1.pipe)((0, plgg_1.fromNullable)(params.get("p")), (0, plgg_1.getOr)(""));
|
|
2751
|
+
return {
|
|
2752
|
+
root: (0, plgg_1.fromNullable)(params.get("c")),
|
|
2753
|
+
path: rawPath === ""
|
|
2754
|
+
? []
|
|
2755
|
+
: rawPath
|
|
2756
|
+
.split("/")
|
|
2757
|
+
.map(decodeURIComponent),
|
|
2758
|
+
query: (0, plgg_1.pipe)((0, plgg_1.fromNullable)(params.get("q")), (0, plgg_1.getOr)("")),
|
|
2759
|
+
choices: [...params.entries()].filter(([key]) => key !== "c" && key !== "p" && key !== "q"),
|
|
2760
|
+
};
|
|
2761
|
+
};
|
|
2762
|
+
exports.parseUrl = parseUrl;
|
|
2763
|
+
const buildSearch = (slice) => {
|
|
2764
|
+
const parts = [
|
|
2765
|
+
...(0, plgg_1.matchOption)(() => [], (r) => [
|
|
2766
|
+
`c=${encodeURIComponent(r)}`,
|
|
2767
|
+
])(slice.root),
|
|
2768
|
+
...(slice.path.length > 0
|
|
2769
|
+
? [
|
|
2770
|
+
`p=${slice.path
|
|
2771
|
+
.map(encodeURIComponent)
|
|
2772
|
+
.join("/")}`,
|
|
2773
|
+
]
|
|
2774
|
+
: []),
|
|
2775
|
+
...(slice.query !== ""
|
|
2776
|
+
? [`q=${encodeURIComponent(slice.query)}`]
|
|
2777
|
+
: []),
|
|
2778
|
+
...(0, plgg_1.pipe)((0, plgg_1.fromNullable)(slice.choices), (0, plgg_1.getOr)([]))
|
|
2779
|
+
.filter(([, value]) => value !== "")
|
|
2780
|
+
.map(([id, value]) => `${encodeURIComponent(id)}=${encodeURIComponent(value)}`),
|
|
2781
|
+
];
|
|
2782
|
+
return parts.length === 0
|
|
2783
|
+
? ""
|
|
2784
|
+
: `?${parts.join("&")}`;
|
|
2785
|
+
};
|
|
2786
|
+
const toUrl = (model) => (0, client_1.makeUrl)(model.base, buildSearch({
|
|
2787
|
+
root: model.root,
|
|
2788
|
+
path: model.path,
|
|
2789
|
+
query: model.query,
|
|
2790
|
+
choices: model.queryChoices,
|
|
2791
|
+
}));
|
|
2792
|
+
exports.toUrl = toUrl;
|
|
2793
|
+
const hrefFor = (base, slice) => `${base}${buildSearch(slice)}`;
|
|
2794
|
+
exports.hrefFor = hrefFor;
|
|
2795
|
+
|
|
2796
|
+
},
|
|
2797
|
+
"src/Schedule/usecase/schedule.ts": function (module, exports, require) {
|
|
2798
|
+
"use strict";
|
|
2799
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2800
|
+
exports.schedule = void 0;
|
|
2801
|
+
const plgg_1 = require("plgg");
|
|
2802
|
+
const reconcile_1 = require("src/Declare/usecase/reconcile.ts");
|
|
2803
|
+
const Model_1 = require("src/Schedule/model/Model.ts");
|
|
2804
|
+
const Msg_1 = require("src/Schedule/model/Msg.ts");
|
|
2805
|
+
const update_1 = require("src/Schedule/usecase/update.ts");
|
|
2806
|
+
const codec_1 = require("src/Schedule/usecase/codec.ts");
|
|
2807
|
+
const scene_1 = require("src/Schedule/usecase/scene.ts");
|
|
2808
|
+
const positionOf = (model) => `${(0, plgg_1.pipe)(model.root, (0, plgg_1.getOr)(""))}|${model.path.join("/")}`;
|
|
2809
|
+
const schedule = (declaration, host = {}) => {
|
|
2810
|
+
const engine = {
|
|
2811
|
+
registry: (0, plgg_1.pipe)((0, plgg_1.fromNullable)(host.adapters), (0, plgg_1.getOr)([])),
|
|
2812
|
+
actor: (0, plgg_1.fromNullable)(host.actor),
|
|
2813
|
+
};
|
|
2814
|
+
const update = (0, update_1.makeUpdate)(declaration, engine);
|
|
2815
|
+
const init = (0, update_1.makeInit)(declaration, engine);
|
|
2816
|
+
const scene = (0, scene_1.makeScene)(declaration, engine.actor);
|
|
2817
|
+
return {
|
|
2818
|
+
init: (url) => {
|
|
2819
|
+
const slice = (0, codec_1.parseUrl)(url);
|
|
2820
|
+
return init(url.path)(slice);
|
|
2821
|
+
},
|
|
2822
|
+
update,
|
|
2823
|
+
onUrlChange: (url) => (0, Msg_1.urlChanged)(url),
|
|
2824
|
+
toUrl: codec_1.toUrl,
|
|
2825
|
+
historyMode: (prev, next) => positionOf(prev) !== positionOf(next)
|
|
2826
|
+
? "push"
|
|
2827
|
+
: "replace",
|
|
2828
|
+
scene,
|
|
2829
|
+
withRows: (model, collectionId, rows) => (0, Model_1.setSlot)(model, collectionId, (0, Model_1.loadedSlot)(rows)),
|
|
2830
|
+
diagnostics: (0, reconcile_1.reconcile)(declaration, engine.registry),
|
|
2831
|
+
};
|
|
2832
|
+
};
|
|
2833
|
+
exports.schedule = schedule;
|
|
2834
|
+
|
|
2835
|
+
},
|
|
2836
|
+
"src/Schedule/usecase/update.ts": function (module, exports, require) {
|
|
2837
|
+
"use strict";
|
|
2838
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2839
|
+
exports.makeInit = exports.makeUpdate = exports.noEngine = void 0;
|
|
2840
|
+
const plgg_1 = require("plgg");
|
|
2841
|
+
const client_1 = require("plgg-view/client");
|
|
2842
|
+
const Collection_1 = require("src/Declare/model/Collection.ts");
|
|
2843
|
+
const Action_1 = require("src/Declare/model/Action.ts");
|
|
2844
|
+
const Adapter_1 = require("src/Declare/model/Adapter.ts");
|
|
2845
|
+
const Source_1 = require("src/Declare/model/Source.ts");
|
|
2846
|
+
const Model_1 = require("src/Schedule/model/Model.ts");
|
|
2847
|
+
const Msg_1 = require("src/Schedule/model/Msg.ts");
|
|
2848
|
+
const codec_1 = require("src/Schedule/usecase/codec.ts");
|
|
2849
|
+
const lower_1 = require("src/Schedule/usecase/lower.ts");
|
|
2850
|
+
const chain_1 = require("src/Schedule/usecase/chain.ts");
|
|
2851
|
+
exports.noEngine = {
|
|
2852
|
+
registry: [],
|
|
2853
|
+
actor: (0, plgg_1.none)(),
|
|
2854
|
+
};
|
|
2855
|
+
const readInto = (registry, model, collection, path) => (0, plgg_1.match)(collection.source)([
|
|
2856
|
+
(0, Source_1.sync$)(),
|
|
2857
|
+
({ content }) => [
|
|
2858
|
+
(0, Model_1.setSlot)(model, collection.id, (0, Model_1.loadedSlot)(content(path))),
|
|
2859
|
+
(0, client_1.cmdNone)(),
|
|
2860
|
+
],
|
|
2861
|
+
], [
|
|
2862
|
+
(0, Source_1.async$)(),
|
|
2863
|
+
({ content }) => [
|
|
2864
|
+
(0, Model_1.setSlot)(model, collection.id, (0, Model_1.loading)()),
|
|
2865
|
+
(0, client_1.cmdEffect)(() => content(path).then((0, plgg_1.matchResult)((e) => (0, Msg_1.failed)(collection.id, e.message), (rows) => (0, Msg_1.loaded)(collection.id, rows)))),
|
|
2866
|
+
],
|
|
2867
|
+
], [(0, Source_1.dynamic$)(), () => [model, (0, client_1.cmdNone)()]], [
|
|
2868
|
+
(0, Source_1.adapter$)(),
|
|
2869
|
+
({ content }) => (0, plgg_1.matchOption)(() => [
|
|
2870
|
+
(0, Model_1.setSlot)(model, collection.id, (0, Model_1.failedSlot)("unresolved host adapter")),
|
|
2871
|
+
(0, client_1.cmdNone)(),
|
|
2872
|
+
], (ad) => [
|
|
2873
|
+
(0, Model_1.setSlot)(model, collection.id, (0, Model_1.loading)()),
|
|
2874
|
+
(0, client_1.cmdEffect)(() => ad
|
|
2875
|
+
.read((0, Adapter_1.scope)(collection.id, path))
|
|
2876
|
+
.then((0, plgg_1.matchResult)((e) => (0, Msg_1.failed)(collection.id, e.message), (rows) => (0, Msg_1.loaded)(collection.id, rows)))),
|
|
2877
|
+
])((0, Adapter_1.resolveAdapter)(registry, content)),
|
|
2878
|
+
]);
|
|
2879
|
+
const ensureChain = (declaration, registry) => (model) => {
|
|
2880
|
+
const chain = (0, chain_1.chainCollections)(declaration, model.root);
|
|
2881
|
+
const [next, cmds] = chain
|
|
2882
|
+
.map((collection, index) => ({
|
|
2883
|
+
collection,
|
|
2884
|
+
index,
|
|
2885
|
+
}))
|
|
2886
|
+
.filter((e) => e.index <= model.path.length)
|
|
2887
|
+
.reduce(([m, acc], e) => {
|
|
2888
|
+
const [m2, cmd] = readInto(registry, m, e.collection, (0, chain_1.ancestorPath)(model.path, e.index));
|
|
2889
|
+
return [m2, [...acc, cmd]];
|
|
2890
|
+
}, [model, []]);
|
|
2891
|
+
return [next, (0, client_1.cmdBatch)(cmds)];
|
|
2892
|
+
};
|
|
2893
|
+
const normalizeChoices = (declaration, entries) => declaration.collections
|
|
2894
|
+
.flatMap((c) => (0, plgg_1.matchOption)(() => [], (q) => q.choices)(c.query))
|
|
2895
|
+
.flatMap((choice) => (0, plgg_1.matchOption)(() => [], ([, value]) => {
|
|
2896
|
+
const chosen = [choice.id, value];
|
|
2897
|
+
return value === "" ? [] : [chosen];
|
|
2898
|
+
})((0, plgg_1.fromNullable)(entries.find(([id]) => id === choice.id))));
|
|
2899
|
+
const goto = (declaration, registry) => (model, slice) => ensureChain(declaration, registry)({
|
|
2900
|
+
...model,
|
|
2901
|
+
root: slice.root,
|
|
2902
|
+
path: slice.path,
|
|
2903
|
+
query: slice.query,
|
|
2904
|
+
queryChoices: normalizeChoices(declaration, (0, plgg_1.pipe)((0, plgg_1.fromNullable)(slice.choices), (0, plgg_1.getOr)([]))),
|
|
2905
|
+
pending: (0, plgg_1.none)(),
|
|
2906
|
+
});
|
|
2907
|
+
const runAction = (action, target) => action.run(target);
|
|
2908
|
+
const requestActionStep = (declaration, actor, model, collection, actionId, target) => (0, plgg_1.matchOption)(() => [model, (0, client_1.cmdNone)()], (c) => (0, plgg_1.matchOption)(() => [model, (0, client_1.cmdNone)()], (a) => !(0, Action_1.permits)(a, actor, target)
|
|
2909
|
+
? [model, (0, client_1.cmdNone)()]
|
|
2910
|
+
: (0, plgg_1.match)(a.confirm)([
|
|
2911
|
+
(0, Action_1.immediate$)(),
|
|
2912
|
+
() => [
|
|
2913
|
+
model,
|
|
2914
|
+
runAction(a, target),
|
|
2915
|
+
],
|
|
2916
|
+
], [
|
|
2917
|
+
(0, Action_1.confirm$)(),
|
|
2918
|
+
({ content }) => [
|
|
2919
|
+
{
|
|
2920
|
+
...model,
|
|
2921
|
+
pending: (0, plgg_1.some)({
|
|
2922
|
+
collection,
|
|
2923
|
+
action: a,
|
|
2924
|
+
target,
|
|
2925
|
+
prompt: content.prompt,
|
|
2926
|
+
destructive: content.destructive,
|
|
2927
|
+
}),
|
|
2928
|
+
},
|
|
2929
|
+
(0, client_1.cmdNone)(),
|
|
2930
|
+
],
|
|
2931
|
+
]))((0, Collection_1.actionById)(c, actionId)))((0, Collection_1.collectionById)(declaration.collections, collection));
|
|
2932
|
+
const makeUpdate = (declaration, options) => (msg, model) => (0, plgg_1.match)(msg)([
|
|
2933
|
+
(0, Msg_1.navigate$)(),
|
|
2934
|
+
({ content }) => goto(declaration, options.registry)(model, (0, lower_1.sliceOf)(content.to, content.with)),
|
|
2935
|
+
], [
|
|
2936
|
+
(0, Msg_1.urlChanged$)(),
|
|
2937
|
+
({ content }) => goto(declaration, options.registry)(model, (0, codec_1.parseUrl)(content)),
|
|
2938
|
+
], [
|
|
2939
|
+
(0, Msg_1.openMenu$)(),
|
|
2940
|
+
({ content }) => goto(declaration, options.registry)(model, {
|
|
2941
|
+
root: (0, plgg_1.some)(content),
|
|
2942
|
+
path: [],
|
|
2943
|
+
query: "",
|
|
2944
|
+
}),
|
|
2945
|
+
], [
|
|
2946
|
+
(0, Msg_1.select$)(),
|
|
2947
|
+
({ content }) => goto(declaration, options.registry)(model, {
|
|
2948
|
+
root: model.root,
|
|
2949
|
+
path: [
|
|
2950
|
+
...(0, chain_1.ancestorPath)(model.path, content.level),
|
|
2951
|
+
content.id,
|
|
2952
|
+
],
|
|
2953
|
+
query: "",
|
|
2954
|
+
}),
|
|
2955
|
+
], [
|
|
2956
|
+
(0, Msg_1.queryInput$)(),
|
|
2957
|
+
({ content }) => [
|
|
2958
|
+
{ ...model, query: content },
|
|
2959
|
+
(0, client_1.cmdNone)(),
|
|
2960
|
+
],
|
|
2961
|
+
], [
|
|
2962
|
+
(0, Msg_1.queryChoiceInput$)(),
|
|
2963
|
+
({ content }) => [
|
|
2964
|
+
{
|
|
2965
|
+
...model,
|
|
2966
|
+
queryChoices: normalizeChoices(declaration, [
|
|
2967
|
+
...model.queryChoices.filter(([id]) => id !== content.choice),
|
|
2968
|
+
[content.choice, content.value],
|
|
2969
|
+
]),
|
|
2970
|
+
},
|
|
2971
|
+
(0, client_1.cmdNone)(),
|
|
2972
|
+
],
|
|
2973
|
+
], [
|
|
2974
|
+
(0, Msg_1.requestAction$)(),
|
|
2975
|
+
({ content }) => requestActionStep(declaration, options.actor, model, content.collection, content.action, content.target),
|
|
2976
|
+
], [
|
|
2977
|
+
(0, Msg_1.confirmAction$)(),
|
|
2978
|
+
() => (0, plgg_1.matchOption)(() => [model, (0, client_1.cmdNone)()], (p) => (0, Action_1.permits)(p.action, options.actor, p.target)
|
|
2979
|
+
? [
|
|
2980
|
+
{ ...model, pending: (0, plgg_1.none)() },
|
|
2981
|
+
runAction(p.action, p.target),
|
|
2982
|
+
]
|
|
2983
|
+
: [
|
|
2984
|
+
{ ...model, pending: (0, plgg_1.none)() },
|
|
2985
|
+
(0, client_1.cmdNone)(),
|
|
2986
|
+
])(model.pending),
|
|
2987
|
+
], [
|
|
2988
|
+
(0, Msg_1.cancelAction$)(),
|
|
2989
|
+
() => [
|
|
2990
|
+
{ ...model, pending: (0, plgg_1.none)() },
|
|
2991
|
+
(0, client_1.cmdNone)(),
|
|
2992
|
+
],
|
|
2993
|
+
], [
|
|
2994
|
+
(0, Msg_1.loaded$)(),
|
|
2995
|
+
({ content }) => [
|
|
2996
|
+
(0, Model_1.setSlot)(model, content.collection, (0, Model_1.loadedSlot)(content.rows)),
|
|
2997
|
+
(0, client_1.cmdNone)(),
|
|
2998
|
+
],
|
|
2999
|
+
], [
|
|
3000
|
+
(0, Msg_1.failed$)(),
|
|
3001
|
+
({ content }) => [
|
|
3002
|
+
(0, Model_1.setSlot)(model, content.collection, (0, Model_1.failedSlot)(content.error)),
|
|
3003
|
+
(0, client_1.cmdNone)(),
|
|
3004
|
+
],
|
|
3005
|
+
]);
|
|
3006
|
+
exports.makeUpdate = makeUpdate;
|
|
3007
|
+
const makeInit = (declaration, options) => (base) => (slice) => goto(declaration, options.registry)((0, Model_1.emptyModel)(base), slice);
|
|
3008
|
+
exports.makeInit = makeInit;
|
|
3009
|
+
|
|
3010
|
+
},
|
|
3011
|
+
"src/Schedule/usecase/scene.ts": function (module, exports, require) {
|
|
3012
|
+
"use strict";
|
|
3013
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3014
|
+
exports.makeScene = void 0;
|
|
3015
|
+
const plgg_1 = require("plgg");
|
|
3016
|
+
const Row_1 = require("src/Declare/model/Row.ts");
|
|
3017
|
+
const Action_1 = require("src/Declare/model/Action.ts");
|
|
3018
|
+
const Query_1 = require("src/Declare/model/Query.ts");
|
|
3019
|
+
const Model_1 = require("src/Schedule/model/Model.ts");
|
|
3020
|
+
const Scene_1 = require("src/Schedule/model/Scene.ts");
|
|
3021
|
+
const View_1 = require("src/Schedule/model/View.ts");
|
|
3022
|
+
const codec_1 = require("src/Schedule/usecase/codec.ts");
|
|
3023
|
+
const lower_1 = require("src/Schedule/usecase/lower.ts");
|
|
3024
|
+
const chain_1 = require("src/Schedule/usecase/chain.ts");
|
|
3025
|
+
const readSlot = (slot) => (0, plgg_1.match)(slot)([
|
|
3026
|
+
(0, Model_1.idle$)(),
|
|
3027
|
+
() => ({
|
|
3028
|
+
rows: [],
|
|
3029
|
+
loading: false,
|
|
3030
|
+
error: (0, plgg_1.none)(),
|
|
3031
|
+
}),
|
|
3032
|
+
], [
|
|
3033
|
+
(0, Model_1.loading$)(),
|
|
3034
|
+
() => ({
|
|
3035
|
+
rows: [],
|
|
3036
|
+
loading: true,
|
|
3037
|
+
error: (0, plgg_1.none)(),
|
|
3038
|
+
}),
|
|
3039
|
+
], [
|
|
3040
|
+
(0, Model_1.loadedSlot$)(),
|
|
3041
|
+
({ content }) => ({
|
|
3042
|
+
rows: content,
|
|
3043
|
+
loading: false,
|
|
3044
|
+
error: (0, plgg_1.none)(),
|
|
3045
|
+
}),
|
|
3046
|
+
], [
|
|
3047
|
+
(0, Model_1.failedSlot$)(),
|
|
3048
|
+
({ content }) => ({
|
|
3049
|
+
rows: [],
|
|
3050
|
+
loading: false,
|
|
3051
|
+
error: (0, plgg_1.some)(content),
|
|
3052
|
+
}),
|
|
3053
|
+
]);
|
|
3054
|
+
const projectAction = (a) => ({
|
|
3055
|
+
id: a.id,
|
|
3056
|
+
label: a.label,
|
|
3057
|
+
verb: a.verb,
|
|
3058
|
+
destructive: (0, Action_1.isDestructive)(a.confirm),
|
|
3059
|
+
});
|
|
3060
|
+
const drillHref = (model, level, id) => (0, codec_1.hrefFor)(model.base, {
|
|
3061
|
+
root: model.root,
|
|
3062
|
+
path: [
|
|
3063
|
+
...(0, chain_1.ancestorPath)(model.path, level),
|
|
3064
|
+
id,
|
|
3065
|
+
],
|
|
3066
|
+
query: "",
|
|
3067
|
+
});
|
|
3068
|
+
const truncateHref = (model, n) => (0, codec_1.hrefFor)(model.base, {
|
|
3069
|
+
root: model.root,
|
|
3070
|
+
path: (0, chain_1.ancestorPath)(model.path, n),
|
|
3071
|
+
query: "",
|
|
3072
|
+
});
|
|
3073
|
+
const menuOnlyHref = (model) => (0, codec_1.hrefFor)(model.base, {
|
|
3074
|
+
root: (0, plgg_1.none)(),
|
|
3075
|
+
path: [],
|
|
3076
|
+
query: "",
|
|
3077
|
+
});
|
|
3078
|
+
const choicesOf = (collection) => (0, plgg_1.matchOption)(() => [], (q) => q.choices)(collection.query);
|
|
3079
|
+
const buildListLevel = (model, actor, collection, index, activeListIndex) => {
|
|
3080
|
+
const view = readSlot((0, Model_1.slotOf)(model, collection.id));
|
|
3081
|
+
const isActive = index === activeListIndex;
|
|
3082
|
+
const filtered = isActive && (0, plgg_1.isSome)(collection.query)
|
|
3083
|
+
? view.rows.filter((r) => (0, Query_1.matchesQuery)(model.query, r.label) &&
|
|
3084
|
+
choicesOf(collection).every((c) => (0, Query_1.matchesChoice)((0, Model_1.choiceOf)(model, c.id), c.field, r)))
|
|
3085
|
+
: view.rows;
|
|
3086
|
+
const selectedId = (0, plgg_1.fromNullable)(model.path[index]);
|
|
3087
|
+
return (0, Scene_1.listLevel)({
|
|
3088
|
+
collection: collection.id,
|
|
3089
|
+
title: collection.title,
|
|
3090
|
+
back: index === 0
|
|
3091
|
+
? (0, plgg_1.some)(menuOnlyHref(model))
|
|
3092
|
+
: (0, plgg_1.some)(truncateHref(model, index - 1)),
|
|
3093
|
+
query: isActive
|
|
3094
|
+
? (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (q) => (0, plgg_1.some)({
|
|
3095
|
+
placeholder: q.placeholder,
|
|
3096
|
+
text: model.query,
|
|
3097
|
+
choices: q.choices.map((c) => ({
|
|
3098
|
+
id: c.id,
|
|
3099
|
+
label: c.label,
|
|
3100
|
+
options: c.options,
|
|
3101
|
+
value: (0, Model_1.choiceOf)(model, c.id),
|
|
3102
|
+
})),
|
|
3103
|
+
}))(collection.query)
|
|
3104
|
+
: (0, plgg_1.none)(),
|
|
3105
|
+
rows: filtered.map((r) => ({
|
|
3106
|
+
row: r,
|
|
3107
|
+
href: drillHref(model, index, r.id),
|
|
3108
|
+
active: (0, plgg_1.matchOption)(() => false, (sid) => sid === r.id)(selectedId),
|
|
3109
|
+
})),
|
|
3110
|
+
loading: view.loading,
|
|
3111
|
+
error: view.error,
|
|
3112
|
+
actions: collection.actions
|
|
3113
|
+
.filter((a) => a.verb === "create")
|
|
3114
|
+
.filter((a) => (0, Action_1.permits)(a, actor, (0, plgg_1.none)()))
|
|
3115
|
+
.map((a) => projectAction(a)),
|
|
3116
|
+
});
|
|
3117
|
+
};
|
|
3118
|
+
const tileJumpHref = (model, t) => t.id === ""
|
|
3119
|
+
? (0, codec_1.hrefFor)(model.base, (0, lower_1.sliceOf)((0, View_1.listView)(t.collection), []))
|
|
3120
|
+
: (0, codec_1.hrefFor)(model.base, (0, lower_1.sliceOf)((0, View_1.detailView)(t.collection), [
|
|
3121
|
+
(0, View_1.binding)(t.collection, t.id),
|
|
3122
|
+
]));
|
|
3123
|
+
const firstRef = (fields) => (0, plgg_1.fromNullable)(fields.flatMap((f) => (0, plgg_1.matchOption)(() => [], (t) => [t])((0, Row_1.refTarget)(f.value)))[0]);
|
|
3124
|
+
const tileOf = (model) => (r) => ({
|
|
3125
|
+
label: r.label,
|
|
3126
|
+
caption: (0, plgg_1.matchOption)(() => "", (f) => (0, Row_1.fieldText)(f.value))((0, plgg_1.fromNullable)(r.fields[0])),
|
|
3127
|
+
href: (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (t) => (0, plgg_1.some)(tileJumpHref(model, t)))(firstRef(r.fields)),
|
|
3128
|
+
});
|
|
3129
|
+
const buildBoardLevel = (model, collection, index) => {
|
|
3130
|
+
const view = readSlot((0, Model_1.slotOf)(model, collection.id));
|
|
3131
|
+
return (0, Scene_1.boardLevel)({
|
|
3132
|
+
collection: collection.id,
|
|
3133
|
+
title: collection.title,
|
|
3134
|
+
back: index === 0
|
|
3135
|
+
? (0, plgg_1.some)(menuOnlyHref(model))
|
|
3136
|
+
: (0, plgg_1.some)(truncateHref(model, index - 1)),
|
|
3137
|
+
tiles: view.rows.map(tileOf(model)),
|
|
3138
|
+
loading: view.loading,
|
|
3139
|
+
error: view.error,
|
|
3140
|
+
});
|
|
3141
|
+
};
|
|
3142
|
+
const buildDetail = (model, actor, focused, chain) => (0, plgg_1.match)(focused)([(0, View_1.menuView$)(), () => []], [(0, View_1.listView$)(), () => []], [
|
|
3143
|
+
(0, View_1.detailView$)(),
|
|
3144
|
+
({ content }) => (0, plgg_1.matchOption)(() => [], (c) => c.board
|
|
3145
|
+
? []
|
|
3146
|
+
: detailFor(model, actor, c))((0, plgg_1.fromNullable)(chain.find((c) => c.id === content))),
|
|
3147
|
+
]);
|
|
3148
|
+
const projectFields = (model, fields) => fields.map((f) => ({
|
|
3149
|
+
label: f.label,
|
|
3150
|
+
value: f.value,
|
|
3151
|
+
href: (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (t) => (0, plgg_1.some)((0, codec_1.hrefFor)(model.base, (0, lower_1.sliceOf)((0, View_1.detailView)(t.collection), [
|
|
3152
|
+
(0, View_1.binding)(t.collection, t.id),
|
|
3153
|
+
]))))((0, Row_1.refTarget)(f.value)),
|
|
3154
|
+
}));
|
|
3155
|
+
const detailFor = (model, actor, c) => (0, plgg_1.matchOption)(() => [], (rowId) => {
|
|
3156
|
+
const found = (0, plgg_1.fromNullable)(readSlot((0, Model_1.slotOf)(model, c.id)).rows.find((r) => r.id === rowId));
|
|
3157
|
+
return [
|
|
3158
|
+
(0, Scene_1.detailLevel)({
|
|
3159
|
+
collection: c.id,
|
|
3160
|
+
title: (0, plgg_1.matchOption)(() => c.title, (r) => r.label)(found),
|
|
3161
|
+
back: (0, plgg_1.some)(truncateHref(model, model.path.length - 1)),
|
|
3162
|
+
row: found,
|
|
3163
|
+
fields: (0, plgg_1.matchOption)(() => [], (r) => projectFields(model, r.fields))(found),
|
|
3164
|
+
actions: c.actions
|
|
3165
|
+
.filter((a) => a.verb !== "create")
|
|
3166
|
+
.filter((a) => (0, Action_1.permits)(a, actor, (0, plgg_1.some)(rowId)))
|
|
3167
|
+
.map((a) => projectAction(a)),
|
|
3168
|
+
}),
|
|
3169
|
+
];
|
|
3170
|
+
})((0, plgg_1.fromNullable)(model.path[model.path.length - 1]));
|
|
3171
|
+
const makeScene = (declaration, actor) => (model) => {
|
|
3172
|
+
const chain = (0, chain_1.chainCollections)(declaration, model.root);
|
|
3173
|
+
const focused = (0, lower_1.focusedView)(declaration)(model.root, model.path);
|
|
3174
|
+
const activeListIndex = (0, plgg_1.match)(focused)([(0, View_1.menuView$)(), () => -1], [
|
|
3175
|
+
(0, View_1.listView$)(),
|
|
3176
|
+
({ content }) => {
|
|
3177
|
+
const at = chain.findIndex((c) => c.id === content);
|
|
3178
|
+
return at >= 0 ? at : chain.length - 1;
|
|
3179
|
+
},
|
|
3180
|
+
], [
|
|
3181
|
+
(0, View_1.detailView$)(),
|
|
3182
|
+
() => chain.length - 1,
|
|
3183
|
+
]);
|
|
3184
|
+
return {
|
|
3185
|
+
title: declaration.title,
|
|
3186
|
+
levels: [
|
|
3187
|
+
(0, Scene_1.menuLevel)(declaration.title, declaration.menu.entries.map((e) => ({
|
|
3188
|
+
label: e.label,
|
|
3189
|
+
href: (0, codec_1.hrefFor)(model.base, {
|
|
3190
|
+
root: (0, plgg_1.some)(e.collection),
|
|
3191
|
+
path: [],
|
|
3192
|
+
query: "",
|
|
3193
|
+
}),
|
|
3194
|
+
active: (0, plgg_1.matchOption)(() => false, (r) => r === e.collection)(model.root),
|
|
3195
|
+
}))),
|
|
3196
|
+
...chain
|
|
3197
|
+
.map((collection, index) => ({
|
|
3198
|
+
collection,
|
|
3199
|
+
index,
|
|
3200
|
+
}))
|
|
3201
|
+
.filter((e) => e.index <= model.path.length)
|
|
3202
|
+
.map((e) => e.collection.board
|
|
3203
|
+
? buildBoardLevel(model, e.collection, e.index)
|
|
3204
|
+
: buildListLevel(model, actor, e.collection, e.index, activeListIndex)),
|
|
3205
|
+
...buildDetail(model, actor, focused, chain),
|
|
3206
|
+
],
|
|
3207
|
+
confirm: (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (p) => (0, plgg_1.some)({
|
|
3208
|
+
prompt: p.prompt,
|
|
3209
|
+
destructive: p.destructive,
|
|
3210
|
+
}))(model.pending),
|
|
3211
|
+
};
|
|
3212
|
+
};
|
|
3213
|
+
exports.makeScene = makeScene;
|
|
3214
|
+
|
|
3215
|
+
},
|
|
3216
|
+
"src/Flow/model/run.ts": function (module, exports, require) {
|
|
3217
|
+
"use strict";
|
|
3218
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3219
|
+
exports.bind = exports.emptyEnv = exports.defaultFuel = exports.flowFailed$ = exports.flowDone$ = exports.flowPaused$ = exports.flowFailed = exports.flowDone = exports.flowPaused = void 0;
|
|
3220
|
+
const plgg_1 = require("plgg");
|
|
3221
|
+
const flowPaused = (p) => (0, plgg_1.box)("FlowPaused")(p);
|
|
3222
|
+
exports.flowPaused = flowPaused;
|
|
3223
|
+
const flowDone = (value) => (0, plgg_1.box)("FlowDone")(value);
|
|
3224
|
+
exports.flowDone = flowDone;
|
|
3225
|
+
const flowFailed = (code, at) => (0, plgg_1.box)("FlowFailed")({ code, at });
|
|
3226
|
+
exports.flowFailed = flowFailed;
|
|
3227
|
+
const flowPaused$ = () => (0, plgg_1.pattern)("FlowPaused")();
|
|
3228
|
+
exports.flowPaused$ = flowPaused$;
|
|
3229
|
+
const flowDone$ = () => (0, plgg_1.pattern)("FlowDone")();
|
|
3230
|
+
exports.flowDone$ = flowDone$;
|
|
3231
|
+
const flowFailed$ = () => (0, plgg_1.pattern)("FlowFailed")();
|
|
3232
|
+
exports.flowFailed$ = flowFailed$;
|
|
3233
|
+
exports.defaultFuel = 10000;
|
|
3234
|
+
const emptyEnv = () => ({});
|
|
3235
|
+
exports.emptyEnv = emptyEnv;
|
|
3236
|
+
const bind = (env, name, value) => ({ ...env, [name]: value });
|
|
3237
|
+
exports.bind = bind;
|
|
3238
|
+
|
|
3239
|
+
},
|
|
3240
|
+
"src/Flow/model/forms.ts": function (module, exports, require) {
|
|
3241
|
+
"use strict";
|
|
3242
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3243
|
+
exports.hasChoice = exports.fieldIsNumeric = exports.collectionSchema = exports.flowSchema = void 0;
|
|
3244
|
+
const plgg_1 = require("plgg");
|
|
3245
|
+
const flowSchema = (collections) => ({ collections });
|
|
3246
|
+
exports.flowSchema = flowSchema;
|
|
3247
|
+
const collectionSchema = (schema, id) => (0, plgg_1.fromNullable)(schema.collections.find((c) => c.id === id));
|
|
3248
|
+
exports.collectionSchema = collectionSchema;
|
|
3249
|
+
const fieldIsNumeric = (cs, kw) => kw === "label" || kw === "id"
|
|
3250
|
+
? false
|
|
3251
|
+
: (0, plgg_1.matchOption)(() => false, (f) => f.numeric)((0, plgg_1.fromNullable)(cs.fields.find((f) => f.kw === kw)));
|
|
3252
|
+
exports.fieldIsNumeric = fieldIsNumeric;
|
|
3253
|
+
const hasChoice = (cs, choiceId) => cs.choices.some((c) => c === choiceId);
|
|
3254
|
+
exports.hasChoice = hasChoice;
|
|
3255
|
+
|
|
3256
|
+
},
|
|
3257
|
+
"src/Flow/usecase/read.ts": function (module, exports, require) {
|
|
3258
|
+
"use strict";
|
|
3259
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3260
|
+
exports.readFlow = void 0;
|
|
3261
|
+
const plgg_1 = require("plgg");
|
|
3262
|
+
const plgg_ir_syntax_1 = require("plgg-ir-syntax");
|
|
3263
|
+
const plgg_ir_language_1 = require("plgg-ir-language");
|
|
3264
|
+
const Msg_1 = require("src/Schedule/model/Msg.ts");
|
|
3265
|
+
const script_1 = require("src/Flow/model/script.ts");
|
|
3266
|
+
const forms_1 = require("src/Flow/model/forms.ts");
|
|
3267
|
+
const tStr = (0, plgg_1.box)("TStr")(null);
|
|
3268
|
+
const tNum = (0, plgg_1.box)("TNum")(null);
|
|
3269
|
+
const tRow = (c) => (0, plgg_1.box)("TRow")(c);
|
|
3270
|
+
const tList = (el) => (0, plgg_1.box)("TList")({ el });
|
|
3271
|
+
const tOption = (el) => (0, plgg_1.box)("TOption")({ el });
|
|
3272
|
+
const tResult = (el) => (0, plgg_1.box)("TResult")({ el });
|
|
3273
|
+
const fail = (code, message, range) => (0, plgg_1.err)([(0, plgg_ir_language_1.semError)(code, message, range)]);
|
|
3274
|
+
const symName = (s) => s !== undefined && (0, plgg_ir_syntax_1.isSymbolExp)(s)
|
|
3275
|
+
? (0, plgg_1.some)(s.content.name)
|
|
3276
|
+
: (0, plgg_1.none)();
|
|
3277
|
+
const rangeOf = (s) => s === undefined ? emptyRange() : (0, plgg_ir_syntax_1.sexpRange)(s);
|
|
3278
|
+
const headName = (items) => (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (h) => symName(h))((0, plgg_1.fromNullable)(items[0]));
|
|
3279
|
+
const listItems = (s) => s !== undefined && (0, plgg_ir_syntax_1.isListExp)(s)
|
|
3280
|
+
? (0, plgg_1.some)(s.content.items)
|
|
3281
|
+
: (0, plgg_1.none)();
|
|
3282
|
+
const lookupEnv = (env, name) => (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (b) => (0, plgg_1.some)(b.type))((0, plgg_1.fromNullable)(env.find((b) => b.name === name)));
|
|
3283
|
+
const asName = (s) => symName(s);
|
|
3284
|
+
const asKeyword = asName;
|
|
3285
|
+
const csOf = (schema, id) => (0, plgg_1.getOr)({
|
|
3286
|
+
id,
|
|
3287
|
+
fields: [],
|
|
3288
|
+
choices: [],
|
|
3289
|
+
})((0, forms_1.collectionSchema)(schema, id));
|
|
3290
|
+
const kwType = (cs, kw) => (0, forms_1.fieldIsNumeric)(cs, kw) ? tNum : tStr;
|
|
3291
|
+
const rowColl = (t) => t.__tag === "TRow" ? t.content : "";
|
|
3292
|
+
const checkExpr = (schema, env, s) => {
|
|
3293
|
+
if ((0, plgg_ir_syntax_1.isStrExp)(s))
|
|
3294
|
+
return (0, plgg_1.ok)({
|
|
3295
|
+
expr: (0, script_1.strLit)(s.content.value),
|
|
3296
|
+
type: tStr,
|
|
3297
|
+
});
|
|
3298
|
+
if ((0, plgg_ir_syntax_1.isNumExp)(s))
|
|
3299
|
+
return (0, plgg_1.ok)({
|
|
3300
|
+
expr: (0, script_1.numLit)(s.content.value),
|
|
3301
|
+
type: tNum,
|
|
3302
|
+
});
|
|
3303
|
+
if ((0, plgg_ir_syntax_1.isSymbolExp)(s)) {
|
|
3304
|
+
const name = s.content.name;
|
|
3305
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeUnknownName, `unbound name '${name}'`, (0, plgg_ir_syntax_1.sexpRange)(s)), (t) => (0, plgg_1.ok)({ expr: (0, script_1.varRef)(name), type: t }))(lookupEnv(env, name));
|
|
3306
|
+
}
|
|
3307
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "expected an expression", (0, plgg_ir_syntax_1.sexpRange)(s)), (items) => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "expected a form head", (0, plgg_ir_syntax_1.sexpRange)(s)), (h) => checkForm(schema, env, s, h, items.slice(1)))(headName(items)))(listItems(s));
|
|
3308
|
+
};
|
|
3309
|
+
const checkForm = (schema, env, whole, head, args) => {
|
|
3310
|
+
const range = (0, plgg_ir_syntax_1.sexpRange)(whole);
|
|
3311
|
+
switch (head) {
|
|
3312
|
+
case "scene-rows":
|
|
3313
|
+
return checkSceneRows(schema, args, range);
|
|
3314
|
+
case "map":
|
|
3315
|
+
return checkMap(schema, env, args, range);
|
|
3316
|
+
case "get":
|
|
3317
|
+
return checkGet(schema, env, args, range);
|
|
3318
|
+
case "first":
|
|
3319
|
+
return checkFirst(schema, env, args, range);
|
|
3320
|
+
case "count":
|
|
3321
|
+
return checkCount(schema, env, args, range);
|
|
3322
|
+
case "sum":
|
|
3323
|
+
return checkSum(schema, env, args, range);
|
|
3324
|
+
case "ok":
|
|
3325
|
+
return checkWrap(schema, env, args, range, script_1.okOf, tResult);
|
|
3326
|
+
case "some":
|
|
3327
|
+
return checkWrap(schema, env, args, range, script_1.someOf, tOption);
|
|
3328
|
+
case "err":
|
|
3329
|
+
return checkErr(args, range);
|
|
3330
|
+
case "none":
|
|
3331
|
+
return args.length === 0
|
|
3332
|
+
? (0, plgg_1.ok)({
|
|
3333
|
+
expr: (0, script_1.noneOf)(),
|
|
3334
|
+
type: tOption(tStr),
|
|
3335
|
+
})
|
|
3336
|
+
: fail(plgg_ir_language_1.codeArityMismatch, "none takes no arguments", range);
|
|
3337
|
+
case "match-empty":
|
|
3338
|
+
return checkMatchEmpty(schema, env, args, range);
|
|
3339
|
+
case "match-option":
|
|
3340
|
+
return checkMatchOption(schema, env, args, range);
|
|
3341
|
+
default:
|
|
3342
|
+
return fail(plgg_ir_language_1.codeUnknownForm, `unknown form or function '${head}'`, range);
|
|
3343
|
+
}
|
|
3344
|
+
};
|
|
3345
|
+
const withArity = (args, n, head, range, then) => args.length === n
|
|
3346
|
+
? then()
|
|
3347
|
+
: fail(plgg_ir_language_1.codeArityMismatch, `${head} takes ${n} argument(s), got ${args.length}`, range);
|
|
3348
|
+
const checkSceneRows = (schema, args, range) => withArity(args, 1, "scene-rows", range, () => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "scene-rows needs a collection name", range), (coll) => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeUnknownName, `unknown collection '${coll}'`, range), () => (0, plgg_1.ok)({
|
|
3349
|
+
expr: (0, script_1.sceneRows)(coll),
|
|
3350
|
+
type: tList(tRow(coll)),
|
|
3351
|
+
}))((0, forms_1.collectionSchema)(schema, coll)))(asName(args[0])));
|
|
3352
|
+
const checkMap = (schema, env, args, range) => withArity(args, 2, "map", range, () => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "map needs a :keyword first", range), (kw) => {
|
|
3353
|
+
const of = checkExpr(schema, env, args[1]);
|
|
3354
|
+
if ((0, plgg_1.isErr)(of))
|
|
3355
|
+
return of;
|
|
3356
|
+
const t = of.content.type;
|
|
3357
|
+
return t.__tag === "TList" &&
|
|
3358
|
+
t.content.el.__tag === "TRow"
|
|
3359
|
+
? (0, plgg_1.ok)({
|
|
3360
|
+
expr: (0, script_1.mapKw)(kw, of.content.expr),
|
|
3361
|
+
type: tList(kwType(csOf(schema, rowColl(t.content.el)), kw)),
|
|
3362
|
+
})
|
|
3363
|
+
: fail(plgg_ir_language_1.codeTypeMismatch, "map expects a list of rows", range);
|
|
3364
|
+
})(asKeyword(args[0])));
|
|
3365
|
+
const checkGet = (schema, env, args, range) => withArity(args, 2, "get", range, () => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "get needs a :keyword first", range), (kw) => {
|
|
3366
|
+
const of = checkExpr(schema, env, args[1]);
|
|
3367
|
+
if ((0, plgg_1.isErr)(of))
|
|
3368
|
+
return of;
|
|
3369
|
+
const t = of.content.type;
|
|
3370
|
+
return t.__tag === "TRow"
|
|
3371
|
+
? (0, plgg_1.ok)({
|
|
3372
|
+
expr: (0, script_1.getKw)(kw, of.content.expr),
|
|
3373
|
+
type: tOption(kwType(csOf(schema, t.content), kw)),
|
|
3374
|
+
})
|
|
3375
|
+
: fail(plgg_ir_language_1.codeTypeMismatch, "get expects a row", range);
|
|
3376
|
+
})(asKeyword(args[0])));
|
|
3377
|
+
const checkFirst = (schema, env, args, range) => withArity(args, 1, "first", range, () => {
|
|
3378
|
+
const of = checkExpr(schema, env, args[0]);
|
|
3379
|
+
if ((0, plgg_1.isErr)(of))
|
|
3380
|
+
return of;
|
|
3381
|
+
const t = of.content.type;
|
|
3382
|
+
return t.__tag === "TList"
|
|
3383
|
+
? (0, plgg_1.ok)({
|
|
3384
|
+
expr: (0, script_1.firstOf)(of.content.expr),
|
|
3385
|
+
type: tOption(t.content.el),
|
|
3386
|
+
})
|
|
3387
|
+
: fail(plgg_ir_language_1.codeTypeMismatch, "first expects a list", range);
|
|
3388
|
+
});
|
|
3389
|
+
const checkCount = (schema, env, args, range) => withArity(args, 1, "count", range, () => {
|
|
3390
|
+
const of = checkExpr(schema, env, args[0]);
|
|
3391
|
+
if ((0, plgg_1.isErr)(of))
|
|
3392
|
+
return of;
|
|
3393
|
+
return of.content.type.__tag === "TList"
|
|
3394
|
+
? (0, plgg_1.ok)({
|
|
3395
|
+
expr: (0, script_1.countOf)(of.content.expr),
|
|
3396
|
+
type: tNum,
|
|
3397
|
+
})
|
|
3398
|
+
: fail(plgg_ir_language_1.codeTypeMismatch, "count expects a list", range);
|
|
3399
|
+
});
|
|
3400
|
+
const checkSum = (schema, env, args, range) => withArity(args, 1, "sum", range, () => {
|
|
3401
|
+
const of = checkExpr(schema, env, args[0]);
|
|
3402
|
+
if ((0, plgg_1.isErr)(of))
|
|
3403
|
+
return of;
|
|
3404
|
+
const t = of.content.type;
|
|
3405
|
+
return t.__tag === "TList" &&
|
|
3406
|
+
t.content.el.__tag === "TNum"
|
|
3407
|
+
? (0, plgg_1.ok)({
|
|
3408
|
+
expr: (0, script_1.sumOf)(of.content.expr),
|
|
3409
|
+
type: tNum,
|
|
3410
|
+
})
|
|
3411
|
+
: fail(plgg_ir_language_1.codeTypeMismatch, "sum expects a list of numbers", range);
|
|
3412
|
+
});
|
|
3413
|
+
const checkWrap = (schema, env, args, range, wrap, ty) => withArity(args, 1, "wrap", range, () => {
|
|
3414
|
+
const of = checkExpr(schema, env, args[0]);
|
|
3415
|
+
if ((0, plgg_1.isErr)(of))
|
|
3416
|
+
return of;
|
|
3417
|
+
return (0, plgg_1.ok)({
|
|
3418
|
+
expr: wrap(of.content.expr),
|
|
3419
|
+
type: ty(of.content.type),
|
|
3420
|
+
});
|
|
3421
|
+
});
|
|
3422
|
+
const checkErr = (args, range) => withArity(args, 1, "err", range, () => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "err needs a :keyword", range), (kw) => (0, plgg_1.ok)({
|
|
3423
|
+
expr: (0, script_1.errOf)(kw),
|
|
3424
|
+
type: tResult(tStr),
|
|
3425
|
+
}))(asKeyword(args[0])));
|
|
3426
|
+
const checkMatchEmpty = (schema, env, args, range) => withArity(args, 4, "match-empty", range, () => {
|
|
3427
|
+
const of = checkExpr(schema, env, args[0]);
|
|
3428
|
+
if ((0, plgg_1.isErr)(of))
|
|
3429
|
+
return of;
|
|
3430
|
+
const t = of.content.type;
|
|
3431
|
+
if (t.__tag !== "TList")
|
|
3432
|
+
return fail(plgg_ir_language_1.codeTypeMismatch, "match-empty expects a list", range);
|
|
3433
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "match-empty needs a bind name", range), (bindName) => {
|
|
3434
|
+
const empty = checkExpr(schema, env, args[1]);
|
|
3435
|
+
if ((0, plgg_1.isErr)(empty))
|
|
3436
|
+
return empty;
|
|
3437
|
+
const rest = checkExpr(schema, [{ name: bindName, type: t }, ...env], args[3]);
|
|
3438
|
+
if ((0, plgg_1.isErr)(rest))
|
|
3439
|
+
return rest;
|
|
3440
|
+
return (0, plgg_1.ok)({
|
|
3441
|
+
expr: (0, script_1.matchEmpty)({
|
|
3442
|
+
of: of.content.expr,
|
|
3443
|
+
whenEmpty: empty.content.expr,
|
|
3444
|
+
bind: bindName,
|
|
3445
|
+
whenRest: rest.content.expr,
|
|
3446
|
+
}),
|
|
3447
|
+
type: rest.content.type,
|
|
3448
|
+
});
|
|
3449
|
+
})(asName(args[2]));
|
|
3450
|
+
});
|
|
3451
|
+
const checkMatchOption = (schema, env, args, range) => withArity(args, 4, "match-option", range, () => {
|
|
3452
|
+
const of = checkExpr(schema, env, args[0]);
|
|
3453
|
+
if ((0, plgg_1.isErr)(of))
|
|
3454
|
+
return of;
|
|
3455
|
+
const t = of.content.type;
|
|
3456
|
+
if (t.__tag !== "TOption")
|
|
3457
|
+
return fail(plgg_ir_language_1.codeTypeMismatch, "match-option expects an option", range);
|
|
3458
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "match-option needs a bind name", range), (bindName) => {
|
|
3459
|
+
const noneB = checkExpr(schema, env, args[1]);
|
|
3460
|
+
if ((0, plgg_1.isErr)(noneB))
|
|
3461
|
+
return noneB;
|
|
3462
|
+
const someB = checkExpr(schema, [
|
|
3463
|
+
{
|
|
3464
|
+
name: bindName,
|
|
3465
|
+
type: t.content.el,
|
|
3466
|
+
},
|
|
3467
|
+
...env,
|
|
3468
|
+
], args[3]);
|
|
3469
|
+
if ((0, plgg_1.isErr)(someB))
|
|
3470
|
+
return someB;
|
|
3471
|
+
return (0, plgg_1.ok)({
|
|
3472
|
+
expr: (0, script_1.matchOption)({
|
|
3473
|
+
of: of.content.expr,
|
|
3474
|
+
whenNone: noneB.content.expr,
|
|
3475
|
+
bind: bindName,
|
|
3476
|
+
whenSome: someB.content.expr,
|
|
3477
|
+
}),
|
|
3478
|
+
type: someB.content.type,
|
|
3479
|
+
});
|
|
3480
|
+
})(asName(args[2]));
|
|
3481
|
+
});
|
|
3482
|
+
const readMsg = (schema, s) => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "dispatch needs a message form", rangeOf(s)), (items) => {
|
|
3483
|
+
const range = rangeOf(s);
|
|
3484
|
+
const a = items.slice(1);
|
|
3485
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "expected a message head", range), (h) => {
|
|
3486
|
+
switch (h) {
|
|
3487
|
+
case "open-menu":
|
|
3488
|
+
return sym1(a, range, Msg_1.openMenu);
|
|
3489
|
+
case "query-input":
|
|
3490
|
+
return str1(a, range, Msg_1.queryInput);
|
|
3491
|
+
case "query-choice":
|
|
3492
|
+
return choiceMsg(schema, a, range);
|
|
3493
|
+
case "select":
|
|
3494
|
+
return numStr(a, range, Msg_1.select);
|
|
3495
|
+
case "request-action":
|
|
3496
|
+
return symSym(a, range, (c, act) => (0, Msg_1.requestAction)(c, act, (0, plgg_1.none)()));
|
|
3497
|
+
default:
|
|
3498
|
+
return fail(plgg_ir_language_1.codeUnknownForm, `unknown message '${h}'`, range);
|
|
3499
|
+
}
|
|
3500
|
+
})(headName(items));
|
|
3501
|
+
})(listItems(s));
|
|
3502
|
+
const atStr = (a, i) => (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (n) => (0, plgg_ir_syntax_1.isStrExp)(n)
|
|
3503
|
+
? (0, plgg_1.some)(n.content.value)
|
|
3504
|
+
: (0, plgg_1.none)())((0, plgg_1.fromNullable)(a[i]));
|
|
3505
|
+
const atNum = (a, i) => (0, plgg_1.matchOption)(() => (0, plgg_1.none)(), (n) => (0, plgg_ir_syntax_1.isNumExp)(n)
|
|
3506
|
+
? (0, plgg_1.some)(n.content.value)
|
|
3507
|
+
: (0, plgg_1.none)())((0, plgg_1.fromNullable)(a[i]));
|
|
3508
|
+
const sym1 = (a, range, f) => (0, plgg_1.matchOption)(() => badMsg(range, "expected a name"), (id) => (0, plgg_1.ok)(f(id)))(asName(a[0]));
|
|
3509
|
+
const str1 = (a, range, f) => (0, plgg_1.matchOption)(() => badMsg(range, "expected a string"), (v) => (0, plgg_1.ok)(f(v)))(atStr(a, 0));
|
|
3510
|
+
const choiceMsg = (schema, a, range) => bothO(asName(a[0]), atStr(a, 1), () => badMsg(range, "query-choice expects a choice id and a string"), (id, value) => schema.collections.some((cs) => (0, forms_1.hasChoice)(cs, id))
|
|
3511
|
+
? (0, plgg_1.ok)((0, Msg_1.queryChoiceInput)(id, value))
|
|
3512
|
+
: fail(plgg_ir_language_1.codeUnknownName, `unknown query choice '${id}'`, range));
|
|
3513
|
+
const symSym = (a, range, f) => bothO(asName(a[0]), asName(a[1]), () => badMsg(range, "expected two names"), (x, y) => (0, plgg_1.ok)(f(x, y)));
|
|
3514
|
+
const numStr = (a, range, f) => bothO(atNum(a, 0), atStr(a, 1), () => badMsg(range, "expected a number and a string"), (n, v) => (0, plgg_1.ok)(f(n, v)));
|
|
3515
|
+
const badMsg = (range, message) => fail(plgg_ir_language_1.codeInvalidForm, message, range);
|
|
3516
|
+
const bothO = (a, b, onNone, onBoth) => (0, plgg_1.matchOption)(onNone, (av) => (0, plgg_1.matchOption)(onNone, (bv) => onBoth(av, bv))(b))(a);
|
|
3517
|
+
const readStep = (schema, env, s) => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "a step must be (dispatch …) or (let …)", (0, plgg_ir_syntax_1.sexpRange)(s)), (items) => {
|
|
3518
|
+
const range = (0, plgg_ir_syntax_1.sexpRange)(s);
|
|
3519
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "a step needs a head", range), (h) => {
|
|
3520
|
+
if (h === "dispatch") {
|
|
3521
|
+
const m = readMsg(schema, items[1]);
|
|
3522
|
+
return (0, plgg_1.isErr)(m)
|
|
3523
|
+
? (0, plgg_1.err)(m.content)
|
|
3524
|
+
: (0, plgg_1.ok)({
|
|
3525
|
+
step: (0, script_1.dispatchStep)(m.content),
|
|
3526
|
+
env,
|
|
3527
|
+
});
|
|
3528
|
+
}
|
|
3529
|
+
if (h === "let")
|
|
3530
|
+
return readLet(schema, env, items, range);
|
|
3531
|
+
return fail(plgg_ir_language_1.codeUnknownForm, `a step must be dispatch or let, got '${h}'`, range);
|
|
3532
|
+
})(headName(items));
|
|
3533
|
+
})(listItems(s));
|
|
3534
|
+
const readLet = (schema, env, items, range) => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "let needs a name", range), (nm) => (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "let needs a value expression", range), (valForm) => {
|
|
3535
|
+
const val = checkExpr(schema, env, valForm);
|
|
3536
|
+
if ((0, plgg_1.isErr)(val))
|
|
3537
|
+
return (0, plgg_1.err)(val.content);
|
|
3538
|
+
return (0, plgg_1.ok)({
|
|
3539
|
+
step: (0, script_1.bindStep)(nm, val.content.expr),
|
|
3540
|
+
env: [
|
|
3541
|
+
{
|
|
3542
|
+
name: nm,
|
|
3543
|
+
type: val.content.type,
|
|
3544
|
+
},
|
|
3545
|
+
...env,
|
|
3546
|
+
],
|
|
3547
|
+
});
|
|
3548
|
+
})((0, plgg_1.fromNullable)(items[2])))(asName(items[1]));
|
|
3549
|
+
const readBody = (schema, forms, range) => {
|
|
3550
|
+
if (forms.length === 0)
|
|
3551
|
+
return fail(plgg_ir_language_1.codeInvalidForm, "a flow needs a result expression", range);
|
|
3552
|
+
const stepForms = forms.slice(0, -1);
|
|
3553
|
+
const resultForm = forms[forms.length - 1];
|
|
3554
|
+
const steps = [];
|
|
3555
|
+
let env = [];
|
|
3556
|
+
for (const sf of stepForms) {
|
|
3557
|
+
const parsed = readStep(schema, env, sf);
|
|
3558
|
+
if ((0, plgg_1.isErr)(parsed))
|
|
3559
|
+
return (0, plgg_1.err)(parsed.content);
|
|
3560
|
+
steps.push(parsed.content.step);
|
|
3561
|
+
env = parsed.content.env;
|
|
3562
|
+
}
|
|
3563
|
+
const result = checkExpr(schema, env, resultForm);
|
|
3564
|
+
if ((0, plgg_1.isErr)(result))
|
|
3565
|
+
return (0, plgg_1.err)(result.content);
|
|
3566
|
+
return (0, plgg_1.ok)({
|
|
3567
|
+
steps,
|
|
3568
|
+
result: result.content.expr,
|
|
3569
|
+
});
|
|
3570
|
+
};
|
|
3571
|
+
const readFlow = (source, schema) => {
|
|
3572
|
+
const parsed = (0, plgg_ir_syntax_1.parseSexps)(source);
|
|
3573
|
+
if ((0, plgg_1.isErr)(parsed))
|
|
3574
|
+
return (0, plgg_1.err)(parsed.content.map(plgg_ir_language_1.fromSyntaxDiagnostic));
|
|
3575
|
+
const forms = parsed.content;
|
|
3576
|
+
if (forms.length !== 1)
|
|
3577
|
+
return (0, plgg_1.err)([
|
|
3578
|
+
(0, plgg_ir_language_1.semError)(plgg_ir_language_1.codeInvalidForm, "expected exactly one (flow …) form", emptyRange()),
|
|
3579
|
+
]);
|
|
3580
|
+
const top = forms[0];
|
|
3581
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "top level must be a (flow …) form", (0, plgg_ir_syntax_1.sexpRange)(top)), (items) => {
|
|
3582
|
+
const range = (0, plgg_ir_syntax_1.sexpRange)(top);
|
|
3583
|
+
const isFlow = (0, plgg_1.matchOption)(() => false, (n) => n === "flow")(headName(items));
|
|
3584
|
+
if (!isFlow)
|
|
3585
|
+
return fail(plgg_ir_language_1.codeInvalidForm, "top level must be a (flow …) form", range);
|
|
3586
|
+
return (0, plgg_1.matchOption)(() => fail(plgg_ir_language_1.codeInvalidForm, "a flow needs a name", range), (nm) => {
|
|
3587
|
+
const body = readBody(schema, items.slice(2), range);
|
|
3588
|
+
if ((0, plgg_1.isErr)(body))
|
|
3589
|
+
return (0, plgg_1.err)(body.content);
|
|
3590
|
+
return (0, plgg_1.ok)((0, script_1.flowScript)({
|
|
3591
|
+
name: nm,
|
|
3592
|
+
steps: body.content.steps,
|
|
3593
|
+
result: body.content.result,
|
|
3594
|
+
}));
|
|
3595
|
+
})(asName(items[1]));
|
|
3596
|
+
})(listItems(top));
|
|
3597
|
+
};
|
|
3598
|
+
exports.readFlow = readFlow;
|
|
3599
|
+
const emptyRange = () => ({
|
|
3600
|
+
start: { offset: 0, line: 1, column: 1 },
|
|
3601
|
+
end: { offset: 0, line: 1, column: 1 },
|
|
3602
|
+
});
|
|
3603
|
+
|
|
3604
|
+
},
|
|
3605
|
+
"src/Flow/model/script.ts": function (module, exports, require) {
|
|
3606
|
+
"use strict";
|
|
3607
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3608
|
+
exports.flowScript = exports.bindStep$ = exports.dispatchStep$ = exports.bindStep = exports.dispatchStep = exports.matchOption$ = exports.matchEmpty$ = exports.noneOf$ = exports.someOf$ = exports.errOf$ = exports.okOf$ = exports.app$ = exports.getKw$ = exports.mapKw$ = exports.sceneRows$ = exports.varRef$ = exports.numLit$ = exports.strLit$ = exports.matchOption = exports.matchEmpty = exports.noneOf = exports.someOf = exports.errOf = exports.okOf = exports.sumOf = exports.countOf = exports.firstOf = exports.app = exports.getKw = exports.mapKw = exports.sceneRows = exports.varRef = exports.numLit = exports.strLit = exports.vErr$ = exports.vOk$ = exports.vSome$ = exports.vNone$ = exports.vRow$ = exports.vList$ = exports.vNum$ = exports.vStr$ = exports.vErr = exports.vOk = exports.vSome = exports.vNone = exports.vRow = exports.vList = exports.vNum = exports.vStr = void 0;
|
|
3609
|
+
const plgg_1 = require("plgg");
|
|
3610
|
+
const vStr = (s) => (0, plgg_1.box)("VStr")(s);
|
|
3611
|
+
exports.vStr = vStr;
|
|
3612
|
+
const vNum = (n) => (0, plgg_1.box)("VNum")(n);
|
|
3613
|
+
exports.vNum = vNum;
|
|
3614
|
+
const vList = (items) => (0, plgg_1.box)("VList")({ items });
|
|
3615
|
+
exports.vList = vList;
|
|
3616
|
+
const vRow = (r) => (0, plgg_1.box)("VRow")(r);
|
|
3617
|
+
exports.vRow = vRow;
|
|
3618
|
+
const vNone = () => (0, plgg_1.icon)("VNone");
|
|
3619
|
+
exports.vNone = vNone;
|
|
3620
|
+
const vSome = (v) => (0, plgg_1.box)("VSome")({ value: v });
|
|
3621
|
+
exports.vSome = vSome;
|
|
3622
|
+
const vOk = (v) => (0, plgg_1.box)("VOk")({ value: v });
|
|
3623
|
+
exports.vOk = vOk;
|
|
3624
|
+
const vErr = (kw) => (0, plgg_1.box)("VErr")(kw);
|
|
3625
|
+
exports.vErr = vErr;
|
|
3626
|
+
const vStr$ = () => (0, plgg_1.pattern)("VStr")();
|
|
3627
|
+
exports.vStr$ = vStr$;
|
|
3628
|
+
const vNum$ = () => (0, plgg_1.pattern)("VNum")();
|
|
3629
|
+
exports.vNum$ = vNum$;
|
|
3630
|
+
const vList$ = () => (0, plgg_1.pattern)("VList")();
|
|
3631
|
+
exports.vList$ = vList$;
|
|
3632
|
+
const vRow$ = () => (0, plgg_1.pattern)("VRow")();
|
|
3633
|
+
exports.vRow$ = vRow$;
|
|
3634
|
+
const vNone$ = () => (0, plgg_1.pattern)("VNone")();
|
|
3635
|
+
exports.vNone$ = vNone$;
|
|
3636
|
+
const vSome$ = () => (0, plgg_1.pattern)("VSome")();
|
|
3637
|
+
exports.vSome$ = vSome$;
|
|
3638
|
+
const vOk$ = () => (0, plgg_1.pattern)("VOk")();
|
|
3639
|
+
exports.vOk$ = vOk$;
|
|
3640
|
+
const vErr$ = () => (0, plgg_1.pattern)("VErr")();
|
|
3641
|
+
exports.vErr$ = vErr$;
|
|
3642
|
+
const strLit = (s) => (0, plgg_1.box)("EStr")(s);
|
|
3643
|
+
exports.strLit = strLit;
|
|
3644
|
+
const numLit = (n) => (0, plgg_1.box)("ENum")(n);
|
|
3645
|
+
exports.numLit = numLit;
|
|
3646
|
+
const varRef = (name) => (0, plgg_1.box)("EVar")(name);
|
|
3647
|
+
exports.varRef = varRef;
|
|
3648
|
+
const sceneRows = (collection) => (0, plgg_1.box)("ESceneRows")(collection);
|
|
3649
|
+
exports.sceneRows = sceneRows;
|
|
3650
|
+
const mapKw = (kw, of) => (0, plgg_1.box)("EProj")({ kw, of });
|
|
3651
|
+
exports.mapKw = mapKw;
|
|
3652
|
+
const getKw = (kw, of) => (0, plgg_1.box)("EGet")({ kw, of });
|
|
3653
|
+
exports.getKw = getKw;
|
|
3654
|
+
const app = (op, args) => (0, plgg_1.box)("EApp")({ op, args });
|
|
3655
|
+
exports.app = app;
|
|
3656
|
+
const firstOf = (of) => (0, exports.app)("first", [of]);
|
|
3657
|
+
exports.firstOf = firstOf;
|
|
3658
|
+
const countOf = (of) => (0, exports.app)("count", [of]);
|
|
3659
|
+
exports.countOf = countOf;
|
|
3660
|
+
const sumOf = (of) => (0, exports.app)("sum", [of]);
|
|
3661
|
+
exports.sumOf = sumOf;
|
|
3662
|
+
const okOf = (of) => (0, plgg_1.box)("EOk")({ of });
|
|
3663
|
+
exports.okOf = okOf;
|
|
3664
|
+
const errOf = (kw) => (0, plgg_1.box)("EErr")(kw);
|
|
3665
|
+
exports.errOf = errOf;
|
|
3666
|
+
const someOf = (of) => (0, plgg_1.box)("ESome")({ of });
|
|
3667
|
+
exports.someOf = someOf;
|
|
3668
|
+
const noneOf = () => (0, plgg_1.icon)("ENone");
|
|
3669
|
+
exports.noneOf = noneOf;
|
|
3670
|
+
const matchEmpty = (m) => (0, plgg_1.box)("EMatchEmpty")(m);
|
|
3671
|
+
exports.matchEmpty = matchEmpty;
|
|
3672
|
+
const matchOption = (m) => (0, plgg_1.box)("EMatchOption")(m);
|
|
3673
|
+
exports.matchOption = matchOption;
|
|
3674
|
+
const strLit$ = () => (0, plgg_1.pattern)("EStr")();
|
|
3675
|
+
exports.strLit$ = strLit$;
|
|
3676
|
+
const numLit$ = () => (0, plgg_1.pattern)("ENum")();
|
|
3677
|
+
exports.numLit$ = numLit$;
|
|
3678
|
+
const varRef$ = () => (0, plgg_1.pattern)("EVar")();
|
|
3679
|
+
exports.varRef$ = varRef$;
|
|
3680
|
+
const sceneRows$ = () => (0, plgg_1.pattern)("ESceneRows")();
|
|
3681
|
+
exports.sceneRows$ = sceneRows$;
|
|
3682
|
+
const mapKw$ = () => (0, plgg_1.pattern)("EProj")();
|
|
3683
|
+
exports.mapKw$ = mapKw$;
|
|
3684
|
+
const getKw$ = () => (0, plgg_1.pattern)("EGet")();
|
|
3685
|
+
exports.getKw$ = getKw$;
|
|
3686
|
+
const app$ = () => (0, plgg_1.pattern)("EApp")();
|
|
3687
|
+
exports.app$ = app$;
|
|
3688
|
+
const okOf$ = () => (0, plgg_1.pattern)("EOk")();
|
|
3689
|
+
exports.okOf$ = okOf$;
|
|
3690
|
+
const errOf$ = () => (0, plgg_1.pattern)("EErr")();
|
|
3691
|
+
exports.errOf$ = errOf$;
|
|
3692
|
+
const someOf$ = () => (0, plgg_1.pattern)("ESome")();
|
|
3693
|
+
exports.someOf$ = someOf$;
|
|
3694
|
+
const noneOf$ = () => (0, plgg_1.pattern)("ENone")();
|
|
3695
|
+
exports.noneOf$ = noneOf$;
|
|
3696
|
+
const matchEmpty$ = () => (0, plgg_1.pattern)("EMatchEmpty")();
|
|
3697
|
+
exports.matchEmpty$ = matchEmpty$;
|
|
3698
|
+
const matchOption$ = () => (0, plgg_1.pattern)("EMatchOption")();
|
|
3699
|
+
exports.matchOption$ = matchOption$;
|
|
3700
|
+
const dispatchStep = (msg) => (0, plgg_1.box)("DispatchStep")(msg);
|
|
3701
|
+
exports.dispatchStep = dispatchStep;
|
|
3702
|
+
const bindStep = (name, expr) => (0, plgg_1.box)("BindStep")({ name, expr });
|
|
3703
|
+
exports.bindStep = bindStep;
|
|
3704
|
+
const dispatchStep$ = () => (0, plgg_1.pattern)("DispatchStep")();
|
|
3705
|
+
exports.dispatchStep$ = dispatchStep$;
|
|
3706
|
+
const bindStep$ = () => (0, plgg_1.pattern)("BindStep")();
|
|
3707
|
+
exports.bindStep$ = bindStep$;
|
|
3708
|
+
const flowScript = (s) => s;
|
|
3709
|
+
exports.flowScript = flowScript;
|
|
3710
|
+
|
|
3711
|
+
},
|
|
3712
|
+
"src/Flow/usecase/interpret.ts": function (module, exports, require) {
|
|
3713
|
+
"use strict";
|
|
3714
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3715
|
+
exports.resumeFlow = exports.startFlow = void 0;
|
|
3716
|
+
const plgg_1 = require("plgg");
|
|
3717
|
+
const Row_1 = require("src/Declare/model/Row.ts");
|
|
3718
|
+
const Scene_1 = require("src/Schedule/model/Scene.ts");
|
|
3719
|
+
const script_1 = require("src/Flow/model/script.ts");
|
|
3720
|
+
const run_1 = require("src/Flow/model/run.ts");
|
|
3721
|
+
const evalOk = (value, fuel) => (0, plgg_1.box)("EvalOk")({ value, fuel });
|
|
3722
|
+
const evalFail = (code, at) => (0, plgg_1.box)("EvalFail")({ code, at });
|
|
3723
|
+
const evalOk$ = () => (0, plgg_1.pattern)("EvalOk")();
|
|
3724
|
+
const evalFail$ = () => (0, plgg_1.pattern)("EvalFail")();
|
|
3725
|
+
const rowsOf = (scene, collection) => (0, plgg_1.fromNullable)(scene.levels.flatMap((level) => (0, plgg_1.match)(level)([
|
|
3726
|
+
(0, Scene_1.listLevel$)(),
|
|
3727
|
+
({ content, }) => content.collection === collection
|
|
3728
|
+
? [
|
|
3729
|
+
content.rows.map((r) => r.row),
|
|
3730
|
+
]
|
|
3731
|
+
: [],
|
|
3732
|
+
], [
|
|
3733
|
+
(0, Scene_1.menuLevel$)(),
|
|
3734
|
+
() => [],
|
|
3735
|
+
], [
|
|
3736
|
+
(0, Scene_1.boardLevel$)(),
|
|
3737
|
+
() => [],
|
|
3738
|
+
], [
|
|
3739
|
+
(0, Scene_1.detailLevel$)(),
|
|
3740
|
+
() => [],
|
|
3741
|
+
]))[0]);
|
|
3742
|
+
const isNumField = (v) => (0, plgg_1.match)(v)([(0, Row_1.textValue$)(), () => false], [(0, Row_1.numValue$)(), () => true], [(0, Row_1.flagValue$)(), () => false], [(0, Row_1.momentValue$)(), () => false], [(0, Row_1.refValue$)(), () => false], [(0, Row_1.mediaValue$)(), () => false]);
|
|
3743
|
+
const projectKw = (kw, r) => kw === "label"
|
|
3744
|
+
? (0, script_1.vStr)(r.label)
|
|
3745
|
+
: kw === "id"
|
|
3746
|
+
? (0, script_1.vStr)(r.id)
|
|
3747
|
+
: (0, plgg_1.matchOption)(() => (0, script_1.vStr)(""), (f) => isNumField(f.value)
|
|
3748
|
+
? (0, script_1.vNum)(Number((0, Row_1.fieldText)(f.value)))
|
|
3749
|
+
: (0, script_1.vStr)((0, Row_1.fieldText)(f.value)))((0, plgg_1.fromNullable)(r.fields.find((f) => f.label === kw)));
|
|
3750
|
+
const lookupKw = (kw, r) => kw === "label" ||
|
|
3751
|
+
kw === "id" ||
|
|
3752
|
+
r.fields.some((f) => f.label === kw)
|
|
3753
|
+
? (0, script_1.vSome)(projectKw(kw, r))
|
|
3754
|
+
: (0, script_1.vNone)();
|
|
3755
|
+
const listItems = (v) => (0, plgg_1.match)(v)([(0, script_1.vStr$)(), () => (0, plgg_1.none)()], [(0, script_1.vNum$)(), () => (0, plgg_1.none)()], [
|
|
3756
|
+
(0, script_1.vList$)(),
|
|
3757
|
+
({ content }) => (0, plgg_1.some)(content.items),
|
|
3758
|
+
], [(0, script_1.vRow$)(), () => (0, plgg_1.none)()], [(0, script_1.vNone$)(), () => (0, plgg_1.none)()], [(0, script_1.vSome$)(), () => (0, plgg_1.none)()], [(0, script_1.vOk$)(), () => (0, plgg_1.none)()], [(0, script_1.vErr$)(), () => (0, plgg_1.none)()]);
|
|
3759
|
+
const rowItem = (v) => (0, plgg_1.match)(v)([(0, script_1.vStr$)(), () => (0, plgg_1.none)()], [(0, script_1.vNum$)(), () => (0, plgg_1.none)()], [(0, script_1.vList$)(), () => (0, plgg_1.none)()], [
|
|
3760
|
+
(0, script_1.vRow$)(),
|
|
3761
|
+
({ content }) => (0, plgg_1.some)(content),
|
|
3762
|
+
], [(0, script_1.vNone$)(), () => (0, plgg_1.none)()], [(0, script_1.vSome$)(), () => (0, plgg_1.none)()], [(0, script_1.vOk$)(), () => (0, plgg_1.none)()], [(0, script_1.vErr$)(), () => (0, plgg_1.none)()]);
|
|
3763
|
+
const optShape = (v) => (0, plgg_1.match)(v)([(0, script_1.vStr$)(), () => (0, plgg_1.icon)("NotOption")], [(0, script_1.vNum$)(), () => (0, plgg_1.icon)("NotOption")], [(0, script_1.vList$)(), () => (0, plgg_1.icon)("NotOption")], [(0, script_1.vRow$)(), () => (0, plgg_1.icon)("NotOption")], [(0, script_1.vNone$)(), () => (0, plgg_1.icon)("IsNone")], [
|
|
3764
|
+
(0, script_1.vSome$)(),
|
|
3765
|
+
({ content }) => (0, plgg_1.box)("IsSome")(content.value),
|
|
3766
|
+
], [(0, script_1.vOk$)(), () => (0, plgg_1.icon)("NotOption")], [(0, script_1.vErr$)(), () => (0, plgg_1.icon)("NotOption")]);
|
|
3767
|
+
const isSome$ = () => (0, plgg_1.pattern)("IsSome")();
|
|
3768
|
+
const isNone$ = () => (0, plgg_1.pattern)("IsNone")();
|
|
3769
|
+
const notOption$ = () => (0, plgg_1.pattern)("NotOption")();
|
|
3770
|
+
const onEval = (out, then) => (0, plgg_1.match)(out)([
|
|
3771
|
+
evalOk$(),
|
|
3772
|
+
({ content }) => then(content.value, content.fuel),
|
|
3773
|
+
], [
|
|
3774
|
+
evalFail$(),
|
|
3775
|
+
({ content }) => (0, plgg_1.box)("EvalFail")(content),
|
|
3776
|
+
]);
|
|
3777
|
+
const onList = (out, at, then) => onEval(out, (value, fuel) => (0, plgg_1.matchOption)(() => evalFail("type-mismatch", at), (items) => then(items, fuel))(listItems(value)));
|
|
3778
|
+
const numbersOf = (items) => {
|
|
3779
|
+
const nums = items.flatMap((item) => (0, plgg_1.match)(item)([(0, script_1.vStr$)(), () => []], [
|
|
3780
|
+
(0, script_1.vNum$)(),
|
|
3781
|
+
({ content }) => [
|
|
3782
|
+
content,
|
|
3783
|
+
],
|
|
3784
|
+
], [(0, script_1.vList$)(), () => []], [(0, script_1.vRow$)(), () => []], [(0, script_1.vNone$)(), () => []], [(0, script_1.vSome$)(), () => []], [(0, script_1.vOk$)(), () => []], [(0, script_1.vErr$)(), () => []]));
|
|
3785
|
+
return nums.length === items.length
|
|
3786
|
+
? (0, plgg_1.some)(nums)
|
|
3787
|
+
: (0, plgg_1.none)();
|
|
3788
|
+
};
|
|
3789
|
+
const applyHost = (op, args, at, fuel) => {
|
|
3790
|
+
const one = (0, plgg_1.fromNullable)(args[0]);
|
|
3791
|
+
return (0, plgg_1.matchOption)(() => evalFail("type-mismatch", at), (arg) => (0, plgg_1.matchOption)(() => evalFail("type-mismatch", at), (items) => op === "first"
|
|
3792
|
+
? (0, plgg_1.matchOption)(() => evalOk((0, script_1.vNone)(), fuel), (head) => evalOk((0, script_1.vSome)(head), fuel))((0, plgg_1.fromNullable)(items[0]))
|
|
3793
|
+
: op === "count"
|
|
3794
|
+
? evalOk((0, script_1.vNum)(items.length), fuel)
|
|
3795
|
+
: op === "sum"
|
|
3796
|
+
? (0, plgg_1.matchOption)(() => evalFail("type-mismatch", at), (ns) => evalOk((0, script_1.vNum)(ns.reduce((a, b) => a + b, 0)), fuel))(numbersOf(items))
|
|
3797
|
+
: evalFail("unknown-host", at))(listItems(arg)))(one);
|
|
3798
|
+
};
|
|
3799
|
+
const evalExpr = (scene, env, at, expr, fuel) => {
|
|
3800
|
+
if (fuel <= 0)
|
|
3801
|
+
return evalFail("fuel-exhausted", at);
|
|
3802
|
+
const f = fuel - 1;
|
|
3803
|
+
return (0, plgg_1.match)(expr)([
|
|
3804
|
+
(0, script_1.strLit$)(),
|
|
3805
|
+
({ content }) => evalOk((0, script_1.vStr)(content), f),
|
|
3806
|
+
], [
|
|
3807
|
+
(0, script_1.numLit$)(),
|
|
3808
|
+
({ content }) => evalOk((0, script_1.vNum)(content), f),
|
|
3809
|
+
], [
|
|
3810
|
+
(0, script_1.varRef$)(),
|
|
3811
|
+
({ content }) => (0, plgg_1.matchOption)(() => evalFail("unbound-name", at), (v) => evalOk(v, f))((0, plgg_1.fromNullable)(env[content])),
|
|
3812
|
+
], [
|
|
3813
|
+
(0, script_1.sceneRows$)(),
|
|
3814
|
+
({ content }) => (0, plgg_1.matchOption)(() => evalFail("unknown-collection", at), (rows) => evalOk((0, script_1.vList)(rows.map(script_1.vRow)), f))(rowsOf(scene, content)),
|
|
3815
|
+
], [
|
|
3816
|
+
(0, script_1.mapKw$)(),
|
|
3817
|
+
({ content }) => onList(evalExpr(scene, env, at, content.of, f), at, (items, left) => (0, plgg_1.matchOption)(() => evalFail("type-mismatch", at), (rows) => evalOk((0, script_1.vList)(rows.map((r) => projectKw(content.kw, r))), left))(allRows(items))),
|
|
3818
|
+
], [
|
|
3819
|
+
(0, script_1.getKw$)(),
|
|
3820
|
+
({ content }) => onEval(evalExpr(scene, env, at, content.of, f), (value, left) => (0, plgg_1.matchOption)(() => evalFail("type-mismatch", at), (r) => evalOk(lookupKw(content.kw, r), left))(rowItem(value))),
|
|
3821
|
+
], [
|
|
3822
|
+
(0, script_1.app$)(),
|
|
3823
|
+
({ content }) => evalArgs(scene, env, at, content.args, f, [], (vals, left) => applyHost(content.op, vals, at, left)),
|
|
3824
|
+
], [
|
|
3825
|
+
(0, script_1.okOf$)(),
|
|
3826
|
+
({ content }) => onEval(evalExpr(scene, env, at, content.of, f), (value, left) => evalOk((0, script_1.vOk)(value), left)),
|
|
3827
|
+
], [
|
|
3828
|
+
(0, script_1.errOf$)(),
|
|
3829
|
+
({ content }) => evalOk((0, script_1.vErr)(content), f),
|
|
3830
|
+
], [
|
|
3831
|
+
(0, script_1.someOf$)(),
|
|
3832
|
+
({ content }) => onEval(evalExpr(scene, env, at, content.of, f), (value, left) => evalOk((0, script_1.vSome)(value), left)),
|
|
3833
|
+
], [
|
|
3834
|
+
(0, script_1.noneOf$)(),
|
|
3835
|
+
() => evalOk((0, script_1.vNone)(), f),
|
|
3836
|
+
], [
|
|
3837
|
+
(0, script_1.matchEmpty$)(),
|
|
3838
|
+
({ content }) => onList(evalExpr(scene, env, at, content.of, f), at, (items, left) => items.length === 0
|
|
3839
|
+
? evalExpr(scene, env, at, content.whenEmpty, left)
|
|
3840
|
+
: evalExpr(scene, (0, run_1.bind)(env, content.bind, (0, script_1.vList)(items)), at, content.whenRest, left)),
|
|
3841
|
+
], [
|
|
3842
|
+
(0, script_1.matchOption$)(),
|
|
3843
|
+
({ content }) => onEval(evalExpr(scene, env, at, content.of, f), (value, left) => (0, plgg_1.match)(optShape(value))([
|
|
3844
|
+
isSome$(),
|
|
3845
|
+
({ content: inner }) => evalExpr(scene, (0, run_1.bind)(env, content.bind, inner), at, content.whenSome, left),
|
|
3846
|
+
], [
|
|
3847
|
+
isNone$(),
|
|
3848
|
+
() => evalExpr(scene, env, at, content.whenNone, left),
|
|
3849
|
+
], [
|
|
3850
|
+
notOption$(),
|
|
3851
|
+
() => evalFail("type-mismatch", at),
|
|
3852
|
+
])),
|
|
3853
|
+
]);
|
|
3854
|
+
};
|
|
3855
|
+
const evalArgs = (scene, env, at, args, fuel, acc, then) => (0, plgg_1.matchOption)(() => then(acc, fuel), (head) => onEval(evalExpr(scene, env, at, head, fuel), (value, left) => evalArgs(scene, env, at, args.slice(1), left, [...acc, value], then)))((0, plgg_1.fromNullable)(args[0]));
|
|
3856
|
+
const allRows = (items) => {
|
|
3857
|
+
const rows = items.flatMap((item) => (0, plgg_1.matchOption)(() => [], (r) => [r])(rowItem(item)));
|
|
3858
|
+
return rows.length === items.length
|
|
3859
|
+
? (0, plgg_1.some)(rows)
|
|
3860
|
+
: (0, plgg_1.none)();
|
|
3861
|
+
};
|
|
3862
|
+
const advance = (script, scene, env, index, fuel) => (0, plgg_1.matchOption)(() => (0, plgg_1.match)(evalExpr(scene, env, script.steps.length, script.result, fuel))([
|
|
3863
|
+
evalOk$(),
|
|
3864
|
+
({ content }) => (0, run_1.flowDone)(content.value),
|
|
3865
|
+
], [
|
|
3866
|
+
evalFail$(),
|
|
3867
|
+
({ content }) => (0, run_1.flowFailed)(content.code, content.at),
|
|
3868
|
+
]), (step) => fuel <= 0
|
|
3869
|
+
? (0, run_1.flowFailed)("fuel-exhausted", index)
|
|
3870
|
+
: (0, plgg_1.match)(step)([
|
|
3871
|
+
(0, script_1.dispatchStep$)(),
|
|
3872
|
+
({ content }) => (0, run_1.flowPaused)({
|
|
3873
|
+
script,
|
|
3874
|
+
next: index + 1,
|
|
3875
|
+
env,
|
|
3876
|
+
fuel: fuel - 1,
|
|
3877
|
+
msg: content,
|
|
3878
|
+
}),
|
|
3879
|
+
], [
|
|
3880
|
+
(0, script_1.bindStep$)(),
|
|
3881
|
+
({ content }) => (0, plgg_1.match)(evalExpr(scene, env, index, content.expr, fuel - 1))([
|
|
3882
|
+
evalOk$(),
|
|
3883
|
+
({ content: out, }) => advance(script, scene, (0, run_1.bind)(env, content.name, out.value), index + 1, out.fuel),
|
|
3884
|
+
], [
|
|
3885
|
+
evalFail$(),
|
|
3886
|
+
({ content: diag, }) => (0, run_1.flowFailed)(diag.code, diag.at),
|
|
3887
|
+
]),
|
|
3888
|
+
]))((0, plgg_1.fromNullable)(script.steps[index]));
|
|
3889
|
+
const startFlow = (script, scene, fuel) => advance(script, scene, (0, run_1.emptyEnv)(), 0, fuel);
|
|
3890
|
+
exports.startFlow = startFlow;
|
|
3891
|
+
const resumeFlow = (paused, scene) => advance(paused.script, scene, paused.env, paused.next, paused.fuel);
|
|
3892
|
+
exports.resumeFlow = resumeFlow;
|
|
3893
|
+
|
|
3894
|
+
},
|
|
3895
|
+
"src/Catalog/index.ts": function (module, exports, require) {
|
|
3896
|
+
"use strict";
|
|
3897
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3898
|
+
exports.inertModelContext = exports.detectModelContext = exports.invokeWith = exports.syncCatalog = exports.diffCatalog = exports.descriptorOf = exports.ran$ = exports.stalled$ = exports.rejected$ = exports.ran = exports.stalled = exports.rejected = exports.runFlow = exports.flowSchemaOf = exports.flowHost = exports.catalogOf = exports.rowCap = exports.runFlow$ = exports.emit$ = exports.enumArg$ = exports.textArg$ = exports.nullary$ = exports.tool = exports.runFlowEffect = exports.emit = exports.enumArg = exports.textArg = exports.nullary = void 0;
|
|
3899
|
+
var tool_1 = require("src/Catalog/model/tool.ts");
|
|
3900
|
+
Object.defineProperty(exports, "nullary", { enumerable: true, get: function () { return tool_1.nullary; } });
|
|
3901
|
+
Object.defineProperty(exports, "textArg", { enumerable: true, get: function () { return tool_1.textArg; } });
|
|
3902
|
+
Object.defineProperty(exports, "enumArg", { enumerable: true, get: function () { return tool_1.enumArg; } });
|
|
3903
|
+
Object.defineProperty(exports, "emit", { enumerable: true, get: function () { return tool_1.emit; } });
|
|
3904
|
+
Object.defineProperty(exports, "runFlowEffect", { enumerable: true, get: function () { return tool_1.runFlowEffect; } });
|
|
3905
|
+
Object.defineProperty(exports, "tool", { enumerable: true, get: function () { return tool_1.tool; } });
|
|
3906
|
+
Object.defineProperty(exports, "nullary$", { enumerable: true, get: function () { return tool_1.nullary$; } });
|
|
3907
|
+
Object.defineProperty(exports, "textArg$", { enumerable: true, get: function () { return tool_1.textArg$; } });
|
|
3908
|
+
Object.defineProperty(exports, "enumArg$", { enumerable: true, get: function () { return tool_1.enumArg$; } });
|
|
3909
|
+
Object.defineProperty(exports, "emit$", { enumerable: true, get: function () { return tool_1.emit$; } });
|
|
3910
|
+
Object.defineProperty(exports, "runFlow$", { enumerable: true, get: function () { return tool_1.runFlow$; } });
|
|
3911
|
+
var catalog_1 = require("src/Catalog/usecase/catalog.ts");
|
|
3912
|
+
Object.defineProperty(exports, "rowCap", { enumerable: true, get: function () { return catalog_1.rowCap; } });
|
|
3913
|
+
Object.defineProperty(exports, "catalogOf", { enumerable: true, get: function () { return catalog_1.catalogOf; } });
|
|
3914
|
+
var runFlow_1 = require("src/Catalog/usecase/runFlow.ts");
|
|
3915
|
+
Object.defineProperty(exports, "flowHost", { enumerable: true, get: function () { return runFlow_1.flowHost; } });
|
|
3916
|
+
Object.defineProperty(exports, "flowSchemaOf", { enumerable: true, get: function () { return runFlow_1.flowSchemaOf; } });
|
|
3917
|
+
Object.defineProperty(exports, "runFlow", { enumerable: true, get: function () { return runFlow_1.runFlow; } });
|
|
3918
|
+
Object.defineProperty(exports, "rejected", { enumerable: true, get: function () { return runFlow_1.rejected; } });
|
|
3919
|
+
Object.defineProperty(exports, "stalled", { enumerable: true, get: function () { return runFlow_1.stalled; } });
|
|
3920
|
+
Object.defineProperty(exports, "ran", { enumerable: true, get: function () { return runFlow_1.ran; } });
|
|
3921
|
+
Object.defineProperty(exports, "rejected$", { enumerable: true, get: function () { return runFlow_1.rejected$; } });
|
|
3922
|
+
Object.defineProperty(exports, "stalled$", { enumerable: true, get: function () { return runFlow_1.stalled$; } });
|
|
3923
|
+
Object.defineProperty(exports, "ran$", { enumerable: true, get: function () { return runFlow_1.ran$; } });
|
|
3924
|
+
var adapter_1 = require("src/Catalog/usecase/adapter.ts");
|
|
3925
|
+
Object.defineProperty(exports, "descriptorOf", { enumerable: true, get: function () { return adapter_1.descriptorOf; } });
|
|
3926
|
+
Object.defineProperty(exports, "diffCatalog", { enumerable: true, get: function () { return adapter_1.diffCatalog; } });
|
|
3927
|
+
Object.defineProperty(exports, "syncCatalog", { enumerable: true, get: function () { return adapter_1.syncCatalog; } });
|
|
3928
|
+
Object.defineProperty(exports, "invokeWith", { enumerable: true, get: function () { return adapter_1.invokeWith; } });
|
|
3929
|
+
Object.defineProperty(exports, "detectModelContext", { enumerable: true, get: function () { return adapter_1.detectModelContext; } });
|
|
3930
|
+
Object.defineProperty(exports, "inertModelContext", { enumerable: true, get: function () { return adapter_1.inertModelContext; } });
|
|
3931
|
+
|
|
3932
|
+
},
|
|
3933
|
+
"src/Catalog/model/tool.ts": function (module, exports, require) {
|
|
3934
|
+
"use strict";
|
|
3935
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3936
|
+
exports.tool = exports.runFlow$ = exports.emit$ = exports.runFlowEffect = exports.emit = exports.enumArg$ = exports.textArg$ = exports.nullary$ = exports.enumArg = exports.textArg = exports.nullary = void 0;
|
|
3937
|
+
const plgg_1 = require("plgg");
|
|
3938
|
+
const nullary = () => (0, plgg_1.icon)("Nullary");
|
|
3939
|
+
exports.nullary = nullary;
|
|
3940
|
+
const textArg = (name, description) => (0, plgg_1.box)("TextArg")({ name, description });
|
|
3941
|
+
exports.textArg = textArg;
|
|
3942
|
+
const enumArg = (name, description, options) => (0, plgg_1.box)("EnumArg")({ name, description, options });
|
|
3943
|
+
exports.enumArg = enumArg;
|
|
3944
|
+
const nullary$ = () => (0, plgg_1.pattern)("Nullary")();
|
|
3945
|
+
exports.nullary$ = nullary$;
|
|
3946
|
+
const textArg$ = () => (0, plgg_1.pattern)("TextArg")();
|
|
3947
|
+
exports.textArg$ = textArg$;
|
|
3948
|
+
const enumArg$ = () => (0, plgg_1.pattern)("EnumArg")();
|
|
3949
|
+
exports.enumArg$ = enumArg$;
|
|
3950
|
+
const emit = (lower) => (0, plgg_1.box)("Emit")(lower);
|
|
3951
|
+
exports.emit = emit;
|
|
3952
|
+
const runFlowEffect = () => (0, plgg_1.icon)("RunFlow");
|
|
3953
|
+
exports.runFlowEffect = runFlowEffect;
|
|
3954
|
+
const emit$ = () => (0, plgg_1.pattern)("Emit")();
|
|
3955
|
+
exports.emit$ = emit$;
|
|
3956
|
+
const runFlow$ = () => (0, plgg_1.pattern)("RunFlow")();
|
|
3957
|
+
exports.runFlow$ = runFlow$;
|
|
3958
|
+
const tool = (t) => t;
|
|
3959
|
+
exports.tool = tool;
|
|
3960
|
+
|
|
3961
|
+
},
|
|
3962
|
+
"src/Catalog/usecase/catalog.ts": function (module, exports, require) {
|
|
3963
|
+
"use strict";
|
|
3964
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3965
|
+
exports.catalogOf = exports.rowCap = void 0;
|
|
3966
|
+
const plgg_1 = require("plgg");
|
|
3967
|
+
const client_1 = require("plgg-view/client");
|
|
3968
|
+
const Scene_1 = require("src/Schedule/model/Scene.ts");
|
|
3969
|
+
const Msg_1 = require("src/Schedule/model/Msg.ts");
|
|
3970
|
+
const tool_1 = require("src/Catalog/model/tool.ts");
|
|
3971
|
+
exports.rowCap = 50;
|
|
3972
|
+
const hrefToUrl = (href) => {
|
|
3973
|
+
const at = href.indexOf("?");
|
|
3974
|
+
return at < 0
|
|
3975
|
+
? (0, client_1.makeUrl)(href, "")
|
|
3976
|
+
: (0, client_1.makeUrl)(href.slice(0, at), href.slice(at));
|
|
3977
|
+
};
|
|
3978
|
+
const hrefByLabel = (pairs, label, fallback) => (0, plgg_1.matchOption)(() => fallback, ([, href]) => href)((0, plgg_1.fromNullable)(pairs.find(([l]) => l === label)));
|
|
3979
|
+
const menuTools = (entries) => {
|
|
3980
|
+
const pairs = entries.map((e) => [
|
|
3981
|
+
e.label,
|
|
3982
|
+
e.href,
|
|
3983
|
+
]);
|
|
3984
|
+
const first = pairs[0];
|
|
3985
|
+
return first === undefined
|
|
3986
|
+
? []
|
|
3987
|
+
: [
|
|
3988
|
+
(0, tool_1.tool)({
|
|
3989
|
+
name: "open_menu",
|
|
3990
|
+
description: "Open a top-level section from the menu.",
|
|
3991
|
+
input: (0, tool_1.enumArg)("section", "the section to open", pairs.map(([label]) => label)),
|
|
3992
|
+
effect: (0, tool_1.emit)((label) => (0, Msg_1.urlChanged)(hrefToUrl(hrefByLabel(pairs, label, first[1])))),
|
|
3993
|
+
}),
|
|
3994
|
+
];
|
|
3995
|
+
};
|
|
3996
|
+
const selectTool = (c, depth) => {
|
|
3997
|
+
const ids = c.rows.map((r) => r.row.id);
|
|
3998
|
+
if (ids.length === 0)
|
|
3999
|
+
return [];
|
|
4000
|
+
const overCap = ids.length > exports.rowCap;
|
|
4001
|
+
return [
|
|
4002
|
+
(0, tool_1.tool)({
|
|
4003
|
+
name: `select_${c.collection}`,
|
|
4004
|
+
description: overCap
|
|
4005
|
+
? `${ids.length} rows exceed the ${exports.rowCap}-row cap — narrow ${c.collection} with the filter tools first, then row choices appear.`
|
|
4006
|
+
: `Open one of the ${ids.length} visible ${c.collection} rows by id.`,
|
|
4007
|
+
input: (0, tool_1.enumArg)("id", overCap
|
|
4008
|
+
? "withheld until the list is filtered below the cap"
|
|
4009
|
+
: "the id of the row to open", overCap ? [] : ids),
|
|
4010
|
+
effect: (0, tool_1.emit)((id) => (0, Msg_1.select)(depth, id)),
|
|
4011
|
+
}),
|
|
4012
|
+
];
|
|
4013
|
+
};
|
|
4014
|
+
const keywordTool = (c) => (0, plgg_1.matchOption)(() => [], (q) => [
|
|
4015
|
+
(0, tool_1.tool)({
|
|
4016
|
+
name: `filter_${c.collection}`,
|
|
4017
|
+
description: `Filter ${c.collection} by keyword (substring over the row label).`,
|
|
4018
|
+
input: (0, tool_1.textArg)("keyword", q.placeholder),
|
|
4019
|
+
effect: (0, tool_1.emit)((text) => (0, Msg_1.queryInput)(text)),
|
|
4020
|
+
}),
|
|
4021
|
+
])(c.query);
|
|
4022
|
+
const choiceTools = (c) => (0, plgg_1.matchOption)(() => [], (q) => q.choices.map((ch) => (0, tool_1.tool)({
|
|
4023
|
+
name: `filter_${c.collection}_${ch.id}`,
|
|
4024
|
+
description: `Filter ${c.collection} by ${ch.label}.`,
|
|
4025
|
+
input: (0, tool_1.enumArg)(ch.id, ch.label, ch.options),
|
|
4026
|
+
effect: (0, tool_1.emit)((value) => (0, Msg_1.queryChoiceInput)(ch.id, value)),
|
|
4027
|
+
})))(c.query);
|
|
4028
|
+
const actionTool = (collection, target) => (ab) => (0, tool_1.tool)({
|
|
4029
|
+
name: `${collection}_${ab.id}`,
|
|
4030
|
+
description: (0, plgg_1.matchOption)(() => `${ab.label} — create in ${collection}.`, (id) => `${ab.label} — on ${collection} ${id}.`)(target),
|
|
4031
|
+
input: (0, tool_1.nullary)(),
|
|
4032
|
+
effect: (0, tool_1.emit)(() => (0, Msg_1.requestAction)(collection, ab.id, target)),
|
|
4033
|
+
});
|
|
4034
|
+
const listTools = (c, depth) => c.loading
|
|
4035
|
+
? []
|
|
4036
|
+
: [
|
|
4037
|
+
...selectTool(c, depth),
|
|
4038
|
+
...keywordTool(c),
|
|
4039
|
+
...choiceTools(c),
|
|
4040
|
+
...c.actions.map(actionTool(c.collection, (0, plgg_1.none)())),
|
|
4041
|
+
];
|
|
4042
|
+
const boardTools = (c) => {
|
|
4043
|
+
if (c.loading)
|
|
4044
|
+
return [];
|
|
4045
|
+
const pairs = c.tiles.flatMap((t) => (0, plgg_1.matchOption)(() => [], (href) => [[t.label, href]])(t.href));
|
|
4046
|
+
const first = pairs[0];
|
|
4047
|
+
return first === undefined
|
|
4048
|
+
? []
|
|
4049
|
+
: [
|
|
4050
|
+
(0, tool_1.tool)({
|
|
4051
|
+
name: `jump_${c.collection}`,
|
|
4052
|
+
description: `Jump to a ${c.collection} tile's target.`,
|
|
4053
|
+
input: (0, tool_1.enumArg)("tile", "the tile to jump to", pairs.map(([label]) => label)),
|
|
4054
|
+
effect: (0, tool_1.emit)((label) => (0, Msg_1.urlChanged)(hrefToUrl(hrefByLabel(pairs, label, first[1])))),
|
|
4055
|
+
}),
|
|
4056
|
+
];
|
|
4057
|
+
};
|
|
4058
|
+
const detailTools = (c) => (0, plgg_1.matchOption)(() => [], (r) => c.actions.map(actionTool(c.collection, (0, plgg_1.some)(r.id))))(c.row);
|
|
4059
|
+
const runFlowTool = (0, tool_1.tool)({
|
|
4060
|
+
name: "run_flow",
|
|
4061
|
+
description: "Read, check, and run a flow-DSL script against the current screen; results and positioned diagnostics come back as values.",
|
|
4062
|
+
input: (0, tool_1.textArg)("flow", "an s-expression (flow …) script"),
|
|
4063
|
+
effect: (0, tool_1.runFlowEffect)(),
|
|
4064
|
+
});
|
|
4065
|
+
const catalogOf = (scene) => [
|
|
4066
|
+
...scene.levels.flatMap((level, position) => (0, plgg_1.match)(level)([
|
|
4067
|
+
(0, Scene_1.menuLevel$)(),
|
|
4068
|
+
({ content }) => menuTools(content.entries),
|
|
4069
|
+
], [
|
|
4070
|
+
(0, Scene_1.listLevel$)(),
|
|
4071
|
+
({ content }) => listTools(content, position - 1),
|
|
4072
|
+
], [
|
|
4073
|
+
(0, Scene_1.boardLevel$)(),
|
|
4074
|
+
({ content }) => boardTools(content),
|
|
4075
|
+
], [
|
|
4076
|
+
(0, Scene_1.detailLevel$)(),
|
|
4077
|
+
({ content }) => detailTools(content),
|
|
4078
|
+
])),
|
|
4079
|
+
runFlowTool,
|
|
4080
|
+
];
|
|
4081
|
+
exports.catalogOf = catalogOf;
|
|
4082
|
+
|
|
4083
|
+
},
|
|
4084
|
+
"src/Catalog/usecase/runFlow.ts": function (module, exports, require) {
|
|
4085
|
+
"use strict";
|
|
4086
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4087
|
+
exports.runFlow = exports.flowSchemaOf = exports.ran$ = exports.stalled$ = exports.rejected$ = exports.ran = exports.stalled = exports.rejected = exports.flowHost = void 0;
|
|
4088
|
+
const plgg_1 = require("plgg");
|
|
4089
|
+
const Row_1 = require("src/Declare/model/Row.ts");
|
|
4090
|
+
const Source_1 = require("src/Declare/model/Source.ts");
|
|
4091
|
+
const forms_1 = require("src/Flow/model/forms.ts");
|
|
4092
|
+
const run_1 = require("src/Flow/model/run.ts");
|
|
4093
|
+
const read_1 = require("src/Flow/usecase/read.ts");
|
|
4094
|
+
const interpret_1 = require("src/Flow/usecase/interpret.ts");
|
|
4095
|
+
const flowHost = (scheduled, model) => ({
|
|
4096
|
+
scene: scheduled.scene(model),
|
|
4097
|
+
settle: (msg) => (0, exports.flowHost)(scheduled, scheduled.update(msg, model)[0]),
|
|
4098
|
+
});
|
|
4099
|
+
exports.flowHost = flowHost;
|
|
4100
|
+
const rejected = (diagnostics) => (0, plgg_1.box)("Rejected")(diagnostics);
|
|
4101
|
+
exports.rejected = rejected;
|
|
4102
|
+
const stalled = (confirm) => (0, plgg_1.box)("Stalled")(confirm);
|
|
4103
|
+
exports.stalled = stalled;
|
|
4104
|
+
const ran = (outcome) => (0, plgg_1.box)("Ran")(outcome);
|
|
4105
|
+
exports.ran = ran;
|
|
4106
|
+
const rejected$ = () => (0, plgg_1.pattern)("Rejected")();
|
|
4107
|
+
exports.rejected$ = rejected$;
|
|
4108
|
+
const stalled$ = () => (0, plgg_1.pattern)("Stalled")();
|
|
4109
|
+
exports.stalled$ = stalled$;
|
|
4110
|
+
const ran$ = () => (0, plgg_1.pattern)("Ran")();
|
|
4111
|
+
exports.ran$ = ran$;
|
|
4112
|
+
const isNumeric = (v) => (0, plgg_1.match)(v)([(0, Row_1.numValue$)(), () => true], [(0, Row_1.textValue$)(), () => false], [(0, Row_1.flagValue$)(), () => false], [(0, Row_1.momentValue$)(), () => false], [(0, Row_1.refValue$)(), () => false], [(0, Row_1.mediaValue$)(), () => false]);
|
|
4113
|
+
const fieldsOfRows = (rows) => {
|
|
4114
|
+
const labels = rows
|
|
4115
|
+
.flatMap((r) => r.fields.map((f) => f.label))
|
|
4116
|
+
.filter((l, i, a) => l !== "" && a.indexOf(l) === i);
|
|
4117
|
+
return labels.map((kw) => {
|
|
4118
|
+
const values = rows.flatMap((r) => r.fields
|
|
4119
|
+
.filter((f) => f.label === kw)
|
|
4120
|
+
.map((f) => f.value));
|
|
4121
|
+
return {
|
|
4122
|
+
kw,
|
|
4123
|
+
numeric: values.length > 0 &&
|
|
4124
|
+
values.every(isNumeric),
|
|
4125
|
+
};
|
|
4126
|
+
});
|
|
4127
|
+
};
|
|
4128
|
+
const schemaOfCollection = (c) => ({
|
|
4129
|
+
id: c.id,
|
|
4130
|
+
fields: (0, plgg_1.match)(c.source)([
|
|
4131
|
+
(0, Source_1.sync$)(),
|
|
4132
|
+
({ content, }) => fieldsOfRows(content([])),
|
|
4133
|
+
], [
|
|
4134
|
+
(0, Source_1.async$)(),
|
|
4135
|
+
() => [],
|
|
4136
|
+
], [
|
|
4137
|
+
(0, Source_1.dynamic$)(),
|
|
4138
|
+
() => [],
|
|
4139
|
+
], [
|
|
4140
|
+
(0, Source_1.adapter$)(),
|
|
4141
|
+
() => [],
|
|
4142
|
+
]),
|
|
4143
|
+
choices: (0, plgg_1.matchOption)(() => [], (q) => q.choices.map((ch) => ch.id))(c.query),
|
|
4144
|
+
});
|
|
4145
|
+
const flowSchemaOf = (declaration) => (0, forms_1.flowSchema)(declaration.collections.map(schemaOfCollection));
|
|
4146
|
+
exports.flowSchemaOf = flowSchemaOf;
|
|
4147
|
+
const stallOr = (host, done) => (0, plgg_1.matchOption)(() => done, (c) => (0, exports.stalled)(c))(host.scene.confirm);
|
|
4148
|
+
const drive = (host, outcome) => (0, plgg_1.match)(outcome)([
|
|
4149
|
+
(0, run_1.flowPaused$)(),
|
|
4150
|
+
({ content }) => {
|
|
4151
|
+
const next = host.settle(content.msg);
|
|
4152
|
+
return drive(next, (0, interpret_1.resumeFlow)(content, next.scene));
|
|
4153
|
+
},
|
|
4154
|
+
], [
|
|
4155
|
+
(0, run_1.flowDone$)(),
|
|
4156
|
+
() => stallOr(host, (0, exports.ran)(outcome)),
|
|
4157
|
+
], [
|
|
4158
|
+
(0, run_1.flowFailed$)(),
|
|
4159
|
+
() => (0, exports.ran)(outcome),
|
|
4160
|
+
]);
|
|
4161
|
+
const runFlow = (source, schema, host, fuel = run_1.defaultFuel) => {
|
|
4162
|
+
const read = (0, read_1.readFlow)(source, schema);
|
|
4163
|
+
return (0, plgg_1.isErr)(read)
|
|
4164
|
+
? (0, exports.rejected)(read.content)
|
|
4165
|
+
: drive(host, (0, interpret_1.startFlow)(read.content, host.scene, fuel));
|
|
4166
|
+
};
|
|
4167
|
+
exports.runFlow = runFlow;
|
|
4168
|
+
|
|
4169
|
+
},
|
|
4170
|
+
"src/Catalog/usecase/adapter.ts": function (module, exports, require) {
|
|
4171
|
+
"use strict";
|
|
4172
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4173
|
+
exports.detectModelContext = exports.syncCatalog = exports.invokeWith = exports.inertModelContext = exports.diffCatalog = exports.descriptorOf = void 0;
|
|
4174
|
+
const plgg_1 = require("plgg");
|
|
4175
|
+
const tool_1 = require("src/Catalog/model/tool.ts");
|
|
4176
|
+
const descriptorOf = (t) => ({
|
|
4177
|
+
name: t.name,
|
|
4178
|
+
description: t.description,
|
|
4179
|
+
input: t.input,
|
|
4180
|
+
});
|
|
4181
|
+
exports.descriptorOf = descriptorOf;
|
|
4182
|
+
const inputKey = (input) => (0, plgg_1.match)(input)([(0, tool_1.nullary$)(), () => "nullary"], [
|
|
4183
|
+
(0, tool_1.textArg$)(),
|
|
4184
|
+
({ content }) => `text${content.name}${content.description}`,
|
|
4185
|
+
], [
|
|
4186
|
+
(0, tool_1.enumArg$)(),
|
|
4187
|
+
({ content }) => `enum${content.name}${content.description}${content.options.join("")}`,
|
|
4188
|
+
]);
|
|
4189
|
+
const descriptorKey = (d) => `${d.name}${d.description}${inputKey(d.input)}`;
|
|
4190
|
+
const diffCatalog = (prev, next) => ({
|
|
4191
|
+
added: next.filter((t) => !prev.some((d) => d.name === t.name)),
|
|
4192
|
+
changed: next.filter((t) => (0, plgg_1.matchOption)(() => false, (d) => descriptorKey(d) !==
|
|
4193
|
+
descriptorKey((0, exports.descriptorOf)(t)))((0, plgg_1.fromNullable)(prev.find((d) => d.name === t.name)))),
|
|
4194
|
+
removed: prev
|
|
4195
|
+
.filter((d) => !next.some((t) => t.name === d.name))
|
|
4196
|
+
.map((d) => d.name),
|
|
4197
|
+
});
|
|
4198
|
+
exports.diffCatalog = diffCatalog;
|
|
4199
|
+
exports.inertModelContext = {
|
|
4200
|
+
registerTool: () => undefined,
|
|
4201
|
+
unregisterTool: () => undefined,
|
|
4202
|
+
};
|
|
4203
|
+
const invokeWith = (dispatch, run) => (t) => (arg) => (0, plgg_1.match)(t.effect)([
|
|
4204
|
+
(0, tool_1.emit$)(),
|
|
4205
|
+
({ content }) => dispatch(content(arg)),
|
|
4206
|
+
], [(0, tool_1.runFlow$)(), () => run(arg)]);
|
|
4207
|
+
exports.invokeWith = invokeWith;
|
|
4208
|
+
const syncCatalog = (host, invokerOf, prev, next) => {
|
|
4209
|
+
const diff = (0, exports.diffCatalog)(prev, next);
|
|
4210
|
+
diff.removed.forEach((name) => host.unregisterTool(name));
|
|
4211
|
+
diff.changed.forEach((t) => {
|
|
4212
|
+
host.unregisterTool(t.name);
|
|
4213
|
+
host.registerTool((0, exports.descriptorOf)(t), invokerOf(t));
|
|
4214
|
+
});
|
|
4215
|
+
diff.added.forEach((t) => host.registerTool((0, exports.descriptorOf)(t), invokerOf(t)));
|
|
4216
|
+
return next.map(exports.descriptorOf);
|
|
4217
|
+
};
|
|
4218
|
+
exports.syncCatalog = syncCatalog;
|
|
4219
|
+
const detectModelContext = (candidate) => {
|
|
4220
|
+
if (!(0, plgg_1.isObjLike)(candidate))
|
|
4221
|
+
return (0, plgg_1.none)();
|
|
4222
|
+
if (!(0, plgg_1.hasProp)(candidate, "modelContext"))
|
|
4223
|
+
return (0, plgg_1.none)();
|
|
4224
|
+
const mc = candidate.modelContext;
|
|
4225
|
+
if (!(0, plgg_1.isObjLike)(mc))
|
|
4226
|
+
return (0, plgg_1.none)();
|
|
4227
|
+
if (!(0, plgg_1.hasProp)(mc, "registerTool"))
|
|
4228
|
+
return (0, plgg_1.none)();
|
|
4229
|
+
if (!(0, plgg_1.hasProp)(mc, "unregisterTool"))
|
|
4230
|
+
return (0, plgg_1.none)();
|
|
4231
|
+
const reg = mc.registerTool;
|
|
4232
|
+
const unreg = mc.unregisterTool;
|
|
4233
|
+
if (!(0, plgg_1.isFunc)(reg) || !(0, plgg_1.isFunc)(unreg))
|
|
4234
|
+
return (0, plgg_1.none)();
|
|
4235
|
+
return (0, plgg_1.some)({
|
|
4236
|
+
registerTool: (descriptor, invoke) => {
|
|
4237
|
+
reg(descriptor, invoke);
|
|
4238
|
+
},
|
|
4239
|
+
unregisterTool: (name) => {
|
|
4240
|
+
unreg(name);
|
|
4241
|
+
},
|
|
4242
|
+
});
|
|
4243
|
+
};
|
|
4244
|
+
exports.detectModelContext = detectModelContext;
|
|
4245
|
+
|
|
4246
|
+
}
|
|
4247
|
+
};
|
|
4248
|
+
const __cache = {};
|
|
4249
|
+
function __require(id) {
|
|
4250
|
+
if (id in __cache) return __cache[id].exports;
|
|
4251
|
+
const fn = __modules[id];
|
|
4252
|
+
if (!fn) { if (id in __externals) return __externals[id]; return import(id); }
|
|
4253
|
+
const module = { exports: {} };
|
|
4254
|
+
__cache[id] = module;
|
|
4255
|
+
fn(module, module.exports, __require);
|
|
4256
|
+
return module.exports;
|
|
4257
|
+
}
|
|
4258
|
+
const __entry = __require("src/index.ts");
|
|
4259
|
+
export default __entry;
|
|
4260
|
+
export const {
|
|
4261
|
+
action,
|
|
4262
|
+
actionById,
|
|
4263
|
+
actor,
|
|
4264
|
+
adapter,
|
|
4265
|
+
applyVia,
|
|
4266
|
+
asFlag,
|
|
4267
|
+
asMoment,
|
|
4268
|
+
asNum,
|
|
4269
|
+
asText,
|
|
4270
|
+
asidePane,
|
|
4271
|
+
async,
|
|
4272
|
+
binding,
|
|
4273
|
+
boardLevel$,
|
|
4274
|
+
breadcrumb,
|
|
4275
|
+
button,
|
|
4276
|
+
cancelAction,
|
|
4277
|
+
catalogOf,
|
|
4278
|
+
checkbox,
|
|
4279
|
+
choiceOf,
|
|
4280
|
+
colHead,
|
|
4281
|
+
collection,
|
|
4282
|
+
collectionById,
|
|
4283
|
+
column,
|
|
4284
|
+
confirm,
|
|
4285
|
+
confirmAction,
|
|
4286
|
+
confirmDialog,
|
|
4287
|
+
controlKinds,
|
|
4288
|
+
crumbsOf,
|
|
4289
|
+
cssPrefix,
|
|
4290
|
+
currentScreen,
|
|
4291
|
+
declare,
|
|
4292
|
+
defaultFuel,
|
|
4293
|
+
descriptorOf,
|
|
4294
|
+
detailLevel$,
|
|
4295
|
+
detailView,
|
|
4296
|
+
detailView$,
|
|
4297
|
+
detectModelContext,
|
|
4298
|
+
diagnosticSeverity,
|
|
4299
|
+
diffCatalog,
|
|
4300
|
+
dynamic,
|
|
4301
|
+
effect,
|
|
4302
|
+
emit,
|
|
4303
|
+
emit$,
|
|
4304
|
+
emptyModel,
|
|
4305
|
+
enumArg,
|
|
4306
|
+
enumArg$,
|
|
4307
|
+
errorFor,
|
|
4308
|
+
failed,
|
|
4309
|
+
field,
|
|
4310
|
+
fieldOf,
|
|
4311
|
+
fieldText,
|
|
4312
|
+
flagValue,
|
|
4313
|
+
flagValue$,
|
|
4314
|
+
flowHost,
|
|
4315
|
+
flowSchema,
|
|
4316
|
+
flowSchemaOf,
|
|
4317
|
+
focusRing,
|
|
4318
|
+
focusedView,
|
|
4319
|
+
formView,
|
|
4320
|
+
frameworkName,
|
|
4321
|
+
heading,
|
|
4322
|
+
hostAdapter,
|
|
4323
|
+
hoverDim,
|
|
4324
|
+
idleSubmission,
|
|
4325
|
+
immediate,
|
|
4326
|
+
inertModelContext,
|
|
4327
|
+
invokeWith,
|
|
4328
|
+
isDestructive,
|
|
4329
|
+
isPending,
|
|
4330
|
+
landmarkTag,
|
|
4331
|
+
listLevel$,
|
|
4332
|
+
listView,
|
|
4333
|
+
listView$,
|
|
4334
|
+
loaded,
|
|
4335
|
+
mainPane,
|
|
4336
|
+
makeRow,
|
|
4337
|
+
matchesChoice,
|
|
4338
|
+
matchesQuery,
|
|
4339
|
+
mediaValue,
|
|
4340
|
+
mediaValue$,
|
|
4341
|
+
menu,
|
|
4342
|
+
menuEntry,
|
|
4343
|
+
menuLevel$,
|
|
4344
|
+
menuView,
|
|
4345
|
+
menuView$,
|
|
4346
|
+
modes,
|
|
4347
|
+
momentValue,
|
|
4348
|
+
momentValue$,
|
|
4349
|
+
multiColumn,
|
|
4350
|
+
multiColumnWith,
|
|
4351
|
+
named,
|
|
4352
|
+
navPane,
|
|
4353
|
+
navTree,
|
|
4354
|
+
navigate,
|
|
4355
|
+
noDefaultAdapter$,
|
|
4356
|
+
nullary,
|
|
4357
|
+
nullary$,
|
|
4358
|
+
numValue,
|
|
4359
|
+
numValue$,
|
|
4360
|
+
openMenu,
|
|
4361
|
+
pane,
|
|
4362
|
+
parseForm,
|
|
4363
|
+
parseUrl,
|
|
4364
|
+
pendingSubmission,
|
|
4365
|
+
permits,
|
|
4366
|
+
pragmaticTheme,
|
|
4367
|
+
pragmaticThemeWithPalette,
|
|
4368
|
+
pressDim,
|
|
4369
|
+
projectField,
|
|
4370
|
+
projectRow,
|
|
4371
|
+
projection,
|
|
4372
|
+
prose,
|
|
4373
|
+
query,
|
|
4374
|
+
queryChoice,
|
|
4375
|
+
queryChoiceInput,
|
|
4376
|
+
queryInput,
|
|
4377
|
+
ran,
|
|
4378
|
+
ran$,
|
|
4379
|
+
readFlow,
|
|
4380
|
+
reconcile,
|
|
4381
|
+
refTarget,
|
|
4382
|
+
refValue,
|
|
4383
|
+
refValue$,
|
|
4384
|
+
rejected,
|
|
4385
|
+
rejected$,
|
|
4386
|
+
renderMode,
|
|
4387
|
+
requestAction,
|
|
4388
|
+
resolveAdapter,
|
|
4389
|
+
resumeFlow,
|
|
4390
|
+
row,
|
|
4391
|
+
rowCap,
|
|
4392
|
+
runFlow,
|
|
4393
|
+
runFlow$,
|
|
4394
|
+
runFlowEffect,
|
|
4395
|
+
sceneToUrl,
|
|
4396
|
+
schedule,
|
|
4397
|
+
scope,
|
|
4398
|
+
select,
|
|
4399
|
+
selectInput,
|
|
4400
|
+
singleColumn,
|
|
4401
|
+
sliceOf,
|
|
4402
|
+
slotOf,
|
|
4403
|
+
stalled,
|
|
4404
|
+
stalled$,
|
|
4405
|
+
startFlow,
|
|
4406
|
+
staticThemeToggle,
|
|
4407
|
+
sync,
|
|
4408
|
+
syncCatalog,
|
|
4409
|
+
textArea,
|
|
4410
|
+
textArg,
|
|
4411
|
+
textArg$,
|
|
4412
|
+
textInput,
|
|
4413
|
+
textLink,
|
|
4414
|
+
textValue,
|
|
4415
|
+
textValue$,
|
|
4416
|
+
themeToggle,
|
|
4417
|
+
themeToggleClass,
|
|
4418
|
+
themeToggleCss,
|
|
4419
|
+
toast,
|
|
4420
|
+
toaster,
|
|
4421
|
+
toggleMode,
|
|
4422
|
+
tones,
|
|
4423
|
+
tool,
|
|
4424
|
+
unknownAdapter$,
|
|
4425
|
+
unusedAdapter$,
|
|
4426
|
+
urlChanged
|
|
4427
|
+
} = __entry;
|