| 1 |
/******/ (function() { // webpackBootstrap |
| 2 |
/******/ "use strict"; |
| 3 |
/******/ // The require scope |
| 4 |
/******/ var __webpack_require__ = {}; |
| 5 |
/******/ |
| 6 |
/************************************************************************/ |
| 7 |
/******/ /* webpack/runtime/define property getters */ |
| 8 |
/******/ !function() { |
| 9 |
/******/ // define getter functions for harmony exports |
| 10 |
/******/ __webpack_require__.d = function(exports, definition) { |
| 11 |
/******/ for(var key in definition) { |
| 12 |
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { |
| 13 |
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); |
| 14 |
/******/ } |
| 15 |
/******/ } |
| 16 |
/******/ }; |
| 17 |
/******/ }(); |
| 18 |
/******/ |
| 19 |
/******/ /* webpack/runtime/hasOwnProperty shorthand */ |
| 20 |
/******/ !function() { |
| 21 |
/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } |
| 22 |
/******/ }(); |
| 23 |
/******/ |
| 24 |
/******/ /* webpack/runtime/make namespace object */ |
| 25 |
/******/ !function() { |
| 26 |
/******/ // define __esModule on exports |
| 27 |
/******/ __webpack_require__.r = function(exports) { |
| 28 |
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { |
| 29 |
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); |
| 30 |
/******/ } |
| 31 |
/******/ Object.defineProperty(exports, '__esModule', { value: true }); |
| 32 |
/******/ }; |
| 33 |
/******/ }(); |
| 34 |
/******/ |
| 35 |
/************************************************************************/ |
| 36 |
var __webpack_exports__ = {}; |
| 37 |
// ESM COMPAT FLAG |
| 38 |
__webpack_require__.r(__webpack_exports__); |
| 39 |
|
| 40 |
// EXPORTS |
| 41 |
__webpack_require__.d(__webpack_exports__, { |
| 42 |
"Slot": function() { return /* reexport */ Slot; }, |
| 43 |
"createInjectorFor": function() { return /* reexport */ createInjectorFor; }, |
| 44 |
"flushInjections": function() { return /* reexport */ flushInjections; }, |
| 45 |
"getInjectionsOf": function() { return /* reexport */ getInjectionsOf; }, |
| 46 |
"inject": function() { return /* reexport */ inject; }, |
| 47 |
"useInjectionsOf": function() { return /* reexport */ useInjectionsOf; } |
| 48 |
}); |
| 49 |
|
| 50 |
;// CONCATENATED MODULE: external "React" |
| 51 |
var external_React_namespaceObject = React; |
| 52 |
;// CONCATENATED MODULE: ./packages/locations/src/components/error-boundary.tsx |
| 53 |
|
| 54 |
class ErrorBoundary extends external_React_namespaceObject.Component { |
| 55 |
state = { |
| 56 |
hasError: false |
| 57 |
}; |
| 58 |
static getDerivedStateFromError() { |
| 59 |
// Update state so the next render will show the fallback UI. |
| 60 |
return { |
| 61 |
hasError: true |
| 62 |
}; |
| 63 |
} |
| 64 |
render() { |
| 65 |
if (this.state.hasError) { |
| 66 |
return this.props.fallback; |
| 67 |
} |
| 68 |
return this.props.children; |
| 69 |
} |
| 70 |
} |
| 71 |
;// CONCATENATED MODULE: ./packages/locations/src/components/filler-wrapper.tsx |
| 72 |
|
| 73 |
|
| 74 |
function FillerWrapper({ |
| 75 |
children |
| 76 |
}) { |
| 77 |
return /*#__PURE__*/React.createElement(ErrorBoundary, { |
| 78 |
fallback: null |
| 79 |
}, /*#__PURE__*/React.createElement(external_React_namespaceObject.Suspense, { |
| 80 |
fallback: null |
| 81 |
}, children)); |
| 82 |
} |
| 83 |
;// CONCATENATED MODULE: ./packages/locations/src/injections.tsx |
| 84 |
|
| 85 |
const DEFAULT_PRIORITY = 10; |
| 86 |
const injections = new Map(); |
| 87 |
function inject({ |
| 88 |
location, |
| 89 |
filler, |
| 90 |
name, |
| 91 |
options = {} |
| 92 |
}) { |
| 93 |
const id = generateId(location, name); |
| 94 |
if (injections.has(id) && !options?.overwrite) { |
| 95 |
// eslint-disable-next-line no-console |
| 96 |
console.error(`An injection named "${name}" under location "${location}" already exists. Did you mean to use "options.overwrite"?`); |
| 97 |
return; |
| 98 |
} |
| 99 |
const injection = { |
| 100 |
id, |
| 101 |
location, |
| 102 |
filler: wrapFiller(filler), |
| 103 |
priority: options.priority ?? DEFAULT_PRIORITY |
| 104 |
}; |
| 105 |
injections.set(id, injection); |
| 106 |
} |
| 107 |
function createInjectorFor(location) { |
| 108 |
return ({ |
| 109 |
filler, |
| 110 |
name, |
| 111 |
options |
| 112 |
}) => { |
| 113 |
return inject({ |
| 114 |
location, |
| 115 |
name, |
| 116 |
filler, |
| 117 |
options |
| 118 |
}); |
| 119 |
}; |
| 120 |
} |
| 121 |
function getInjectionsOf(location) { |
| 122 |
return [...injections.values()].filter(injection => injection.location === location).sort((a, b) => a.priority - b.priority); |
| 123 |
} |
| 124 |
function flushInjections() { |
| 125 |
injections.clear(); |
| 126 |
} |
| 127 |
function wrapFiller(FillerComponent) { |
| 128 |
return props => /*#__PURE__*/React.createElement(FillerWrapper, null, /*#__PURE__*/React.createElement(FillerComponent, props)); |
| 129 |
} |
| 130 |
function generateId(location, name) { |
| 131 |
return `${location}::${name}`; |
| 132 |
} |
| 133 |
;// CONCATENATED MODULE: ./packages/locations/src/hooks/use-injections-of.ts |
| 134 |
|
| 135 |
|
| 136 |
function useInjectionsOf(locations) { |
| 137 |
return (0,external_React_namespaceObject.useMemo)(() => { |
| 138 |
if (Array.isArray(locations)) { |
| 139 |
return locations.map(location => getInjectionsOf(location)); |
| 140 |
} |
| 141 |
return getInjectionsOf(locations); |
| 142 |
}, [locations]); |
| 143 |
} |
| 144 |
;// CONCATENATED MODULE: ./packages/locations/src/components/slot.tsx |
| 145 |
|
| 146 |
|
| 147 |
function Slot({ |
| 148 |
location |
| 149 |
}) { |
| 150 |
const injections = useInjectionsOf(location); |
| 151 |
return /*#__PURE__*/external_React_namespaceObject.createElement(external_React_namespaceObject.Fragment, null, injections.map(({ |
| 152 |
id, |
| 153 |
filler: Filler |
| 154 |
}) => /*#__PURE__*/external_React_namespaceObject.createElement(Filler, { |
| 155 |
key: id |
| 156 |
}))); |
| 157 |
} |
| 158 |
;// CONCATENATED MODULE: ./packages/locations/src/index.ts |
| 159 |
|
| 160 |
|
| 161 |
|
| 162 |
|
| 163 |
(window.__UNSTABLE__elementorPackages = window.__UNSTABLE__elementorPackages || {}).locations = __webpack_exports__; |
| 164 |
/******/ })() |
| 165 |
; |