Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

piral-blazor

Package Overview
Dependencies
Maintainers
1
Versions
805
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

piral-blazor - npm Package Compare versions

Comparing version 1.4.0-beta.6250 to 1.4.0-beta.6252

21

esm/converter.js

@@ -1,2 +0,1 @@

import { __awaiter } from "tslib";
import { addGlobalEventListeners, attachEvents, removeGlobalEventListeners } from './events';

@@ -19,3 +18,3 @@ import { activate, deactivate, createBootLoader, reactivate, callNotifyLocationChanged, setLanguage, createElement, destroyElement, updateElement, setLogLevel, processEvent, } from './interop';

function project(component, destination, options) {
if ((options === null || options === void 0 ? void 0 : options.resourcePathRoot) && !bootConfig.noMutation) {
if (options?.resourcePathRoot && !bootConfig.noMutation) {
prefixMediaSources(component, options.resourcePathRoot);

@@ -34,7 +33,7 @@ }

const bootLoader = createBootLoader(bootConfig.url, bootConfig.satellites);
const boot = (opts) => bootLoader(opts).then((res) => __awaiter(this, void 0, void 0, function* () {
const boot = (opts) => bootLoader(opts).then(async (res) => {
const [_, capabilities] = res;
if (capabilities.includes('logging')) {
if (typeof logLevel === 'number') {
yield setLogLevel(logLevel);
await setLogLevel(logLevel);
}

@@ -44,3 +43,3 @@ }

if (typeof language.current === 'string') {
yield setLanguage(language.current);
await setLanguage(language.current);
}

@@ -58,3 +57,3 @@ if (capabilities.includes('events')) {

}
catch (_a) {
catch {
console.warn(`The event "${type}" could not be serialized and will not be handled by Blazor.`);

@@ -72,3 +71,3 @@ }

return res;
}));
});
let loader = !lazy && boot(opts);

@@ -89,3 +88,3 @@ let listener = undefined;

mount(el, data, ctx, locals) {
const props = Object.assign(Object.assign({}, args), data);
const props = { ...args, ...data };
const { piral } = data;

@@ -124,4 +123,3 @@ const nav = ctx.navigation;

locals.unmount = () => {
var _a;
(_a = root.querySelector(`#${refId}`)) === null || _a === void 0 ? void 0 : _a.appendChild(node);
root.querySelector(`#${refId}`)?.appendChild(node);
deactivate(moduleName, refId);

@@ -168,4 +166,3 @@ el.innerHTML = '';

enqueueChange(locals, () => {
var _a;
(_a = locals.update) === null || _a === void 0 ? void 0 : _a.call(locals, Object.assign(Object.assign({}, args), data));
locals.update?.({ ...args, ...data });
});

@@ -172,0 +169,0 @@ },

@@ -1,6 +0,4 @@

var _a, _b;
import { __awaiter } from "tslib";
import { loadBlazorPilet, loadResource, loadResourceWithSymbol, unloadBlazorPilet, unloadResource } from './interop';
const loadedDependencies = ((_a = window.$blazorDependencies) !== null && _a !== void 0 ? _a : (window.$blazorDependencies = []));
const depsWithPrios = ((_b = window.$blazorDependencyPrios) !== null && _b !== void 0 ? _b : (window.$blazorDependencyPrios = []));
const loadedDependencies = (window.$blazorDependencies ?? (window.$blazorDependencies = []));
const depsWithPrios = (window.$blazorDependencyPrios ?? (window.$blazorDependencyPrios = []));
function toExtLessUrl(url) {

@@ -44,5 +42,5 @@ const idx = url.lastIndexOf('.');

let result = false;
const load = ([_, capabilities]) => __awaiter(this, void 0, void 0, function* () {
const load = async ([_, capabilities]) => {
// let others (any global, or higher prio) finish first
yield Promise.all(depsWithPrios
await Promise.all(depsWithPrios
.filter((m) => m !== depWithPrio)

@@ -76,3 +74,3 @@ // prefer (any) global pilets before non-global ones and otherwise prefer higher prio than lower ones

}
yield loadBlazorPilet(id, {
await loadBlazorPilet(id, {
name: meta.name || '(unknown)',

@@ -100,3 +98,3 @@ version: meta.version || '0.0.0',

entry.count++;
yield entry.promise;
await entry.promise;
}

@@ -114,3 +112,3 @@ else {

});
yield promise;
await promise;
}

@@ -123,3 +121,3 @@ definedBlazorReferences.push(dllName);

window.dispatchEvent(new CustomEvent('loaded-blazor-pilet', { detail: meta }));
});
};
depWithPrio.load = () => {

@@ -142,19 +140,17 @@ if (!result) {

},
releaseBlazorReferences() {
return __awaiter(this, void 0, void 0, function* () {
const references = definedBlazorReferences.splice(0, definedBlazorReferences.length);
const ids = loadedBlazorPilets.splice(0, loadedBlazorPilets.length);
// old way of loading
for (const reference of references) {
const entry = loadedDependencies.find((m) => m.name === reference);
if (--entry.count === 0) {
loadedDependencies.splice(loadedDependencies.indexOf(entry), 1);
yield unloadResource(entry.url);
}
async releaseBlazorReferences() {
const references = definedBlazorReferences.splice(0, definedBlazorReferences.length);
const ids = loadedBlazorPilets.splice(0, loadedBlazorPilets.length);
// old way of loading
for (const reference of references) {
const entry = loadedDependencies.find((m) => m.name === reference);
if (--entry.count === 0) {
loadedDependencies.splice(loadedDependencies.indexOf(entry), 1);
await unloadResource(entry.url);
}
// new way of loading
for (const id of ids) {
yield unloadBlazorPilet(id);
}
});
}
// new way of loading
for (const id of ids) {
await unloadBlazorPilet(id);
}
},

@@ -161,0 +157,0 @@ };

@@ -56,3 +56,2 @@ import { createElement } from 'react';

function dispatchToRoot(event) {
var _a;
isInternalNavigation(event) && performInternalNavigation(event);

@@ -62,3 +61,3 @@ // the mutation event cannot be cloned (at least in Webkit-based browsers)

const eventClone = new event.constructor(event.type, event);
(_a = document.getElementById(blazorRootId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(eventClone);
document.getElementById(blazorRootId)?.dispatchEvent(eventClone);
// make sure to only process every event once; even though multiple boundaries might be active

@@ -75,10 +74,7 @@ event.processed = true;

? (elements) => {
const oldItems = elements.map((el, id) => {
var _a;
return ({
id,
pilet: el.pilet,
defaults: (_a = el.defaults) !== null && _a !== void 0 ? _a : {},
});
});
const oldItems = elements.map((el, id) => ({
id,
pilet: el.pilet,
defaults: el.defaults ?? {},
}));
const newItems = sourceRef.invokeMethod('Order', oldItems);

@@ -85,0 +81,0 @@ return newItems.map(({ id }) => elements[id]).filter(Boolean);

@@ -1,2 +0,1 @@

import { __rest } from "tslib";
import { emitRenderEvent, emitNavigateEvent, emitPiralEvent } from './events';

@@ -115,4 +114,7 @@ const wasmLib = 'Microsoft.AspNetCore.Components.WebAssembly';

if ('children' in props && typeof props.children === 'object') {
const { children } = props, rest = __rest(props, ["children"]);
return Object.assign({ children: window.DotNet.createJSObjectReference(children) }, rest);
const { children, ...rest } = props;
return {
children: window.DotNet.createJSObjectReference(children),
...rest,
};
}

@@ -119,0 +121,0 @@ return props;

@@ -21,3 +21,3 @@ function findClosestAncestor(element, tagName) {

!eventHasSpecialKey(event) &&
(anchorTarget === null || anchorTarget === void 0 ? void 0 : anchorTarget.hasAttribute('href')) &&
anchorTarget?.hasAttribute('href') &&
isWithinBaseUriSpace(anchorTarget.href));

@@ -24,0 +24,0 @@ }

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createConverter = void 0;
const tslib_1 = require("tslib");
const events_1 = require("./events");

@@ -22,3 +21,3 @@ const interop_1 = require("./interop");

function project(component, destination, options) {
if ((options === null || options === void 0 ? void 0 : options.resourcePathRoot) && !infra_codegen_1.default.noMutation) {
if (options?.resourcePathRoot && !infra_codegen_1.default.noMutation) {
prefixMediaSources(component, options.resourcePathRoot);

@@ -37,7 +36,7 @@ }

const bootLoader = (0, interop_1.createBootLoader)(infra_codegen_1.default.url, infra_codegen_1.default.satellites);
const boot = (opts) => bootLoader(opts).then((res) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const boot = (opts) => bootLoader(opts).then(async (res) => {
const [_, capabilities] = res;
if (capabilities.includes('logging')) {
if (typeof logLevel === 'number') {
yield (0, interop_1.setLogLevel)(logLevel);
await (0, interop_1.setLogLevel)(logLevel);
}

@@ -47,3 +46,3 @@ }

if (typeof language.current === 'string') {
yield (0, interop_1.setLanguage)(language.current);
await (0, interop_1.setLanguage)(language.current);
}

@@ -61,3 +60,3 @@ if (capabilities.includes('events')) {

}
catch (_a) {
catch {
console.warn(`The event "${type}" could not be serialized and will not be handled by Blazor.`);

@@ -75,3 +74,3 @@ }

return res;
}));
});
let loader = !lazy && boot(opts);

@@ -92,3 +91,3 @@ let listener = undefined;

mount(el, data, ctx, locals) {
const props = Object.assign(Object.assign({}, args), data);
const props = { ...args, ...data };
const { piral } = data;

@@ -127,4 +126,3 @@ const nav = ctx.navigation;

locals.unmount = () => {
var _a;
(_a = root.querySelector(`#${refId}`)) === null || _a === void 0 ? void 0 : _a.appendChild(node);
root.querySelector(`#${refId}`)?.appendChild(node);
(0, interop_1.deactivate)(moduleName, refId);

@@ -171,4 +169,3 @@ el.innerHTML = '';

enqueueChange(locals, () => {
var _a;
(_a = locals.update) === null || _a === void 0 ? void 0 : _a.call(locals, Object.assign(Object.assign({}, args), data));
locals.update?.({ ...args, ...data });
});

@@ -175,0 +172,0 @@ },

"use strict";
var _a, _b;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDependencyLoader = void 0;
const tslib_1 = require("tslib");
const interop_1 = require("./interop");
const loadedDependencies = ((_a = window.$blazorDependencies) !== null && _a !== void 0 ? _a : (window.$blazorDependencies = []));
const depsWithPrios = ((_b = window.$blazorDependencyPrios) !== null && _b !== void 0 ? _b : (window.$blazorDependencyPrios = []));
const loadedDependencies = (window.$blazorDependencies ?? (window.$blazorDependencies = []));
const depsWithPrios = (window.$blazorDependencyPrios ?? (window.$blazorDependencyPrios = []));
function toExtLessUrl(url) {

@@ -47,5 +45,5 @@ const idx = url.lastIndexOf('.');

let result = false;
const load = ([_, capabilities]) => tslib_1.__awaiter(this, void 0, void 0, function* () {
const load = async ([_, capabilities]) => {
// let others (any global, or higher prio) finish first
yield Promise.all(depsWithPrios
await Promise.all(depsWithPrios
.filter((m) => m !== depWithPrio)

@@ -79,3 +77,3 @@ // prefer (any) global pilets before non-global ones and otherwise prefer higher prio than lower ones

}
yield (0, interop_1.loadBlazorPilet)(id, {
await (0, interop_1.loadBlazorPilet)(id, {
name: meta.name || '(unknown)',

@@ -103,3 +101,3 @@ version: meta.version || '0.0.0',

entry.count++;
yield entry.promise;
await entry.promise;
}

@@ -117,3 +115,3 @@ else {

});
yield promise;
await promise;
}

@@ -126,3 +124,3 @@ definedBlazorReferences.push(dllName);

window.dispatchEvent(new CustomEvent('loaded-blazor-pilet', { detail: meta }));
});
};
depWithPrio.load = () => {

@@ -145,19 +143,17 @@ if (!result) {

},
releaseBlazorReferences() {
return tslib_1.__awaiter(this, void 0, void 0, function* () {
const references = definedBlazorReferences.splice(0, definedBlazorReferences.length);
const ids = loadedBlazorPilets.splice(0, loadedBlazorPilets.length);
// old way of loading
for (const reference of references) {
const entry = loadedDependencies.find((m) => m.name === reference);
if (--entry.count === 0) {
loadedDependencies.splice(loadedDependencies.indexOf(entry), 1);
yield (0, interop_1.unloadResource)(entry.url);
}
async releaseBlazorReferences() {
const references = definedBlazorReferences.splice(0, definedBlazorReferences.length);
const ids = loadedBlazorPilets.splice(0, loadedBlazorPilets.length);
// old way of loading
for (const reference of references) {
const entry = loadedDependencies.find((m) => m.name === reference);
if (--entry.count === 0) {
loadedDependencies.splice(loadedDependencies.indexOf(entry), 1);
await (0, interop_1.unloadResource)(entry.url);
}
// new way of loading
for (const id of ids) {
yield (0, interop_1.unloadBlazorPilet)(id);
}
});
}
// new way of loading
for (const id of ids) {
await (0, interop_1.unloadBlazorPilet)(id);
}
},

@@ -164,0 +160,0 @@ };

@@ -59,3 +59,2 @@ "use strict";

function dispatchToRoot(event) {
var _a;
(0, navigation_1.isInternalNavigation)(event) && (0, navigation_1.performInternalNavigation)(event);

@@ -65,3 +64,3 @@ // the mutation event cannot be cloned (at least in Webkit-based browsers)

const eventClone = new event.constructor(event.type, event);
(_a = document.getElementById(blazorRootId)) === null || _a === void 0 ? void 0 : _a.dispatchEvent(eventClone);
document.getElementById(blazorRootId)?.dispatchEvent(eventClone);
// make sure to only process every event once; even though multiple boundaries might be active

@@ -78,10 +77,7 @@ event.processed = true;

? (elements) => {
const oldItems = elements.map((el, id) => {
var _a;
return ({
id,
pilet: el.pilet,
defaults: (_a = el.defaults) !== null && _a !== void 0 ? _a : {},
});
});
const oldItems = elements.map((el, id) => ({
id,
pilet: el.pilet,
defaults: el.defaults ?? {},
}));
const newItems = sourceRef.invokeMethod('Order', oldItems);

@@ -88,0 +84,0 @@ return newItems.map(({ id }) => elements[id]).filter(Boolean);

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createBootLoader = exports.initialize = exports.unloadBlazorPilet = exports.loadBlazorPilet = exports.unloadResource = exports.loadResourceWithSymbol = exports.loadResource = exports.getCapabilities = exports.setLanguage = exports.callNotifyLocationChanged = exports.deactivate = exports.reactivate = exports.activate = exports.destroyElement = exports.updateElement = exports.createElement = exports.setLogLevel = exports.processEvent = void 0;
const tslib_1 = require("tslib");
const events_1 = require("./events");

@@ -118,4 +117,7 @@ const wasmLib = 'Microsoft.AspNetCore.Components.WebAssembly';

if ('children' in props && typeof props.children === 'object') {
const { children } = props, rest = tslib_1.__rest(props, ["children"]);
return Object.assign({ children: window.DotNet.createJSObjectReference(children) }, rest);
const { children, ...rest } = props;
return {
children: window.DotNet.createJSObjectReference(children),
...rest,
};
}

@@ -122,0 +124,0 @@ return props;

@@ -24,3 +24,3 @@ "use strict";

!eventHasSpecialKey(event) &&
(anchorTarget === null || anchorTarget === void 0 ? void 0 : anchorTarget.hasAttribute('href')) &&
anchorTarget?.hasAttribute('href') &&
isWithinBaseUriSpace(anchorTarget.href));

@@ -27,0 +27,0 @@ }

{
"name": "piral-blazor",
"version": "1.4.0-beta.6250",
"version": "1.4.0-beta.6252",
"description": "Plugin for integrating Blazor components in Piral.",

@@ -70,5 +70,5 @@ "keywords": [

"devDependencies": {
"piral-core": "1.4.0-beta.6250"
"piral-core": "1.4.0-beta.6252"
},
"gitHead": "7c95a8922d0cfb80e02b32bcded0256825e00c09"
"gitHead": "f30d158bb902504e233849eb7c7f65a0d3e52ce3"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc