Socket
Socket
Sign inDemoInstall

@beyond-js/kernel

Package Overview
Dependencies
Maintainers
2
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@beyond-js/kernel - npm Package Compare versions

Comparing version 0.1.2 to 0.1.3

bundle/__sources/bundle/base/index.ts

317

bundle/bundle.amd.js

@@ -13,2 +13,3 @@ define(["exports", "module"], function (_exports2, _amd_module) {

const ims = new Map();
/****************************

@@ -28,3 +29,2 @@ INTERNAL MODULE: ./base/index

exports.resolve = resolve;
function resolve(source, id) {

@@ -36,3 +36,2 @@ if (!id.startsWith('.')) throw new Error(`Module id must be a relative resource "${id}"`);

split.target = (id.startsWith('./') ? id.slice(2) : id).split('../');
while (split.target[0] === '' && split.target.length > 1) {

@@ -42,3 +41,2 @@ split.target.shift();

}
return split.source.join('/') + '/' + split.target.join('/');

@@ -49,4 +47,2 @@ }

*/
class BeyondPackage {

@@ -56,7 +52,5 @@ #ims;

#exports;
constructor(exports) {
this.#exports = exports;
}
initialise(ims) {

@@ -73,7 +67,4 @@ this.#ims = ims;

*/
require(id, source) {
id = source ? resolve(source, id) : id;
const module = (() => {

@@ -83,10 +74,6 @@ if (this.#ims.has(id)) return id;

})();
if (this.#cached.has(module)) return this.#cached.get(module);
if (!this.#ims.has(module)) throw new Error(`Internal module "${id}" not found`);
const fn = this.#ims.get(module).creator;
const require = required => this.require(required, module); // Here the id is the source of the require
const exports = {};

@@ -97,8 +84,7 @@ fn(require, exports);

}
}
exports.BeyondPackage = BeyondPackage;
}
});
/*********************************

@@ -117,17 +103,12 @@ INTERNAL MODULE: ./bimport/bimport

exports.bimport = bimport;
require("./brequire");
/*bundle*/
/**
* Import a module, solving internally the module format (amd, esm).
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param resource {string} The resource identifier of the bundle
* @param version {number} The version required by hmr to update a bundle's processor
* @returns {Promise<*>}
*/
/*bundle*/ /**
* Import a module, solving internally the module format (amd, esm).
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param resource {string} The resource identifier of the bundle
* @param version {number} The version required by hmr to update a bundle's processor
* @returns {Promise<*>}
*/
function bimport(resource, version) {

@@ -151,3 +132,2 @@ if (bimport.mode === 'amd') {

}
bimport.mode = (() => {

@@ -161,3 +141,2 @@ if (typeof amd_require === 'function') return 'amd';

})();
const appDependencies = (() => {

@@ -167,3 +146,2 @@ const dependencies = globalThis.__app_package?.dependencies;

})();
bimport.resolve = (specifier, dependencies) => {

@@ -173,3 +151,2 @@ if (/^https?:\/\//.test(specifier)) return specifier;

const pkg = split[0].startsWith('@') ? `${split.shift()}/${split.shift()}` : split.shift();
const version = (() => {

@@ -179,3 +156,2 @@ if (dependencies.has(pkg)) return dependencies.get(pkg);

})();
if (!version) return specifier;

@@ -187,2 +163,3 @@ const subpath = split.join('/');

});
/**********************************

@@ -201,21 +178,16 @@ INTERNAL MODULE: ./bimport/brequire

exports.brequire = brequire;
var _instances = require("../package/instances");
/*bundle*/
/**
* Require a previously loaded bundle synchronously:
* (can be a project bundle or library bundle, or an external bundle).
*
* brequire is implemented for internal use, as the require function available in the internal modules
* exposes this functionality.
* In fact the require of the internal modules internally makes use of brequire.
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param {string} specifier
* @return {*}
*/
/*bundle*/ /**
* Require a previously loaded bundle synchronously:
* (can be a project bundle or library bundle, or an external bundle).
*
* brequire is implemented for internal use, as the require function available in the internal modules
* exposes this functionality.
* In fact the require of the internal modules internally makes use of brequire.
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param {string} specifier
* @return {*}
*/
function brequire(specifier) {

@@ -229,3 +201,2 @@ const split = specifier.split('/');

split.shift(); // Remove the version of the specifier of the instance
return subpath === split.join('/');

@@ -239,2 +210,3 @@ });

});
/*******************************

@@ -250,3 +222,2 @@ INTERNAL MODULE: ./bimport/index

var _bimport = require("./bimport");
var _brequire = require("./brequire");

@@ -256,4 +227,2 @@ /**

*/
globalThis.bimport === void 0 && (globalThis.bimport = _bimport.bimport);

@@ -263,2 +232,3 @@ globalThis.brequire === void 0 && (globalThis.brequire = _brequire.brequire);

});
/***********************************

@@ -278,2 +248,3 @@ INTERNAL MODULE: ./bimport/requirejs

});
/************************

@@ -292,50 +263,32 @@ INTERNAL MODULE: ./bundle

exports.Bundle = void 0;
var _package = require("./package");
var _instances = require("./instances");
var _module = require("./module");
require("./bimport");
/*bundle*/
class Bundle extends Map {
#type;
get type() {
return this.#type;
}
#name;
get name() {
return this.#name;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#module;
get module() {
return this.#module;
}
#uri;
get uri() {
return this.#uri;
}
constructor(specs, uri) {

@@ -356,6 +309,4 @@ super();

this.#specifier = multibundle ? `${specifier}.${name}` : specifier;
_instances.instances.register(this);
}
package(language) {

@@ -369,8 +320,7 @@ if (language && language.length !== 2) throw new Error(`Language "${language}" is invalid`);

}
}
exports.Bundle = Bundle;
}
});
/******************************

@@ -390,3 +340,2 @@ INTERNAL MODULE: ./events/index

/*bundle*/
class Events {

@@ -396,7 +345,5 @@ #specs;

#destroyed = false;
get destroyed() {
return this.#destroyed;
}
constructor(specs) {

@@ -406,6 +353,4 @@ specs = specs ? specs : {};

this.#specs = specs;
if (specs.bind) {
specs.bind.bind = (event, listener, priority) => this.on(event, listener, priority);
specs.bind.unbind = (event, listener) => this.off(event, listener);

@@ -422,4 +367,2 @@ }

*/
on(event, listener, priority) {

@@ -429,13 +372,9 @@ if (this.#destroyed) {

}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (typeof listener !== 'function') {
throw new Error('Listener is not a function');
}
this.off(event, listener); // Just in case the listener is already registered
const l = this.#listeners.has(event) ? this.#listeners.get(event) : [];

@@ -449,3 +388,2 @@ this.#listeners.set(event, l);

}
bind = (event, listener, priority) => this.on(event, listener, priority);

@@ -460,3 +398,2 @@ /**

*/
off(event, listener, force) {

@@ -466,11 +403,8 @@ if (this.#destroyed) {

}
if (!event) {
throw new Error(`Event name not specified`);
}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (!listener) {

@@ -481,7 +415,5 @@ if (!force) throw new Error('Listener function not set');

}
if (!this.#listeners.has(event)) {
return this;
}
const e = this.#listeners.get(event);

@@ -492,3 +424,2 @@ const filtered = e.filter(item => item.listener !== listener);

}
unbind = (event, listener, force) => this.off(event, listener, force);

@@ -502,3 +433,2 @@ /**

*/
trigger(event, ...rest) {

@@ -508,3 +438,2 @@ if (this.#destroyed) {

}
event = typeof event === 'string' ? {

@@ -515,26 +444,19 @@ 'name': event

if (typeof event.name !== 'string') throw new Error('Invalid event name');
if (this.#specs.supported && !this.#specs.supported.includes(event.name)) {
throw new Error(`Event "${event.name}" is not defined`);
}
let args = [...arguments];
args.shift(); // Remove the event name from the list of arguments
if (!this.#listeners.has(event.name)) return;
let l = this.#listeners.get(event.name); // Sort by priority
let l = this.#listeners.get(event.name);
// Sort by priority
l.sort((a, b) => b.priority - a.priority);
if (event.async) {
const trigger = async function () {
const promises = [];
for (let listener of l) {
promises.push(listener.listener(...args));
}
await Promise.all(promises);
};
return trigger.call(this, ...args).catch(exc => console.error(exc.stack));

@@ -547,3 +469,2 @@ } else {

}
destroy() {

@@ -553,8 +474,7 @@ this.#destroyed = true;

}
}
exports.Events = Events;
}
});
/******************************

@@ -574,2 +494,3 @@ INTERNAL MODULE: ./events/types

});
/***************************

@@ -589,3 +510,2 @@ INTERNAL MODULE: ./instances

/*bundle*/
const instances = new class extends Map {

@@ -595,3 +515,2 @@ register(bundle) {

}
}();

@@ -601,2 +520,3 @@ exports.instances = instances;

});
/******************************

@@ -616,40 +536,27 @@ INTERNAL MODULE: ./module/index

/*bundle*/
class Module {
#pkg;
get pkg() {
return this.#pkg;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#version;
get version() {
return this.#version;
}
#subpath;
get subpath() {
return this.#subpath;
}
#multibundle;
get multibundle() {
return this.#multibundle;
}
constructor(specs) {

@@ -673,4 +580,2 @@ this.#vspecifier = specs.vspecifier;

*/
async execute(action, params) {

@@ -683,8 +588,7 @@ if (typeof globalThis.beyond !== 'object') return;

}
}
exports.Module = Module;
}
});
/**************************************

@@ -703,6 +607,4 @@ INTERNAL MODULE: ./package/dependencies

exports.default = void 0;
class _default extends Map {
#pkg;
constructor(pkg) {

@@ -712,3 +614,2 @@ super();

}
update(deps) {

@@ -720,3 +621,2 @@ this.clear();

}
const {

@@ -729,8 +629,7 @@ __beyond_transversal: transversal

}
}
exports.default = _default;
}
});
/*********************************

@@ -749,9 +648,6 @@ INTERNAL MODULE: ./package/exports

exports.default = void 0;
var _trace = require("./ims/require/trace");
class _default {
#require;
#values = {};
get values() {

@@ -764,4 +660,2 @@ return this.#values;

*/
descriptor;

@@ -772,5 +666,3 @@ /**

*/
process;
constructor(require) {

@@ -783,10 +675,8 @@ this.#require = require;

this.#values.__beyond_pkg = this.#require.pkg;
} // Used by the IM exports proxy to update the value of the bundle exported property when
}
// Used by the IM exports proxy to update the value of the bundle exported property when
// the property is changed in the IM
set(key, value) {
this.#values[key] = value;
}
update() {

@@ -798,7 +688,6 @@ const require = id => {

};
this.process?.({
require
}); // Clean all previous values
});
// Clean all previous values
const reserved = ['__beyond_pkg', 'hmr'];

@@ -815,8 +704,7 @@ Object.keys(this.#values).forEach(p => !reserved.includes(p) && delete this.#values[p]);

}
}
exports.default = _default;
}
});
/*************************************

@@ -835,3 +723,2 @@ INTERNAL MODULE: ./package/ims/exports

exports.IMExports = void 0;
class IMExports {

@@ -842,4 +729,4 @@ constructor(im, bexports) {

// Set the exported property
self[name] = value; // Check if it is a bundle exported property
self[name] = value;
// Check if it is a bundle exported property
const prop = bexports.descriptor?.find(({

@@ -860,8 +747,7 @@ im: id,

}
}
exports.IMExports = IMExports;
}
});
/********************************

@@ -880,27 +766,18 @@ INTERNAL MODULE: ./package/ims/im

exports.InternalModule = void 0;
var _trace = require("./require/trace");
var _exports = require("./exports"); // Bundle internal module
var _exports = require("./exports");
// Bundle internal module
class InternalModule {
#pkg;
get package() {
return this.#pkg;
}
#id;
get id() {
return this.#id;
}
#hash;
get hash() {
return this.#hash;
}
#require;

@@ -911,7 +788,5 @@ #exports;

#created = false;
get created() {
return this.#created;
}
#create = trace => {

@@ -921,5 +796,3 @@ if (this.#created) throw new Error(`Internal module "${this.#id}" already created`);

this.#creating = true;
const require = id => this.#require.solve(id, trace, this);
Object.keys(this.#exports).forEach(key => delete this.#exports[key]);

@@ -930,3 +803,2 @@ this.#creator(require, this.#exports);

};
require(trace, source) {

@@ -938,6 +810,4 @@ if (!this.#created) {

}
return this.#exports;
}
initialise() {

@@ -949,3 +819,2 @@ if (this.#created) return;

}
update(creator, hash) {

@@ -956,3 +825,2 @@ this.#created = false;

}
constructor(pkg, id, hash, creator, require) {

@@ -966,8 +834,7 @@ this.#pkg = pkg;

}
}
exports.InternalModule = InternalModule;
}
});
/***********************************

@@ -986,5 +853,3 @@ INTERNAL MODULE: ./package/ims/index

exports.InternalModules = void 0;
var _im = require("./im");
class InternalModules {

@@ -994,11 +859,8 @@ #pkg;

#require;
constructor(pkg) {
this.#pkg = pkg;
}
set _require(value) {
this.#require = value;
}
#register = (id, hash, creator) => {

@@ -1009,3 +871,2 @@ if (this.#ims.has(id)) throw new Error(`IM "${id}" already registered`);

};
register(ims) {

@@ -1017,3 +878,2 @@ ims.forEach(({

}
require(id, trace, source) {

@@ -1024,15 +884,11 @@ const module = (() => {

})();
if (!this.#ims.has(module)) {
throw new Error(`Internal module "${id}" not found`);
}
const im = this.#ims.get(module);
return im.require(trace, source);
}
initialise() {
this.#ims.forEach(im => im.initialise());
}
update(ims) {

@@ -1047,3 +903,2 @@ ims.forEach(({

}
const im = this.#ims.get(id);

@@ -1055,8 +910,7 @@ if (im.hash === hash) return;

}
}
exports.InternalModules = InternalModules;
}
});
/*******************************************

@@ -1075,12 +929,8 @@ INTERNAL MODULE: ./package/ims/require/index

exports.Require = void 0;
var _base = require("../../../base");
class Require {
#pkg;
get pkg() {
return this.#pkg;
}
constructor(pkg) {

@@ -1097,4 +947,2 @@ this.#pkg = pkg;

*/
solve(specifier, trace, im) {

@@ -1109,4 +957,2 @@ if (specifier.startsWith('.')) {

*/
if (specifier === 'beyond_context') {

@@ -1121,5 +967,4 @@ const {

};
} // @beyond-js/kernel/transversals requires the Bundle object
}
// @beyond-js/kernel/transversals requires the Bundle object
if (specifier === '@beyond-js/kernel/bundle') {

@@ -1129,7 +974,5 @@ const {

} = require('../../../bundle');
const {
instances
} = require('../../../instances');
return {

@@ -1140,7 +983,5 @@ Bundle,

}
const {
dependencies
} = this.#pkg;
if (dependencies.has(specifier)) {

@@ -1157,12 +998,10 @@ /**

}
const keys = JSON.stringify([...dependencies.keys()]);
throw new Error(`Bundle "${specifier}" is not registered as a dependency: ${keys}`);
}
}
exports.Require = Require;
}
});
/*******************************************

@@ -1180,8 +1019,7 @@ INTERNAL MODULE: ./package/ims/require/trace

});
exports.Trace = void 0; // Used to find cyclical requires of internal modules
exports.Trace = void 0;
// Used to find cyclical requires of internal modules
// Key is the id being required and the value is the source
class Trace extends Array {
has = id => this.find(rt => rt.id === id);
register(source, id) {

@@ -1201,3 +1039,2 @@ // Check for cyclical module require

}
this.push({

@@ -1208,8 +1045,7 @@ id,

}
}
exports.Trace = Trace;
}
});
/*******************************

@@ -1228,68 +1064,44 @@ INTERNAL MODULE: ./package/index

exports.Package = void 0;
var _ims = require("./ims");
var _require = require("./ims/require");
var _exports = require("./exports");
var _dependencies = require("./dependencies");
var _instances = require("./instances");
var _events = require("../events");
/*bundle*/
class Package {
#bundle;
get bundle() {
return this.#bundle;
}
#language;
get language() {
return this.#language;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#require;
#ims;
get ims() {
return this.#ims;
}
#exports;
get exports() {
return this.#exports;
} // The beyond dependencies that are required by the bundle
}
// The beyond dependencies that are required by the bundle
#dependencies = new _dependencies.default(this);
get dependencies() {
return this.#dependencies;
}
#hmr = new _events.Events();
get hmr() {
return this.#hmr;
}
constructor(bundle, language) {

@@ -1304,12 +1116,8 @@ this.#bundle = bundle;

this.#exports = new _exports.default(this.#require);
_instances.default.register(this);
}
#initialised = false;
get initialised() {
return this.#initialised;
}
initialise(ims) {

@@ -1322,3 +1130,2 @@ if (this.#initialised) throw new Error('Package already initialised');

}
update(ims) {

@@ -1330,8 +1137,7 @@ this.#ims.update(ims);

}
}
exports.Package = Package;
}
});
/***********************************

@@ -1350,3 +1156,2 @@ INTERNAL MODULE: ./package/instances

exports.default = void 0;
var _default = new class extends Map {

@@ -1356,5 +1161,3 @@ register(pkg) {

}
}();
exports.default = _default;

@@ -1412,4 +1215,5 @@ }

}];
let bimport, brequire, IBundleSpecs, Bundle, Events, ListenerFunction, instances, Module, IExportsDescriptor, IMSpecs, IMCreators, Package; // Module exports
let bimport, brequire, IBundleSpecs, Bundle, Events, ListenerFunction, instances, Module, IExportsDescriptor, IMSpecs, IMCreators, Package;
// Module exports
_exports2.Package = Package;

@@ -1427,3 +1231,2 @@ _exports2.IMCreators = IMCreators;

_exports2.bimport = bimport;
__pkg.exports.process = function (require) {

@@ -1443,9 +1246,7 @@ _exports2.bimport = bimport = require('./bimport/bimport').bimport;

};
const __bp = {};
ims.get('./base/index').creator(() => 0, __bp);
__pkg = new __bp.BeyondPackage(__pkg.exports);
__pkg.initialise(ims);
});
//# sourceMappingURL=bundle.amd.js.map

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

const ims = new Map();
/****************************

@@ -26,3 +27,2 @@ INTERNAL MODULE: ./base/index

exports.resolve = resolve;
function resolve(source, id) {

@@ -34,3 +34,2 @@ if (!id.startsWith('.')) throw new Error(`Module id must be a relative resource "${id}"`);

split.target = (id.startsWith('./') ? id.slice(2) : id).split('../');
while (split.target[0] === '' && split.target.length > 1) {

@@ -40,3 +39,2 @@ split.target.shift();

}
return split.source.join('/') + '/' + split.target.join('/');

@@ -47,4 +45,2 @@ }

*/
class BeyondPackage {

@@ -54,7 +50,5 @@ #ims;

#exports;
constructor(exports) {
this.#exports = exports;
}
initialise(ims) {

@@ -71,7 +65,4 @@ this.#ims = ims;

*/
require(id, source) {
id = source ? resolve(source, id) : id;
const module = (() => {

@@ -81,10 +72,6 @@ if (this.#ims.has(id)) return id;

})();
if (this.#cached.has(module)) return this.#cached.get(module);
if (!this.#ims.has(module)) throw new Error(`Internal module "${id}" not found`);
const fn = this.#ims.get(module).creator;
const require = required => this.require(required, module); // Here the id is the source of the require
const exports = {};

@@ -95,8 +82,7 @@ fn(require, exports);

}
}
exports.BeyondPackage = BeyondPackage;
}
});
/*********************************

@@ -115,17 +101,12 @@ INTERNAL MODULE: ./bimport/bimport

exports.bimport = bimport;
require("./brequire");
/*bundle*/
/**
* Import a module, solving internally the module format (amd, esm).
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param resource {string} The resource identifier of the bundle
* @param version {number} The version required by hmr to update a bundle's processor
* @returns {Promise<*>}
*/
/*bundle*/ /**
* Import a module, solving internally the module format (amd, esm).
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param resource {string} The resource identifier of the bundle
* @param version {number} The version required by hmr to update a bundle's processor
* @returns {Promise<*>}
*/
function bimport(resource, version) {

@@ -149,3 +130,2 @@ if (bimport.mode === 'amd') {

}
bimport.mode = (() => {

@@ -159,3 +139,2 @@ if (typeof amd_require === 'function') return 'amd';

})();
const appDependencies = (() => {

@@ -165,3 +144,2 @@ const dependencies = globalThis.__app_package?.dependencies;

})();
bimport.resolve = (specifier, dependencies) => {

@@ -171,3 +149,2 @@ if (/^https?:\/\//.test(specifier)) return specifier;

const pkg = split[0].startsWith('@') ? `${split.shift()}/${split.shift()}` : split.shift();
const version = (() => {

@@ -177,3 +154,2 @@ if (dependencies.has(pkg)) return dependencies.get(pkg);

})();
if (!version) return specifier;

@@ -185,2 +161,3 @@ const subpath = split.join('/');

});
/**********************************

@@ -199,21 +176,16 @@ INTERNAL MODULE: ./bimport/brequire

exports.brequire = brequire;
var _instances = require("../package/instances");
/*bundle*/
/**
* Require a previously loaded bundle synchronously:
* (can be a project bundle or library bundle, or an external bundle).
*
* brequire is implemented for internal use, as the require function available in the internal modules
* exposes this functionality.
* In fact the require of the internal modules internally makes use of brequire.
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param {string} specifier
* @return {*}
*/
/*bundle*/ /**
* Require a previously loaded bundle synchronously:
* (can be a project bundle or library bundle, or an external bundle).
*
* brequire is implemented for internal use, as the require function available in the internal modules
* exposes this functionality.
* In fact the require of the internal modules internally makes use of brequire.
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param {string} specifier
* @return {*}
*/
function brequire(specifier) {

@@ -227,3 +199,2 @@ const split = specifier.split('/');

split.shift(); // Remove the version of the specifier of the instance
return subpath === split.join('/');

@@ -237,2 +208,3 @@ });

});
/*******************************

@@ -248,3 +220,2 @@ INTERNAL MODULE: ./bimport/index

var _bimport = require("./bimport");
var _brequire = require("./brequire");

@@ -254,4 +225,2 @@ /**

*/
globalThis.bimport === void 0 && (globalThis.bimport = _bimport.bimport);

@@ -261,2 +230,3 @@ globalThis.brequire === void 0 && (globalThis.brequire = _brequire.brequire);

});
/***********************************

@@ -276,2 +246,3 @@ INTERNAL MODULE: ./bimport/requirejs

});
/************************

@@ -290,50 +261,32 @@ INTERNAL MODULE: ./bundle

exports.Bundle = void 0;
var _package = require("./package");
var _instances = require("./instances");
var _module = require("./module");
require("./bimport");
/*bundle*/
class Bundle extends Map {
#type;
get type() {
return this.#type;
}
#name;
get name() {
return this.#name;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#module;
get module() {
return this.#module;
}
#uri;
get uri() {
return this.#uri;
}
constructor(specs, uri) {

@@ -354,6 +307,4 @@ super();

this.#specifier = multibundle ? `${specifier}.${name}` : specifier;
_instances.instances.register(this);
}
package(language) {

@@ -367,8 +318,7 @@ if (language && language.length !== 2) throw new Error(`Language "${language}" is invalid`);

}
}
exports.Bundle = Bundle;
}
});
/******************************

@@ -388,3 +338,2 @@ INTERNAL MODULE: ./events/index

/*bundle*/
class Events {

@@ -394,7 +343,5 @@ #specs;

#destroyed = false;
get destroyed() {
return this.#destroyed;
}
constructor(specs) {

@@ -404,6 +351,4 @@ specs = specs ? specs : {};

this.#specs = specs;
if (specs.bind) {
specs.bind.bind = (event, listener, priority) => this.on(event, listener, priority);
specs.bind.unbind = (event, listener) => this.off(event, listener);

@@ -420,4 +365,2 @@ }

*/
on(event, listener, priority) {

@@ -427,13 +370,9 @@ if (this.#destroyed) {

}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (typeof listener !== 'function') {
throw new Error('Listener is not a function');
}
this.off(event, listener); // Just in case the listener is already registered
const l = this.#listeners.has(event) ? this.#listeners.get(event) : [];

@@ -447,3 +386,2 @@ this.#listeners.set(event, l);

}
bind = (event, listener, priority) => this.on(event, listener, priority);

@@ -458,3 +396,2 @@ /**

*/
off(event, listener, force) {

@@ -464,11 +401,8 @@ if (this.#destroyed) {

}
if (!event) {
throw new Error(`Event name not specified`);
}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (!listener) {

@@ -479,7 +413,5 @@ if (!force) throw new Error('Listener function not set');

}
if (!this.#listeners.has(event)) {
return this;
}
const e = this.#listeners.get(event);

@@ -490,3 +422,2 @@ const filtered = e.filter(item => item.listener !== listener);

}
unbind = (event, listener, force) => this.off(event, listener, force);

@@ -500,3 +431,2 @@ /**

*/
trigger(event, ...rest) {

@@ -506,3 +436,2 @@ if (this.#destroyed) {

}
event = typeof event === 'string' ? {

@@ -513,26 +442,19 @@ 'name': event

if (typeof event.name !== 'string') throw new Error('Invalid event name');
if (this.#specs.supported && !this.#specs.supported.includes(event.name)) {
throw new Error(`Event "${event.name}" is not defined`);
}
let args = [...arguments];
args.shift(); // Remove the event name from the list of arguments
if (!this.#listeners.has(event.name)) return;
let l = this.#listeners.get(event.name); // Sort by priority
let l = this.#listeners.get(event.name);
// Sort by priority
l.sort((a, b) => b.priority - a.priority);
if (event.async) {
const trigger = async function () {
const promises = [];
for (let listener of l) {
promises.push(listener.listener(...args));
}
await Promise.all(promises);
};
return trigger.call(this, ...args).catch(exc => console.error(exc.stack));

@@ -545,3 +467,2 @@ } else {

}
destroy() {

@@ -551,8 +472,7 @@ this.#destroyed = true;

}
}
exports.Events = Events;
}
});
/******************************

@@ -572,2 +492,3 @@ INTERNAL MODULE: ./events/types

});
/***************************

@@ -587,3 +508,2 @@ INTERNAL MODULE: ./instances

/*bundle*/
const instances = new class extends Map {

@@ -593,3 +513,2 @@ register(bundle) {

}
}();

@@ -599,2 +518,3 @@ exports.instances = instances;

});
/******************************

@@ -614,40 +534,27 @@ INTERNAL MODULE: ./module/index

/*bundle*/
class Module {
#pkg;
get pkg() {
return this.#pkg;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#version;
get version() {
return this.#version;
}
#subpath;
get subpath() {
return this.#subpath;
}
#multibundle;
get multibundle() {
return this.#multibundle;
}
constructor(specs) {

@@ -671,4 +578,2 @@ this.#vspecifier = specs.vspecifier;

*/
async execute(action, params) {

@@ -681,8 +586,7 @@ if (typeof globalThis.beyond !== 'object') return;

}
}
exports.Module = Module;
}
});
/**************************************

@@ -701,6 +605,4 @@ INTERNAL MODULE: ./package/dependencies

exports.default = void 0;
class _default extends Map {
#pkg;
constructor(pkg) {

@@ -710,3 +612,2 @@ super();

}
update(deps) {

@@ -718,3 +619,2 @@ this.clear();

}
const {

@@ -727,8 +627,7 @@ __beyond_transversal: transversal

}
}
exports.default = _default;
}
});
/*********************************

@@ -747,9 +646,6 @@ INTERNAL MODULE: ./package/exports

exports.default = void 0;
var _trace = require("./ims/require/trace");
class _default {
#require;
#values = {};
get values() {

@@ -762,4 +658,2 @@ return this.#values;

*/
descriptor;

@@ -770,5 +664,3 @@ /**

*/
process;
constructor(require) {

@@ -781,10 +673,8 @@ this.#require = require;

this.#values.__beyond_pkg = this.#require.pkg;
} // Used by the IM exports proxy to update the value of the bundle exported property when
}
// Used by the IM exports proxy to update the value of the bundle exported property when
// the property is changed in the IM
set(key, value) {
this.#values[key] = value;
}
update() {

@@ -796,7 +686,6 @@ const require = id => {

};
this.process?.({
require
}); // Clean all previous values
});
// Clean all previous values
const reserved = ['__beyond_pkg', 'hmr'];

@@ -813,8 +702,7 @@ Object.keys(this.#values).forEach(p => !reserved.includes(p) && delete this.#values[p]);

}
}
exports.default = _default;
}
});
/*************************************

@@ -833,3 +721,2 @@ INTERNAL MODULE: ./package/ims/exports

exports.IMExports = void 0;
class IMExports {

@@ -840,4 +727,4 @@ constructor(im, bexports) {

// Set the exported property
self[name] = value; // Check if it is a bundle exported property
self[name] = value;
// Check if it is a bundle exported property
const prop = bexports.descriptor?.find(({

@@ -858,8 +745,7 @@ im: id,

}
}
exports.IMExports = IMExports;
}
});
/********************************

@@ -878,27 +764,18 @@ INTERNAL MODULE: ./package/ims/im

exports.InternalModule = void 0;
var _trace = require("./require/trace");
var _exports = require("./exports"); // Bundle internal module
var _exports = require("./exports");
// Bundle internal module
class InternalModule {
#pkg;
get package() {
return this.#pkg;
}
#id;
get id() {
return this.#id;
}
#hash;
get hash() {
return this.#hash;
}
#require;

@@ -909,7 +786,5 @@ #exports;

#created = false;
get created() {
return this.#created;
}
#create = trace => {

@@ -919,5 +794,3 @@ if (this.#created) throw new Error(`Internal module "${this.#id}" already created`);

this.#creating = true;
const require = id => this.#require.solve(id, trace, this);
Object.keys(this.#exports).forEach(key => delete this.#exports[key]);

@@ -928,3 +801,2 @@ this.#creator(require, this.#exports);

};
require(trace, source) {

@@ -936,6 +808,4 @@ if (!this.#created) {

}
return this.#exports;
}
initialise() {

@@ -947,3 +817,2 @@ if (this.#created) return;

}
update(creator, hash) {

@@ -954,3 +823,2 @@ this.#created = false;

}
constructor(pkg, id, hash, creator, require) {

@@ -964,8 +832,7 @@ this.#pkg = pkg;

}
}
exports.InternalModule = InternalModule;
}
});
/***********************************

@@ -984,5 +851,3 @@ INTERNAL MODULE: ./package/ims/index

exports.InternalModules = void 0;
var _im = require("./im");
class InternalModules {

@@ -992,11 +857,8 @@ #pkg;

#require;
constructor(pkg) {
this.#pkg = pkg;
}
set _require(value) {
this.#require = value;
}
#register = (id, hash, creator) => {

@@ -1007,3 +869,2 @@ if (this.#ims.has(id)) throw new Error(`IM "${id}" already registered`);

};
register(ims) {

@@ -1015,3 +876,2 @@ ims.forEach(({

}
require(id, trace, source) {

@@ -1022,15 +882,11 @@ const module = (() => {

})();
if (!this.#ims.has(module)) {
throw new Error(`Internal module "${id}" not found`);
}
const im = this.#ims.get(module);
return im.require(trace, source);
}
initialise() {
this.#ims.forEach(im => im.initialise());
}
update(ims) {

@@ -1045,3 +901,2 @@ ims.forEach(({

}
const im = this.#ims.get(id);

@@ -1053,8 +908,7 @@ if (im.hash === hash) return;

}
}
exports.InternalModules = InternalModules;
}
});
/*******************************************

@@ -1073,12 +927,8 @@ INTERNAL MODULE: ./package/ims/require/index

exports.Require = void 0;
var _base = require("../../../base");
class Require {
#pkg;
get pkg() {
return this.#pkg;
}
constructor(pkg) {

@@ -1095,4 +945,2 @@ this.#pkg = pkg;

*/
solve(specifier, trace, im) {

@@ -1107,4 +955,2 @@ if (specifier.startsWith('.')) {

*/
if (specifier === 'beyond_context') {

@@ -1119,5 +965,4 @@ const {

};
} // @beyond-js/kernel/transversals requires the Bundle object
}
// @beyond-js/kernel/transversals requires the Bundle object
if (specifier === '@beyond-js/kernel/bundle') {

@@ -1127,7 +972,5 @@ const {

} = require('../../../bundle');
const {
instances
} = require('../../../instances');
return {

@@ -1138,7 +981,5 @@ Bundle,

}
const {
dependencies
} = this.#pkg;
if (dependencies.has(specifier)) {

@@ -1155,12 +996,10 @@ /**

}
const keys = JSON.stringify([...dependencies.keys()]);
throw new Error(`Bundle "${specifier}" is not registered as a dependency: ${keys}`);
}
}
exports.Require = Require;
}
});
/*******************************************

@@ -1178,8 +1017,7 @@ INTERNAL MODULE: ./package/ims/require/trace

});
exports.Trace = void 0; // Used to find cyclical requires of internal modules
exports.Trace = void 0;
// Used to find cyclical requires of internal modules
// Key is the id being required and the value is the source
class Trace extends Array {
has = id => this.find(rt => rt.id === id);
register(source, id) {

@@ -1199,3 +1037,2 @@ // Check for cyclical module require

}
this.push({

@@ -1206,8 +1043,7 @@ id,

}
}
exports.Trace = Trace;
}
});
/*******************************

@@ -1226,68 +1062,44 @@ INTERNAL MODULE: ./package/index

exports.Package = void 0;
var _ims = require("./ims");
var _require = require("./ims/require");
var _exports = require("./exports");
var _dependencies = require("./dependencies");
var _instances = require("./instances");
var _events = require("../events");
/*bundle*/
class Package {
#bundle;
get bundle() {
return this.#bundle;
}
#language;
get language() {
return this.#language;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#require;
#ims;
get ims() {
return this.#ims;
}
#exports;
get exports() {
return this.#exports;
} // The beyond dependencies that are required by the bundle
}
// The beyond dependencies that are required by the bundle
#dependencies = new _dependencies.default(this);
get dependencies() {
return this.#dependencies;
}
#hmr = new _events.Events();
get hmr() {
return this.#hmr;
}
constructor(bundle, language) {

@@ -1302,12 +1114,8 @@ this.#bundle = bundle;

this.#exports = new _exports.default(this.#require);
_instances.default.register(this);
}
#initialised = false;
get initialised() {
return this.#initialised;
}
initialise(ims) {

@@ -1320,3 +1128,2 @@ if (this.#initialised) throw new Error('Package already initialised');

}
update(ims) {

@@ -1328,8 +1135,7 @@ this.#ims.update(ims);

}
}
exports.Package = Package;
}
});
/***********************************

@@ -1348,3 +1154,2 @@ INTERNAL MODULE: ./package/instances

exports.default = void 0;
var _default = new class extends Map {

@@ -1354,5 +1159,3 @@ register(pkg) {

}
}();
exports.default = _default;

@@ -1410,4 +1213,5 @@ }

}];
let bimport, brequire, IBundleSpecs, Bundle, Events, ListenerFunction, instances, Module, IExportsDescriptor, IMSpecs, IMCreators, Package; // Module exports
let bimport, brequire, IBundleSpecs, Bundle, Events, ListenerFunction, instances, Module, IExportsDescriptor, IMSpecs, IMCreators, Package;
// Module exports
exports.Package = Package;

@@ -1425,3 +1229,2 @@ exports.IMCreators = IMCreators;

exports.bimport = bimport;
__pkg.exports.process = function (require) {

@@ -1441,8 +1244,6 @@ exports.bimport = bimport = require('./bimport/bimport').bimport;

};
const __bp = {};
ims.get('./base/index').creator(() => 0, __bp);
__pkg = new __bp.BeyondPackage(__pkg.exports);
__pkg.initialise(ims);
//# sourceMappingURL=bundle.cjs.js.map

@@ -5,3 +5,2 @@ System.register([], function (_export, _context) {

var __pkg, ims, bimport, brequire, IBundleSpecs, Bundle, Events, ListenerFunction, instances, Module, IExportsDescriptor, IMSpecs, IMCreators, Package, __bp;
_export({

@@ -21,3 +20,2 @@ bimport: void 0,

});
return {

@@ -33,3 +31,2 @@ setters: [],

****************************/
ims.set('./base/index', {

@@ -45,3 +42,2 @@ hash: 1936310117,

exports.resolve = resolve;
function resolve(source, id) {

@@ -53,3 +49,2 @@ if (!id.startsWith('.')) throw new Error(`Module id must be a relative resource "${id}"`);

split.target = (id.startsWith('./') ? id.slice(2) : id).split('../');
while (split.target[0] === '' && split.target.length > 1) {

@@ -59,3 +54,2 @@ split.target.shift();

}
return split.source.join('/') + '/' + split.target.join('/');

@@ -66,4 +60,2 @@ }

*/
class BeyondPackage {

@@ -73,7 +65,5 @@ #ims;

#exports;
constructor(exports) {
this.#exports = exports;
}
initialise(ims) {

@@ -90,7 +80,4 @@ this.#ims = ims;

*/
require(id, source) {
id = source ? resolve(source, id) : id;
const module = (() => {

@@ -100,10 +87,6 @@ if (this.#ims.has(id)) return id;

})();
if (this.#cached.has(module)) return this.#cached.get(module);
if (!this.#ims.has(module)) throw new Error(`Internal module "${id}" not found`);
const fn = this.#ims.get(module).creator;
const require = required => this.require(required, module); // Here the id is the source of the require
const exports = {};

@@ -114,8 +97,7 @@ fn(require, exports);

}
}
exports.BeyondPackage = BeyondPackage;
}
});
/*********************************

@@ -134,17 +116,12 @@ INTERNAL MODULE: ./bimport/bimport

exports.bimport = bimport;
require("./brequire");
/*bundle*/
/**
* Import a module, solving internally the module format (amd, esm).
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param resource {string} The resource identifier of the bundle
* @param version {number} The version required by hmr to update a bundle's processor
* @returns {Promise<*>}
*/
/*bundle*/ /**
* Import a module, solving internally the module format (amd, esm).
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param resource {string} The resource identifier of the bundle
* @param version {number} The version required by hmr to update a bundle's processor
* @returns {Promise<*>}
*/
function bimport(resource, version) {

@@ -168,3 +145,2 @@ if (bimport.mode === 'amd') {

}
bimport.mode = (() => {

@@ -178,3 +154,2 @@ if (typeof amd_require === 'function') return 'amd';

})();
const appDependencies = (() => {

@@ -184,3 +159,2 @@ const dependencies = globalThis.__app_package?.dependencies;

})();
bimport.resolve = (specifier, dependencies) => {

@@ -190,3 +164,2 @@ if (/^https?:\/\//.test(specifier)) return specifier;

const pkg = split[0].startsWith('@') ? `${split.shift()}/${split.shift()}` : split.shift();
const version = (() => {

@@ -196,3 +169,2 @@ if (dependencies.has(pkg)) return dependencies.get(pkg);

})();
if (!version) return specifier;

@@ -204,2 +176,3 @@ const subpath = split.join('/');

});
/**********************************

@@ -218,21 +191,16 @@ INTERNAL MODULE: ./bimport/brequire

exports.brequire = brequire;
var _instances = require("../package/instances");
/*bundle*/
/**
* Require a previously loaded bundle synchronously:
* (can be a project bundle or library bundle, or an external bundle).
*
* brequire is implemented for internal use, as the require function available in the internal modules
* exposes this functionality.
* In fact the require of the internal modules internally makes use of brequire.
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param {string} specifier
* @return {*}
*/
/*bundle*/ /**
* Require a previously loaded bundle synchronously:
* (can be a project bundle or library bundle, or an external bundle).
*
* brequire is implemented for internal use, as the require function available in the internal modules
* exposes this functionality.
* In fact the require of the internal modules internally makes use of brequire.
*
* When running in a BEE, brequire and bimport are implemented by it, overriding both functions.
*
* @param {string} specifier
* @return {*}
*/
function brequire(specifier) {

@@ -246,3 +214,2 @@ const split = specifier.split('/');

split.shift(); // Remove the version of the specifier of the instance
return subpath === split.join('/');

@@ -256,2 +223,3 @@ });

});
/*******************************

@@ -267,3 +235,2 @@ INTERNAL MODULE: ./bimport/index

var _bimport = require("./bimport");
var _brequire = require("./brequire");

@@ -273,4 +240,2 @@ /**

*/
globalThis.bimport === void 0 && (globalThis.bimport = _bimport.bimport);

@@ -280,2 +245,3 @@ globalThis.brequire === void 0 && (globalThis.brequire = _brequire.brequire);

});
/***********************************

@@ -295,2 +261,3 @@ INTERNAL MODULE: ./bimport/requirejs

});
/************************

@@ -309,50 +276,32 @@ INTERNAL MODULE: ./bundle

exports.Bundle = void 0;
var _package = require("./package");
var _instances = require("./instances");
var _module = require("./module");
require("./bimport");
/*bundle*/
class Bundle extends Map {
#type;
get type() {
return this.#type;
}
#name;
get name() {
return this.#name;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#module;
get module() {
return this.#module;
}
#uri;
get uri() {
return this.#uri;
}
constructor(specs, uri) {

@@ -373,6 +322,4 @@ super();

this.#specifier = multibundle ? `${specifier}.${name}` : specifier;
_instances.instances.register(this);
}
package(language) {

@@ -386,8 +333,7 @@ if (language && language.length !== 2) throw new Error(`Language "${language}" is invalid`);

}
}
exports.Bundle = Bundle;
}
});
/******************************

@@ -407,3 +353,2 @@ INTERNAL MODULE: ./events/index

/*bundle*/
class Events {

@@ -413,7 +358,5 @@ #specs;

#destroyed = false;
get destroyed() {
return this.#destroyed;
}
constructor(specs) {

@@ -423,6 +366,4 @@ specs = specs ? specs : {};

this.#specs = specs;
if (specs.bind) {
specs.bind.bind = (event, listener, priority) => this.on(event, listener, priority);
specs.bind.unbind = (event, listener) => this.off(event, listener);

@@ -439,4 +380,2 @@ }

*/
on(event, listener, priority) {

@@ -446,13 +385,9 @@ if (this.#destroyed) {

}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (typeof listener !== 'function') {
throw new Error('Listener is not a function');
}
this.off(event, listener); // Just in case the listener is already registered
const l = this.#listeners.has(event) ? this.#listeners.get(event) : [];

@@ -466,3 +401,2 @@ this.#listeners.set(event, l);

}
bind = (event, listener, priority) => this.on(event, listener, priority);

@@ -477,3 +411,2 @@ /**

*/
off(event, listener, force) {

@@ -483,11 +416,8 @@ if (this.#destroyed) {

}
if (!event) {
throw new Error(`Event name not specified`);
}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (!listener) {

@@ -498,7 +428,5 @@ if (!force) throw new Error('Listener function not set');

}
if (!this.#listeners.has(event)) {
return this;
}
const e = this.#listeners.get(event);

@@ -509,3 +437,2 @@ const filtered = e.filter(item => item.listener !== listener);

}
unbind = (event, listener, force) => this.off(event, listener, force);

@@ -519,3 +446,2 @@ /**

*/
trigger(event, ...rest) {

@@ -525,3 +451,2 @@ if (this.#destroyed) {

}
event = typeof event === 'string' ? {

@@ -532,26 +457,19 @@ 'name': event

if (typeof event.name !== 'string') throw new Error('Invalid event name');
if (this.#specs.supported && !this.#specs.supported.includes(event.name)) {
throw new Error(`Event "${event.name}" is not defined`);
}
let args = [...arguments];
args.shift(); // Remove the event name from the list of arguments
if (!this.#listeners.has(event.name)) return;
let l = this.#listeners.get(event.name); // Sort by priority
let l = this.#listeners.get(event.name);
// Sort by priority
l.sort((a, b) => b.priority - a.priority);
if (event.async) {
const trigger = async function () {
const promises = [];
for (let listener of l) {
promises.push(listener.listener(...args));
}
await Promise.all(promises);
};
return trigger.call(this, ...args).catch(exc => console.error(exc.stack));

@@ -564,3 +482,2 @@ } else {

}
destroy() {

@@ -570,8 +487,7 @@ this.#destroyed = true;

}
}
exports.Events = Events;
}
});
/******************************

@@ -591,2 +507,3 @@ INTERNAL MODULE: ./events/types

});
/***************************

@@ -606,3 +523,2 @@ INTERNAL MODULE: ./instances

/*bundle*/
const instances = new class extends Map {

@@ -612,3 +528,2 @@ register(bundle) {

}
}();

@@ -618,2 +533,3 @@ exports.instances = instances;

});
/******************************

@@ -633,40 +549,27 @@ INTERNAL MODULE: ./module/index

/*bundle*/
class Module {
#pkg;
get pkg() {
return this.#pkg;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#version;
get version() {
return this.#version;
}
#subpath;
get subpath() {
return this.#subpath;
}
#multibundle;
get multibundle() {
return this.#multibundle;
}
constructor(specs) {

@@ -690,4 +593,2 @@ this.#vspecifier = specs.vspecifier;

*/
async execute(action, params) {

@@ -700,8 +601,7 @@ if (typeof globalThis.beyond !== 'object') return;

}
}
exports.Module = Module;
}
});
/**************************************

@@ -720,6 +620,4 @@ INTERNAL MODULE: ./package/dependencies

exports.default = void 0;
class _default extends Map {
#pkg;
constructor(pkg) {

@@ -729,3 +627,2 @@ super();

}
update(deps) {

@@ -737,3 +634,2 @@ this.clear();

}
const {

@@ -746,8 +642,7 @@ __beyond_transversal: transversal

}
}
exports.default = _default;
}
});
/*********************************

@@ -766,9 +661,6 @@ INTERNAL MODULE: ./package/exports

exports.default = void 0;
var _trace = require("./ims/require/trace");
class _default {
#require;
#values = {};
get values() {

@@ -781,4 +673,2 @@ return this.#values;

*/
descriptor;

@@ -789,5 +679,3 @@ /**

*/
process;
constructor(require) {

@@ -800,10 +688,8 @@ this.#require = require;

this.#values.__beyond_pkg = this.#require.pkg;
} // Used by the IM exports proxy to update the value of the bundle exported property when
}
// Used by the IM exports proxy to update the value of the bundle exported property when
// the property is changed in the IM
set(key, value) {
this.#values[key] = value;
}
update() {

@@ -815,7 +701,6 @@ const require = id => {

};
this.process?.({
require
}); // Clean all previous values
});
// Clean all previous values
const reserved = ['__beyond_pkg', 'hmr'];

@@ -832,8 +717,7 @@ Object.keys(this.#values).forEach(p => !reserved.includes(p) && delete this.#values[p]);

}
}
exports.default = _default;
}
});
/*************************************

@@ -852,3 +736,2 @@ INTERNAL MODULE: ./package/ims/exports

exports.IMExports = void 0;
class IMExports {

@@ -859,4 +742,4 @@ constructor(im, bexports) {

// Set the exported property
self[name] = value; // Check if it is a bundle exported property
self[name] = value;
// Check if it is a bundle exported property
const prop = bexports.descriptor?.find(({

@@ -877,8 +760,7 @@ im: id,

}
}
exports.IMExports = IMExports;
}
});
/********************************

@@ -897,27 +779,18 @@ INTERNAL MODULE: ./package/ims/im

exports.InternalModule = void 0;
var _trace = require("./require/trace");
var _exports = require("./exports"); // Bundle internal module
var _exports = require("./exports");
// Bundle internal module
class InternalModule {
#pkg;
get package() {
return this.#pkg;
}
#id;
get id() {
return this.#id;
}
#hash;
get hash() {
return this.#hash;
}
#require;

@@ -928,7 +801,5 @@ #exports;

#created = false;
get created() {
return this.#created;
}
#create = trace => {

@@ -938,5 +809,3 @@ if (this.#created) throw new Error(`Internal module "${this.#id}" already created`);

this.#creating = true;
const require = id => this.#require.solve(id, trace, this);
Object.keys(this.#exports).forEach(key => delete this.#exports[key]);

@@ -947,3 +816,2 @@ this.#creator(require, this.#exports);

};
require(trace, source) {

@@ -955,6 +823,4 @@ if (!this.#created) {

}
return this.#exports;
}
initialise() {

@@ -966,3 +832,2 @@ if (this.#created) return;

}
update(creator, hash) {

@@ -973,3 +838,2 @@ this.#created = false;

}
constructor(pkg, id, hash, creator, require) {

@@ -983,8 +847,7 @@ this.#pkg = pkg;

}
}
exports.InternalModule = InternalModule;
}
});
/***********************************

@@ -1003,5 +866,3 @@ INTERNAL MODULE: ./package/ims/index

exports.InternalModules = void 0;
var _im = require("./im");
class InternalModules {

@@ -1011,11 +872,8 @@ #pkg;

#require;
constructor(pkg) {
this.#pkg = pkg;
}
set _require(value) {
this.#require = value;
}
#register = (id, hash, creator) => {

@@ -1026,3 +884,2 @@ if (this.#ims.has(id)) throw new Error(`IM "${id}" already registered`);

};
register(ims) {

@@ -1034,3 +891,2 @@ ims.forEach(({

}
require(id, trace, source) {

@@ -1041,15 +897,11 @@ const module = (() => {

})();
if (!this.#ims.has(module)) {
throw new Error(`Internal module "${id}" not found`);
}
const im = this.#ims.get(module);
return im.require(trace, source);
}
initialise() {
this.#ims.forEach(im => im.initialise());
}
update(ims) {

@@ -1064,3 +916,2 @@ ims.forEach(({

}
const im = this.#ims.get(id);

@@ -1072,8 +923,7 @@ if (im.hash === hash) return;

}
}
exports.InternalModules = InternalModules;
}
});
/*******************************************

@@ -1092,12 +942,8 @@ INTERNAL MODULE: ./package/ims/require/index

exports.Require = void 0;
var _base = require("../../../base");
class Require {
#pkg;
get pkg() {
return this.#pkg;
}
constructor(pkg) {

@@ -1114,4 +960,2 @@ this.#pkg = pkg;

*/
solve(specifier, trace, im) {

@@ -1126,4 +970,2 @@ if (specifier.startsWith('.')) {

*/
if (specifier === 'beyond_context') {

@@ -1138,5 +980,4 @@ const {

};
} // @beyond-js/kernel/transversals requires the Bundle object
}
// @beyond-js/kernel/transversals requires the Bundle object
if (specifier === '@beyond-js/kernel/bundle') {

@@ -1146,7 +987,5 @@ const {

} = require('../../../bundle');
const {
instances
} = require('../../../instances');
return {

@@ -1157,7 +996,5 @@ Bundle,

}
const {
dependencies
} = this.#pkg;
if (dependencies.has(specifier)) {

@@ -1174,12 +1011,10 @@ /**

}
const keys = JSON.stringify([...dependencies.keys()]);
throw new Error(`Bundle "${specifier}" is not registered as a dependency: ${keys}`);
}
}
exports.Require = Require;
}
});
/*******************************************

@@ -1197,8 +1032,7 @@ INTERNAL MODULE: ./package/ims/require/trace

});
exports.Trace = void 0; // Used to find cyclical requires of internal modules
exports.Trace = void 0;
// Used to find cyclical requires of internal modules
// Key is the id being required and the value is the source
class Trace extends Array {
has = id => this.find(rt => rt.id === id);
register(source, id) {

@@ -1218,3 +1052,2 @@ // Check for cyclical module require

}
this.push({

@@ -1225,8 +1058,7 @@ id,

}
}
exports.Trace = Trace;
}
});
/*******************************

@@ -1245,68 +1077,44 @@ INTERNAL MODULE: ./package/index

exports.Package = void 0;
var _ims = require("./ims");
var _require = require("./ims/require");
var _exports = require("./exports");
var _dependencies = require("./dependencies");
var _instances = require("./instances");
var _events = require("../events");
/*bundle*/
class Package {
#bundle;
get bundle() {
return this.#bundle;
}
#language;
get language() {
return this.#language;
}
#vspecifier;
get vspecifier() {
return this.#vspecifier;
}
#specifier;
get specifier() {
return this.#specifier;
}
#require;
#ims;
get ims() {
return this.#ims;
}
#exports;
get exports() {
return this.#exports;
} // The beyond dependencies that are required by the bundle
}
// The beyond dependencies that are required by the bundle
#dependencies = new _dependencies.default(this);
get dependencies() {
return this.#dependencies;
}
#hmr = new _events.Events();
get hmr() {
return this.#hmr;
}
constructor(bundle, language) {

@@ -1321,12 +1129,8 @@ this.#bundle = bundle;

this.#exports = new _exports.default(this.#require);
_instances.default.register(this);
}
#initialised = false;
get initialised() {
return this.#initialised;
}
initialise(ims) {

@@ -1339,3 +1143,2 @@ if (this.#initialised) throw new Error('Package already initialised');

}
update(ims) {

@@ -1347,8 +1150,7 @@ this.#ims.update(ims);

}
}
exports.Package = Package;
}
});
/***********************************

@@ -1367,3 +1169,2 @@ INTERNAL MODULE: ./package/instances

exports.default = void 0;
var _default = new class extends Map {

@@ -1373,5 +1174,3 @@ register(pkg) {

}
}();
exports.default = _default;

@@ -1429,34 +1228,20 @@ }

}];
// Module exports
__pkg.exports.process = function (require) {
_export("bimport", bimport = require('./bimport/bimport').bimport);
_export("brequire", brequire = require('./bimport/brequire').brequire);
_export("IBundleSpecs", IBundleSpecs = require('./bundle').IBundleSpecs);
_export("Bundle", Bundle = require('./bundle').Bundle);
_export("Events", Events = require('./events/index').Events);
_export("ListenerFunction", ListenerFunction = require('./events/types').ListenerFunction);
_export("instances", instances = require('./instances').instances);
_export("Module", Module = require('./module/index').Module);
_export("IExportsDescriptor", IExportsDescriptor = require('./package/exports').IExportsDescriptor);
_export("IMSpecs", IMSpecs = require('./package/ims/im').IMSpecs);
_export("IMCreators", IMCreators = require('./package/ims/index').IMCreators);
_export("Package", Package = require('./package/index').Package);
};
__bp = {};
ims.get('./base/index').creator(() => 0, __bp);
__pkg = new __bp.BeyondPackage(__pkg.exports);
__pkg.initialise(ims);

@@ -1463,0 +1248,0 @@ }

@@ -10,3 +10,3 @@ define(["exports"], function (_exports) {

"package": "@beyond-js/kernel",
"version": "0.1.2",
"version": "0.1.3",
"languages": {

@@ -13,0 +13,0 @@ "supported": [],

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

"package": "@beyond-js/kernel",
"version": "0.1.2",
"version": "0.1.3",
"languages": {

@@ -12,0 +12,0 @@ "supported": [],

@@ -9,3 +9,3 @@ System.register([], function (_export, _context) {

"package": "@beyond-js/kernel",
"version": "0.1.2",
"version": "0.1.3",
"languages": {

@@ -12,0 +12,0 @@ "supported": [],

@@ -11,15 +11,12 @@ define(["exports", "module", "@beyond-js/kernel/bundle"], function (_exports, _amd_module, dependency_0) {

} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/core"
"vspecifier": "@beyond-js/kernel@0.1.3/core"
},
"type": "ts"
}, _amd_module.uri).package();
;
__pkg.dependencies.update([]);
const ims = new Map();
const ims = new Map();
/************************

@@ -38,5 +35,3 @@ INTERNAL MODULE: ./beyond

exports.beyond = exports.Beyond = void 0;
var _languages = require("./languages");
class Beyond {

@@ -58,13 +53,8 @@ /**

*/
async import(resource, version) {
return await bimport(resource, version);
}
}
exports.Beyond = Beyond;
/*bundle*/
const beyond = new Beyond();

@@ -75,2 +65,3 @@ exports.beyond = beyond;

});
/*********************************

@@ -89,7 +80,4 @@ INTERNAL MODULE: ./languages/index

exports.languages = exports.Languages = void 0;
var _events = require("../utils/events/events");
/*bundle*/
class Languages extends _events.Events {

@@ -100,30 +88,21 @@ #project;

#supported;
get supported() {
return this.#supported;
}
get default() {
return this.#specs?.default;
}
#current;
get current() {
return this.#current;
}
#resolve;
#ready = new Promise(resolve => this.#resolve = resolve);
get ready() {
return this.#ready;
}
#fetched = false;
get fetched() {
return this.#fetched;
}
constructor(project) {

@@ -140,6 +119,4 @@ super();

}
#configure(value) {
if (this.#current === value) return true;
if (typeof value !== 'string' || value.length !== 2) {

@@ -149,3 +126,2 @@ console.warn(`Configured language "${value}" is invalid`);

}
if (value && !this.#supported.has(value)) {

@@ -155,3 +131,2 @@ console.log(`Language "${value}" is not supported`);

}
const previous = this.#current;

@@ -162,3 +137,2 @@ this.#current = value;

}
set current(value) {

@@ -168,3 +142,2 @@ if (!this.#configure(value)) return;

}
#setup(specs) {

@@ -175,12 +148,11 @@ // Check if the default language is valid

specs.default = undefined;
} // Check the supported languages, if not set, default will be english
}
// Check the supported languages, if not set, default will be english
const def = specs.default ? specs.default : 'en';
specs.supported = specs.supported instanceof Array ? specs.supported : [def];
!specs.supported.length && specs.supported.push(def);
this.#supported = new Set(specs.supported); // If default language not set or was invalid, take the first supported language
specs.default = specs.default ? specs.default : [...this.#supported][0]; // If default language was configured, but not set in the supported list, warn it
this.#supported = new Set(specs.supported);
// If default language not set or was invalid, take the first supported language
specs.default = specs.default ? specs.default : [...this.#supported][0];
// If default language was configured, but not set in the supported list, warn it
if (!this.#supported.has(specs.default)) {

@@ -190,8 +162,7 @@ console.warn(`Default language "${specs.default}" is not supported by current application`);

}
this.#specs = specs;
const configured = this.#storage?.getItem('__beyond_language'); // Try to configure the locally previously configured language
if (configured && this.#configure(configured)) return; // Try to configure the language configured in the device
const configured = this.#storage?.getItem('__beyond_language');
// Try to configure the locally previously configured language
if (configured && this.#configure(configured)) return;
// Try to configure the language configured in the device
const device = typeof location === 'object' ? navigator.language.split('-')[0] : void 0;

@@ -201,8 +172,5 @@ if (device && this.#configure(device)) return;

}
}
exports.Languages = Languages;
/*bundle*/
const languages = new Languages(globalThis.__app_package.specifier);

@@ -212,2 +180,3 @@ exports.languages = languages;

});
/*************************************

@@ -227,3 +196,2 @@ INTERNAL MODULE: ./utils/events/events

/*bundle*/
class Events {

@@ -233,7 +201,5 @@ #specs;

#destroyed = false;
get destroyed() {
return this.#destroyed;
}
constructor(specs) {

@@ -243,6 +209,4 @@ specs = specs ? specs : {};

this.#specs = specs;
if (specs.bind) {
specs.bind.bind = (event, listener, priority) => this.on(event, listener, priority);
specs.bind.unbind = (event, listener) => this.off(event, listener);

@@ -259,4 +223,2 @@ }

*/
on(event, listener, priority) {

@@ -266,13 +228,9 @@ if (this.#destroyed) {

}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (typeof listener !== 'function') {
throw new Error('Listener is not a function');
}
this.off(event, listener); // Just in case the listener is already registered
const l = this.#listeners.has(event) ? this.#listeners.get(event) : [];

@@ -286,3 +244,2 @@ this.#listeners.set(event, l);

}
bind = (event, listener, priority) => this.on(event, listener, priority);

@@ -297,3 +254,2 @@ /**

*/
off(event, listener, force) {

@@ -303,11 +259,8 @@ if (this.#destroyed) {

}
if (!event) {
throw new Error(`Event name not specified`);
}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (!listener) {

@@ -318,7 +271,5 @@ if (!force) throw new Error('Listener function not set');

}
if (!this.#listeners.has(event)) {
return this;
}
const e = this.#listeners.get(event);

@@ -329,3 +280,2 @@ const filtered = e.filter(item => item.listener !== listener);

}
unbind = (event, listener, force) => this.off(event, listener, force);

@@ -339,3 +289,2 @@ /**

*/
trigger(event, ...rest) {

@@ -345,3 +294,2 @@ if (this.#destroyed) {

}
event = typeof event === 'string' ? {

@@ -352,26 +300,19 @@ 'name': event

if (typeof event.name !== 'string') throw new Error('Invalid event name');
if (this.#specs.supported && !this.#specs.supported.includes(event.name)) {
throw new Error(`Event "${event.name}" is not defined`);
}
let args = [...arguments];
args.shift(); // Remove the event name from the list of arguments
if (!this.#listeners.has(event.name)) return;
let l = this.#listeners.get(event.name); // Sort by priority
let l = this.#listeners.get(event.name);
// Sort by priority
l.sort((a, b) => b.priority - a.priority);
if (event.async) {
const trigger = async function () {
const promises = [];
for (let listener of l) {
promises.push(listener.listener(...args));
}
await Promise.all(promises);
};
return trigger.call(this, ...args).catch(exc => console.error(exc.stack));

@@ -384,3 +325,2 @@ } else {

}
destroy() {

@@ -390,5 +330,3 @@ this.#destroyed = true;

}
}
exports.Events = Events;

@@ -398,2 +336,3 @@ globalThis.Events = Events;

});
/************************************

@@ -413,2 +352,3 @@ INTERNAL MODULE: ./utils/events/types

});
/*******************************************************************************

@@ -428,17 +368,14 @@ INTERNAL MODULE: ./utils/execution-control/cancellation-token/cancellation-token

/*bundle*/
class CancellationToken {
#id = 0;
get current() {
return this.#id;
}
reset = () => ++this.#id;
check = id => id === this.#id;
}
exports.CancellationToken = CancellationToken;
}
});
/*****************************************************************

@@ -458,7 +395,5 @@ INTERNAL MODULE: ./utils/execution-control/single-call/single-call

/*bundle*/
function SingleCall(target, propertyKey, descriptor) {
const originalMethod = descriptor.value;
let promises = new WeakMap();
descriptor.value = function (...args) {

@@ -468,9 +403,6 @@ if (promises.has(this)) return promises.get(this);

promises.set(this, promise);
const clean = () => promises.delete(this);
promise.then(clean).catch(clean);
return promise;
};
return descriptor;

@@ -480,2 +412,3 @@ }

});
/*******************************************************

@@ -495,7 +428,5 @@ INTERNAL MODULE: ./utils/pending-promise/pending-promise

/*bundle*/
class PendingPromise extends Promise {
resolve;
reject;
constructor(executor) {

@@ -507,3 +438,2 @@ // needed for PendingPromise.race/all ecc

}
let resolve = undefined;

@@ -518,6 +448,4 @@ let reject = undefined;

}
} // For backward compatibility
}
// For backward compatibility
exports.PendingPromise = PendingPromise;

@@ -560,4 +488,5 @@ typeof globalThis.process !== 'object' && (window.PendingPromise = PendingPromise);

}];
let beyond, Languages, languages, Events, ListenerFunction, CancellationToken, SingleCall, PendingPromise; // Module exports
let beyond, Languages, languages, Events, ListenerFunction, CancellationToken, SingleCall, PendingPromise;
// Module exports
_exports.PendingPromise = PendingPromise;

@@ -571,3 +500,2 @@ _exports.SingleCall = SingleCall;

_exports.beyond = beyond;
__pkg.exports.process = function ({

@@ -587,3 +515,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -593,9 +520,7 @@ _exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
_exports.hmr = hmr;
__pkg.initialise(ims);
});
//# sourceMappingURL=core.amd.js.map

@@ -7,21 +7,16 @@ "use strict";

exports.languages = exports.hmr = exports.beyond = exports.__beyond_pkg = exports.SingleCall = exports.PendingPromise = exports.ListenerFunction = exports.Languages = exports.Events = exports.CancellationToken = void 0;
var dependency_0 = require("@beyond-js/kernel/bundle");
const {
Bundle: __Bundle
} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/core"
"vspecifier": "@beyond-js/kernel@0.1.3/core"
},
"type": "ts"
}).package();
;
__pkg.dependencies.update([]);
const ims = new Map();
const ims = new Map();
/************************

@@ -40,5 +35,3 @@ INTERNAL MODULE: ./beyond

exports.beyond = exports.Beyond = void 0;
var _languages = require("./languages");
class Beyond {

@@ -60,13 +53,8 @@ /**

*/
async import(resource, version) {
return await bimport(resource, version);
}
}
exports.Beyond = Beyond;
/*bundle*/
const beyond = new Beyond();

@@ -77,2 +65,3 @@ exports.beyond = beyond;

});
/*********************************

@@ -91,7 +80,4 @@ INTERNAL MODULE: ./languages/index

exports.languages = exports.Languages = void 0;
var _events = require("../utils/events/events");
/*bundle*/
class Languages extends _events.Events {

@@ -102,30 +88,21 @@ #project;

#supported;
get supported() {
return this.#supported;
}
get default() {
return this.#specs?.default;
}
#current;
get current() {
return this.#current;
}
#resolve;
#ready = new Promise(resolve => this.#resolve = resolve);
get ready() {
return this.#ready;
}
#fetched = false;
get fetched() {
return this.#fetched;
}
constructor(project) {

@@ -142,6 +119,4 @@ super();

}
#configure(value) {
if (this.#current === value) return true;
if (typeof value !== 'string' || value.length !== 2) {

@@ -151,3 +126,2 @@ console.warn(`Configured language "${value}" is invalid`);

}
if (value && !this.#supported.has(value)) {

@@ -157,3 +131,2 @@ console.log(`Language "${value}" is not supported`);

}
const previous = this.#current;

@@ -164,3 +137,2 @@ this.#current = value;

}
set current(value) {

@@ -170,3 +142,2 @@ if (!this.#configure(value)) return;

}
#setup(specs) {

@@ -177,12 +148,11 @@ // Check if the default language is valid

specs.default = undefined;
} // Check the supported languages, if not set, default will be english
}
// Check the supported languages, if not set, default will be english
const def = specs.default ? specs.default : 'en';
specs.supported = specs.supported instanceof Array ? specs.supported : [def];
!specs.supported.length && specs.supported.push(def);
this.#supported = new Set(specs.supported); // If default language not set or was invalid, take the first supported language
specs.default = specs.default ? specs.default : [...this.#supported][0]; // If default language was configured, but not set in the supported list, warn it
this.#supported = new Set(specs.supported);
// If default language not set or was invalid, take the first supported language
specs.default = specs.default ? specs.default : [...this.#supported][0];
// If default language was configured, but not set in the supported list, warn it
if (!this.#supported.has(specs.default)) {

@@ -192,8 +162,7 @@ console.warn(`Default language "${specs.default}" is not supported by current application`);

}
this.#specs = specs;
const configured = this.#storage?.getItem('__beyond_language'); // Try to configure the locally previously configured language
if (configured && this.#configure(configured)) return; // Try to configure the language configured in the device
const configured = this.#storage?.getItem('__beyond_language');
// Try to configure the locally previously configured language
if (configured && this.#configure(configured)) return;
// Try to configure the language configured in the device
const device = typeof location === 'object' ? navigator.language.split('-')[0] : void 0;

@@ -203,8 +172,5 @@ if (device && this.#configure(device)) return;

}
}
exports.Languages = Languages;
/*bundle*/
const languages = new Languages(globalThis.__app_package.specifier);

@@ -214,2 +180,3 @@ exports.languages = languages;

});
/*************************************

@@ -229,3 +196,2 @@ INTERNAL MODULE: ./utils/events/events

/*bundle*/
class Events {

@@ -235,7 +201,5 @@ #specs;

#destroyed = false;
get destroyed() {
return this.#destroyed;
}
constructor(specs) {

@@ -245,6 +209,4 @@ specs = specs ? specs : {};

this.#specs = specs;
if (specs.bind) {
specs.bind.bind = (event, listener, priority) => this.on(event, listener, priority);
specs.bind.unbind = (event, listener) => this.off(event, listener);

@@ -261,4 +223,2 @@ }

*/
on(event, listener, priority) {

@@ -268,13 +228,9 @@ if (this.#destroyed) {

}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (typeof listener !== 'function') {
throw new Error('Listener is not a function');
}
this.off(event, listener); // Just in case the listener is already registered
const l = this.#listeners.has(event) ? this.#listeners.get(event) : [];

@@ -288,3 +244,2 @@ this.#listeners.set(event, l);

}
bind = (event, listener, priority) => this.on(event, listener, priority);

@@ -299,3 +254,2 @@ /**

*/
off(event, listener, force) {

@@ -305,11 +259,8 @@ if (this.#destroyed) {

}
if (!event) {
throw new Error(`Event name not specified`);
}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (!listener) {

@@ -320,7 +271,5 @@ if (!force) throw new Error('Listener function not set');

}
if (!this.#listeners.has(event)) {
return this;
}
const e = this.#listeners.get(event);

@@ -331,3 +280,2 @@ const filtered = e.filter(item => item.listener !== listener);

}
unbind = (event, listener, force) => this.off(event, listener, force);

@@ -341,3 +289,2 @@ /**

*/
trigger(event, ...rest) {

@@ -347,3 +294,2 @@ if (this.#destroyed) {

}
event = typeof event === 'string' ? {

@@ -354,26 +300,19 @@ 'name': event

if (typeof event.name !== 'string') throw new Error('Invalid event name');
if (this.#specs.supported && !this.#specs.supported.includes(event.name)) {
throw new Error(`Event "${event.name}" is not defined`);
}
let args = [...arguments];
args.shift(); // Remove the event name from the list of arguments
if (!this.#listeners.has(event.name)) return;
let l = this.#listeners.get(event.name); // Sort by priority
let l = this.#listeners.get(event.name);
// Sort by priority
l.sort((a, b) => b.priority - a.priority);
if (event.async) {
const trigger = async function () {
const promises = [];
for (let listener of l) {
promises.push(listener.listener(...args));
}
await Promise.all(promises);
};
return trigger.call(this, ...args).catch(exc => console.error(exc.stack));

@@ -386,3 +325,2 @@ } else {

}
destroy() {

@@ -392,5 +330,3 @@ this.#destroyed = true;

}
}
exports.Events = Events;

@@ -400,2 +336,3 @@ globalThis.Events = Events;

});
/************************************

@@ -415,2 +352,3 @@ INTERNAL MODULE: ./utils/events/types

});
/*******************************************************************************

@@ -430,17 +368,14 @@ INTERNAL MODULE: ./utils/execution-control/cancellation-token/cancellation-token

/*bundle*/
class CancellationToken {
#id = 0;
get current() {
return this.#id;
}
reset = () => ++this.#id;
check = id => id === this.#id;
}
exports.CancellationToken = CancellationToken;
}
});
/*****************************************************************

@@ -460,7 +395,5 @@ INTERNAL MODULE: ./utils/execution-control/single-call/single-call

/*bundle*/
function SingleCall(target, propertyKey, descriptor) {
const originalMethod = descriptor.value;
let promises = new WeakMap();
descriptor.value = function (...args) {

@@ -470,9 +403,6 @@ if (promises.has(this)) return promises.get(this);

promises.set(this, promise);
const clean = () => promises.delete(this);
promise.then(clean).catch(clean);
return promise;
};
return descriptor;

@@ -482,2 +412,3 @@ }

});
/*******************************************************

@@ -497,7 +428,5 @@ INTERNAL MODULE: ./utils/pending-promise/pending-promise

/*bundle*/
class PendingPromise extends Promise {
resolve;
reject;
constructor(executor) {

@@ -509,3 +438,2 @@ // needed for PendingPromise.race/all ecc

}
let resolve = undefined;

@@ -520,6 +448,4 @@ let reject = undefined;

}
} // For backward compatibility
}
// For backward compatibility
exports.PendingPromise = PendingPromise;

@@ -562,4 +488,5 @@ typeof globalThis.process !== 'object' && (window.PendingPromise = PendingPromise);

}];
let beyond, Languages, languages, Events, ListenerFunction, CancellationToken, SingleCall, PendingPromise; // Module exports
let beyond, Languages, languages, Events, ListenerFunction, CancellationToken, SingleCall, PendingPromise;
// Module exports
exports.PendingPromise = PendingPromise;

@@ -573,3 +500,2 @@ exports.SingleCall = SingleCall;

exports.beyond = beyond;
__pkg.exports.process = function ({

@@ -589,3 +515,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -595,8 +520,6 @@ exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
exports.hmr = hmr;
__pkg.initialise(ims);
//# sourceMappingURL=core.cjs.js.map

@@ -5,3 +5,2 @@ System.register(["@beyond-js/kernel/bundle"], function (_export, _context) {

var dependency_0, __Bundle, __pkg, ims, beyond, Languages, languages, Events, ListenerFunction, CancellationToken, SingleCall, PendingPromise, __beyond_pkg, hmr;
_export({

@@ -17,3 +16,2 @@ beyond: void 0,

});
return {

@@ -29,3 +27,3 @@ setters: [function (_beyondJsKernelBundle) {

"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/core"
"vspecifier": "@beyond-js/kernel@0.1.3/core"
},

@@ -35,5 +33,3 @@ "type": "ts"

;
__pkg.dependencies.update([]);
ims = new Map();

@@ -43,3 +39,2 @@ /************************

************************/
ims.set('./beyond', {

@@ -54,5 +49,3 @@ hash: 959081709,

exports.beyond = exports.Beyond = void 0;
var _languages = require("./languages");
class Beyond {

@@ -74,13 +67,8 @@ /**

*/
async import(resource, version) {
return await bimport(resource, version);
}
}
exports.Beyond = Beyond;
/*bundle*/
const beyond = new Beyond();

@@ -91,2 +79,3 @@ exports.beyond = beyond;

});
/*********************************

@@ -105,7 +94,4 @@ INTERNAL MODULE: ./languages/index

exports.languages = exports.Languages = void 0;
var _events = require("../utils/events/events");
/*bundle*/
class Languages extends _events.Events {

@@ -116,30 +102,21 @@ #project;

#supported;
get supported() {
return this.#supported;
}
get default() {
return this.#specs?.default;
}
#current;
get current() {
return this.#current;
}
#resolve;
#ready = new Promise(resolve => this.#resolve = resolve);
get ready() {
return this.#ready;
}
#fetched = false;
get fetched() {
return this.#fetched;
}
constructor(project) {

@@ -156,6 +133,4 @@ super();

}
#configure(value) {
if (this.#current === value) return true;
if (typeof value !== 'string' || value.length !== 2) {

@@ -165,3 +140,2 @@ console.warn(`Configured language "${value}" is invalid`);

}
if (value && !this.#supported.has(value)) {

@@ -171,3 +145,2 @@ console.log(`Language "${value}" is not supported`);

}
const previous = this.#current;

@@ -178,3 +151,2 @@ this.#current = value;

}
set current(value) {

@@ -184,3 +156,2 @@ if (!this.#configure(value)) return;

}
#setup(specs) {

@@ -191,12 +162,11 @@ // Check if the default language is valid

specs.default = undefined;
} // Check the supported languages, if not set, default will be english
}
// Check the supported languages, if not set, default will be english
const def = specs.default ? specs.default : 'en';
specs.supported = specs.supported instanceof Array ? specs.supported : [def];
!specs.supported.length && specs.supported.push(def);
this.#supported = new Set(specs.supported); // If default language not set or was invalid, take the first supported language
specs.default = specs.default ? specs.default : [...this.#supported][0]; // If default language was configured, but not set in the supported list, warn it
this.#supported = new Set(specs.supported);
// If default language not set or was invalid, take the first supported language
specs.default = specs.default ? specs.default : [...this.#supported][0];
// If default language was configured, but not set in the supported list, warn it
if (!this.#supported.has(specs.default)) {

@@ -206,8 +176,7 @@ console.warn(`Default language "${specs.default}" is not supported by current application`);

}
this.#specs = specs;
const configured = this.#storage?.getItem('__beyond_language'); // Try to configure the locally previously configured language
if (configured && this.#configure(configured)) return; // Try to configure the language configured in the device
const configured = this.#storage?.getItem('__beyond_language');
// Try to configure the locally previously configured language
if (configured && this.#configure(configured)) return;
// Try to configure the language configured in the device
const device = typeof location === 'object' ? navigator.language.split('-')[0] : void 0;

@@ -217,8 +186,5 @@ if (device && this.#configure(device)) return;

}
}
exports.Languages = Languages;
/*bundle*/
const languages = new Languages(globalThis.__app_package.specifier);

@@ -228,2 +194,3 @@ exports.languages = languages;

});
/*************************************

@@ -243,3 +210,2 @@ INTERNAL MODULE: ./utils/events/events

/*bundle*/
class Events {

@@ -249,7 +215,5 @@ #specs;

#destroyed = false;
get destroyed() {
return this.#destroyed;
}
constructor(specs) {

@@ -259,6 +223,4 @@ specs = specs ? specs : {};

this.#specs = specs;
if (specs.bind) {
specs.bind.bind = (event, listener, priority) => this.on(event, listener, priority);
specs.bind.unbind = (event, listener) => this.off(event, listener);

@@ -275,4 +237,2 @@ }

*/
on(event, listener, priority) {

@@ -282,13 +242,9 @@ if (this.#destroyed) {

}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (typeof listener !== 'function') {
throw new Error('Listener is not a function');
}
this.off(event, listener); // Just in case the listener is already registered
const l = this.#listeners.has(event) ? this.#listeners.get(event) : [];

@@ -302,3 +258,2 @@ this.#listeners.set(event, l);

}
bind = (event, listener, priority) => this.on(event, listener, priority);

@@ -313,3 +268,2 @@ /**

*/
off(event, listener, force) {

@@ -319,11 +273,8 @@ if (this.#destroyed) {

}
if (!event) {
throw new Error(`Event name not specified`);
}
if (this.#specs.supported && !this.#specs.supported.includes(event)) {
throw new Error(`Event "${event}" is not defined`);
}
if (!listener) {

@@ -334,7 +285,5 @@ if (!force) throw new Error('Listener function not set');

}
if (!this.#listeners.has(event)) {
return this;
}
const e = this.#listeners.get(event);

@@ -345,3 +294,2 @@ const filtered = e.filter(item => item.listener !== listener);

}
unbind = (event, listener, force) => this.off(event, listener, force);

@@ -355,3 +303,2 @@ /**

*/
trigger(event, ...rest) {

@@ -361,3 +308,2 @@ if (this.#destroyed) {

}
event = typeof event === 'string' ? {

@@ -368,26 +314,19 @@ 'name': event

if (typeof event.name !== 'string') throw new Error('Invalid event name');
if (this.#specs.supported && !this.#specs.supported.includes(event.name)) {
throw new Error(`Event "${event.name}" is not defined`);
}
let args = [...arguments];
args.shift(); // Remove the event name from the list of arguments
if (!this.#listeners.has(event.name)) return;
let l = this.#listeners.get(event.name); // Sort by priority
let l = this.#listeners.get(event.name);
// Sort by priority
l.sort((a, b) => b.priority - a.priority);
if (event.async) {
const trigger = async function () {
const promises = [];
for (let listener of l) {
promises.push(listener.listener(...args));
}
await Promise.all(promises);
};
return trigger.call(this, ...args).catch(exc => console.error(exc.stack));

@@ -400,3 +339,2 @@ } else {

}
destroy() {

@@ -406,5 +344,3 @@ this.#destroyed = true;

}
}
exports.Events = Events;

@@ -414,2 +350,3 @@ globalThis.Events = Events;

});
/************************************

@@ -429,2 +366,3 @@ INTERNAL MODULE: ./utils/events/types

});
/*******************************************************************************

@@ -444,17 +382,14 @@ INTERNAL MODULE: ./utils/execution-control/cancellation-token/cancellation-token

/*bundle*/
class CancellationToken {
#id = 0;
get current() {
return this.#id;
}
reset = () => ++this.#id;
check = id => id === this.#id;
}
exports.CancellationToken = CancellationToken;
}
});
/*****************************************************************

@@ -474,7 +409,5 @@ INTERNAL MODULE: ./utils/execution-control/single-call/single-call

/*bundle*/
function SingleCall(target, propertyKey, descriptor) {
const originalMethod = descriptor.value;
let promises = new WeakMap();
descriptor.value = function (...args) {

@@ -484,9 +417,6 @@ if (promises.has(this)) return promises.get(this);

promises.set(this, promise);
const clean = () => promises.delete(this);
promise.then(clean).catch(clean);
return promise;
};
return descriptor;

@@ -496,2 +426,3 @@ }

});
/*******************************************************

@@ -511,7 +442,5 @@ INTERNAL MODULE: ./utils/pending-promise/pending-promise

/*bundle*/
class PendingPromise extends Promise {
resolve;
reject;
constructor(executor) {

@@ -523,3 +452,2 @@ // needed for PendingPromise.race/all ecc

}
let resolve = undefined;

@@ -534,6 +462,4 @@ let reject = undefined;

}
} // For backward compatibility
}
// For backward compatibility
exports.PendingPromise = PendingPromise;

@@ -576,3 +502,2 @@ typeof globalThis.process !== 'object' && (window.PendingPromise = PendingPromise);

}];
// Module exports

@@ -593,11 +518,7 @@ __pkg.exports.process = function ({

};
_export("__beyond_pkg", __beyond_pkg = __pkg);
_export("hmr", hmr = new function () {
this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}());
__pkg.initialise(ims);

@@ -604,0 +525,0 @@ }

@@ -11,15 +11,12 @@ define(["exports", "module", "@beyond-js/kernel/bundle"], function (_exports, _amd_module, dependency_0) {

} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/error"
"vspecifier": "@beyond-js/kernel@0.1.3/error"
},
"type": "ts"
}, _amd_module.uri).package();
;
__pkg.dependencies.update([]);
const ims = new Map();
const ims = new Map();
/***********************

@@ -43,11 +40,10 @@ INTERNAL MODULE: ./error

}
return err.stack;
};
};
Error.prepareStackTrace && prepareStackTrace(Error);
}
}); // Module exports
});
// Module exports
__pkg.exports.process = function ({

@@ -58,3 +54,2 @@ require,

}) {};
const __beyond_pkg = __pkg;

@@ -64,9 +59,7 @@ _exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
_exports.hmr = hmr;
__pkg.initialise(ims);
});
//# sourceMappingURL=error.amd.js.map

@@ -7,21 +7,16 @@ "use strict";

exports.hmr = exports.__beyond_pkg = void 0;
var dependency_0 = require("@beyond-js/kernel/bundle");
const {
Bundle: __Bundle
} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/error"
"vspecifier": "@beyond-js/kernel@0.1.3/error"
},
"type": "ts"
}).package();
;
__pkg.dependencies.update([]);
const ims = new Map();
const ims = new Map();
/***********************

@@ -45,11 +40,10 @@ INTERNAL MODULE: ./error

}
return err.stack;
};
};
Error.prepareStackTrace && prepareStackTrace(Error);
}
}); // Module exports
});
// Module exports
__pkg.exports.process = function ({

@@ -60,3 +54,2 @@ require,

}) {};
const __beyond_pkg = __pkg;

@@ -66,8 +59,6 @@ exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
exports.hmr = hmr;
__pkg.initialise(ims);
//# sourceMappingURL=error.cjs.js.map

@@ -5,3 +5,2 @@ System.register(["@beyond-js/kernel/bundle"], function (_export, _context) {

var dependency_0, __Bundle, __pkg, ims, __beyond_pkg, hmr;
return {

@@ -17,3 +16,3 @@ setters: [function (_beyondJsKernelBundle) {

"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/error"
"vspecifier": "@beyond-js/kernel@0.1.3/error"
},

@@ -23,5 +22,3 @@ "type": "ts"

;
__pkg.dependencies.update([]);
ims = new Map();

@@ -31,3 +28,2 @@ /***********************

***********************/
ims.set('./error', {

@@ -47,11 +43,10 @@ hash: 1344789388,

}
return err.stack;
};
};
Error.prepareStackTrace && prepareStackTrace(Error);
}
}); // Module exports
});
// Module exports
__pkg.exports.process = function ({

@@ -62,11 +57,7 @@ require,

}) {};
_export("__beyond_pkg", __beyond_pkg = __pkg);
_export("hmr", hmr = new function () {
this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}());
__pkg.initialise(ims);

@@ -73,0 +64,0 @@ }

{
"name": "@beyond-js/kernel",
"version": "0.1.2",
"version": "0.1.3",
"license": "MIT",

@@ -10,2 +10,3 @@ "keywords": [],

},
"scripts": {},
"exports": {

@@ -12,0 +13,0 @@ "./bundle": {

@@ -11,15 +11,12 @@ define(["exports", "module", "@beyond-js/kernel/bundle", "@beyond-js/kernel/core"], function (_exports, _amd_module, dependency_0, dependency_1) {

} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/routing"
"vspecifier": "@beyond-js/kernel@0.1.3/routing"
},
"type": "ts"
}, _amd_module.uri).package();
;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
const ims = new Map();
const ims = new Map();
/*********************************

@@ -38,5 +35,3 @@ INTERNAL MODULE: ./history/history

exports.BeyondHistory = void 0;
var _position = require("./position");
var _records = require("./records");

@@ -47,27 +42,18 @@ /**

*/
class BeyondHistory {
#position;
get position() {
return this.#position;
}
#records;
get records() {
return this.#records;
}
get valid() {
return this.#records.valid;
}
get current() {
return this.valid ? this.#records.current.uri : void 0;
}
#initial = history.length;
get initial() {

@@ -83,17 +69,11 @@ return this.#initial;

*/
#processBrowserURI(uri) {
void this;
if (uri === void 0) return;
const {
routing
} = require('../routing');
const RoutingModeEnum = require('../routing').RoutingMode;
return routing.mode === RoutingModeEnum.Hash ? `#${uri.substr(1)}` : uri;
}
#push(uri) {

@@ -104,8 +84,7 @@ this.#records.reset();

}
replaceState(state, title, uri) {
state = state ? state : {};
if (typeof state !== 'object') throw new Error('Invalid state parameter');
this.#records.updateCurrentURI(uri); // The uri in the browser considering the routing mode
this.#records.updateCurrentURI(uri);
// The uri in the browser considering the routing mode
const position = this.#position.value;

@@ -115,3 +94,2 @@ history.replaceState(state, title, this.#processBrowserURI(uri));

}
pushState(uri, state) {

@@ -124,3 +102,2 @@ if (uri === `${location.pathname}${location.search}${location.hash}`) return;

}
back() {

@@ -132,3 +109,2 @@ const previous = this.#records.previous?.position;

}
forward() {

@@ -140,7 +116,5 @@ const following = this.#records.following?.position;

}
constructor(routing, Mode) {
this.#position = new _position.HistoryPosition();
this.#records = new _records.HistoryRecords(this.#position);
if (this.#position.value === void 0) {

@@ -152,8 +126,7 @@ // It is not a refresh of a previously navigated page

}
}
exports.BeyondHistory = BeyondHistory;
}
});
/**********************************

@@ -179,3 +152,2 @@ INTERNAL MODULE: ./history/position

*/
class HistoryPosition {

@@ -191,8 +163,5 @@ check() {

*/
get value() {
return history.state?.__beyond_navigation_position;
}
save(position) {

@@ -203,8 +172,7 @@ const state = history.state ? history.state : {};

}
}
exports.HistoryPosition = HistoryPosition;
}
});
/*********************************

@@ -223,25 +191,18 @@ INTERNAL MODULE: ./history/records

exports.HistoryRecords = void 0;
class HistoryRecords {
#position;
#valid = true;
get valid() {
return this.#valid;
}
#entries = [];
get entries() {
return this.#entries.slice();
}
get length() {
return this.#entries.length;
}
get current() {
return this.#entries[this.#position.value - 1];
}
get previous() {

@@ -252,3 +213,2 @@ const previous = this.#position.value - 2;

}
get following() {

@@ -259,7 +219,5 @@ const following = this.#position.value;

}
constructor(position) {
this.#position = position;
let parsed;
try {

@@ -271,3 +229,2 @@ const stored = sessionStorage.getItem('__beyond_navigation_records');

*/
if (!stored && position.value !== void 0) {

@@ -277,3 +234,2 @@ this.#valid = false;

}
parsed = stored ? JSON.parse(stored) : [];

@@ -285,3 +241,2 @@ } catch (exc) {

}
if (!(parsed instanceof Array)) {

@@ -291,3 +246,2 @@ const warning = 'The beyond navigation data, stored in session store is invalid.';

}
this.#entries = parsed;

@@ -301,4 +255,2 @@ }

*/
#sanitizeURI(uri) {

@@ -309,3 +261,2 @@ void this;

}
get(index) {

@@ -318,4 +269,2 @@ return this.#entries[index];

*/
push(uri) {

@@ -339,4 +288,2 @@ uri = this.#sanitizeURI(uri);

*/
reset() {

@@ -347,3 +294,2 @@ const position = this.#position.value;

}
updateCurrentURI(uri) {

@@ -359,3 +305,2 @@ if (!this.#valid) return;

}
save() {

@@ -365,8 +310,7 @@ if (!this.#valid) return;

}
}
exports.HistoryRecords = HistoryRecords;
}
});
/*************************

@@ -385,12 +329,7 @@ INTERNAL MODULE: ./routing

exports.routing = exports.RoutingMode = exports.Routing = void 0;
var _uri2 = require("./uri/uri");
var _core = require("@beyond-js/kernel/core");
var _history = require("./history/history");
var RoutingMode;
exports.RoutingMode = RoutingMode;
(function (RoutingMode) {

@@ -400,37 +339,25 @@ RoutingMode[RoutingMode["Hash"] = 0] = "Hash";

})(RoutingMode || (exports.RoutingMode = RoutingMode = {}));
const serverside = typeof process === 'object';
class Routing extends _core.Events {
#mode;
get mode() {
return this.#mode;
}
#history;
get history() {
return this.#history;
}
#initialised = false;
get initialised() {
return this.#initialised;
}
#resolve;
#ready = new Promise(resolve => this.#resolve = resolve);
get ready() {
return this.#ready;
}
#uri;
get uri() {
return this.#uri;
}
missing;

@@ -440,6 +367,5 @@ redirect;

#configured = new Promise(resolve => this.#resolveConfigured = resolve);
constructor() {
super(); // @TODO: move to some kind of initialization / setup
super();
// @TODO: move to some kind of initialization / setup
const {

@@ -460,3 +386,2 @@ specifier

}
#redirect = async uri => {

@@ -466,3 +391,2 @@ if (typeof this.redirect !== 'function') return;

if (!redirected) return;
if (typeof redirected !== 'string') {

@@ -472,9 +396,6 @@ console.error(`Invalid route value set by custom routing function`, redirected);

}
if (uri.pathname === redirected) return; // Routing function returned the actual route
this.pushState(redirected);
return true;
};
pushState(uri, state) {

@@ -486,3 +407,2 @@ this.#configured.then(() => {

}
replaceState(state, title, uri) {

@@ -493,5 +413,4 @@ this.#configured.then(() => {

});
} // Avoid to continue the execution on asynchronous calls, when a newest call's been made
}
// Avoid to continue the execution on asynchronous calls, when a newest call's been made
#cancellationToken = new _core.CancellationToken();

@@ -505,8 +424,6 @@ update = async () => {

} = location;
const _uri = this.#mode === RoutingMode.Hash ? `/${hash.slice(1)}` : pathname + search + hash;
if (this.#uri?.uri === _uri) return;
const uri = this.#uri = new _uri2.URI(_uri); // Check for uri redirect
const uri = this.#uri = new _uri2.URI(_uri);
// Check for uri redirect
const redirected = await this.#redirect(uri);

@@ -516,10 +433,8 @@ if (!this.#cancellationToken.check(cancellationTokenId)) return;

// Verify the state of the history registry to check for possible errors
this.#history && uri.uri !== this.#history.current && console.error(`History current "${this.#history.current}" is not equal to actual uri "${uri.uri}"`);
this.#initialised ? this.trigger('change') : this.#resolve();
this.#initialised = true;
}; // Wait for start.js be completed, as routing.redirect must be set before initialising routing
};
// Wait for start.js be completed, as routing.redirect must be set before initialising routing
#started = false;
setup() {

@@ -529,16 +444,11 @@ this.#started = true;

}
back() {
this.#history.back();
}
forward() {
this.#history.forward();
}
}
exports.Routing = Routing;
/*bundle*/
const routing = new Routing();

@@ -550,7 +460,8 @@ exports.routing = routing;

!serverside && (beyond.back = () => routing.back());
!serverside && (beyond.forward = () => routing.forward()); // Only on client side
!serverside && (beyond.forward = () => routing.forward());
// Only on client side
!serverside && window.addEventListener('popstate', () => routing.update().catch(exc => console.error(exc.stack)));
}
});
/*********************************

@@ -569,3 +480,2 @@ INTERNAL MODULE: ./uri/querystring

exports.QueryString = void 0;
class QueryString extends Map {

@@ -577,3 +487,2 @@ constructor(search) {

const split = search.split('&');
for (let i = 0; i < split.length; ++i) {

@@ -585,8 +494,7 @@ const param = split[i].split('=', 2);

}
}
exports.QueryString = QueryString;
}
});
/*************************

@@ -605,45 +513,31 @@ INTERNAL MODULE: ./uri/uri

exports.URI = void 0;
var _querystring = require("./querystring");
/*bundle*/
/*bundle*/ /**
* Uri parser
*
* @param href {string} The href to be parsed
* @constructor
*/
/**
* Uri parser
*
* @param href {string} The href to be parsed
* @constructor
*/
class URI {
#uri;
get uri() {
return this.#uri;
}
#pathname;
get pathname() {
return this.#pathname;
}
#search;
get search() {
return this.#search;
}
#qs;
get qs() {
return this.#qs;
}
#hash;
get hash() {
return this.#hash;
}
constructor(uri) {

@@ -658,5 +552,3 @@ this.#uri = uri;

}
}
exports.URI = URI;

@@ -674,7 +566,7 @@ }

}];
let routing, URI; // Module exports
let routing, URI;
// Module exports
_exports.URI = URI;
_exports.routing = routing;
__pkg.exports.process = function ({

@@ -688,5 +580,4 @@ require,

};
__pkg.initialise(ims);
});
//# sourceMappingURL=routing.amd.js.map

@@ -7,23 +7,17 @@ "use strict";

exports.routing = exports.URI = void 0;
var dependency_0 = require("@beyond-js/kernel/bundle");
var dependency_1 = require("@beyond-js/kernel/core");
const {
Bundle: __Bundle
} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/routing"
"vspecifier": "@beyond-js/kernel@0.1.3/routing"
},
"type": "ts"
}).package();
;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
const ims = new Map();
const ims = new Map();
/*********************************

@@ -42,5 +36,3 @@ INTERNAL MODULE: ./history/history

exports.BeyondHistory = void 0;
var _position = require("./position");
var _records = require("./records");

@@ -51,27 +43,18 @@ /**

*/
class BeyondHistory {
#position;
get position() {
return this.#position;
}
#records;
get records() {
return this.#records;
}
get valid() {
return this.#records.valid;
}
get current() {
return this.valid ? this.#records.current.uri : void 0;
}
#initial = history.length;
get initial() {

@@ -87,17 +70,11 @@ return this.#initial;

*/
#processBrowserURI(uri) {
void this;
if (uri === void 0) return;
const {
routing
} = require('../routing');
const RoutingModeEnum = require('../routing').RoutingMode;
return routing.mode === RoutingModeEnum.Hash ? `#${uri.substr(1)}` : uri;
}
#push(uri) {

@@ -108,8 +85,7 @@ this.#records.reset();

}
replaceState(state, title, uri) {
state = state ? state : {};
if (typeof state !== 'object') throw new Error('Invalid state parameter');
this.#records.updateCurrentURI(uri); // The uri in the browser considering the routing mode
this.#records.updateCurrentURI(uri);
// The uri in the browser considering the routing mode
const position = this.#position.value;

@@ -119,3 +95,2 @@ history.replaceState(state, title, this.#processBrowserURI(uri));

}
pushState(uri, state) {

@@ -128,3 +103,2 @@ if (uri === `${location.pathname}${location.search}${location.hash}`) return;

}
back() {

@@ -136,3 +110,2 @@ const previous = this.#records.previous?.position;

}
forward() {

@@ -144,7 +117,5 @@ const following = this.#records.following?.position;

}
constructor(routing, Mode) {
this.#position = new _position.HistoryPosition();
this.#records = new _records.HistoryRecords(this.#position);
if (this.#position.value === void 0) {

@@ -156,8 +127,7 @@ // It is not a refresh of a previously navigated page

}
}
exports.BeyondHistory = BeyondHistory;
}
});
/**********************************

@@ -183,3 +153,2 @@ INTERNAL MODULE: ./history/position

*/
class HistoryPosition {

@@ -195,8 +164,5 @@ check() {

*/
get value() {
return history.state?.__beyond_navigation_position;
}
save(position) {

@@ -207,8 +173,7 @@ const state = history.state ? history.state : {};

}
}
exports.HistoryPosition = HistoryPosition;
}
});
/*********************************

@@ -227,25 +192,18 @@ INTERNAL MODULE: ./history/records

exports.HistoryRecords = void 0;
class HistoryRecords {
#position;
#valid = true;
get valid() {
return this.#valid;
}
#entries = [];
get entries() {
return this.#entries.slice();
}
get length() {
return this.#entries.length;
}
get current() {
return this.#entries[this.#position.value - 1];
}
get previous() {

@@ -256,3 +214,2 @@ const previous = this.#position.value - 2;

}
get following() {

@@ -263,7 +220,5 @@ const following = this.#position.value;

}
constructor(position) {
this.#position = position;
let parsed;
try {

@@ -275,3 +230,2 @@ const stored = sessionStorage.getItem('__beyond_navigation_records');

*/
if (!stored && position.value !== void 0) {

@@ -281,3 +235,2 @@ this.#valid = false;

}
parsed = stored ? JSON.parse(stored) : [];

@@ -289,3 +242,2 @@ } catch (exc) {

}
if (!(parsed instanceof Array)) {

@@ -295,3 +247,2 @@ const warning = 'The beyond navigation data, stored in session store is invalid.';

}
this.#entries = parsed;

@@ -305,4 +256,2 @@ }

*/
#sanitizeURI(uri) {

@@ -313,3 +262,2 @@ void this;

}
get(index) {

@@ -322,4 +270,2 @@ return this.#entries[index];

*/
push(uri) {

@@ -343,4 +289,2 @@ uri = this.#sanitizeURI(uri);

*/
reset() {

@@ -351,3 +295,2 @@ const position = this.#position.value;

}
updateCurrentURI(uri) {

@@ -363,3 +306,2 @@ if (!this.#valid) return;

}
save() {

@@ -369,8 +311,7 @@ if (!this.#valid) return;

}
}
exports.HistoryRecords = HistoryRecords;
}
});
/*************************

@@ -389,12 +330,7 @@ INTERNAL MODULE: ./routing

exports.routing = exports.RoutingMode = exports.Routing = void 0;
var _uri2 = require("./uri/uri");
var _core = require("@beyond-js/kernel/core");
var _history = require("./history/history");
var RoutingMode;
exports.RoutingMode = RoutingMode;
(function (RoutingMode) {

@@ -404,37 +340,25 @@ RoutingMode[RoutingMode["Hash"] = 0] = "Hash";

})(RoutingMode || (exports.RoutingMode = RoutingMode = {}));
const serverside = typeof process === 'object';
class Routing extends _core.Events {
#mode;
get mode() {
return this.#mode;
}
#history;
get history() {
return this.#history;
}
#initialised = false;
get initialised() {
return this.#initialised;
}
#resolve;
#ready = new Promise(resolve => this.#resolve = resolve);
get ready() {
return this.#ready;
}
#uri;
get uri() {
return this.#uri;
}
missing;

@@ -444,6 +368,5 @@ redirect;

#configured = new Promise(resolve => this.#resolveConfigured = resolve);
constructor() {
super(); // @TODO: move to some kind of initialization / setup
super();
// @TODO: move to some kind of initialization / setup
const {

@@ -464,3 +387,2 @@ specifier

}
#redirect = async uri => {

@@ -470,3 +392,2 @@ if (typeof this.redirect !== 'function') return;

if (!redirected) return;
if (typeof redirected !== 'string') {

@@ -476,9 +397,6 @@ console.error(`Invalid route value set by custom routing function`, redirected);

}
if (uri.pathname === redirected) return; // Routing function returned the actual route
this.pushState(redirected);
return true;
};
pushState(uri, state) {

@@ -490,3 +408,2 @@ this.#configured.then(() => {

}
replaceState(state, title, uri) {

@@ -497,5 +414,4 @@ this.#configured.then(() => {

});
} // Avoid to continue the execution on asynchronous calls, when a newest call's been made
}
// Avoid to continue the execution on asynchronous calls, when a newest call's been made
#cancellationToken = new _core.CancellationToken();

@@ -509,8 +425,6 @@ update = async () => {

} = location;
const _uri = this.#mode === RoutingMode.Hash ? `/${hash.slice(1)}` : pathname + search + hash;
if (this.#uri?.uri === _uri) return;
const uri = this.#uri = new _uri2.URI(_uri); // Check for uri redirect
const uri = this.#uri = new _uri2.URI(_uri);
// Check for uri redirect
const redirected = await this.#redirect(uri);

@@ -520,10 +434,8 @@ if (!this.#cancellationToken.check(cancellationTokenId)) return;

// Verify the state of the history registry to check for possible errors
this.#history && uri.uri !== this.#history.current && console.error(`History current "${this.#history.current}" is not equal to actual uri "${uri.uri}"`);
this.#initialised ? this.trigger('change') : this.#resolve();
this.#initialised = true;
}; // Wait for start.js be completed, as routing.redirect must be set before initialising routing
};
// Wait for start.js be completed, as routing.redirect must be set before initialising routing
#started = false;
setup() {

@@ -533,16 +445,11 @@ this.#started = true;

}
back() {
this.#history.back();
}
forward() {
this.#history.forward();
}
}
exports.Routing = Routing;
/*bundle*/
const routing = new Routing();

@@ -554,7 +461,8 @@ exports.routing = routing;

!serverside && (beyond.back = () => routing.back());
!serverside && (beyond.forward = () => routing.forward()); // Only on client side
!serverside && (beyond.forward = () => routing.forward());
// Only on client side
!serverside && window.addEventListener('popstate', () => routing.update().catch(exc => console.error(exc.stack)));
}
});
/*********************************

@@ -573,3 +481,2 @@ INTERNAL MODULE: ./uri/querystring

exports.QueryString = void 0;
class QueryString extends Map {

@@ -581,3 +488,2 @@ constructor(search) {

const split = search.split('&');
for (let i = 0; i < split.length; ++i) {

@@ -589,8 +495,7 @@ const param = split[i].split('=', 2);

}
}
exports.QueryString = QueryString;
}
});
/*************************

@@ -609,45 +514,31 @@ INTERNAL MODULE: ./uri/uri

exports.URI = void 0;
var _querystring = require("./querystring");
/*bundle*/
/*bundle*/ /**
* Uri parser
*
* @param href {string} The href to be parsed
* @constructor
*/
/**
* Uri parser
*
* @param href {string} The href to be parsed
* @constructor
*/
class URI {
#uri;
get uri() {
return this.#uri;
}
#pathname;
get pathname() {
return this.#pathname;
}
#search;
get search() {
return this.#search;
}
#qs;
get qs() {
return this.#qs;
}
#hash;
get hash() {
return this.#hash;
}
constructor(uri) {

@@ -662,5 +553,3 @@ this.#uri = uri;

}
}
exports.URI = URI;

@@ -678,7 +567,7 @@ }

}];
let routing, URI; // Module exports
let routing, URI;
// Module exports
exports.URI = URI;
exports.routing = routing;
__pkg.exports.process = function ({

@@ -692,4 +581,3 @@ require,

};
__pkg.initialise(ims);
//# sourceMappingURL=routing.cjs.js.map

@@ -5,3 +5,2 @@ System.register(["@beyond-js/kernel/bundle", "@beyond-js/kernel/core"], function (_export, _context) {

var dependency_0, dependency_1, __Bundle, __pkg, ims, routing, URI;
_export({

@@ -11,3 +10,2 @@ routing: void 0,

});
return {

@@ -25,3 +23,3 @@ setters: [function (_beyondJsKernelBundle) {

"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/routing"
"vspecifier": "@beyond-js/kernel@0.1.3/routing"
},

@@ -31,5 +29,3 @@ "type": "ts"

;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
ims = new Map();

@@ -39,3 +35,2 @@ /*********************************

*********************************/
ims.set('./history/history', {

@@ -50,5 +45,3 @@ hash: 1835933971,

exports.BeyondHistory = void 0;
var _position = require("./position");
var _records = require("./records");

@@ -59,27 +52,18 @@ /**

*/
class BeyondHistory {
#position;
get position() {
return this.#position;
}
#records;
get records() {
return this.#records;
}
get valid() {
return this.#records.valid;
}
get current() {
return this.valid ? this.#records.current.uri : void 0;
}
#initial = history.length;
get initial() {

@@ -95,17 +79,11 @@ return this.#initial;

*/
#processBrowserURI(uri) {
void this;
if (uri === void 0) return;
const {
routing
} = require('../routing');
const RoutingModeEnum = require('../routing').RoutingMode;
return routing.mode === RoutingModeEnum.Hash ? `#${uri.substr(1)}` : uri;
}
#push(uri) {

@@ -116,8 +94,7 @@ this.#records.reset();

}
replaceState(state, title, uri) {
state = state ? state : {};
if (typeof state !== 'object') throw new Error('Invalid state parameter');
this.#records.updateCurrentURI(uri); // The uri in the browser considering the routing mode
this.#records.updateCurrentURI(uri);
// The uri in the browser considering the routing mode
const position = this.#position.value;

@@ -127,3 +104,2 @@ history.replaceState(state, title, this.#processBrowserURI(uri));

}
pushState(uri, state) {

@@ -136,3 +112,2 @@ if (uri === `${location.pathname}${location.search}${location.hash}`) return;

}
back() {

@@ -144,3 +119,2 @@ const previous = this.#records.previous?.position;

}
forward() {

@@ -152,7 +126,5 @@ const following = this.#records.following?.position;

}
constructor(routing, Mode) {
this.#position = new _position.HistoryPosition();
this.#records = new _records.HistoryRecords(this.#position);
if (this.#position.value === void 0) {

@@ -164,8 +136,7 @@ // It is not a refresh of a previously navigated page

}
}
exports.BeyondHistory = BeyondHistory;
}
});
/**********************************

@@ -191,3 +162,2 @@ INTERNAL MODULE: ./history/position

*/
class HistoryPosition {

@@ -203,8 +173,5 @@ check() {

*/
get value() {
return history.state?.__beyond_navigation_position;
}
save(position) {

@@ -215,8 +182,7 @@ const state = history.state ? history.state : {};

}
}
exports.HistoryPosition = HistoryPosition;
}
});
/*********************************

@@ -235,25 +201,18 @@ INTERNAL MODULE: ./history/records

exports.HistoryRecords = void 0;
class HistoryRecords {
#position;
#valid = true;
get valid() {
return this.#valid;
}
#entries = [];
get entries() {
return this.#entries.slice();
}
get length() {
return this.#entries.length;
}
get current() {
return this.#entries[this.#position.value - 1];
}
get previous() {

@@ -264,3 +223,2 @@ const previous = this.#position.value - 2;

}
get following() {

@@ -271,7 +229,5 @@ const following = this.#position.value;

}
constructor(position) {
this.#position = position;
let parsed;
try {

@@ -283,3 +239,2 @@ const stored = sessionStorage.getItem('__beyond_navigation_records');

*/
if (!stored && position.value !== void 0) {

@@ -289,3 +244,2 @@ this.#valid = false;

}
parsed = stored ? JSON.parse(stored) : [];

@@ -297,3 +251,2 @@ } catch (exc) {

}
if (!(parsed instanceof Array)) {

@@ -303,3 +256,2 @@ const warning = 'The beyond navigation data, stored in session store is invalid.';

}
this.#entries = parsed;

@@ -313,4 +265,2 @@ }

*/
#sanitizeURI(uri) {

@@ -321,3 +271,2 @@ void this;

}
get(index) {

@@ -330,4 +279,2 @@ return this.#entries[index];

*/
push(uri) {

@@ -351,4 +298,2 @@ uri = this.#sanitizeURI(uri);

*/
reset() {

@@ -359,3 +304,2 @@ const position = this.#position.value;

}
updateCurrentURI(uri) {

@@ -371,3 +315,2 @@ if (!this.#valid) return;

}
save() {

@@ -377,8 +320,7 @@ if (!this.#valid) return;

}
}
exports.HistoryRecords = HistoryRecords;
}
});
/*************************

@@ -397,12 +339,7 @@ INTERNAL MODULE: ./routing

exports.routing = exports.RoutingMode = exports.Routing = void 0;
var _uri2 = require("./uri/uri");
var _core = require("@beyond-js/kernel/core");
var _history = require("./history/history");
var RoutingMode;
exports.RoutingMode = RoutingMode;
(function (RoutingMode) {

@@ -412,37 +349,25 @@ RoutingMode[RoutingMode["Hash"] = 0] = "Hash";

})(RoutingMode || (exports.RoutingMode = RoutingMode = {}));
const serverside = typeof process === 'object';
class Routing extends _core.Events {
#mode;
get mode() {
return this.#mode;
}
#history;
get history() {
return this.#history;
}
#initialised = false;
get initialised() {
return this.#initialised;
}
#resolve;
#ready = new Promise(resolve => this.#resolve = resolve);
get ready() {
return this.#ready;
}
#uri;
get uri() {
return this.#uri;
}
missing;

@@ -452,6 +377,5 @@ redirect;

#configured = new Promise(resolve => this.#resolveConfigured = resolve);
constructor() {
super(); // @TODO: move to some kind of initialization / setup
super();
// @TODO: move to some kind of initialization / setup
const {

@@ -472,3 +396,2 @@ specifier

}
#redirect = async uri => {

@@ -478,3 +401,2 @@ if (typeof this.redirect !== 'function') return;

if (!redirected) return;
if (typeof redirected !== 'string') {

@@ -484,9 +406,6 @@ console.error(`Invalid route value set by custom routing function`, redirected);

}
if (uri.pathname === redirected) return; // Routing function returned the actual route
this.pushState(redirected);
return true;
};
pushState(uri, state) {

@@ -498,3 +417,2 @@ this.#configured.then(() => {

}
replaceState(state, title, uri) {

@@ -505,5 +423,4 @@ this.#configured.then(() => {

});
} // Avoid to continue the execution on asynchronous calls, when a newest call's been made
}
// Avoid to continue the execution on asynchronous calls, when a newest call's been made
#cancellationToken = new _core.CancellationToken();

@@ -517,8 +434,6 @@ update = async () => {

} = location;
const _uri = this.#mode === RoutingMode.Hash ? `/${hash.slice(1)}` : pathname + search + hash;
if (this.#uri?.uri === _uri) return;
const uri = this.#uri = new _uri2.URI(_uri); // Check for uri redirect
const uri = this.#uri = new _uri2.URI(_uri);
// Check for uri redirect
const redirected = await this.#redirect(uri);

@@ -528,10 +443,8 @@ if (!this.#cancellationToken.check(cancellationTokenId)) return;

// Verify the state of the history registry to check for possible errors
this.#history && uri.uri !== this.#history.current && console.error(`History current "${this.#history.current}" is not equal to actual uri "${uri.uri}"`);
this.#initialised ? this.trigger('change') : this.#resolve();
this.#initialised = true;
}; // Wait for start.js be completed, as routing.redirect must be set before initialising routing
};
// Wait for start.js be completed, as routing.redirect must be set before initialising routing
#started = false;
setup() {

@@ -541,16 +454,11 @@ this.#started = true;

}
back() {
this.#history.back();
}
forward() {
this.#history.forward();
}
}
exports.Routing = Routing;
/*bundle*/
const routing = new Routing();

@@ -562,7 +470,8 @@ exports.routing = routing;

!serverside && (beyond.back = () => routing.back());
!serverside && (beyond.forward = () => routing.forward()); // Only on client side
!serverside && (beyond.forward = () => routing.forward());
// Only on client side
!serverside && window.addEventListener('popstate', () => routing.update().catch(exc => console.error(exc.stack)));
}
});
/*********************************

@@ -581,3 +490,2 @@ INTERNAL MODULE: ./uri/querystring

exports.QueryString = void 0;
class QueryString extends Map {

@@ -589,3 +497,2 @@ constructor(search) {

const split = search.split('&');
for (let i = 0; i < split.length; ++i) {

@@ -597,8 +504,7 @@ const param = split[i].split('=', 2);

}
}
exports.QueryString = QueryString;
}
});
/*************************

@@ -617,45 +523,31 @@ INTERNAL MODULE: ./uri/uri

exports.URI = void 0;
var _querystring = require("./querystring");
/*bundle*/
/*bundle*/ /**
* Uri parser
*
* @param href {string} The href to be parsed
* @constructor
*/
/**
* Uri parser
*
* @param href {string} The href to be parsed
* @constructor
*/
class URI {
#uri;
get uri() {
return this.#uri;
}
#pathname;
get pathname() {
return this.#pathname;
}
#search;
get search() {
return this.#search;
}
#qs;
get qs() {
return this.#qs;
}
#hash;
get hash() {
return this.#hash;
}
constructor(uri) {

@@ -670,5 +562,3 @@ this.#uri = uri;

}
}
exports.URI = URI;

@@ -686,3 +576,2 @@ }

}];
// Module exports

@@ -697,3 +586,2 @@ __pkg.exports.process = function ({

};
__pkg.initialise(ims);

@@ -700,0 +588,0 @@ }

@@ -11,15 +11,12 @@ define(["exports", "module", "@beyond-js/kernel/bundle", "@beyond-js/kernel/core"], function (_exports, _amd_module, dependency_0, dependency_1) {

} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/styles"
"vspecifier": "@beyond-js/kernel@0.1.3/styles"
},
"type": "ts"
}, _amd_module.uri).package();
;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
const ims = new Map();
const ims = new Map();
/*************************************

@@ -38,27 +35,17 @@ INTERNAL MODULE: ./dependencies-styles

exports.DependenciesStyles = void 0;
var _bundle = require("@beyond-js/kernel/bundle");
var _core = require("@beyond-js/kernel/core");
var _registry = require("./registry");
/*bundle*/
class DependenciesStyles extends _core.Events {
#vspecifier;
#elements;
get elements() {
return this.#elements;
}
constructor(vspecifier) {
super();
this.#vspecifier = vspecifier;
const change = () => this.trigger('change');
this.#elements = new Set();
const recursive = vspecifier => {

@@ -69,3 +56,2 @@ if (!vspecifier) {

}
if (!_bundle.instances.has(vspecifier)) {

@@ -75,9 +61,6 @@ console.error(`Bundle id "${vspecifier}" not found. Try refreshing the page.\n` + `If the problem still persist, delete the BeyondJS cache and try again.`);

}
const bundle = _bundle.instances.get(vspecifier);
if (vspecifier !== this.#vspecifier && bundle.type === 'widget') return; // Check if the bundle has styles
if (vspecifier !== this.#vspecifier && bundle.type === 'widget') return;
// Check if the bundle has styles
const styles = _registry.styles.get(vspecifier);
if (styles && styles.engine !== 'legacy') {

@@ -87,3 +70,2 @@ this.#elements.add(styles);

}
const {

@@ -98,11 +80,9 @@ dependencies

};
recursive(this.#vspecifier);
}
}
exports.DependenciesStyles = DependenciesStyles;
}
});
/************************

@@ -121,3 +101,2 @@ INTERNAL MODULE: ./legacy

exports.default = void 0;
class _default {

@@ -127,20 +106,14 @@ get engine() {

}
#bundle;
#value;
get value() {
return this.#value;
} // Is the stylesheet appended to the DOM of the page (not a shadow dom of a widget)
}
// Is the stylesheet appended to the DOM of the page (not a shadow dom of a widget)
#appended = false;
get appended() {
return this.#appended;
}
constructor(bundle, value) {
this.#bundle = bundle;
const module = (() => {

@@ -150,5 +123,4 @@ const module = bundle.split('/');

return module.join('/');
})(); // Find and replace #host...
})();
// Find and replace #host...
const regexp = /#host\.([\w\d]*)#([^.]*\.[\w\d]*)/g;

@@ -161,3 +133,2 @@ this.#value = value.replace(regexp, (match, host, resource) => {

}
console.warn(`Invalid css host specification on bundle "${bundle}"`, match);

@@ -169,4 +140,2 @@ });

*/
appendToDOM(is) {

@@ -177,3 +146,2 @@ if (this.#appended) {

}
const css = document.createElement('style');

@@ -185,8 +153,7 @@ css.appendChild(document.createTextNode(this.#value));

}
}
exports.default = _default;
}
});
/**************************

@@ -205,10 +172,6 @@ INTERNAL MODULE: ./registry

exports.styles = void 0;
var _legacy = require("./legacy");
var _v = require("./v1");
class Registry {
#registry = new Map();
register(vspecifier, value) {

@@ -220,17 +183,12 @@ if (this.#registry.has(vspecifier)) return;

}
has(vspecifier) {
return this.#registry.has(vspecifier);
}
get(vspecifier) {
return this.#registry.get(vspecifier);
}
}
/*bundle*/
const styles = new Registry(); // Just for legacy projects
const styles = new Registry();
// Just for legacy projects
exports.styles = styles;

@@ -240,2 +198,3 @@ globalThis.beyondLegacyStyles = styles;

});
/********************

@@ -254,9 +213,5 @@ INTERNAL MODULE: ./v1

exports.V1Styles = void 0;
var _core = require("@beyond-js/kernel/core");
var _bundle = require("@beyond-js/kernel/bundle");
/*bundle*/
class V1Styles extends _core.Events {

@@ -272,6 +227,3 @@ get engine() {

*/
#bundle;
get bundle() {

@@ -286,6 +238,3 @@ return this.#bundle;

*/
#version = 0;
get version() {

@@ -300,6 +249,3 @@ return this.#version;

*/
#resource;
get resource() {

@@ -313,4 +259,2 @@ return this.#resource;

*/
get href() {

@@ -320,7 +264,5 @@ const version = this.#version ? `?version=${this.#version}` : '';

}
constructor(resource) {
super();
this.#bundle = _bundle.instances.get(resource);
this.#resource = (() => {

@@ -333,3 +275,2 @@ if (typeof process === 'object') {

}
let {

@@ -339,3 +280,2 @@ uri

uri = uri.slice(0, uri.length - 3); // Remove the .js extension
return `${uri}.css`;

@@ -347,4 +287,2 @@ })();

*/
change() {

@@ -354,5 +292,3 @@ this.#version++;

}
}
exports.V1Styles = V1Styles;

@@ -374,8 +310,8 @@ }

}];
let DependenciesStyles, styles, V1Styles; // Module exports
let DependenciesStyles, styles, V1Styles;
// Module exports
_exports.V1Styles = V1Styles;
_exports.styles = styles;
_exports.DependenciesStyles = DependenciesStyles;
__pkg.exports.process = function ({

@@ -390,3 +326,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -396,9 +331,7 @@ _exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
_exports.hmr = hmr;
__pkg.initialise(ims);
});
//# sourceMappingURL=styles.amd.js.map

@@ -7,23 +7,17 @@ "use strict";

exports.styles = exports.hmr = exports.__beyond_pkg = exports.V1Styles = exports.DependenciesStyles = void 0;
var dependency_0 = require("@beyond-js/kernel/bundle");
var dependency_1 = require("@beyond-js/kernel/core");
const {
Bundle: __Bundle
} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/styles"
"vspecifier": "@beyond-js/kernel@0.1.3/styles"
},
"type": "ts"
}).package();
;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
const ims = new Map();
const ims = new Map();
/*************************************

@@ -42,27 +36,17 @@ INTERNAL MODULE: ./dependencies-styles

exports.DependenciesStyles = void 0;
var _bundle = require("@beyond-js/kernel/bundle");
var _core = require("@beyond-js/kernel/core");
var _registry = require("./registry");
/*bundle*/
class DependenciesStyles extends _core.Events {
#vspecifier;
#elements;
get elements() {
return this.#elements;
}
constructor(vspecifier) {
super();
this.#vspecifier = vspecifier;
const change = () => this.trigger('change');
this.#elements = new Set();
const recursive = vspecifier => {

@@ -73,3 +57,2 @@ if (!vspecifier) {

}
if (!_bundle.instances.has(vspecifier)) {

@@ -79,9 +62,6 @@ console.error(`Bundle id "${vspecifier}" not found. Try refreshing the page.\n` + `If the problem still persist, delete the BeyondJS cache and try again.`);

}
const bundle = _bundle.instances.get(vspecifier);
if (vspecifier !== this.#vspecifier && bundle.type === 'widget') return; // Check if the bundle has styles
if (vspecifier !== this.#vspecifier && bundle.type === 'widget') return;
// Check if the bundle has styles
const styles = _registry.styles.get(vspecifier);
if (styles && styles.engine !== 'legacy') {

@@ -91,3 +71,2 @@ this.#elements.add(styles);

}
const {

@@ -102,11 +81,9 @@ dependencies

};
recursive(this.#vspecifier);
}
}
exports.DependenciesStyles = DependenciesStyles;
}
});
/************************

@@ -125,3 +102,2 @@ INTERNAL MODULE: ./legacy

exports.default = void 0;
class _default {

@@ -131,20 +107,14 @@ get engine() {

}
#bundle;
#value;
get value() {
return this.#value;
} // Is the stylesheet appended to the DOM of the page (not a shadow dom of a widget)
}
// Is the stylesheet appended to the DOM of the page (not a shadow dom of a widget)
#appended = false;
get appended() {
return this.#appended;
}
constructor(bundle, value) {
this.#bundle = bundle;
const module = (() => {

@@ -154,5 +124,4 @@ const module = bundle.split('/');

return module.join('/');
})(); // Find and replace #host...
})();
// Find and replace #host...
const regexp = /#host\.([\w\d]*)#([^.]*\.[\w\d]*)/g;

@@ -165,3 +134,2 @@ this.#value = value.replace(regexp, (match, host, resource) => {

}
console.warn(`Invalid css host specification on bundle "${bundle}"`, match);

@@ -173,4 +141,2 @@ });

*/
appendToDOM(is) {

@@ -181,3 +147,2 @@ if (this.#appended) {

}
const css = document.createElement('style');

@@ -189,8 +154,7 @@ css.appendChild(document.createTextNode(this.#value));

}
}
exports.default = _default;
}
});
/**************************

@@ -209,10 +173,6 @@ INTERNAL MODULE: ./registry

exports.styles = void 0;
var _legacy = require("./legacy");
var _v = require("./v1");
class Registry {
#registry = new Map();
register(vspecifier, value) {

@@ -224,17 +184,12 @@ if (this.#registry.has(vspecifier)) return;

}
has(vspecifier) {
return this.#registry.has(vspecifier);
}
get(vspecifier) {
return this.#registry.get(vspecifier);
}
}
/*bundle*/
const styles = new Registry(); // Just for legacy projects
const styles = new Registry();
// Just for legacy projects
exports.styles = styles;

@@ -244,2 +199,3 @@ globalThis.beyondLegacyStyles = styles;

});
/********************

@@ -258,9 +214,5 @@ INTERNAL MODULE: ./v1

exports.V1Styles = void 0;
var _core = require("@beyond-js/kernel/core");
var _bundle = require("@beyond-js/kernel/bundle");
/*bundle*/
class V1Styles extends _core.Events {

@@ -276,6 +228,3 @@ get engine() {

*/
#bundle;
get bundle() {

@@ -290,6 +239,3 @@ return this.#bundle;

*/
#version = 0;
get version() {

@@ -304,6 +250,3 @@ return this.#version;

*/
#resource;
get resource() {

@@ -317,4 +260,2 @@ return this.#resource;

*/
get href() {

@@ -324,7 +265,5 @@ const version = this.#version ? `?version=${this.#version}` : '';

}
constructor(resource) {
super();
this.#bundle = _bundle.instances.get(resource);
this.#resource = (() => {

@@ -337,3 +276,2 @@ if (typeof process === 'object') {

}
let {

@@ -343,3 +281,2 @@ uri

uri = uri.slice(0, uri.length - 3); // Remove the .js extension
return `${uri}.css`;

@@ -351,4 +288,2 @@ })();

*/
change() {

@@ -358,5 +293,3 @@ this.#version++;

}
}
exports.V1Styles = V1Styles;

@@ -378,8 +311,8 @@ }

}];
let DependenciesStyles, styles, V1Styles; // Module exports
let DependenciesStyles, styles, V1Styles;
// Module exports
exports.V1Styles = V1Styles;
exports.styles = styles;
exports.DependenciesStyles = DependenciesStyles;
__pkg.exports.process = function ({

@@ -394,3 +327,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -400,8 +332,6 @@ exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
exports.hmr = hmr;
__pkg.initialise(ims);
//# sourceMappingURL=styles.cjs.js.map

@@ -5,3 +5,2 @@ System.register(["@beyond-js/kernel/bundle", "@beyond-js/kernel/core"], function (_export, _context) {

var dependency_0, dependency_1, __Bundle, __pkg, ims, DependenciesStyles, styles, V1Styles, __beyond_pkg, hmr;
_export({

@@ -12,3 +11,2 @@ DependenciesStyles: void 0,

});
return {

@@ -26,3 +24,3 @@ setters: [function (_beyondJsKernelBundle) {

"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/styles"
"vspecifier": "@beyond-js/kernel@0.1.3/styles"
},

@@ -32,5 +30,3 @@ "type": "ts"

;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
ims = new Map();

@@ -40,3 +36,2 @@ /*************************************

*************************************/
ims.set('./dependencies-styles', {

@@ -51,27 +46,17 @@ hash: 282408023,

exports.DependenciesStyles = void 0;
var _bundle = require("@beyond-js/kernel/bundle");
var _core = require("@beyond-js/kernel/core");
var _registry = require("./registry");
/*bundle*/
class DependenciesStyles extends _core.Events {
#vspecifier;
#elements;
get elements() {
return this.#elements;
}
constructor(vspecifier) {
super();
this.#vspecifier = vspecifier;
const change = () => this.trigger('change');
this.#elements = new Set();
const recursive = vspecifier => {

@@ -82,3 +67,2 @@ if (!vspecifier) {

}
if (!_bundle.instances.has(vspecifier)) {

@@ -88,9 +72,6 @@ console.error(`Bundle id "${vspecifier}" not found. Try refreshing the page.\n` + `If the problem still persist, delete the BeyondJS cache and try again.`);

}
const bundle = _bundle.instances.get(vspecifier);
if (vspecifier !== this.#vspecifier && bundle.type === 'widget') return; // Check if the bundle has styles
if (vspecifier !== this.#vspecifier && bundle.type === 'widget') return;
// Check if the bundle has styles
const styles = _registry.styles.get(vspecifier);
if (styles && styles.engine !== 'legacy') {

@@ -100,3 +81,2 @@ this.#elements.add(styles);

}
const {

@@ -111,11 +91,9 @@ dependencies

};
recursive(this.#vspecifier);
}
}
exports.DependenciesStyles = DependenciesStyles;
}
});
/************************

@@ -134,3 +112,2 @@ INTERNAL MODULE: ./legacy

exports.default = void 0;
class _default {

@@ -140,20 +117,14 @@ get engine() {

}
#bundle;
#value;
get value() {
return this.#value;
} // Is the stylesheet appended to the DOM of the page (not a shadow dom of a widget)
}
// Is the stylesheet appended to the DOM of the page (not a shadow dom of a widget)
#appended = false;
get appended() {
return this.#appended;
}
constructor(bundle, value) {
this.#bundle = bundle;
const module = (() => {

@@ -163,5 +134,4 @@ const module = bundle.split('/');

return module.join('/');
})(); // Find and replace #host...
})();
// Find and replace #host...
const regexp = /#host\.([\w\d]*)#([^.]*\.[\w\d]*)/g;

@@ -174,3 +144,2 @@ this.#value = value.replace(regexp, (match, host, resource) => {

}
console.warn(`Invalid css host specification on bundle "${bundle}"`, match);

@@ -182,4 +151,2 @@ });

*/
appendToDOM(is) {

@@ -190,3 +157,2 @@ if (this.#appended) {

}
const css = document.createElement('style');

@@ -198,8 +164,7 @@ css.appendChild(document.createTextNode(this.#value));

}
}
exports.default = _default;
}
});
/**************************

@@ -218,10 +183,6 @@ INTERNAL MODULE: ./registry

exports.styles = void 0;
var _legacy = require("./legacy");
var _v = require("./v1");
class Registry {
#registry = new Map();
register(vspecifier, value) {

@@ -233,17 +194,12 @@ if (this.#registry.has(vspecifier)) return;

}
has(vspecifier) {
return this.#registry.has(vspecifier);
}
get(vspecifier) {
return this.#registry.get(vspecifier);
}
}
/*bundle*/
const styles = new Registry(); // Just for legacy projects
const styles = new Registry();
// Just for legacy projects
exports.styles = styles;

@@ -253,2 +209,3 @@ globalThis.beyondLegacyStyles = styles;

});
/********************

@@ -267,9 +224,5 @@ INTERNAL MODULE: ./v1

exports.V1Styles = void 0;
var _core = require("@beyond-js/kernel/core");
var _bundle = require("@beyond-js/kernel/bundle");
/*bundle*/
class V1Styles extends _core.Events {

@@ -285,6 +238,3 @@ get engine() {

*/
#bundle;
get bundle() {

@@ -299,6 +249,3 @@ return this.#bundle;

*/
#version = 0;
get version() {

@@ -313,6 +260,3 @@ return this.#version;

*/
#resource;
get resource() {

@@ -326,4 +270,2 @@ return this.#resource;

*/
get href() {

@@ -333,7 +275,5 @@ const version = this.#version ? `?version=${this.#version}` : '';

}
constructor(resource) {
super();
this.#bundle = _bundle.instances.get(resource);
this.#resource = (() => {

@@ -346,3 +286,2 @@ if (typeof process === 'object') {

}
let {

@@ -352,3 +291,2 @@ uri

uri = uri.slice(0, uri.length - 3); // Remove the .js extension
return `${uri}.css`;

@@ -360,4 +298,2 @@ })();

*/
change() {

@@ -367,5 +303,3 @@ this.#version++;

}
}
exports.V1Styles = V1Styles;

@@ -387,3 +321,2 @@ }

}];
// Module exports

@@ -399,11 +332,7 @@ __pkg.exports.process = function ({

};
_export("__beyond_pkg", __beyond_pkg = __pkg);
_export("hmr", hmr = new function () {
this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}());
__pkg.initialise(ims);

@@ -410,0 +339,0 @@ }

@@ -11,15 +11,12 @@ define(["exports", "module", "@beyond-js/kernel/bundle", "@beyond-js/kernel/core"], function (_exports, _amd_module, dependency_0, dependency_1) {

} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/texts"
"vspecifier": "@beyond-js/kernel@0.1.3/texts"
},
"type": "ts"
}, _amd_module.uri).package();
;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
const ims = new Map();
const ims = new Map();
/*************************

@@ -38,27 +35,17 @@ INTERNAL MODULE: ./current

exports.CurrentTexts = void 0;
var _core = require("@beyond-js/kernel/core");
var _texts = require("./texts");
/*bundle*/
/**
* The texts loaded by the current language (not available in SSR environment)
*/
/*bundle*/ /**
* The texts loaded by the current language (not available in SSR environment)
*/
class CurrentTexts extends _core.Events {
#texts = new Map();
#bundle;
get bundle() {
return this.#bundle;
}
#enabled = false;
get enabled() {
return this.#enabled;
}
set enabled(value) {

@@ -68,5 +55,3 @@ this.#enabled = !!value;

}
#last;
get #current() {

@@ -83,7 +68,5 @@ const {

}
get loading() {
return this.#current.loading;
}
get loaded() {

@@ -96,4 +79,2 @@ return this.#current.loaded;

*/
get ready() {

@@ -103,3 +84,2 @@ !this.loaded && !this.loading && this.fetch().catch(exc => console.error(exc.stack));

}
get value() {

@@ -113,4 +93,2 @@ return this.#current.value;

*/
constructor(bundle) {

@@ -120,9 +98,6 @@ super();

if (!bundle) throw new Error(`Bundle parameter must be specified`);
_core.languages.on('change', this.#change);
this.#current.on('change', this.#triggerChange);
this.#last = this.#current;
}
#triggerChange = () => {

@@ -138,3 +113,2 @@ this.trigger('change');

};
async fetch() {

@@ -148,23 +122,17 @@ await _core.languages.ready;

*/
async load() {
await this.#current.fetch();
}
destroy() {
this.#texts.forEach(texts => texts.destroy());
_core.languages.off('change', this.#change);
}
toJSON() {
return {};
}
}
exports.CurrentTexts = CurrentTexts;
}
});
/***********************

@@ -183,7 +151,4 @@ INTERNAL MODULE: ./texts

exports.Texts = void 0;
var _core = require("@beyond-js/kernel/core");
/*bundle*/
class Texts extends _core.Events {

@@ -196,3 +161,2 @@ /**

#module;
get module() {

@@ -206,6 +170,3 @@ return this.#module;

*/
#bundle;
get bundle() {

@@ -219,40 +180,27 @@ return this.#bundle;

*/
#transversal;
get transversal() {
return this.#transversal;
}
#multilanguage;
get multilanguage() {
return this.#multilanguage;
}
#language;
get language() {
return this.#language;
} // The loaded bundle
}
// The loaded bundle
#texts;
#loaded = false;
get loaded() {
return this.#loaded;
}
#loading;
get loading() {
return this.#loading;
}
get value() {
return this.#texts?.txt;
}
get ready() {

@@ -269,4 +217,2 @@ if (this.#loading) return false;

*/
constructor(module, specs) {

@@ -281,7 +227,5 @@ if (!module) throw new Error('Invalid parameters');

this.#transversal = specs.transversal;
} // Used by HMR when packaged has been updated
}
// Used by HMR when packaged has been updated
#update = () => this.trigger('change');
async fetch() {

@@ -292,3 +236,2 @@ if (this.#loading || this.#loaded) return;

const language = this.#language ? `.${this.#language}` : '';
const {

@@ -300,3 +243,2 @@ specifier,

const specifier = `${this.#module}.${this.#transversal}${language}`;
const pkg = (() => {

@@ -306,3 +248,2 @@ const split = this.#module.split('/');

})();
const resource = `${pkg}/${this.#transversal}${language}`;

@@ -321,5 +262,3 @@ return {

})();
const imported = await bimport(resource);
this.#texts = (() => {

@@ -332,3 +271,2 @@ if (!this.#transversal) return imported;

})();
this.#texts.hmr.on('change', this.#update);

@@ -343,18 +281,12 @@ this.#loading = false;

*/
async load() {
await this.fetch();
}
destroy() {
this.#texts?.hmr.off('change', this.#update);
}
toJSON() {
return {};
}
}
exports.Texts = Texts;

@@ -372,7 +304,7 @@ }

}];
let CurrentTexts, Texts; // Module exports
let CurrentTexts, Texts;
// Module exports
_exports.Texts = Texts;
_exports.CurrentTexts = CurrentTexts;
__pkg.exports.process = function ({

@@ -386,3 +318,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -392,9 +323,7 @@ _exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
_exports.hmr = hmr;
__pkg.initialise(ims);
});
//# sourceMappingURL=texts.amd.js.map

@@ -7,23 +7,17 @@ "use strict";

exports.hmr = exports.__beyond_pkg = exports.Texts = exports.CurrentTexts = void 0;
var dependency_0 = require("@beyond-js/kernel/bundle");
var dependency_1 = require("@beyond-js/kernel/core");
const {
Bundle: __Bundle
} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/texts"
"vspecifier": "@beyond-js/kernel@0.1.3/texts"
},
"type": "ts"
}).package();
;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
const ims = new Map();
const ims = new Map();
/*************************

@@ -42,27 +36,17 @@ INTERNAL MODULE: ./current

exports.CurrentTexts = void 0;
var _core = require("@beyond-js/kernel/core");
var _texts = require("./texts");
/*bundle*/
/**
* The texts loaded by the current language (not available in SSR environment)
*/
/*bundle*/ /**
* The texts loaded by the current language (not available in SSR environment)
*/
class CurrentTexts extends _core.Events {
#texts = new Map();
#bundle;
get bundle() {
return this.#bundle;
}
#enabled = false;
get enabled() {
return this.#enabled;
}
set enabled(value) {

@@ -72,5 +56,3 @@ this.#enabled = !!value;

}
#last;
get #current() {

@@ -87,7 +69,5 @@ const {

}
get loading() {
return this.#current.loading;
}
get loaded() {

@@ -100,4 +80,2 @@ return this.#current.loaded;

*/
get ready() {

@@ -107,3 +85,2 @@ !this.loaded && !this.loading && this.fetch().catch(exc => console.error(exc.stack));

}
get value() {

@@ -117,4 +94,2 @@ return this.#current.value;

*/
constructor(bundle) {

@@ -124,9 +99,6 @@ super();

if (!bundle) throw new Error(`Bundle parameter must be specified`);
_core.languages.on('change', this.#change);
this.#current.on('change', this.#triggerChange);
this.#last = this.#current;
}
#triggerChange = () => {

@@ -142,3 +114,2 @@ this.trigger('change');

};
async fetch() {

@@ -152,23 +123,17 @@ await _core.languages.ready;

*/
async load() {
await this.#current.fetch();
}
destroy() {
this.#texts.forEach(texts => texts.destroy());
_core.languages.off('change', this.#change);
}
toJSON() {
return {};
}
}
exports.CurrentTexts = CurrentTexts;
}
});
/***********************

@@ -187,7 +152,4 @@ INTERNAL MODULE: ./texts

exports.Texts = void 0;
var _core = require("@beyond-js/kernel/core");
/*bundle*/
class Texts extends _core.Events {

@@ -200,3 +162,2 @@ /**

#module;
get module() {

@@ -210,6 +171,3 @@ return this.#module;

*/
#bundle;
get bundle() {

@@ -223,40 +181,27 @@ return this.#bundle;

*/
#transversal;
get transversal() {
return this.#transversal;
}
#multilanguage;
get multilanguage() {
return this.#multilanguage;
}
#language;
get language() {
return this.#language;
} // The loaded bundle
}
// The loaded bundle
#texts;
#loaded = false;
get loaded() {
return this.#loaded;
}
#loading;
get loading() {
return this.#loading;
}
get value() {
return this.#texts?.txt;
}
get ready() {

@@ -273,4 +218,2 @@ if (this.#loading) return false;

*/
constructor(module, specs) {

@@ -285,7 +228,5 @@ if (!module) throw new Error('Invalid parameters');

this.#transversal = specs.transversal;
} // Used by HMR when packaged has been updated
}
// Used by HMR when packaged has been updated
#update = () => this.trigger('change');
async fetch() {

@@ -296,3 +237,2 @@ if (this.#loading || this.#loaded) return;

const language = this.#language ? `.${this.#language}` : '';
const {

@@ -304,3 +244,2 @@ specifier,

const specifier = `${this.#module}.${this.#transversal}${language}`;
const pkg = (() => {

@@ -310,3 +249,2 @@ const split = this.#module.split('/');

})();
const resource = `${pkg}/${this.#transversal}${language}`;

@@ -325,5 +263,3 @@ return {

})();
const imported = await bimport(resource);
this.#texts = (() => {

@@ -336,3 +272,2 @@ if (!this.#transversal) return imported;

})();
this.#texts.hmr.on('change', this.#update);

@@ -347,18 +282,12 @@ this.#loading = false;

*/
async load() {
await this.fetch();
}
destroy() {
this.#texts?.hmr.off('change', this.#update);
}
toJSON() {
return {};
}
}
exports.Texts = Texts;

@@ -376,7 +305,7 @@ }

}];
let CurrentTexts, Texts; // Module exports
let CurrentTexts, Texts;
// Module exports
exports.Texts = Texts;
exports.CurrentTexts = CurrentTexts;
__pkg.exports.process = function ({

@@ -390,3 +319,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -396,8 +324,6 @@ exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
exports.hmr = hmr;
__pkg.initialise(ims);
//# sourceMappingURL=texts.cjs.js.map

@@ -5,3 +5,2 @@ System.register(["@beyond-js/kernel/bundle", "@beyond-js/kernel/core"], function (_export, _context) {

var dependency_0, dependency_1, __Bundle, __pkg, ims, CurrentTexts, Texts, __beyond_pkg, hmr;
_export({

@@ -11,3 +10,2 @@ CurrentTexts: void 0,

});
return {

@@ -25,3 +23,3 @@ setters: [function (_beyondJsKernelBundle) {

"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/texts"
"vspecifier": "@beyond-js/kernel@0.1.3/texts"
},

@@ -31,5 +29,3 @@ "type": "ts"

;
__pkg.dependencies.update([['@beyond-js/kernel/core', dependency_1]]);
ims = new Map();

@@ -39,3 +35,2 @@ /*************************

*************************/
ims.set('./current', {

@@ -50,27 +45,17 @@ hash: 1735458173,

exports.CurrentTexts = void 0;
var _core = require("@beyond-js/kernel/core");
var _texts = require("./texts");
/*bundle*/
/**
* The texts loaded by the current language (not available in SSR environment)
*/
/*bundle*/ /**
* The texts loaded by the current language (not available in SSR environment)
*/
class CurrentTexts extends _core.Events {
#texts = new Map();
#bundle;
get bundle() {
return this.#bundle;
}
#enabled = false;
get enabled() {
return this.#enabled;
}
set enabled(value) {

@@ -80,5 +65,3 @@ this.#enabled = !!value;

}
#last;
get #current() {

@@ -95,7 +78,5 @@ const {

}
get loading() {
return this.#current.loading;
}
get loaded() {

@@ -108,4 +89,2 @@ return this.#current.loaded;

*/
get ready() {

@@ -115,3 +94,2 @@ !this.loaded && !this.loading && this.fetch().catch(exc => console.error(exc.stack));

}
get value() {

@@ -125,4 +103,2 @@ return this.#current.value;

*/
constructor(bundle) {

@@ -132,9 +108,6 @@ super();

if (!bundle) throw new Error(`Bundle parameter must be specified`);
_core.languages.on('change', this.#change);
this.#current.on('change', this.#triggerChange);
this.#last = this.#current;
}
#triggerChange = () => {

@@ -150,3 +123,2 @@ this.trigger('change');

};
async fetch() {

@@ -160,23 +132,17 @@ await _core.languages.ready;

*/
async load() {
await this.#current.fetch();
}
destroy() {
this.#texts.forEach(texts => texts.destroy());
_core.languages.off('change', this.#change);
}
toJSON() {
return {};
}
}
exports.CurrentTexts = CurrentTexts;
}
});
/***********************

@@ -195,7 +161,4 @@ INTERNAL MODULE: ./texts

exports.Texts = void 0;
var _core = require("@beyond-js/kernel/core");
/*bundle*/
class Texts extends _core.Events {

@@ -208,3 +171,2 @@ /**

#module;
get module() {

@@ -218,6 +180,3 @@ return this.#module;

*/
#bundle;
get bundle() {

@@ -231,40 +190,27 @@ return this.#bundle;

*/
#transversal;
get transversal() {
return this.#transversal;
}
#multilanguage;
get multilanguage() {
return this.#multilanguage;
}
#language;
get language() {
return this.#language;
} // The loaded bundle
}
// The loaded bundle
#texts;
#loaded = false;
get loaded() {
return this.#loaded;
}
#loading;
get loading() {
return this.#loading;
}
get value() {
return this.#texts?.txt;
}
get ready() {

@@ -281,4 +227,2 @@ if (this.#loading) return false;

*/
constructor(module, specs) {

@@ -293,7 +237,5 @@ if (!module) throw new Error('Invalid parameters');

this.#transversal = specs.transversal;
} // Used by HMR when packaged has been updated
}
// Used by HMR when packaged has been updated
#update = () => this.trigger('change');
async fetch() {

@@ -304,3 +246,2 @@ if (this.#loading || this.#loaded) return;

const language = this.#language ? `.${this.#language}` : '';
const {

@@ -312,3 +253,2 @@ specifier,

const specifier = `${this.#module}.${this.#transversal}${language}`;
const pkg = (() => {

@@ -318,3 +258,2 @@ const split = this.#module.split('/');

})();
const resource = `${pkg}/${this.#transversal}${language}`;

@@ -333,5 +272,3 @@ return {

})();
const imported = await bimport(resource);
this.#texts = (() => {

@@ -344,3 +281,2 @@ if (!this.#transversal) return imported;

})();
this.#texts.hmr.on('change', this.#update);

@@ -355,18 +291,12 @@ this.#loading = false;

*/
async load() {
await this.fetch();
}
destroy() {
this.#texts?.hmr.off('change', this.#update);
}
toJSON() {
return {};
}
}
exports.Texts = Texts;

@@ -384,3 +314,2 @@ }

}];
// Module exports

@@ -395,11 +324,7 @@ __pkg.exports.process = function ({

};
_export("__beyond_pkg", __beyond_pkg = __pkg);
_export("hmr", hmr = new function () {
this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}());
__pkg.initialise(ims);

@@ -406,0 +331,0 @@ }

@@ -11,15 +11,12 @@ define(["exports", "module", "@beyond-js/kernel/bundle"], function (_exports, _amd_module, dependency_0) {

} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/transversals"
"vspecifier": "@beyond-js/kernel@0.1.3/transversals"
},
"type": "ts"
}, _amd_module.uri).package();
;
__pkg.dependencies.update([]);
const ims = new Map();
const ims = new Map();
/******************************

@@ -38,3 +35,2 @@ INTERNAL MODULE: ./dependencies

exports.default = void 0;
class _default extends Map {

@@ -45,8 +41,7 @@ update(deps) {

}
}
exports.default = _default;
}
});
/*****************************

@@ -65,34 +60,22 @@ INTERNAL MODULE: ./transversal

exports.Transversal = void 0;
var _bundle = require("@beyond-js/kernel/bundle");
var _dependencies = require("./dependencies");
/*bundle*/
class Transversal {
#name;
get name() {
return this.#name;
}
#language;
get language() {
return this.#language;
}
#bundles = new Map();
get bundles() {
return this.#bundles;
}
#dependencies = new _dependencies.default();
get dependencies() {
return this.#dependencies;
}
constructor(name, language) {

@@ -102,5 +85,3 @@ this.#name = name;

}
#initialised = false;
initialise(bundles) {

@@ -114,10 +95,7 @@ if (this.#initialised) throw new Error(`Transversal "${this.#name}" already initialised`);

*/
bundles.forEach(([specs, creator]) => {
const pkg = new _bundle.Bundle(specs).package(this.#language);
const ims = new Map(); // The internal modules map
const exports = {}; // The exports.managed function
// Execute the bundle creation function
const response = creator(ims, exports);

@@ -128,7 +106,7 @@ const {

dependencies: void 0
}; // Set the descriptor of the exports
pkg.exports.descriptor = exports.descriptor; // Store the package and its dependencies to register the dependencies once all the bundles
};
// Set the descriptor of the exports
pkg.exports.descriptor = exports.descriptor;
// Store the package and its dependencies to register the dependencies once all the bundles
// of the transversal are created
packages.set(pkg.specifier, {

@@ -144,3 +122,2 @@ pkg,

*/
packages.forEach(({

@@ -157,5 +134,4 @@ pkg,

return;
} // Check if dependency is a bundle of the transversal
}
// Check if dependency is a bundle of the transversal
if (!packages.has(specifier)) {

@@ -165,3 +141,2 @@ const data = `\n\tDependencies: ${JSON.stringify([...this.#dependencies.keys()])}. ` + `\n\tBundles: ${JSON.stringify([...packages.keys()])}`;

}
const {

@@ -174,9 +149,8 @@ pkg

})();
packages.forEach(({
pkg
}) => this.#bundles.set(pkg.specifier, pkg.exports.values));
register && pkg.dependencies.update(register); // Register the ims, but do not initialise them until all bundles of the transversal are set
register && pkg.dependencies.update(register);
// Register the ims, but do not initialise them until all bundles of the transversal are set
// To allow dependencies among bundles
pkg.ims.register(ims);

@@ -188,5 +162,3 @@ });

}
}
exports.Transversal = Transversal;

@@ -200,6 +172,6 @@ }

}];
let Transversal; // Module exports
let Transversal;
// Module exports
_exports.Transversal = Transversal;
__pkg.exports.process = function ({

@@ -212,3 +184,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -218,9 +189,7 @@ _exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
_exports.hmr = hmr;
__pkg.initialise(ims);
});
//# sourceMappingURL=transversals.amd.js.map

@@ -7,21 +7,16 @@ "use strict";

exports.hmr = exports.__beyond_pkg = exports.Transversal = void 0;
var dependency_0 = require("@beyond-js/kernel/bundle");
const {
Bundle: __Bundle
} = dependency_0;
const __pkg = new __Bundle({
"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/transversals"
"vspecifier": "@beyond-js/kernel@0.1.3/transversals"
},
"type": "ts"
}).package();
;
__pkg.dependencies.update([]);
const ims = new Map();
const ims = new Map();
/******************************

@@ -40,3 +35,2 @@ INTERNAL MODULE: ./dependencies

exports.default = void 0;
class _default extends Map {

@@ -47,8 +41,7 @@ update(deps) {

}
}
exports.default = _default;
}
});
/*****************************

@@ -67,34 +60,22 @@ INTERNAL MODULE: ./transversal

exports.Transversal = void 0;
var _bundle = require("@beyond-js/kernel/bundle");
var _dependencies = require("./dependencies");
/*bundle*/
class Transversal {
#name;
get name() {
return this.#name;
}
#language;
get language() {
return this.#language;
}
#bundles = new Map();
get bundles() {
return this.#bundles;
}
#dependencies = new _dependencies.default();
get dependencies() {
return this.#dependencies;
}
constructor(name, language) {

@@ -104,5 +85,3 @@ this.#name = name;

}
#initialised = false;
initialise(bundles) {

@@ -116,10 +95,7 @@ if (this.#initialised) throw new Error(`Transversal "${this.#name}" already initialised`);

*/
bundles.forEach(([specs, creator]) => {
const pkg = new _bundle.Bundle(specs).package(this.#language);
const ims = new Map(); // The internal modules map
const exports = {}; // The exports.managed function
// Execute the bundle creation function
const response = creator(ims, exports);

@@ -130,7 +106,7 @@ const {

dependencies: void 0
}; // Set the descriptor of the exports
pkg.exports.descriptor = exports.descriptor; // Store the package and its dependencies to register the dependencies once all the bundles
};
// Set the descriptor of the exports
pkg.exports.descriptor = exports.descriptor;
// Store the package and its dependencies to register the dependencies once all the bundles
// of the transversal are created
packages.set(pkg.specifier, {

@@ -146,3 +122,2 @@ pkg,

*/
packages.forEach(({

@@ -159,5 +134,4 @@ pkg,

return;
} // Check if dependency is a bundle of the transversal
}
// Check if dependency is a bundle of the transversal
if (!packages.has(specifier)) {

@@ -167,3 +141,2 @@ const data = `\n\tDependencies: ${JSON.stringify([...this.#dependencies.keys()])}. ` + `\n\tBundles: ${JSON.stringify([...packages.keys()])}`;

}
const {

@@ -176,9 +149,8 @@ pkg

})();
packages.forEach(({
pkg
}) => this.#bundles.set(pkg.specifier, pkg.exports.values));
register && pkg.dependencies.update(register); // Register the ims, but do not initialise them until all bundles of the transversal are set
register && pkg.dependencies.update(register);
// Register the ims, but do not initialise them until all bundles of the transversal are set
// To allow dependencies among bundles
pkg.ims.register(ims);

@@ -190,5 +162,3 @@ });

}
}
exports.Transversal = Transversal;

@@ -202,6 +172,6 @@ }

}];
let Transversal; // Module exports
let Transversal;
// Module exports
exports.Transversal = Transversal;
__pkg.exports.process = function ({

@@ -214,3 +184,2 @@ require,

};
const __beyond_pkg = __pkg;

@@ -220,8 +189,6 @@ exports.__beyond_pkg = __beyond_pkg;

this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}();
exports.hmr = hmr;
__pkg.initialise(ims);
//# sourceMappingURL=transversals.cjs.js.map

@@ -5,5 +5,3 @@ System.register(["@beyond-js/kernel/bundle"], function (_export, _context) {

var dependency_0, __Bundle, __pkg, ims, Transversal, __beyond_pkg, hmr;
_export("Transversal", void 0);
return {

@@ -19,3 +17,3 @@ setters: [function (_beyondJsKernelBundle) {

"module": {
"vspecifier": "@beyond-js/kernel@0.1.2/transversals"
"vspecifier": "@beyond-js/kernel@0.1.3/transversals"
},

@@ -25,5 +23,3 @@ "type": "ts"

;
__pkg.dependencies.update([]);
ims = new Map();

@@ -33,3 +29,2 @@ /******************************

******************************/
ims.set('./dependencies', {

@@ -44,3 +39,2 @@ hash: 916907578,

exports.default = void 0;
class _default extends Map {

@@ -51,8 +45,7 @@ update(deps) {

}
}
exports.default = _default;
}
});
/*****************************

@@ -71,34 +64,22 @@ INTERNAL MODULE: ./transversal

exports.Transversal = void 0;
var _bundle = require("@beyond-js/kernel/bundle");
var _dependencies = require("./dependencies");
/*bundle*/
class Transversal {
#name;
get name() {
return this.#name;
}
#language;
get language() {
return this.#language;
}
#bundles = new Map();
get bundles() {
return this.#bundles;
}
#dependencies = new _dependencies.default();
get dependencies() {
return this.#dependencies;
}
constructor(name, language) {

@@ -108,5 +89,3 @@ this.#name = name;

}
#initialised = false;
initialise(bundles) {

@@ -120,10 +99,7 @@ if (this.#initialised) throw new Error(`Transversal "${this.#name}" already initialised`);

*/
bundles.forEach(([specs, creator]) => {
const pkg = new _bundle.Bundle(specs).package(this.#language);
const ims = new Map(); // The internal modules map
const exports = {}; // The exports.managed function
// Execute the bundle creation function
const response = creator(ims, exports);

@@ -134,7 +110,7 @@ const {

dependencies: void 0
}; // Set the descriptor of the exports
pkg.exports.descriptor = exports.descriptor; // Store the package and its dependencies to register the dependencies once all the bundles
};
// Set the descriptor of the exports
pkg.exports.descriptor = exports.descriptor;
// Store the package and its dependencies to register the dependencies once all the bundles
// of the transversal are created
packages.set(pkg.specifier, {

@@ -150,3 +126,2 @@ pkg,

*/
packages.forEach(({

@@ -163,5 +138,4 @@ pkg,

return;
} // Check if dependency is a bundle of the transversal
}
// Check if dependency is a bundle of the transversal
if (!packages.has(specifier)) {

@@ -171,3 +145,2 @@ const data = `\n\tDependencies: ${JSON.stringify([...this.#dependencies.keys()])}. ` + `\n\tBundles: ${JSON.stringify([...packages.keys()])}`;

}
const {

@@ -180,9 +153,8 @@ pkg

})();
packages.forEach(({
pkg
}) => this.#bundles.set(pkg.specifier, pkg.exports.values));
register && pkg.dependencies.update(register); // Register the ims, but do not initialise them until all bundles of the transversal are set
register && pkg.dependencies.update(register);
// Register the ims, but do not initialise them until all bundles of the transversal are set
// To allow dependencies among bundles
pkg.ims.register(ims);

@@ -194,5 +166,3 @@ });

}
}
exports.Transversal = Transversal;

@@ -206,3 +176,2 @@ }

}];
// Module exports

@@ -216,11 +185,7 @@ __pkg.exports.process = function ({

};
_export("__beyond_pkg", __beyond_pkg = __pkg);
_export("hmr", hmr = new function () {
this.on = (event, listener) => void 0;
this.off = (event, listener) => void 0;
}());
__pkg.initialise(ims);

@@ -227,0 +192,0 @@ }

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

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

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

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

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

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