@lango-project/lango-client 0.2.1 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/NOTICE +5 -1
- package/README.md +603 -906
- package/cli/.lango/localization.mjs +108 -0
- package/{dist/node → cli}/.lango/runtime.mjs +120 -20
- package/cli/.lango/vendor/i18next.LICENSE +21 -0
- package/cli/.lango/vendor/i18next.mjs +2434 -0
- package/cli/create.mjs +62 -0
- package/cli/create.mjs.map +1 -0
- package/dist/.lango/localization.mjs +108 -0
- package/dist/.lango/runtime.mjs +120 -20
- package/dist/.lango/vendor/i18next.LICENSE +21 -0
- package/dist/.lango/vendor/i18next.mjs +2434 -0
- package/dist/accordion.mjs +277 -0
- package/dist/accordion.mjs.map +1 -0
- package/dist/activities.mjs +185 -0
- package/dist/activities.mjs.map +1 -0
- package/dist/app.mjs +671 -0
- package/dist/app.mjs.map +1 -0
- package/dist/boot.mjs +24 -0
- package/dist/boot.mjs.map +1 -0
- package/dist/bootstrap-LICENSE +21 -0
- package/dist/bootstrap.min.css +6 -0
- package/dist/bootstrap.min.css.map +1 -0
- package/dist/button.mjs +77 -0
- package/dist/button.mjs.map +1 -0
- package/dist/chip.mjs +134 -0
- package/dist/chip.mjs.map +1 -0
- package/dist/client.css +102 -0
- package/dist/collections.mjs +77 -0
- package/dist/collections.mjs.map +1 -0
- package/dist/combo_box.mjs +408 -0
- package/dist/combo_box.mjs.map +1 -0
- package/dist/content.mjs +123 -0
- package/dist/content.mjs.map +1 -0
- package/dist/control.mjs +141 -0
- package/dist/control.mjs.map +1 -0
- package/dist/date_input.mjs +242 -0
- package/dist/date_input.mjs.map +1 -0
- package/dist/dimensions.mjs +102 -0
- package/dist/dimensions.mjs.map +1 -0
- package/dist/error_reporter.mjs +136 -0
- package/dist/error_reporter.mjs.map +1 -0
- package/dist/fields.mjs +454 -0
- package/dist/fields.mjs.map +1 -0
- package/dist/file_input.mjs +227 -0
- package/dist/file_input.mjs.map +1 -0
- package/dist/form.mjs +272 -0
- package/dist/form.mjs.map +1 -0
- package/dist/heartbeat.mjs +167 -254
- package/dist/heartbeat.mjs.map +1 -1
- package/dist/index.html +18 -0
- package/dist/indicators.mjs +127 -0
- package/dist/indicators.mjs.map +1 -0
- package/dist/input_changes.mjs +58 -0
- package/dist/input_changes.mjs.map +1 -0
- package/dist/input_group.mjs +38 -0
- package/dist/input_group.mjs.map +1 -0
- package/dist/layouts.mjs +195 -0
- package/dist/layouts.mjs.map +1 -0
- package/dist/library.mjs +130 -807
- package/dist/library.mjs.map +1 -1
- package/dist/longpoll.mjs +254 -0
- package/dist/longpoll.mjs.map +1 -0
- package/dist/main.mjs +147 -0
- package/dist/main.mjs.map +1 -0
- package/dist/markdown.mjs +61 -0
- package/dist/markdown.mjs.map +1 -0
- package/dist/menus.mjs +468 -0
- package/dist/menus.mjs.map +1 -0
- package/dist/navigation.mjs +260 -410
- package/dist/navigation.mjs.map +1 -1
- package/dist/numeric_input.mjs +181 -0
- package/dist/numeric_input.mjs.map +1 -0
- package/dist/otp_input.mjs +113 -0
- package/dist/otp_input.mjs.map +1 -0
- package/dist/presentations.mjs +852 -0
- package/dist/presentations.mjs.map +1 -0
- package/dist/renderer.mjs +295 -0
- package/dist/renderer.mjs.map +1 -0
- package/dist/rich_content.mjs +99 -0
- package/dist/rich_content.mjs.map +1 -0
- package/dist/table_scope.mjs +166 -0
- package/dist/table_scope.mjs.map +1 -0
- package/dist/tables.mjs +1052 -0
- package/dist/tables.mjs.map +1 -0
- package/dist/tabs.mjs +205 -0
- package/dist/tabs.mjs.map +1 -0
- package/dist/templates.mjs +46 -0
- package/dist/templates.mjs.map +1 -0
- package/dist/vendor/DOMPurify-LICENSE +202 -0
- package/dist/vendor/dompurify.mjs +2454 -0
- package/dist/vendor/flatpickr-LICENSE.md +21 -0
- package/dist/vendor/flatpickr.min.css +13 -0
- package/dist/vendor/flatpickr.mjs +2340 -0
- package/dist/vendor/flatpickr.mjs.map +7 -0
- package/dist/vendor/marked-LICENSE.md +44 -0
- package/dist/vendor/marked.esm.js.map +7 -0
- package/dist/vendor/marked.mjs +85 -0
- package/dist/vendor/purify.es.mjs.map +1 -0
- package/dist/widgets.mjs +197 -0
- package/dist/widgets.mjs.map +1 -0
- package/docs/implementation.md +93 -0
- package/package.json +25 -43
- package/src/accordion.lango +198 -0
- package/src/activities.lango +132 -0
- package/src/app.lango +540 -0
- package/src/boot.lango +12 -0
- package/src/button.lango +49 -0
- package/src/chip.lango +94 -0
- package/src/collections.lango +46 -0
- package/src/combo_box.lango +298 -0
- package/src/content.lango +75 -0
- package/src/control.lango +103 -0
- package/src/create.lango +42 -0
- package/src/date_input.lango +215 -0
- package/src/dimensions.lango +65 -0
- package/src/error_reporter.lango +95 -0
- package/src/fields.lango +327 -0
- package/src/file_input.lango +175 -0
- package/src/form.lango +195 -0
- package/src/heartbeat.lango +136 -199
- package/src/indicators.lango +94 -0
- package/src/input_changes.lango +33 -0
- package/src/input_group.lango +22 -0
- package/src/layouts.lango +137 -0
- package/src/library.lango +194 -599
- package/src/longpoll.lango +187 -0
- package/src/main.lango +118 -0
- package/src/markdown.lango +48 -0
- package/src/menus.lango +336 -0
- package/src/navigation.lango +209 -299
- package/src/numeric_input.lango +131 -0
- package/src/otp_input.lango +83 -0
- package/src/presentations.lango +617 -0
- package/src/renderer.lango +296 -0
- package/src/rich_content.lango +66 -0
- package/src/table_scope.lango +119 -0
- package/src/tables.lango +786 -0
- package/src/tabs.lango +144 -0
- package/src/templates.lango +29 -0
- package/src/widgets.lango +141 -0
- package/web/client.css +102 -0
- package/web/index.html +18 -0
- package/dist/application.mjs +0 -429
- package/dist/application.mjs.map +0 -1
- package/dist/coordinator.mjs +0 -91
- package/dist/coordinator.mjs.map +0 -1
- package/dist/demo.mjs +0 -110
- package/dist/demo.mjs.map +0 -1
- package/dist/demo_controls.mjs +0 -59
- package/dist/demo_controls.mjs.map +0 -1
- package/dist/errors.mjs +0 -201
- package/dist/errors.mjs.map +0 -1
- package/dist/form_state.mjs +0 -266
- package/dist/form_state.mjs.map +0 -1
- package/dist/inheritance.mjs +0 -240
- package/dist/inheritance.mjs.map +0 -1
- package/dist/input_values.mjs +0 -65
- package/dist/input_values.mjs.map +0 -1
- package/dist/node/.lango/xmldom/conventions.js +0 -429
- package/dist/node/.lango/xmldom/dom-parser.js +0 -591
- package/dist/node/.lango/xmldom/dom.js +0 -3759
- package/dist/node/.lango/xmldom/entities.js +0 -2171
- package/dist/node/.lango/xmldom/errors.js +0 -205
- package/dist/node/.lango/xmldom/grammar.js +0 -559
- package/dist/node/.lango/xmldom/index.js +0 -41
- package/dist/node/.lango/xmldom/package.json +0 -1
- package/dist/node/.lango/xmldom/sax.js +0 -983
- package/dist/node/.lango/xmldom.LICENSE.md +0 -8
- package/dist/node/browser_host.mjs +0 -351
- package/dist/node/browser_host.mjs.map +0 -1
- package/dist/node/create_app.mjs +0 -118
- package/dist/node/create_app.mjs.map +0 -1
- package/dist/presentation.mjs +0 -89
- package/dist/presentation.mjs.map +0 -1
- package/dist/protocol.mjs +0 -706
- package/dist/protocol.mjs.map +0 -1
- package/dist/session.mjs +0 -471
- package/dist/session.mjs.map +0 -1
- package/dist/tokens.mjs +0 -298
- package/dist/tokens.mjs.map +0 -1
- package/examples/contacts.lango +0 -293
- package/examples/contacts_flow.lango +0 -174
- package/examples/contacts_store.lango +0 -109
- package/examples/contacts_store_test.lango +0 -65
- package/examples/demo.css +0 -87
- package/examples/demo_test.lango +0 -356
- package/examples/index.html +0 -32
- package/examples/pages.lango +0 -174
- package/examples/server.lango +0 -189
- package/examples/worker.lango +0 -142
- package/src/application.lango +0 -327
- package/src/browser_host.lango +0 -276
- package/src/coordinator.lango +0 -57
- package/src/demo.lango +0 -110
- package/src/demo_controls.lango +0 -53
- package/src/errors.lango +0 -149
- package/src/errors_test.lango +0 -157
- package/src/form_state.lango +0 -168
- package/src/heartbeat_test.lango +0 -479
- package/src/inheritance.lango +0 -167
- package/src/input_values.lango +0 -37
- package/src/logout_test.lango +0 -564
- package/src/navigation_test.lango +0 -556
- package/src/presentation.lango +0 -55
- package/src/protocol.lango +0 -787
- package/src/renderer_test.lango +0 -2047
- package/src/session.lango +0 -343
- package/src/session_test.lango +0 -455
- package/src/tabs_test.lango +0 -216
- package/src/tokens.lango +0 -215
- package/template/.vscode/extensions.json +0 -3
- package/template/.vscode/settings.json +0 -9
- package/template/README.md +0 -44
- package/template/gitignore +0 -4
- package/template/package.json +0 -22
- package/template/public/app.css +0 -10
- package/template/public/index.html +0 -24
- package/template/src/client.lango +0 -78
- package/template/src/pages.lango +0 -55
- package/template/src/server.lango +0 -24
- package/template/src/worker.lango +0 -77
- package/template/test/app.lango +0 -9
- package/tools/browser_runner.lango +0 -32
- package/tools/browser_test.lango +0 -343
- package/tools/create_app.lango +0 -88
- package/tools/create_app_test.lango +0 -43
- package/tools/starter_test.lango +0 -227
- /package/{dist/node → cli}/.lango/bignumber.mjs +0 -0
- /package/{dist → cli}/.lango/xmldom/conventions.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom-parser.js +0 -0
- /package/{dist → cli}/.lango/xmldom/dom.js +0 -0
- /package/{dist → cli}/.lango/xmldom/entities.js +0 -0
- /package/{dist → cli}/.lango/xmldom/errors.js +0 -0
- /package/{dist → cli}/.lango/xmldom/grammar.js +0 -0
- /package/{dist → cli}/.lango/xmldom/index.js +0 -0
- /package/{dist → cli}/.lango/xmldom/package.json +0 -0
- /package/{dist → cli}/.lango/xmldom/sax.js +0 -0
- /package/{dist → cli}/.lango/xmldom.LICENSE.md +0 -0
package/dist/button.mjs
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Control } from "./control.mjs";
|
|
2
|
+
import { cloneMarkup } from "./templates.mjs";
|
|
3
|
+
import { RichContent } from "./rich_content.mjs";
|
|
4
|
+
import {
|
|
5
|
+
xmlEscape as __xmlEscape,
|
|
6
|
+
add as __add,
|
|
7
|
+
requireBoolean as __requireBoolean,
|
|
8
|
+
normalize as __normalize,
|
|
9
|
+
boundary as __boundary,
|
|
10
|
+
requireArity as __requireArity,
|
|
11
|
+
withArity as __withArity,
|
|
12
|
+
} from "./.lango/runtime.mjs";
|
|
13
|
+
|
|
14
|
+
export class Button extends Control {
|
|
15
|
+
#presentations;
|
|
16
|
+
#url;
|
|
17
|
+
#dismiss;
|
|
18
|
+
#content;
|
|
19
|
+
constructor(form, props, renderer) {
|
|
20
|
+
super(form, props, cloneMarkup("button", ["<button type=\"button\" class=\"btn\"></button>"].join("")));
|
|
21
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
22
|
+
form = __boundary(form);
|
|
23
|
+
props = __boundary(props);
|
|
24
|
+
renderer = __boundary(renderer);
|
|
25
|
+
this.#presentations = __normalize(renderer.presentations);
|
|
26
|
+
this.#url = __normalize(props.url);
|
|
27
|
+
this.#dismiss = __normalize(props.dismiss) === true;
|
|
28
|
+
this.#content = new RichContent(form, __normalize(this.element), renderer, false);
|
|
29
|
+
let theme = __normalize(props.theme);
|
|
30
|
+
if (__requireBoolean(theme === null)) {
|
|
31
|
+
theme = "primary";
|
|
32
|
+
}
|
|
33
|
+
__add(this.element.classList, `btn-${__normalize(theme.toLowerCase())}`);
|
|
34
|
+
this.element.disabled = __normalize(props.disabled) === true;
|
|
35
|
+
this.setCaption(__normalize(props.caption));
|
|
36
|
+
if (__requireBoolean(__requireBoolean(__normalize(this.#url) !== null) || __requireBoolean(__normalize(this.#dismiss)))) {
|
|
37
|
+
let listener = () => {
|
|
38
|
+
if (__requireBoolean(__normalize(this.#url) === null)) {
|
|
39
|
+
__normalize(this.#presentations.dismiss(__normalize(this.form)));
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
__normalize(this.form.send(__normalize(this.#url))).then(__withArity((ignored) => {
|
|
43
|
+
ignored = __boundary(ignored);
|
|
44
|
+
if (__requireBoolean(__normalize(this.#dismiss))) {
|
|
45
|
+
__normalize(this.#presentations.dismiss(__normalize(this.form)));
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}, [0], "closure")).catch(__withArity((error) => {
|
|
49
|
+
error = __boundary(error);
|
|
50
|
+
__normalize(this.form.app.error(__normalize(this.form), error));
|
|
51
|
+
return null;
|
|
52
|
+
}, [0], "closure"));
|
|
53
|
+
return null;
|
|
54
|
+
};
|
|
55
|
+
__normalize(this.element.addEventListener("click", listener));
|
|
56
|
+
let release = () => {
|
|
57
|
+
__normalize(this.element.removeEventListener("click", listener));
|
|
58
|
+
return null;
|
|
59
|
+
};
|
|
60
|
+
__add(this.release, release);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
setCaption(value) {
|
|
64
|
+
__requireArity(arguments.length, [0], "setCaption");
|
|
65
|
+
value = __boundary(value);
|
|
66
|
+
__normalize(this.#content.replace(value));
|
|
67
|
+
return this;
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
dispose() {
|
|
71
|
+
__normalize(this.#content.dispose());
|
|
72
|
+
super.dispose();
|
|
73
|
+
return null;
|
|
74
|
+
return null;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=button.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.mjs","sources":["button.lango"],"sourcesContent":["import \"./control\"\n class Control\nimport \"./templates\"\n cloneMarkup(name, xml)\nimport \"./rich_content\"\n class RichContent\n\nexport class Button(form, props, renderer) : Control\n methods\n setCaption(value)\n dispose()\n\nButton(form, props, renderer)\n super(form, props, cloneMarkup(\"button\", <button type=\"button\" class=\"btn\"></button>))\n @presentations = renderer.presentations\n @url = props.url\n @dismiss = props.dismiss == true\n @content = new RichContent(form, @element, renderer, false)\n theme = props.theme\n if theme == null\n theme = \"primary\"\n @element.classList.add(\"btn-${theme.toLowerCase()}\")\n @element.disabled = props.disabled == true\n setCaption(props.caption)\n if @url != null or @dismiss\n listener = ()\n if @url == null\n @presentations.dismiss(@form)\n return null\n chain @form.send(@url)\n then(ignored)\n if @dismiss\n @presentations.dismiss(@form)\n catch(error)\n @form.app.error(@form, error)\n @element.addEventListener(\"click\", listener)\n release = ()\n capture listener\n @element.removeEventListener(\"click\", listener)\n @release.add(release)\n\nButton:setCaption(value)\n @content.replace(value)\n return @this\n\nButton:dispose()\n @content.dispose()\n super.dispose()\n return null\n"],"names":[],"mappings":";;;;;;;;;;;;;AAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/chip.mjs
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
import { Field, sameValue } from "./fields.mjs";
|
|
2
|
+
import { cloneMarkup } from "./templates.mjs";
|
|
3
|
+
import { RichContent } from "./rich_content.mjs";
|
|
4
|
+
import {
|
|
5
|
+
hostGlobal as __hostGlobal,
|
|
6
|
+
xmlEscape as __xmlEscape,
|
|
7
|
+
isNumber as __isNumber,
|
|
8
|
+
isString as __isString,
|
|
9
|
+
isBool as __isBool,
|
|
10
|
+
isObject as __isObject,
|
|
11
|
+
isArray as __isArray,
|
|
12
|
+
add as __add,
|
|
13
|
+
requireBoolean as __requireBoolean,
|
|
14
|
+
normalize as __normalize,
|
|
15
|
+
boundary as __boundary,
|
|
16
|
+
requireArity as __requireArity,
|
|
17
|
+
} from "./.lango/runtime.mjs";
|
|
18
|
+
|
|
19
|
+
export class Chip extends Field {
|
|
20
|
+
#locked;
|
|
21
|
+
#payload;
|
|
22
|
+
#active;
|
|
23
|
+
#icon;
|
|
24
|
+
#action;
|
|
25
|
+
constructor(form, props, renderer) {
|
|
26
|
+
super(form, props, cloneMarkup("chip", ["<button type=\"button\" class=\"btn rounded-pill lango-chip\"><span class=\"lango-chip-icon\" aria-hidden=\"true\"></span><span></span></button>"].join("")));
|
|
27
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
28
|
+
form = __boundary(form);
|
|
29
|
+
props = __boundary(props);
|
|
30
|
+
renderer = __boundary(renderer);
|
|
31
|
+
this.#locked = __normalize(props.readonly) === true;
|
|
32
|
+
this.#payload = __normalize(props.value);
|
|
33
|
+
this.#active = __normalize(props.active) === true;
|
|
34
|
+
__normalize(this.input.setAttribute("aria-pressed", `${__normalize(this.#active)}`));
|
|
35
|
+
__normalize(this.input.classList.toggle("active", __normalize(this.#active)));
|
|
36
|
+
let theme = __normalize(props.theme);
|
|
37
|
+
if (__requireBoolean(theme === null)) {
|
|
38
|
+
theme = "secondary";
|
|
39
|
+
}
|
|
40
|
+
__add(this.input.classList, `btn-outline-${__normalize(theme.toLowerCase())}`);
|
|
41
|
+
if (__requireBoolean(__normalize(this.labelElement) !== null)) {
|
|
42
|
+
this.labelElement.className = "visually-hidden";
|
|
43
|
+
}
|
|
44
|
+
this.#icon = new RichContent(form, __normalize(this.input.firstElementChild), renderer, false, "Chip icon");
|
|
45
|
+
if (__requireBoolean(__isString(__normalize(props.icon)))) {
|
|
46
|
+
let symbol = __normalize(__hostGlobal(["document"]).createElement("i"));
|
|
47
|
+
symbol.className = __normalize(props.icon);
|
|
48
|
+
__normalize(this.input.firstElementChild.appendChild(symbol));
|
|
49
|
+
} else {
|
|
50
|
+
__normalize(this.#icon.replace(__normalize(props.icon)));
|
|
51
|
+
}
|
|
52
|
+
let caption = __normalize(props.label);
|
|
53
|
+
if (__requireBoolean(__requireBoolean(caption === null) && __requireBoolean(__isString(__normalize(props.value))))) {
|
|
54
|
+
caption = __normalize(props.value);
|
|
55
|
+
}
|
|
56
|
+
this.setCaption(caption);
|
|
57
|
+
this.#action = null;
|
|
58
|
+
if (__requireBoolean(__normalize(props.button) !== null)) {
|
|
59
|
+
if (__requireBoolean(__requireBoolean(!__requireBoolean(__isObject(__normalize(props.button)))) || __requireBoolean(props.button.type !== "button"))) {
|
|
60
|
+
throw "Chip button requires a Button definition";
|
|
61
|
+
}
|
|
62
|
+
let action = __normalize(__hostGlobal(["document"]).createElement("span"));
|
|
63
|
+
action.className = "lango-chip-action";
|
|
64
|
+
__normalize(this.element.insertBefore(action, __normalize(this.input.nextSibling)));
|
|
65
|
+
this.#action = new RichContent(form, action, renderer);
|
|
66
|
+
__normalize(this.#action.replace(__normalize(props.button)));
|
|
67
|
+
}
|
|
68
|
+
this.setDisabled(__normalize(props.disabled) === true);
|
|
69
|
+
let click = () => {
|
|
70
|
+
this.#active = !__requireBoolean(__normalize(this.#active));
|
|
71
|
+
this.#paint();
|
|
72
|
+
return null;
|
|
73
|
+
};
|
|
74
|
+
__normalize(this.input.addEventListener("click", click));
|
|
75
|
+
let release = () => {
|
|
76
|
+
__normalize(this.input.removeEventListener("click", click));
|
|
77
|
+
return null;
|
|
78
|
+
};
|
|
79
|
+
__add(this.release, release);
|
|
80
|
+
}
|
|
81
|
+
#paint() {
|
|
82
|
+
__normalize(this.input.setAttribute("aria-pressed", `${__normalize(this.#active)}`));
|
|
83
|
+
__normalize(this.input.classList.toggle("active", __normalize(this.#active)));
|
|
84
|
+
return null;
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
getValue() {
|
|
88
|
+
if (__requireBoolean(__normalize(this.#active))) {
|
|
89
|
+
return __normalize(this.#payload);
|
|
90
|
+
}
|
|
91
|
+
return null;
|
|
92
|
+
return null;
|
|
93
|
+
}
|
|
94
|
+
setValue(value) {
|
|
95
|
+
__requireArity(arguments.length, [0], "setValue");
|
|
96
|
+
value = __boundary(value);
|
|
97
|
+
if (__requireBoolean(__requireBoolean(value !== null) && __requireBoolean(!__requireBoolean(sameValue(value, __normalize(this.#payload)))))) {
|
|
98
|
+
throw "Chip value does not match its configured value";
|
|
99
|
+
}
|
|
100
|
+
this.#active = value !== null;
|
|
101
|
+
this.#paint();
|
|
102
|
+
return this;
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
setDisabled(value) {
|
|
106
|
+
__requireArity(arguments.length, [0], "setDisabled");
|
|
107
|
+
value = __boundary(value);
|
|
108
|
+
this.input.disabled = __requireBoolean(value) || __requireBoolean(__normalize(this.#locked) === true);
|
|
109
|
+
return this;
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
setCaption(value) {
|
|
113
|
+
__requireArity(arguments.length, [0], "setCaption");
|
|
114
|
+
value = __boundary(value);
|
|
115
|
+
this.input.lastElementChild.textContent = value;
|
|
116
|
+
if (__requireBoolean(__normalize(this.labelElement) !== null)) {
|
|
117
|
+
this.labelElement.textContent = value;
|
|
118
|
+
}
|
|
119
|
+
return this;
|
|
120
|
+
return null;
|
|
121
|
+
}
|
|
122
|
+
dispose() {
|
|
123
|
+
if (__requireBoolean(__normalize(this.#icon) !== null)) {
|
|
124
|
+
__normalize(this.#icon.dispose());
|
|
125
|
+
}
|
|
126
|
+
if (__requireBoolean(__normalize(this.#action) !== null)) {
|
|
127
|
+
__normalize(this.#action.dispose());
|
|
128
|
+
}
|
|
129
|
+
super.dispose();
|
|
130
|
+
return null;
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=chip.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chip.mjs","sources":["chip.lango"],"sourcesContent":["import js global document\nimport \"./fields\"\n class Field\n sameValue(first, second)\nimport \"./templates\"\n cloneMarkup(name, xml)\nimport \"./rich_content\"\n class RichContent\n\nexport class Chip(form, props, renderer) : Field\n methods\n getValue()\n setValue(value)\n setDisabled(value)\n setCaption(value)\n dispose()\n\nChip(form, props, renderer)\n super(form, props, cloneMarkup(\"chip\", <button type=\"button\" class=\"btn rounded-pill lango-chip\"><span class=\"lango-chip-icon\" aria-hidden=\"true\"></span><span></span></button>))\n @locked = props.readonly == true\n @payload = props.value\n @active = props.active == true\n @input.setAttribute(\"aria-pressed\", \"${@active}\")\n @input.classList.toggle(\"active\", @active)\n theme = props.theme\n if theme == null\n theme = \"secondary\"\n @input.classList.add(\"btn-outline-${theme.toLowerCase()}\")\n if @labelElement != null\n @labelElement.className = \"visually-hidden\"\n @icon = new RichContent(form, @input.firstElementChild, renderer, false, \"Chip icon\")\n if is_string(props.icon)\n symbol = document/createElement(\"i\")\n symbol.className = props.icon\n @input.firstElementChild.appendChild(symbol)\n else\n @icon.replace(props.icon)\n caption = props.label\n if caption == null and is_string(props.value)\n caption = props.value\n setCaption(caption)\n @action = null\n if props.button != null\n if !is_object(props.button) or props.button.type != \"button\"\n throw \"Chip button requires a Button definition\"\n action = document/createElement(\"span\")\n action.className = \"lango-chip-action\"\n @element.insertBefore(action, @input.nextSibling)\n @action = new RichContent(form, action, renderer)\n @action.replace(props.button)\n setDisabled(props.disabled == true)\n click = ()\n @active = !@active\n paint()\n @input.addEventListener(\"click\", click)\n release = ()\n capture click\n @input.removeEventListener(\"click\", click)\n @release.add(release)\n\nChip:paint()\n @input.setAttribute(\"aria-pressed\", \"${@active}\")\n @input.classList.toggle(\"active\", @active)\n return null\n\nChip:getValue()\n if @active\n return @payload\n return null\n\nChip:setValue(value)\n if value != null and !sameValue(value, @payload)\n throw \"Chip value does not match its configured value\"\n @active = value != null\n paint()\n return @this\n\nChip:setDisabled(value)\n @input.disabled = value or @locked == true\n return @this\n\nChip:setCaption(value)\n @input.lastElementChild.textContent = value\n if @labelElement != null\n @labelElement.textContent = value\n return @this\n\nChip:dispose()\n if @icon != null\n @icon.dispose()\n if @action != null\n @action.dispose()\n super.dispose()\n return null\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AASA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/client.css
ADDED
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
.lango-waiting { position: relative; cursor: progress; }
|
|
2
|
+
.lango-waiting > * { filter: blur(1px); pointer-events: none; }
|
|
3
|
+
.lango-waiting::after {
|
|
4
|
+
content: "";
|
|
5
|
+
position: absolute;
|
|
6
|
+
inset: 50% auto auto 50%;
|
|
7
|
+
width: 2rem;
|
|
8
|
+
height: 2rem;
|
|
9
|
+
border: .2rem solid currentColor;
|
|
10
|
+
border-right-color: transparent;
|
|
11
|
+
border-radius: 50%;
|
|
12
|
+
animation: lango-spin .8s linear infinite;
|
|
13
|
+
}
|
|
14
|
+
@keyframes lango-spin { to { transform: rotate(360deg); } }
|
|
15
|
+
.lango-indeterminate .progress-bar { opacity: .65; }
|
|
16
|
+
.lango-progress { position: relative; }
|
|
17
|
+
.lango-progress-label { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; color: var(--bs-body-color); }
|
|
18
|
+
.lango-toast-stack, .lango-toast-region { display: flex; flex-direction: column; gap: .75rem; }
|
|
19
|
+
.lango-toast-region { position: fixed; z-index: 1080; padding: .5rem; max-width: 95vw; }
|
|
20
|
+
.lango-toast-region[data-position^="top-"] { top: .5rem; }
|
|
21
|
+
.lango-toast-region[data-position^="middle-"] { top: 50%; transform: translateY(-50%); }
|
|
22
|
+
.lango-toast-region[data-position^="bottom-"] { bottom: .5rem; }
|
|
23
|
+
.lango-toast-region[data-position$="-left"] { left: .5rem; }
|
|
24
|
+
.lango-toast-region[data-position$="-center"] { left: 50%; transform: translateX(-50%); }
|
|
25
|
+
.lango-toast-region[data-position$="-right"] { right: .5rem; }
|
|
26
|
+
.lango-toast-region[data-position="middle-center"] { transform: translate(-50%, -50%); }
|
|
27
|
+
.lango-dialog { border: 0; border-radius: .5rem; padding: 0; width: min(90vw, 500px); max-height: 90vh; }
|
|
28
|
+
.lango-dialog::backdrop { background: rgb(0 0 0 / .5); }
|
|
29
|
+
.lango-dialog-blur::backdrop { backdrop-filter: blur(4px); }
|
|
30
|
+
.lango-dialog-sm { width: min(90vw, 300px); }
|
|
31
|
+
.lango-dialog-lg { width: min(90vw, 800px); }
|
|
32
|
+
.lango-dialog-xl { width: min(95vw, 1140px); }
|
|
33
|
+
.lango-dialog-fullscreen { width: 100vw; max-width: none; height: 100vh; max-height: none; border-radius: 0; }
|
|
34
|
+
.lango-dialog-scrollable .lango-dialog-content { max-height: 75vh; overflow-y: auto; }
|
|
35
|
+
.lango-card-main { flex: 1; min-width: 0; }
|
|
36
|
+
.lango-card-media .figure { display: block; margin: 0; }
|
|
37
|
+
.lango-card-media img { display: block; width: 100%; margin: 0; }
|
|
38
|
+
.lango-card-horizontal { flex-direction: row; }
|
|
39
|
+
.lango-card-horizontal .lango-card-media { flex: 0 0 35%; min-width: 0; }
|
|
40
|
+
.lango-tab-vertical { display: flex; gap: 1rem; }
|
|
41
|
+
.lango-tab-vertical > [role=tablist] { flex-shrink: 0; }
|
|
42
|
+
.lango-tab > .tab-content { flex: 1; min-width: 0; }
|
|
43
|
+
.lango-resizable-cell { position: relative; padding-right: 1rem !important; }
|
|
44
|
+
.lango-col-resize { position: absolute; inset: 0 0 0 auto; width: .65rem; border: 0; padding: 0; background: transparent; cursor: col-resize; touch-action: none; }
|
|
45
|
+
.lango-col-resize:hover, .lango-col-resize:focus-visible { background: var(--bs-primary); opacity: .5; }
|
|
46
|
+
.lango-nav { flex-wrap: nowrap; overflow-x: auto; }
|
|
47
|
+
.lango-nav > .nav-link { flex-shrink: 0; }
|
|
48
|
+
.lango-nav-compact > .nav-link:not(.lango-nav-keep) .lango-nav-label { display: none; }
|
|
49
|
+
.lango-menu { display: inline-block; }
|
|
50
|
+
.lango-menu > .dropdown-menu { max-width: calc(100vw - 1rem); }
|
|
51
|
+
.lango-menu .dropdown-item { white-space: normal; }
|
|
52
|
+
.lango-submenu > .dropdown-menu { position: static; margin-left: .75rem; }
|
|
53
|
+
.lango-submenu > [aria-haspopup=menu]::after { content: " ▸"; }
|
|
54
|
+
.lango-menu-split { display: grid; grid-template-columns: minmax(0, 1fr) 2.5rem; }
|
|
55
|
+
.lango-menu-split > .dropdown-menu { grid-column: 1 / -1; }
|
|
56
|
+
.lango-menu-split > .lango-submenu-toggle::after { content: none; }
|
|
57
|
+
.lango-menu-icon { display: inline-block; margin-inline-end: .5rem; }
|
|
58
|
+
.lango-accordion-small .accordion-button, .lango-accordion-small .accordion-body { padding: .5rem .75rem; font-size: .875rem; }
|
|
59
|
+
.lango-accordion-gap { display: flex; flex-direction: column; }
|
|
60
|
+
.lango-accordion-gap > .accordion-item { border: var(--bs-accordion-border-width) solid var(--bs-accordion-border-color); border-radius: var(--bs-accordion-border-radius); overflow: hidden; }
|
|
61
|
+
.lango-input-group { display: grid; grid-template-rows: auto auto auto auto; align-items: stretch; }
|
|
62
|
+
.lango-input-group > * { grid-row: 2; min-width: 0; }
|
|
63
|
+
.lango-input-group > .lango-input-group-field { display: grid; grid-row: 1 / -1; grid-template-rows: subgrid; margin-bottom: 0 !important; }
|
|
64
|
+
.lango-input-group-field > .form-label { grid-row: 1; }
|
|
65
|
+
.lango-input-group-field > :is(input, select, textarea) { grid-row: 2; width: 100%; }
|
|
66
|
+
.lango-input-group-field > .form-text { grid-row: 3; }
|
|
67
|
+
.lango-input-group-field > .invalid-feedback { grid-row: 4; }
|
|
68
|
+
.lango-input-group > :not(:first-child) { margin-inline-start: -1px; }
|
|
69
|
+
.lango-input-group > :not(:first-child):is(.btn, .input-group-text), .lango-input-group > .lango-input-group-field:not(:first-child) > :is(input, select, textarea) { border-start-start-radius: 0; border-end-start-radius: 0; }
|
|
70
|
+
.lango-input-group > :not(:last-child):is(.btn, .input-group-text), .lango-input-group > .lango-input-group-field:not(:last-child) > :is(input, select, textarea) { border-start-end-radius: 0; border-end-end-radius: 0; }
|
|
71
|
+
.lango-input-group-field:focus-within { position: relative; z-index: 3; }
|
|
72
|
+
.lango-markdown { overflow-wrap: anywhere; }
|
|
73
|
+
.lango-markdown img { max-width: 100%; }
|
|
74
|
+
.lango-markdown pre { overflow-x: auto; }
|
|
75
|
+
.lango-markdown table { display: block; overflow-x: auto; }
|
|
76
|
+
.lango-markdown :is(td, th) { border: 1px solid var(--bs-border-color); padding: .25rem .5rem; }
|
|
77
|
+
.lango-avatar { position: relative; display: inline-flex; vertical-align: middle; width: var(--lango-avatar-size); height: var(--lango-avatar-size); }
|
|
78
|
+
.lango-avatar-content { display: grid; place-items: center; width: 100%; height: 100%; overflow: hidden; border-radius: 50%; background: var(--bs-secondary-bg); }
|
|
79
|
+
.lango-avatar-content :is(.figure, img) { width: 100%; height: 100%; margin: 0; object-fit: cover; }
|
|
80
|
+
.lango-avatar-status { position: absolute; bottom: 0; right: 0; width: 25%; height: 25%; border: 2px solid var(--bs-body-bg); border-radius: 50%; background: var(--bs-secondary); }
|
|
81
|
+
.lango-avatar-status[data-status=online] { background: var(--bs-success); }
|
|
82
|
+
.lango-avatar-status[data-status=busy] { background: var(--bs-danger); }
|
|
83
|
+
.lango-avatar-status[data-status=away] { background: var(--bs-warning); }
|
|
84
|
+
.lango-chip-icon:not(:empty) { margin-inline-end: .4rem; }
|
|
85
|
+
.lango-chip-action { display: inline-block; margin-inline-start: .25rem; }
|
|
86
|
+
.lango-combo { position: relative; }
|
|
87
|
+
.lango-combo-panel { position: absolute; z-index: 1050; inset-inline: 0; max-height: 18rem; overflow: auto; background: var(--bs-body-bg); box-shadow: 0 .3rem .6rem rgb(0 0 0 / .15); }
|
|
88
|
+
.lango-combo-panel ul { list-style: none; padding: 0; margin: 0; }
|
|
89
|
+
.lango-combo-heading { padding: .5rem 1rem; font-weight: 600; }
|
|
90
|
+
.lango-combo-panel [role=option]:focus { outline: 2px solid var(--bs-primary); outline-offset: -2px; }
|
|
91
|
+
.lango-form-spinner { position: absolute; inset: 0; z-index: 1060; display: flex; justify-content: center; align-items: center; gap: .75rem; min-height: 3rem; background: rgba(var(--bs-body-bg-rgb), .65); }
|
|
92
|
+
.lango-form-spinner[hidden] { display: none; }
|
|
93
|
+
.lango-waiting > .lango-form-spinner { filter: none; }
|
|
94
|
+
.lango-custom-spinner::after { display: none; }
|
|
95
|
+
.lango-spinner-rotate { width: 2rem; height: 2rem; border: .25rem dotted currentColor; border-radius: 50%; animation: lango-spin .8s linear infinite; }
|
|
96
|
+
|
|
97
|
+
/* Columns stack below the same 48rem boundary advertised in request headers. */
|
|
98
|
+
.lango-row { display: flex; flex-wrap: wrap; gap: var(--lango-gap, 1rem); min-width: 0; }
|
|
99
|
+
.lango-row > .lango-col { flex: 0 0 100%; width: 100% !important; min-width: 0; max-width: 100%; }
|
|
100
|
+
@media (min-width: 48rem) {
|
|
101
|
+
.lango-row > .lango-col { flex: var(--lango-grow, 1) 1 var(--lango-basis, 0px); width: auto !important; }
|
|
102
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { Control } from "./control.mjs";
|
|
2
|
+
import { cloneMarkup } from "./templates.mjs";
|
|
3
|
+
import { decorate } from "./content.mjs";
|
|
4
|
+
import {
|
|
5
|
+
hostGlobal as __hostGlobal,
|
|
6
|
+
xmlEscape as __xmlEscape,
|
|
7
|
+
isNumber as __isNumber,
|
|
8
|
+
isString as __isString,
|
|
9
|
+
isBool as __isBool,
|
|
10
|
+
isObject as __isObject,
|
|
11
|
+
isArray as __isArray,
|
|
12
|
+
add as __add,
|
|
13
|
+
requireBoolean as __requireBoolean,
|
|
14
|
+
normalize as __normalize,
|
|
15
|
+
finite as __finite,
|
|
16
|
+
numericAdd as __numericAdd,
|
|
17
|
+
boundary as __boundary,
|
|
18
|
+
requireArity as __requireArity,
|
|
19
|
+
} from "./.lango/runtime.mjs";
|
|
20
|
+
|
|
21
|
+
export class ListGroup extends Control {
|
|
22
|
+
constructor(form, props, renderer) {
|
|
23
|
+
super(form, props, listElement(__normalize(props.numbered) === true));
|
|
24
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
25
|
+
form = __boundary(form);
|
|
26
|
+
props = __boundary(props);
|
|
27
|
+
renderer = __boundary(renderer);
|
|
28
|
+
let items = __normalize(props.items);
|
|
29
|
+
if (__requireBoolean(items === null)) {
|
|
30
|
+
items = [];
|
|
31
|
+
}
|
|
32
|
+
let active = listIndex(__normalize(props.activeIndex), __normalize(items.length));
|
|
33
|
+
if (__requireBoolean(__normalize(props.flush) === true)) {
|
|
34
|
+
__add(this.element.classList, "list-group-flush");
|
|
35
|
+
}
|
|
36
|
+
if (__requireBoolean(__normalize(props.horizontal) === true)) {
|
|
37
|
+
__add(this.element.classList, "list-group-horizontal");
|
|
38
|
+
}
|
|
39
|
+
let index = 0;
|
|
40
|
+
for (const definition of items) {
|
|
41
|
+
let item = __normalize(__hostGlobal(["document"]).createElement("li"));
|
|
42
|
+
item.className = "list-group-item";
|
|
43
|
+
if (__requireBoolean(index === active)) {
|
|
44
|
+
__add(item.classList, "active");
|
|
45
|
+
__normalize(item.setAttribute("aria-current", "true"));
|
|
46
|
+
}
|
|
47
|
+
__normalize(item.appendChild(__normalize(renderer.build(form, definition))));
|
|
48
|
+
__normalize(this.element.appendChild(item));
|
|
49
|
+
index = __numericAdd(index, 1);
|
|
50
|
+
}
|
|
51
|
+
decorate(this, props);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
export function listIndex(value, length) {
|
|
55
|
+
__requireArity(arguments.length, [0, 1], "listIndex");
|
|
56
|
+
value = __boundary(value);
|
|
57
|
+
length = __boundary(length);
|
|
58
|
+
if (__requireBoolean(value === null)) {
|
|
59
|
+
return __finite(-1);
|
|
60
|
+
}
|
|
61
|
+
if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__isNumber(value))) || __requireBoolean(!__requireBoolean(__normalize(__hostGlobal(["Number"]).isInteger(value))))) || __requireBoolean(value < __finite(-1))) || __requireBoolean(value >= length))) {
|
|
62
|
+
throw "ListGroup activeIndex must identify an item or be -1";
|
|
63
|
+
}
|
|
64
|
+
return value;
|
|
65
|
+
return null;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function listElement(numbered) {
|
|
69
|
+
__requireArity(arguments.length, [0], "listElement");
|
|
70
|
+
numbered = __boundary(numbered);
|
|
71
|
+
if (__requireBoolean(numbered)) {
|
|
72
|
+
return cloneMarkup("list-numbered", ["<ol class=\"list-group list-group-numbered\"></ol>"].join(""));
|
|
73
|
+
}
|
|
74
|
+
return cloneMarkup("list", ["<ul class=\"list-group\"></ul>"].join(""));
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=collections.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"collections.mjs","sources":["collections.lango"],"sourcesContent":["import js global document\nimport js global Number\nimport \"./control\"\n class Control\nimport \"./templates\"\n cloneMarkup(name, xml)\nimport \"./content\"\n decorate(control, props)\n\nexport listIndex(value, length)\n\nlistIndex(value, length)\n if value == null\n return -1\n if !is_number(value) or !Number/isInteger(value) or value < -1 or value >= length\n throw \"ListGroup activeIndex must identify an item or be -1\"\n return value\n\nexport class ListGroup(form, props, renderer) : Control\n\nListGroup(form, props, renderer)\n super(form, props, listElement(props.numbered == true))\n items = props.items\n if items == null\n items = []\n active = listIndex(props.activeIndex, items.length)\n if props.flush == true\n @element.classList.add(\"list-group-flush\")\n if props.horizontal == true\n @element.classList.add(\"list-group-horizontal\")\n index = 0\n for items as definition\n item = document/createElement(\"li\")\n item.className = \"list-group-item\"\n if index == active\n item.classList.add(\"active\")\n item.setAttribute(\"aria-current\", \"true\")\n item.appendChild(renderer.build(form, definition))\n @element.appendChild(item)\n index = index + 1\n decorate(@this, props)\n\nlistElement(numbered)\n if numbered\n return cloneMarkup(\"list-numbered\", <ol class=\"list-group list-group-numbered\"></ol>)\n return cloneMarkup(\"list\", <ul class=\"list-group\"></ul>)\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAkBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAPA;;;;;;;;;;;;;;AA+BA;;;;;;;;;;"}
|