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