minimal-piral 1.4.0-beta.6280 → 1.4.0-beta.6287

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.
@@ -174,10 +174,10 @@ var RootListener = function RootListener() {
174
174
  target.dispose = dispose;
175
175
  };
176
176
  document.body.addEventListener('render-html', renderHtml, false);
177
- document.body.addEventListener('render-content', renderContent, false);
177
+ window.addEventListener('render-content', renderContent, false);
178
178
  return function () {
179
179
  document.body.removeEventListener('render-html', renderHtml, false);
180
- document.body.removeEventListener('render-content', renderContent, false);
180
+ window.removeEventListener('render-content', renderContent, false);
181
181
  };
182
182
  }
183
183
  }, [context]);
@@ -2106,6 +2106,7 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
2106
2106
 
2107
2107
 
2108
2108
  if (typeof window !== 'undefined' && 'customElements' in window) {
2109
+ var contents = 'contents';
2109
2110
  /**
2110
2111
  * This is a nice abstraction allowing anyone to actually use the extension system
2111
2112
  * brought by Piral. Not all props of the extension system are actually exposed.
@@ -2205,7 +2206,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
2205
2206
  }, {
2206
2207
  key: "connectedCallback",
2207
2208
  value: function connectedCallback() {
2208
- this.style.display = 'contents';
2209
+ this.style.display = contents;
2209
2210
  if (this.isConnected) {
2210
2211
  this.dispatchEvent(new CustomEvent('render-html', {
2211
2212
  bubbles: true,
@@ -2268,7 +2269,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
2268
2269
  _createClass(PiralPortal, [{
2269
2270
  key: "connectedCallback",
2270
2271
  value: function connectedCallback() {
2271
- this.style.display = 'contents';
2272
+ this.style.display = contents;
2272
2273
  }
2273
2274
  }]);
2274
2275
  return PiralPortal;
@@ -2295,7 +2296,7 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
2295
2296
  _createClass(PiralSlot, [{
2296
2297
  key: "connectedCallback",
2297
2298
  value: function connectedCallback() {
2298
- this.style.display = 'contents';
2299
+ this.style.display = contents;
2299
2300
  }
2300
2301
  }]);
2301
2302
  return PiralSlot;
@@ -2335,13 +2336,13 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
2335
2336
  _createClass(PiralContent, [{
2336
2337
  key: "connectedCallback",
2337
2338
  value: function connectedCallback() {
2338
- this.style.display = 'contents';
2339
+ this.style.display = contents;
2339
2340
  var cid = this.getAttribute('cid');
2340
2341
  var content = PiralContent.contentAssignments[cid];
2341
2342
  var portal = this.closest('piral-portal');
2342
2343
  if (content && portal) {
2343
2344
  var portalId = portal.getAttribute('pid');
2344
- document.body.dispatchEvent(new CustomEvent('render-content', {
2345
+ window.dispatchEvent(new CustomEvent('render-content', {
2345
2346
  detail: {
2346
2347
  target: this,
2347
2348
  content: content,
@@ -2364,6 +2365,58 @@ if (typeof window !== 'undefined' && 'customElements' in window) {
2364
2365
  PiralContent.contentAssignments[cid] = content;
2365
2366
  };
2366
2367
  customElements.define(_utils__WEBPACK_IMPORTED_MODULE_3__.contentName, PiralContent);
2368
+ /**
2369
+ * This is a virtual element to indicate that the contained content is
2370
+ * rendered from a micro frontend's component. It will be used by the
2371
+ * orchestrator, so there is nothing you will need to do with it.
2372
+ *
2373
+ * Right now this is only used when you opt-in in the createInstance.
2374
+ */
2375
+ var PiralComponent = /*#__PURE__*/function (_HTMLElement5) {
2376
+ _inherits(PiralComponent, _HTMLElement5);
2377
+ var _super5 = _createSuper(PiralComponent);
2378
+ function PiralComponent() {
2379
+ _classCallCheck(this, PiralComponent);
2380
+ return _super5.apply(this, arguments);
2381
+ }
2382
+ _createClass(PiralComponent, [{
2383
+ key: "name",
2384
+ get: function get() {
2385
+ return this.getAttribute('name');
2386
+ }
2387
+ }, {
2388
+ key: "origin",
2389
+ get: function get() {
2390
+ return this.getAttribute('origin');
2391
+ }
2392
+ }, {
2393
+ key: "connectedCallback",
2394
+ value: function connectedCallback() {
2395
+ this.style.display = contents;
2396
+ this.deferEvent('add-component');
2397
+ }
2398
+ }, {
2399
+ key: "disconnectedCallback",
2400
+ value: function disconnectedCallback() {
2401
+ this.deferEvent('remove-component');
2402
+ }
2403
+ }, {
2404
+ key: "deferEvent",
2405
+ value: function deferEvent(eventName) {
2406
+ var ev = new CustomEvent(eventName, {
2407
+ detail: {
2408
+ name: this.name,
2409
+ origin: this.origin
2410
+ }
2411
+ });
2412
+ setTimeout(function () {
2413
+ return window.dispatchEvent(ev);
2414
+ }, 0);
2415
+ }
2416
+ }]);
2417
+ return PiralComponent;
2418
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
2419
+ customElements.define(_utils__WEBPACK_IMPORTED_MODULE_3__.componentName, PiralComponent);
2367
2420
  }
2368
2421
  function renderElement(context, element, props) {
2369
2422
  if (typeof window !== 'undefined') {
@@ -2544,14 +2597,22 @@ function getWrapper(wrappers, wrapperType) {
2544
2597
  return WrapType || WrapAll || DefaultWrapper;
2545
2598
  }
2546
2599
  function makeWrapper(context, outerProps, wrapperType, errorType) {
2600
+ var wrapped = context.readState(function (m) {
2601
+ return m.app.wrap;
2602
+ });
2547
2603
  var OuterWrapper = context.readState(function (m) {
2548
2604
  return getWrapper(m.registry.wrappers, wrapperType);
2549
2605
  });
2550
- return function (props) {
2606
+ var Wrapper = function Wrapper(props) {
2551
2607
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(OuterWrapper, _objectSpread(_objectSpread({}, outerProps), props), /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(_components__WEBPACK_IMPORTED_MODULE_2__.ErrorBoundary, _objectSpread(_objectSpread(_objectSpread({}, outerProps), props), {}, {
2552
2608
  errorType: errorType
2553
2609
  }), props.children));
2554
2610
  };
2611
+ return wrapped ? function (props) {
2612
+ return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("piral-component", {
2613
+ origin: outerProps.piral.meta.name
2614
+ }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Wrapper, _objectSpread({}, props)));
2615
+ } : Wrapper;
2555
2616
  }
2556
2617
  function withApi(context, component, piral, errorType) {
2557
2618
  var wrapperType = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : errorType;
@@ -2644,11 +2705,7 @@ function integrateDebugger(context, options) {
2644
2705
  integrate: function integrate(dbg) {
2645
2706
  context.dispatch(function (s) {
2646
2707
  return _objectSpread(_objectSpread({}, s), {}, {
2647
- components: _objectSpread(_objectSpread({}, s.components), dbg.components),
2648
- routes: _objectSpread(_objectSpread({}, s.routes), dbg.routes),
2649
- registry: _objectSpread(_objectSpread({}, s.registry), {}, {
2650
- wrappers: _objectSpread(_objectSpread({}, s.registry.wrappers), dbg.wrappers)
2651
- })
2708
+ routes: _objectSpread(_objectSpread({}, s.routes), dbg.routes)
2652
2709
  });
2653
2710
  });
2654
2711
  context.state.subscribe(function (current, previous) {
@@ -2888,6 +2945,7 @@ __webpack_require__.r(__webpack_exports__);
2888
2945
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
2889
2946
  /* harmony export */ attachDomPortal: () => (/* binding */ attachDomPortal),
2890
2947
  /* harmony export */ changeDomPortal: () => (/* binding */ changeDomPortal),
2948
+ /* harmony export */ componentName: () => (/* binding */ componentName),
2891
2949
  /* harmony export */ contentName: () => (/* binding */ contentName),
2892
2950
  /* harmony export */ convertComponent: () => (/* binding */ convertComponent),
2893
2951
  /* harmony export */ extensionName: () => (/* binding */ extensionName),
@@ -2901,6 +2959,7 @@ __webpack_require__.r(__webpack_exports__);
2901
2959
 
2902
2960
 
2903
2961
  var extensionName = 'piral-extension';
2962
+ var componentName = 'piral-component';
2904
2963
  var contentName = 'piral-content';
2905
2964
  var portalName = 'piral-portal';
2906
2965
  var slotName = 'piral-slot';
@@ -3314,37 +3373,6 @@ function withRoute(path, component) {
3314
3373
 
3315
3374
  /***/ }),
3316
3375
 
3317
- /***/ "../../utilities/piral-debug-utils/esm/DebugTracker.js":
3318
- /*!*************************************************************!*\
3319
- !*** ../../utilities/piral-debug-utils/esm/DebugTracker.js ***!
3320
- \*************************************************************/
3321
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3322
-
3323
- "use strict";
3324
- __webpack_require__.r(__webpack_exports__);
3325
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3326
- /* harmony export */ DebugTracker: () => (/* binding */ DebugTracker)
3327
- /* harmony export */ });
3328
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
3329
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3330
- /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "../../utilities/piral-debug-utils/esm/state.js");
3331
-
3332
-
3333
- var DebugTracker = function DebugTracker() {
3334
- var route = (0,_state__WEBPACK_IMPORTED_MODULE_1__.useDebugState)(function (s) {
3335
- return s.route;
3336
- });
3337
- react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
3338
- if (route) {
3339
- (0,_state__WEBPACK_IMPORTED_MODULE_1__.navigate)(route.path, route.state);
3340
- }
3341
- }, [route]);
3342
- // tslint:disable-next-line:no-null-keyword
3343
- return null;
3344
- };
3345
-
3346
- /***/ }),
3347
-
3348
3376
  /***/ "../../utilities/piral-debug-utils/esm/ExtensionCatalogue.js":
3349
3377
  /*!*******************************************************************!*\
3350
3378
  !*** ../../utilities/piral-debug-utils/esm/ExtensionCatalogue.js ***!
@@ -3369,6 +3397,7 @@ var ExtensionCatalogue = function ExtensionCatalogue() {
3369
3397
  name = _state$name === void 0 ? '' : _state$name,
3370
3398
  _state$params = state.params,
3371
3399
  params = _state$params === void 0 ? {} : _state$params;
3400
+ // @ts-ignore
3372
3401
  return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("piral-extension", {
3373
3402
  name: name,
3374
3403
  params: JSON.stringify(params)
@@ -3379,141 +3408,6 @@ var ExtensionCatalogue = function ExtensionCatalogue() {
3379
3408
 
3380
3409
  /***/ }),
3381
3410
 
3382
- /***/ "../../utilities/piral-debug-utils/esm/VisualizationWrapper.js":
3383
- /*!*********************************************************************!*\
3384
- !*** ../../utilities/piral-debug-utils/esm/VisualizationWrapper.js ***!
3385
- \*********************************************************************/
3386
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
3387
-
3388
- "use strict";
3389
- __webpack_require__.r(__webpack_exports__);
3390
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3391
- /* harmony export */ VisualizationWrapper: () => (/* binding */ VisualizationWrapper)
3392
- /* harmony export */ });
3393
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
3394
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
3395
- /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./state */ "../../utilities/piral-debug-utils/esm/state.js");
3396
-
3397
-
3398
- var moduleColor = {};
3399
- var Visualizer = function Visualizer(_ref) {
3400
- var pilet = _ref.pilet,
3401
- force = _ref.force,
3402
- active = _ref.active;
3403
- var colors = ['#001F3F', '#0074D9', '#7FDBFF', '#39CCCC', '#3D9970', '#2ECC40', '#01FF70', '#FFDC00', '#FF851B', '#FF4136', '#85144B', '#F012BE', '#B10DC9'];
3404
- var container = react__WEBPACK_IMPORTED_MODULE_0__.useRef();
3405
- var color = react__WEBPACK_IMPORTED_MODULE_0__.useMemo(function () {
3406
- return moduleColor[pilet] || (moduleColor[pilet] = colors[Object.keys(moduleColor).length % colors.length]);
3407
- }, [pilet]);
3408
- react__WEBPACK_IMPORTED_MODULE_0__.useEffect(function () {
3409
- var sibling = container.current && container.current.nextElementSibling;
3410
- if (sibling && active) {
3411
- var target = container.current.parentNode;
3412
- var mouseIn = function mouseIn() {
3413
- if (container.current && sibling) {
3414
- var style = container.current.style;
3415
- style.display = 'block';
3416
- style.left = '0px';
3417
- style.top = '0px';
3418
- style.bottom = '0px';
3419
- style.right = '0px';
3420
- var targetRect = sibling.getBoundingClientRect();
3421
- var sourceRect = container.current.getBoundingClientRect();
3422
- style.left = targetRect.left - sourceRect.left + 'px';
3423
- style.top = targetRect.top - sourceRect.top + 'px';
3424
- style.bottom = -(targetRect.bottom - sourceRect.bottom) + 'px';
3425
- style.right = -(targetRect.right - sourceRect.right) + 'px';
3426
- }
3427
- };
3428
- var mouseOut = function mouseOut() {
3429
- if (container.current) {
3430
- var style = container.current.style;
3431
- style.display = 'none';
3432
- }
3433
- };
3434
- var append = function append() {
3435
- if (force) {
3436
- mouseIn();
3437
- } else if (sibling) {
3438
- sibling.addEventListener('mouseover', mouseIn);
3439
- sibling.addEventListener('mouseout', mouseOut);
3440
- }
3441
- };
3442
- var remove = function remove() {
3443
- if (force) {
3444
- mouseOut();
3445
- } else if (sibling) {
3446
- sibling.removeEventListener('mouseover', mouseIn);
3447
- sibling.removeEventListener('mouseout', mouseOut);
3448
- }
3449
- };
3450
- var observer = new MutationObserver(function () {
3451
- var _container$current;
3452
- var newSibling = (_container$current = container.current) === null || _container$current === void 0 ? void 0 : _container$current.nextElementSibling;
3453
- if (newSibling !== sibling) {
3454
- remove();
3455
- sibling = newSibling;
3456
- append();
3457
- }
3458
- });
3459
- append();
3460
- observer.observe(target, {
3461
- childList: true
3462
- });
3463
- return function () {
3464
- remove();
3465
- observer.disconnect();
3466
- };
3467
- }
3468
- }, [active, force]);
3469
- if (active) {
3470
- var rect = {
3471
- border: '1px solid red',
3472
- display: 'none',
3473
- position: 'absolute',
3474
- top: 0,
3475
- bottom: 0,
3476
- right: 0,
3477
- left: 0,
3478
- zIndex: 99999999999,
3479
- pointerEvents: 'none',
3480
- borderColor: color
3481
- };
3482
- var info = {
3483
- color: 'white',
3484
- position: 'absolute',
3485
- right: 0,
3486
- top: 0,
3487
- fontSize: '8px',
3488
- background: color
3489
- };
3490
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", {
3491
- style: rect,
3492
- ref: container
3493
- }, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement("div", {
3494
- style: info
3495
- }, pilet));
3496
- }
3497
- // tslint:disable-next-line:no-null-keyword
3498
- return null;
3499
- };
3500
- var VisualizationWrapper = function VisualizationWrapper(_ref2) {
3501
- var piral = _ref2.piral,
3502
- children = _ref2.children;
3503
- var _useDebugState = (0,_state__WEBPACK_IMPORTED_MODULE_1__.useDebugState)(function (m) {
3504
- return m.visualize;
3505
- }),
3506
- active = _useDebugState.active,
3507
- force = _useDebugState.force;
3508
- return /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, /*#__PURE__*/react__WEBPACK_IMPORTED_MODULE_0__.createElement(Visualizer, {
3509
- pilet: piral.meta.name,
3510
- force: force,
3511
- active: active
3512
- }), children);
3513
- };
3514
-
3515
- /***/ }),
3516
-
3517
3411
  /***/ "../../utilities/piral-debug-utils/esm/debug.js":
3518
3412
  /*!******************************************************!*\
3519
3413
  !*** ../../utilities/piral-debug-utils/esm/debug.js ***!
@@ -3525,10 +3419,9 @@ __webpack_require__.r(__webpack_exports__);
3525
3419
  /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3526
3420
  /* harmony export */ installPiralDebug: () => (/* binding */ installPiralDebug)
3527
3421
  /* harmony export */ });
3528
- /* harmony import */ var _DebugTracker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./DebugTracker */ "../../utilities/piral-debug-utils/esm/DebugTracker.js");
3529
- /* harmony import */ var _VisualizationWrapper__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./VisualizationWrapper */ "../../utilities/piral-debug-utils/esm/VisualizationWrapper.js");
3530
3422
  /* harmony import */ var _ExtensionCatalogue__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./ExtensionCatalogue */ "../../utilities/piral-debug-utils/esm/ExtensionCatalogue.js");
3531
- /* harmony import */ var _decycle__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./decycle */ "../../utilities/piral-debug-utils/esm/decycle.js");
3423
+ /* harmony import */ var _decycle__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./decycle */ "../../utilities/piral-debug-utils/esm/decycle.js");
3424
+ /* harmony import */ var _visualizer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./visualizer */ "../../utilities/piral-debug-utils/esm/visualizer.js");
3532
3425
  /* harmony import */ var _state__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./state */ "../../utilities/piral-debug-utils/esm/state.js");
3533
3426
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3534
3427
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
@@ -3540,7 +3433,6 @@ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input ==
3540
3433
 
3541
3434
 
3542
3435
 
3543
-
3544
3436
  function installPiralDebug(options) {
3545
3437
  var getGlobalState = options.getGlobalState,
3546
3438
  getExtensions = options.getExtensions,
@@ -3564,7 +3456,6 @@ function installPiralDebug(options) {
3564
3456
  var selfSource = 'piral-debug-api';
3565
3457
  var debugApiVersion = 'v1';
3566
3458
  var setValue = _state__WEBPACK_IMPORTED_MODULE_0__.initialSetter;
3567
- (0,_state__WEBPACK_IMPORTED_MODULE_0__.setInitialState)(initialSettings);
3568
3459
  var settings = _objectSpread(_objectSpread({}, customSettings), {}, {
3569
3460
  viewState: {
3570
3461
  value: initialSettings.viewState,
@@ -3626,6 +3517,9 @@ function installPiralDebug(options) {
3626
3517
  }
3627
3518
  }
3628
3519
  });
3520
+ if (initialSettings.viewOrigins) {
3521
+ (0,_visualizer__WEBPACK_IMPORTED_MODULE_1__.createVisualizer)();
3522
+ }
3629
3523
  var sendMessage = function sendMessage(content) {
3630
3524
  window.postMessage({
3631
3525
  content: content,
@@ -3705,33 +3599,12 @@ function installPiralDebug(options) {
3705
3599
  });
3706
3600
  }
3707
3601
  };
3708
- var toggleVisualize = function toggleVisualize() {
3709
- (0,_state__WEBPACK_IMPORTED_MODULE_0__.setState)(function (s) {
3710
- return _objectSpread(_objectSpread({}, s), {}, {
3711
- visualize: _objectSpread(_objectSpread({}, s.visualize), {}, {
3712
- force: !s.visualize.force
3713
- })
3714
- });
3715
- });
3716
- };
3717
3602
  var updateVisualize = function updateVisualize(active) {
3718
- (0,_state__WEBPACK_IMPORTED_MODULE_0__.setState)(function (s) {
3719
- return _objectSpread(_objectSpread({}, s), {}, {
3720
- visualize: _objectSpread(_objectSpread({}, s.visualize), {}, {
3721
- active: active
3722
- })
3723
- });
3724
- });
3725
- };
3726
- var goToRoute = function goToRoute(path, state) {
3727
- (0,_state__WEBPACK_IMPORTED_MODULE_0__.setState)(function (s) {
3728
- return _objectSpread(_objectSpread({}, s), {}, {
3729
- route: {
3730
- path: path,
3731
- state: state
3732
- }
3733
- });
3734
- });
3603
+ if (active) {
3604
+ (0,_visualizer__WEBPACK_IMPORTED_MODULE_1__.createVisualizer)();
3605
+ } else {
3606
+ (0,_visualizer__WEBPACK_IMPORTED_MODULE_1__.destroyVisualizer)();
3607
+ }
3735
3608
  };
3736
3609
  var eventDispatcher = document.body.dispatchEvent;
3737
3610
  var systemResolve = System.constructor.prototype.resolve;
@@ -3767,12 +3640,12 @@ function installPiralDebug(options) {
3767
3640
  debug: debugApiVersion,
3768
3641
  instance: {
3769
3642
  name: "minimal-piral",
3770
- version: "1.4.0-beta.6280",
3643
+ version: "1.4.0-beta.6287",
3771
3644
  dependencies: "tslib,react,react-dom,react-router,react-router-dom"
3772
3645
  },
3773
3646
  build: {
3774
- date: "2023-11-29T17:17:07.546Z",
3775
- cli: "1.4.0-beta.6280",
3647
+ date: "2023-12-01T10:56:35.368Z",
3648
+ cli: "1.4.0-beta.6287",
3776
3649
  compat: "1"
3777
3650
  }
3778
3651
  };
@@ -3784,7 +3657,7 @@ function installPiralDebug(options) {
3784
3657
  capabilities: ['events', 'container', 'routes', 'pilets', 'settings', 'extensions', 'dependencies', 'dependency-map']
3785
3658
  };
3786
3659
  var start = function start() {
3787
- var container = (0,_decycle__WEBPACK_IMPORTED_MODULE_1__.decycle)(getGlobalState());
3660
+ var container = (0,_decycle__WEBPACK_IMPORTED_MODULE_2__.decycle)(getGlobalState());
3788
3661
  var routes = getRoutes().filter(function (r) {
3789
3662
  return !excludedRoutes.includes(r);
3790
3663
  });
@@ -3872,7 +3745,7 @@ function installPiralDebug(options) {
3872
3745
  events.unshift({
3873
3746
  id: events.length.toString(),
3874
3747
  name: ev.type.replace('piral-', ''),
3875
- args: (0,_decycle__WEBPACK_IMPORTED_MODULE_1__.decycle)(ev.detail.arg),
3748
+ args: (0,_decycle__WEBPACK_IMPORTED_MODULE_2__.decycle)(ev.detail.arg),
3876
3749
  time: Date.now()
3877
3750
  });
3878
3751
  sendMessage({
@@ -3919,21 +3792,14 @@ function installPiralDebug(options) {
3919
3792
  case 'emit-event':
3920
3793
  return fireEvent(content.name, content.args);
3921
3794
  case 'goto-route':
3922
- return goToRoute(content.route, content.state);
3795
+ return navigate(content.route, content.state);
3923
3796
  case 'visualize-all':
3924
- return toggleVisualize();
3797
+ return (0,_visualizer__WEBPACK_IMPORTED_MODULE_1__.toggleVisualizer)();
3925
3798
  }
3926
3799
  }
3927
3800
  });
3928
- (0,_state__WEBPACK_IMPORTED_MODULE_0__.setNavigate)(navigate);
3929
3801
  integrate({
3930
- components: {
3931
- Debug: _DebugTracker__WEBPACK_IMPORTED_MODULE_2__.DebugTracker
3932
- },
3933
3802
  routes: _defineProperty({}, initialSettings.cataloguePath, _ExtensionCatalogue__WEBPACK_IMPORTED_MODULE_3__.ExtensionCatalogue),
3934
- wrappers: {
3935
- '*': _VisualizationWrapper__WEBPACK_IMPORTED_MODULE_4__.VisualizationWrapper
3936
- },
3937
3803
  onChange: function onChange(previous, current, changed) {
3938
3804
  if (changed.state) {
3939
3805
  if (settings.viewState.value) {
@@ -3956,7 +3822,7 @@ function installPiralDebug(options) {
3956
3822
  }
3957
3823
  sendMessage({
3958
3824
  type: 'container',
3959
- container: (0,_decycle__WEBPACK_IMPORTED_MODULE_1__.decycle)(getGlobalState())
3825
+ container: (0,_decycle__WEBPACK_IMPORTED_MODULE_2__.decycle)(getGlobalState())
3960
3826
  });
3961
3827
  }
3962
3828
  if (changed.pilets) {
@@ -4203,25 +4069,9 @@ __webpack_require__.r(__webpack_exports__);
4203
4069
  /* harmony export */ disablePersistance: () => (/* binding */ disablePersistance),
4204
4070
  /* harmony export */ enablePersistance: () => (/* binding */ enablePersistance),
4205
4071
  /* harmony export */ getInitialSettings: () => (/* binding */ getInitialSettings),
4206
- /* harmony export */ getState: () => (/* binding */ getState),
4207
4072
  /* harmony export */ initialSetter: () => (/* binding */ initialSetter),
4208
- /* harmony export */ navigate: () => (/* binding */ navigate),
4209
- /* harmony export */ setInitialState: () => (/* binding */ setInitialState),
4210
- /* harmony export */ setNavigate: () => (/* binding */ setNavigate),
4211
- /* harmony export */ setState: () => (/* binding */ setState),
4212
- /* harmony export */ settingsKeys: () => (/* binding */ settingsKeys),
4213
- /* harmony export */ subscribe: () => (/* binding */ subscribe),
4214
- /* harmony export */ useDebugState: () => (/* binding */ useDebugState)
4073
+ /* harmony export */ settingsKeys: () => (/* binding */ settingsKeys)
4215
4074
  /* harmony export */ });
4216
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "../../../node_modules/react/index.js");
4217
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
4218
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4219
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4220
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
4221
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
4222
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
4223
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
4224
-
4225
4075
  var settingsKeys = {
4226
4076
  viewState: 'dbg:view-state',
4227
4077
  loadPilets: 'dbg:load-pilets',
@@ -4296,73 +4146,6 @@ function getInitialSettings(defaultValues) {
4296
4146
  cataloguePath: '/$debug-extension-catalogue'
4297
4147
  };
4298
4148
  }
4299
- var listeners = [];
4300
- var _navigate = undefined;
4301
- function setNavigate(navigate) {
4302
- _navigate = navigate;
4303
- }
4304
- function navigate(path, state) {
4305
- var _navigate2;
4306
- (_navigate2 = _navigate) === null || _navigate2 === void 0 || _navigate2(path, state);
4307
- }
4308
- var state = {
4309
- visualize: {
4310
- active: false,
4311
- force: false
4312
- },
4313
- catalogue: {
4314
- active: false,
4315
- path: ''
4316
- },
4317
- route: undefined
4318
- };
4319
- function setInitialState(initialSettings) {
4320
- state.visualize.active = initialSettings.viewOrigins;
4321
- state.catalogue.active = initialSettings.extensionCatalogue;
4322
- state.catalogue.path = initialSettings.cataloguePath;
4323
- }
4324
- function setState(dispatch) {
4325
- var newState = dispatch(state);
4326
- if (newState !== state) {
4327
- state = newState;
4328
- listeners.forEach(function (listener) {
4329
- return listener();
4330
- });
4331
- }
4332
- }
4333
- function getState() {
4334
- return state;
4335
- }
4336
- function subscribe(select, notify) {
4337
- var prevState = select(state);
4338
- var cb = function cb() {
4339
- var nextState = select(state);
4340
- if (prevState !== nextState) {
4341
- prevState = nextState;
4342
- notify(nextState);
4343
- }
4344
- };
4345
- var unsubscribe = function unsubscribe() {
4346
- var idx = listeners.indexOf(cb);
4347
- if (idx !== -1) {
4348
- listeners.splice(idx, 1);
4349
- }
4350
- };
4351
- listeners.push(cb);
4352
- return unsubscribe;
4353
- }
4354
- function useDebugState(select) {
4355
- var _useState = (0,react__WEBPACK_IMPORTED_MODULE_0__.useState)(function () {
4356
- return select(getState());
4357
- }),
4358
- _useState2 = _slicedToArray(_useState, 2),
4359
- state = _useState2[0],
4360
- setState = _useState2[1];
4361
- (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(function () {
4362
- return subscribe(select, setState);
4363
- }, []);
4364
- return state;
4365
- }
4366
4149
 
4367
4150
  /***/ }),
4368
4151
 
@@ -4407,6 +4190,186 @@ function useDebugRouteFilter(paths) {
4407
4190
 
4408
4191
  /***/ }),
4409
4192
 
4193
+ /***/ "../../utilities/piral-debug-utils/esm/visualizer.js":
4194
+ /*!***********************************************************!*\
4195
+ !*** ../../utilities/piral-debug-utils/esm/visualizer.js ***!
4196
+ \***********************************************************/
4197
+ /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
4198
+
4199
+ "use strict";
4200
+ __webpack_require__.r(__webpack_exports__);
4201
+ /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4202
+ /* harmony export */ createVisualizer: () => (/* binding */ createVisualizer),
4203
+ /* harmony export */ destroyVisualizer: () => (/* binding */ destroyVisualizer),
4204
+ /* harmony export */ toggleVisualizer: () => (/* binding */ toggleVisualizer)
4205
+ /* harmony export */ });
4206
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4207
+ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4208
+ function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
4209
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
4210
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
4211
+ function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
4212
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
4213
+ function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
4214
+ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
4215
+ function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
4216
+ function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
4217
+ function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
4218
+ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
4219
+ function _isNativeFunction(fn) { try { return Function.toString.call(fn).indexOf("[native code]") !== -1; } catch (e) { return typeof fn === "function"; } }
4220
+ function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
4221
+ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
4222
+ var visualizerName = 'piral-inspector-visualizer';
4223
+ var persistAttribute = 'persist';
4224
+ var piletColorMap = {};
4225
+ var colors = ['#001F3F', '#0074D9', '#7FDBFF', '#39CCCC', '#3D9970', '#2ECC40', '#01FF70', '#FFDC00', '#FF851B', '#FF4136', '#85144B', '#F012BE', '#B10DC9'];
4226
+ function getTarget(element) {
4227
+ var row = element.childNodes;
4228
+ var rects = Array.prototype.map.call(row, function (item) {
4229
+ if (item instanceof Element) {
4230
+ return item.getBoundingClientRect();
4231
+ } else if (item instanceof Text) {
4232
+ var range = document.createRange();
4233
+ range.selectNode(item);
4234
+ return range.getBoundingClientRect();
4235
+ } else {
4236
+ return new DOMRectReadOnly(0, 0, 0, 0);
4237
+ }
4238
+ });
4239
+ var relevant = rects.filter(function (m) {
4240
+ return m.height !== 0 && m.width !== 0;
4241
+ });
4242
+ if (relevant.length === 0) {
4243
+ return new DOMRectReadOnly(0, 0, 0, 0);
4244
+ }
4245
+ return relevant.reduce(function (a, b) {
4246
+ var x = Math.min(a.left, b.left);
4247
+ var y = Math.min(a.top, b.top);
4248
+ var width = Math.max(a.right, b.right) - x;
4249
+ var height = Math.max(a.bottom, b.bottom) - y;
4250
+ return new DOMRectReadOnly(x, y, width, height);
4251
+ });
4252
+ }
4253
+ function hide(vis) {
4254
+ vis.style.opacity = '0';
4255
+ // vis.style.pointerEvents = 'auto';
4256
+ }
4257
+
4258
+ function show(vis) {
4259
+ vis.style.opacity = '1';
4260
+ // vis.style.pointerEvents = 'none';
4261
+ }
4262
+
4263
+ function updatePosition(source, vis) {
4264
+ var targetRect = getTarget(source);
4265
+ vis.style.left = targetRect.left + 'px';
4266
+ vis.style.top = targetRect.top + 'px';
4267
+ vis.style.width = targetRect.width + 'px';
4268
+ vis.style.height = targetRect.height + 'px';
4269
+ }
4270
+ var PiralInspectorVisualizer = /*#__PURE__*/function (_HTMLElement) {
4271
+ _inherits(PiralInspectorVisualizer, _HTMLElement);
4272
+ var _super = _createSuper(PiralInspectorVisualizer);
4273
+ function PiralInspectorVisualizer() {
4274
+ var _this;
4275
+ _classCallCheck(this, PiralInspectorVisualizer);
4276
+ _this = _super.apply(this, arguments);
4277
+ _this.update = function () {
4278
+ var persist = _this.getAttribute(persistAttribute) !== null;
4279
+ _this.innerText = '';
4280
+ document.querySelectorAll('piral-component').forEach(function (element) {
4281
+ var pilet = element.getAttribute('origin');
4282
+ var vis = _this.appendChild(document.createElement('div'));
4283
+ var info = vis.appendChild(document.createElement('div'));
4284
+ vis.style.position = 'absolute';
4285
+ vis.style.zIndex = '2147483647';
4286
+ vis.style.border = '1px solid #ccc';
4287
+ vis.style.pointerEvents = 'none';
4288
+ info.style.color = 'white';
4289
+ info.textContent = pilet;
4290
+ info.style.position = 'absolute';
4291
+ info.style.right = '0';
4292
+ info.style.top = '0';
4293
+ info.style.fontSize = '8px';
4294
+ info.style.background = piletColorMap[pilet] || (piletColorMap[pilet] = colors[Object.keys(piletColorMap).length % colors.length]);
4295
+ if (!persist) {
4296
+ hide(vis);
4297
+ element.addEventListener('mouseenter', function () {
4298
+ updatePosition(element, vis);
4299
+ show(vis);
4300
+ });
4301
+ element.addEventListener('mouseleave', function () {
4302
+ hide(vis);
4303
+ });
4304
+ } else {
4305
+ updatePosition(element, vis);
4306
+ show(vis);
4307
+ }
4308
+ });
4309
+ };
4310
+ return _this;
4311
+ }
4312
+ _createClass(PiralInspectorVisualizer, [{
4313
+ key: "connectedCallback",
4314
+ value: function connectedCallback() {
4315
+ this.style.position = 'absolute';
4316
+ this.style.top = '0';
4317
+ this.style.left = '0';
4318
+ this.style.width = '0';
4319
+ this.style.height = '0';
4320
+ window.addEventListener('resize', this.update);
4321
+ window.addEventListener('add-component', this.update);
4322
+ window.addEventListener('remove-component', this.update);
4323
+ this.update();
4324
+ }
4325
+ }, {
4326
+ key: "disconnectedCallback",
4327
+ value: function disconnectedCallback() {
4328
+ window.removeEventListener('resize', this.update);
4329
+ window.removeEventListener('add-component', this.update);
4330
+ window.removeEventListener('remove-component', this.update);
4331
+ }
4332
+ }, {
4333
+ key: "attributeChangedCallback",
4334
+ value: function attributeChangedCallback(name, oldValue, newValue) {
4335
+ if (name === persistAttribute && oldValue !== newValue) {
4336
+ this.update();
4337
+ }
4338
+ }
4339
+ }], [{
4340
+ key: "observedAttributes",
4341
+ get: function get() {
4342
+ return [persistAttribute];
4343
+ }
4344
+ }]);
4345
+ return PiralInspectorVisualizer;
4346
+ }( /*#__PURE__*/_wrapNativeSuper(HTMLElement));
4347
+ customElements.define(visualizerName, PiralInspectorVisualizer);
4348
+ function createVisualizer() {
4349
+ var visualizer = document.querySelector(visualizerName);
4350
+ if (!visualizer) {
4351
+ document.body.appendChild(document.createElement(visualizerName));
4352
+ }
4353
+ }
4354
+ function destroyVisualizer() {
4355
+ var visualizer = document.querySelector(visualizerName);
4356
+ if (visualizer) {
4357
+ visualizer.remove();
4358
+ }
4359
+ }
4360
+ function toggleVisualizer() {
4361
+ var visualizer = document.querySelector(visualizerName);
4362
+ if (visualizer) {
4363
+ if (visualizer.getAttribute(persistAttribute) !== null) {
4364
+ visualizer.removeAttribute(persistAttribute);
4365
+ } else {
4366
+ visualizer.setAttribute(persistAttribute, '');
4367
+ }
4368
+ }
4369
+ }
4370
+
4371
+ /***/ }),
4372
+
4410
4373
  /***/ "../../../node_modules/history/esm/history.js":
4411
4374
  /*!****************************************************!*\
4412
4375
  !*** ../../../node_modules/history/esm/history.js ***!
@@ -5648,6 +5611,7 @@ __webpack_require__.r(__webpack_exports__);
5648
5611
  app: {
5649
5612
  error: undefined,
5650
5613
  loading: typeof window !== 'undefined',
5614
+ wrap: true,
5651
5615
  },
5652
5616
  components: {
5653
5617
  ErrorInfo: piral_core_defaults_DefaultErrorInfo__WEBPACK_IMPORTED_MODULE_6__.DefaultErrorInfo,
@@ -44673,4 +44637,4 @@ var instance = (0,piral_core__WEBPACK_IMPORTED_MODULE_2__.createInstance)({
44673
44637
 
44674
44638
  /******/ })()
44675
44639
  ;
44676
- //# sourceMappingURL=index.adc047.js.map
44640
+ //# sourceMappingURL=index.1b8d53.js.map