@beyond-js/kernel
Advanced tools
Comparing version 0.0.14 to 0.0.15
@@ -118,3 +118,3 @@ /************ | ||
get transversals(): { | ||
"__#5312@#transversals": Map<string, ns_transversals_transversal.Transversal>; | ||
"__#5531@#transversals": Map<string, ns_transversals_transversal.Transversal>; | ||
has(name: string, language: string): boolean; | ||
@@ -480,3 +480,3 @@ obtain(name: string, language: string, deps?: ns_bundles_instances_dependencies.IDependencies): ns_transversals_transversal.Transversal; | ||
declare namespace ns_modules_module { | ||
import ModuleTexts = ns_modules_texts.ModuleTexts; | ||
import ModuleTextsLanguages = ns_modules_texts_index.ModuleTextsLanguages; | ||
import Bundles = ns_bundles_bundles.Bundles; | ||
@@ -506,3 +506,3 @@ import Application = ns_application_application.Application; | ||
get socket(): Promise<Socket>; | ||
get texts(): ModuleTexts<any>; | ||
get texts(): ModuleTextsLanguages<any>; | ||
execute(path: string, params?: object): Promise<unknown>; | ||
@@ -533,16 +533,67 @@ /** | ||
// FILE: modules\texts.d.ts | ||
declare namespace ns_modules_texts { | ||
// FILE: modules\texts\current.d.ts | ||
declare namespace ns_modules_texts_current { | ||
import Module = ns_modules_module.Module; | ||
import Events = ns_utils_events_events.Events; | ||
class ModuleTexts<TextsDeclaration> extends Events { | ||
/** | ||
* The texts loaded by the current language (not available in SSR environment) | ||
*/ | ||
class ModuleCurrentTexts<TextsDeclaration> extends Events { | ||
#private; | ||
get id(): string; | ||
get module(): Module; | ||
get bundle(): string; | ||
get multilanguage(): boolean; | ||
get value(): TextsDeclaration; | ||
get enabled(): boolean; | ||
set enabled(value: boolean); | ||
get loading(): boolean; | ||
get loaded(): boolean; | ||
get loading(): string; | ||
get ready(): boolean; | ||
get value(): TextsDeclaration; | ||
/** | ||
* Module texts constructor | ||
* | ||
* @param {Module} module The module that holds the texts bundle | ||
* @param {boolean} multilanguage | ||
*/ | ||
constructor(module: Module, multilanguage?: boolean); | ||
load(): Promise<void>; | ||
destroy(): void; | ||
} | ||
} | ||
// FILE: modules\texts\index.d.ts | ||
declare namespace ns_modules_texts_index { | ||
import ModuleTexts = ns_modules_texts_texts.ModuleTexts; | ||
import IModuleSpecs = ns_modules_module.IModuleSpecs; | ||
import Module = ns_modules_module.Module; | ||
import ModuleCurrentTexts = ns_modules_texts_current.ModuleCurrentTexts; | ||
class ModuleTextsLanguages<TextsDeclaration> { | ||
#private; | ||
get module(): Module; | ||
get specs(): IModuleSpecs; | ||
get current(): ModuleCurrentTexts<TextsDeclaration>; | ||
/** | ||
* Module texts constructor | ||
* | ||
* @param {Module} module The module that holds the texts bundle | ||
* @param {IModuleSpecs} specs To know which txt bundles are present | ||
*/ | ||
constructor(module: Module, specs: IModuleSpecs); | ||
get(bundle: string, language: string): ModuleTexts<TextsDeclaration>; | ||
} | ||
} | ||
// FILE: modules\texts\texts.d.ts | ||
declare namespace ns_modules_texts_texts { | ||
import Module = ns_modules_module.Module; | ||
import Events = ns_utils_events_events.Events; | ||
class ModuleTexts<TextsDeclaration> extends Events { | ||
#private; | ||
get module(): Module; | ||
get bundle(): string; | ||
get multilanguage(): boolean; | ||
get loaded(): boolean; | ||
get loading(): boolean; | ||
get value(): TextsDeclaration; | ||
get ready(): boolean; | ||
get language(): string; | ||
@@ -554,5 +605,6 @@ /** | ||
* @param {string} bundle The bundle name | ||
* @param {boolean=true} multilanguage | ||
* @param {boolean=} multilanguage | ||
* @param {string=} language | ||
*/ | ||
constructor(module: Module, bundle: string, multilanguage?: boolean); | ||
constructor(module: Module, bundle: string, multilanguage?: boolean, language?: string); | ||
load(): Promise<void>; | ||
@@ -618,5 +670,5 @@ destroy(): void; | ||
new (message: string, stack: Stack): { | ||
"__#5294@#message": string; | ||
"__#5513@#message": string; | ||
readonly message: string; | ||
readonly "__#5294@#stack": Stack; | ||
readonly "__#5513@#stack": Stack; | ||
readonly stack: Stack; | ||
@@ -792,3 +844,3 @@ }; | ||
const transversals: { | ||
"__#5312@#transversals": Map<string, Transversal>; | ||
"__#5531@#transversals": Map<string, Transversal>; | ||
has(name: string, language: string): boolean; | ||
@@ -950,7 +1002,13 @@ obtain(name: string, language: string, deps?: IDependencies): Transversal; | ||
import Bundle = ns_bundles_bundle.Bundle; | ||
import BundleStyles = ns_bundles_styles_styles.BundleStyles; | ||
interface IWidgetStore { | ||
toJSON(): object; | ||
hydrate(cached: object): void; | ||
hydrate(cached: object): Promise<void>; | ||
fetch(): Promise<void>; | ||
} | ||
type ControllerSpecs = Partial<{ | ||
specs: WidgetSpecs; | ||
component: HTMLElement; | ||
language: string; | ||
}>; | ||
abstract class BeyondWidgetControllerBase { | ||
@@ -963,8 +1021,7 @@ #private; | ||
get layout(): string; | ||
get language(): string; | ||
get Widget(): any; | ||
createStore(): IWidgetStore; | ||
protected constructor({ specs, component }: Partial<{ | ||
specs: WidgetSpecs; | ||
component: HTMLElement; | ||
}>); | ||
get styles(): BundleStyles[]; | ||
createStore(language?: string): IWidgetStore; | ||
protected constructor({ specs, component, language }: ControllerSpecs); | ||
} | ||
@@ -992,3 +1049,3 @@ } | ||
refresh(): void; | ||
initialise(): void; | ||
initialise(): Promise<void>; | ||
} | ||
@@ -1116,2 +1173,3 @@ } | ||
id: string; | ||
props?: string[]; | ||
is?: string; | ||
@@ -1173,3 +1231,4 @@ route?: string; | ||
export import Module = ns_modules_module.Module; | ||
export import ModuleTexts = ns_modules_texts.ModuleTexts; | ||
export import ModuleCurrentTexts = ns_modules_texts_current.ModuleCurrentTexts; | ||
export import ModuleTexts = ns_modules_texts_texts.ModuleTexts; | ||
export import ActionsBridge = ns_service_actionsbridge.ActionsBridge; | ||
@@ -1189,2 +1248,3 @@ export import Collection = ns_utils_collection_collection.Collection; | ||
export import WidgetControllerLoader = ns_widgets_widget_loader.WidgetControllerLoader; | ||
export import BeyondWidget = ns_widgets_widget_widget.BeyondWidget; | ||
export import WidgetSpecs = ns_widgets_widgets.WidgetSpecs; | ||
@@ -1191,0 +1251,0 @@ export import widgets = ns_widgets_widgets.widgets; |
{ | ||
"name": "@beyond-js/kernel", | ||
"version": "0.0.14", | ||
"version": "0.0.15", | ||
"keywords": [], | ||
@@ -5,0 +5,0 @@ "static": { |
@@ -26,3 +26,3 @@ define(["exports", "react", "react-dom", "@beyond-js/kernel/core/ts", "@beyond-js/kernel/routing/ts"], function (_exports2, dependency_0, dependency_1, dependency_2, dependency_3) { | ||
modules.set('./controller', { | ||
hash: 3785716811, | ||
hash: 3610802844, | ||
creator: function (require, exports) { | ||
@@ -69,5 +69,5 @@ "use strict"; | ||
initialise() { | ||
async initialise() { | ||
this.component.localName === 'main-layout' && (0, _retargetEvents.retargetEvents)(this.component.shadowRoot); | ||
super.initialise(); | ||
await super.initialise(); | ||
} | ||
@@ -85,3 +85,3 @@ | ||
modules.set('./page', { | ||
hash: 3352408644, | ||
hash: 3426493260, | ||
creator: function (require, exports) { | ||
@@ -126,6 +126,6 @@ "use strict"; | ||
initialise() { | ||
async initialise() { | ||
const child = this.component.getAttribute('data-child-id'); | ||
this.#uri = child ? _ts.routing.manager.pages.find(child).uri : void 0; | ||
super.initialise(); | ||
await super.initialise(); | ||
} | ||
@@ -132,0 +132,0 @@ |
@@ -15,3 +15,3 @@ /************ | ||
unmount(): void; | ||
initialise(): void; | ||
initialise(): Promise<void>; | ||
} | ||
@@ -31,3 +31,3 @@ } | ||
unmount(): void; | ||
initialise(): void; | ||
initialise(): Promise<void>; | ||
} | ||
@@ -34,0 +34,0 @@ } |
@@ -7,3 +7,3 @@ define(["exports", "@beyond-js/kernel/core/ts"], function (_exports2, dependency_0) { | ||
}); | ||
_exports2.routing = _exports2.hmr = _exports2.URI = _exports2.Layout = _exports2.BeyondLayoutChildrenRenderer = void 0; | ||
_exports2.routing = _exports2.URI = _exports2.Layout = _exports2.BeyondLayoutChildrenRenderer = void 0; | ||
const dependencies = new Map(); | ||
@@ -46,3 +46,3 @@ dependencies.set('@beyond-js/kernel/core/ts', dependency_0); | ||
modules.set('./beyond-layout-children/renderer', { | ||
hash: 4045584597, | ||
hash: 1396988951, | ||
creator: function (require, exports) { | ||
@@ -62,2 +62,7 @@ "use strict"; | ||
#element; | ||
get element() { | ||
return this.#element; | ||
} | ||
#layout; | ||
@@ -76,5 +81,18 @@ | ||
if (!this.#layout) return; | ||
element.attachShadow({ | ||
mode: 'open' | ||
}); | ||
if (element.shadowRoot) { | ||
// The shadow root is already created in ssr distributions | ||
this.#layout.children.forEach(child => { | ||
// Check which of the children were created in by ssr | ||
const childElement = element.shadowRoot.querySelector(child.element); | ||
if (!childElement) return; | ||
childElement.setAttribute('data-child-id', child.id); | ||
this.#mounted.set(child.id, childElement); | ||
}); | ||
} else { | ||
element.attachShadow({ | ||
mode: 'open' | ||
}); | ||
} | ||
this.#layout.on('change', this.render); | ||
@@ -95,4 +113,7 @@ this.render(); | ||
if (widget.getAttribute('data-main') === '1') return routing.manager.main; | ||
return routing.manager.layouts.get(widget.getAttribute('data-child-id')); | ||
if (!widget) { | ||
throw new Error(`Widget container of beyond-layout-children not found`); | ||
} | ||
return widget.getAttribute('data-main') === '1' ? routing.manager.main : routing.manager.layouts.get(widget.getAttribute('data-child-id')); | ||
})(); // Render the layouts and pages of this container | ||
@@ -119,7 +140,12 @@ | ||
const show = () => { | ||
page.removeEventListener('controller.loaded', show); | ||
page.removeEventListener('controller.initialised', show); | ||
if (!page.controller) { | ||
throw new Error(`Controller of page widget "${child.element}" is undefined`); | ||
} | ||
this.#active === element && page.controller.show?.(); | ||
}; | ||
page.controller ? page.controller.show?.() : page.addEventListener('controller.loaded', show); | ||
page.controller ? page.controller.show?.() : page.addEventListener('controller.initialised', show); | ||
} else if (!element.hidden && !active) { | ||
@@ -1000,3 +1026,3 @@ page.controller?.hide?.(); | ||
modules.set('./routing', { | ||
hash: 3685224982, | ||
hash: 3301894040, | ||
creator: function (require, exports) { | ||
@@ -1142,4 +1168,3 @@ "use strict"; | ||
!ssr && this.update().catch(exc => console.error(exc.stack)); | ||
this.#hydrate(); | ||
!ssr && this.update().then(() => this.#hydrate()).catch(exc => console.error(exc.stack)); | ||
} | ||
@@ -1433,10 +1458,3 @@ | ||
const hmr = new function () { | ||
this.on = (event, listener) => void 0; | ||
this.off = (event, listener) => void 0; | ||
}(); | ||
_exports2.hmr = hmr; | ||
__pkg.initialise(modules); | ||
}); |
@@ -15,2 +15,3 @@ /************ | ||
#private; | ||
get element(): HTMLElement; | ||
get layout(): Layout; | ||
@@ -27,5 +28,5 @@ constructor(element: HTMLElement); | ||
const config: { | ||
readonly "__#49189@#layouts": LayoutsConfig; | ||
readonly "__#49477@#layouts": LayoutsConfig; | ||
readonly layouts: LayoutsConfig; | ||
readonly "__#49189@#pages": PagesConfig; | ||
readonly "__#49477@#pages": PagesConfig; | ||
readonly pages: PagesConfig; | ||
@@ -32,0 +33,0 @@ }; |
@@ -66,3 +66,3 @@ define(["exports", "@beyond-js/kernel/core/ts", "@beyond-js/kernel/routing/ts"], function (_exports2, dependency_0, dependency_1) { | ||
modules.set('./page', { | ||
hash: 2731159955, | ||
hash: 3282113093, | ||
creator: function (require, exports) { | ||
@@ -103,6 +103,6 @@ "use strict"; | ||
initialise() { | ||
async initialise() { | ||
const child = this.component.getAttribute('data-child-id'); | ||
this.#uri = child ? _ts.routing.manager.pages.find(child).uri : void 0; | ||
super.initialise(); | ||
await super.initialise(); | ||
} | ||
@@ -109,0 +109,0 @@ |
@@ -29,3 +29,3 @@ /************ | ||
unmount(): void; | ||
initialise(): void; | ||
initialise(): Promise<void>; | ||
} | ||
@@ -32,0 +32,0 @@ } |
@@ -65,3 +65,3 @@ define(["exports", "@beyond-js/kernel/core/ts", "vue", "@beyond-js/kernel/routing/ts"], function (_exports2, dependency_0, dependency_1, dependency_2) { | ||
modules.set('./page', { | ||
hash: 1856234592, | ||
hash: 4256937406, | ||
creator: function (require, exports) { | ||
@@ -102,6 +102,6 @@ "use strict"; | ||
initialise() { | ||
async initialise() { | ||
const child = this.component.getAttribute('data-child-id'); | ||
this.#uri = child ? _ts.routing.manager.pages.find(child).uri : void 0; | ||
super.initialise(); | ||
await super.initialise(); | ||
} | ||
@@ -108,0 +108,0 @@ |
@@ -29,3 +29,3 @@ /************ | ||
unmount(): void; | ||
initialise(): void; | ||
initialise(): Promise<void>; | ||
} | ||
@@ -32,0 +32,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1708861
44934
2