piral-blazor 1.0.0-pre.2296 → 1.0.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 -1
- package/README.md +51 -9
- package/convert.d.ts +13 -8
- package/convert.js +17 -12
- package/esm/converter.d.ts +10 -4
- package/esm/converter.js +164 -50
- package/esm/converter.js.map +1 -1
- package/esm/create.d.ts +21 -1
- package/esm/create.js +29 -15
- package/esm/create.js.map +1 -1
- package/esm/dependencies.d.ts +6 -3
- package/esm/dependencies.js +104 -14
- package/esm/dependencies.js.map +1 -1
- package/esm/events.d.ts +6 -0
- package/esm/events.js +145 -0
- package/esm/events.js.map +1 -0
- package/esm/interop.d.ts +29 -12
- package/esm/interop.js +181 -119
- package/esm/interop.js.map +1 -1
- package/esm/navigation.d.ts +2 -0
- package/esm/navigation.js +30 -0
- package/esm/navigation.js.map +1 -0
- package/esm/types.d.ts +97 -4
- package/infra.codegen +32 -23
- package/lib/converter.d.ts +10 -4
- package/lib/converter.js +164 -50
- package/lib/converter.js.map +1 -1
- package/lib/create.d.ts +21 -1
- package/lib/create.js +31 -17
- package/lib/create.js.map +1 -1
- package/lib/dependencies.d.ts +6 -3
- package/lib/dependencies.js +104 -14
- package/lib/dependencies.js.map +1 -1
- package/lib/events.d.ts +6 -0
- package/lib/events.js +154 -0
- package/lib/events.js.map +1 -0
- package/lib/index.js +1 -1
- package/lib/interop.d.ts +29 -12
- package/lib/interop.js +196 -124
- package/lib/interop.js.map +1 -1
- package/lib/navigation.d.ts +2 -0
- package/lib/navigation.js +35 -0
- package/lib/navigation.js.map +1 -0
- package/lib/types.d.ts +97 -4
- package/package.json +26 -7
- package/src/converter.ts +233 -63
- package/src/create.ts +53 -9
- package/src/dependencies.ts +122 -14
- package/src/events.ts +174 -0
- package/src/interop.ts +228 -117
- package/src/navigation.ts +36 -0
- package/src/types.ts +115 -4
- package/convert.ts +0 -17
package/lib/converter.js
CHANGED
|
@@ -1,60 +1,174 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createConverter = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const events_1 = require("./events");
|
|
6
|
+
const interop_1 = require("./interop");
|
|
7
|
+
const infra_codegen_1 = require("../infra.codegen");
|
|
8
|
+
const noop = () => { };
|
|
9
|
+
const mediaRules = [
|
|
10
|
+
{ attribute: 'src', selector: 'img, embed, video > source, video > track, audio > source' },
|
|
11
|
+
{ attribute: 'srcset', selector: 'picture > source' },
|
|
12
|
+
];
|
|
13
|
+
function prefixMediaSources(component, prefix) {
|
|
14
|
+
const prefixAttributeValue = (el, attr) => el.setAttribute(attr, prefix + el.getAttribute(attr));
|
|
15
|
+
for (const { attribute, selector } of mediaRules) {
|
|
16
|
+
Array.from(component.querySelectorAll(selector))
|
|
17
|
+
.filter((el) => el.hasAttribute(attribute) && !el.getAttribute(attribute).match(/^https?:/))
|
|
18
|
+
.forEach((el) => prefixAttributeValue(el, attribute));
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function project(component, destination, options) {
|
|
22
|
+
if ((options === null || options === void 0 ? void 0 : options.resourcePathRoot) && !infra_codegen_1.default.noMutation) {
|
|
23
|
+
prefixMediaSources(component, options.resourcePathRoot);
|
|
24
|
+
}
|
|
25
|
+
destination.appendChild(component);
|
|
26
|
+
}
|
|
27
|
+
function makeUrl(href) {
|
|
28
|
+
const origin = document.location.origin;
|
|
29
|
+
if (!href.startsWith(origin)) {
|
|
30
|
+
return `${origin}${href}`;
|
|
31
|
+
}
|
|
32
|
+
return href;
|
|
33
|
+
}
|
|
34
|
+
function createConverter(lazy, opts, language, logLevel) {
|
|
35
|
+
const bootLoader = (0, interop_1.createBootLoader)(infra_codegen_1.default.url, infra_codegen_1.default.satellites);
|
|
36
|
+
const boot = (opts) => bootLoader(opts).then((res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const [_, capabilities] = res;
|
|
38
|
+
if (capabilities.includes('logging')) {
|
|
39
|
+
if (typeof logLevel === 'number') {
|
|
40
|
+
yield (0, interop_1.setLogLevel)(logLevel);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
if (language && capabilities.includes('language')) {
|
|
44
|
+
if (typeof language.current === 'string') {
|
|
45
|
+
yield (0, interop_1.setLanguage)(language.current);
|
|
46
|
+
}
|
|
47
|
+
if (capabilities.includes('events')) {
|
|
48
|
+
const eventDispatcher = document.body.dispatchEvent;
|
|
49
|
+
// listen to all events for forwarding them
|
|
50
|
+
document.body.dispatchEvent = function (ev) {
|
|
51
|
+
if (ev.type.startsWith('piral-')) {
|
|
52
|
+
const type = ev.type.replace('piral-', '');
|
|
53
|
+
const args = ev.detail.arg;
|
|
54
|
+
(0, interop_1.processEvent)(type, args);
|
|
55
|
+
}
|
|
56
|
+
return eventDispatcher.call(this, ev);
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
if (typeof language.onChange === 'function') {
|
|
60
|
+
language.onChange(interop_1.setLanguage);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
window.dispatchEvent(new CustomEvent('loaded-blazor-core'));
|
|
64
|
+
return res;
|
|
65
|
+
}));
|
|
66
|
+
let loader = !lazy && boot(opts);
|
|
67
|
+
let listener = undefined;
|
|
68
|
+
const enqueueChange = (locals, update) => {
|
|
69
|
+
if (typeof update !== 'function') {
|
|
70
|
+
// nothing to do in this case
|
|
71
|
+
}
|
|
72
|
+
else if (locals.state === 'mounted') {
|
|
73
|
+
loader.then(update);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
locals.next = update;
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
const convert = (moduleName, dependency, args, options) => ({
|
|
80
|
+
mount(el, data, ctx, locals) {
|
|
81
|
+
const props = Object.assign(Object.assign({}, args), data);
|
|
82
|
+
const { piral } = data;
|
|
83
|
+
const nav = ctx.navigation;
|
|
84
|
+
el.setAttribute('data-blazor-pilet-root', 'true');
|
|
85
|
+
(0, events_1.addGlobalEventListeners)(el);
|
|
86
|
+
if (listener === undefined) {
|
|
87
|
+
listener = nav.listen(({ location, action }) => {
|
|
88
|
+
// POP is already handled by .NET
|
|
89
|
+
if (action !== 'POP') {
|
|
90
|
+
const url = makeUrl(location.href);
|
|
91
|
+
(0, interop_1.callNotifyLocationChanged)(url, action === 'REPLACE', location.state);
|
|
34
92
|
}
|
|
35
|
-
})
|
|
36
|
-
.catch(function (err) { return console.error(err); });
|
|
37
|
-
dispose = interop_1.attachEvents(el, function (ev) { return data.piral.renderHtmlExtension(ev.detail.target, ev.detail.props); }, function (ev) {
|
|
38
|
-
return ev.detail.replace
|
|
39
|
-
? ctx.router.history.replace(ev.detail.to, ev.detail.store)
|
|
40
|
-
: ctx.router.history.push(ev.detail.to, ev.detail.state);
|
|
41
93
|
});
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
94
|
+
}
|
|
95
|
+
locals.state = 'fresh';
|
|
96
|
+
locals.next = noop;
|
|
97
|
+
locals.dispose = (0, events_1.attachEvents)(el, (ev) => {
|
|
98
|
+
ev.stopPropagation();
|
|
99
|
+
const { target, props } = ev.detail;
|
|
100
|
+
piral.renderHtmlExtension(target, props);
|
|
101
|
+
}, (ev) => {
|
|
102
|
+
ev.stopPropagation();
|
|
103
|
+
const { to, state, replace } = ev.detail;
|
|
104
|
+
replace ? nav.replace(to, state) : nav.push(to, state);
|
|
105
|
+
}, (ev) => {
|
|
106
|
+
ev.stopPropagation();
|
|
107
|
+
const { type, args } = ev.detail;
|
|
108
|
+
piral.emit(type, args);
|
|
109
|
+
});
|
|
110
|
+
function mountClassic(config) {
|
|
111
|
+
return (0, interop_1.activate)(moduleName, props).then((refId) => {
|
|
112
|
+
const [root] = config;
|
|
113
|
+
const node = root.querySelector(`#${refId} > div`);
|
|
114
|
+
locals.unmount = () => {
|
|
115
|
+
var _a;
|
|
116
|
+
(_a = root.querySelector(`#${refId}`)) === null || _a === void 0 ? void 0 : _a.appendChild(node);
|
|
117
|
+
(0, interop_1.deactivate)(moduleName, refId);
|
|
118
|
+
el.innerHTML = '';
|
|
119
|
+
};
|
|
120
|
+
locals.update = (props) => {
|
|
121
|
+
(0, interop_1.reactivate)(moduleName, refId, props);
|
|
122
|
+
};
|
|
123
|
+
project(node, el, options);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
function mountModern(_) {
|
|
127
|
+
return (0, interop_1.createElement)(moduleName, props).then((refId) => {
|
|
128
|
+
const child = document.createElement('piral-blazor-component');
|
|
129
|
+
child.setAttribute('rid', refId);
|
|
130
|
+
el.appendChild(child);
|
|
131
|
+
locals.unmount = () => {
|
|
132
|
+
(0, interop_1.destroyElement)(refId);
|
|
133
|
+
child.remove();
|
|
134
|
+
el.innerHTML = '';
|
|
135
|
+
};
|
|
136
|
+
locals.update = (props) => {
|
|
137
|
+
(0, interop_1.updateElement)(refId, props);
|
|
138
|
+
};
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
(loader || (convert.loader = loader = boot(opts)))
|
|
142
|
+
.then((config) => dependency(config).then(() => {
|
|
143
|
+
if (locals.state === 'fresh') {
|
|
144
|
+
const [_, capabilities, applyChanges] = config;
|
|
145
|
+
const fn = capabilities.includes('custom-element') ? mountModern : mountClassic;
|
|
146
|
+
applyChanges(piral);
|
|
147
|
+
return fn(config).then(() => {
|
|
148
|
+
locals.state = 'mounted';
|
|
149
|
+
locals.next(config);
|
|
150
|
+
locals.next = noop;
|
|
151
|
+
});
|
|
51
152
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
153
|
+
}))
|
|
154
|
+
.catch((err) => console.error(err));
|
|
155
|
+
},
|
|
156
|
+
update(el, data, ctx, locals) {
|
|
157
|
+
enqueueChange(locals, () => {
|
|
158
|
+
var _a;
|
|
159
|
+
(_a = locals.update) === null || _a === void 0 ? void 0 : _a.call(locals, Object.assign(Object.assign({}, args), data));
|
|
160
|
+
});
|
|
161
|
+
},
|
|
162
|
+
unmount(el, locals) {
|
|
163
|
+
(0, events_1.removeGlobalEventListeners)(el);
|
|
164
|
+
el.removeAttribute('data-blazor-pilet-root');
|
|
165
|
+
locals.dispose();
|
|
166
|
+
enqueueChange(locals, locals.unmount);
|
|
167
|
+
locals.state = 'removed';
|
|
168
|
+
},
|
|
169
|
+
});
|
|
57
170
|
convert.loader = loader;
|
|
171
|
+
convert.lazy = lazy;
|
|
58
172
|
return convert;
|
|
59
173
|
}
|
|
60
174
|
exports.createConverter = createConverter;
|
package/lib/converter.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;;AACA,
|
|
1
|
+
{"version":3,"file":"converter.js","sourceRoot":"","sources":["../src/converter.ts"],"names":[],"mappings":";;;;AACA,qCAA6F;AAC7F,uCAYmB;AAQnB,oDAA0C;AAE1C,MAAM,IAAI,GAAG,GAAG,EAAE,GAAE,CAAC,CAAC;AAEtB,MAAM,UAAU,GAAG;IACjB,EAAE,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,2DAA2D,EAAE;IAC3F,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ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AC9B,IAAA,mCAA0B,EAAC,EAAE,CAAC,CAAC;YAC/B,EAAE,CAAC,eAAe,CAAC,wBAAwB,CAAC,CAAC;YAC7C,MAAM,CAAC,OAAO,EAAE,CAAC;YACjB,aAAa,CAAC,MAAM,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;YACtC,MAAM,CAAC,KAAK,GAAG,SAAS,CAAC;QAC3B,CAAC;KACF,CAAC,CAAC;IAEH,OAAO,CAAC,MAAM,GAAG,MAAM,CAAC;IACxB,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;IACpB,OAAO,OAAO,CAAC;AACjB,CAAC;AA/KD,0CA+KC"}
|
package/lib/create.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PiralPlugin } from 'piral-core';
|
|
2
|
-
import type { PiletBlazorApi } from './types';
|
|
2
|
+
import type { BlazorLogLevel, PiletBlazorApi, WebAssemblyStartOptions } from './types';
|
|
3
3
|
/**
|
|
4
4
|
* Available configuration options for the Blazor plugin.
|
|
5
5
|
*/
|
|
@@ -9,6 +9,26 @@ export interface BlazorConfig {
|
|
|
9
9
|
* @default true
|
|
10
10
|
*/
|
|
11
11
|
lazy?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Determines the used log level, if any. Otherwise, will use
|
|
14
|
+
* the default log level (info).
|
|
15
|
+
*/
|
|
16
|
+
logLevel?: BlazorLogLevel;
|
|
17
|
+
/**
|
|
18
|
+
* Determines the initial language to use, if any.
|
|
19
|
+
* Otherwise, falls back to Blazor's default language.
|
|
20
|
+
*/
|
|
21
|
+
initialLanguage?: string;
|
|
22
|
+
/**
|
|
23
|
+
* Installs a function to handle language change. By default,
|
|
24
|
+
* this will hook on to the `select-language` event from Piral.
|
|
25
|
+
* @param inform The callback to use for passing in a new locale.
|
|
26
|
+
*/
|
|
27
|
+
onLanguageChange?: ((inform: (language: string) => void) => void) | false;
|
|
28
|
+
/**
|
|
29
|
+
* Determines the start options to use for booting Blazor.
|
|
30
|
+
*/
|
|
31
|
+
options?: WebAssemblyStartOptions;
|
|
12
32
|
}
|
|
13
33
|
/**
|
|
14
34
|
* Creates new Pilet API extensions for integration of Blazor.
|
package/lib/create.js
CHANGED
|
@@ -1,30 +1,44 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createBlazorApi = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
const converter_1 = require("./converter");
|
|
5
|
+
const dependencies_1 = require("./dependencies");
|
|
6
|
+
function createDefaultHandler(context) {
|
|
7
|
+
return (inform) => {
|
|
8
|
+
context.on('select-language', (ev) => {
|
|
9
|
+
inform(ev.currentLanguage);
|
|
10
|
+
});
|
|
11
|
+
};
|
|
12
|
+
}
|
|
6
13
|
/**
|
|
7
14
|
* Creates new Pilet API extensions for integration of Blazor.
|
|
8
15
|
*/
|
|
9
|
-
function createBlazorApi(config) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
function createBlazorApi(config = {}) {
|
|
17
|
+
return (context) => {
|
|
18
|
+
const { lazy = true, initialLanguage, onLanguageChange = createDefaultHandler(context), logLevel } = config;
|
|
19
|
+
const convert = (0, converter_1.createConverter)(lazy, config.options, {
|
|
20
|
+
current: initialLanguage,
|
|
21
|
+
onChange: onLanguageChange || (() => { }),
|
|
22
|
+
}, logLevel);
|
|
23
|
+
context.converters.blazor = ({ moduleName, args, dependency, options }) => convert(moduleName, dependency, args, options);
|
|
24
|
+
return (_, meta) => {
|
|
25
|
+
const loader = (0, dependencies_1.createDependencyLoader)(convert);
|
|
26
|
+
let options;
|
|
20
27
|
return {
|
|
21
|
-
defineBlazorReferences
|
|
22
|
-
|
|
28
|
+
defineBlazorReferences(references, satellites, prio) {
|
|
29
|
+
return loader.defineBlazorReferences(references, meta, satellites, prio);
|
|
30
|
+
},
|
|
31
|
+
defineBlazorOptions(blazorOptions) {
|
|
32
|
+
options = blazorOptions;
|
|
33
|
+
},
|
|
34
|
+
releaseBlazorReferences: loader.releaseBlazorReferences,
|
|
35
|
+
fromBlazor(moduleName, args) {
|
|
23
36
|
return {
|
|
24
37
|
type: 'blazor',
|
|
25
38
|
dependency: loader.getDependency(),
|
|
26
|
-
moduleName
|
|
27
|
-
args
|
|
39
|
+
moduleName,
|
|
40
|
+
args,
|
|
41
|
+
options,
|
|
28
42
|
};
|
|
29
43
|
},
|
|
30
44
|
};
|
package/lib/create.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AACA,
|
|
1
|
+
{"version":3,"file":"create.js","sourceRoot":"","sources":["../src/create.ts"],"names":[],"mappings":";;;AACA,2CAA8C;AAC9C,iDAAwD;AAkCxD,SAAS,oBAAoB,CAAC,OAAqB;IACjD,OAAO,CAAC,MAAkC,EAAE,EAAE;QAC5C,OAAO,CAAC,EAAE,CAAC,iBAAiB,EAAE,CAAC,EAAE,EAAE,EAAE;YACnC,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC;QAC7B,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAC,SAAuB,EAAE;IACvD,OAAO,CAAC,OAAO,EAAE,EAAE;QACjB,MAAM,EAAE,IAAI,GAAG,IAAI,EAAE,eAAe,EAAE,gBAAgB,GAAG,oBAAoB,CAAC,OAAO,CAAC,EAAE,QAAQ,EAAE,GAAG,MAAM,CAAC;QAC5G,MAAM,OAAO,GAAG,IAAA,2BAAe,EAC7B,IAAI,EACJ,MAAM,CAAC,OAAO,EACd;YACE,OAAO,EAAE,eAAe;YACxB,QAAQ,EAAE,gBAAgB,IAAI,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC;SACzC,EACD,QAAQ,CACT,CAAC;QACF,OAAO,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE,CACxE,OAAO,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;QAEjD,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;YACjB,MAAM,MAAM,GAAG,IAAA,qCAAsB,EAAC,OAAO,CAAC,CAAC;YAC/C,IAAI,OAAsB,CAAC;YAE3B,OAAO;gBACL,sBAAsB,CAAC,UAAU,EAAE,UAAU,EAAE,IAAI;oBACjD,OAAO,MAAM,CAAC,sBAAsB,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,CAAC;gBAC3E,CAAC;gBACD,mBAAmB,CAAC,aAA4B;oBAC9C,OAAO,GAAG,aAAa,CAAC;gBAC1B,CAAC;gBACD,uBAAuB,EAAE,MAAM,CAAC,uBAAuB;gBACvD,UAAU,CAAC,UAAU,EAAE,IAAI;oBACzB,OAAO;wBACL,IAAI,EAAE,QAAQ;wBACd,UAAU,EAAE,MAAM,CAAC,aAAa,EAAE;wBAClC,UAAU;wBACV,IAAI;wBACJ,OAAO;qBACR,CAAC;gBACJ,CAAC;aACF,CAAC;QACJ,CAAC,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAvCD,0CAuCC"}
|
package/lib/dependencies.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import type { PiletMetadata } from 'piral-core';
|
|
1
2
|
import type { createConverter } from './converter';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type { BlazorDependencyLoader } from './types';
|
|
4
|
+
export declare function createDependencyLoader(convert: ReturnType<typeof createConverter>): {
|
|
5
|
+
getDependency(): BlazorDependencyLoader;
|
|
6
|
+
defineBlazorReferences(references: Array<string>, meta?: Partial<PiletMetadata>, satellites?: {}, prio?: number): void;
|
|
7
|
+
releaseBlazorReferences(): Promise<void>;
|
|
5
8
|
};
|
package/lib/dependencies.js
CHANGED
|
@@ -1,24 +1,114 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var _a, _b;
|
|
2
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
4
|
exports.createDependencyLoader = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const tslib_1 = require("tslib");
|
|
6
|
+
const interop_1 = require("./interop");
|
|
7
|
+
const loadedDependencies = ((_a = window.$blazorDependencies) !== null && _a !== void 0 ? _a : (window.$blazorDependencies = []));
|
|
8
|
+
const depsWithPrios = ((_b = window.$blazorDependencyPrios) !== null && _b !== void 0 ? _b : (window.$blazorDependencyPrios = []));
|
|
9
|
+
function createDependencyLoader(convert) {
|
|
10
|
+
const definedBlazorReferences = [];
|
|
11
|
+
const loadedBlazorPilets = [];
|
|
12
|
+
let dependency;
|
|
8
13
|
return {
|
|
9
|
-
getDependency
|
|
14
|
+
getDependency() {
|
|
10
15
|
return dependency;
|
|
11
16
|
},
|
|
12
|
-
defineBlazorReferences
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
17
|
+
defineBlazorReferences(references, meta = {}, satellites = {}, prio = 0) {
|
|
18
|
+
prio = Math.max(prio, 0);
|
|
19
|
+
const depWithPrio = {
|
|
20
|
+
prio,
|
|
21
|
+
load() {
|
|
22
|
+
return Promise.resolve();
|
|
23
|
+
},
|
|
19
24
|
};
|
|
20
|
-
|
|
21
|
-
|
|
25
|
+
let result = false;
|
|
26
|
+
const load = ([_, capabilities]) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
// let others finish first
|
|
28
|
+
yield Promise.all(depsWithPrios.filter((m) => m.prio > prio).map((m) => m.load()));
|
|
29
|
+
window.dispatchEvent(new CustomEvent('loading-blazor-pilet', { detail: meta }));
|
|
30
|
+
if (capabilities.includes('load')) {
|
|
31
|
+
// new loading mechanism
|
|
32
|
+
if (!capabilities.includes('language')) {
|
|
33
|
+
satellites = undefined;
|
|
34
|
+
}
|
|
35
|
+
const dependencies = references.filter((m) => m.endsWith('.dll'));
|
|
36
|
+
const dllUrl = dependencies.pop();
|
|
37
|
+
const piletName = dllUrl.substring(0, dllUrl.length - 4);
|
|
38
|
+
const piletPdb = `${piletName}.pdb`;
|
|
39
|
+
const pdbUrl = references.find((m) => m === piletPdb);
|
|
40
|
+
const id = Math.random().toString(26).substring(2);
|
|
41
|
+
yield (0, interop_1.loadBlazorPilet)(id, {
|
|
42
|
+
name: meta.name || '(unknown)',
|
|
43
|
+
version: meta.version || '0.0.0',
|
|
44
|
+
config: JSON.stringify(meta.config || {}),
|
|
45
|
+
baseUrl: meta.basePath || dllUrl.substring(0, dllUrl.lastIndexOf('/')).replace('/_framework/', '/'),
|
|
46
|
+
dependencies,
|
|
47
|
+
satellites,
|
|
48
|
+
dllUrl,
|
|
49
|
+
pdbUrl,
|
|
50
|
+
});
|
|
51
|
+
loadedBlazorPilets.push(id);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
// old loading mechanism
|
|
55
|
+
for (const dllUrl of references) {
|
|
56
|
+
const dllName = dllUrl.substring(dllUrl.lastIndexOf('/') + 1);
|
|
57
|
+
if (dllUrl.endsWith('.dll')) {
|
|
58
|
+
const entry = loadedDependencies.find((m) => m.name === dllName);
|
|
59
|
+
if (entry) {
|
|
60
|
+
entry.count++;
|
|
61
|
+
yield entry.promise;
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
const urlWithoutExtension = dllUrl.substring(0, dllUrl.length - 4);
|
|
65
|
+
const pdbName = `${urlWithoutExtension}.pdb`;
|
|
66
|
+
const pdbUrl = references.find((m) => m === pdbName);
|
|
67
|
+
const promise = pdbUrl ? (0, interop_1.loadResourceWithSymbol)(dllUrl, pdbUrl) : (0, interop_1.loadResource)(dllUrl);
|
|
68
|
+
loadedDependencies.push({
|
|
69
|
+
name: dllName,
|
|
70
|
+
url: dllUrl,
|
|
71
|
+
count: 1,
|
|
72
|
+
promise,
|
|
73
|
+
});
|
|
74
|
+
yield promise;
|
|
75
|
+
}
|
|
76
|
+
definedBlazorReferences.push(dllName);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
// inform remaining that this one finished
|
|
81
|
+
window.dispatchEvent(new CustomEvent('loaded-blazor-pilet', { detail: meta }));
|
|
82
|
+
});
|
|
83
|
+
depWithPrio.load = () => {
|
|
84
|
+
if (!result) {
|
|
85
|
+
result = convert.loader.then(load);
|
|
86
|
+
}
|
|
87
|
+
return result;
|
|
88
|
+
};
|
|
89
|
+
result = !convert.lazy && convert.loader.then(load);
|
|
90
|
+
dependency = (config) => result || (result = load(config));
|
|
91
|
+
if (prio) {
|
|
92
|
+
depsWithPrios.push(depWithPrio);
|
|
93
|
+
}
|
|
94
|
+
},
|
|
95
|
+
releaseBlazorReferences() {
|
|
96
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const references = definedBlazorReferences.splice(0, definedBlazorReferences.length);
|
|
98
|
+
const ids = loadedBlazorPilets.splice(0, loadedBlazorPilets.length);
|
|
99
|
+
// old way of loading
|
|
100
|
+
for (const reference of references) {
|
|
101
|
+
const entry = loadedDependencies.find((m) => m.name === reference);
|
|
102
|
+
if (--entry.count === 0) {
|
|
103
|
+
loadedDependencies.splice(loadedDependencies.indexOf(entry), 1);
|
|
104
|
+
yield (0, interop_1.unloadResource)(entry.url);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// new way of loading
|
|
108
|
+
for (const id of ids) {
|
|
109
|
+
yield (0, interop_1.unloadBlazorPilet)(id);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
22
112
|
},
|
|
23
113
|
};
|
|
24
114
|
}
|
package/lib/dependencies.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"dependencies.js","sourceRoot":"","sources":["../src/dependencies.ts"],"names":[],"mappings":";;;;;AACA,uCAAqH;AAIrH,MAAM,kBAAkB,GAAG,OAAC,MAAM,CAAC,mBAAmB,oCAA1B,MAAM,CAAC,mBAAmB,GAAK,EAAE,EAAC,CAAC;AAC/D,MAAM,aAAa,GAAG,OAAC,MAAM,CAAC,sBAAsB,oCAA7B,MAAM,CAAC,sBAAsB,GAAK,EAAE,EAAC,CAAC;AAE7D,SAAgB,sBAAsB,CAAC,OAA2C;IAChF,MAAM,uBAAuB,GAAkB,EAAE,CAAC;IAClD,MAAM,kBAAkB,GAAkB,EAAE,CAAC;IAC7C,IAAI,UAAkC,CAAC;IAEvC,OAAO;QACL,aAAa;YACX,OAAO,UAAU,CAAC;QACpB,CAAC;QACD,sBAAsB,CAAC,UAAyB,EAAE,OAA+B,EAAE,EAAE,UAAU,GAAG,EAAE,EAAE,IAAI,GAAG,CAAC;YAC5G,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;YAEzB,MAAM,WAAW,GAAG;gBAClB,IAAI;gBACJ,IAAI;oBACF,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC3B,CAAC;aACF,CAAC;YAEF,IAAI,MAAM,GAA0B,KAAK,CAAC;YAC1C,MAAM,IAAI,GAAG,CAAO,CAAC,CAAC,EAAE,YAAY,CAAmB,EAAE,EAAE;gBACzD,0BAA0B;gBAC1B,MAAM,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;gBAEnF,MAAM,CAAC,aAAa,CAAC,IAAI,WAAW,CA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G,CAAC,CAAC;qBACjC;iBACF;gBAED,qBAAqB;gBACrB,KAAK,MAAM,EAAE,IAAI,GAAG,EAAE;oBACpB,MAAM,IAAA,2BAAiB,EAAC,EAAE,CAAC,CAAC;iBAC7B;YACH,CAAC;SAAA;KACF,CAAC;AACJ,CAAC;AA3HD,wDA2HC"}
|
package/lib/events.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare function emitRenderEvent(source: HTMLElement, name: string, params: any, sourceRef: any, fallbackComponent: string | null): void;
|
|
2
|
+
export declare function emitPiralEvent(type: string, args: any): void;
|
|
3
|
+
export declare function emitNavigateEvent(source: HTMLElement, to: string, replace?: boolean, state?: any): void;
|
|
4
|
+
export declare function attachEvents(host: HTMLElement, render: (ev: CustomEvent) => void, navigate: (ev: CustomEvent) => void, forward: (ev: CustomEvent) => void): () => void;
|
|
5
|
+
export declare function addGlobalEventListeners(el: HTMLElement): void;
|
|
6
|
+
export declare function removeGlobalEventListeners(el: HTMLElement): void;
|