@lango-project/lango-client 0.2.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +1 -0
- package/NOTICE +5 -1
- package/README.md +571 -855
- package/cli/.lango/localization.mjs +108 -0
- package/{dist/node → cli}/.lango/runtime.mjs +112 -19
- 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 +112 -19
- 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 +636 -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 +95 -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 +139 -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/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 -775
- package/dist/library.mjs.map +1 -1
- package/dist/longpoll.mjs +254 -0
- package/dist/longpoll.mjs.map +1 -0
- package/dist/main.mjs +138 -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 +293 -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/tables.mjs +369 -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 +2540 -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 +42 -0
- package/package.json +26 -40
- package/src/accordion.lango +198 -0
- package/src/activities.lango +132 -0
- package/src/app.lango +508 -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 +100 -0
- package/src/create.lango +42 -0
- package/src/date_input.lango +215 -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 -571
- package/src/longpoll.lango +187 -0
- package/src/main.lango +109 -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 +288 -0
- package/src/rich_content.lango +66 -0
- package/src/tables.lango +271 -0
- package/src/tabs.lango +144 -0
- package/src/templates.lango +29 -0
- package/src/widgets.lango +141 -0
- package/web/client.css +95 -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 -431
- 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 -302
- 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 -72
- package/examples/demo_test.lango +0 -356
- package/examples/index.html +0 -28
- package/examples/pages.lango +0 -180
- 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 -1986
- package/src/session.lango +0 -313
- 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 -40
- package/template/gitignore +0 -4
- package/template/package.json +0 -22
- package/template/public/app.css +0 -4
- 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/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/navigation.mjs
CHANGED
|
@@ -1,466 +1,316 @@
|
|
|
1
|
+
import { Control } from "./control.mjs";
|
|
2
|
+
import { cloneMarkup } from "./templates.mjs";
|
|
3
|
+
import { appendContent, decorate } from "./content.mjs";
|
|
1
4
|
import {
|
|
2
5
|
hostGlobal as __hostGlobal,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
getClass as __getClass,
|
|
7
|
-
isKindof as __isKindof,
|
|
6
|
+
xmlEscape as __xmlEscape,
|
|
7
|
+
fromJson as __fromJson,
|
|
8
|
+
toJson as __toJson,
|
|
8
9
|
isNumber as __isNumber,
|
|
9
10
|
isString as __isString,
|
|
10
11
|
isBool as __isBool,
|
|
11
12
|
isObject as __isObject,
|
|
12
13
|
isArray as __isArray,
|
|
13
|
-
|
|
14
|
+
add as __add,
|
|
15
|
+
remove as __remove,
|
|
14
16
|
requireBoolean as __requireBoolean,
|
|
15
17
|
normalize as __normalize,
|
|
16
18
|
finite as __finite,
|
|
17
|
-
numericAdd as __numericAdd,
|
|
18
|
-
call as __call,
|
|
19
19
|
boundary as __boundary,
|
|
20
20
|
requireArity as __requireArity,
|
|
21
|
-
withArity as __withArity,
|
|
22
21
|
} from "./.lango/runtime.mjs";
|
|
23
22
|
|
|
24
|
-
export class
|
|
25
|
-
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
window = __boundary(window);
|
|
46
|
-
options = __boundary(options);
|
|
47
|
-
if (__requireBoolean(__requireBoolean(!__requireBoolean(__isObject(options))) || __requireBoolean(!__requireBoolean(__isKindof(__normalize(options.onUrl), Function))))) {
|
|
48
|
-
throw "UiNavigationRequiresUrlHandler";
|
|
49
|
-
}
|
|
50
|
-
this.#window = window;
|
|
51
|
-
this.#document = __normalize(window.document);
|
|
52
|
-
this.#onUrl = __normalize(options.onUrl);
|
|
53
|
-
this.#errors = __normalize(options.errors);
|
|
54
|
-
this.#redirect = __normalize(options.rootRedirect);
|
|
55
|
-
this.#guard = __normalize(options.beforeNavigate);
|
|
56
|
-
if (__requireBoolean(__requireBoolean(__normalize(this.#guard) !== null) && __requireBoolean(!__requireBoolean(__isKindof(__normalize(this.#guard), Function))))) {
|
|
57
|
-
throw "UiNavigationGuardRequiresFunction";
|
|
58
|
-
}
|
|
59
|
-
this.#owner = __normalize(__hostGlobal(["crypto"]).randomUUID());
|
|
60
|
-
this.#position = 0;
|
|
61
|
-
this.#restoring = false;
|
|
62
|
-
this.#started = false;
|
|
63
|
-
this.#disposed = false;
|
|
64
|
-
this.#last = null;
|
|
65
|
-
this.url = null;
|
|
66
|
-
this.#initial = null;
|
|
67
|
-
this.#tail = __normalize(__hostGlobal(["Promise"]).resolve());
|
|
68
|
-
this.#click = null;
|
|
69
|
-
this.#pop = null;
|
|
70
|
-
this.#hash = null;
|
|
71
|
-
if (__requireBoolean(__normalize(this.#redirect) !== null)) {
|
|
72
|
-
this.#parseUrl(__normalize(this.#redirect));
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
#parseUrl(value) {
|
|
76
|
-
__requireArity(arguments.length, [0], "parseUrl");
|
|
77
|
-
value = __boundary(value);
|
|
78
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(!__requireBoolean(__isString(value))) || __requireBoolean(value === "")) || __requireBoolean(__normalize(value.includes("\\"))))) {
|
|
79
|
-
throw "UiNavigationRequiresSameOriginUrl";
|
|
80
|
-
}
|
|
81
|
-
let location = __normalize(this.#window.location);
|
|
82
|
-
let target = new (__hostGlobal(["URL"]))(value, __normalize(location.href));
|
|
83
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__normalize(target.origin) !== __normalize(location.origin)) || __requireBoolean(__requireBoolean(__normalize(target.protocol) !== "http:") && __requireBoolean(__normalize(target.protocol) !== "https:"))) || __requireBoolean(__normalize(target.username) !== "")) || __requireBoolean(__normalize(target.password) !== ""))) {
|
|
84
|
-
throw "UiNavigationRequiresSameOriginUrl";
|
|
85
|
-
}
|
|
86
|
-
return target;
|
|
87
|
-
return null;
|
|
88
|
-
}
|
|
89
|
-
start() {
|
|
90
|
-
if (__requireBoolean(__normalize(this.#disposed))) {
|
|
91
|
-
throw "UiNavigationDisposed";
|
|
92
|
-
}
|
|
93
|
-
if (__requireBoolean(__normalize(this.#started))) {
|
|
94
|
-
return __normalize(this.#initial);
|
|
95
|
-
}
|
|
96
|
-
let location = __normalize(this.#window.location);
|
|
97
|
-
if (__requireBoolean(__requireBoolean(__normalize(location.pathname) === "/") && __requireBoolean(__normalize(this.#redirect) !== null))) {
|
|
98
|
-
let target = this.#parseUrl(__normalize(this.#redirect));
|
|
99
|
-
if (__requireBoolean(__normalize(target.search) === "")) {
|
|
100
|
-
target.search = __normalize(location.search);
|
|
23
|
+
export class Nav extends Control {
|
|
24
|
+
#items;
|
|
25
|
+
#overflow;
|
|
26
|
+
#url;
|
|
27
|
+
constructor(form, props, renderer, navigationBar = false) {
|
|
28
|
+
super(form, props, cloneMarkup("nav", ["<nav class=\"nav lango-nav\"></nav>"].join("")));
|
|
29
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
30
|
+
form = __boundary(form);
|
|
31
|
+
props = __boundary(props);
|
|
32
|
+
renderer = __boundary(renderer);
|
|
33
|
+
navigationBar = __boundary(navigationBar);
|
|
34
|
+
this.#items = [];
|
|
35
|
+
this.#overflow = __normalize(props.overflow) !== null;
|
|
36
|
+
this.#url = __normalize(form.app.hostUrl());
|
|
37
|
+
if (__requireBoolean(navigationBar)) {
|
|
38
|
+
__add(this.element.classList, "navbar");
|
|
39
|
+
if (__requireBoolean(__normalize(props.brand) !== null)) {
|
|
40
|
+
let brand = __normalize(__hostGlobal(["document"]).createElement("div"));
|
|
41
|
+
brand.className = "navbar-brand";
|
|
42
|
+
appendContent(form, brand, __normalize(props.brand), renderer);
|
|
43
|
+
__normalize(this.element.appendChild(brand));
|
|
101
44
|
}
|
|
102
|
-
|
|
103
|
-
|
|
45
|
+
}
|
|
46
|
+
if (__normalize(props.alignment) === "center") {
|
|
47
|
+
__add(this.element.classList, "justify-content-center");
|
|
48
|
+
} else if (__normalize(props.alignment) === "end") {
|
|
49
|
+
__add(this.element.classList, "justify-content-end");
|
|
50
|
+
} else if (__normalize(props.alignment) === "vertical") {
|
|
51
|
+
__add(this.element.classList, "flex-column");
|
|
52
|
+
} else if (__normalize(props.alignment) === "fill") {
|
|
53
|
+
__add(this.element.classList, "nav-fill");
|
|
54
|
+
}
|
|
55
|
+
let placement = null;
|
|
56
|
+
if (__requireBoolean(__normalize(props.items) !== null)) {
|
|
57
|
+
for (const definition of __normalize(props.items)) {
|
|
58
|
+
if (__requireBoolean(__requireBoolean(__normalize(definition.type) !== "navItem") && __requireBoolean(__normalize(definition.type) !== "navBarItem"))) {
|
|
59
|
+
throw "Nav accepts NavItem definitions";
|
|
60
|
+
}
|
|
61
|
+
let item = new NavItem(form, definition, renderer);
|
|
62
|
+
__normalize(form.register(__normalize(definition.name), item));
|
|
63
|
+
this.#items.push(item);
|
|
64
|
+
__normalize(this.element.appendChild(__normalize(item.element)));
|
|
65
|
+
if (__requireBoolean(__normalize(definition.placement) !== null)) {
|
|
66
|
+
if (__requireBoolean(__requireBoolean(placement !== null) && __requireBoolean(placement !== __normalize(definition.placement)))) {
|
|
67
|
+
throw "Navbar items must agree on placement";
|
|
68
|
+
}
|
|
69
|
+
placement = __normalize(definition.placement);
|
|
70
|
+
if (__normalize(definition.placement) === "fixed-top" || __normalize(definition.placement) === "fixed-bottom" || __normalize(definition.placement) === "sticky-top" || __normalize(definition.placement) === "sticky-bottom") {
|
|
71
|
+
__add(this.element.classList, __normalize(definition.placement));
|
|
72
|
+
} else {
|
|
73
|
+
throw `Unknown navbar placement: ${__normalize(definition.placement)}`;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
104
76
|
}
|
|
105
|
-
__normalize(this.#window.history.replaceState(null, "", localUrl(target)));
|
|
106
77
|
}
|
|
107
|
-
this.#
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
this
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
event = __boundary(event);
|
|
116
|
-
this.#historyEvent("history");
|
|
117
|
-
return null;
|
|
118
|
-
}, [0], "closure");
|
|
119
|
-
let hash = __withArity((event) => {
|
|
120
|
-
event = __boundary(event);
|
|
121
|
-
this.#historyEvent("hash");
|
|
78
|
+
this.locationChanged(__normalize(this.#url));
|
|
79
|
+
let groups = __normalize(renderer.navigation);
|
|
80
|
+
__add(groups, this);
|
|
81
|
+
let release = () => {
|
|
82
|
+
let index = __normalize(groups.indexOf(this));
|
|
83
|
+
if (__requireBoolean(index >= 0)) {
|
|
84
|
+
__normalize(groups.splice(index, 1));
|
|
85
|
+
}
|
|
122
86
|
return null;
|
|
123
|
-
}
|
|
124
|
-
this
|
|
125
|
-
this.#
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
__normalize(this.#window.addEventListener("popstate", pop));
|
|
129
|
-
__normalize(this.#window.addEventListener("hashchange", hash));
|
|
130
|
-
this.#initial = this.#notify("start");
|
|
131
|
-
return __normalize(this.#initial);
|
|
87
|
+
};
|
|
88
|
+
__add(this.release, release);
|
|
89
|
+
if (__requireBoolean(__normalize(this.#overflow))) {
|
|
90
|
+
let observer = new (__hostGlobal(["ResizeObserver"]))(() => {
|
|
91
|
+
this.fit();
|
|
132
92
|
return null;
|
|
93
|
+
});
|
|
94
|
+
__normalize(observer.observe(__normalize(this.element)));
|
|
95
|
+
let stop = () => {
|
|
96
|
+
__normalize(observer.disconnect());
|
|
97
|
+
return null;
|
|
98
|
+
};
|
|
99
|
+
__add(this.release, stop);
|
|
100
|
+
}
|
|
133
101
|
}
|
|
134
|
-
|
|
135
|
-
__requireArity(arguments.length, [0], "
|
|
102
|
+
locationChanged(url) {
|
|
103
|
+
__requireArity(arguments.length, [0], "locationChanged");
|
|
136
104
|
url = __boundary(url);
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
throw "UiNavigationRestoringHistory";
|
|
146
|
-
}
|
|
147
|
-
if (__requireBoolean(!__requireBoolean(__isBool(replace)))) {
|
|
148
|
-
throw "UiNavigationReplaceMustBeBoolean";
|
|
149
|
-
}
|
|
150
|
-
let target = this.#parseUrl(url);
|
|
151
|
-
let path = localUrl(target);
|
|
152
|
-
if (__requireBoolean(path === localUrl(__normalize(this.#window.location)))) {
|
|
153
|
-
if (__requireBoolean(__normalize(this.#last) === null)) {
|
|
154
|
-
if (__requireBoolean(!__requireBoolean(this.#canNavigate(path, "navigate")))) {
|
|
155
|
-
return __normalize(__hostGlobal(["Promise"]).resolve(false));
|
|
105
|
+
let best = __finite(-1);
|
|
106
|
+
let selected = null;
|
|
107
|
+
for (const item of __normalize(this.#items)) {
|
|
108
|
+
if (__requireBoolean(__normalize(item.url) !== null)) {
|
|
109
|
+
let score = navigationMatch(__normalize(item.url), url);
|
|
110
|
+
if (__requireBoolean(score > best)) {
|
|
111
|
+
best = score;
|
|
112
|
+
selected = item;
|
|
156
113
|
}
|
|
157
|
-
return this.#notify("navigate");
|
|
158
114
|
}
|
|
159
|
-
return __normalize(__hostGlobal(["Promise"]).resolve(null));
|
|
160
|
-
}
|
|
161
|
-
if (__requireBoolean(!__requireBoolean(this.#canNavigate(path, "navigate")))) {
|
|
162
|
-
return __normalize(__hostGlobal(["Promise"]).resolve(false));
|
|
163
|
-
}
|
|
164
|
-
if (__requireBoolean(replace)) {
|
|
165
|
-
__normalize(this.#window.history.replaceState(this.#historyState(__normalize(this.#position), path), "", path));
|
|
166
|
-
} else {
|
|
167
|
-
this.#position = __numericAdd(__normalize(this.#position), 1);
|
|
168
|
-
__normalize(this.#window.history.pushState(this.#historyState(__normalize(this.#position), path), "", path));
|
|
169
115
|
}
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
__requireArity(arguments.length, [0, 1], "canNavigate");
|
|
175
|
-
path = __boundary(path);
|
|
176
|
-
source = __boundary(source);
|
|
177
|
-
if (__requireBoolean(__normalize(this.#guard) === null)) {
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
let callback = __normalize(this.#guard);
|
|
181
|
-
let result = __call(callback, { url: path, source: source });
|
|
182
|
-
if (__requireBoolean(!__requireBoolean(__isBool(result)))) {
|
|
183
|
-
if (__requireBoolean(__requireBoolean(result !== null) && __requireBoolean(__isKindof(__normalize(result.then), Function)))) {
|
|
184
|
-
recovered(__normalize(__hostGlobal(["Promise"]).resolve(result)));
|
|
116
|
+
for (const item of __normalize(this.#items)) {
|
|
117
|
+
let active = __normalize(item.initial);
|
|
118
|
+
if (__requireBoolean(__normalize(item.url) !== null)) {
|
|
119
|
+
active = item === selected;
|
|
185
120
|
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
#historyState(position, path) {
|
|
192
|
-
__requireArity(arguments.length, [0, 1], "historyState");
|
|
193
|
-
position = __boundary(position);
|
|
194
|
-
path = __boundary(path);
|
|
195
|
-
let result = { };
|
|
196
|
-
let previous = __normalize(this.#window.history.state);
|
|
197
|
-
if (__requireBoolean(__requireBoolean(__isObject(previous)) && __requireBoolean(!__requireBoolean(__isArray(previous))))) {
|
|
198
|
-
for (const [name, value] of __entries(previous)) {
|
|
199
|
-
result[name] = value;
|
|
200
|
-
}
|
|
201
|
-
} else {
|
|
202
|
-
if (__requireBoolean(previous !== null)) {
|
|
203
|
-
result.previousState = previous;
|
|
121
|
+
__normalize(item.element.classList.toggle("active", active));
|
|
122
|
+
if (__requireBoolean(active)) {
|
|
123
|
+
__normalize(item.element.setAttribute("aria-current", "page"));
|
|
124
|
+
} else {
|
|
125
|
+
__normalize(item.element.removeAttribute("aria-current"));
|
|
204
126
|
}
|
|
205
127
|
}
|
|
206
|
-
result["__langoNavigation"] = { owner: __normalize(this.#owner), index: position, url: path };
|
|
207
|
-
return result;
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
#historyEvent(source) {
|
|
211
|
-
__requireArity(arguments.length, [0], "historyEvent");
|
|
212
|
-
source = __boundary(source);
|
|
213
|
-
try {
|
|
214
|
-
this.#moveHistory(source);
|
|
215
|
-
} catch (error) {
|
|
216
|
-
this.#report(error);
|
|
217
|
-
}
|
|
218
128
|
return null;
|
|
219
129
|
return null;
|
|
220
130
|
}
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
let state = __normalize(this.#window.history.state);
|
|
226
|
-
let marker = null;
|
|
227
|
-
if (__requireBoolean(state !== null)) {
|
|
228
|
-
marker = __normalize(state["__langoNavigation"]);
|
|
229
|
-
}
|
|
230
|
-
if (__requireBoolean(__normalize(this.#restoring))) {
|
|
231
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(path === __normalize(this.url)) && __requireBoolean(marker !== null)) && __requireBoolean(__normalize(marker.owner) === __normalize(this.#owner))) && __requireBoolean(__normalize(marker.index) === __normalize(this.#position)))) {
|
|
232
|
-
this.#restoring = false;
|
|
233
|
-
}
|
|
234
|
-
return null;
|
|
235
|
-
}
|
|
236
|
-
if (__requireBoolean(path === __normalize(this.url))) {
|
|
237
|
-
if (__requireBoolean(__requireBoolean(marker !== null) && __requireBoolean(__normalize(marker.owner) === __normalize(this.#owner)))) {
|
|
238
|
-
this.#position = __normalize(marker.index);
|
|
239
|
-
}
|
|
240
|
-
return null;
|
|
241
|
-
}
|
|
242
|
-
let position = __numericAdd(__normalize(this.#position), 1);
|
|
243
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(marker !== null) && __requireBoolean(__normalize(marker.owner) === __normalize(this.#owner))) && __requireBoolean(__normalize(marker.url) === path))) {
|
|
244
|
-
position = __normalize(marker.index);
|
|
245
|
-
}
|
|
246
|
-
let allowed = false;
|
|
247
|
-
try {
|
|
248
|
-
allowed = this.#canNavigate(path, source);
|
|
249
|
-
} catch (error) {
|
|
250
|
-
this.#restoreHistory(position);
|
|
251
|
-
throw error;
|
|
252
|
-
}
|
|
253
|
-
if (__requireBoolean(!__requireBoolean(allowed))) {
|
|
254
|
-
this.#restoreHistory(position);
|
|
255
|
-
return null;
|
|
131
|
+
fit() {
|
|
132
|
+
__remove(this.element.classList, "lango-nav-compact");
|
|
133
|
+
if (__requireBoolean(__normalize(this.element.scrollWidth) > __normalize(this.element.clientWidth))) {
|
|
134
|
+
__add(this.element.classList, "lango-nav-compact");
|
|
256
135
|
}
|
|
257
|
-
this.#position = position;
|
|
258
|
-
__normalize(this.#window.history.replaceState(this.#historyState(position, path), "", path));
|
|
259
|
-
this.#observe(this.#notify(source));
|
|
260
136
|
return null;
|
|
261
137
|
return null;
|
|
262
138
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
return null;
|
|
273
|
-
return null;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export class NavBar extends Nav {
|
|
142
|
+
constructor(form, props, renderer) {
|
|
143
|
+
super(form, props, renderer, true);
|
|
144
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
145
|
+
form = __boundary(form);
|
|
146
|
+
props = __boundary(props);
|
|
147
|
+
renderer = __boundary(renderer);
|
|
274
148
|
}
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export class NavItem extends Control {
|
|
152
|
+
url;
|
|
153
|
+
initial;
|
|
154
|
+
constructor(form, props, renderer) {
|
|
155
|
+
super(form, props, navElement(__normalize(props.url)));
|
|
156
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
157
|
+
form = __boundary(form);
|
|
158
|
+
props = __boundary(props);
|
|
159
|
+
renderer = __boundary(renderer);
|
|
160
|
+
this.url = __normalize(props.url);
|
|
161
|
+
this.initial = __normalize(props.active) === true;
|
|
162
|
+
__add(this.element.classList, "nav-link");
|
|
163
|
+
appendNavContent(form, __normalize(this.element), __normalize(props.content), renderer);
|
|
164
|
+
if (__requireBoolean(__requireBoolean(__normalize(this.url) !== null) && __requireBoolean(__normalize(this.element.querySelector("a, button, input, select, textarea, [contenteditable]")) !== null))) {
|
|
165
|
+
throw "A linked NavItem cannot contain interactive controls";
|
|
166
|
+
}
|
|
167
|
+
__normalize(this.element.setAttribute("aria-label", __normalize(this.element.textContent)));
|
|
168
|
+
this.element.title = __normalize(this.element.textContent);
|
|
169
|
+
decorate(this, props);
|
|
170
|
+
if (__requireBoolean(__requireBoolean(__normalize(props.keepVisible) === true) || __requireBoolean(__normalize(this.element.querySelector("img, svg, i, .bi")) === null))) {
|
|
171
|
+
__add(this.element.classList, "lango-nav-keep");
|
|
172
|
+
}
|
|
173
|
+
if (__requireBoolean(__normalize(props.theme) !== null)) {
|
|
174
|
+
__add(this.element.classList, `text-bg-${__normalize(props.theme.toLowerCase())}`);
|
|
175
|
+
}
|
|
176
|
+
if (__requireBoolean(__normalize(props.dark) === true)) {
|
|
177
|
+
__normalize(this.element.setAttribute("data-bs-theme", "dark"));
|
|
178
|
+
}
|
|
179
|
+
if (__requireBoolean(__normalize(props.translucent) === true)) {
|
|
180
|
+
__normalize(this.element.style.setProperty("--bs-bg-opacity", ".85"));
|
|
285
181
|
}
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
182
|
+
}
|
|
183
|
+
setCaption(value) {
|
|
184
|
+
__requireArity(arguments.length, [0], "setCaption");
|
|
185
|
+
value = __boundary(value);
|
|
186
|
+
this.element.textContent = value;
|
|
187
|
+
__normalize(this.element.setAttribute("aria-label", value));
|
|
188
|
+
this.element.title = value;
|
|
189
|
+
__add(this.element.classList, "lango-nav-keep");
|
|
190
|
+
return this;
|
|
290
191
|
return null;
|
|
291
192
|
}
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export class NavBarItem extends NavItem {
|
|
196
|
+
constructor(form, props, renderer) {
|
|
197
|
+
super(form, props, renderer);
|
|
198
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
199
|
+
form = __boundary(form);
|
|
200
|
+
props = __boundary(props);
|
|
201
|
+
renderer = __boundary(renderer);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
export class Breadcrumb extends Control {
|
|
206
|
+
constructor(form, props, renderer) {
|
|
207
|
+
super(form, props, cloneMarkup("breadcrumb", ["<nav><ol class=\"breadcrumb\"></ol></nav>"].join("")));
|
|
208
|
+
__requireArity(arguments.length, [0, 1, 2], "constructor");
|
|
209
|
+
form = __boundary(form);
|
|
210
|
+
props = __boundary(props);
|
|
211
|
+
renderer = __boundary(renderer);
|
|
212
|
+
let list = __normalize(this.element.firstElementChild);
|
|
213
|
+
if (__requireBoolean(__normalize(props.divider) !== null)) {
|
|
214
|
+
__normalize(list.style.setProperty("--bs-breadcrumb-divider", __toJson(`${__normalize(props.divider)}`)));
|
|
215
|
+
}
|
|
216
|
+
if (__requireBoolean(__normalize(props.items) !== null)) {
|
|
217
|
+
for (const definition of __normalize(props.items)) {
|
|
218
|
+
if (__requireBoolean(__normalize(definition.type) !== "breadcrumbItem")) {
|
|
219
|
+
throw "Breadcrumb accepts BreadcrumbItem definitions";
|
|
220
|
+
}
|
|
221
|
+
let item = new BreadcrumbItem(form, definition);
|
|
222
|
+
__normalize(form.register(__normalize(definition.name), item));
|
|
223
|
+
__normalize(list.appendChild(__normalize(item.element)));
|
|
224
|
+
}
|
|
301
225
|
}
|
|
302
|
-
if (__requireBoolean(
|
|
303
|
-
|
|
226
|
+
if (__requireBoolean(__normalize(list.lastElementChild) !== null)) {
|
|
227
|
+
__add(list.lastElementChild.classList, "active");
|
|
228
|
+
__normalize(list.lastElementChild.setAttribute("aria-current", "page"));
|
|
304
229
|
}
|
|
305
|
-
this.#last = null;
|
|
306
|
-
return this.#notify("refresh");
|
|
307
|
-
return null;
|
|
308
230
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
error = __boundary(error);
|
|
322
|
-
if (__requireBoolean(__normalize(this.#last) === __normalize(event.url))) {
|
|
323
|
-
this.#last = null;
|
|
324
|
-
}
|
|
325
|
-
throw error;
|
|
326
|
-
return null;
|
|
327
|
-
}, [0], "closure"));
|
|
328
|
-
return null;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export class BreadcrumbItem extends Control {
|
|
234
|
+
constructor(form, props) {
|
|
235
|
+
super(form, props, cloneMarkup("breadcrumb-item", ["<li class=\"breadcrumb-item\"></li>"].join("")));
|
|
236
|
+
__requireArity(arguments.length, [0, 1], "constructor");
|
|
237
|
+
form = __boundary(form);
|
|
238
|
+
props = __boundary(props);
|
|
239
|
+
decorate(this, props);
|
|
240
|
+
let content = navElement(__normalize(props.url));
|
|
241
|
+
content.textContent = __normalize(props.text);
|
|
242
|
+
__normalize(this.element.appendChild(content));
|
|
329
243
|
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
return
|
|
339
|
-
return null;
|
|
244
|
+
}
|
|
245
|
+
export function navigationMatch(url, current) {
|
|
246
|
+
__requireArity(arguments.length, [0, 1], "navigationMatch");
|
|
247
|
+
url = __boundary(url);
|
|
248
|
+
current = __boundary(current);
|
|
249
|
+
let target = new (__hostGlobal(["URL"]))(url, current);
|
|
250
|
+
let location = new (__hostGlobal(["URL"]))(current);
|
|
251
|
+
if (__requireBoolean(__normalize(target.origin) !== __normalize(location.origin))) {
|
|
252
|
+
return __finite(-1);
|
|
340
253
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
__requireArity(arguments.length, [0], "report");
|
|
345
|
-
error = __boundary(error);
|
|
346
|
-
if (__requireBoolean(__normalize(this.#disposed))) {
|
|
347
|
-
return null;
|
|
348
|
-
}
|
|
349
|
-
if (__requireBoolean(__normalize(this.#errors) !== null)) {
|
|
350
|
-
__normalize(this.#errors.error(error));
|
|
351
|
-
} else {
|
|
352
|
-
__normalize(__contextGet("log").err(error));
|
|
353
|
-
}
|
|
354
|
-
return null;
|
|
355
|
-
return null;
|
|
356
|
-
} finally {
|
|
357
|
-
__contextRestore(__contextScope);
|
|
358
|
-
}
|
|
254
|
+
let path = __normalize(target.pathname);
|
|
255
|
+
if (__requireBoolean(path === __normalize(location.pathname))) {
|
|
256
|
+
return __normalize(path.length);
|
|
359
257
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
event = __boundary(event);
|
|
363
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__requireBoolean(__normalize(this.#disposed)) || __requireBoolean(__normalize(event.defaultPrevented) === true)) || __requireBoolean(__normalize(event.metaKey) === true)) || __requireBoolean(__normalize(event.ctrlKey) === true)) || __requireBoolean(__normalize(event.shiftKey) === true)) || __requireBoolean(__normalize(event.altKey) === true))) {
|
|
364
|
-
return null;
|
|
365
|
-
}
|
|
366
|
-
if (__requireBoolean(__requireBoolean(__normalize(event.button) !== null) && __requireBoolean(__normalize(event.button) !== 0))) {
|
|
367
|
-
return null;
|
|
368
|
-
}
|
|
369
|
-
let anchor = this.#link(__normalize(event.target));
|
|
370
|
-
if (__requireBoolean(__requireBoolean(anchor === null) || __requireBoolean(__normalize(anchor.hasAttribute("download"))))) {
|
|
371
|
-
return null;
|
|
372
|
-
}
|
|
373
|
-
let href = __normalize(anchor.getAttribute("href"));
|
|
374
|
-
if (__requireBoolean(__requireBoolean(href === null) || __requireBoolean(href === ""))) {
|
|
375
|
-
return null;
|
|
376
|
-
}
|
|
377
|
-
let target = __normalize(anchor.getAttribute("target"));
|
|
378
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(target !== null) && __requireBoolean(target !== "")) && __requireBoolean(__normalize(target.toLowerCase()) !== "_self"))) {
|
|
379
|
-
return null;
|
|
380
|
-
}
|
|
381
|
-
try {
|
|
382
|
-
let destination = new (__hostGlobal(["URL"]))(href, __normalize(this.#window.location.href));
|
|
383
|
-
if (__requireBoolean(__requireBoolean(__normalize(destination.protocol) !== "http:") && __requireBoolean(__normalize(destination.protocol) !== "https:"))) {
|
|
384
|
-
return null;
|
|
385
|
-
}
|
|
386
|
-
let location = __normalize(this.#window.location);
|
|
387
|
-
if (__requireBoolean(__normalize(destination.origin) !== __normalize(location.origin))) {
|
|
388
|
-
if (__requireBoolean(target === null)) {
|
|
389
|
-
__normalize(anchor.setAttribute("target", "_blank"));
|
|
390
|
-
let rel = __normalize(anchor.getAttribute("rel"));
|
|
391
|
-
if (__requireBoolean(__requireBoolean(rel === null) || __requireBoolean(rel === ""))) {
|
|
392
|
-
rel = "noopener";
|
|
393
|
-
} else {
|
|
394
|
-
if (__requireBoolean(!__requireBoolean(__normalize(__normalize(rel.split(" ")).includes("noopener"))))) {
|
|
395
|
-
rel = `${rel} noopener`;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
__normalize(anchor.setAttribute("rel", rel));
|
|
399
|
-
}
|
|
400
|
-
return null;
|
|
401
|
-
}
|
|
402
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(__normalize(destination.pathname) === __normalize(location.pathname)) && __requireBoolean(__normalize(destination.search) === __normalize(location.search))) && __requireBoolean(__requireBoolean(__normalize(destination.hash) !== __normalize(location.hash)) || __requireBoolean(__normalize(href.includes("#")))))) {
|
|
403
|
-
return null;
|
|
404
|
-
}
|
|
405
|
-
__normalize(event.preventDefault());
|
|
406
|
-
this.#observe(this.navigate(__normalize(destination.href)));
|
|
407
|
-
} catch (error) {
|
|
408
|
-
this.#report(error);
|
|
409
|
-
}
|
|
410
|
-
return null;
|
|
411
|
-
return null;
|
|
258
|
+
if (__requireBoolean(__requireBoolean(path !== "/") && __requireBoolean(__normalize(location.pathname.startsWith(`${__normalize(path.replace(new (__hostGlobal(["RegExp"]))("/+$"), ""))}/`))))) {
|
|
259
|
+
return __normalize(path.length);
|
|
412
260
|
}
|
|
413
|
-
|
|
414
|
-
__requireArity(arguments.length, [0], "link");
|
|
415
|
-
element = __boundary(element);
|
|
416
|
-
let current = element;
|
|
417
|
-
let found = null;
|
|
418
|
-
__loop1: while (__requireBoolean(current !== null)) {
|
|
419
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(__normalize(current.inert) === true) || __requireBoolean(__normalize(current.hidden) === true)) || __requireBoolean(__normalize(current.disabled) === true))) {
|
|
420
|
-
return null;
|
|
421
|
-
}
|
|
422
|
-
let name = __normalize(current.tagName);
|
|
423
|
-
if (__requireBoolean(__requireBoolean(__requireBoolean(found === null) && __requireBoolean(__isString(name))) && __requireBoolean(__normalize(name.toLowerCase()) === "a"))) {
|
|
424
|
-
found = current;
|
|
425
|
-
}
|
|
426
|
-
current = __normalize(current.parentNode);
|
|
427
|
-
}
|
|
428
|
-
return found;
|
|
261
|
+
return __finite(-1);
|
|
429
262
|
return null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
function navElement(url) {
|
|
266
|
+
__requireArity(arguments.length, [0], "navElement");
|
|
267
|
+
url = __boundary(url);
|
|
268
|
+
if (__requireBoolean(url === null)) {
|
|
269
|
+
return cloneMarkup("nav-content", ["<div></div>"].join(""));
|
|
430
270
|
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
return null;
|
|
271
|
+
if (__requireBoolean(__requireBoolean(!__requireBoolean(__isString(url))) || __requireBoolean(__normalize(url.trim()) === ""))) {
|
|
272
|
+
throw "NavItem URL must be nonempty text";
|
|
434
273
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
}
|
|
439
|
-
this.#disposed = true;
|
|
440
|
-
if (__requireBoolean(__normalize(this.#started))) {
|
|
441
|
-
__normalize(this.#document.removeEventListener("click", __normalize(this.#click)));
|
|
442
|
-
__normalize(this.#window.removeEventListener("popstate", __normalize(this.#pop)));
|
|
443
|
-
__normalize(this.#window.removeEventListener("hashchange", __normalize(this.#hash)));
|
|
444
|
-
}
|
|
445
|
-
return null;
|
|
446
|
-
return null;
|
|
274
|
+
let target = new (__hostGlobal(["URL"]))(url, __normalize(__hostGlobal(["document"]).baseURI));
|
|
275
|
+
if (__requireBoolean(__requireBoolean(__normalize(target.protocol) !== "http:") && __requireBoolean(__normalize(target.protocol) !== "https:"))) {
|
|
276
|
+
throw "Unsupported navigation URL";
|
|
447
277
|
}
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
target = __boundary(target);
|
|
452
|
-
return `${__normalize(target.pathname)}${__normalize(target.search)}${__normalize(target.hash)}`;
|
|
278
|
+
let element = __normalize(__hostGlobal(["document"]).createElement("a"));
|
|
279
|
+
element.href = __normalize(target.href);
|
|
280
|
+
return element;
|
|
453
281
|
return null;
|
|
454
282
|
}
|
|
455
283
|
|
|
456
|
-
function
|
|
457
|
-
__requireArity(arguments.length, [0], "
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
284
|
+
function appendNavContent(form, element, content, renderer) {
|
|
285
|
+
__requireArity(arguments.length, [0, 1, 2, 3], "appendNavContent");
|
|
286
|
+
form = __boundary(form);
|
|
287
|
+
element = __boundary(element);
|
|
288
|
+
content = __boundary(content);
|
|
289
|
+
renderer = __boundary(renderer);
|
|
290
|
+
let label;
|
|
291
|
+
let child;
|
|
292
|
+
if (__requireBoolean(content === null)) {
|
|
462
293
|
return null;
|
|
463
|
-
}
|
|
294
|
+
}
|
|
295
|
+
if (__requireBoolean(__isArray(content))) {
|
|
296
|
+
for (const child of content) {
|
|
297
|
+
appendNavContent(form, element, child, renderer);
|
|
298
|
+
}
|
|
299
|
+
} else {
|
|
300
|
+
if (__requireBoolean(__requireBoolean(__isString(content)) || __requireBoolean(__isNumber(content)))) {
|
|
301
|
+
label = __normalize(__hostGlobal(["document"]).createElement("span"));
|
|
302
|
+
label.className = "lango-nav-label";
|
|
303
|
+
label.textContent = `${content}`;
|
|
304
|
+
__normalize(element.appendChild(label));
|
|
305
|
+
} else {
|
|
306
|
+
child = __normalize(renderer.build(form, content));
|
|
307
|
+
if (__requireBoolean(__normalize(content.type) === "text")) {
|
|
308
|
+
__add(child.classList, "lango-nav-label");
|
|
309
|
+
}
|
|
310
|
+
__normalize(element.appendChild(child));
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
return null;
|
|
464
314
|
return null;
|
|
465
315
|
}
|
|
466
316
|
//# sourceMappingURL=navigation.mjs.map
|