@makeswift/runtime 0.0.0-018e17a

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.
Files changed (87) hide show
  1. package/dist/actions.cjs.js +91 -0
  2. package/dist/actions.cjs.js.map +1 -0
  3. package/dist/actions.es.js +80 -0
  4. package/dist/actions.es.js.map +1 -0
  5. package/dist/box-model.cjs.js +9 -0
  6. package/dist/box-model.cjs.js.map +1 -0
  7. package/dist/box-model.es.js +3 -0
  8. package/dist/box-model.es.js.map +1 -0
  9. package/dist/box-models.cjs.js +236 -0
  10. package/dist/box-models.cjs.js.map +1 -0
  11. package/dist/box-models.es.js +227 -0
  12. package/dist/box-models.es.js.map +1 -0
  13. package/dist/components.cjs.js +305 -0
  14. package/dist/components.cjs.js.map +1 -0
  15. package/dist/components.es.js +298 -0
  16. package/dist/components.es.js.map +1 -0
  17. package/dist/main.cjs.js +8 -0
  18. package/dist/main.cjs.js.map +1 -0
  19. package/dist/main.es.js +2 -0
  20. package/dist/main.es.js.map +1 -0
  21. package/dist/prop-controllers.cjs.js +177 -0
  22. package/dist/prop-controllers.cjs.js.map +1 -0
  23. package/dist/prop-controllers.es.js +174 -0
  24. package/dist/prop-controllers.es.js.map +1 -0
  25. package/dist/react-builder-preview.cjs.js +4301 -0
  26. package/dist/react-builder-preview.cjs.js.map +1 -0
  27. package/dist/react-builder-preview.es.js +4294 -0
  28. package/dist/react-builder-preview.es.js.map +1 -0
  29. package/dist/react.cjs.js +13 -0
  30. package/dist/react.cjs.js.map +1 -0
  31. package/dist/react.cjs2.js +835 -0
  32. package/dist/react.cjs2.js.map +1 -0
  33. package/dist/react.es.js +4 -0
  34. package/dist/react.es.js.map +1 -0
  35. package/dist/react.es2.js +810 -0
  36. package/dist/react.es2.js.map +1 -0
  37. package/dist/types/box-model.d.ts +3 -0
  38. package/dist/types/box-model.d.ts.map +1 -0
  39. package/dist/types/components/Root/Root.d.ts +11 -0
  40. package/dist/types/components/Root/Root.d.ts.map +1 -0
  41. package/dist/types/components/Root/components/Placeholder/index.d.ts +5 -0
  42. package/dist/types/components/Root/components/Placeholder/index.d.ts.map +1 -0
  43. package/dist/types/components/Root/index.d.ts +2 -0
  44. package/dist/types/components/Root/index.d.ts.map +1 -0
  45. package/dist/types/components/index.d.ts +2 -0
  46. package/dist/types/components/index.d.ts.map +1 -0
  47. package/dist/types/components/utils/columns.d.ts +2 -0
  48. package/dist/types/components/utils/columns.d.ts.map +1 -0
  49. package/dist/types/components/utils/cssMediaRules.d.ts +18 -0
  50. package/dist/types/components/utils/cssMediaRules.d.ts.map +1 -0
  51. package/dist/types/components/utils/devices.d.ts +16 -0
  52. package/dist/types/components/utils/devices.d.ts.map +1 -0
  53. package/dist/types/index.d.ts +6 -0
  54. package/dist/types/index.d.ts.map +1 -0
  55. package/dist/types/prop-controllers/descriptors.d.ts +656 -0
  56. package/dist/types/prop-controllers/descriptors.d.ts.map +1 -0
  57. package/dist/types/prop-controllers/index.d.ts +3 -0
  58. package/dist/types/prop-controllers/index.d.ts.map +1 -0
  59. package/dist/types/react.d.ts +4 -0
  60. package/dist/types/react.d.ts.map +1 -0
  61. package/dist/types/runtimes/react.d.ts +28 -0
  62. package/dist/types/runtimes/react.d.ts.map +1 -0
  63. package/dist/types/state/actions.d.ts +124 -0
  64. package/dist/types/state/actions.d.ts.map +1 -0
  65. package/dist/types/state/modules/box-models.d.ts +22 -0
  66. package/dist/types/state/modules/box-models.d.ts.map +1 -0
  67. package/dist/types/state/modules/components-meta.d.ts +14 -0
  68. package/dist/types/state/modules/components-meta.d.ts.map +1 -0
  69. package/dist/types/state/modules/prop-controllers.d.ts +10 -0
  70. package/dist/types/state/modules/prop-controllers.d.ts.map +1 -0
  71. package/dist/types/state/modules/react-components.d.ts +10 -0
  72. package/dist/types/state/modules/react-components.d.ts.map +1 -0
  73. package/dist/types/state/modules/read-only-documents.d.ts +28 -0
  74. package/dist/types/state/modules/read-only-documents.d.ts.map +1 -0
  75. package/dist/types/state/modules/read-write-documents.d.ts +13 -0
  76. package/dist/types/state/modules/read-write-documents.d.ts.map +1 -0
  77. package/dist/types/state/react-builder-preview.d.ts +39 -0
  78. package/dist/types/state/react-builder-preview.d.ts.map +1 -0
  79. package/dist/types/state/react-page.d.ts +28 -0
  80. package/dist/types/state/react-page.d.ts.map +1 -0
  81. package/dist/types/utils/deepEqual.d.ts +3 -0
  82. package/dist/types/utils/deepEqual.d.ts.map +1 -0
  83. package/dist/types/utils/is.d.ts +2 -0
  84. package/dist/types/utils/is.d.ts.map +1 -0
  85. package/dist/types/utils/shallowEqual.d.ts +3 -0
  86. package/dist/types/utils/shallowEqual.d.ts.map +1 -0
  87. package/package.json +103 -0
@@ -0,0 +1,810 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ import require$$0, { createContext, memo, forwardRef, createElement, useCallback, useEffect, useState, useContext } from "react";
21
+ import { A as ActionTypes$1, b as changeComponentHandle, m as mountComponentEffect, r as registerComponentEffect, d as registerReactComponentEffect } from "./actions.es.js";
22
+ var withSelector = { exports: {} };
23
+ var withSelector_production_min = {};
24
+ var shim = { exports: {} };
25
+ var useSyncExternalStoreShim_production_min = {};
26
+ /** @license React vundefined
27
+ * use-sync-external-store-shim.production.min.js
28
+ *
29
+ * Copyright (c) Facebook, Inc. and its affiliates.
30
+ *
31
+ * This source code is licensed under the MIT license found in the
32
+ * LICENSE file in the root directory of this source tree.
33
+ */
34
+ var e = require$$0;
35
+ function h$2(a, b) {
36
+ return a === b && (a !== 0 || 1 / a === 1 / b) || a !== a && b !== b;
37
+ }
38
+ var k = typeof Object.is === "function" ? Object.is : h$2, l = e.useState, m$1 = e.useEffect, n$2 = e.useLayoutEffect, p$2 = e.useDebugValue;
39
+ function q$2(a, b) {
40
+ var d = b(), f2 = l({ inst: { value: d, getSnapshot: b } }), c = f2[0].inst, g2 = f2[1];
41
+ n$2(function() {
42
+ c.value = d;
43
+ c.getSnapshot = b;
44
+ r$1(c) && g2({ inst: c });
45
+ }, [a, d, b]);
46
+ m$1(function() {
47
+ r$1(c) && g2({ inst: c });
48
+ return a(function() {
49
+ r$1(c) && g2({ inst: c });
50
+ });
51
+ }, [a]);
52
+ p$2(d);
53
+ return d;
54
+ }
55
+ function r$1(a) {
56
+ var b = a.getSnapshot;
57
+ a = a.value;
58
+ try {
59
+ var d = b();
60
+ return !k(a, d);
61
+ } catch (f2) {
62
+ return true;
63
+ }
64
+ }
65
+ function t$1(a, b) {
66
+ return b();
67
+ }
68
+ var u$1 = typeof window === "undefined" || typeof window.document === "undefined" || typeof window.document.createElement === "undefined" ? t$1 : q$2;
69
+ useSyncExternalStoreShim_production_min.useSyncExternalStore = e.useSyncExternalStore !== void 0 ? e.useSyncExternalStore : u$1;
70
+ {
71
+ shim.exports = useSyncExternalStoreShim_production_min;
72
+ }
73
+ /** @license React vundefined
74
+ * use-sync-external-store-shim/with-selector.production.min.js
75
+ *
76
+ * Copyright (c) Facebook, Inc. and its affiliates.
77
+ *
78
+ * This source code is licensed under the MIT license found in the
79
+ * LICENSE file in the root directory of this source tree.
80
+ */
81
+ var h$1 = require$$0, n$1 = shim.exports;
82
+ function p$1(a, b) {
83
+ return a === b && (a !== 0 || 1 / a === 1 / b) || a !== a && b !== b;
84
+ }
85
+ var q$1 = typeof Object.is === "function" ? Object.is : p$1, r = n$1.useSyncExternalStore, t = h$1.useRef, u = h$1.useEffect, v = h$1.useMemo, w = h$1.useDebugValue;
86
+ withSelector_production_min.useSyncExternalStoreWithSelector = function(a, b, e2, l2, g2) {
87
+ var c = t(null);
88
+ if (c.current === null) {
89
+ var f2 = { hasValue: false, value: null };
90
+ c.current = f2;
91
+ } else
92
+ f2 = c.current;
93
+ c = v(function() {
94
+ function a2(a3) {
95
+ if (!c2) {
96
+ c2 = true;
97
+ d2 = a3;
98
+ a3 = l2(a3);
99
+ if (g2 !== void 0 && f2.hasValue) {
100
+ var b2 = f2.value;
101
+ if (g2(b2, a3))
102
+ return k2 = b2;
103
+ }
104
+ return k2 = a3;
105
+ }
106
+ b2 = k2;
107
+ if (q$1(d2, a3))
108
+ return b2;
109
+ var e3 = l2(a3);
110
+ if (g2 !== void 0 && g2(b2, e3))
111
+ return b2;
112
+ d2 = a3;
113
+ return k2 = e3;
114
+ }
115
+ var c2 = false, d2, k2, m2 = e2 === void 0 ? null : e2;
116
+ return [function() {
117
+ return a2(b());
118
+ }, m2 === null ? void 0 : function() {
119
+ return a2(m2());
120
+ }];
121
+ }, [b, e2, l2, g2]);
122
+ var d = r(a, c[0], c[1]);
123
+ u(function() {
124
+ f2.hasValue = true;
125
+ f2.value = d;
126
+ }, [d]);
127
+ w(d);
128
+ return d;
129
+ };
130
+ {
131
+ withSelector.exports = withSelector_production_min;
132
+ }
133
+ function _defineProperty(obj, key, value) {
134
+ if (key in obj) {
135
+ Object.defineProperty(obj, key, {
136
+ value,
137
+ enumerable: true,
138
+ configurable: true,
139
+ writable: true
140
+ });
141
+ } else {
142
+ obj[key] = value;
143
+ }
144
+ return obj;
145
+ }
146
+ function ownKeys(object, enumerableOnly) {
147
+ var keys = Object.keys(object);
148
+ if (Object.getOwnPropertySymbols) {
149
+ var symbols = Object.getOwnPropertySymbols(object);
150
+ enumerableOnly && (symbols = symbols.filter(function(sym) {
151
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
152
+ })), keys.push.apply(keys, symbols);
153
+ }
154
+ return keys;
155
+ }
156
+ function _objectSpread2(target) {
157
+ for (var i = 1; i < arguments.length; i++) {
158
+ var source = arguments[i] != null ? arguments[i] : {};
159
+ i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
160
+ _defineProperty(target, key, source[key]);
161
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
162
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
163
+ });
164
+ }
165
+ return target;
166
+ }
167
+ function formatProdErrorMessage(code) {
168
+ return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or use the non-minified dev environment for full errors. ";
169
+ }
170
+ var $$observable = function() {
171
+ return typeof Symbol === "function" && Symbol.observable || "@@observable";
172
+ }();
173
+ var randomString = function randomString2() {
174
+ return Math.random().toString(36).substring(7).split("").join(".");
175
+ };
176
+ var ActionTypes = {
177
+ INIT: "@@redux/INIT" + randomString(),
178
+ REPLACE: "@@redux/REPLACE" + randomString(),
179
+ PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
180
+ return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
181
+ }
182
+ };
183
+ function isPlainObject(obj) {
184
+ if (typeof obj !== "object" || obj === null)
185
+ return false;
186
+ var proto = obj;
187
+ while (Object.getPrototypeOf(proto) !== null) {
188
+ proto = Object.getPrototypeOf(proto);
189
+ }
190
+ return Object.getPrototypeOf(obj) === proto;
191
+ }
192
+ function createStore(reducer2, preloadedState, enhancer) {
193
+ var _ref2;
194
+ if (typeof preloadedState === "function" && typeof enhancer === "function" || typeof enhancer === "function" && typeof arguments[3] === "function") {
195
+ throw new Error(formatProdErrorMessage(0));
196
+ }
197
+ if (typeof preloadedState === "function" && typeof enhancer === "undefined") {
198
+ enhancer = preloadedState;
199
+ preloadedState = void 0;
200
+ }
201
+ if (typeof enhancer !== "undefined") {
202
+ if (typeof enhancer !== "function") {
203
+ throw new Error(formatProdErrorMessage(1));
204
+ }
205
+ return enhancer(createStore)(reducer2, preloadedState);
206
+ }
207
+ if (typeof reducer2 !== "function") {
208
+ throw new Error(formatProdErrorMessage(2));
209
+ }
210
+ var currentReducer = reducer2;
211
+ var currentState = preloadedState;
212
+ var currentListeners = [];
213
+ var nextListeners = currentListeners;
214
+ var isDispatching = false;
215
+ function ensureCanMutateNextListeners() {
216
+ if (nextListeners === currentListeners) {
217
+ nextListeners = currentListeners.slice();
218
+ }
219
+ }
220
+ function getState() {
221
+ if (isDispatching) {
222
+ throw new Error(formatProdErrorMessage(3));
223
+ }
224
+ return currentState;
225
+ }
226
+ function subscribe(listener) {
227
+ if (typeof listener !== "function") {
228
+ throw new Error(formatProdErrorMessage(4));
229
+ }
230
+ if (isDispatching) {
231
+ throw new Error(formatProdErrorMessage(5));
232
+ }
233
+ var isSubscribed = true;
234
+ ensureCanMutateNextListeners();
235
+ nextListeners.push(listener);
236
+ return function unsubscribe() {
237
+ if (!isSubscribed) {
238
+ return;
239
+ }
240
+ if (isDispatching) {
241
+ throw new Error(formatProdErrorMessage(6));
242
+ }
243
+ isSubscribed = false;
244
+ ensureCanMutateNextListeners();
245
+ var index = nextListeners.indexOf(listener);
246
+ nextListeners.splice(index, 1);
247
+ currentListeners = null;
248
+ };
249
+ }
250
+ function dispatch(action) {
251
+ if (!isPlainObject(action)) {
252
+ throw new Error(formatProdErrorMessage(7));
253
+ }
254
+ if (typeof action.type === "undefined") {
255
+ throw new Error(formatProdErrorMessage(8));
256
+ }
257
+ if (isDispatching) {
258
+ throw new Error(formatProdErrorMessage(9));
259
+ }
260
+ try {
261
+ isDispatching = true;
262
+ currentState = currentReducer(currentState, action);
263
+ } finally {
264
+ isDispatching = false;
265
+ }
266
+ var listeners = currentListeners = nextListeners;
267
+ for (var i = 0; i < listeners.length; i++) {
268
+ var listener = listeners[i];
269
+ listener();
270
+ }
271
+ return action;
272
+ }
273
+ function replaceReducer(nextReducer) {
274
+ if (typeof nextReducer !== "function") {
275
+ throw new Error(formatProdErrorMessage(10));
276
+ }
277
+ currentReducer = nextReducer;
278
+ dispatch({
279
+ type: ActionTypes.REPLACE
280
+ });
281
+ }
282
+ function observable() {
283
+ var _ref;
284
+ var outerSubscribe = subscribe;
285
+ return _ref = {
286
+ subscribe: function subscribe2(observer) {
287
+ if (typeof observer !== "object" || observer === null) {
288
+ throw new Error(formatProdErrorMessage(11));
289
+ }
290
+ function observeState() {
291
+ if (observer.next) {
292
+ observer.next(getState());
293
+ }
294
+ }
295
+ observeState();
296
+ var unsubscribe = outerSubscribe(observeState);
297
+ return {
298
+ unsubscribe
299
+ };
300
+ }
301
+ }, _ref[$$observable] = function() {
302
+ return this;
303
+ }, _ref;
304
+ }
305
+ dispatch({
306
+ type: ActionTypes.INIT
307
+ });
308
+ return _ref2 = {
309
+ dispatch,
310
+ subscribe,
311
+ getState,
312
+ replaceReducer
313
+ }, _ref2[$$observable] = observable, _ref2;
314
+ }
315
+ function assertReducerShape(reducers) {
316
+ Object.keys(reducers).forEach(function(key) {
317
+ var reducer2 = reducers[key];
318
+ var initialState = reducer2(void 0, {
319
+ type: ActionTypes.INIT
320
+ });
321
+ if (typeof initialState === "undefined") {
322
+ throw new Error(formatProdErrorMessage(12));
323
+ }
324
+ if (typeof reducer2(void 0, {
325
+ type: ActionTypes.PROBE_UNKNOWN_ACTION()
326
+ }) === "undefined") {
327
+ throw new Error(formatProdErrorMessage(13));
328
+ }
329
+ });
330
+ }
331
+ function combineReducers(reducers) {
332
+ var reducerKeys = Object.keys(reducers);
333
+ var finalReducers = {};
334
+ for (var i = 0; i < reducerKeys.length; i++) {
335
+ var key = reducerKeys[i];
336
+ if (typeof reducers[key] === "function") {
337
+ finalReducers[key] = reducers[key];
338
+ }
339
+ }
340
+ var finalReducerKeys = Object.keys(finalReducers);
341
+ var shapeAssertionError;
342
+ try {
343
+ assertReducerShape(finalReducers);
344
+ } catch (e2) {
345
+ shapeAssertionError = e2;
346
+ }
347
+ return function combination(state, action) {
348
+ if (state === void 0) {
349
+ state = {};
350
+ }
351
+ if (shapeAssertionError) {
352
+ throw shapeAssertionError;
353
+ }
354
+ var hasChanged = false;
355
+ var nextState = {};
356
+ for (var _i = 0; _i < finalReducerKeys.length; _i++) {
357
+ var _key = finalReducerKeys[_i];
358
+ var reducer2 = finalReducers[_key];
359
+ var previousStateForKey = state[_key];
360
+ var nextStateForKey = reducer2(previousStateForKey, action);
361
+ if (typeof nextStateForKey === "undefined") {
362
+ action && action.type;
363
+ throw new Error(formatProdErrorMessage(14));
364
+ }
365
+ nextState[_key] = nextStateForKey;
366
+ hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
367
+ }
368
+ hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length;
369
+ return hasChanged ? nextState : state;
370
+ };
371
+ }
372
+ function compose() {
373
+ for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
374
+ funcs[_key] = arguments[_key];
375
+ }
376
+ if (funcs.length === 0) {
377
+ return function(arg) {
378
+ return arg;
379
+ };
380
+ }
381
+ if (funcs.length === 1) {
382
+ return funcs[0];
383
+ }
384
+ return funcs.reduce(function(a, b) {
385
+ return function() {
386
+ return a(b.apply(void 0, arguments));
387
+ };
388
+ });
389
+ }
390
+ function applyMiddleware() {
391
+ for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
392
+ middlewares[_key] = arguments[_key];
393
+ }
394
+ return function(createStore2) {
395
+ return function() {
396
+ var store = createStore2.apply(void 0, arguments);
397
+ var _dispatch = function dispatch() {
398
+ throw new Error(formatProdErrorMessage(15));
399
+ };
400
+ var middlewareAPI = {
401
+ getState: store.getState,
402
+ dispatch: function dispatch() {
403
+ return _dispatch.apply(void 0, arguments);
404
+ }
405
+ };
406
+ var chain = middlewares.map(function(middleware) {
407
+ return middleware(middlewareAPI);
408
+ });
409
+ _dispatch = compose.apply(void 0, chain)(store.dispatch);
410
+ return _objectSpread2(_objectSpread2({}, store), {}, {
411
+ dispatch: _dispatch
412
+ });
413
+ };
414
+ };
415
+ }
416
+ function createThunkMiddleware(extraArgument) {
417
+ var middleware = function middleware2(_ref) {
418
+ var dispatch = _ref.dispatch, getState = _ref.getState;
419
+ return function(next) {
420
+ return function(action) {
421
+ if (typeof action === "function") {
422
+ return action(dispatch, getState, extraArgument);
423
+ }
424
+ return next(action);
425
+ };
426
+ };
427
+ };
428
+ return middleware;
429
+ }
430
+ var thunk = createThunkMiddleware();
431
+ thunk.withExtraArgument = createThunkMiddleware;
432
+ var thunk$1 = thunk;
433
+ function isElementReference(element) {
434
+ return !("props" in element);
435
+ }
436
+ function createDocument(rootElement) {
437
+ return { rootElement };
438
+ }
439
+ function getInitialState$3({
440
+ rootElements = /* @__PURE__ */ new Map()
441
+ } = {}) {
442
+ const initialState = /* @__PURE__ */ new Map();
443
+ rootElements.forEach((rootElement, elementKey) => {
444
+ initialState.set(elementKey, createDocument(rootElement));
445
+ });
446
+ return initialState;
447
+ }
448
+ function getDocuments(state) {
449
+ return state;
450
+ }
451
+ function getDocument(state, documentKey) {
452
+ var _a;
453
+ return (_a = getDocuments(state).get(documentKey)) != null ? _a : null;
454
+ }
455
+ function getDocumentRootElement$1(state, documentKey) {
456
+ var _a, _b;
457
+ return (_b = (_a = getDocument(state, documentKey)) == null ? void 0 : _a.rootElement) != null ? _b : null;
458
+ }
459
+ function reducer$4(state = getInitialState$3(), _action) {
460
+ return state;
461
+ }
462
+ function getInitialState$2({
463
+ reactComponents = /* @__PURE__ */ new Map()
464
+ } = {}) {
465
+ return reactComponents;
466
+ }
467
+ function getReactComponents(state) {
468
+ return state;
469
+ }
470
+ function getReactComponent$1(state, type) {
471
+ var _a;
472
+ return (_a = getReactComponents(state).get(type)) != null ? _a : null;
473
+ }
474
+ function reducer$3(state = getInitialState$2(), action) {
475
+ switch (action.type) {
476
+ case ActionTypes$1.REGISTER_REACT_COMPONENT:
477
+ return new Map(state).set(action.payload.type, action.payload.component);
478
+ case ActionTypes$1.UNREGISTER_REACT_COMPONENT: {
479
+ const nextState = new Map(state);
480
+ const deleted = nextState.delete(action.payload.type);
481
+ return deleted ? nextState : state;
482
+ }
483
+ default:
484
+ return state;
485
+ }
486
+ }
487
+ function getInitialState$1({
488
+ componentsMeta = /* @__PURE__ */ new Map()
489
+ } = {}) {
490
+ return componentsMeta;
491
+ }
492
+ function getComponentsMeta(state) {
493
+ return state;
494
+ }
495
+ function reducer$2(state = getInitialState$1(), action) {
496
+ switch (action.type) {
497
+ case ActionTypes$1.REGISTER_COMPONENT:
498
+ return new Map(state).set(action.payload.type, action.payload.meta);
499
+ case ActionTypes$1.UNREGISTER_COMPONENT: {
500
+ const nextState = new Map(state);
501
+ const deleted = nextState.delete(action.payload.type);
502
+ return deleted ? nextState : state;
503
+ }
504
+ default:
505
+ return state;
506
+ }
507
+ }
508
+ function getInitialState({
509
+ propControllerDescriptors = /* @__PURE__ */ new Map()
510
+ } = {}) {
511
+ return propControllerDescriptors;
512
+ }
513
+ function getPropControllerDescriptors(state) {
514
+ return state;
515
+ }
516
+ function getComponentPropControllerDescriptors(state, componentType) {
517
+ var _a;
518
+ return (_a = getPropControllerDescriptors(state).get(componentType)) != null ? _a : null;
519
+ }
520
+ function reducer$1(state = getInitialState(), action) {
521
+ switch (action.type) {
522
+ case ActionTypes$1.REGISTER_COMPONENT:
523
+ return new Map(state).set(action.payload.type, action.payload.propControllerDescriptors);
524
+ case ActionTypes$1.UNREGISTER_COMPONENT: {
525
+ const nextState = new Map(state);
526
+ const deleted = nextState.delete(action.payload.type);
527
+ return deleted ? nextState : state;
528
+ }
529
+ default:
530
+ return state;
531
+ }
532
+ }
533
+ const reducer = combineReducers({
534
+ documents: reducer$4,
535
+ reactComponents: reducer$3,
536
+ componentsMeta: reducer$2,
537
+ propControllers: reducer$1
538
+ });
539
+ function getDocumentsStateSlice(state) {
540
+ return state.documents;
541
+ }
542
+ function getDocumentRootElement(state, documentKey) {
543
+ return getDocumentRootElement$1(getDocumentsStateSlice(state), documentKey);
544
+ }
545
+ function getReactComponentsStateSlice(state) {
546
+ return state.reactComponents;
547
+ }
548
+ function getReactComponent(state, type) {
549
+ return getReactComponent$1(getReactComponentsStateSlice(state), type);
550
+ }
551
+ function configureStore({
552
+ rootElements,
553
+ preloadedState
554
+ } = {}) {
555
+ return createStore(reducer, __spreadProps(__spreadValues({}, preloadedState), { documents: getInitialState$3({ rootElements }) }), applyMiddleware(thunk$1));
556
+ }
557
+ var jsxRuntime = { exports: {} };
558
+ var reactJsxRuntime_production_min = {};
559
+ /*
560
+ object-assign
561
+ (c) Sindre Sorhus
562
+ @license MIT
563
+ */
564
+ var getOwnPropertySymbols = Object.getOwnPropertySymbols;
565
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
566
+ var propIsEnumerable = Object.prototype.propertyIsEnumerable;
567
+ function toObject(val) {
568
+ if (val === null || val === void 0) {
569
+ throw new TypeError("Object.assign cannot be called with null or undefined");
570
+ }
571
+ return Object(val);
572
+ }
573
+ function shouldUseNative() {
574
+ try {
575
+ if (!Object.assign) {
576
+ return false;
577
+ }
578
+ var test1 = new String("abc");
579
+ test1[5] = "de";
580
+ if (Object.getOwnPropertyNames(test1)[0] === "5") {
581
+ return false;
582
+ }
583
+ var test2 = {};
584
+ for (var i = 0; i < 10; i++) {
585
+ test2["_" + String.fromCharCode(i)] = i;
586
+ }
587
+ var order2 = Object.getOwnPropertyNames(test2).map(function(n2) {
588
+ return test2[n2];
589
+ });
590
+ if (order2.join("") !== "0123456789") {
591
+ return false;
592
+ }
593
+ var test3 = {};
594
+ "abcdefghijklmnopqrst".split("").forEach(function(letter) {
595
+ test3[letter] = letter;
596
+ });
597
+ if (Object.keys(Object.assign({}, test3)).join("") !== "abcdefghijklmnopqrst") {
598
+ return false;
599
+ }
600
+ return true;
601
+ } catch (err) {
602
+ return false;
603
+ }
604
+ }
605
+ shouldUseNative() ? Object.assign : function(target, source) {
606
+ var from;
607
+ var to = toObject(target);
608
+ var symbols;
609
+ for (var s = 1; s < arguments.length; s++) {
610
+ from = Object(arguments[s]);
611
+ for (var key in from) {
612
+ if (hasOwnProperty.call(from, key)) {
613
+ to[key] = from[key];
614
+ }
615
+ }
616
+ if (getOwnPropertySymbols) {
617
+ symbols = getOwnPropertySymbols(from);
618
+ for (var i = 0; i < symbols.length; i++) {
619
+ if (propIsEnumerable.call(from, symbols[i])) {
620
+ to[symbols[i]] = from[symbols[i]];
621
+ }
622
+ }
623
+ }
624
+ }
625
+ return to;
626
+ };
627
+ /** @license React v17.0.2
628
+ * react-jsx-runtime.production.min.js
629
+ *
630
+ * Copyright (c) Facebook, Inc. and its affiliates.
631
+ *
632
+ * This source code is licensed under the MIT license found in the
633
+ * LICENSE file in the root directory of this source tree.
634
+ */
635
+ var f = require$$0, g = 60103;
636
+ reactJsxRuntime_production_min.Fragment = 60107;
637
+ if (typeof Symbol === "function" && Symbol.for) {
638
+ var h = Symbol.for;
639
+ g = h("react.element");
640
+ reactJsxRuntime_production_min.Fragment = h("react.fragment");
641
+ }
642
+ var m = f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, n = Object.prototype.hasOwnProperty, p = { key: true, ref: true, __self: true, __source: true };
643
+ function q(c, a, k2) {
644
+ var b, d = {}, e2 = null, l2 = null;
645
+ k2 !== void 0 && (e2 = "" + k2);
646
+ a.key !== void 0 && (e2 = "" + a.key);
647
+ a.ref !== void 0 && (l2 = a.ref);
648
+ for (b in a)
649
+ n.call(a, b) && !p.hasOwnProperty(b) && (d[b] = a[b]);
650
+ if (c && c.defaultProps)
651
+ for (b in a = c.defaultProps, a)
652
+ d[b] === void 0 && (d[b] = a[b]);
653
+ return { $$typeof: g, type: c, key: e2, ref: l2, props: d, _owner: m.current };
654
+ }
655
+ reactJsxRuntime_production_min.jsx = q;
656
+ reactJsxRuntime_production_min.jsxs = q;
657
+ {
658
+ jsxRuntime.exports = reactJsxRuntime_production_min;
659
+ }
660
+ const jsx = jsxRuntime.exports.jsx;
661
+ const jsxs = jsxRuntime.exports.jsxs;
662
+ const Fragment = jsxRuntime.exports.Fragment;
663
+ const contextDefaultValue = configureStore();
664
+ const ReactRuntime = {
665
+ registerComponent(component, {
666
+ type,
667
+ label,
668
+ icon = "Cube40",
669
+ hidden = false,
670
+ props
671
+ }) {
672
+ const unregisterComponent = contextDefaultValue.dispatch(registerComponentEffect(type, {
673
+ label,
674
+ icon,
675
+ hidden
676
+ }, props != null ? props : {}));
677
+ const unregisterReactComponent = contextDefaultValue.dispatch(registerReactComponentEffect(type, component));
678
+ return () => {
679
+ unregisterComponent();
680
+ unregisterReactComponent();
681
+ };
682
+ }
683
+ };
684
+ const Context = createContext(contextDefaultValue);
685
+ function RuntimeProvider({
686
+ children,
687
+ defaultRootElements
688
+ }) {
689
+ const [store, setStore] = useState(() => configureStore({
690
+ preloadedState: contextDefaultValue.getState(),
691
+ rootElements: defaultRootElements
692
+ }));
693
+ useEffect(() => {
694
+ const isInBuilder = window.parent !== window;
695
+ if (!isInBuilder)
696
+ return;
697
+ const initializePromise = initializeReactBuilderPreview();
698
+ return () => {
699
+ initializePromise.then((cleanUp) => {
700
+ cleanUp();
701
+ });
702
+ };
703
+ async function initializeReactBuilderPreview() {
704
+ const ReactBuilderPreview = await import("./react-builder-preview.es.js");
705
+ const store2 = await new Promise((resolve) => {
706
+ setStore((store3) => {
707
+ const nextStore = ReactBuilderPreview.configureStore({
708
+ preloadedState: store3.getState()
709
+ });
710
+ resolve(nextStore);
711
+ return nextStore;
712
+ });
713
+ });
714
+ return store2.dispatch(ReactBuilderPreview.initialize());
715
+ }
716
+ }, []);
717
+ return /* @__PURE__ */ jsx(Context.Provider, {
718
+ value: store,
719
+ children
720
+ });
721
+ }
722
+ function useSelector(selector) {
723
+ const store = useContext(Context);
724
+ return withSelector.exports.useSyncExternalStoreWithSelector(store.subscribe, store.getState, store.getState, selector);
725
+ }
726
+ function useComponent(type) {
727
+ return useSelector((state) => getReactComponent(state, type));
728
+ }
729
+ function useDocumentRootElement(documentKey) {
730
+ return useSelector((state) => getDocumentRootElement(state, documentKey));
731
+ }
732
+ function useDispatch() {
733
+ const store = useContext(Context);
734
+ return store.dispatch;
735
+ }
736
+ const ElementData = memo(forwardRef(function ElementData2({
737
+ elementData
738
+ }, ref) {
739
+ const Component = useComponent(elementData.type);
740
+ if (Component == null) {
741
+ return /* @__PURE__ */ jsxs("div", {
742
+ ref,
743
+ children: [/* @__PURE__ */ jsx("p", {
744
+ children: "Component Not Found"
745
+ }), /* @__PURE__ */ jsx("pre", {
746
+ children: /* @__PURE__ */ jsx("code", {
747
+ children: JSON.stringify(elementData, null, 2)
748
+ })
749
+ })]
750
+ });
751
+ }
752
+ return /* @__PURE__ */ createElement(Component, __spreadProps(__spreadValues({}, elementData.props), {
753
+ key: elementData.key,
754
+ ref
755
+ }));
756
+ }));
757
+ const ElementReference = memo(forwardRef(function ElementReference2({
758
+ elementReference
759
+ }, ref) {
760
+ return /* @__PURE__ */ jsxs("div", {
761
+ ref,
762
+ children: [/* @__PURE__ */ jsx("p", {
763
+ children: "Not Implemented"
764
+ }), /* @__PURE__ */ jsx("pre", {
765
+ children: /* @__PURE__ */ jsx("code", {
766
+ children: JSON.stringify(elementReference, null, 2)
767
+ })
768
+ })]
769
+ });
770
+ }));
771
+ const Element = memo(function Element2({
772
+ element
773
+ }) {
774
+ const elementKey = element.key;
775
+ const dispatch = useDispatch();
776
+ const ref = useCallback((handle) => {
777
+ dispatch(changeComponentHandle(elementKey, handle));
778
+ }, [dispatch, elementKey]);
779
+ useEffect(() => dispatch(mountComponentEffect(elementKey)), [dispatch, elementKey]);
780
+ return isElementReference(element) ? /* @__PURE__ */ jsx(ElementReference, {
781
+ ref,
782
+ elementReference: element
783
+ }, elementKey) : /* @__PURE__ */ jsx(ElementData, {
784
+ ref,
785
+ elementData: element
786
+ }, elementKey);
787
+ });
788
+ const Document = memo(function Document2({
789
+ documentKey
790
+ }) {
791
+ const documentRootElement = useDocumentRootElement(documentKey);
792
+ if (documentRootElement == null) {
793
+ return /* @__PURE__ */ jsxs("div", {
794
+ children: [/* @__PURE__ */ jsx("p", {
795
+ children: "Document Not Found"
796
+ }), /* @__PURE__ */ jsx("pre", {
797
+ children: /* @__PURE__ */ jsx("code", {
798
+ children: JSON.stringify({
799
+ documentKey
800
+ }, null, 2)
801
+ })
802
+ })]
803
+ });
804
+ }
805
+ return /* @__PURE__ */ jsx(Element, {
806
+ element: documentRootElement
807
+ });
808
+ });
809
+ export { Document as D, Element as E, Fragment as F, RuntimeProvider as R, ReactRuntime as a, jsxs as b, getDocumentRootElement$1 as c, createDocument as d, combineReducers as e, reducer$2 as f, getInitialState$3 as g, reducer$1 as h, getComponentsMeta as i, jsx as j, getComponentPropControllerDescriptors as k, createStore as l, applyMiddleware as m, reducer$3 as r, thunk$1 as t };
810
+ //# sourceMappingURL=react.es2.js.map