sample-cross-fx 0.15.2-beta.4943 → 0.15.3-beta.4955

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -54285,16 +54285,20 @@ function createConverter(lazy) {
54285
54285
  let listener = undefined;
54286
54286
 
54287
54287
  const enqueueChange = (locals, update) => {
54288
- if (locals.state === 'mounted') {
54288
+ if (typeof update !== 'function') {// nothing to do in this case
54289
+ } else if (locals.state === 'mounted') {
54289
54290
  loader.then(update);
54290
54291
  } else {
54291
- locals.update = update;
54292
+ locals.next = update;
54292
54293
  }
54293
54294
  };
54294
54295
 
54295
54296
  const convert = (moduleName, dependency, args, options) => ({
54296
54297
  mount(el, data, ctx, locals) {
54297
54298
  const props = Object.assign(Object.assign({}, args), data);
54299
+ const {
54300
+ piral
54301
+ } = data;
54298
54302
  const nav = ctx.navigation;
54299
54303
  el.setAttribute('data-blazor-pilet-root', 'true');
54300
54304
  (0,_events__WEBPACK_IMPORTED_MODULE_2__.addGlobalEventListeners)(el);
@@ -54313,27 +54317,67 @@ function createConverter(lazy) {
54313
54317
  }
54314
54318
 
54315
54319
  locals.state = 'fresh';
54316
- locals.update = noop;
54317
- locals.dispose = (0,_events__WEBPACK_IMPORTED_MODULE_2__.attachEvents)(el, ev => data.piral.renderHtmlExtension(ev.detail.target, ev.detail.props), ev => ev.detail.replace ? nav.replace(ev.detail.to, ev.detail.store) : nav.push(ev.detail.to, ev.detail.state));
54318
- (loader || (loader = boot())).then(config => dependency(config).then(() => (0,_interop__WEBPACK_IMPORTED_MODULE_1__.activate)(moduleName, props)).then(refId => {
54319
- const [root] = config;
54320
+ locals.next = noop;
54321
+ locals.dispose = (0,_events__WEBPACK_IMPORTED_MODULE_2__.attachEvents)(el, ev => piral.renderHtmlExtension(ev.detail.target, ev.detail.props), ev => ev.detail.replace ? nav.replace(ev.detail.to, ev.detail.store) : nav.push(ev.detail.to, ev.detail.state));
54322
+
54323
+ function mountClassic(config) {
54324
+ return (0,_interop__WEBPACK_IMPORTED_MODULE_1__.activate)(moduleName, props).then(refId => {
54325
+ const [root] = config;
54326
+ const node = root.querySelector(`#${refId} > div`);
54327
+
54328
+ locals.unmount = () => {
54329
+ var _a;
54330
+
54331
+ (_a = root.querySelector(`#${refId}`)) === null || _a === void 0 ? void 0 : _a.appendChild(node);
54332
+ (0,_interop__WEBPACK_IMPORTED_MODULE_1__.deactivate)(moduleName, refId);
54333
+ el.innerHTML = '';
54334
+ };
54335
+
54336
+ locals.update = props => {
54337
+ (0,_interop__WEBPACK_IMPORTED_MODULE_1__.reactivate)(moduleName, refId, props);
54338
+ };
54339
+
54340
+ project(node, el, options);
54341
+ });
54342
+ }
54343
+
54344
+ function mountModern(_) {
54345
+ return (0,_interop__WEBPACK_IMPORTED_MODULE_1__.createElement)(moduleName, props).then(refId => {
54346
+ const child = document.createElement('piral-blazor-component');
54347
+ child.setAttribute('rid', refId);
54348
+ el.appendChild(child);
54349
+
54350
+ locals.unmount = () => {
54351
+ (0,_interop__WEBPACK_IMPORTED_MODULE_1__.destroyElement)(refId);
54352
+ child.remove();
54353
+ el.innerHTML = '';
54354
+ };
54355
+
54356
+ locals.update = props => {
54357
+ (0,_interop__WEBPACK_IMPORTED_MODULE_1__.updateElement)(refId, props);
54358
+ };
54359
+ });
54360
+ }
54320
54361
 
54362
+ (loader || (loader = boot())).then(config => dependency(config).then(() => {
54321
54363
  if (locals.state === 'fresh') {
54322
- locals.id = refId;
54323
- locals.node = root.querySelector(`#${locals.id} > div`);
54324
- project(locals.node, el, options);
54325
- locals.state = 'mounted';
54326
- locals.referenceId = refId;
54327
- locals.update(config);
54328
- locals.update = noop;
54364
+ const [_, capabilities, applyChanges] = config;
54365
+ const fn = capabilities.includes('custom-element') ? mountModern : mountClassic;
54366
+ applyChanges(piral.meta);
54367
+ return fn(config).then(() => {
54368
+ locals.state = 'mounted';
54369
+ locals.next(config);
54370
+ locals.next = noop;
54371
+ });
54329
54372
  }
54330
54373
  })).catch(err => console.error(err));
54331
54374
  },
54332
54375
 
54333
54376
  update(el, data, ctx, locals) {
54334
54377
  enqueueChange(locals, () => {
54335
- const props = Object.assign(Object.assign({}, args), data);
54336
- (0,_interop__WEBPACK_IMPORTED_MODULE_1__.reactivate)(moduleName, locals.referenceId, props);
54378
+ var _a;
54379
+
54380
+ (_a = locals.update) === null || _a === void 0 ? void 0 : _a.call(locals, Object.assign(Object.assign({}, args), data));
54337
54381
  });
54338
54382
  },
54339
54383
 
@@ -54341,13 +54385,7 @@ function createConverter(lazy) {
54341
54385
  (0,_events__WEBPACK_IMPORTED_MODULE_2__.removeGlobalEventListeners)(el);
54342
54386
  el.removeAttribute('data-blazor-pilet-root');
54343
54387
  locals.dispose();
54344
- enqueueChange(locals, ([root]) => {
54345
- var _a;
54346
-
54347
- (_a = root.querySelector(`#${locals.id}`)) === null || _a === void 0 ? void 0 : _a.appendChild(locals.node);
54348
- (0,_interop__WEBPACK_IMPORTED_MODULE_1__.deactivate)(moduleName, locals.referenceId);
54349
- el.innerHTML = '';
54350
- });
54388
+ enqueueChange(locals, locals.unmount);
54351
54389
  locals.state = 'removed';
54352
54390
  }
54353
54391
 
@@ -54674,7 +54712,9 @@ __webpack_require__.r(__webpack_exports__);
54674
54712
  /* harmony export */ "activate": () => (/* binding */ activate),
54675
54713
  /* harmony export */ "callNotifyLocationChanged": () => (/* binding */ callNotifyLocationChanged),
54676
54714
  /* harmony export */ "createBootLoader": () => (/* binding */ createBootLoader),
54715
+ /* harmony export */ "createElement": () => (/* binding */ createElement),
54677
54716
  /* harmony export */ "deactivate": () => (/* binding */ deactivate),
54717
+ /* harmony export */ "destroyElement": () => (/* binding */ destroyElement),
54678
54718
  /* harmony export */ "getCapabilities": () => (/* binding */ getCapabilities),
54679
54719
  /* harmony export */ "initialize": () => (/* binding */ initialize),
54680
54720
  /* harmony export */ "loadBlazorPilet": () => (/* binding */ loadBlazorPilet),
@@ -54682,7 +54722,8 @@ __webpack_require__.r(__webpack_exports__);
54682
54722
  /* harmony export */ "loadResourceWithSymbol": () => (/* binding */ loadResourceWithSymbol),
54683
54723
  /* harmony export */ "reactivate": () => (/* binding */ reactivate),
54684
54724
  /* harmony export */ "unloadBlazorPilet": () => (/* binding */ unloadBlazorPilet),
54685
- /* harmony export */ "unloadResource": () => (/* binding */ unloadResource)
54725
+ /* harmony export */ "unloadResource": () => (/* binding */ unloadResource),
54726
+ /* harmony export */ "updateElement": () => (/* binding */ updateElement)
54686
54727
  /* harmony export */ });
54687
54728
  /* harmony import */ var _events__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./events */ "../../converters/piral-blazor/esm/events.js");
54688
54729
 
@@ -54715,6 +54756,30 @@ function createBase() {
54715
54756
  return document.head.appendChild(el);
54716
54757
  }
54717
54758
 
54759
+ function prepareForStartup() {
54760
+ const originalApplyHotReload = window.Blazor._internal.applyHotReload;
54761
+ const queue = [];
54762
+
54763
+ const applyChanges = pilet => {
54764
+ if (pilet.config && pilet.config.blazorHotReload) {
54765
+ for (const item of queue.splice(0, queue.length)) {
54766
+ item();
54767
+ }
54768
+
54769
+ window.Blazor._internal.applyHotReload = originalApplyHotReload;
54770
+ }
54771
+ };
54772
+
54773
+ window.Blazor._internal.applyHotReload = function (...args) {
54774
+ queue.push(() => originalApplyHotReload.apply(this, args));
54775
+ };
54776
+
54777
+ return getCapabilities().then(capabilities => ({
54778
+ capabilities,
54779
+ applyChanges
54780
+ }));
54781
+ }
54782
+
54718
54783
  function createBlazorStarter(publicPath) {
54719
54784
  const root = document.body.appendChild(document.createElement('div'));
54720
54785
  root.style.display = 'none';
@@ -54737,14 +54802,20 @@ function createBlazorStarter(publicPath) {
54737
54802
 
54738
54803
  navManager.getBaseURI = () => originalBase;
54739
54804
 
54740
- return window.Blazor.start().then(getCapabilities).then(capabilities => {
54805
+ return window.Blazor.start().then(prepareForStartup).then(({
54806
+ capabilities,
54807
+ applyChanges
54808
+ }) => {
54741
54809
  baseElement.href = originalBase;
54742
- return [root, capabilities];
54810
+ return [root, capabilities, applyChanges];
54743
54811
  });
54744
54812
  };
54745
54813
  }
54746
54814
 
54747
- return () => window.Blazor.start().then(getCapabilities).then(capabilities => [root, capabilities]);
54815
+ return () => window.Blazor.start().then(prepareForStartup).then(({
54816
+ capabilities,
54817
+ applyChanges
54818
+ }) => [root, capabilities, applyChanges]);
54748
54819
  }
54749
54820
 
54750
54821
  function computePath() {
@@ -54774,6 +54845,15 @@ function addScript(url) {
54774
54845
  });
54775
54846
  }
54776
54847
 
54848
+ function createElement(moduleName, props) {
54849
+ return window.DotNet.invokeMethodAsync(coreLib, 'CreateElement', moduleName, props);
54850
+ }
54851
+ function updateElement(referenceId, props) {
54852
+ return window.DotNet.invokeMethodAsync(coreLib, 'UpdateElement', referenceId, props);
54853
+ }
54854
+ function destroyElement(referenceId) {
54855
+ return window.DotNet.invokeMethodAsync(coreLib, 'DestroyElement', referenceId);
54856
+ }
54777
54857
  function activate(moduleName, props) {
54778
54858
  return window.DotNet.invokeMethodAsync(coreLib, 'Activate', moduleName, props);
54779
54859
  }
@@ -63607,12 +63687,12 @@ function installPiralDebug(options) {
63607
63687
  debug: debugApiVersion,
63608
63688
  instance: {
63609
63689
  name: "sample-cross-fx",
63610
- version: "0.15.2-beta.4943",
63690
+ version: "0.15.3-beta.4955",
63611
63691
  dependencies: "@angular/common,@angular/compiler,@angular/core,@angular/platform-browser,@angular/platform-browser-dynamic,@webcomponents/webcomponentsjs,angular,aurelia-framework,aurelia-templating-binding,aurelia-templating-resources,aurelia-pal-browser,aurelia-event-aggregator,aurelia-history-browser,hyperapp,inferno,inferno-create-element,mithril,lit-element,solid-js,solid-js/dom,piral-ng/common,preact,riot,rxjs,vue,zone.js,tslib,react,react-dom,react-router,react-router-dom"
63612
63692
  },
63613
63693
  build: {
63614
- date: "2022-12-04T23:25:48.116Z",
63615
- cli: "0.15.2-beta.4943",
63694
+ date: "2022-12-09T17:21:28.687Z",
63695
+ cli: "0.15.2",
63616
63696
  compat: "0.15"
63617
63697
  }
63618
63698
  };
@@ -216460,4 +216540,4 @@ root.render( /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_8__.createElement(piral
216460
216540
 
216461
216541
  /******/ })()
216462
216542
  ;
216463
- //# sourceMappingURL=index.a9cbe9.js.map
216543
+ //# sourceMappingURL=index.2af468.js.map