@plasmicpkgs/plasmic-cms 0.0.15 → 0.0.21
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.
- package/dist/components.d.ts +25 -9
- package/dist/plasmic-cms.cjs.development.js +875 -671
- package/dist/plasmic-cms.cjs.development.js.map +1 -1
- package/dist/plasmic-cms.cjs.production.min.js +1 -1
- package/dist/plasmic-cms.cjs.production.min.js.map +1 -1
- package/dist/plasmic-cms.esm.js +865 -665
- package/dist/plasmic-cms.esm.js.map +1 -1
- package/dist/util.d.ts +2 -2
- package/package.json +4 -4
package/dist/plasmic-cms.esm.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import registerComponent from '@plasmicapp/host/registerComponent';
|
|
2
|
-
import { repeatedElement } from '@plasmicapp/host';
|
|
2
|
+
import { useSelector, DataProvider, useDataEnv, repeatedElement } from '@plasmicapp/host';
|
|
3
3
|
import { usePlasmicQueryData } from '@plasmicapp/query';
|
|
4
4
|
import React from 'react';
|
|
5
|
-
import { useSelector, DataProvider, useDataEnv } from '@plasmicpkgs/plasmic-basic-components';
|
|
6
5
|
|
|
7
6
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
8
7
|
try {
|
|
@@ -206,201 +205,198 @@ function createCommonjsModule(fn, module) {
|
|
|
206
205
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
207
206
|
}
|
|
208
207
|
|
|
209
|
-
var runtime_1 = createCommonjsModule(function (module) {
|
|
210
|
-
/**
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
try {
|
|
237
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
238
|
-
define({}, "");
|
|
239
|
-
} catch (err) {
|
|
240
|
-
define = function(obj, key, value) {
|
|
241
|
-
return obj[key] = value;
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
246
|
-
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
247
|
-
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
248
|
-
var generator = Object.create(protoGenerator.prototype);
|
|
249
|
-
var context = new Context(tryLocsList || []);
|
|
250
|
-
|
|
251
|
-
// The ._invoke method unifies the implementations of the .next,
|
|
252
|
-
// .throw, and .return methods.
|
|
253
|
-
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
208
|
+
var runtime_1 = /*#__PURE__*/createCommonjsModule(function (module) {
|
|
209
|
+
/**
|
|
210
|
+
* Copyright (c) 2014-present, Facebook, Inc.
|
|
211
|
+
*
|
|
212
|
+
* This source code is licensed under the MIT license found in the
|
|
213
|
+
* LICENSE file in the root directory of this source tree.
|
|
214
|
+
*/
|
|
215
|
+
var runtime = function (exports) {
|
|
216
|
+
|
|
217
|
+
var Op = Object.prototype;
|
|
218
|
+
var hasOwn = Op.hasOwnProperty;
|
|
219
|
+
var undefined$1; // More compressible than void 0.
|
|
220
|
+
|
|
221
|
+
var $Symbol = typeof Symbol === "function" ? Symbol : {};
|
|
222
|
+
var iteratorSymbol = $Symbol.iterator || "@@iterator";
|
|
223
|
+
var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
|
|
224
|
+
var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
|
|
225
|
+
|
|
226
|
+
function define(obj, key, value) {
|
|
227
|
+
Object.defineProperty(obj, key, {
|
|
228
|
+
value: value,
|
|
229
|
+
enumerable: true,
|
|
230
|
+
configurable: true,
|
|
231
|
+
writable: true
|
|
232
|
+
});
|
|
233
|
+
return obj[key];
|
|
234
|
+
}
|
|
254
235
|
|
|
255
|
-
return generator;
|
|
256
|
-
}
|
|
257
|
-
exports.wrap = wrap;
|
|
258
|
-
|
|
259
|
-
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
260
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
261
|
-
// have been (and was previously) designed to take a closure to be
|
|
262
|
-
// invoked without arguments, but in all the cases we care about we
|
|
263
|
-
// already have an existing method we want to call, so there's no need
|
|
264
|
-
// to create a new function object. We can even get away with assuming
|
|
265
|
-
// the method takes exactly one argument, since that happens to be true
|
|
266
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
267
|
-
// only additional allocation required is the completion record, which
|
|
268
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
269
|
-
function tryCatch(fn, obj, arg) {
|
|
270
236
|
try {
|
|
271
|
-
|
|
237
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
238
|
+
define({}, "");
|
|
272
239
|
} catch (err) {
|
|
273
|
-
|
|
240
|
+
define = function define(obj, key, value) {
|
|
241
|
+
return obj[key] = value;
|
|
242
|
+
};
|
|
274
243
|
}
|
|
275
|
-
}
|
|
276
244
|
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
// breaking out of the dispatch switch statement.
|
|
284
|
-
var ContinueSentinel = {};
|
|
285
|
-
|
|
286
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
287
|
-
// .constructor.prototype properties for functions that return Generator
|
|
288
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
289
|
-
// minifier not to mangle the names of these two functions.
|
|
290
|
-
function Generator() {}
|
|
291
|
-
function GeneratorFunction() {}
|
|
292
|
-
function GeneratorFunctionPrototype() {}
|
|
293
|
-
|
|
294
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
295
|
-
// don't natively support it.
|
|
296
|
-
var IteratorPrototype = {};
|
|
297
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
298
|
-
return this;
|
|
299
|
-
});
|
|
245
|
+
function wrap(innerFn, outerFn, self, tryLocsList) {
|
|
246
|
+
// If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
|
|
247
|
+
var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
|
|
248
|
+
var generator = Object.create(protoGenerator.prototype);
|
|
249
|
+
var context = new Context(tryLocsList || []); // The ._invoke method unifies the implementations of the .next,
|
|
250
|
+
// .throw, and .return methods.
|
|
300
251
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
NativeIteratorPrototype !== Op &&
|
|
305
|
-
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
306
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
307
|
-
// of the polyfill.
|
|
308
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
309
|
-
}
|
|
252
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
253
|
+
return generator;
|
|
254
|
+
}
|
|
310
255
|
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
})
|
|
329
|
-
|
|
330
|
-
|
|
256
|
+
exports.wrap = wrap; // Try/catch helper to minimize deoptimizations. Returns a completion
|
|
257
|
+
// record like context.tryEntries[i].completion. This interface could
|
|
258
|
+
// have been (and was previously) designed to take a closure to be
|
|
259
|
+
// invoked without arguments, but in all the cases we care about we
|
|
260
|
+
// already have an existing method we want to call, so there's no need
|
|
261
|
+
// to create a new function object. We can even get away with assuming
|
|
262
|
+
// the method takes exactly one argument, since that happens to be true
|
|
263
|
+
// in every case, so we don't have to touch the arguments object. The
|
|
264
|
+
// only additional allocation required is the completion record, which
|
|
265
|
+
// has a stable shape and so hopefully should be cheap to allocate.
|
|
266
|
+
|
|
267
|
+
function tryCatch(fn, obj, arg) {
|
|
268
|
+
try {
|
|
269
|
+
return {
|
|
270
|
+
type: "normal",
|
|
271
|
+
arg: fn.call(obj, arg)
|
|
272
|
+
};
|
|
273
|
+
} catch (err) {
|
|
274
|
+
return {
|
|
275
|
+
type: "throw",
|
|
276
|
+
arg: err
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
}
|
|
331
280
|
|
|
332
|
-
|
|
333
|
-
var
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
// do is to check its .name property.
|
|
338
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
339
|
-
: false;
|
|
340
|
-
};
|
|
281
|
+
var GenStateSuspendedStart = "suspendedStart";
|
|
282
|
+
var GenStateSuspendedYield = "suspendedYield";
|
|
283
|
+
var GenStateExecuting = "executing";
|
|
284
|
+
var GenStateCompleted = "completed"; // Returning this object from the innerFn has the same effect as
|
|
285
|
+
// breaking out of the dispatch switch statement.
|
|
341
286
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
287
|
+
var ContinueSentinel = {}; // Dummy constructor functions that we use as the .constructor and
|
|
288
|
+
// .constructor.prototype properties for functions that return Generator
|
|
289
|
+
// objects. For full spec compliance, you may wish to configure your
|
|
290
|
+
// minifier not to mangle the names of these two functions.
|
|
291
|
+
|
|
292
|
+
function Generator() {}
|
|
293
|
+
|
|
294
|
+
function GeneratorFunction() {}
|
|
295
|
+
|
|
296
|
+
function GeneratorFunctionPrototype() {} // This is a polyfill for %IteratorPrototype% for environments that
|
|
297
|
+
// don't natively support it.
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
var IteratorPrototype = {};
|
|
301
|
+
|
|
302
|
+
IteratorPrototype[iteratorSymbol] = function () {
|
|
303
|
+
return this;
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
var getProto = Object.getPrototypeOf;
|
|
307
|
+
var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
|
|
308
|
+
|
|
309
|
+
if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
310
|
+
// This environment has a native %IteratorPrototype%; use it instead
|
|
311
|
+
// of the polyfill.
|
|
312
|
+
IteratorPrototype = NativeIteratorPrototype;
|
|
348
313
|
}
|
|
349
|
-
genFun.prototype = Object.create(Gp);
|
|
350
|
-
return genFun;
|
|
351
|
-
};
|
|
352
314
|
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
return { __await: arg };
|
|
359
|
-
};
|
|
315
|
+
var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
|
|
316
|
+
GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
|
|
317
|
+
GeneratorFunctionPrototype.constructor = GeneratorFunction;
|
|
318
|
+
GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"); // Helper for defining the .next, .throw, and .return methods of the
|
|
319
|
+
// Iterator interface in terms of a single ._invoke method.
|
|
360
320
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
321
|
+
function defineIteratorMethods(prototype) {
|
|
322
|
+
["next", "throw", "return"].forEach(function (method) {
|
|
323
|
+
define(prototype, method, function (arg) {
|
|
324
|
+
return this._invoke(method, arg);
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
exports.isGeneratorFunction = function (genFun) {
|
|
330
|
+
var ctor = typeof genFun === "function" && genFun.constructor;
|
|
331
|
+
return ctor ? ctor === GeneratorFunction || // For the native GeneratorFunction constructor, the best we can
|
|
332
|
+
// do is to check its .name property.
|
|
333
|
+
(ctor.displayName || ctor.name) === "GeneratorFunction" : false;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
exports.mark = function (genFun) {
|
|
337
|
+
if (Object.setPrototypeOf) {
|
|
338
|
+
Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
|
|
366
339
|
} else {
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
340
|
+
genFun.__proto__ = GeneratorFunctionPrototype;
|
|
341
|
+
define(genFun, toStringTagSymbol, "GeneratorFunction");
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
genFun.prototype = Object.create(Gp);
|
|
345
|
+
return genFun;
|
|
346
|
+
}; // Within the body of any async function, `await x` is transformed to
|
|
347
|
+
// `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
|
|
348
|
+
// `hasOwn.call(value, "__await")` to determine if the yielded value is
|
|
349
|
+
// meant to be awaited.
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
exports.awrap = function (arg) {
|
|
353
|
+
return {
|
|
354
|
+
__await: arg
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
function AsyncIterator(generator, PromiseImpl) {
|
|
359
|
+
function invoke(method, arg, resolve, reject) {
|
|
360
|
+
var record = tryCatch(generator[method], generator, arg);
|
|
361
|
+
|
|
362
|
+
if (record.type === "throw") {
|
|
363
|
+
reject(record.arg);
|
|
364
|
+
} else {
|
|
365
|
+
var result = record.arg;
|
|
366
|
+
var value = result.value;
|
|
367
|
+
|
|
368
|
+
if (value && typeof value === "object" && hasOwn.call(value, "__await")) {
|
|
369
|
+
return PromiseImpl.resolve(value.__await).then(function (value) {
|
|
370
|
+
invoke("next", value, resolve, reject);
|
|
371
|
+
}, function (err) {
|
|
372
|
+
invoke("throw", err, resolve, reject);
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
return PromiseImpl.resolve(value).then(function (unwrapped) {
|
|
377
|
+
// When a yielded Promise is resolved, its final value becomes
|
|
378
|
+
// the .value of the Promise<{value,done}> result for the
|
|
379
|
+
// current iteration.
|
|
380
|
+
result.value = unwrapped;
|
|
381
|
+
resolve(result);
|
|
382
|
+
}, function (error) {
|
|
383
|
+
// If a rejected Promise was yielded, throw the rejection back
|
|
384
|
+
// into the async generator function so it can be handled there.
|
|
385
|
+
return invoke("throw", error, resolve, reject);
|
|
376
386
|
});
|
|
377
387
|
}
|
|
378
|
-
|
|
379
|
-
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
380
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
381
|
-
// the .value of the Promise<{value,done}> result for the
|
|
382
|
-
// current iteration.
|
|
383
|
-
result.value = unwrapped;
|
|
384
|
-
resolve(result);
|
|
385
|
-
}, function(error) {
|
|
386
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
387
|
-
// into the async generator function so it can be handled there.
|
|
388
|
-
return invoke("throw", error, resolve, reject);
|
|
389
|
-
});
|
|
390
388
|
}
|
|
391
|
-
}
|
|
392
389
|
|
|
393
|
-
|
|
390
|
+
var previousPromise;
|
|
394
391
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
392
|
+
function enqueue(method, arg) {
|
|
393
|
+
function callInvokeWithMethodAndArg() {
|
|
394
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
395
|
+
invoke(method, arg, resolve, reject);
|
|
396
|
+
});
|
|
397
|
+
}
|
|
401
398
|
|
|
402
|
-
|
|
403
|
-
// If enqueue has been called before, then we want to wait until
|
|
399
|
+
return previousPromise = // If enqueue has been called before, then we want to wait until
|
|
404
400
|
// all previous Promises have been resolved before calling invoke,
|
|
405
401
|
// so that results are always delivered in the correct order. If
|
|
406
402
|
// enqueue has not been called before, then it is important to
|
|
@@ -412,554 +408,525 @@ var runtime = (function (exports) {
|
|
|
412
408
|
// execute code before the first await. Since we implement simple
|
|
413
409
|
// async functions in terms of async generators, it is especially
|
|
414
410
|
// important to get this right, even though it requires care.
|
|
415
|
-
previousPromise ? previousPromise.then(
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
411
|
+
previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, // Avoid propagating failures to Promises returned by later
|
|
412
|
+
// invocations of the iterator.
|
|
413
|
+
callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
|
|
414
|
+
} // Define the unified helper method that is used to implement .next,
|
|
415
|
+
// .throw, and .return (see defineIteratorMethods).
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
this._invoke = enqueue;
|
|
421
419
|
}
|
|
422
420
|
|
|
423
|
-
|
|
424
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
425
|
-
this._invoke = enqueue;
|
|
426
|
-
}
|
|
421
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
|
427
422
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
});
|
|
432
|
-
exports.AsyncIterator = AsyncIterator;
|
|
433
|
-
|
|
434
|
-
// Note that simple async functions are implemented on top of
|
|
435
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
436
|
-
// the final result produced by the iterator.
|
|
437
|
-
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
438
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
439
|
-
|
|
440
|
-
var iter = new AsyncIterator(
|
|
441
|
-
wrap(innerFn, outerFn, self, tryLocsList),
|
|
442
|
-
PromiseImpl
|
|
443
|
-
);
|
|
444
|
-
|
|
445
|
-
return exports.isGeneratorFunction(outerFn)
|
|
446
|
-
? iter // If outerFn is a generator, return the full iterator.
|
|
447
|
-
: iter.next().then(function(result) {
|
|
448
|
-
return result.done ? result.value : iter.next();
|
|
449
|
-
});
|
|
450
|
-
};
|
|
423
|
+
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
424
|
+
return this;
|
|
425
|
+
};
|
|
451
426
|
|
|
452
|
-
|
|
453
|
-
|
|
427
|
+
exports.AsyncIterator = AsyncIterator; // Note that simple async functions are implemented on top of
|
|
428
|
+
// AsyncIterator objects; they just return a Promise for the value of
|
|
429
|
+
// the final result produced by the iterator.
|
|
454
430
|
|
|
455
|
-
|
|
456
|
-
if (
|
|
457
|
-
|
|
458
|
-
|
|
431
|
+
exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
432
|
+
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
433
|
+
var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
|
|
434
|
+
return exports.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
|
|
435
|
+
: iter.next().then(function (result) {
|
|
436
|
+
return result.done ? result.value : iter.next();
|
|
437
|
+
});
|
|
438
|
+
};
|
|
459
439
|
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
440
|
+
function makeInvokeMethod(innerFn, self, context) {
|
|
441
|
+
var state = GenStateSuspendedStart;
|
|
442
|
+
return function invoke(method, arg) {
|
|
443
|
+
if (state === GenStateExecuting) {
|
|
444
|
+
throw new Error("Generator is already running");
|
|
463
445
|
}
|
|
464
446
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
447
|
+
if (state === GenStateCompleted) {
|
|
448
|
+
if (method === "throw") {
|
|
449
|
+
throw arg;
|
|
450
|
+
} // Be forgiving, per 25.3.3.3.3 of the spec:
|
|
451
|
+
// https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
|
|
469
452
|
|
|
470
|
-
context.method = method;
|
|
471
|
-
context.arg = arg;
|
|
472
453
|
|
|
473
|
-
|
|
474
|
-
var delegate = context.delegate;
|
|
475
|
-
if (delegate) {
|
|
476
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
477
|
-
if (delegateResult) {
|
|
478
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
479
|
-
return delegateResult;
|
|
480
|
-
}
|
|
454
|
+
return doneResult();
|
|
481
455
|
}
|
|
482
456
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
457
|
+
context.method = method;
|
|
458
|
+
context.arg = arg;
|
|
459
|
+
|
|
460
|
+
while (true) {
|
|
461
|
+
var delegate = context.delegate;
|
|
487
462
|
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
463
|
+
if (delegate) {
|
|
464
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
465
|
+
|
|
466
|
+
if (delegateResult) {
|
|
467
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
468
|
+
return delegateResult;
|
|
469
|
+
}
|
|
492
470
|
}
|
|
493
471
|
|
|
494
|
-
|
|
472
|
+
if (context.method === "next") {
|
|
473
|
+
// Setting context._sent for legacy support of Babel's
|
|
474
|
+
// function.sent implementation.
|
|
475
|
+
context.sent = context._sent = context.arg;
|
|
476
|
+
} else if (context.method === "throw") {
|
|
477
|
+
if (state === GenStateSuspendedStart) {
|
|
478
|
+
state = GenStateCompleted;
|
|
479
|
+
throw context.arg;
|
|
480
|
+
}
|
|
495
481
|
|
|
496
|
-
|
|
497
|
-
context.
|
|
498
|
-
|
|
482
|
+
context.dispatchException(context.arg);
|
|
483
|
+
} else if (context.method === "return") {
|
|
484
|
+
context.abrupt("return", context.arg);
|
|
485
|
+
}
|
|
499
486
|
|
|
500
|
-
|
|
487
|
+
state = GenStateExecuting;
|
|
488
|
+
var record = tryCatch(innerFn, self, context);
|
|
501
489
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
state = context.done
|
|
507
|
-
? GenStateCompleted
|
|
508
|
-
: GenStateSuspendedYield;
|
|
490
|
+
if (record.type === "normal") {
|
|
491
|
+
// If an exception is thrown from innerFn, we leave state ===
|
|
492
|
+
// GenStateExecuting and loop back for another invocation.
|
|
493
|
+
state = context.done ? GenStateCompleted : GenStateSuspendedYield;
|
|
509
494
|
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
495
|
+
if (record.arg === ContinueSentinel) {
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
513
498
|
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
499
|
+
return {
|
|
500
|
+
value: record.arg,
|
|
501
|
+
done: context.done
|
|
502
|
+
};
|
|
503
|
+
} else if (record.type === "throw") {
|
|
504
|
+
state = GenStateCompleted; // Dispatch the exception by looping back around to the
|
|
505
|
+
// context.dispatchException(context.arg) call above.
|
|
506
|
+
|
|
507
|
+
context.method = "throw";
|
|
508
|
+
context.arg = record.arg;
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
};
|
|
512
|
+
} // Call delegate.iterator[context.method](context.arg) and handle the
|
|
513
|
+
// result, either by returning a { value, done } result from the
|
|
514
|
+
// delegate iterator, or by modifying context.method and context.arg,
|
|
515
|
+
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
function maybeInvokeDelegate(delegate, context) {
|
|
519
|
+
var method = delegate.iterator[context.method];
|
|
520
|
+
|
|
521
|
+
if (method === undefined$1) {
|
|
522
|
+
// A .throw or .return when the delegate iterator has no .throw
|
|
523
|
+
// method always terminates the yield* loop.
|
|
524
|
+
context.delegate = null;
|
|
525
|
+
|
|
526
|
+
if (context.method === "throw") {
|
|
527
|
+
// Note: ["return"] must be used for ES3 parsing compatibility.
|
|
528
|
+
if (delegate.iterator["return"]) {
|
|
529
|
+
// If the delegate iterator has a return method, give it a
|
|
530
|
+
// chance to clean up.
|
|
531
|
+
context.method = "return";
|
|
532
|
+
context.arg = undefined$1;
|
|
533
|
+
maybeInvokeDelegate(delegate, context);
|
|
534
|
+
|
|
535
|
+
if (context.method === "throw") {
|
|
536
|
+
// If maybeInvokeDelegate(context) changed context.method from
|
|
537
|
+
// "return" to "throw", let that override the TypeError below.
|
|
538
|
+
return ContinueSentinel;
|
|
539
|
+
}
|
|
540
|
+
}
|
|
518
541
|
|
|
519
|
-
} else if (record.type === "throw") {
|
|
520
|
-
state = GenStateCompleted;
|
|
521
|
-
// Dispatch the exception by looping back around to the
|
|
522
|
-
// context.dispatchException(context.arg) call above.
|
|
523
542
|
context.method = "throw";
|
|
524
|
-
context.arg =
|
|
543
|
+
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
525
544
|
}
|
|
545
|
+
|
|
546
|
+
return ContinueSentinel;
|
|
526
547
|
}
|
|
527
|
-
};
|
|
528
|
-
}
|
|
529
548
|
|
|
530
|
-
|
|
531
|
-
// result, either by returning a { value, done } result from the
|
|
532
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
533
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
534
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
535
|
-
var method = delegate.iterator[context.method];
|
|
536
|
-
if (method === undefined$1) {
|
|
537
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
538
|
-
// method always terminates the yield* loop.
|
|
539
|
-
context.delegate = null;
|
|
549
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
540
550
|
|
|
541
|
-
if (
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
context.arg = undefined$1;
|
|
548
|
-
maybeInvokeDelegate(delegate, context);
|
|
551
|
+
if (record.type === "throw") {
|
|
552
|
+
context.method = "throw";
|
|
553
|
+
context.arg = record.arg;
|
|
554
|
+
context.delegate = null;
|
|
555
|
+
return ContinueSentinel;
|
|
556
|
+
}
|
|
549
557
|
|
|
550
|
-
|
|
551
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
552
|
-
// "return" to "throw", let that override the TypeError below.
|
|
553
|
-
return ContinueSentinel;
|
|
554
|
-
}
|
|
555
|
-
}
|
|
558
|
+
var info = record.arg;
|
|
556
559
|
|
|
560
|
+
if (!info) {
|
|
557
561
|
context.method = "throw";
|
|
558
|
-
context.arg = new TypeError(
|
|
559
|
-
|
|
562
|
+
context.arg = new TypeError("iterator result is not an object");
|
|
563
|
+
context.delegate = null;
|
|
564
|
+
return ContinueSentinel;
|
|
560
565
|
}
|
|
561
566
|
|
|
562
|
-
|
|
563
|
-
|
|
567
|
+
if (info.done) {
|
|
568
|
+
// Assign the result of the finished delegate to the temporary
|
|
569
|
+
// variable specified by delegate.resultName (see delegateYield).
|
|
570
|
+
context[delegate.resultName] = info.value; // Resume execution at the desired location (see delegateYield).
|
|
564
571
|
|
|
565
|
-
|
|
572
|
+
context.next = delegate.nextLoc; // If context.method was "throw" but the delegate handled the
|
|
573
|
+
// exception, let the outer generator proceed normally. If
|
|
574
|
+
// context.method was "next", forget context.arg since it has been
|
|
575
|
+
// "consumed" by the delegate iterator. If context.method was
|
|
576
|
+
// "return", allow the original .return call to continue in the
|
|
577
|
+
// outer generator.
|
|
566
578
|
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
579
|
+
if (context.method !== "return") {
|
|
580
|
+
context.method = "next";
|
|
581
|
+
context.arg = undefined$1;
|
|
582
|
+
}
|
|
583
|
+
} else {
|
|
584
|
+
// Re-yield the result returned by the delegate method.
|
|
585
|
+
return info;
|
|
586
|
+
} // The delegate iterator is finished, so forget it and continue with
|
|
587
|
+
// the outer generator.
|
|
573
588
|
|
|
574
|
-
var info = record.arg;
|
|
575
589
|
|
|
576
|
-
if (! info) {
|
|
577
|
-
context.method = "throw";
|
|
578
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
579
590
|
context.delegate = null;
|
|
580
591
|
return ContinueSentinel;
|
|
581
|
-
}
|
|
592
|
+
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
593
|
+
// unified ._invoke helper method.
|
|
582
594
|
|
|
583
|
-
if (info.done) {
|
|
584
|
-
// Assign the result of the finished delegate to the temporary
|
|
585
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
586
|
-
context[delegate.resultName] = info.value;
|
|
587
|
-
|
|
588
|
-
// Resume execution at the desired location (see delegateYield).
|
|
589
|
-
context.next = delegate.nextLoc;
|
|
590
|
-
|
|
591
|
-
// If context.method was "throw" but the delegate handled the
|
|
592
|
-
// exception, let the outer generator proceed normally. If
|
|
593
|
-
// context.method was "next", forget context.arg since it has been
|
|
594
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
595
|
-
// "return", allow the original .return call to continue in the
|
|
596
|
-
// outer generator.
|
|
597
|
-
if (context.method !== "return") {
|
|
598
|
-
context.method = "next";
|
|
599
|
-
context.arg = undefined$1;
|
|
600
|
-
}
|
|
601
|
-
|
|
602
|
-
} else {
|
|
603
|
-
// Re-yield the result returned by the delegate method.
|
|
604
|
-
return info;
|
|
605
|
-
}
|
|
606
595
|
|
|
607
|
-
|
|
608
|
-
// the
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
596
|
+
defineIteratorMethods(Gp);
|
|
597
|
+
define(Gp, toStringTagSymbol, "Generator"); // A Generator should always return itself as the iterator object when the
|
|
598
|
+
// @@iterator function is called on it. Some browsers' implementations of the
|
|
599
|
+
// iterator prototype chain incorrectly implement this, causing the Generator
|
|
600
|
+
// object to not be returned from this call. This ensures that doesn't happen.
|
|
601
|
+
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
612
602
|
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
603
|
+
Gp[iteratorSymbol] = function () {
|
|
604
|
+
return this;
|
|
605
|
+
};
|
|
616
606
|
|
|
617
|
-
|
|
607
|
+
Gp.toString = function () {
|
|
608
|
+
return "[object Generator]";
|
|
609
|
+
};
|
|
618
610
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
624
|
-
define(Gp, iteratorSymbol, function() {
|
|
625
|
-
return this;
|
|
626
|
-
});
|
|
611
|
+
function pushTryEntry(locs) {
|
|
612
|
+
var entry = {
|
|
613
|
+
tryLoc: locs[0]
|
|
614
|
+
};
|
|
627
615
|
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
616
|
+
if (1 in locs) {
|
|
617
|
+
entry.catchLoc = locs[1];
|
|
618
|
+
}
|
|
631
619
|
|
|
632
|
-
|
|
633
|
-
|
|
620
|
+
if (2 in locs) {
|
|
621
|
+
entry.finallyLoc = locs[2];
|
|
622
|
+
entry.afterLoc = locs[3];
|
|
623
|
+
}
|
|
634
624
|
|
|
635
|
-
|
|
636
|
-
entry.catchLoc = locs[1];
|
|
625
|
+
this.tryEntries.push(entry);
|
|
637
626
|
}
|
|
638
627
|
|
|
639
|
-
|
|
640
|
-
entry.
|
|
641
|
-
|
|
628
|
+
function resetTryEntry(entry) {
|
|
629
|
+
var record = entry.completion || {};
|
|
630
|
+
record.type = "normal";
|
|
631
|
+
delete record.arg;
|
|
632
|
+
entry.completion = record;
|
|
642
633
|
}
|
|
643
634
|
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
function Context(tryLocsList) {
|
|
655
|
-
// The root entry object (effectively a try statement without a catch
|
|
656
|
-
// or a finally block) gives us a place to store values thrown from
|
|
657
|
-
// locations where there is no enclosing try statement.
|
|
658
|
-
this.tryEntries = [{ tryLoc: "root" }];
|
|
659
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
660
|
-
this.reset(true);
|
|
661
|
-
}
|
|
662
|
-
|
|
663
|
-
exports.keys = function(object) {
|
|
664
|
-
var keys = [];
|
|
665
|
-
for (var key in object) {
|
|
666
|
-
keys.push(key);
|
|
635
|
+
function Context(tryLocsList) {
|
|
636
|
+
// The root entry object (effectively a try statement without a catch
|
|
637
|
+
// or a finally block) gives us a place to store values thrown from
|
|
638
|
+
// locations where there is no enclosing try statement.
|
|
639
|
+
this.tryEntries = [{
|
|
640
|
+
tryLoc: "root"
|
|
641
|
+
}];
|
|
642
|
+
tryLocsList.forEach(pushTryEntry, this);
|
|
643
|
+
this.reset(true);
|
|
667
644
|
}
|
|
668
|
-
keys.reverse();
|
|
669
|
-
|
|
670
|
-
// Rather than returning an object with a next method, we keep
|
|
671
|
-
// things simple and return the next function itself.
|
|
672
|
-
return function next() {
|
|
673
|
-
while (keys.length) {
|
|
674
|
-
var key = keys.pop();
|
|
675
|
-
if (key in object) {
|
|
676
|
-
next.value = key;
|
|
677
|
-
next.done = false;
|
|
678
|
-
return next;
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
645
|
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
// also ensures that the minifier will not anonymize the function.
|
|
685
|
-
next.done = true;
|
|
686
|
-
return next;
|
|
687
|
-
};
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
function values(iterable) {
|
|
691
|
-
if (iterable) {
|
|
692
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
693
|
-
if (iteratorMethod) {
|
|
694
|
-
return iteratorMethod.call(iterable);
|
|
695
|
-
}
|
|
646
|
+
exports.keys = function (object) {
|
|
647
|
+
var keys = [];
|
|
696
648
|
|
|
697
|
-
|
|
698
|
-
|
|
649
|
+
for (var key in object) {
|
|
650
|
+
keys.push(key);
|
|
699
651
|
}
|
|
700
652
|
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
while (++i < iterable.length) {
|
|
704
|
-
if (hasOwn.call(iterable, i)) {
|
|
705
|
-
next.value = iterable[i];
|
|
706
|
-
next.done = false;
|
|
707
|
-
return next;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
653
|
+
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
654
|
+
// things simple and return the next function itself.
|
|
710
655
|
|
|
711
|
-
|
|
712
|
-
|
|
656
|
+
return function next() {
|
|
657
|
+
while (keys.length) {
|
|
658
|
+
var key = keys.pop();
|
|
713
659
|
|
|
714
|
-
|
|
715
|
-
|
|
660
|
+
if (key in object) {
|
|
661
|
+
next.value = key;
|
|
662
|
+
next.done = false;
|
|
663
|
+
return next;
|
|
664
|
+
}
|
|
665
|
+
} // To avoid creating an additional object, we just hang the .value
|
|
666
|
+
// and .done properties off the next function object itself. This
|
|
667
|
+
// also ensures that the minifier will not anonymize the function.
|
|
716
668
|
|
|
717
|
-
return next.next = next;
|
|
718
|
-
}
|
|
719
|
-
}
|
|
720
669
|
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
670
|
+
next.done = true;
|
|
671
|
+
return next;
|
|
672
|
+
};
|
|
673
|
+
};
|
|
725
674
|
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
675
|
+
function values(iterable) {
|
|
676
|
+
if (iterable) {
|
|
677
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
729
678
|
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
reset: function(skipTempReset) {
|
|
734
|
-
this.prev = 0;
|
|
735
|
-
this.next = 0;
|
|
736
|
-
// Resetting context._sent for legacy support of Babel's
|
|
737
|
-
// function.sent implementation.
|
|
738
|
-
this.sent = this._sent = undefined$1;
|
|
739
|
-
this.done = false;
|
|
740
|
-
this.delegate = null;
|
|
741
|
-
|
|
742
|
-
this.method = "next";
|
|
743
|
-
this.arg = undefined$1;
|
|
744
|
-
|
|
745
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
746
|
-
|
|
747
|
-
if (!skipTempReset) {
|
|
748
|
-
for (var name in this) {
|
|
749
|
-
// Not sure about the optimal order of these conditions:
|
|
750
|
-
if (name.charAt(0) === "t" &&
|
|
751
|
-
hasOwn.call(this, name) &&
|
|
752
|
-
!isNaN(+name.slice(1))) {
|
|
753
|
-
this[name] = undefined$1;
|
|
754
|
-
}
|
|
679
|
+
if (iteratorMethod) {
|
|
680
|
+
return iteratorMethod.call(iterable);
|
|
755
681
|
}
|
|
756
|
-
}
|
|
757
|
-
},
|
|
758
|
-
|
|
759
|
-
stop: function() {
|
|
760
|
-
this.done = true;
|
|
761
682
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
throw rootRecord.arg;
|
|
766
|
-
}
|
|
767
|
-
|
|
768
|
-
return this.rval;
|
|
769
|
-
},
|
|
683
|
+
if (typeof iterable.next === "function") {
|
|
684
|
+
return iterable;
|
|
685
|
+
}
|
|
770
686
|
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
687
|
+
if (!isNaN(iterable.length)) {
|
|
688
|
+
var i = -1,
|
|
689
|
+
next = function next() {
|
|
690
|
+
while (++i < iterable.length) {
|
|
691
|
+
if (hasOwn.call(iterable, i)) {
|
|
692
|
+
next.value = iterable[i];
|
|
693
|
+
next.done = false;
|
|
694
|
+
return next;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
775
697
|
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
context.next = loc;
|
|
698
|
+
next.value = undefined$1;
|
|
699
|
+
next.done = true;
|
|
700
|
+
return next;
|
|
701
|
+
};
|
|
781
702
|
|
|
782
|
-
|
|
783
|
-
// If the dispatched exception was caught by a catch block,
|
|
784
|
-
// then let that catch block handle the exception normally.
|
|
785
|
-
context.method = "next";
|
|
786
|
-
context.arg = undefined$1;
|
|
703
|
+
return next.next = next;
|
|
787
704
|
}
|
|
705
|
+
} // Return an iterator with no values.
|
|
788
706
|
|
|
789
|
-
return !! caught;
|
|
790
|
-
}
|
|
791
707
|
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
708
|
+
return {
|
|
709
|
+
next: doneResult
|
|
710
|
+
};
|
|
711
|
+
}
|
|
795
712
|
|
|
796
|
-
|
|
797
|
-
// Exception thrown outside of any try block that could handle
|
|
798
|
-
// it, so set the completion value of the entire function to
|
|
799
|
-
// throw the exception.
|
|
800
|
-
return handle("end");
|
|
801
|
-
}
|
|
713
|
+
exports.values = values;
|
|
802
714
|
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
715
|
+
function doneResult() {
|
|
716
|
+
return {
|
|
717
|
+
value: undefined$1,
|
|
718
|
+
done: true
|
|
719
|
+
};
|
|
720
|
+
}
|
|
806
721
|
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
722
|
+
Context.prototype = {
|
|
723
|
+
constructor: Context,
|
|
724
|
+
reset: function reset(skipTempReset) {
|
|
725
|
+
this.prev = 0;
|
|
726
|
+
this.next = 0; // Resetting context._sent for legacy support of Babel's
|
|
727
|
+
// function.sent implementation.
|
|
813
728
|
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
729
|
+
this.sent = this._sent = undefined$1;
|
|
730
|
+
this.done = false;
|
|
731
|
+
this.delegate = null;
|
|
732
|
+
this.method = "next";
|
|
733
|
+
this.arg = undefined$1;
|
|
734
|
+
this.tryEntries.forEach(resetTryEntry);
|
|
818
735
|
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
736
|
+
if (!skipTempReset) {
|
|
737
|
+
for (var name in this) {
|
|
738
|
+
// Not sure about the optimal order of these conditions:
|
|
739
|
+
if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
|
|
740
|
+
this[name] = undefined$1;
|
|
822
741
|
}
|
|
823
|
-
|
|
824
|
-
} else {
|
|
825
|
-
throw new Error("try statement without catch or finally");
|
|
826
742
|
}
|
|
827
743
|
}
|
|
828
|
-
}
|
|
829
|
-
|
|
744
|
+
},
|
|
745
|
+
stop: function stop() {
|
|
746
|
+
this.done = true;
|
|
747
|
+
var rootEntry = this.tryEntries[0];
|
|
748
|
+
var rootRecord = rootEntry.completion;
|
|
749
|
+
|
|
750
|
+
if (rootRecord.type === "throw") {
|
|
751
|
+
throw rootRecord.arg;
|
|
752
|
+
}
|
|
830
753
|
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
if (
|
|
835
|
-
|
|
836
|
-
this.prev < entry.finallyLoc) {
|
|
837
|
-
var finallyEntry = entry;
|
|
838
|
-
break;
|
|
754
|
+
return this.rval;
|
|
755
|
+
},
|
|
756
|
+
dispatchException: function dispatchException(exception) {
|
|
757
|
+
if (this.done) {
|
|
758
|
+
throw exception;
|
|
839
759
|
}
|
|
840
|
-
}
|
|
841
760
|
|
|
842
|
-
|
|
843
|
-
(type === "break" ||
|
|
844
|
-
type === "continue") &&
|
|
845
|
-
finallyEntry.tryLoc <= arg &&
|
|
846
|
-
arg <= finallyEntry.finallyLoc) {
|
|
847
|
-
// Ignore the finally entry if control is not jumping to a
|
|
848
|
-
// location outside the try/catch block.
|
|
849
|
-
finallyEntry = null;
|
|
850
|
-
}
|
|
761
|
+
var context = this;
|
|
851
762
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
763
|
+
function handle(loc, caught) {
|
|
764
|
+
record.type = "throw";
|
|
765
|
+
record.arg = exception;
|
|
766
|
+
context.next = loc;
|
|
855
767
|
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
768
|
+
if (caught) {
|
|
769
|
+
// If the dispatched exception was caught by a catch block,
|
|
770
|
+
// then let that catch block handle the exception normally.
|
|
771
|
+
context.method = "next";
|
|
772
|
+
context.arg = undefined$1;
|
|
773
|
+
}
|
|
861
774
|
|
|
862
|
-
|
|
863
|
-
|
|
775
|
+
return !!caught;
|
|
776
|
+
}
|
|
864
777
|
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
}
|
|
778
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
779
|
+
var entry = this.tryEntries[i];
|
|
780
|
+
var record = entry.completion;
|
|
869
781
|
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
this.next = "end";
|
|
877
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
878
|
-
this.next = afterLoc;
|
|
879
|
-
}
|
|
782
|
+
if (entry.tryLoc === "root") {
|
|
783
|
+
// Exception thrown outside of any try block that could handle
|
|
784
|
+
// it, so set the completion value of the entire function to
|
|
785
|
+
// throw the exception.
|
|
786
|
+
return handle("end");
|
|
787
|
+
}
|
|
880
788
|
|
|
881
|
-
|
|
882
|
-
|
|
789
|
+
if (entry.tryLoc <= this.prev) {
|
|
790
|
+
var hasCatch = hasOwn.call(entry, "catchLoc");
|
|
791
|
+
var hasFinally = hasOwn.call(entry, "finallyLoc");
|
|
792
|
+
|
|
793
|
+
if (hasCatch && hasFinally) {
|
|
794
|
+
if (this.prev < entry.catchLoc) {
|
|
795
|
+
return handle(entry.catchLoc, true);
|
|
796
|
+
} else if (this.prev < entry.finallyLoc) {
|
|
797
|
+
return handle(entry.finallyLoc);
|
|
798
|
+
}
|
|
799
|
+
} else if (hasCatch) {
|
|
800
|
+
if (this.prev < entry.catchLoc) {
|
|
801
|
+
return handle(entry.catchLoc, true);
|
|
802
|
+
}
|
|
803
|
+
} else if (hasFinally) {
|
|
804
|
+
if (this.prev < entry.finallyLoc) {
|
|
805
|
+
return handle(entry.finallyLoc);
|
|
806
|
+
}
|
|
807
|
+
} else {
|
|
808
|
+
throw new Error("try statement without catch or finally");
|
|
809
|
+
}
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
},
|
|
813
|
+
abrupt: function abrupt(type, arg) {
|
|
814
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
815
|
+
var entry = this.tryEntries[i];
|
|
816
|
+
|
|
817
|
+
if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
|
|
818
|
+
var finallyEntry = entry;
|
|
819
|
+
break;
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
|
|
824
|
+
// Ignore the finally entry if control is not jumping to a
|
|
825
|
+
// location outside the try/catch block.
|
|
826
|
+
finallyEntry = null;
|
|
827
|
+
}
|
|
883
828
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
829
|
+
var record = finallyEntry ? finallyEntry.completion : {};
|
|
830
|
+
record.type = type;
|
|
831
|
+
record.arg = arg;
|
|
832
|
+
|
|
833
|
+
if (finallyEntry) {
|
|
834
|
+
this.method = "next";
|
|
835
|
+
this.next = finallyEntry.finallyLoc;
|
|
890
836
|
return ContinueSentinel;
|
|
891
837
|
}
|
|
892
|
-
}
|
|
893
|
-
},
|
|
894
838
|
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
if (
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
839
|
+
return this.complete(record);
|
|
840
|
+
},
|
|
841
|
+
complete: function complete(record, afterLoc) {
|
|
842
|
+
if (record.type === "throw") {
|
|
843
|
+
throw record.arg;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
if (record.type === "break" || record.type === "continue") {
|
|
847
|
+
this.next = record.arg;
|
|
848
|
+
} else if (record.type === "return") {
|
|
849
|
+
this.rval = this.arg = record.arg;
|
|
850
|
+
this.method = "return";
|
|
851
|
+
this.next = "end";
|
|
852
|
+
} else if (record.type === "normal" && afterLoc) {
|
|
853
|
+
this.next = afterLoc;
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
return ContinueSentinel;
|
|
857
|
+
},
|
|
858
|
+
finish: function finish(finallyLoc) {
|
|
859
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
860
|
+
var entry = this.tryEntries[i];
|
|
861
|
+
|
|
862
|
+
if (entry.finallyLoc === finallyLoc) {
|
|
863
|
+
this.complete(entry.completion, entry.afterLoc);
|
|
902
864
|
resetTryEntry(entry);
|
|
865
|
+
return ContinueSentinel;
|
|
903
866
|
}
|
|
904
|
-
return thrown;
|
|
905
867
|
}
|
|
906
|
-
}
|
|
868
|
+
},
|
|
869
|
+
"catch": function _catch(tryLoc) {
|
|
870
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
871
|
+
var entry = this.tryEntries[i];
|
|
907
872
|
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
throw new Error("illegal catch attempt");
|
|
911
|
-
},
|
|
873
|
+
if (entry.tryLoc === tryLoc) {
|
|
874
|
+
var record = entry.completion;
|
|
912
875
|
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
nextLoc: nextLoc
|
|
918
|
-
};
|
|
876
|
+
if (record.type === "throw") {
|
|
877
|
+
var thrown = record.arg;
|
|
878
|
+
resetTryEntry(entry);
|
|
879
|
+
}
|
|
919
880
|
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
//
|
|
923
|
-
|
|
924
|
-
}
|
|
881
|
+
return thrown;
|
|
882
|
+
}
|
|
883
|
+
} // The context.catch method must only be called with a location
|
|
884
|
+
// argument that corresponds to a known catch block.
|
|
925
885
|
|
|
926
|
-
return ContinueSentinel;
|
|
927
|
-
}
|
|
928
|
-
};
|
|
929
886
|
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
887
|
+
throw new Error("illegal catch attempt");
|
|
888
|
+
},
|
|
889
|
+
delegateYield: function delegateYield(iterable, resultName, nextLoc) {
|
|
890
|
+
this.delegate = {
|
|
891
|
+
iterator: values(iterable),
|
|
892
|
+
resultName: resultName,
|
|
893
|
+
nextLoc: nextLoc
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
if (this.method === "next") {
|
|
897
|
+
// Deliberately forget the last sent value so that we don't
|
|
898
|
+
// accidentally pass it on to the delegate.
|
|
899
|
+
this.arg = undefined$1;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
return ContinueSentinel;
|
|
903
|
+
}
|
|
904
|
+
}; // Regardless of whether this script is executing as a CommonJS module
|
|
905
|
+
// or not, return the runtime object so that we can declare the variable
|
|
906
|
+
// regeneratorRuntime in the outer scope, which allows this module to be
|
|
907
|
+
// injected easily by `bin/regenerator --include-runtime script.js`.
|
|
935
908
|
|
|
936
|
-
|
|
937
|
-
// If this script is executing as a CommonJS module, use module.exports
|
|
909
|
+
return exports;
|
|
910
|
+
}( // If this script is executing as a CommonJS module, use module.exports
|
|
938
911
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
939
912
|
// object. Either way, the resulting object will be used to initialize
|
|
940
913
|
// the regeneratorRuntime variable at the top of this file.
|
|
941
|
-
module.exports
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
956
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
957
|
-
if (typeof globalThis === "object") {
|
|
958
|
-
globalThis.regeneratorRuntime = runtime;
|
|
959
|
-
} else {
|
|
914
|
+
module.exports );
|
|
915
|
+
|
|
916
|
+
try {
|
|
917
|
+
regeneratorRuntime = runtime;
|
|
918
|
+
} catch (accidentalStrictMode) {
|
|
919
|
+
// This module should not be running in strict mode, so the above
|
|
920
|
+
// assignment should always work unless something is misconfigured. Just
|
|
921
|
+
// in case runtime.js accidentally runs in strict mode, we can escape
|
|
922
|
+
// strict mode using a global Function call. This could conceivably fail
|
|
923
|
+
// if a Content Security Policy forbids using Function, but in that case
|
|
924
|
+
// the proper solution is to fix the accidental strict mode problem. If
|
|
925
|
+
// you've misconfigured your bundler to force strict mode and applied a
|
|
926
|
+
// CSP to forbid Function, and you're not willing to fix either of those
|
|
927
|
+
// problems, please detail your unique predicament in a GitHub issue.
|
|
960
928
|
Function("r", "regeneratorRuntime = r")(runtime);
|
|
961
929
|
}
|
|
962
|
-
}
|
|
963
930
|
});
|
|
964
931
|
|
|
965
932
|
function queryParamsToApi(params) {
|
|
@@ -1376,7 +1343,7 @@ function mkTableOptions(tables) {
|
|
|
1376
1343
|
};
|
|
1377
1344
|
});
|
|
1378
1345
|
}
|
|
1379
|
-
function mkFieldOptions(tables, tableId) {
|
|
1346
|
+
function mkFieldOptions(tables, tableId, types) {
|
|
1380
1347
|
if (!tables) {
|
|
1381
1348
|
return [];
|
|
1382
1349
|
}
|
|
@@ -1389,7 +1356,15 @@ function mkFieldOptions(tables, tableId) {
|
|
|
1389
1356
|
return [];
|
|
1390
1357
|
}
|
|
1391
1358
|
|
|
1392
|
-
|
|
1359
|
+
var fields = table.schema.fields;
|
|
1360
|
+
|
|
1361
|
+
if (types) {
|
|
1362
|
+
fields = fields.filter(function (f) {
|
|
1363
|
+
return types.includes(f.type);
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
return fields.map(function (f) {
|
|
1393
1368
|
return {
|
|
1394
1369
|
value: f.identifier,
|
|
1395
1370
|
label: f.name || f.identifier
|
|
@@ -1398,7 +1373,7 @@ function mkFieldOptions(tables, tableId) {
|
|
|
1398
1373
|
}
|
|
1399
1374
|
|
|
1400
1375
|
var _excluded = ["children"],
|
|
1401
|
-
_excluded2 = ["table", "
|
|
1376
|
+
_excluded2 = ["className", "table", "field", "setControlContextData"];
|
|
1402
1377
|
var modulePath = "@plasmicpkgs/plasmic-cms";
|
|
1403
1378
|
var componentPrefix = "hostless-plasmic-cms";
|
|
1404
1379
|
var fetcherComponentPropMetas = {
|
|
@@ -1476,6 +1451,19 @@ function CmsCredentialsProvider(_ref) {
|
|
|
1476
1451
|
config = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1477
1452
|
|
|
1478
1453
|
config.host = config.host || defaultHost;
|
|
1454
|
+
|
|
1455
|
+
if (!config.databaseId) {
|
|
1456
|
+
throw new Error("You must specify the CMS database ID to use.");
|
|
1457
|
+
}
|
|
1458
|
+
|
|
1459
|
+
if (!config.projectId) {
|
|
1460
|
+
throw new Error("You must specify the project you are using this CMS from.");
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1463
|
+
if (!config.projectApiToken) {
|
|
1464
|
+
throw new Error("You must specify the token of the project you are using this CMS from.");
|
|
1465
|
+
}
|
|
1466
|
+
|
|
1479
1467
|
return React.createElement(DatabaseProvider, {
|
|
1480
1468
|
config: config
|
|
1481
1469
|
}, React.createElement(TablesFetcher, null, children));
|
|
@@ -1570,8 +1558,11 @@ function CmsQueryLoader(_ref5) {
|
|
|
1570
1558
|
var table = _ref5.table,
|
|
1571
1559
|
children = _ref5.children,
|
|
1572
1560
|
setControlContextData = _ref5.setControlContextData,
|
|
1573
|
-
|
|
1574
|
-
|
|
1561
|
+
where = _ref5.where,
|
|
1562
|
+
useDraft = _ref5.useDraft,
|
|
1563
|
+
orderBy = _ref5.orderBy,
|
|
1564
|
+
desc = _ref5.desc,
|
|
1565
|
+
limit = _ref5.limit;
|
|
1575
1566
|
var databaseConfig = useDatabase();
|
|
1576
1567
|
var tables = useTables();
|
|
1577
1568
|
|
|
@@ -1582,6 +1573,13 @@ function CmsQueryLoader(_ref5) {
|
|
|
1582
1573
|
});
|
|
1583
1574
|
}
|
|
1584
1575
|
|
|
1576
|
+
var params = {
|
|
1577
|
+
where: where,
|
|
1578
|
+
useDraft: useDraft,
|
|
1579
|
+
orderBy: orderBy,
|
|
1580
|
+
desc: desc,
|
|
1581
|
+
limit: limit
|
|
1582
|
+
};
|
|
1585
1583
|
var cacheKey = JSON.stringify({
|
|
1586
1584
|
component: "CmsQueryLoader",
|
|
1587
1585
|
table: table,
|
|
@@ -1699,18 +1697,20 @@ var cmsRowFieldMeta = {
|
|
|
1699
1697
|
var _ctx$table;
|
|
1700
1698
|
|
|
1701
1699
|
var table = _ref8.table;
|
|
1702
|
-
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table = ctx == null ? void 0 : ctx.table) != null ? _ctx$table : table);
|
|
1700
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table = ctx == null ? void 0 : ctx.table) != null ? _ctx$table : table, ["number", "boolean", "text", "long-text", "date-time"]);
|
|
1703
1701
|
}
|
|
1704
1702
|
}
|
|
1705
1703
|
}
|
|
1706
1704
|
};
|
|
1707
1705
|
function CmsRowField(_ref9) {
|
|
1708
|
-
var
|
|
1706
|
+
var _res$row$data;
|
|
1709
1707
|
|
|
1710
1708
|
var className = _ref9.className,
|
|
1711
1709
|
table = _ref9.table,
|
|
1712
1710
|
field = _ref9.field,
|
|
1713
|
-
setControlContextData = _ref9.setControlContextData
|
|
1711
|
+
setControlContextData = _ref9.setControlContextData,
|
|
1712
|
+
rest = _objectWithoutPropertiesLoose(_ref9, _excluded2);
|
|
1713
|
+
|
|
1714
1714
|
var tables = useTables();
|
|
1715
1715
|
var res = useRow(table);
|
|
1716
1716
|
|
|
@@ -1726,21 +1726,40 @@ function CmsRowField(_ref9) {
|
|
|
1726
1726
|
});
|
|
1727
1727
|
}
|
|
1728
1728
|
|
|
1729
|
-
var
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
})
|
|
1729
|
+
var fieldMeta = deriveInferredTableField({
|
|
1730
|
+
table: res.table,
|
|
1731
|
+
tables: tables,
|
|
1732
|
+
field: field,
|
|
1733
|
+
typeFilters: ["text"]
|
|
1734
|
+
});
|
|
1735
1735
|
|
|
1736
1736
|
if (!fieldMeta) {
|
|
1737
1737
|
return React.createElement("div", null, "Error: No field to display");
|
|
1738
1738
|
}
|
|
1739
1739
|
|
|
1740
1740
|
var data = (_res$row$data = res.row.data) == null ? void 0 : _res$row$data[fieldMeta.identifier];
|
|
1741
|
-
return data ? renderValue(data, fieldMeta.type, {
|
|
1741
|
+
return data ? renderValue(data, fieldMeta.type, _extends({
|
|
1742
1742
|
className: className
|
|
1743
|
-
}) :
|
|
1743
|
+
}, rest)) : null;
|
|
1744
|
+
}
|
|
1745
|
+
var DEFAULT_TYPE_FILTERS = ["text"];
|
|
1746
|
+
|
|
1747
|
+
function deriveInferredTableField(opts) {
|
|
1748
|
+
var _tables$find;
|
|
1749
|
+
|
|
1750
|
+
var table = opts.table,
|
|
1751
|
+
tables = opts.tables,
|
|
1752
|
+
field = opts.field,
|
|
1753
|
+
typeFilters = opts.typeFilters;
|
|
1754
|
+
var schema = tables == null ? void 0 : (_tables$find = tables.find(function (t) {
|
|
1755
|
+
return t.identifier === table;
|
|
1756
|
+
})) == null ? void 0 : _tables$find.schema;
|
|
1757
|
+
var fieldMeta = field ? schema == null ? void 0 : schema.fields.find(function (f) {
|
|
1758
|
+
return f.identifier === field;
|
|
1759
|
+
}) : schema == null ? void 0 : schema.fields.find(function (f) {
|
|
1760
|
+
return (typeFilters != null ? typeFilters : DEFAULT_TYPE_FILTERS).includes(f.type);
|
|
1761
|
+
});
|
|
1762
|
+
return fieldMeta;
|
|
1744
1763
|
}
|
|
1745
1764
|
|
|
1746
1765
|
function assertNever(_) {
|
|
@@ -1754,18 +1773,15 @@ function renderValue(value, type, props) {
|
|
|
1754
1773
|
case "text":
|
|
1755
1774
|
case "long-text":
|
|
1756
1775
|
case "date-time":
|
|
1757
|
-
return React.createElement("div", {
|
|
1758
|
-
className: props.className
|
|
1759
|
-
}, value);
|
|
1776
|
+
return React.createElement("div", Object.assign({}, props), value);
|
|
1760
1777
|
|
|
1761
1778
|
case "image":
|
|
1762
1779
|
if (value && typeof value === "object" && value.url && value.imageMeta) {
|
|
1763
|
-
return React.createElement("img", {
|
|
1780
|
+
return React.createElement("img", Object.assign({
|
|
1764
1781
|
src: value.url,
|
|
1765
1782
|
width: value.imageMeta.height,
|
|
1766
|
-
height: value.imageMeta.height
|
|
1767
|
-
|
|
1768
|
-
});
|
|
1783
|
+
height: value.imageMeta.height
|
|
1784
|
+
}, props));
|
|
1769
1785
|
}
|
|
1770
1786
|
|
|
1771
1787
|
return null;
|
|
@@ -1784,7 +1800,7 @@ var cmsRowLinkMeta = {
|
|
|
1784
1800
|
children: {
|
|
1785
1801
|
type: "slot",
|
|
1786
1802
|
defaultValue: {
|
|
1787
|
-
type: "
|
|
1803
|
+
type: "text",
|
|
1788
1804
|
tag: "a",
|
|
1789
1805
|
value: "Link"
|
|
1790
1806
|
}
|
|
@@ -1817,7 +1833,7 @@ var cmsRowLinkMeta = {
|
|
|
1817
1833
|
}
|
|
1818
1834
|
};
|
|
1819
1835
|
function CmsRowLink(_ref11) {
|
|
1820
|
-
var
|
|
1836
|
+
var _res$row$data2;
|
|
1821
1837
|
|
|
1822
1838
|
var table = _ref11.table,
|
|
1823
1839
|
field = _ref11.field,
|
|
@@ -1828,7 +1844,7 @@ function CmsRowLink(_ref11) {
|
|
|
1828
1844
|
var res = useRow(table);
|
|
1829
1845
|
|
|
1830
1846
|
if (!res || !res.row) {
|
|
1831
|
-
return React.createElement(
|
|
1847
|
+
return React.createElement(React.Fragment, null, children);
|
|
1832
1848
|
}
|
|
1833
1849
|
|
|
1834
1850
|
if (tables) {
|
|
@@ -1839,17 +1855,19 @@ function CmsRowLink(_ref11) {
|
|
|
1839
1855
|
});
|
|
1840
1856
|
}
|
|
1841
1857
|
|
|
1842
|
-
var
|
|
1843
|
-
|
|
1844
|
-
|
|
1845
|
-
|
|
1846
|
-
|
|
1847
|
-
}) : schema == null ? void 0 : schema.fields.find(function (f) {
|
|
1848
|
-
return f.type === "text";
|
|
1858
|
+
var fieldMeta = deriveInferredTableField({
|
|
1859
|
+
table: res.table,
|
|
1860
|
+
tables: tables,
|
|
1861
|
+
field: field,
|
|
1862
|
+
typeFilters: ["text"]
|
|
1849
1863
|
});
|
|
1850
1864
|
|
|
1851
1865
|
if (!fieldMeta) {
|
|
1852
|
-
return React.createElement(
|
|
1866
|
+
return React.createElement(React.Fragment, null, children);
|
|
1867
|
+
}
|
|
1868
|
+
|
|
1869
|
+
if (!children) {
|
|
1870
|
+
return null;
|
|
1853
1871
|
}
|
|
1854
1872
|
|
|
1855
1873
|
var value = ((_res$row$data2 = res.row.data) == null ? void 0 : _res$row$data2[fieldMeta.identifier]) || "";
|
|
@@ -1862,6 +1880,184 @@ function CmsRowLink(_ref11) {
|
|
|
1862
1880
|
|
|
1863
1881
|
return child;
|
|
1864
1882
|
});
|
|
1883
|
+
return React.createElement(React.Fragment, null, childrenWithProps != null ? childrenWithProps : null);
|
|
1884
|
+
}
|
|
1885
|
+
var cmsRowImageMeta = {
|
|
1886
|
+
name: componentPrefix + "-row-image",
|
|
1887
|
+
displayName: "CMS Row Image",
|
|
1888
|
+
importName: "CmsRowImage",
|
|
1889
|
+
importPath: modulePath,
|
|
1890
|
+
props: {
|
|
1891
|
+
children: {
|
|
1892
|
+
type: "slot",
|
|
1893
|
+
defaultValue: {
|
|
1894
|
+
type: "img",
|
|
1895
|
+
src: "https://studio.plasmic.app/static/img/placeholder-full.png"
|
|
1896
|
+
}
|
|
1897
|
+
},
|
|
1898
|
+
table: {
|
|
1899
|
+
type: "choice",
|
|
1900
|
+
displayName: "Model",
|
|
1901
|
+
description: "CMS model (table) to use.",
|
|
1902
|
+
options: function options(_, ctx) {
|
|
1903
|
+
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
1904
|
+
}
|
|
1905
|
+
},
|
|
1906
|
+
field: {
|
|
1907
|
+
type: "choice",
|
|
1908
|
+
displayName: "Field",
|
|
1909
|
+
description: "Field (from model schema) to use.",
|
|
1910
|
+
options: function options(_ref12, ctx) {
|
|
1911
|
+
var _ctx$table3;
|
|
1912
|
+
|
|
1913
|
+
var table = _ref12.table;
|
|
1914
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table3 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table3 : table);
|
|
1915
|
+
}
|
|
1916
|
+
},
|
|
1917
|
+
srcProp: {
|
|
1918
|
+
type: "string",
|
|
1919
|
+
displayName: 'Image "src" prop',
|
|
1920
|
+
description: "Prop to inject into children",
|
|
1921
|
+
defaultValue: "src"
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
};
|
|
1925
|
+
function CmsRowImage(_ref13) {
|
|
1926
|
+
var _res$row$data3;
|
|
1927
|
+
|
|
1928
|
+
var table = _ref13.table,
|
|
1929
|
+
field = _ref13.field,
|
|
1930
|
+
srcProp = _ref13.srcProp,
|
|
1931
|
+
children = _ref13.children,
|
|
1932
|
+
setControlContextData = _ref13.setControlContextData;
|
|
1933
|
+
var tables = useTables();
|
|
1934
|
+
var res = useRow(table);
|
|
1935
|
+
|
|
1936
|
+
if (!res || !res.row) {
|
|
1937
|
+
return React.createElement(React.Fragment, null, children);
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
if (tables) {
|
|
1941
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
1942
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
1943
|
+
tables: tables,
|
|
1944
|
+
table: res.table
|
|
1945
|
+
});
|
|
1946
|
+
}
|
|
1947
|
+
|
|
1948
|
+
var fieldMeta = deriveInferredTableField({
|
|
1949
|
+
table: res.table,
|
|
1950
|
+
tables: tables,
|
|
1951
|
+
field: field,
|
|
1952
|
+
typeFilters: ["image"]
|
|
1953
|
+
});
|
|
1954
|
+
|
|
1955
|
+
if (!fieldMeta) {
|
|
1956
|
+
return React.createElement(React.Fragment, null, children);
|
|
1957
|
+
}
|
|
1958
|
+
|
|
1959
|
+
var value = ((_res$row$data3 = res.row.data) == null ? void 0 : _res$row$data3[fieldMeta.identifier]) || "";
|
|
1960
|
+
var childrenWithProps = React.Children.map(children, function (child) {
|
|
1961
|
+
if (React.isValidElement(child) && value) {
|
|
1962
|
+
var _React$cloneElement3;
|
|
1963
|
+
|
|
1964
|
+
if (typeof value === "object" && value.url && value.imageMeta) {
|
|
1965
|
+
var _React$cloneElement2;
|
|
1966
|
+
|
|
1967
|
+
return React.cloneElement(child, (_React$cloneElement2 = {}, _React$cloneElement2[srcProp] = {
|
|
1968
|
+
src: value.url,
|
|
1969
|
+
fullHeight: value.imageMeta.height,
|
|
1970
|
+
fullWidth: value.imageMeta.width
|
|
1971
|
+
}, _React$cloneElement2));
|
|
1972
|
+
}
|
|
1973
|
+
|
|
1974
|
+
return React.cloneElement(child, (_React$cloneElement3 = {}, _React$cloneElement3[srcProp] = value, _React$cloneElement3));
|
|
1975
|
+
}
|
|
1976
|
+
|
|
1977
|
+
return child;
|
|
1978
|
+
});
|
|
1979
|
+
return React.createElement(React.Fragment, null, childrenWithProps);
|
|
1980
|
+
}
|
|
1981
|
+
var cmsRowFieldValueMeta = {
|
|
1982
|
+
name: componentPrefix + "-row-value",
|
|
1983
|
+
displayName: "CMS Row Value",
|
|
1984
|
+
importName: "CmsRowValue",
|
|
1985
|
+
importPath: modulePath,
|
|
1986
|
+
props: {
|
|
1987
|
+
children: {
|
|
1988
|
+
type: "slot"
|
|
1989
|
+
},
|
|
1990
|
+
table: {
|
|
1991
|
+
type: "choice",
|
|
1992
|
+
displayName: "Model",
|
|
1993
|
+
description: "CMS model (table) to use.",
|
|
1994
|
+
options: function options(_, ctx) {
|
|
1995
|
+
return mkTableOptions(ctx == null ? void 0 : ctx.tables);
|
|
1996
|
+
}
|
|
1997
|
+
},
|
|
1998
|
+
field: {
|
|
1999
|
+
type: "choice",
|
|
2000
|
+
displayName: "Field",
|
|
2001
|
+
description: "Field (from model schema) to use.",
|
|
2002
|
+
options: function options(_ref14, ctx) {
|
|
2003
|
+
var _ctx$table4;
|
|
2004
|
+
|
|
2005
|
+
var table = _ref14.table;
|
|
2006
|
+
return mkFieldOptions(ctx == null ? void 0 : ctx.tables, (_ctx$table4 = ctx == null ? void 0 : ctx.table) != null ? _ctx$table4 : table);
|
|
2007
|
+
}
|
|
2008
|
+
},
|
|
2009
|
+
valueProp: {
|
|
2010
|
+
type: "string",
|
|
2011
|
+
displayName: "Value prop",
|
|
2012
|
+
description: "Prop to inject into children as",
|
|
2013
|
+
defaultValue: "children"
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
};
|
|
2017
|
+
function CmsRowFieldValue(_ref15) {
|
|
2018
|
+
var _res$row$data4;
|
|
2019
|
+
|
|
2020
|
+
var table = _ref15.table,
|
|
2021
|
+
field = _ref15.field,
|
|
2022
|
+
valueProp = _ref15.valueProp,
|
|
2023
|
+
children = _ref15.children,
|
|
2024
|
+
setControlContextData = _ref15.setControlContextData;
|
|
2025
|
+
var tables = useTables();
|
|
2026
|
+
var res = useRow(table);
|
|
2027
|
+
|
|
2028
|
+
if (!res || !res.row) {
|
|
2029
|
+
return React.createElement(React.Fragment, null, children);
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
if (tables) {
|
|
2033
|
+
// TODO: Only include table if __plasmic_cms_row_{table} exists.
|
|
2034
|
+
setControlContextData == null ? void 0 : setControlContextData({
|
|
2035
|
+
tables: tables,
|
|
2036
|
+
table: res.table
|
|
2037
|
+
});
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
var fieldMeta = deriveInferredTableField({
|
|
2041
|
+
table: res.table,
|
|
2042
|
+
tables: tables,
|
|
2043
|
+
field: field,
|
|
2044
|
+
typeFilters: ["text"]
|
|
2045
|
+
});
|
|
2046
|
+
|
|
2047
|
+
if (!fieldMeta) {
|
|
2048
|
+
return React.createElement(React.Fragment, null, children);
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
var value = ((_res$row$data4 = res.row.data) == null ? void 0 : _res$row$data4[fieldMeta.identifier]) || "";
|
|
2052
|
+
var childrenWithProps = React.Children.map(children, function (child) {
|
|
2053
|
+
if (React.isValidElement(child)) {
|
|
2054
|
+
var _React$cloneElement4;
|
|
2055
|
+
|
|
2056
|
+
return React.cloneElement(child, (_React$cloneElement4 = {}, _React$cloneElement4[valueProp] = value, _React$cloneElement4));
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
return child;
|
|
2060
|
+
});
|
|
1865
2061
|
return React.createElement(React.Fragment, null, childrenWithProps);
|
|
1866
2062
|
}
|
|
1867
2063
|
var cmsRowLoaderMeta = {
|
|
@@ -1898,13 +2094,13 @@ var cmsRowLoaderMeta = {
|
|
|
1898
2094
|
}
|
|
1899
2095
|
}, fetcherComponentPropMetas)
|
|
1900
2096
|
};
|
|
1901
|
-
function CmsRowLoader(
|
|
1902
|
-
var table =
|
|
1903
|
-
row =
|
|
1904
|
-
children =
|
|
1905
|
-
useDraft =
|
|
1906
|
-
hideIfNotFound =
|
|
1907
|
-
setControlContextData =
|
|
2097
|
+
function CmsRowLoader(_ref16) {
|
|
2098
|
+
var table = _ref16.table,
|
|
2099
|
+
row = _ref16.row,
|
|
2100
|
+
children = _ref16.children,
|
|
2101
|
+
useDraft = _ref16.useDraft,
|
|
2102
|
+
hideIfNotFound = _ref16.hideIfNotFound,
|
|
2103
|
+
setControlContextData = _ref16.setControlContextData;
|
|
1908
2104
|
var databaseConfig = useDatabase();
|
|
1909
2105
|
var tables = useTables();
|
|
1910
2106
|
|
|
@@ -1986,8 +2182,12 @@ function registerAll(loader) {
|
|
|
1986
2182
|
|
|
1987
2183
|
_registerComponent(CmsRowLink, cmsRowLinkMeta);
|
|
1988
2184
|
|
|
2185
|
+
_registerComponent(CmsRowImage, cmsRowImageMeta);
|
|
2186
|
+
|
|
2187
|
+
_registerComponent(CmsRowFieldValue, cmsRowFieldValueMeta);
|
|
2188
|
+
|
|
1989
2189
|
_registerComponent(CmsRowLoader, cmsRowLoaderMeta);
|
|
1990
2190
|
}
|
|
1991
2191
|
|
|
1992
|
-
export { CmsCredentialsProvider, CmsQueryLoader, CmsRowField, CmsRowLink, CmsRowLoader, CmsRowRepeater, cmsCredentialsProviderMeta, cmsQueryLoaderMeta, cmsRowFieldMeta, cmsRowLinkMeta, cmsRowLoaderMeta, cmsRowRepeaterMeta, registerAll };
|
|
2192
|
+
export { CmsCredentialsProvider, CmsQueryLoader, CmsRowField, CmsRowFieldValue, CmsRowImage, CmsRowLink, CmsRowLoader, CmsRowRepeater, cmsCredentialsProviderMeta, cmsQueryLoaderMeta, cmsRowFieldMeta, cmsRowFieldValueMeta, cmsRowImageMeta, cmsRowLinkMeta, cmsRowLoaderMeta, cmsRowRepeaterMeta, registerAll };
|
|
1993
2193
|
//# sourceMappingURL=plasmic-cms.esm.js.map
|