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