@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
|
@@ -8,7 +8,6 @@ var registerComponent = _interopDefault(require('@plasmicapp/host/registerCompon
|
|
|
8
8
|
var host = require('@plasmicapp/host');
|
|
9
9
|
var query = require('@plasmicapp/query');
|
|
10
10
|
var React = _interopDefault(require('react'));
|
|
11
|
-
var plasmicBasicComponents = require('@plasmicpkgs/plasmic-basic-components');
|
|
12
11
|
|
|
13
12
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
14
13
|
try {
|
|
@@ -212,201 +211,198 @@ function createCommonjsModule(fn, module) {
|
|
|
212
211
|
return module = { exports: {} }, fn(module, module.exports), module.exports;
|
|
213
212
|
}
|
|
214
213
|
|
|
215
|
-
var runtime_1 = createCommonjsModule(function (module) {
|
|
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
|
-
|
|
242
|
-
try {
|
|
243
|
-
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
244
|
-
define({}, "");
|
|
245
|
-
} catch (err) {
|
|
246
|
-
define = function(obj, key, value) {
|
|
247
|
-
return obj[key] = value;
|
|
248
|
-
};
|
|
249
|
-
}
|
|
250
|
-
|
|
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 || []);
|
|
256
|
-
|
|
257
|
-
// The ._invoke method unifies the implementations of the .next,
|
|
258
|
-
// .throw, and .return methods.
|
|
259
|
-
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
|
+
}
|
|
260
241
|
|
|
261
|
-
return generator;
|
|
262
|
-
}
|
|
263
|
-
exports.wrap = wrap;
|
|
264
|
-
|
|
265
|
-
// Try/catch helper to minimize deoptimizations. Returns a completion
|
|
266
|
-
// record like context.tryEntries[i].completion. This interface could
|
|
267
|
-
// have been (and was previously) designed to take a closure to be
|
|
268
|
-
// invoked without arguments, but in all the cases we care about we
|
|
269
|
-
// already have an existing method we want to call, so there's no need
|
|
270
|
-
// to create a new function object. We can even get away with assuming
|
|
271
|
-
// the method takes exactly one argument, since that happens to be true
|
|
272
|
-
// in every case, so we don't have to touch the arguments object. The
|
|
273
|
-
// only additional allocation required is the completion record, which
|
|
274
|
-
// has a stable shape and so hopefully should be cheap to allocate.
|
|
275
|
-
function tryCatch(fn, obj, arg) {
|
|
276
242
|
try {
|
|
277
|
-
|
|
243
|
+
// IE 8 has a broken Object.defineProperty that only works on DOM objects.
|
|
244
|
+
define({}, "");
|
|
278
245
|
} catch (err) {
|
|
279
|
-
|
|
246
|
+
define = function define(obj, key, value) {
|
|
247
|
+
return obj[key] = value;
|
|
248
|
+
};
|
|
280
249
|
}
|
|
281
|
-
}
|
|
282
250
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
// breaking out of the dispatch switch statement.
|
|
290
|
-
var ContinueSentinel = {};
|
|
291
|
-
|
|
292
|
-
// Dummy constructor functions that we use as the .constructor and
|
|
293
|
-
// .constructor.prototype properties for functions that return Generator
|
|
294
|
-
// objects. For full spec compliance, you may wish to configure your
|
|
295
|
-
// minifier not to mangle the names of these two functions.
|
|
296
|
-
function Generator() {}
|
|
297
|
-
function GeneratorFunction() {}
|
|
298
|
-
function GeneratorFunctionPrototype() {}
|
|
299
|
-
|
|
300
|
-
// This is a polyfill for %IteratorPrototype% for environments that
|
|
301
|
-
// don't natively support it.
|
|
302
|
-
var IteratorPrototype = {};
|
|
303
|
-
define(IteratorPrototype, iteratorSymbol, function () {
|
|
304
|
-
return this;
|
|
305
|
-
});
|
|
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.
|
|
306
257
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
NativeIteratorPrototype !== Op &&
|
|
311
|
-
hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
|
|
312
|
-
// This environment has a native %IteratorPrototype%; use it instead
|
|
313
|
-
// of the polyfill.
|
|
314
|
-
IteratorPrototype = NativeIteratorPrototype;
|
|
315
|
-
}
|
|
258
|
+
generator._invoke = makeInvokeMethod(innerFn, self, context);
|
|
259
|
+
return generator;
|
|
260
|
+
}
|
|
316
261
|
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
})
|
|
335
|
-
|
|
336
|
-
|
|
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
|
+
}
|
|
337
286
|
|
|
338
|
-
|
|
339
|
-
var
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
// do is to check its .name property.
|
|
344
|
-
(ctor.displayName || ctor.name) === "GeneratorFunction"
|
|
345
|
-
: false;
|
|
346
|
-
};
|
|
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.
|
|
347
292
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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;
|
|
354
319
|
}
|
|
355
|
-
genFun.prototype = Object.create(Gp);
|
|
356
|
-
return genFun;
|
|
357
|
-
};
|
|
358
320
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
return { __await: arg };
|
|
365
|
-
};
|
|
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.
|
|
366
326
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
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);
|
|
372
345
|
} else {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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);
|
|
382
392
|
});
|
|
383
393
|
}
|
|
384
|
-
|
|
385
|
-
return PromiseImpl.resolve(value).then(function(unwrapped) {
|
|
386
|
-
// When a yielded Promise is resolved, its final value becomes
|
|
387
|
-
// the .value of the Promise<{value,done}> result for the
|
|
388
|
-
// current iteration.
|
|
389
|
-
result.value = unwrapped;
|
|
390
|
-
resolve(result);
|
|
391
|
-
}, function(error) {
|
|
392
|
-
// If a rejected Promise was yielded, throw the rejection back
|
|
393
|
-
// into the async generator function so it can be handled there.
|
|
394
|
-
return invoke("throw", error, resolve, reject);
|
|
395
|
-
});
|
|
396
394
|
}
|
|
397
|
-
}
|
|
398
395
|
|
|
399
|
-
|
|
396
|
+
var previousPromise;
|
|
400
397
|
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
398
|
+
function enqueue(method, arg) {
|
|
399
|
+
function callInvokeWithMethodAndArg() {
|
|
400
|
+
return new PromiseImpl(function (resolve, reject) {
|
|
401
|
+
invoke(method, arg, resolve, reject);
|
|
402
|
+
});
|
|
403
|
+
}
|
|
407
404
|
|
|
408
|
-
|
|
409
|
-
// 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
|
|
410
406
|
// all previous Promises have been resolved before calling invoke,
|
|
411
407
|
// so that results are always delivered in the correct order. If
|
|
412
408
|
// enqueue has not been called before, then it is important to
|
|
@@ -418,554 +414,525 @@ var runtime = (function (exports) {
|
|
|
418
414
|
// execute code before the first await. Since we implement simple
|
|
419
415
|
// async functions in terms of async generators, it is especially
|
|
420
416
|
// important to get this right, even though it requires care.
|
|
421
|
-
previousPromise ? previousPromise.then(
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
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;
|
|
427
425
|
}
|
|
428
426
|
|
|
429
|
-
|
|
430
|
-
// .throw, and .return (see defineIteratorMethods).
|
|
431
|
-
this._invoke = enqueue;
|
|
432
|
-
}
|
|
427
|
+
defineIteratorMethods(AsyncIterator.prototype);
|
|
433
428
|
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
});
|
|
438
|
-
exports.AsyncIterator = AsyncIterator;
|
|
439
|
-
|
|
440
|
-
// Note that simple async functions are implemented on top of
|
|
441
|
-
// AsyncIterator objects; they just return a Promise for the value of
|
|
442
|
-
// the final result produced by the iterator.
|
|
443
|
-
exports.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
|
|
444
|
-
if (PromiseImpl === void 0) PromiseImpl = Promise;
|
|
445
|
-
|
|
446
|
-
var iter = new AsyncIterator(
|
|
447
|
-
wrap(innerFn, outerFn, self, tryLocsList),
|
|
448
|
-
PromiseImpl
|
|
449
|
-
);
|
|
450
|
-
|
|
451
|
-
return exports.isGeneratorFunction(outerFn)
|
|
452
|
-
? iter // If outerFn is a generator, return the full iterator.
|
|
453
|
-
: iter.next().then(function(result) {
|
|
454
|
-
return result.done ? result.value : iter.next();
|
|
455
|
-
});
|
|
456
|
-
};
|
|
429
|
+
AsyncIterator.prototype[asyncIteratorSymbol] = function () {
|
|
430
|
+
return this;
|
|
431
|
+
};
|
|
457
432
|
|
|
458
|
-
|
|
459
|
-
|
|
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.
|
|
460
436
|
|
|
461
|
-
|
|
462
|
-
if (
|
|
463
|
-
|
|
464
|
-
|
|
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
|
+
};
|
|
465
445
|
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
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");
|
|
469
451
|
}
|
|
470
452
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
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
|
|
475
458
|
|
|
476
|
-
context.method = method;
|
|
477
|
-
context.arg = arg;
|
|
478
459
|
|
|
479
|
-
|
|
480
|
-
var delegate = context.delegate;
|
|
481
|
-
if (delegate) {
|
|
482
|
-
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
483
|
-
if (delegateResult) {
|
|
484
|
-
if (delegateResult === ContinueSentinel) continue;
|
|
485
|
-
return delegateResult;
|
|
486
|
-
}
|
|
460
|
+
return doneResult();
|
|
487
461
|
}
|
|
488
462
|
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
463
|
+
context.method = method;
|
|
464
|
+
context.arg = arg;
|
|
465
|
+
|
|
466
|
+
while (true) {
|
|
467
|
+
var delegate = context.delegate;
|
|
493
468
|
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
469
|
+
if (delegate) {
|
|
470
|
+
var delegateResult = maybeInvokeDelegate(delegate, context);
|
|
471
|
+
|
|
472
|
+
if (delegateResult) {
|
|
473
|
+
if (delegateResult === ContinueSentinel) continue;
|
|
474
|
+
return delegateResult;
|
|
475
|
+
}
|
|
498
476
|
}
|
|
499
477
|
|
|
500
|
-
|
|
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
|
+
}
|
|
501
487
|
|
|
502
|
-
|
|
503
|
-
context.
|
|
504
|
-
|
|
488
|
+
context.dispatchException(context.arg);
|
|
489
|
+
} else if (context.method === "return") {
|
|
490
|
+
context.abrupt("return", context.arg);
|
|
491
|
+
}
|
|
505
492
|
|
|
506
|
-
|
|
493
|
+
state = GenStateExecuting;
|
|
494
|
+
var record = tryCatch(innerFn, self, context);
|
|
507
495
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
state = context.done
|
|
513
|
-
? GenStateCompleted
|
|
514
|
-
: 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;
|
|
515
500
|
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
501
|
+
if (record.arg === ContinueSentinel) {
|
|
502
|
+
continue;
|
|
503
|
+
}
|
|
519
504
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
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
|
+
}
|
|
524
547
|
|
|
525
|
-
} else if (record.type === "throw") {
|
|
526
|
-
state = GenStateCompleted;
|
|
527
|
-
// Dispatch the exception by looping back around to the
|
|
528
|
-
// context.dispatchException(context.arg) call above.
|
|
529
548
|
context.method = "throw";
|
|
530
|
-
context.arg =
|
|
549
|
+
context.arg = new TypeError("The iterator does not provide a 'throw' method");
|
|
531
550
|
}
|
|
551
|
+
|
|
552
|
+
return ContinueSentinel;
|
|
532
553
|
}
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
554
|
|
|
536
|
-
|
|
537
|
-
// result, either by returning a { value, done } result from the
|
|
538
|
-
// delegate iterator, or by modifying context.method and context.arg,
|
|
539
|
-
// setting context.delegate to null, and returning the ContinueSentinel.
|
|
540
|
-
function maybeInvokeDelegate(delegate, context) {
|
|
541
|
-
var method = delegate.iterator[context.method];
|
|
542
|
-
if (method === undefined$1) {
|
|
543
|
-
// A .throw or .return when the delegate iterator has no .throw
|
|
544
|
-
// method always terminates the yield* loop.
|
|
545
|
-
context.delegate = null;
|
|
555
|
+
var record = tryCatch(method, delegate.iterator, context.arg);
|
|
546
556
|
|
|
547
|
-
if (
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
context.arg = undefined$1;
|
|
554
|
-
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
|
+
}
|
|
555
563
|
|
|
556
|
-
|
|
557
|
-
// If maybeInvokeDelegate(context) changed context.method from
|
|
558
|
-
// "return" to "throw", let that override the TypeError below.
|
|
559
|
-
return ContinueSentinel;
|
|
560
|
-
}
|
|
561
|
-
}
|
|
564
|
+
var info = record.arg;
|
|
562
565
|
|
|
566
|
+
if (!info) {
|
|
563
567
|
context.method = "throw";
|
|
564
|
-
context.arg = new TypeError(
|
|
565
|
-
|
|
568
|
+
context.arg = new TypeError("iterator result is not an object");
|
|
569
|
+
context.delegate = null;
|
|
570
|
+
return ContinueSentinel;
|
|
566
571
|
}
|
|
567
572
|
|
|
568
|
-
|
|
569
|
-
|
|
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).
|
|
570
577
|
|
|
571
|
-
|
|
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.
|
|
572
584
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
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.
|
|
579
594
|
|
|
580
|
-
var info = record.arg;
|
|
581
595
|
|
|
582
|
-
if (! info) {
|
|
583
|
-
context.method = "throw";
|
|
584
|
-
context.arg = new TypeError("iterator result is not an object");
|
|
585
596
|
context.delegate = null;
|
|
586
597
|
return ContinueSentinel;
|
|
587
|
-
}
|
|
598
|
+
} // Define Generator.prototype.{next,throw,return} in terms of the
|
|
599
|
+
// unified ._invoke helper method.
|
|
588
600
|
|
|
589
|
-
if (info.done) {
|
|
590
|
-
// Assign the result of the finished delegate to the temporary
|
|
591
|
-
// variable specified by delegate.resultName (see delegateYield).
|
|
592
|
-
context[delegate.resultName] = info.value;
|
|
593
|
-
|
|
594
|
-
// Resume execution at the desired location (see delegateYield).
|
|
595
|
-
context.next = delegate.nextLoc;
|
|
596
|
-
|
|
597
|
-
// If context.method was "throw" but the delegate handled the
|
|
598
|
-
// exception, let the outer generator proceed normally. If
|
|
599
|
-
// context.method was "next", forget context.arg since it has been
|
|
600
|
-
// "consumed" by the delegate iterator. If context.method was
|
|
601
|
-
// "return", allow the original .return call to continue in the
|
|
602
|
-
// outer generator.
|
|
603
|
-
if (context.method !== "return") {
|
|
604
|
-
context.method = "next";
|
|
605
|
-
context.arg = undefined$1;
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
} else {
|
|
609
|
-
// Re-yield the result returned by the delegate method.
|
|
610
|
-
return info;
|
|
611
|
-
}
|
|
612
601
|
|
|
613
|
-
|
|
614
|
-
// the
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
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.
|
|
618
608
|
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
609
|
+
Gp[iteratorSymbol] = function () {
|
|
610
|
+
return this;
|
|
611
|
+
};
|
|
622
612
|
|
|
623
|
-
|
|
613
|
+
Gp.toString = function () {
|
|
614
|
+
return "[object Generator]";
|
|
615
|
+
};
|
|
624
616
|
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
// See https://github.com/facebook/regenerator/issues/274 for more details.
|
|
630
|
-
define(Gp, iteratorSymbol, function() {
|
|
631
|
-
return this;
|
|
632
|
-
});
|
|
617
|
+
function pushTryEntry(locs) {
|
|
618
|
+
var entry = {
|
|
619
|
+
tryLoc: locs[0]
|
|
620
|
+
};
|
|
633
621
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
622
|
+
if (1 in locs) {
|
|
623
|
+
entry.catchLoc = locs[1];
|
|
624
|
+
}
|
|
637
625
|
|
|
638
|
-
|
|
639
|
-
|
|
626
|
+
if (2 in locs) {
|
|
627
|
+
entry.finallyLoc = locs[2];
|
|
628
|
+
entry.afterLoc = locs[3];
|
|
629
|
+
}
|
|
640
630
|
|
|
641
|
-
|
|
642
|
-
entry.catchLoc = locs[1];
|
|
631
|
+
this.tryEntries.push(entry);
|
|
643
632
|
}
|
|
644
633
|
|
|
645
|
-
|
|
646
|
-
entry.
|
|
647
|
-
|
|
634
|
+
function resetTryEntry(entry) {
|
|
635
|
+
var record = entry.completion || {};
|
|
636
|
+
record.type = "normal";
|
|
637
|
+
delete record.arg;
|
|
638
|
+
entry.completion = record;
|
|
648
639
|
}
|
|
649
640
|
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
function Context(tryLocsList) {
|
|
661
|
-
// The root entry object (effectively a try statement without a catch
|
|
662
|
-
// or a finally block) gives us a place to store values thrown from
|
|
663
|
-
// locations where there is no enclosing try statement.
|
|
664
|
-
this.tryEntries = [{ tryLoc: "root" }];
|
|
665
|
-
tryLocsList.forEach(pushTryEntry, this);
|
|
666
|
-
this.reset(true);
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
exports.keys = function(object) {
|
|
670
|
-
var keys = [];
|
|
671
|
-
for (var key in object) {
|
|
672
|
-
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);
|
|
673
650
|
}
|
|
674
|
-
keys.reverse();
|
|
675
|
-
|
|
676
|
-
// Rather than returning an object with a next method, we keep
|
|
677
|
-
// things simple and return the next function itself.
|
|
678
|
-
return function next() {
|
|
679
|
-
while (keys.length) {
|
|
680
|
-
var key = keys.pop();
|
|
681
|
-
if (key in object) {
|
|
682
|
-
next.value = key;
|
|
683
|
-
next.done = false;
|
|
684
|
-
return next;
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
651
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
// also ensures that the minifier will not anonymize the function.
|
|
691
|
-
next.done = true;
|
|
692
|
-
return next;
|
|
693
|
-
};
|
|
694
|
-
};
|
|
695
|
-
|
|
696
|
-
function values(iterable) {
|
|
697
|
-
if (iterable) {
|
|
698
|
-
var iteratorMethod = iterable[iteratorSymbol];
|
|
699
|
-
if (iteratorMethod) {
|
|
700
|
-
return iteratorMethod.call(iterable);
|
|
701
|
-
}
|
|
652
|
+
exports.keys = function (object) {
|
|
653
|
+
var keys = [];
|
|
702
654
|
|
|
703
|
-
|
|
704
|
-
|
|
655
|
+
for (var key in object) {
|
|
656
|
+
keys.push(key);
|
|
705
657
|
}
|
|
706
658
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
while (++i < iterable.length) {
|
|
710
|
-
if (hasOwn.call(iterable, i)) {
|
|
711
|
-
next.value = iterable[i];
|
|
712
|
-
next.done = false;
|
|
713
|
-
return next;
|
|
714
|
-
}
|
|
715
|
-
}
|
|
659
|
+
keys.reverse(); // Rather than returning an object with a next method, we keep
|
|
660
|
+
// things simple and return the next function itself.
|
|
716
661
|
|
|
717
|
-
|
|
718
|
-
|
|
662
|
+
return function next() {
|
|
663
|
+
while (keys.length) {
|
|
664
|
+
var key = keys.pop();
|
|
719
665
|
|
|
720
|
-
|
|
721
|
-
|
|
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.
|
|
722
674
|
|
|
723
|
-
return next.next = next;
|
|
724
|
-
}
|
|
725
|
-
}
|
|
726
675
|
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
676
|
+
next.done = true;
|
|
677
|
+
return next;
|
|
678
|
+
};
|
|
679
|
+
};
|
|
731
680
|
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
681
|
+
function values(iterable) {
|
|
682
|
+
if (iterable) {
|
|
683
|
+
var iteratorMethod = iterable[iteratorSymbol];
|
|
735
684
|
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
reset: function(skipTempReset) {
|
|
740
|
-
this.prev = 0;
|
|
741
|
-
this.next = 0;
|
|
742
|
-
// Resetting context._sent for legacy support of Babel's
|
|
743
|
-
// function.sent implementation.
|
|
744
|
-
this.sent = this._sent = undefined$1;
|
|
745
|
-
this.done = false;
|
|
746
|
-
this.delegate = null;
|
|
747
|
-
|
|
748
|
-
this.method = "next";
|
|
749
|
-
this.arg = undefined$1;
|
|
750
|
-
|
|
751
|
-
this.tryEntries.forEach(resetTryEntry);
|
|
752
|
-
|
|
753
|
-
if (!skipTempReset) {
|
|
754
|
-
for (var name in this) {
|
|
755
|
-
// Not sure about the optimal order of these conditions:
|
|
756
|
-
if (name.charAt(0) === "t" &&
|
|
757
|
-
hasOwn.call(this, name) &&
|
|
758
|
-
!isNaN(+name.slice(1))) {
|
|
759
|
-
this[name] = undefined$1;
|
|
760
|
-
}
|
|
685
|
+
if (iteratorMethod) {
|
|
686
|
+
return iteratorMethod.call(iterable);
|
|
761
687
|
}
|
|
762
|
-
}
|
|
763
|
-
},
|
|
764
|
-
|
|
765
|
-
stop: function() {
|
|
766
|
-
this.done = true;
|
|
767
688
|
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
throw rootRecord.arg;
|
|
772
|
-
}
|
|
773
|
-
|
|
774
|
-
return this.rval;
|
|
775
|
-
},
|
|
689
|
+
if (typeof iterable.next === "function") {
|
|
690
|
+
return iterable;
|
|
691
|
+
}
|
|
776
692
|
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
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
|
+
}
|
|
781
703
|
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
context.next = loc;
|
|
704
|
+
next.value = undefined$1;
|
|
705
|
+
next.done = true;
|
|
706
|
+
return next;
|
|
707
|
+
};
|
|
787
708
|
|
|
788
|
-
|
|
789
|
-
// If the dispatched exception was caught by a catch block,
|
|
790
|
-
// then let that catch block handle the exception normally.
|
|
791
|
-
context.method = "next";
|
|
792
|
-
context.arg = undefined$1;
|
|
709
|
+
return next.next = next;
|
|
793
710
|
}
|
|
711
|
+
} // Return an iterator with no values.
|
|
794
712
|
|
|
795
|
-
return !! caught;
|
|
796
|
-
}
|
|
797
713
|
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
714
|
+
return {
|
|
715
|
+
next: doneResult
|
|
716
|
+
};
|
|
717
|
+
}
|
|
801
718
|
|
|
802
|
-
|
|
803
|
-
// Exception thrown outside of any try block that could handle
|
|
804
|
-
// it, so set the completion value of the entire function to
|
|
805
|
-
// throw the exception.
|
|
806
|
-
return handle("end");
|
|
807
|
-
}
|
|
719
|
+
exports.values = values;
|
|
808
720
|
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
721
|
+
function doneResult() {
|
|
722
|
+
return {
|
|
723
|
+
value: undefined$1,
|
|
724
|
+
done: true
|
|
725
|
+
};
|
|
726
|
+
}
|
|
812
727
|
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
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.
|
|
819
734
|
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
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);
|
|
824
741
|
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
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;
|
|
828
747
|
}
|
|
829
|
-
|
|
830
|
-
} else {
|
|
831
|
-
throw new Error("try statement without catch or finally");
|
|
832
748
|
}
|
|
833
749
|
}
|
|
834
|
-
}
|
|
835
|
-
|
|
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
|
+
}
|
|
836
759
|
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
if (
|
|
841
|
-
|
|
842
|
-
this.prev < entry.finallyLoc) {
|
|
843
|
-
var finallyEntry = entry;
|
|
844
|
-
break;
|
|
760
|
+
return this.rval;
|
|
761
|
+
},
|
|
762
|
+
dispatchException: function dispatchException(exception) {
|
|
763
|
+
if (this.done) {
|
|
764
|
+
throw exception;
|
|
845
765
|
}
|
|
846
|
-
}
|
|
847
766
|
|
|
848
|
-
|
|
849
|
-
(type === "break" ||
|
|
850
|
-
type === "continue") &&
|
|
851
|
-
finallyEntry.tryLoc <= arg &&
|
|
852
|
-
arg <= finallyEntry.finallyLoc) {
|
|
853
|
-
// Ignore the finally entry if control is not jumping to a
|
|
854
|
-
// location outside the try/catch block.
|
|
855
|
-
finallyEntry = null;
|
|
856
|
-
}
|
|
767
|
+
var context = this;
|
|
857
768
|
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
769
|
+
function handle(loc, caught) {
|
|
770
|
+
record.type = "throw";
|
|
771
|
+
record.arg = exception;
|
|
772
|
+
context.next = loc;
|
|
861
773
|
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
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
|
+
}
|
|
867
780
|
|
|
868
|
-
|
|
869
|
-
|
|
781
|
+
return !!caught;
|
|
782
|
+
}
|
|
870
783
|
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
}
|
|
784
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
785
|
+
var entry = this.tryEntries[i];
|
|
786
|
+
var record = entry.completion;
|
|
875
787
|
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
this.next = "end";
|
|
883
|
-
} else if (record.type === "normal" && afterLoc) {
|
|
884
|
-
this.next = afterLoc;
|
|
885
|
-
}
|
|
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
|
+
}
|
|
886
794
|
|
|
887
|
-
|
|
888
|
-
|
|
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
|
+
}
|
|
889
834
|
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
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;
|
|
896
842
|
return ContinueSentinel;
|
|
897
843
|
}
|
|
898
|
-
}
|
|
899
|
-
},
|
|
900
844
|
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
if (
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
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);
|
|
908
870
|
resetTryEntry(entry);
|
|
871
|
+
return ContinueSentinel;
|
|
909
872
|
}
|
|
910
|
-
return thrown;
|
|
911
873
|
}
|
|
912
|
-
}
|
|
874
|
+
},
|
|
875
|
+
"catch": function _catch(tryLoc) {
|
|
876
|
+
for (var i = this.tryEntries.length - 1; i >= 0; --i) {
|
|
877
|
+
var entry = this.tryEntries[i];
|
|
913
878
|
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
throw new Error("illegal catch attempt");
|
|
917
|
-
},
|
|
879
|
+
if (entry.tryLoc === tryLoc) {
|
|
880
|
+
var record = entry.completion;
|
|
918
881
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
nextLoc: nextLoc
|
|
924
|
-
};
|
|
882
|
+
if (record.type === "throw") {
|
|
883
|
+
var thrown = record.arg;
|
|
884
|
+
resetTryEntry(entry);
|
|
885
|
+
}
|
|
925
886
|
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
//
|
|
929
|
-
|
|
930
|
-
}
|
|
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.
|
|
931
891
|
|
|
932
|
-
return ContinueSentinel;
|
|
933
|
-
}
|
|
934
|
-
};
|
|
935
892
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
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`.
|
|
941
914
|
|
|
942
|
-
|
|
943
|
-
// 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
|
|
944
917
|
// as the regeneratorRuntime namespace. Otherwise create a new empty
|
|
945
918
|
// object. Either way, the resulting object will be used to initialize
|
|
946
919
|
// the regeneratorRuntime variable at the top of this file.
|
|
947
|
-
module.exports
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
// CSP to forbid Function, and you're not willing to fix either of those
|
|
962
|
-
// problems, please detail your unique predicament in a GitHub issue.
|
|
963
|
-
if (typeof globalThis === "object") {
|
|
964
|
-
globalThis.regeneratorRuntime = runtime;
|
|
965
|
-
} 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.
|
|
966
934
|
Function("r", "regeneratorRuntime = r")(runtime);
|
|
967
935
|
}
|
|
968
|
-
}
|
|
969
936
|
});
|
|
970
937
|
|
|
971
938
|
function queryParamsToApi(params) {
|
|
@@ -1229,29 +1196,29 @@ var mkRowContextKey = function mkRowContextKey(table) {
|
|
|
1229
1196
|
};
|
|
1230
1197
|
|
|
1231
1198
|
function useDatabase() {
|
|
1232
|
-
return
|
|
1199
|
+
return host.useSelector(databaseContextKey);
|
|
1233
1200
|
}
|
|
1234
1201
|
function DatabaseProvider(_ref) {
|
|
1235
1202
|
var config = _ref.config,
|
|
1236
1203
|
children = _ref.children;
|
|
1237
|
-
return React.createElement(
|
|
1204
|
+
return React.createElement(host.DataProvider, {
|
|
1238
1205
|
name: databaseContextKey,
|
|
1239
1206
|
data: config
|
|
1240
1207
|
}, children);
|
|
1241
1208
|
}
|
|
1242
1209
|
function useTables() {
|
|
1243
|
-
return
|
|
1210
|
+
return host.useSelector(tablesContextKey);
|
|
1244
1211
|
}
|
|
1245
1212
|
function TablesProvider(_ref2) {
|
|
1246
1213
|
var children = _ref2.children,
|
|
1247
1214
|
tables = _ref2.tables;
|
|
1248
|
-
return React.createElement(
|
|
1215
|
+
return React.createElement(host.DataProvider, {
|
|
1249
1216
|
name: tablesContextKey,
|
|
1250
1217
|
data: tables
|
|
1251
1218
|
}, children);
|
|
1252
1219
|
}
|
|
1253
1220
|
function useQueryResults(table) {
|
|
1254
|
-
var env =
|
|
1221
|
+
var env = host.useDataEnv();
|
|
1255
1222
|
var tables = useTables();
|
|
1256
1223
|
|
|
1257
1224
|
if (!env) {
|
|
@@ -1310,13 +1277,13 @@ function QueryResultProvider(_ref3) {
|
|
|
1310
1277
|
var children = _ref3.children,
|
|
1311
1278
|
table = _ref3.table,
|
|
1312
1279
|
rows = _ref3.rows;
|
|
1313
|
-
return React.createElement(
|
|
1280
|
+
return React.createElement(host.DataProvider, {
|
|
1314
1281
|
name: mkQueryContextKey(table),
|
|
1315
1282
|
data: rows
|
|
1316
1283
|
}, children);
|
|
1317
1284
|
}
|
|
1318
1285
|
function useRow(table) {
|
|
1319
|
-
var env =
|
|
1286
|
+
var env = host.useDataEnv();
|
|
1320
1287
|
var tables = useTables();
|
|
1321
1288
|
|
|
1322
1289
|
if (!env) {
|
|
@@ -1364,7 +1331,7 @@ function RowProvider(_ref4) {
|
|
|
1364
1331
|
var children = _ref4.children,
|
|
1365
1332
|
table = _ref4.table,
|
|
1366
1333
|
row = _ref4.row;
|
|
1367
|
-
return React.createElement(
|
|
1334
|
+
return React.createElement(host.DataProvider, {
|
|
1368
1335
|
name: mkRowContextKey(table),
|
|
1369
1336
|
data: row
|
|
1370
1337
|
}, children);
|
|
@@ -1382,7 +1349,7 @@ function mkTableOptions(tables) {
|
|
|
1382
1349
|
};
|
|
1383
1350
|
});
|
|
1384
1351
|
}
|
|
1385
|
-
function mkFieldOptions(tables, tableId) {
|
|
1352
|
+
function mkFieldOptions(tables, tableId, types) {
|
|
1386
1353
|
if (!tables) {
|
|
1387
1354
|
return [];
|
|
1388
1355
|
}
|
|
@@ -1395,7 +1362,15 @@ function mkFieldOptions(tables, tableId) {
|
|
|
1395
1362
|
return [];
|
|
1396
1363
|
}
|
|
1397
1364
|
|
|
1398
|
-
|
|
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) {
|
|
1399
1374
|
return {
|
|
1400
1375
|
value: f.identifier,
|
|
1401
1376
|
label: f.name || f.identifier
|
|
@@ -1404,7 +1379,7 @@ function mkFieldOptions(tables, tableId) {
|
|
|
1404
1379
|
}
|
|
1405
1380
|
|
|
1406
1381
|
var _excluded = ["children"],
|
|
1407
|
-
_excluded2 = ["table", "
|
|
1382
|
+
_excluded2 = ["className", "table", "field", "setControlContextData"];
|
|
1408
1383
|
var modulePath = "@plasmicpkgs/plasmic-cms";
|
|
1409
1384
|
var componentPrefix = "hostless-plasmic-cms";
|
|
1410
1385
|
var fetcherComponentPropMetas = {
|
|
@@ -1482,6 +1457,19 @@ function CmsCredentialsProvider(_ref) {
|
|
|
1482
1457
|
config = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
1483
1458
|
|
|
1484
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
|
+
|
|
1485
1473
|
return React.createElement(DatabaseProvider, {
|
|
1486
1474
|
config: config
|
|
1487
1475
|
}, React.createElement(TablesFetcher, null, children));
|
|
@@ -1576,8 +1564,11 @@ function CmsQueryLoader(_ref5) {
|
|
|
1576
1564
|
var table = _ref5.table,
|
|
1577
1565
|
children = _ref5.children,
|
|
1578
1566
|
setControlContextData = _ref5.setControlContextData,
|
|
1579
|
-
|
|
1580
|
-
|
|
1567
|
+
where = _ref5.where,
|
|
1568
|
+
useDraft = _ref5.useDraft,
|
|
1569
|
+
orderBy = _ref5.orderBy,
|
|
1570
|
+
desc = _ref5.desc,
|
|
1571
|
+
limit = _ref5.limit;
|
|
1581
1572
|
var databaseConfig = useDatabase();
|
|
1582
1573
|
var tables = useTables();
|
|
1583
1574
|
|
|
@@ -1588,6 +1579,13 @@ function CmsQueryLoader(_ref5) {
|
|
|
1588
1579
|
});
|
|
1589
1580
|
}
|
|
1590
1581
|
|
|
1582
|
+
var params = {
|
|
1583
|
+
where: where,
|
|
1584
|
+
useDraft: useDraft,
|
|
1585
|
+
orderBy: orderBy,
|
|
1586
|
+
desc: desc,
|
|
1587
|
+
limit: limit
|
|
1588
|
+
};
|
|
1591
1589
|
var cacheKey = JSON.stringify({
|
|
1592
1590
|
component: "CmsQueryLoader",
|
|
1593
1591
|
table: table,
|
|
@@ -1705,18 +1703,20 @@ var cmsRowFieldMeta = {
|
|
|
1705
1703
|
var _ctx$table;
|
|
1706
1704
|
|
|
1707
1705
|
var table = _ref8.table;
|
|
1708
|
-
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"]);
|
|
1709
1707
|
}
|
|
1710
1708
|
}
|
|
1711
1709
|
}
|
|
1712
1710
|
};
|
|
1713
1711
|
function CmsRowField(_ref9) {
|
|
1714
|
-
var
|
|
1712
|
+
var _res$row$data;
|
|
1715
1713
|
|
|
1716
1714
|
var className = _ref9.className,
|
|
1717
1715
|
table = _ref9.table,
|
|
1718
1716
|
field = _ref9.field,
|
|
1719
|
-
setControlContextData = _ref9.setControlContextData
|
|
1717
|
+
setControlContextData = _ref9.setControlContextData,
|
|
1718
|
+
rest = _objectWithoutPropertiesLoose(_ref9, _excluded2);
|
|
1719
|
+
|
|
1720
1720
|
var tables = useTables();
|
|
1721
1721
|
var res = useRow(table);
|
|
1722
1722
|
|
|
@@ -1732,21 +1732,40 @@ function CmsRowField(_ref9) {
|
|
|
1732
1732
|
});
|
|
1733
1733
|
}
|
|
1734
1734
|
|
|
1735
|
-
var
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
})
|
|
1735
|
+
var fieldMeta = deriveInferredTableField({
|
|
1736
|
+
table: res.table,
|
|
1737
|
+
tables: tables,
|
|
1738
|
+
field: field,
|
|
1739
|
+
typeFilters: ["text"]
|
|
1740
|
+
});
|
|
1741
1741
|
|
|
1742
1742
|
if (!fieldMeta) {
|
|
1743
1743
|
return React.createElement("div", null, "Error: No field to display");
|
|
1744
1744
|
}
|
|
1745
1745
|
|
|
1746
1746
|
var data = (_res$row$data = res.row.data) == null ? void 0 : _res$row$data[fieldMeta.identifier];
|
|
1747
|
-
return data ? renderValue(data, fieldMeta.type, {
|
|
1747
|
+
return data ? renderValue(data, fieldMeta.type, _extends({
|
|
1748
1748
|
className: className
|
|
1749
|
-
}) :
|
|
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;
|
|
1750
1769
|
}
|
|
1751
1770
|
|
|
1752
1771
|
function assertNever(_) {
|
|
@@ -1760,18 +1779,15 @@ function renderValue(value, type, props) {
|
|
|
1760
1779
|
case "text":
|
|
1761
1780
|
case "long-text":
|
|
1762
1781
|
case "date-time":
|
|
1763
|
-
return React.createElement("div", {
|
|
1764
|
-
className: props.className
|
|
1765
|
-
}, value);
|
|
1782
|
+
return React.createElement("div", Object.assign({}, props), value);
|
|
1766
1783
|
|
|
1767
1784
|
case "image":
|
|
1768
1785
|
if (value && typeof value === "object" && value.url && value.imageMeta) {
|
|
1769
|
-
return React.createElement("img", {
|
|
1786
|
+
return React.createElement("img", Object.assign({
|
|
1770
1787
|
src: value.url,
|
|
1771
1788
|
width: value.imageMeta.height,
|
|
1772
|
-
height: value.imageMeta.height
|
|
1773
|
-
|
|
1774
|
-
});
|
|
1789
|
+
height: value.imageMeta.height
|
|
1790
|
+
}, props));
|
|
1775
1791
|
}
|
|
1776
1792
|
|
|
1777
1793
|
return null;
|
|
@@ -1790,7 +1806,7 @@ var cmsRowLinkMeta = {
|
|
|
1790
1806
|
children: {
|
|
1791
1807
|
type: "slot",
|
|
1792
1808
|
defaultValue: {
|
|
1793
|
-
type: "
|
|
1809
|
+
type: "text",
|
|
1794
1810
|
tag: "a",
|
|
1795
1811
|
value: "Link"
|
|
1796
1812
|
}
|
|
@@ -1823,7 +1839,7 @@ var cmsRowLinkMeta = {
|
|
|
1823
1839
|
}
|
|
1824
1840
|
};
|
|
1825
1841
|
function CmsRowLink(_ref11) {
|
|
1826
|
-
var
|
|
1842
|
+
var _res$row$data2;
|
|
1827
1843
|
|
|
1828
1844
|
var table = _ref11.table,
|
|
1829
1845
|
field = _ref11.field,
|
|
@@ -1834,7 +1850,7 @@ function CmsRowLink(_ref11) {
|
|
|
1834
1850
|
var res = useRow(table);
|
|
1835
1851
|
|
|
1836
1852
|
if (!res || !res.row) {
|
|
1837
|
-
return React.createElement(
|
|
1853
|
+
return React.createElement(React.Fragment, null, children);
|
|
1838
1854
|
}
|
|
1839
1855
|
|
|
1840
1856
|
if (tables) {
|
|
@@ -1845,17 +1861,19 @@ function CmsRowLink(_ref11) {
|
|
|
1845
1861
|
});
|
|
1846
1862
|
}
|
|
1847
1863
|
|
|
1848
|
-
var
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
}) : schema == null ? void 0 : schema.fields.find(function (f) {
|
|
1854
|
-
return f.type === "text";
|
|
1864
|
+
var fieldMeta = deriveInferredTableField({
|
|
1865
|
+
table: res.table,
|
|
1866
|
+
tables: tables,
|
|
1867
|
+
field: field,
|
|
1868
|
+
typeFilters: ["text"]
|
|
1855
1869
|
});
|
|
1856
1870
|
|
|
1857
1871
|
if (!fieldMeta) {
|
|
1858
|
-
return React.createElement(
|
|
1872
|
+
return React.createElement(React.Fragment, null, children);
|
|
1873
|
+
}
|
|
1874
|
+
|
|
1875
|
+
if (!children) {
|
|
1876
|
+
return null;
|
|
1859
1877
|
}
|
|
1860
1878
|
|
|
1861
1879
|
var value = ((_res$row$data2 = res.row.data) == null ? void 0 : _res$row$data2[fieldMeta.identifier]) || "";
|
|
@@ -1868,6 +1886,184 @@ function CmsRowLink(_ref11) {
|
|
|
1868
1886
|
|
|
1869
1887
|
return child;
|
|
1870
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
|
+
});
|
|
1871
2067
|
return React.createElement(React.Fragment, null, childrenWithProps);
|
|
1872
2068
|
}
|
|
1873
2069
|
var cmsRowLoaderMeta = {
|
|
@@ -1904,13 +2100,13 @@ var cmsRowLoaderMeta = {
|
|
|
1904
2100
|
}
|
|
1905
2101
|
}, fetcherComponentPropMetas)
|
|
1906
2102
|
};
|
|
1907
|
-
function CmsRowLoader(
|
|
1908
|
-
var table =
|
|
1909
|
-
row =
|
|
1910
|
-
children =
|
|
1911
|
-
useDraft =
|
|
1912
|
-
hideIfNotFound =
|
|
1913
|
-
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;
|
|
1914
2110
|
var databaseConfig = useDatabase();
|
|
1915
2111
|
var tables = useTables();
|
|
1916
2112
|
|
|
@@ -1992,18 +2188,26 @@ function registerAll(loader) {
|
|
|
1992
2188
|
|
|
1993
2189
|
_registerComponent(CmsRowLink, cmsRowLinkMeta);
|
|
1994
2190
|
|
|
2191
|
+
_registerComponent(CmsRowImage, cmsRowImageMeta);
|
|
2192
|
+
|
|
2193
|
+
_registerComponent(CmsRowFieldValue, cmsRowFieldValueMeta);
|
|
2194
|
+
|
|
1995
2195
|
_registerComponent(CmsRowLoader, cmsRowLoaderMeta);
|
|
1996
2196
|
}
|
|
1997
2197
|
|
|
1998
2198
|
exports.CmsCredentialsProvider = CmsCredentialsProvider;
|
|
1999
2199
|
exports.CmsQueryLoader = CmsQueryLoader;
|
|
2000
2200
|
exports.CmsRowField = CmsRowField;
|
|
2201
|
+
exports.CmsRowFieldValue = CmsRowFieldValue;
|
|
2202
|
+
exports.CmsRowImage = CmsRowImage;
|
|
2001
2203
|
exports.CmsRowLink = CmsRowLink;
|
|
2002
2204
|
exports.CmsRowLoader = CmsRowLoader;
|
|
2003
2205
|
exports.CmsRowRepeater = CmsRowRepeater;
|
|
2004
2206
|
exports.cmsCredentialsProviderMeta = cmsCredentialsProviderMeta;
|
|
2005
2207
|
exports.cmsQueryLoaderMeta = cmsQueryLoaderMeta;
|
|
2006
2208
|
exports.cmsRowFieldMeta = cmsRowFieldMeta;
|
|
2209
|
+
exports.cmsRowFieldValueMeta = cmsRowFieldValueMeta;
|
|
2210
|
+
exports.cmsRowImageMeta = cmsRowImageMeta;
|
|
2007
2211
|
exports.cmsRowLinkMeta = cmsRowLinkMeta;
|
|
2008
2212
|
exports.cmsRowLoaderMeta = cmsRowLoaderMeta;
|
|
2009
2213
|
exports.cmsRowRepeaterMeta = cmsRowRepeaterMeta;
|