@brandup/ui-app 1.0.5 → 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 +9 -224
- package/dist/cjs/index.js.map +1 -1
- package/dist/mjs/index.js +8 -223
- package/dist/mjs/index.js.map +1 -1
- package/dist/types.d.ts +0 -4
- package/package.json +2 -2
package/dist/cjs/index.js
CHANGED
|
@@ -1,219 +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 || !callback)
|
|
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 if (typeof callback === "function")
|
|
140
|
-
this.__destroyCallbacks.push(callback);
|
|
141
|
-
else
|
|
142
|
-
throw new Error("Unsupported callback type.");
|
|
143
|
-
}
|
|
144
|
-
toString() {
|
|
145
|
-
return this.typeName;
|
|
146
|
-
}
|
|
147
|
-
destroy() {
|
|
148
|
-
const elem = this.__element;
|
|
149
|
-
if (!elem)
|
|
150
|
-
return;
|
|
151
|
-
delete elem.dataset[constants$1.ElemAttributeName];
|
|
152
|
-
delete elem[constants$1.ElemPropertyName];
|
|
153
|
-
delete this.__element;
|
|
154
|
-
delete this.__events;
|
|
155
|
-
delete this.__commands;
|
|
156
|
-
if (this.__destroyCallbacks) {
|
|
157
|
-
this.__destroyCallbacks.map(callback => {
|
|
158
|
-
try {
|
|
159
|
-
callback();
|
|
160
|
-
}
|
|
161
|
-
catch (reason) {
|
|
162
|
-
console.error(`Error in call "${this.typeName}" destroy callback.`);
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
delete this.__destroyCallbacks;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
const fundUiElementByCommand = (elem, commandName) => {
|
|
170
|
-
while (elem) {
|
|
171
|
-
if (elem.dataset[constants$1.ElemAttributeName]) {
|
|
172
|
-
const uiElem = elem[constants$1.ElemPropertyName];
|
|
173
|
-
if (uiElem.hasCommand(commandName))
|
|
174
|
-
return uiElem;
|
|
175
|
-
}
|
|
176
|
-
if (typeof elem.parentElement === "undefined")
|
|
177
|
-
elem = elem.parentNode;
|
|
178
|
-
else if (elem.parentElement)
|
|
179
|
-
elem = elem.parentElement;
|
|
180
|
-
else
|
|
181
|
-
break;
|
|
182
|
-
}
|
|
183
|
-
return null;
|
|
184
|
-
};
|
|
185
|
-
const commandClickHandler = (e) => {
|
|
186
|
-
let commandElem = e.target;
|
|
187
|
-
while (commandElem) {
|
|
188
|
-
if (commandElem.dataset[constants$1.CommandAttributeName])
|
|
189
|
-
break;
|
|
190
|
-
if (commandElem === e.currentTarget)
|
|
191
|
-
return;
|
|
192
|
-
commandElem = commandElem.parentElement;
|
|
193
|
-
}
|
|
194
|
-
if (!commandElem)
|
|
195
|
-
return;
|
|
196
|
-
const commandName = commandElem.dataset[constants$1.CommandAttributeName];
|
|
197
|
-
if (!commandName)
|
|
198
|
-
throw new Error("Command data attribute is not have value.");
|
|
199
|
-
const uiElem = fundUiElementByCommand(commandElem, commandName);
|
|
200
|
-
if (uiElem) {
|
|
201
|
-
const result = uiElem.__execCommand(commandName, commandElem);
|
|
202
|
-
if (result.status == "success" && result.context.transparent)
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
else
|
|
206
|
-
console.warn(`Not find handler for command "${commandName}".`);
|
|
207
|
-
e.preventDefault();
|
|
208
|
-
e.stopPropagation();
|
|
209
|
-
e.stopImmediatePropagation();
|
|
210
|
-
};
|
|
211
|
-
window.addEventListener("click", commandClickHandler, false);
|
|
212
|
-
|
|
213
|
-
HTMLElement.prototype.ui = function (factory) {
|
|
214
|
-
factory(this);
|
|
215
|
-
return this;
|
|
216
|
-
};
|
|
3
|
+
var ui = require('@brandup/ui');
|
|
217
4
|
|
|
218
5
|
class MiddlewareInvoker {
|
|
219
6
|
middleware;
|
|
@@ -265,8 +52,8 @@ const result = {
|
|
|
265
52
|
};
|
|
266
53
|
|
|
267
54
|
var constants = /*#__PURE__*/Object.freeze({
|
|
268
|
-
|
|
269
|
-
|
|
55
|
+
__proto__: null,
|
|
56
|
+
default: result
|
|
270
57
|
});
|
|
271
58
|
|
|
272
59
|
const STATE_MIDDLEWARE_NAME = "app-state";
|
|
@@ -347,8 +134,8 @@ var BROWSER = {
|
|
|
347
134
|
};
|
|
348
135
|
|
|
349
136
|
var browser = /*#__PURE__*/Object.freeze({
|
|
350
|
-
|
|
351
|
-
|
|
137
|
+
__proto__: null,
|
|
138
|
+
default: BROWSER
|
|
352
139
|
});
|
|
353
140
|
|
|
354
141
|
const HYPERLINK_MIDDLEWARE_NAME = "app-hyperlink";
|
|
@@ -619,14 +406,14 @@ var urlHelper = {
|
|
|
619
406
|
};
|
|
620
407
|
|
|
621
408
|
var url = /*#__PURE__*/Object.freeze({
|
|
622
|
-
|
|
623
|
-
|
|
409
|
+
__proto__: null,
|
|
410
|
+
default: urlHelper
|
|
624
411
|
});
|
|
625
412
|
|
|
626
413
|
/**
|
|
627
414
|
* Base application class.
|
|
628
415
|
*/
|
|
629
|
-
class Application extends UIElement {
|
|
416
|
+
class Application extends ui.UIElement {
|
|
630
417
|
env;
|
|
631
418
|
model;
|
|
632
419
|
__invoker;
|
|
@@ -644,9 +431,7 @@ class Application extends UIElement {
|
|
|
644
431
|
get typeName() { return "Application"; }
|
|
645
432
|
/** Middleware methods invoker. */
|
|
646
433
|
get invoker() { return this.__invoker; }
|
|
647
|
-
/**
|
|
648
|
-
* @param middlewares Initialize application with middlewares. Using in ApplicationBuilder.
|
|
649
|
-
*/
|
|
434
|
+
/** @internal */
|
|
650
435
|
initialize(middlewares) {
|
|
651
436
|
if (this.__isInitialized)
|
|
652
437
|
throw 'Application already initialized.';
|
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 || !callback)\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 if (typeof callback === \"function\")\n this.__destroyCallbacks.push(callback);\n else\n throw new Error(\"Unsupported callback type.\");\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,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;AACxD,YAAY,MAAM,2BAA2B,CAAC;AAC9C,QAAQ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AAC9B,QAAQ,IAAI,CAACA,WAAS,CAAC,gBAAgB,CAAC,GAAG,IAAI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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/mjs/index.js
CHANGED
|
@@ -1,217 +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 || !callback)
|
|
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 if (typeof callback === "function")
|
|
138
|
-
this.__destroyCallbacks.push(callback);
|
|
139
|
-
else
|
|
140
|
-
throw new Error("Unsupported callback type.");
|
|
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
|
-
};
|
|
1
|
+
import { UIElement } from '@brandup/ui';
|
|
215
2
|
|
|
216
3
|
class MiddlewareInvoker {
|
|
217
4
|
middleware;
|
|
@@ -263,8 +50,8 @@ const result = {
|
|
|
263
50
|
};
|
|
264
51
|
|
|
265
52
|
var constants = /*#__PURE__*/Object.freeze({
|
|
266
|
-
|
|
267
|
-
|
|
53
|
+
__proto__: null,
|
|
54
|
+
default: result
|
|
268
55
|
});
|
|
269
56
|
|
|
270
57
|
const STATE_MIDDLEWARE_NAME = "app-state";
|
|
@@ -345,8 +132,8 @@ var BROWSER = {
|
|
|
345
132
|
};
|
|
346
133
|
|
|
347
134
|
var browser = /*#__PURE__*/Object.freeze({
|
|
348
|
-
|
|
349
|
-
|
|
135
|
+
__proto__: null,
|
|
136
|
+
default: BROWSER
|
|
350
137
|
});
|
|
351
138
|
|
|
352
139
|
const HYPERLINK_MIDDLEWARE_NAME = "app-hyperlink";
|
|
@@ -617,8 +404,8 @@ var urlHelper = {
|
|
|
617
404
|
};
|
|
618
405
|
|
|
619
406
|
var url = /*#__PURE__*/Object.freeze({
|
|
620
|
-
|
|
621
|
-
|
|
407
|
+
__proto__: null,
|
|
408
|
+
default: urlHelper
|
|
622
409
|
});
|
|
623
410
|
|
|
624
411
|
/**
|
|
@@ -642,9 +429,7 @@ class Application extends UIElement {
|
|
|
642
429
|
get typeName() { return "Application"; }
|
|
643
430
|
/** Middleware methods invoker. */
|
|
644
431
|
get invoker() { return this.__invoker; }
|
|
645
|
-
/**
|
|
646
|
-
* @param middlewares Initialize application with middlewares. Using in ApplicationBuilder.
|
|
647
|
-
*/
|
|
432
|
+
/** @internal */
|
|
648
433
|
initialize(middlewares) {
|
|
649
434
|
if (this.__isInitialized)
|
|
650
435
|
throw 'Application already initialized.';
|
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 || !callback)\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 if (typeof callback === \"function\")\n this.__destroyCallbacks.push(callback);\n else\n throw new Error(\"Unsupported callback type.\");\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,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC;AACxD,YAAY,MAAM,2BAA2B,CAAC;AAC9C,QAAQ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;AAC9B,QAAQ,IAAI,CAACA,WAAS,CAAC,gBAAgB,CAAC,GAAG,IAAI,CAAC;AAChD,QAAQ,IAAI,CAAC,OAAO,CAACA,WAAS,CAAC,iBAAiB,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;AAClE,QAAQ,IAAI,CAAC,WAAW,CAACA,WAAS,CAAC,gBAAgB,EAAE,EAAE,UAAU,EAAE,KAAK,EAAE,OAAO,EAAE,IAA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|
@@ -98,10 +98,6 @@ declare class Application<TModel extends ApplicationModel = ApplicationModel> ex
|
|
|
98
98
|
get typeName(): string;
|
|
99
99
|
/** Middleware methods invoker. */
|
|
100
100
|
get invoker(): MiddlewareInvoker;
|
|
101
|
-
/**
|
|
102
|
-
* @param middlewares Initialize application with middlewares. Using in ApplicationBuilder.
|
|
103
|
-
*/
|
|
104
|
-
initialize(middlewares: Array<Middleware>): void;
|
|
105
101
|
protected onInitialize(): void;
|
|
106
102
|
/**
|
|
107
103
|
* Get middleware by type.
|
package/package.json
CHANGED