PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.1
Elementor Website Builder – more than just a page builder v4.3.1
4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 All 454 releases
elementor / assets / js / packages / locations / locations.js

locations.js in Elementor Website Builder – more than just a page builder 4.3.1, at assets/js/packages/locations/locations.js

214 lines 6.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 (function(react) {
2
3 //#region \0rolldown/runtime.js
4 var __create = Object.create;
5 var __defProp$1 = Object.defineProperty;
6 var __name = (target, value) => __defProp$1(target, "name", {
7 value,
8 configurable: true
9 });
10 var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
11 var __getOwnPropNames = Object.getOwnPropertyNames;
12 var __getProtoOf = Object.getPrototypeOf;
13 var __hasOwnProp = Object.prototype.hasOwnProperty;
14 var __exportAll = (all, no_symbols) => {
15 let target = {};
16 for (var name in all) {
17 __defProp$1(target, name, {
18 get: all[name],
19 enumerable: true
20 });
21 }
22 if (!no_symbols) {
23 __defProp$1(target, Symbol.toStringTag, { value: "Module" });
24 }
25 return target;
26 };
27 var __copyProps = (to, from, except, desc) => {
28 if (from && typeof from === "object" || typeof from === "function") {
29 for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
30 key = keys[i];
31 if (!__hasOwnProp.call(to, key) && key !== except) {
32 __defProp$1(to, key, {
33 get: ((k) => from[k]).bind(null, key),
34 enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
35 });
36 }
37 }
38 }
39 return to;
40 };
41 var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp$1(target, "default", {
42 value: mod,
43 enumerable: true
44 }) : target, mod));
45
46 //#endregion
47 react = __toESM(react);
48
49 //#region packages/packages/libs/locations/src/components/error-boundary.tsx
50 var __defProp = Object.defineProperty;
51 var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
52 enumerable: true,
53 configurable: true,
54 writable: true,
55 value
56 }) : obj[key] = value;
57 var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
58 var ErrorBoundary = class extends react.Component {
59 constructor() {
60 super(...arguments);
61 __publicField(this, "state", { hasError: false });
62 }
63 static getDerivedStateFromError() {
64 return { hasError: true };
65 }
66 render() {
67 if (this.state.hasError) return this.props.fallback;
68 return this.props.children;
69 }
70 };
71
72 //#endregion
73 //#region packages/packages/libs/locations/src/components/injected-component-wrapper.tsx
74 function InjectedComponentWrapper({ children }) {
75 return /* @__PURE__ */ react.createElement(ErrorBoundary, { fallback: null }, /* @__PURE__ */ react.createElement(react.Suspense, { fallback: null }, children));
76 }
77
78 //#endregion
79 //#region packages/packages/libs/locations/src/injections.tsx
80 var flushInjectionsFns = [];
81 function flushAllInjections() {
82 flushInjectionsFns.forEach((flush) => flush());
83 }
84 function registerFlushInjections(flush) {
85 flushInjectionsFns.push(flush);
86 }
87 function createSubscription() {
88 const listeners = /* @__PURE__ */ new Set();
89 return {
90 subscribe: (listener) => {
91 listeners.add(listener);
92 return () => listeners.delete(listener);
93 },
94 notify: () => listeners.forEach((listener) => listener())
95 };
96 }
97 function createGetInjections(injections) {
98 return () => [...injections.values()].sort((a, b) => a.priority - b.priority);
99 }
100 function createUseInjections(getInjections, subscribe) {
101 let snapshot = null;
102 subscribe(() => {
103 snapshot = null;
104 });
105 const getSnapshot = () => {
106 if (!snapshot) snapshot = getInjections();
107 return snapshot;
108 };
109 return () => (0, react.useSyncExternalStore)(subscribe, getSnapshot);
110 }
111 function wrapInjectedComponent(Component) {
112 return (props) => /* @__PURE__ */ react.createElement(InjectedComponentWrapper, null, /* @__PURE__ */ react.createElement(Component, { ...props }));
113 }
114
115 //#endregion
116 //#region packages/packages/libs/locations/src/create-location.tsx
117 function createLocation() {
118 const injections = /* @__PURE__ */ new Map();
119 const { subscribe, notify } = createSubscription();
120 const getInjections = createGetInjections(injections);
121 const useInjections = createUseInjections(getInjections, subscribe);
122 const Slot = createSlot(useInjections);
123 const inject = createInject(injections, notify);
124 flushInjectionsFns.push(() => {
125 injections.clear();
126 notify();
127 });
128 return {
129 inject,
130 getInjections,
131 useInjections,
132 Slot
133 };
134 }
135 function createSlot(useInjections) {
136 return (props) => {
137 const injections = useInjections();
138 return /* @__PURE__ */ react.createElement(react.Fragment, null, injections.map(({ id, component: Component }) => /* @__PURE__ */ react.createElement(Component, {
139 ...props,
140 key: id
141 })));
142 };
143 }
144 function createInject(injections, notify) {
145 return ({ component, id, options = {} }) => {
146 if (injections.has(id) && !options?.overwrite) {
147 console.warn(`An injection with the id "${id}" already exists. Did you mean to use "options.overwrite"?`);
148 return;
149 }
150 injections.set(id, {
151 id,
152 component: wrapInjectedComponent(component),
153 priority: options.priority ?? 10
154 });
155 notify();
156 };
157 }
158
159 //#endregion
160 //#region packages/packages/libs/locations/src/create-replaceable-location.tsx
161 function createReplaceableLocation() {
162 const injections = /* @__PURE__ */ new Map();
163 const { subscribe, notify } = createSubscription();
164 const getInjections = createGetInjections(injections);
165 const useInjections = createUseInjections(getInjections, subscribe);
166 const Slot = createReplaceable(useInjections);
167 const inject = createRegister(injections, notify);
168 flushInjectionsFns.push(() => {
169 injections.clear();
170 notify();
171 });
172 return {
173 getInjections,
174 useInjections,
175 inject,
176 Slot
177 };
178 }
179 function createReplaceable(useInjections) {
180 return (props) => {
181 const { component: Component } = useInjections().find(({ condition }) => condition?.(props)) ?? {};
182 if (!Component) return props.children;
183 return /* @__PURE__ */ react.createElement(Component, { ...props });
184 };
185 }
186 function createRegister(injections, notify) {
187 return ({ component, id, condition = () => true, options = {} }) => {
188 injections.set(id, {
189 id,
190 component: wrapInjectedComponent(component),
191 condition,
192 priority: options.priority ?? 10
193 });
194 notify();
195 };
196 }
197
198 //#endregion
199 //#region packages/packages/libs/locations/src/index.ts
200 var src_exports = /* @__PURE__ */ __exportAll({
201 __flushAllInjections: () => flushAllInjections,
202 __registerFlushInjections: () => registerFlushInjections,
203 createLocation: () => createLocation,
204 createReplaceableLocation: () => createReplaceableLocation
205 });
206
207 //#endregion
208 //#region \0elementor-package-library-entry
209 (window.elementorV2 = window.elementorV2 || {}).locations = src_exports;
210
211 //#endregion
212 })(React);
213 window.elementorV2.locations?.init?.();
214 //# sourceMappingURL=locations.js.map