@brandup/ui-app 1.0.4 → 1.0.6
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/cjs/index.js +25 -236
- package/dist/cjs/index.js.map +1 -1
- package/dist/mjs/index.js +24 -235
- package/dist/mjs/index.js.map +1 -1
- package/dist/types.d.ts +5 -6
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,217 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
ElemAttributeName: "uiElement",
|
|
5
|
-
ElemPropertyName: "uielement",
|
|
6
|
-
CommandAttributeName: "command",
|
|
7
|
-
CommandExecutingCssClassName: "executing",
|
|
8
|
-
CommandEventName: "uicommand"
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
class UIElement {
|
|
12
|
-
__element;
|
|
13
|
-
__events;
|
|
14
|
-
__commands;
|
|
15
|
-
__destroyCallbacks;
|
|
16
|
-
// Element members
|
|
17
|
-
get element() { return this.__element; }
|
|
18
|
-
setElement(elem) {
|
|
19
|
-
if (!elem)
|
|
20
|
-
throw "Not set value elem.";
|
|
21
|
-
if (this.__element || UIElement.hasElement(elem))
|
|
22
|
-
throw "UIElement already defined";
|
|
23
|
-
this.__element = elem;
|
|
24
|
-
elem[constants$1.ElemPropertyName] = this;
|
|
25
|
-
elem.dataset[constants$1.ElemAttributeName] = this.typeName;
|
|
26
|
-
this.defineEvent(constants$1.CommandEventName, { cancelable: false, bubbles: true });
|
|
27
|
-
this._onRenderElement(elem);
|
|
28
|
-
}
|
|
29
|
-
// static members
|
|
30
|
-
static hasElement(elem) {
|
|
31
|
-
return !!elem.dataset[constants$1.ElemAttributeName];
|
|
32
|
-
}
|
|
33
|
-
// HTMLElement event members
|
|
34
|
-
defineEvent(eventName, eventOptions) {
|
|
35
|
-
if (!this.__events)
|
|
36
|
-
this.__events = {};
|
|
37
|
-
this.__events[eventName] = eventOptions ? eventOptions : null;
|
|
38
|
-
}
|
|
39
|
-
raiseEvent(eventName, eventArgs) {
|
|
40
|
-
if (!this.__events || !(eventName in this.__events))
|
|
41
|
-
throw new Error(`Not found event "${eventName}".`);
|
|
42
|
-
const eventOptions = this.__events[eventName];
|
|
43
|
-
const eventInit = {};
|
|
44
|
-
if (eventOptions) {
|
|
45
|
-
eventInit.bubbles = eventOptions.bubbles;
|
|
46
|
-
eventInit.cancelable = eventOptions.cancelable;
|
|
47
|
-
eventInit.composed = eventOptions.composed;
|
|
48
|
-
}
|
|
49
|
-
eventInit.detail = eventArgs;
|
|
50
|
-
return this.dispatchEvent(new CustomEvent(eventName, eventInit));
|
|
51
|
-
}
|
|
52
|
-
addEventListener(type, listener, options) {
|
|
53
|
-
this.__element?.addEventListener(type, listener, options);
|
|
54
|
-
}
|
|
55
|
-
removeEventListener(type, listener, options) {
|
|
56
|
-
this.__element?.removeEventListener(type, listener, options);
|
|
57
|
-
}
|
|
58
|
-
dispatchEvent(event) {
|
|
59
|
-
if (!this.__element)
|
|
60
|
-
throw new Error("HTMLElement is not defined.");
|
|
61
|
-
return this.__element.dispatchEvent(event);
|
|
62
|
-
}
|
|
63
|
-
// Command members
|
|
64
|
-
registerCommand(name, execute, canExecute) {
|
|
65
|
-
if (!this.__commands)
|
|
66
|
-
this.__commands = {};
|
|
67
|
-
const nornalizedName = name.toLowerCase();
|
|
68
|
-
if (nornalizedName in this.__commands)
|
|
69
|
-
throw new Error(`Command "${name}" already registered.`);
|
|
70
|
-
this.__commands[nornalizedName] = {
|
|
71
|
-
name: name,
|
|
72
|
-
execute,
|
|
73
|
-
canExecute
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
hasCommand(name) {
|
|
77
|
-
return this.__commands && name.toLowerCase() in this.__commands;
|
|
78
|
-
}
|
|
79
|
-
/** @internal */
|
|
80
|
-
__execCommand(name, target) {
|
|
81
|
-
if (!this.__element || !this.__commands)
|
|
82
|
-
throw new Error("UIElement is not set HTMLElement.");
|
|
83
|
-
const key = name.toLowerCase();
|
|
84
|
-
const command = this.__commands[key];
|
|
85
|
-
if (!command)
|
|
86
|
-
throw new Error(`Command "${name}" is not registered.`);
|
|
87
|
-
const context = {
|
|
88
|
-
target,
|
|
89
|
-
uiElem: this
|
|
90
|
-
};
|
|
91
|
-
if (command.isExecuting)
|
|
92
|
-
return { status: "already", context };
|
|
93
|
-
command.isExecuting = true;
|
|
94
|
-
if (!this._onCanExecCommand(name, target)) {
|
|
95
|
-
delete command.isExecuting;
|
|
96
|
-
return { status: "disallow", context };
|
|
97
|
-
}
|
|
98
|
-
if (command.canExecute && !command.canExecute(context)) {
|
|
99
|
-
delete command.isExecuting;
|
|
100
|
-
return { status: "disallow", context };
|
|
101
|
-
}
|
|
102
|
-
this.raiseEvent(constants$1.CommandEventName, {
|
|
103
|
-
name: command.name,
|
|
104
|
-
uiElem: this,
|
|
105
|
-
elem: this.__element
|
|
106
|
-
});
|
|
107
|
-
let isAsync;
|
|
108
|
-
try {
|
|
109
|
-
const commandResult = command.execute(context);
|
|
110
|
-
if (commandResult && commandResult instanceof Promise) {
|
|
111
|
-
isAsync = true;
|
|
112
|
-
target.classList.add(constants$1.CommandExecutingCssClassName);
|
|
113
|
-
commandResult
|
|
114
|
-
.finally(() => {
|
|
115
|
-
target.classList.remove(constants$1.CommandExecutingCssClassName);
|
|
116
|
-
delete command.isExecuting;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
finally {
|
|
121
|
-
if (!isAsync)
|
|
122
|
-
delete command.isExecuting;
|
|
123
|
-
}
|
|
124
|
-
return { status: "success", context: context };
|
|
125
|
-
}
|
|
126
|
-
_onRenderElement(_elem) { }
|
|
127
|
-
_onCanExecCommand(_name, _elem) {
|
|
128
|
-
return true;
|
|
129
|
-
}
|
|
130
|
-
onDestroy(callback) {
|
|
131
|
-
if (!this.__element)
|
|
132
|
-
return;
|
|
133
|
-
if (!this.__destroyCallbacks)
|
|
134
|
-
this.__destroyCallbacks = [];
|
|
135
|
-
if (callback instanceof UIElement)
|
|
136
|
-
this.__destroyCallbacks.push(() => callback.destroy());
|
|
137
|
-
else if (callback instanceof Element)
|
|
138
|
-
this.__destroyCallbacks.push(() => callback.remove());
|
|
139
|
-
else
|
|
140
|
-
this.__destroyCallbacks.push(callback);
|
|
141
|
-
}
|
|
142
|
-
toString() {
|
|
143
|
-
return this.typeName;
|
|
144
|
-
}
|
|
145
|
-
destroy() {
|
|
146
|
-
const elem = this.__element;
|
|
147
|
-
if (!elem)
|
|
148
|
-
return;
|
|
149
|
-
delete elem.dataset[constants$1.ElemAttributeName];
|
|
150
|
-
delete elem[constants$1.ElemPropertyName];
|
|
151
|
-
delete this.__element;
|
|
152
|
-
delete this.__events;
|
|
153
|
-
delete this.__commands;
|
|
154
|
-
if (this.__destroyCallbacks) {
|
|
155
|
-
this.__destroyCallbacks.map(callback => {
|
|
156
|
-
try {
|
|
157
|
-
callback();
|
|
158
|
-
}
|
|
159
|
-
catch (reason) {
|
|
160
|
-
console.error(`Error in call "${this.typeName}" destroy callback.`);
|
|
161
|
-
}
|
|
162
|
-
});
|
|
163
|
-
delete this.__destroyCallbacks;
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
const fundUiElementByCommand = (elem, commandName) => {
|
|
168
|
-
while (elem) {
|
|
169
|
-
if (elem.dataset[constants$1.ElemAttributeName]) {
|
|
170
|
-
const uiElem = elem[constants$1.ElemPropertyName];
|
|
171
|
-
if (uiElem.hasCommand(commandName))
|
|
172
|
-
return uiElem;
|
|
173
|
-
}
|
|
174
|
-
if (typeof elem.parentElement === "undefined")
|
|
175
|
-
elem = elem.parentNode;
|
|
176
|
-
else if (elem.parentElement)
|
|
177
|
-
elem = elem.parentElement;
|
|
178
|
-
else
|
|
179
|
-
break;
|
|
180
|
-
}
|
|
181
|
-
return null;
|
|
182
|
-
};
|
|
183
|
-
const commandClickHandler = (e) => {
|
|
184
|
-
let commandElem = e.target;
|
|
185
|
-
while (commandElem) {
|
|
186
|
-
if (commandElem.dataset[constants$1.CommandAttributeName])
|
|
187
|
-
break;
|
|
188
|
-
if (commandElem === e.currentTarget)
|
|
189
|
-
return;
|
|
190
|
-
commandElem = commandElem.parentElement;
|
|
191
|
-
}
|
|
192
|
-
if (!commandElem)
|
|
193
|
-
return;
|
|
194
|
-
const commandName = commandElem.dataset[constants$1.CommandAttributeName];
|
|
195
|
-
if (!commandName)
|
|
196
|
-
throw new Error("Command data attribute is not have value.");
|
|
197
|
-
const uiElem = fundUiElementByCommand(commandElem, commandName);
|
|
198
|
-
if (uiElem) {
|
|
199
|
-
const result = uiElem.__execCommand(commandName, commandElem);
|
|
200
|
-
if (result.status == "success" && result.context.transparent)
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
else
|
|
204
|
-
console.warn(`Not find handler for command "${commandName}".`);
|
|
205
|
-
e.preventDefault();
|
|
206
|
-
e.stopPropagation();
|
|
207
|
-
e.stopImmediatePropagation();
|
|
208
|
-
};
|
|
209
|
-
window.addEventListener("click", commandClickHandler, false);
|
|
210
|
-
|
|
211
|
-
HTMLElement.prototype.ui = function (factory) {
|
|
212
|
-
factory(this);
|
|
213
|
-
return this;
|
|
214
|
-
};
|
|
3
|
+
var ui = require('@brandup/ui');
|
|
215
4
|
|
|
216
5
|
class MiddlewareInvoker {
|
|
217
6
|
middleware;
|
|
@@ -263,8 +52,8 @@ const result = {
|
|
|
263
52
|
};
|
|
264
53
|
|
|
265
54
|
var constants = /*#__PURE__*/Object.freeze({
|
|
266
|
-
|
|
267
|
-
|
|
55
|
+
__proto__: null,
|
|
56
|
+
default: result
|
|
268
57
|
});
|
|
269
58
|
|
|
270
59
|
const STATE_MIDDLEWARE_NAME = "app-state";
|
|
@@ -345,8 +134,8 @@ var BROWSER = {
|
|
|
345
134
|
};
|
|
346
135
|
|
|
347
136
|
var browser = /*#__PURE__*/Object.freeze({
|
|
348
|
-
|
|
349
|
-
|
|
137
|
+
__proto__: null,
|
|
138
|
+
default: BROWSER
|
|
350
139
|
});
|
|
351
140
|
|
|
352
141
|
const HYPERLINK_MIDDLEWARE_NAME = "app-hyperlink";
|
|
@@ -525,6 +314,7 @@ const parseUrl = (url) => {
|
|
|
525
314
|
hash = hash.substring(1);
|
|
526
315
|
var result = {
|
|
527
316
|
full: "",
|
|
317
|
+
url: "",
|
|
528
318
|
relative: "",
|
|
529
319
|
origin,
|
|
530
320
|
path,
|
|
@@ -563,14 +353,13 @@ const extendQuery = (url, query) => {
|
|
|
563
353
|
}
|
|
564
354
|
rebuildUrl(url);
|
|
565
355
|
};
|
|
566
|
-
const rebuildUrl = (
|
|
567
|
-
let relativeUrl =
|
|
568
|
-
if (
|
|
569
|
-
relativeUrl += "?" +
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
url.relative = relativeUrl;
|
|
356
|
+
const rebuildUrl = (parsedUrl) => {
|
|
357
|
+
let relativeUrl = parsedUrl.path;
|
|
358
|
+
if (parsedUrl.query.size)
|
|
359
|
+
relativeUrl += "?" + parsedUrl.query.toString();
|
|
360
|
+
parsedUrl.url = parsedUrl.origin + relativeUrl;
|
|
361
|
+
parsedUrl.relative = relativeUrl;
|
|
362
|
+
parsedUrl.full = parsedUrl.hash ? `${parsedUrl.url}#${parsedUrl.hash}` : parsedUrl.url;
|
|
574
363
|
};
|
|
575
364
|
const buildUrl = (basePath, path, query, hash) => {
|
|
576
365
|
let url = basePath;
|
|
@@ -617,14 +406,14 @@ var urlHelper = {
|
|
|
617
406
|
};
|
|
618
407
|
|
|
619
408
|
var url = /*#__PURE__*/Object.freeze({
|
|
620
|
-
|
|
621
|
-
|
|
409
|
+
__proto__: null,
|
|
410
|
+
default: urlHelper
|
|
622
411
|
});
|
|
623
412
|
|
|
624
413
|
/**
|
|
625
414
|
* Base application class.
|
|
626
415
|
*/
|
|
627
|
-
class Application extends UIElement {
|
|
416
|
+
class Application extends ui.UIElement {
|
|
628
417
|
env;
|
|
629
418
|
model;
|
|
630
419
|
__invoker;
|
|
@@ -642,9 +431,7 @@ class Application extends UIElement {
|
|
|
642
431
|
get typeName() { return "Application"; }
|
|
643
432
|
/** Middleware methods invoker. */
|
|
644
433
|
get invoker() { return this.__invoker; }
|
|
645
|
-
/**
|
|
646
|
-
* @param middlewares Initialize application with middlewares. Using in ApplicationBuilder.
|
|
647
|
-
*/
|
|
434
|
+
/** @internal */
|
|
648
435
|
initialize(middlewares) {
|
|
649
436
|
if (this.__isInitialized)
|
|
650
437
|
throw 'Application already initialized.';
|
|
@@ -719,13 +506,14 @@ class Application extends UIElement {
|
|
|
719
506
|
app: this,
|
|
720
507
|
source: isFirst ? "first" : "nav",
|
|
721
508
|
data,
|
|
722
|
-
url: navUrl.
|
|
509
|
+
url: navUrl.url,
|
|
723
510
|
origin: navUrl.origin,
|
|
511
|
+
pathAndQuery: navUrl.relative,
|
|
724
512
|
path: navUrl.path,
|
|
725
513
|
query: navUrl.query,
|
|
726
514
|
hash: navUrl.hash,
|
|
727
|
-
|
|
728
|
-
|
|
515
|
+
external: navUrl.external,
|
|
516
|
+
replace
|
|
729
517
|
};
|
|
730
518
|
console.info(context);
|
|
731
519
|
try {
|
|
@@ -775,13 +563,14 @@ class Application extends UIElement {
|
|
|
775
563
|
button,
|
|
776
564
|
method,
|
|
777
565
|
enctype,
|
|
778
|
-
url: navUrl.
|
|
566
|
+
url: navUrl.url,
|
|
779
567
|
origin: navUrl.origin,
|
|
568
|
+
pathAndQuery: navUrl.relative,
|
|
780
569
|
path: navUrl.path,
|
|
781
570
|
query: navUrl.query,
|
|
782
571
|
hash: navUrl.hash,
|
|
783
|
-
|
|
784
|
-
|
|
572
|
+
external: navUrl.external,
|
|
573
|
+
replace: false
|
|
785
574
|
};
|
|
786
575
|
try {
|
|
787
576
|
console.info(`submit ${method} begin ${navUrl.full}`);
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../brandup-ui/dist/mjs/index.js"],"sourcesContent":["const constants = {\n ElemAttributeName: \"uiElement\",\n ElemPropertyName: \"uielement\",\n CommandAttributeName: \"command\",\n CommandExecutingCssClassName: \"executing\",\n CommandEventName: \"uicommand\"\n};\n\nclass UIElement {\n __element;\n __events;\n __commands;\n __destroyCallbacks;\n // Element members\n get element() { return this.__element; }\n setElement(elem) {\n if (!elem)\n throw \"Not set value elem.\";\n if (this.__element || UIElement.hasElement(elem))\n throw \"UIElement already defined\";\n this.__element = elem;\n elem[constants.ElemPropertyName] = this;\n elem.dataset[constants.ElemAttributeName] = this.typeName;\n this.defineEvent(constants.CommandEventName, { cancelable: false, bubbles: true });\n this._onRenderElement(elem);\n }\n // static members\n static hasElement(elem) {\n return !!elem.dataset[constants.ElemAttributeName];\n }\n // HTMLElement event members\n defineEvent(eventName, eventOptions) {\n if (!this.__events)\n this.__events = {};\n this.__events[eventName] = eventOptions ? eventOptions : null;\n }\n raiseEvent(eventName, eventArgs) {\n if (!this.__events || !(eventName in this.__events))\n throw new Error(`Not found event \"${eventName}\".`);\n const eventOptions = this.__events[eventName];\n const eventInit = {};\n if (eventOptions) {\n eventInit.bubbles = eventOptions.bubbles;\n eventInit.cancelable = eventOptions.cancelable;\n eventInit.composed = eventOptions.composed;\n }\n eventInit.detail = eventArgs;\n return this.dispatchEvent(new CustomEvent(eventName, eventInit));\n }\n addEventListener(type, listener, options) {\n this.__element?.addEventListener(type, listener, options);\n }\n removeEventListener(type, listener, options) {\n this.__element?.removeEventListener(type, listener, options);\n }\n dispatchEvent(event) {\n if (!this.__element)\n throw new Error(\"HTMLElement is not defined.\");\n return this.__element.dispatchEvent(event);\n }\n // Command members\n registerCommand(name, execute, canExecute) {\n if (!this.__commands)\n this.__commands = {};\n const nornalizedName = name.toLowerCase();\n if (nornalizedName in this.__commands)\n throw new Error(`Command \"${name}\" already registered.`);\n this.__commands[nornalizedName] = {\n name: name,\n execute,\n canExecute\n };\n }\n hasCommand(name) {\n return this.__commands && name.toLowerCase() in this.__commands;\n }\n /** @internal */\n __execCommand(name, target) {\n if (!this.__element || !this.__commands)\n throw new Error(\"UIElement is not set HTMLElement.\");\n const key = name.toLowerCase();\n const command = this.__commands[key];\n if (!command)\n throw new Error(`Command \"${name}\" is not registered.`);\n const context = {\n target,\n uiElem: this\n };\n if (command.isExecuting)\n return { status: \"already\", context };\n command.isExecuting = true;\n if (!this._onCanExecCommand(name, target)) {\n delete command.isExecuting;\n return { status: \"disallow\", context };\n }\n if (command.canExecute && !command.canExecute(context)) {\n delete command.isExecuting;\n return { status: \"disallow\", context };\n }\n this.raiseEvent(constants.CommandEventName, {\n name: command.name,\n uiElem: this,\n elem: this.__element\n });\n let isAsync;\n try {\n const commandResult = command.execute(context);\n if (commandResult && commandResult instanceof Promise) {\n isAsync = true;\n target.classList.add(constants.CommandExecutingCssClassName);\n commandResult\n .finally(() => {\n target.classList.remove(constants.CommandExecutingCssClassName);\n delete command.isExecuting;\n });\n }\n }\n finally {\n if (!isAsync)\n delete command.isExecuting;\n }\n return { status: \"success\", context: context };\n }\n _onRenderElement(_elem) { }\n _onCanExecCommand(_name, _elem) {\n return true;\n }\n onDestroy(callback) {\n if (!this.__element)\n return;\n if (!this.__destroyCallbacks)\n this.__destroyCallbacks = [];\n if (callback instanceof UIElement)\n this.__destroyCallbacks.push(() => callback.destroy());\n else if (callback instanceof Element)\n this.__destroyCallbacks.push(() => callback.remove());\n else\n this.__destroyCallbacks.push(callback);\n }\n toString() {\n return this.typeName;\n }\n destroy() {\n const elem = this.__element;\n if (!elem)\n return;\n delete elem.dataset[constants.ElemAttributeName];\n delete elem[constants.ElemPropertyName];\n delete this.__element;\n delete this.__events;\n delete this.__commands;\n if (this.__destroyCallbacks) {\n this.__destroyCallbacks.map(callback => {\n try {\n callback();\n }\n catch (reason) {\n console.error(`Error in call \"${this.typeName}\" destroy callback.`);\n }\n });\n delete this.__destroyCallbacks;\n }\n }\n}\nconst fundUiElementByCommand = (elem, commandName) => {\n while (elem) {\n if (elem.dataset[constants.ElemAttributeName]) {\n const uiElem = elem[constants.ElemPropertyName];\n if (uiElem.hasCommand(commandName))\n return uiElem;\n }\n if (typeof elem.parentElement === \"undefined\")\n elem = elem.parentNode;\n else if (elem.parentElement)\n elem = elem.parentElement;\n else\n break;\n }\n return null;\n};\nconst commandClickHandler = (e) => {\n let commandElem = e.target;\n while (commandElem) {\n if (commandElem.dataset[constants.CommandAttributeName])\n break;\n if (commandElem === e.currentTarget)\n return;\n commandElem = commandElem.parentElement;\n }\n if (!commandElem)\n return;\n const commandName = commandElem.dataset[constants.CommandAttributeName];\n if (!commandName)\n throw new Error(\"Command data attribute is not have value.\");\n const uiElem = fundUiElementByCommand(commandElem, commandName);\n if (uiElem) {\n const result = uiElem.__execCommand(commandName, commandElem);\n if (result.status == \"success\" && result.context.transparent)\n return;\n }\n else\n console.warn(`Not find handler for command \"${commandName}\".`);\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n};\nwindow.addEventListener(\"click\", commandClickHandler, false);\n\nHTMLElement.prototype.ui = function (factory) {\n factory(this);\n return this;\n};\n\nconst UICONSTANTS = constants;\n\nexport { UICONSTANTS, UIElement };\n//# sourceMappingURL=index.js.map\n"],"names":["constants"],"mappings":";;AAAA,MAAMA,WAAS,GAAG;AAClB,IAAI,iBAAiB,EAAE,WAAW;AAClC,IAAI,gBAAgB,EAAE,WAAW;AACjC,IAAI,oBAAoB,EAAE,SAAS;AACnC,IAAI,4BAA4B,EAAE,WAAW;AAC7C,IAAI,gBAAgB,EAAE,WAAW;AACjC,CAAC,CAAC;AACF;AACA,MAAM,SAAS,CAAC;AAChB,IAAI,SAAS,CAAC;AACd,IAAI,QAAQ,CAAC;AACb,IAAI,UAAU,CAAC;AACf,IAAI,kBAAkB,CAAC;AACvB;AACA,IAAI,IAAI,OAAO,GAAG,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE;AAC5C,IAAI,UAAU,CAAC,IAAI,EAAE;AACrB,QAAQ,IAAI,CAAC,IAAI;A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/mjs/index.js
CHANGED
|
@@ -1,215 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
ElemAttributeName: "uiElement",
|
|
3
|
-
ElemPropertyName: "uielement",
|
|
4
|
-
CommandAttributeName: "command",
|
|
5
|
-
CommandExecutingCssClassName: "executing",
|
|
6
|
-
CommandEventName: "uicommand"
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
class UIElement {
|
|
10
|
-
__element;
|
|
11
|
-
__events;
|
|
12
|
-
__commands;
|
|
13
|
-
__destroyCallbacks;
|
|
14
|
-
// Element members
|
|
15
|
-
get element() { return this.__element; }
|
|
16
|
-
setElement(elem) {
|
|
17
|
-
if (!elem)
|
|
18
|
-
throw "Not set value elem.";
|
|
19
|
-
if (this.__element || UIElement.hasElement(elem))
|
|
20
|
-
throw "UIElement already defined";
|
|
21
|
-
this.__element = elem;
|
|
22
|
-
elem[constants$1.ElemPropertyName] = this;
|
|
23
|
-
elem.dataset[constants$1.ElemAttributeName] = this.typeName;
|
|
24
|
-
this.defineEvent(constants$1.CommandEventName, { cancelable: false, bubbles: true });
|
|
25
|
-
this._onRenderElement(elem);
|
|
26
|
-
}
|
|
27
|
-
// static members
|
|
28
|
-
static hasElement(elem) {
|
|
29
|
-
return !!elem.dataset[constants$1.ElemAttributeName];
|
|
30
|
-
}
|
|
31
|
-
// HTMLElement event members
|
|
32
|
-
defineEvent(eventName, eventOptions) {
|
|
33
|
-
if (!this.__events)
|
|
34
|
-
this.__events = {};
|
|
35
|
-
this.__events[eventName] = eventOptions ? eventOptions : null;
|
|
36
|
-
}
|
|
37
|
-
raiseEvent(eventName, eventArgs) {
|
|
38
|
-
if (!this.__events || !(eventName in this.__events))
|
|
39
|
-
throw new Error(`Not found event "${eventName}".`);
|
|
40
|
-
const eventOptions = this.__events[eventName];
|
|
41
|
-
const eventInit = {};
|
|
42
|
-
if (eventOptions) {
|
|
43
|
-
eventInit.bubbles = eventOptions.bubbles;
|
|
44
|
-
eventInit.cancelable = eventOptions.cancelable;
|
|
45
|
-
eventInit.composed = eventOptions.composed;
|
|
46
|
-
}
|
|
47
|
-
eventInit.detail = eventArgs;
|
|
48
|
-
return this.dispatchEvent(new CustomEvent(eventName, eventInit));
|
|
49
|
-
}
|
|
50
|
-
addEventListener(type, listener, options) {
|
|
51
|
-
this.__element?.addEventListener(type, listener, options);
|
|
52
|
-
}
|
|
53
|
-
removeEventListener(type, listener, options) {
|
|
54
|
-
this.__element?.removeEventListener(type, listener, options);
|
|
55
|
-
}
|
|
56
|
-
dispatchEvent(event) {
|
|
57
|
-
if (!this.__element)
|
|
58
|
-
throw new Error("HTMLElement is not defined.");
|
|
59
|
-
return this.__element.dispatchEvent(event);
|
|
60
|
-
}
|
|
61
|
-
// Command members
|
|
62
|
-
registerCommand(name, execute, canExecute) {
|
|
63
|
-
if (!this.__commands)
|
|
64
|
-
this.__commands = {};
|
|
65
|
-
const nornalizedName = name.toLowerCase();
|
|
66
|
-
if (nornalizedName in this.__commands)
|
|
67
|
-
throw new Error(`Command "${name}" already registered.`);
|
|
68
|
-
this.__commands[nornalizedName] = {
|
|
69
|
-
name: name,
|
|
70
|
-
execute,
|
|
71
|
-
canExecute
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
hasCommand(name) {
|
|
75
|
-
return this.__commands && name.toLowerCase() in this.__commands;
|
|
76
|
-
}
|
|
77
|
-
/** @internal */
|
|
78
|
-
__execCommand(name, target) {
|
|
79
|
-
if (!this.__element || !this.__commands)
|
|
80
|
-
throw new Error("UIElement is not set HTMLElement.");
|
|
81
|
-
const key = name.toLowerCase();
|
|
82
|
-
const command = this.__commands[key];
|
|
83
|
-
if (!command)
|
|
84
|
-
throw new Error(`Command "${name}" is not registered.`);
|
|
85
|
-
const context = {
|
|
86
|
-
target,
|
|
87
|
-
uiElem: this
|
|
88
|
-
};
|
|
89
|
-
if (command.isExecuting)
|
|
90
|
-
return { status: "already", context };
|
|
91
|
-
command.isExecuting = true;
|
|
92
|
-
if (!this._onCanExecCommand(name, target)) {
|
|
93
|
-
delete command.isExecuting;
|
|
94
|
-
return { status: "disallow", context };
|
|
95
|
-
}
|
|
96
|
-
if (command.canExecute && !command.canExecute(context)) {
|
|
97
|
-
delete command.isExecuting;
|
|
98
|
-
return { status: "disallow", context };
|
|
99
|
-
}
|
|
100
|
-
this.raiseEvent(constants$1.CommandEventName, {
|
|
101
|
-
name: command.name,
|
|
102
|
-
uiElem: this,
|
|
103
|
-
elem: this.__element
|
|
104
|
-
});
|
|
105
|
-
let isAsync;
|
|
106
|
-
try {
|
|
107
|
-
const commandResult = command.execute(context);
|
|
108
|
-
if (commandResult && commandResult instanceof Promise) {
|
|
109
|
-
isAsync = true;
|
|
110
|
-
target.classList.add(constants$1.CommandExecutingCssClassName);
|
|
111
|
-
commandResult
|
|
112
|
-
.finally(() => {
|
|
113
|
-
target.classList.remove(constants$1.CommandExecutingCssClassName);
|
|
114
|
-
delete command.isExecuting;
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
finally {
|
|
119
|
-
if (!isAsync)
|
|
120
|
-
delete command.isExecuting;
|
|
121
|
-
}
|
|
122
|
-
return { status: "success", context: context };
|
|
123
|
-
}
|
|
124
|
-
_onRenderElement(_elem) { }
|
|
125
|
-
_onCanExecCommand(_name, _elem) {
|
|
126
|
-
return true;
|
|
127
|
-
}
|
|
128
|
-
onDestroy(callback) {
|
|
129
|
-
if (!this.__element)
|
|
130
|
-
return;
|
|
131
|
-
if (!this.__destroyCallbacks)
|
|
132
|
-
this.__destroyCallbacks = [];
|
|
133
|
-
if (callback instanceof UIElement)
|
|
134
|
-
this.__destroyCallbacks.push(() => callback.destroy());
|
|
135
|
-
else if (callback instanceof Element)
|
|
136
|
-
this.__destroyCallbacks.push(() => callback.remove());
|
|
137
|
-
else
|
|
138
|
-
this.__destroyCallbacks.push(callback);
|
|
139
|
-
}
|
|
140
|
-
toString() {
|
|
141
|
-
return this.typeName;
|
|
142
|
-
}
|
|
143
|
-
destroy() {
|
|
144
|
-
const elem = this.__element;
|
|
145
|
-
if (!elem)
|
|
146
|
-
return;
|
|
147
|
-
delete elem.dataset[constants$1.ElemAttributeName];
|
|
148
|
-
delete elem[constants$1.ElemPropertyName];
|
|
149
|
-
delete this.__element;
|
|
150
|
-
delete this.__events;
|
|
151
|
-
delete this.__commands;
|
|
152
|
-
if (this.__destroyCallbacks) {
|
|
153
|
-
this.__destroyCallbacks.map(callback => {
|
|
154
|
-
try {
|
|
155
|
-
callback();
|
|
156
|
-
}
|
|
157
|
-
catch (reason) {
|
|
158
|
-
console.error(`Error in call "${this.typeName}" destroy callback.`);
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
delete this.__destroyCallbacks;
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
const fundUiElementByCommand = (elem, commandName) => {
|
|
166
|
-
while (elem) {
|
|
167
|
-
if (elem.dataset[constants$1.ElemAttributeName]) {
|
|
168
|
-
const uiElem = elem[constants$1.ElemPropertyName];
|
|
169
|
-
if (uiElem.hasCommand(commandName))
|
|
170
|
-
return uiElem;
|
|
171
|
-
}
|
|
172
|
-
if (typeof elem.parentElement === "undefined")
|
|
173
|
-
elem = elem.parentNode;
|
|
174
|
-
else if (elem.parentElement)
|
|
175
|
-
elem = elem.parentElement;
|
|
176
|
-
else
|
|
177
|
-
break;
|
|
178
|
-
}
|
|
179
|
-
return null;
|
|
180
|
-
};
|
|
181
|
-
const commandClickHandler = (e) => {
|
|
182
|
-
let commandElem = e.target;
|
|
183
|
-
while (commandElem) {
|
|
184
|
-
if (commandElem.dataset[constants$1.CommandAttributeName])
|
|
185
|
-
break;
|
|
186
|
-
if (commandElem === e.currentTarget)
|
|
187
|
-
return;
|
|
188
|
-
commandElem = commandElem.parentElement;
|
|
189
|
-
}
|
|
190
|
-
if (!commandElem)
|
|
191
|
-
return;
|
|
192
|
-
const commandName = commandElem.dataset[constants$1.CommandAttributeName];
|
|
193
|
-
if (!commandName)
|
|
194
|
-
throw new Error("Command data attribute is not have value.");
|
|
195
|
-
const uiElem = fundUiElementByCommand(commandElem, commandName);
|
|
196
|
-
if (uiElem) {
|
|
197
|
-
const result = uiElem.__execCommand(commandName, commandElem);
|
|
198
|
-
if (result.status == "success" && result.context.transparent)
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
else
|
|
202
|
-
console.warn(`Not find handler for command "${commandName}".`);
|
|
203
|
-
e.preventDefault();
|
|
204
|
-
e.stopPropagation();
|
|
205
|
-
e.stopImmediatePropagation();
|
|
206
|
-
};
|
|
207
|
-
window.addEventListener("click", commandClickHandler, false);
|
|
208
|
-
|
|
209
|
-
HTMLElement.prototype.ui = function (factory) {
|
|
210
|
-
factory(this);
|
|
211
|
-
return this;
|
|
212
|
-
};
|
|
1
|
+
import { UIElement } from '@brandup/ui';
|
|
213
2
|
|
|
214
3
|
class MiddlewareInvoker {
|
|
215
4
|
middleware;
|
|
@@ -261,8 +50,8 @@ const result = {
|
|
|
261
50
|
};
|
|
262
51
|
|
|
263
52
|
var constants = /*#__PURE__*/Object.freeze({
|
|
264
|
-
|
|
265
|
-
|
|
53
|
+
__proto__: null,
|
|
54
|
+
default: result
|
|
266
55
|
});
|
|
267
56
|
|
|
268
57
|
const STATE_MIDDLEWARE_NAME = "app-state";
|
|
@@ -343,8 +132,8 @@ var BROWSER = {
|
|
|
343
132
|
};
|
|
344
133
|
|
|
345
134
|
var browser = /*#__PURE__*/Object.freeze({
|
|
346
|
-
|
|
347
|
-
|
|
135
|
+
__proto__: null,
|
|
136
|
+
default: BROWSER
|
|
348
137
|
});
|
|
349
138
|
|
|
350
139
|
const HYPERLINK_MIDDLEWARE_NAME = "app-hyperlink";
|
|
@@ -523,6 +312,7 @@ const parseUrl = (url) => {
|
|
|
523
312
|
hash = hash.substring(1);
|
|
524
313
|
var result = {
|
|
525
314
|
full: "",
|
|
315
|
+
url: "",
|
|
526
316
|
relative: "",
|
|
527
317
|
origin,
|
|
528
318
|
path,
|
|
@@ -561,14 +351,13 @@ const extendQuery = (url, query) => {
|
|
|
561
351
|
}
|
|
562
352
|
rebuildUrl(url);
|
|
563
353
|
};
|
|
564
|
-
const rebuildUrl = (
|
|
565
|
-
let relativeUrl =
|
|
566
|
-
if (
|
|
567
|
-
relativeUrl += "?" +
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
url.relative = relativeUrl;
|
|
354
|
+
const rebuildUrl = (parsedUrl) => {
|
|
355
|
+
let relativeUrl = parsedUrl.path;
|
|
356
|
+
if (parsedUrl.query.size)
|
|
357
|
+
relativeUrl += "?" + parsedUrl.query.toString();
|
|
358
|
+
parsedUrl.url = parsedUrl.origin + relativeUrl;
|
|
359
|
+
parsedUrl.relative = relativeUrl;
|
|
360
|
+
parsedUrl.full = parsedUrl.hash ? `${parsedUrl.url}#${parsedUrl.hash}` : parsedUrl.url;
|
|
572
361
|
};
|
|
573
362
|
const buildUrl = (basePath, path, query, hash) => {
|
|
574
363
|
let url = basePath;
|
|
@@ -615,8 +404,8 @@ var urlHelper = {
|
|
|
615
404
|
};
|
|
616
405
|
|
|
617
406
|
var url = /*#__PURE__*/Object.freeze({
|
|
618
|
-
|
|
619
|
-
|
|
407
|
+
__proto__: null,
|
|
408
|
+
default: urlHelper
|
|
620
409
|
});
|
|
621
410
|
|
|
622
411
|
/**
|
|
@@ -640,9 +429,7 @@ class Application extends UIElement {
|
|
|
640
429
|
get typeName() { return "Application"; }
|
|
641
430
|
/** Middleware methods invoker. */
|
|
642
431
|
get invoker() { return this.__invoker; }
|
|
643
|
-
/**
|
|
644
|
-
* @param middlewares Initialize application with middlewares. Using in ApplicationBuilder.
|
|
645
|
-
*/
|
|
432
|
+
/** @internal */
|
|
646
433
|
initialize(middlewares) {
|
|
647
434
|
if (this.__isInitialized)
|
|
648
435
|
throw 'Application already initialized.';
|
|
@@ -717,13 +504,14 @@ class Application extends UIElement {
|
|
|
717
504
|
app: this,
|
|
718
505
|
source: isFirst ? "first" : "nav",
|
|
719
506
|
data,
|
|
720
|
-
url: navUrl.
|
|
507
|
+
url: navUrl.url,
|
|
721
508
|
origin: navUrl.origin,
|
|
509
|
+
pathAndQuery: navUrl.relative,
|
|
722
510
|
path: navUrl.path,
|
|
723
511
|
query: navUrl.query,
|
|
724
512
|
hash: navUrl.hash,
|
|
725
|
-
|
|
726
|
-
|
|
513
|
+
external: navUrl.external,
|
|
514
|
+
replace
|
|
727
515
|
};
|
|
728
516
|
console.info(context);
|
|
729
517
|
try {
|
|
@@ -773,13 +561,14 @@ class Application extends UIElement {
|
|
|
773
561
|
button,
|
|
774
562
|
method,
|
|
775
563
|
enctype,
|
|
776
|
-
url: navUrl.
|
|
564
|
+
url: navUrl.url,
|
|
777
565
|
origin: navUrl.origin,
|
|
566
|
+
pathAndQuery: navUrl.relative,
|
|
778
567
|
path: navUrl.path,
|
|
779
568
|
query: navUrl.query,
|
|
780
569
|
hash: navUrl.hash,
|
|
781
|
-
|
|
782
|
-
|
|
570
|
+
external: navUrl.external,
|
|
571
|
+
replace: false
|
|
783
572
|
};
|
|
784
573
|
try {
|
|
785
574
|
console.info(`submit ${method} begin ${navUrl.full}`);
|
package/dist/mjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../brandup-ui/dist/mjs/index.js"],"sourcesContent":["const constants = {\n ElemAttributeName: \"uiElement\",\n ElemPropertyName: \"uielement\",\n CommandAttributeName: \"command\",\n CommandExecutingCssClassName: \"executing\",\n CommandEventName: \"uicommand\"\n};\n\nclass UIElement {\n __element;\n __events;\n __commands;\n __destroyCallbacks;\n // Element members\n get element() { return this.__element; }\n setElement(elem) {\n if (!elem)\n throw \"Not set value elem.\";\n if (this.__element || UIElement.hasElement(elem))\n throw \"UIElement already defined\";\n this.__element = elem;\n elem[constants.ElemPropertyName] = this;\n elem.dataset[constants.ElemAttributeName] = this.typeName;\n this.defineEvent(constants.CommandEventName, { cancelable: false, bubbles: true });\n this._onRenderElement(elem);\n }\n // static members\n static hasElement(elem) {\n return !!elem.dataset[constants.ElemAttributeName];\n }\n // HTMLElement event members\n defineEvent(eventName, eventOptions) {\n if (!this.__events)\n this.__events = {};\n this.__events[eventName] = eventOptions ? eventOptions : null;\n }\n raiseEvent(eventName, eventArgs) {\n if (!this.__events || !(eventName in this.__events))\n throw new Error(`Not found event \"${eventName}\".`);\n const eventOptions = this.__events[eventName];\n const eventInit = {};\n if (eventOptions) {\n eventInit.bubbles = eventOptions.bubbles;\n eventInit.cancelable = eventOptions.cancelable;\n eventInit.composed = eventOptions.composed;\n }\n eventInit.detail = eventArgs;\n return this.dispatchEvent(new CustomEvent(eventName, eventInit));\n }\n addEventListener(type, listener, options) {\n this.__element?.addEventListener(type, listener, options);\n }\n removeEventListener(type, listener, options) {\n this.__element?.removeEventListener(type, listener, options);\n }\n dispatchEvent(event) {\n if (!this.__element)\n throw new Error(\"HTMLElement is not defined.\");\n return this.__element.dispatchEvent(event);\n }\n // Command members\n registerCommand(name, execute, canExecute) {\n if (!this.__commands)\n this.__commands = {};\n const nornalizedName = name.toLowerCase();\n if (nornalizedName in this.__commands)\n throw new Error(`Command \"${name}\" already registered.`);\n this.__commands[nornalizedName] = {\n name: name,\n execute,\n canExecute\n };\n }\n hasCommand(name) {\n return this.__commands && name.toLowerCase() in this.__commands;\n }\n /** @internal */\n __execCommand(name, target) {\n if (!this.__element || !this.__commands)\n throw new Error(\"UIElement is not set HTMLElement.\");\n const key = name.toLowerCase();\n const command = this.__commands[key];\n if (!command)\n throw new Error(`Command \"${name}\" is not registered.`);\n const context = {\n target,\n uiElem: this\n };\n if (command.isExecuting)\n return { status: \"already\", context };\n command.isExecuting = true;\n if (!this._onCanExecCommand(name, target)) {\n delete command.isExecuting;\n return { status: \"disallow\", context };\n }\n if (command.canExecute && !command.canExecute(context)) {\n delete command.isExecuting;\n return { status: \"disallow\", context };\n }\n this.raiseEvent(constants.CommandEventName, {\n name: command.name,\n uiElem: this,\n elem: this.__element\n });\n let isAsync;\n try {\n const commandResult = command.execute(context);\n if (commandResult && commandResult instanceof Promise) {\n isAsync = true;\n target.classList.add(constants.CommandExecutingCssClassName);\n commandResult\n .finally(() => {\n target.classList.remove(constants.CommandExecutingCssClassName);\n delete command.isExecuting;\n });\n }\n }\n finally {\n if (!isAsync)\n delete command.isExecuting;\n }\n return { status: \"success\", context: context };\n }\n _onRenderElement(_elem) { }\n _onCanExecCommand(_name, _elem) {\n return true;\n }\n onDestroy(callback) {\n if (!this.__element)\n return;\n if (!this.__destroyCallbacks)\n this.__destroyCallbacks = [];\n if (callback instanceof UIElement)\n this.__destroyCallbacks.push(() => callback.destroy());\n else if (callback instanceof Element)\n this.__destroyCallbacks.push(() => callback.remove());\n else\n this.__destroyCallbacks.push(callback);\n }\n toString() {\n return this.typeName;\n }\n destroy() {\n const elem = this.__element;\n if (!elem)\n return;\n delete elem.dataset[constants.ElemAttributeName];\n delete elem[constants.ElemPropertyName];\n delete this.__element;\n delete this.__events;\n delete this.__commands;\n if (this.__destroyCallbacks) {\n this.__destroyCallbacks.map(callback => {\n try {\n callback();\n }\n catch (reason) {\n console.error(`Error in call \"${this.typeName}\" destroy callback.`);\n }\n });\n delete this.__destroyCallbacks;\n }\n }\n}\nconst fundUiElementByCommand = (elem, commandName) => {\n while (elem) {\n if (elem.dataset[constants.ElemAttributeName]) {\n const uiElem = elem[constants.ElemPropertyName];\n if (uiElem.hasCommand(commandName))\n return uiElem;\n }\n if (typeof elem.parentElement === \"undefined\")\n elem = elem.parentNode;\n else if (elem.parentElement)\n elem = elem.parentElement;\n else\n break;\n }\n return null;\n};\nconst commandClickHandler = (e) => {\n let commandElem = e.target;\n while (commandElem) {\n if (commandElem.dataset[constants.CommandAttributeName])\n break;\n if (commandElem === e.currentTarget)\n return;\n commandElem = commandElem.parentElement;\n }\n if (!commandElem)\n return;\n const commandName = commandElem.dataset[constants.CommandAttributeName];\n if (!commandName)\n throw new Error(\"Command data attribute is not have value.\");\n const uiElem = fundUiElementByCommand(commandElem, commandName);\n if (uiElem) {\n const result = uiElem.__execCommand(commandName, commandElem);\n if (result.status == \"success\" && result.context.transparent)\n return;\n }\n else\n console.warn(`Not find handler for command \"${commandName}\".`);\n e.preventDefault();\n e.stopPropagation();\n e.stopImmediatePropagation();\n};\nwindow.addEventListener(\"click\", commandClickHandler, false);\n\nHTMLElement.prototype.ui = function (factory) {\n factory(this);\n return this;\n};\n\nconst UICONSTANTS = constants;\n\nexport { UICONSTANTS, UIElement };\n//# sourceMappingURL=index.js.map\n"],"names":["constants"],"mappings":"AAAA,MAAMA,WAAS,GAAG;AAClB,IAAI,iBAAiB,EAAE,WAAW;AAClC,IAAI,gBAAgB,EAAE,WAAW;AACjC,IAAI,oBAAoB,EAAE,SAAS;AACnC,IAAI,4BAA4B,EAAE,WAAW;AAC7C,IAAI,gBAAgB,EAAE,WAAW;AACjC,CAAC,CAAC;AACF;AACA,MAAM,SAAS,CAAC;AAChB,IAAI,SAAS,CAAC;AACd,IAAI,QAAQ,CAAC;AACb,IAAI,UAAU,CAAC;AACf,IAAI,kBAAkB,CAAC;AACvB;AACA,IAAI,IAAI,OAAO,GAAG,EAAE,OAAO,IAAI,CAAC,SAAS,CAAC,EAAE;AAC5C,IAAI,UAAU,CAAC,IAAI,EAAE;AACrB,QAAQ,IAAI,CAAC,IAAI;AACjB,YAAY,MAAM,qBAAqB,CAAC;AACxC,QAAQ,IAAI,IAAI,CAAC,SAAS,IAAI,SA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/types.d.ts
CHANGED
|
@@ -42,19 +42,21 @@ interface NavigateContext<TApplication extends Application = Application, TData
|
|
|
42
42
|
readonly data: TData;
|
|
43
43
|
/** Source navigation event. */
|
|
44
44
|
readonly source: NavigateSource;
|
|
45
|
-
/**
|
|
45
|
+
/** Origin, path and query, but without hash. */
|
|
46
46
|
readonly url: string;
|
|
47
47
|
/** Scheme, host and port. */
|
|
48
48
|
readonly origin: string;
|
|
49
|
+
/** Path and query, but without hash. */
|
|
50
|
+
readonly pathAndQuery: string;
|
|
49
51
|
/** Path of navigation url. */
|
|
50
52
|
readonly path: string;
|
|
51
53
|
/** Query parameters of navigation url. */
|
|
52
54
|
readonly query: URLSearchParams;
|
|
53
55
|
/** Hash of navigation url. */
|
|
54
56
|
readonly hash: string | null;
|
|
55
|
-
/** Replace current navigation entry. */
|
|
56
57
|
/** Navigation origin is different of current page origin. */
|
|
57
58
|
readonly external: boolean;
|
|
59
|
+
/** Replace current navigation entry. */
|
|
58
60
|
replace: boolean;
|
|
59
61
|
}
|
|
60
62
|
/**
|
|
@@ -96,10 +98,6 @@ declare class Application<TModel extends ApplicationModel = ApplicationModel> ex
|
|
|
96
98
|
get typeName(): string;
|
|
97
99
|
/** Middleware methods invoker. */
|
|
98
100
|
get invoker(): MiddlewareInvoker;
|
|
99
|
-
/**
|
|
100
|
-
* @param middlewares Initialize application with middlewares. Using in ApplicationBuilder.
|
|
101
|
-
*/
|
|
102
|
-
initialize(middlewares: Array<Middleware>): void;
|
|
103
101
|
protected onInitialize(): void;
|
|
104
102
|
/**
|
|
105
103
|
* Get middleware by type.
|
|
@@ -176,6 +174,7 @@ declare class ApplicationBuilder<TModel extends ApplicationModel> {
|
|
|
176
174
|
|
|
177
175
|
interface ParsedUrl {
|
|
178
176
|
full: string;
|
|
177
|
+
url: string;
|
|
179
178
|
relative: string;
|
|
180
179
|
origin: string;
|
|
181
180
|
path: string;
|
package/package.json
CHANGED