@antv/g 5.16.14 → 5.16.15

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/index.umd.js CHANGED
@@ -10013,1197 +10013,6 @@
10013
10013
  }(Camera);
10014
10014
  runtime.CameraContribution = AdvancedCamera;
10015
10015
 
10016
- // export const ContextNode = Syringe.defineToken('');
10017
- var FragmentResult = function FragmentResult(_layoutContext, _node, options) {
10018
- this._layoutContext = void 0;
10019
- this._node = void 0;
10020
- this.options = void 0;
10021
- this.layoutContext = void 0;
10022
- this.inlineSize = void 0;
10023
- this.blockSize = void 0;
10024
- this.node = void 0;
10025
- this.childFragments = void 0;
10026
- this.data = void 0;
10027
- this._layoutContext = _layoutContext;
10028
- this._node = _node;
10029
- this.options = options;
10030
- this.layoutContext = _layoutContext;
10031
- this.inlineSize = options === null || options === void 0 ? void 0 : options.inlineSize;
10032
- this.blockSize = options === null || options === void 0 ? void 0 : options.blockSize;
10033
- this.childFragments = options === null || options === void 0 ? void 0 : options.childFragments;
10034
- this.data = options.data;
10035
- this.node = _node;
10036
- };
10037
-
10038
- (function (LayoutTaskType) {
10039
- LayoutTaskType["Layout"] = "layout";
10040
- LayoutTaskType["IntrinsicSizes"] = "intrinsic-sizes";
10041
- })(exports.LayoutTaskType || (exports.LayoutTaskType = {}));
10042
- var ChildDisplayType;
10043
- (function (ChildDisplayType) {
10044
- ChildDisplayType[ChildDisplayType["block"] = 0] = "block";
10045
- ChildDisplayType[ChildDisplayType["normal"] = 1] = "normal";
10046
- })(ChildDisplayType || (ChildDisplayType = {}));
10047
- var LayoutSizingMode;
10048
- (function (LayoutSizingMode) {
10049
- LayoutSizingMode[LayoutSizingMode["block-like"] = 0] = "block-like";
10050
- LayoutSizingMode[LayoutSizingMode["manual"] = 1] = "manual";
10051
- })(LayoutSizingMode || (LayoutSizingMode = {}));
10052
-
10053
- (function (PropertyName) {
10054
- PropertyName["LAYOUT"] = "display";
10055
- PropertyName["LEFT"] = "left";
10056
- PropertyName["TOP"] = "top";
10057
- PropertyName["BOTTOM"] = "bottom";
10058
- PropertyName["RIGHT"] = "right";
10059
- PropertyName["WIDTH"] = "width";
10060
- PropertyName["HEIGHT"] = "height";
10061
- PropertyName["MIN_WIDTH"] = "minWidth";
10062
- PropertyName["MAX_WIDTH"] = "maxWidth";
10063
- PropertyName["MIN_HEIGHT"] = "minHeight";
10064
- PropertyName["MAX_HEIGHT"] = "maxHeight";
10065
- PropertyName["BOX_SIZING"] = "boxSizing";
10066
- PropertyName["PADDING"] = "padding";
10067
- PropertyName["PADDING_TOP"] = "paddingTop";
10068
- PropertyName["PADDING_BOTTOM"] = "paddingBottom";
10069
- PropertyName["PADDING_START"] = "paddingLeft";
10070
- PropertyName["PADDING_END"] = "paddingRight";
10071
- PropertyName["MARGIN"] = "margin";
10072
- PropertyName["MARGIN_TOP"] = "marginTop";
10073
- PropertyName["MARGIN_BOTTOM"] = "marginBottom";
10074
- PropertyName["MARGIN_START"] = "marginLeft";
10075
- PropertyName["MARGIN_END"] = "marginRight";
10076
- PropertyName["BORDER"] = "border";
10077
- PropertyName["BORDER_TOP"] = "borderTop";
10078
- PropertyName["BORDER_BOTTOM"] = "borderBottom";
10079
- PropertyName["BORDER_START"] = "borderLeft";
10080
- PropertyName["BORDER_END"] = "borderRight";
10081
- PropertyName["FLEX_DIRECTION"] = "flexDirection";
10082
- PropertyName["FLEX_WRAP"] = "flexWrap";
10083
- PropertyName["FLEX_FLOW"] = "flexFlow";
10084
- PropertyName["ALIGN_ITEMS"] = "alignItems";
10085
- PropertyName["ALIGN_CONTENT"] = "alignContent";
10086
- PropertyName["JUSTIFY_CONTENT"] = "justifyContent";
10087
- PropertyName["FLEX"] = "flex";
10088
- PropertyName["ALIGN_SELF"] = "alignSelf";
10089
- PropertyName["FLEX_SHRINK"] = "flexShrink";
10090
- PropertyName["FLEX_BASIS"] = "flexBasis";
10091
- PropertyName["FLEX_GROW"] = "flexGrow";
10092
- PropertyName["OFFSET_WIDTH"] = "offsetWidth";
10093
- PropertyName["OFFSET_HEIGHT"] = "offsetHeight";
10094
- PropertyName["ORDER"] = "order";
10095
- })(exports.PropertyName || (exports.PropertyName = {}));
10096
- function _regeneratorRuntime$1() {
10097
- _regeneratorRuntime$1 = function _regeneratorRuntime() {
10098
- return exports;
10099
- };
10100
- var exports = {},
10101
- Op = Object.prototype,
10102
- hasOwn = Op.hasOwnProperty,
10103
- defineProperty = Object.defineProperty || function (obj, key, desc) {
10104
- obj[key] = desc.value;
10105
- },
10106
- $Symbol = "function" == typeof Symbol ? Symbol : {},
10107
- iteratorSymbol = $Symbol.iterator || "@@iterator",
10108
- asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
10109
- toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
10110
- function define(obj, key, value) {
10111
- return Object.defineProperty(obj, key, {
10112
- value: value,
10113
- enumerable: !0,
10114
- configurable: !0,
10115
- writable: !0
10116
- }), obj[key];
10117
- }
10118
- try {
10119
- define({}, "");
10120
- } catch (err) {
10121
- define = function define(obj, key, value) {
10122
- return obj[key] = value;
10123
- };
10124
- }
10125
- function wrap(innerFn, outerFn, self, tryLocsList) {
10126
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
10127
- generator = Object.create(protoGenerator.prototype),
10128
- context = new Context(tryLocsList || []);
10129
- return defineProperty(generator, "_invoke", {
10130
- value: makeInvokeMethod(innerFn, self, context)
10131
- }), generator;
10132
- }
10133
- function tryCatch(fn, obj, arg) {
10134
- try {
10135
- return {
10136
- type: "normal",
10137
- arg: fn.call(obj, arg)
10138
- };
10139
- } catch (err) {
10140
- return {
10141
- type: "throw",
10142
- arg: err
10143
- };
10144
- }
10145
- }
10146
- exports.wrap = wrap;
10147
- var ContinueSentinel = {};
10148
- function Generator() {}
10149
- function GeneratorFunction() {}
10150
- function GeneratorFunctionPrototype() {}
10151
- var IteratorPrototype = {};
10152
- define(IteratorPrototype, iteratorSymbol, function () {
10153
- return this;
10154
- });
10155
- var getProto = Object.getPrototypeOf,
10156
- NativeIteratorPrototype = getProto && getProto(getProto(values([])));
10157
- NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
10158
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
10159
- function defineIteratorMethods(prototype) {
10160
- ["next", "throw", "return"].forEach(function (method) {
10161
- define(prototype, method, function (arg) {
10162
- return this._invoke(method, arg);
10163
- });
10164
- });
10165
- }
10166
- function AsyncIterator(generator, PromiseImpl) {
10167
- function invoke(method, arg, resolve, reject) {
10168
- var record = tryCatch(generator[method], generator, arg);
10169
- if ("throw" !== record.type) {
10170
- var result = record.arg,
10171
- value = result.value;
10172
- return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
10173
- invoke("next", value, resolve, reject);
10174
- }, function (err) {
10175
- invoke("throw", err, resolve, reject);
10176
- }) : PromiseImpl.resolve(value).then(function (unwrapped) {
10177
- result.value = unwrapped, resolve(result);
10178
- }, function (error) {
10179
- return invoke("throw", error, resolve, reject);
10180
- });
10181
- }
10182
- reject(record.arg);
10183
- }
10184
- var previousPromise;
10185
- defineProperty(this, "_invoke", {
10186
- value: function value(method, arg) {
10187
- function callInvokeWithMethodAndArg() {
10188
- return new PromiseImpl(function (resolve, reject) {
10189
- invoke(method, arg, resolve, reject);
10190
- });
10191
- }
10192
- return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
10193
- }
10194
- });
10195
- }
10196
- function makeInvokeMethod(innerFn, self, context) {
10197
- var state = "suspendedStart";
10198
- return function (method, arg) {
10199
- if ("executing" === state) throw new Error("Generator is already running");
10200
- if ("completed" === state) {
10201
- if ("throw" === method) throw arg;
10202
- return doneResult();
10203
- }
10204
- for (context.method = method, context.arg = arg;;) {
10205
- var delegate = context.delegate;
10206
- if (delegate) {
10207
- var delegateResult = maybeInvokeDelegate(delegate, context);
10208
- if (delegateResult) {
10209
- if (delegateResult === ContinueSentinel) continue;
10210
- return delegateResult;
10211
- }
10212
- }
10213
- if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
10214
- if ("suspendedStart" === state) throw state = "completed", context.arg;
10215
- context.dispatchException(context.arg);
10216
- } else "return" === context.method && context.abrupt("return", context.arg);
10217
- state = "executing";
10218
- var record = tryCatch(innerFn, self, context);
10219
- if ("normal" === record.type) {
10220
- if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
10221
- return {
10222
- value: record.arg,
10223
- done: context.done
10224
- };
10225
- }
10226
- "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
10227
- }
10228
- };
10229
- }
10230
- function maybeInvokeDelegate(delegate, context) {
10231
- var methodName = context.method,
10232
- method = delegate.iterator[methodName];
10233
- if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel;
10234
- var record = tryCatch(method, delegate.iterator, context.arg);
10235
- if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
10236
- var info = record.arg;
10237
- return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
10238
- }
10239
- function pushTryEntry(locs) {
10240
- var entry = {
10241
- tryLoc: locs[0]
10242
- };
10243
- 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
10244
- }
10245
- function resetTryEntry(entry) {
10246
- var record = entry.completion || {};
10247
- record.type = "normal", delete record.arg, entry.completion = record;
10248
- }
10249
- function Context(tryLocsList) {
10250
- this.tryEntries = [{
10251
- tryLoc: "root"
10252
- }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
10253
- }
10254
- function values(iterable) {
10255
- if (iterable) {
10256
- var iteratorMethod = iterable[iteratorSymbol];
10257
- if (iteratorMethod) return iteratorMethod.call(iterable);
10258
- if ("function" == typeof iterable.next) return iterable;
10259
- if (!isNaN(iterable.length)) {
10260
- var i = -1,
10261
- next = function next() {
10262
- for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
10263
- return next.value = undefined, next.done = !0, next;
10264
- };
10265
- return next.next = next;
10266
- }
10267
- }
10268
- return {
10269
- next: doneResult
10270
- };
10271
- }
10272
- function doneResult() {
10273
- return {
10274
- value: undefined,
10275
- done: !0
10276
- };
10277
- }
10278
- return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
10279
- value: GeneratorFunctionPrototype,
10280
- configurable: !0
10281
- }), defineProperty(GeneratorFunctionPrototype, "constructor", {
10282
- value: GeneratorFunction,
10283
- configurable: !0
10284
- }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
10285
- var ctor = "function" == typeof genFun && genFun.constructor;
10286
- return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
10287
- }, exports.mark = function (genFun) {
10288
- return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
10289
- }, exports.awrap = function (arg) {
10290
- return {
10291
- __await: arg
10292
- };
10293
- }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
10294
- return this;
10295
- }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
10296
- void 0 === PromiseImpl && (PromiseImpl = Promise);
10297
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
10298
- return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
10299
- return result.done ? result.value : iter.next();
10300
- });
10301
- }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
10302
- return this;
10303
- }), define(Gp, "toString", function () {
10304
- return "[object Generator]";
10305
- }), exports.keys = function (val) {
10306
- var object = Object(val),
10307
- keys = [];
10308
- for (var key in object) keys.push(key);
10309
- return keys.reverse(), function next() {
10310
- for (; keys.length;) {
10311
- var key = keys.pop();
10312
- if (key in object) return next.value = key, next.done = !1, next;
10313
- }
10314
- return next.done = !0, next;
10315
- };
10316
- }, exports.values = values, Context.prototype = {
10317
- constructor: Context,
10318
- reset: function reset(skipTempReset) {
10319
- if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined);
10320
- },
10321
- stop: function stop() {
10322
- this.done = !0;
10323
- var rootRecord = this.tryEntries[0].completion;
10324
- if ("throw" === rootRecord.type) throw rootRecord.arg;
10325
- return this.rval;
10326
- },
10327
- dispatchException: function dispatchException(exception) {
10328
- if (this.done) throw exception;
10329
- var context = this;
10330
- function handle(loc, caught) {
10331
- return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
10332
- }
10333
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10334
- var entry = this.tryEntries[i],
10335
- record = entry.completion;
10336
- if ("root" === entry.tryLoc) return handle("end");
10337
- if (entry.tryLoc <= this.prev) {
10338
- var hasCatch = hasOwn.call(entry, "catchLoc"),
10339
- hasFinally = hasOwn.call(entry, "finallyLoc");
10340
- if (hasCatch && hasFinally) {
10341
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
10342
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
10343
- } else if (hasCatch) {
10344
- if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
10345
- } else {
10346
- if (!hasFinally) throw new Error("try statement without catch or finally");
10347
- if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
10348
- }
10349
- }
10350
- }
10351
- },
10352
- abrupt: function abrupt(type, arg) {
10353
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10354
- var entry = this.tryEntries[i];
10355
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
10356
- var finallyEntry = entry;
10357
- break;
10358
- }
10359
- }
10360
- finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
10361
- var record = finallyEntry ? finallyEntry.completion : {};
10362
- return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
10363
- },
10364
- complete: function complete(record, afterLoc) {
10365
- if ("throw" === record.type) throw record.arg;
10366
- return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
10367
- },
10368
- finish: function finish(finallyLoc) {
10369
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10370
- var entry = this.tryEntries[i];
10371
- if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
10372
- }
10373
- },
10374
- catch: function _catch(tryLoc) {
10375
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
10376
- var entry = this.tryEntries[i];
10377
- if (entry.tryLoc === tryLoc) {
10378
- var record = entry.completion;
10379
- if ("throw" === record.type) {
10380
- var thrown = record.arg;
10381
- resetTryEntry(entry);
10382
- }
10383
- return thrown;
10384
- }
10385
- }
10386
- throw new Error("illegal catch attempt");
10387
- },
10388
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
10389
- return this.delegate = {
10390
- iterator: values(iterable),
10391
- resultName: resultName,
10392
- nextLoc: nextLoc
10393
- }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
10394
- }
10395
- }, exports;
10396
- }
10397
- function asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, key, arg) {
10398
- try {
10399
- var info = gen[key](arg);
10400
- var value = info.value;
10401
- } catch (error) {
10402
- reject(error);
10403
- return;
10404
- }
10405
- if (info.done) {
10406
- resolve(value);
10407
- } else {
10408
- Promise.resolve(value).then(_next, _throw);
10409
- }
10410
- }
10411
- function _asyncToGenerator$1(fn) {
10412
- return function () {
10413
- var self = this,
10414
- args = arguments;
10415
- return new Promise(function (resolve, reject) {
10416
- var gen = fn.apply(self, args);
10417
- function _next(value) {
10418
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "next", value);
10419
- }
10420
- function _throw(err) {
10421
- asyncGeneratorStep$1(gen, resolve, reject, _next, _throw, "throw", err);
10422
- }
10423
- _next(undefined);
10424
- });
10425
- };
10426
- }
10427
- function _defineProperties$1(target, props) {
10428
- for (var i = 0; i < props.length; i++) {
10429
- var descriptor = props[i];
10430
- descriptor.enumerable = descriptor.enumerable || false;
10431
- descriptor.configurable = true;
10432
- if ("value" in descriptor) descriptor.writable = true;
10433
- Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
10434
- }
10435
- }
10436
- function _createClass$1(Constructor, protoProps, staticProps) {
10437
- if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
10438
- if (staticProps) _defineProperties$1(Constructor, staticProps);
10439
- Object.defineProperty(Constructor, "prototype", {
10440
- writable: false
10441
- });
10442
- return Constructor;
10443
- }
10444
- function _toPrimitive$1(input, hint) {
10445
- if (typeof input !== "object" || input === null) return input;
10446
- var prim = input[Symbol.toPrimitive];
10447
- if (prim !== undefined) {
10448
- var res = prim.call(input, hint || "default");
10449
- if (typeof res !== "object") return res;
10450
- throw new TypeError("@@toPrimitive must return a primitive value.");
10451
- }
10452
- return (hint === "string" ? String : Number)(input);
10453
- }
10454
- function _toPropertyKey$1(arg) {
10455
- var key = _toPrimitive$1(arg, "string");
10456
- return typeof key === "symbol" ? key : String(key);
10457
- }
10458
-
10459
- /**
10460
- * This function allow you to modify a JS Promise by adding some status properties.
10461
- * Based on: http://stackoverflow.com/questions/21485545/is-there-a-way-to-tell-if-an-es6-promise-is-fulfilled-rejected-resolved
10462
- * But modified according to the specs of promises : https://promisesaplus.com/
10463
- */
10464
- var makeQuerablePromise = function makeQuerablePromise(promise) {
10465
- // Don't modify any promise that has been already modified.
10466
- if (promise.isRejected || promise.isFulfilled) return promise;
10467
- // Set initial state
10468
- var isPending = true;
10469
- var isRejected = false;
10470
- var isFulfilled = false;
10471
- var fullFilledValue;
10472
- // Observe the promise, saving the fulfillment in a closure scope.
10473
- var result = promise.then(function (v) {
10474
- isFulfilled = true;
10475
- isPending = false;
10476
- fullFilledValue = v;
10477
- return v;
10478
- }, function (e) {
10479
- isRejected = true;
10480
- isPending = false;
10481
- throw e;
10482
- });
10483
- result.isFulfilled = function () {
10484
- return isFulfilled;
10485
- };
10486
- result.isPending = function () {
10487
- return isPending;
10488
- };
10489
- result.isRejected = function () {
10490
- return isRejected;
10491
- };
10492
- result.getFullFilledValue = function () {
10493
- return fullFilledValue;
10494
- };
10495
- return result;
10496
- };
10497
- /**
10498
- * Simple implementation of the deferred pattern.
10499
- * An object that exposes a promise and functions to resolve and reject it.
10500
- */
10501
- var Deferred = function Deferred() {
10502
- var _this = this;
10503
- this.resolve = void 0;
10504
- this.reject = void 0;
10505
- this.promise = new Promise(function (resolve, reject) {
10506
- _this.resolve = resolve;
10507
- _this.reject = reject;
10508
- });
10509
- };
10510
- var LayoutChildren = /*#__PURE__*/function () {
10511
- function LayoutChildren(_layoutContext, options) {
10512
- this._layoutContext = void 0;
10513
- this.options = void 0;
10514
- this.node = void 0;
10515
- this.styleMap = void 0;
10516
- this.layoutContext = void 0;
10517
- this._layoutContext = _layoutContext;
10518
- this.options = options;
10519
- this.layoutContext = _layoutContext;
10520
- this.node = options.node;
10521
- this.styleMap = options.node.getAllStyle();
10522
- }
10523
- var _proto = LayoutChildren.prototype;
10524
- _proto.intrinsicSizes = function intrinsicSizes() {
10525
- // if (this.contextId !== this.layoutContext.contextId) {
10526
- // throw new Error('Invalid State: wrong layout context');
10527
- // }
10528
- var deferred = new Deferred();
10529
- this.layoutContext.appendWorkTask({
10530
- layoutChild: this,
10531
- taskType: exports.LayoutTaskType.IntrinsicSizes,
10532
- deferred: deferred
10533
- });
10534
- return deferred.promise;
10535
- };
10536
- _proto.layoutNextFragment = function layoutNextFragment(constraints) {
10537
- // if (this.layoutContext.contextId !== this.layoutContext.contextId) {
10538
- // throw new Error('Invalid State: wrong layout context');
10539
- // }
10540
- if (this.layoutContext.mode === exports.LayoutTaskType.IntrinsicSizes) {
10541
- throw new Error('Not Supported: cant call layoutNextFragment in intrinsicSizes');
10542
- }
10543
- var deferred = new Deferred();
10544
- this.layoutContext.appendWorkTask({
10545
- layoutConstraints: constraints,
10546
- layoutChild: this,
10547
- taskType: exports.LayoutTaskType.Layout,
10548
- deferred: deferred
10549
- });
10550
- return deferred.promise;
10551
- };
10552
- return LayoutChildren;
10553
- }();
10554
- var guid = 0;
10555
- /**
10556
- * 每次layout 有单独的 context
10557
- */
10558
- var LayoutContext = /*#__PURE__*/function () {
10559
- function LayoutContext(options) {
10560
- this.options = void 0;
10561
- this.contextId = void 0;
10562
- this.workQueue = [];
10563
- this.mode = void 0;
10564
- this.layoutChildrenFactory = void 0;
10565
- this.fragmentResultFactory = void 0;
10566
- this.layoutFragmentFactory = void 0;
10567
- this.options = options;
10568
- this.contextId = "" + guid++;
10569
- this.mode = options.mode;
10570
- this.layoutChildrenFactory = options.layoutChildrenFactory;
10571
- this.fragmentResultFactory = options.fragmentResultFactory;
10572
- this.layoutFragmentFactory = options.layoutFragmentFactory;
10573
- }
10574
- var _proto = LayoutContext.prototype;
10575
- _proto.appendWorkTask = function appendWorkTask(work) {
10576
- this.workQueue.push(work);
10577
- };
10578
- _proto.clearWorkQueue = function clearWorkQueue() {
10579
- this.workQueue = [];
10580
- };
10581
- return LayoutContext;
10582
- }();
10583
- var AbstractLayoutDefinition = function AbstractLayoutDefinition() {};
10584
- AbstractLayoutDefinition.inputProperties = void 0;
10585
- AbstractLayoutDefinition.childrenInputProperties = void 0;
10586
- AbstractLayoutDefinition.layoutOptions = void 0;
10587
- var SCROLLBAR_SIZES = [0, 0, 0, 0];
10588
- /**
10589
- * https://drafts.css-houdini.org/css-layout-api/#layoutedges
10590
- * the size of border, scrollbar, padding
10591
- */
10592
- var LayoutEdges =
10593
- // Convenience attributes for the sum in one direction.
10594
-
10595
- function LayoutEdges(options) {
10596
- var _styleMap$get$value, _styleMap$get, _styleMap$get$value2, _styleMap$get2, _styleMap$get$value3, _styleMap$get3, _styleMap$get$value4, _styleMap$get4, _styleMap$get$value5, _styleMap$get5, _styleMap$get$value6, _styleMap$get6, _styleMap$get$value7, _styleMap$get7, _styleMap$get$value8, _styleMap$get8;
10597
- this.options = void 0;
10598
- this.inlineStart = void 0;
10599
- this.inlineEnd = void 0;
10600
- this.blockStart = void 0;
10601
- this.blockEnd = void 0;
10602
- this.inline = void 0;
10603
- this.block = void 0;
10604
- this.options = options;
10605
- var node = options.node;
10606
- var styleMap = node.getAllStyle();
10607
- var borderTopWidth = (_styleMap$get$value = (_styleMap$get = styleMap.get(exports.PropertyName.PADDING_TOP)) === null || _styleMap$get === void 0 ? void 0 : _styleMap$get.value) !== null && _styleMap$get$value !== void 0 ? _styleMap$get$value : 0;
10608
- var borderRightWidth = (_styleMap$get$value2 = (_styleMap$get2 = styleMap.get(exports.PropertyName.PADDING_END)) === null || _styleMap$get2 === void 0 ? void 0 : _styleMap$get2.value) !== null && _styleMap$get$value2 !== void 0 ? _styleMap$get$value2 : 0;
10609
- var borderBottomWidth = (_styleMap$get$value3 = (_styleMap$get3 = styleMap.get(exports.PropertyName.PADDING_BOTTOM)) === null || _styleMap$get3 === void 0 ? void 0 : _styleMap$get3.value) !== null && _styleMap$get$value3 !== void 0 ? _styleMap$get$value3 : 0;
10610
- var borderLeftWidth = (_styleMap$get$value4 = (_styleMap$get4 = styleMap.get(exports.PropertyName.PADDING_START)) === null || _styleMap$get4 === void 0 ? void 0 : _styleMap$get4.value) !== null && _styleMap$get$value4 !== void 0 ? _styleMap$get$value4 : 0;
10611
- var paddingTopWidth = (_styleMap$get$value5 = (_styleMap$get5 = styleMap.get(exports.PropertyName.PADDING_TOP)) === null || _styleMap$get5 === void 0 ? void 0 : _styleMap$get5.value) !== null && _styleMap$get$value5 !== void 0 ? _styleMap$get$value5 : 0;
10612
- var paddingRightWidth = (_styleMap$get$value6 = (_styleMap$get6 = styleMap.get(exports.PropertyName.PADDING_END)) === null || _styleMap$get6 === void 0 ? void 0 : _styleMap$get6.value) !== null && _styleMap$get$value6 !== void 0 ? _styleMap$get$value6 : 0;
10613
- var paddingBottomWidth = (_styleMap$get$value7 = (_styleMap$get7 = styleMap.get(exports.PropertyName.PADDING_BOTTOM)) === null || _styleMap$get7 === void 0 ? void 0 : _styleMap$get7.value) !== null && _styleMap$get$value7 !== void 0 ? _styleMap$get$value7 : 0;
10614
- var paddingLeftWidth = (_styleMap$get$value8 = (_styleMap$get8 = styleMap.get(exports.PropertyName.PADDING_START)) === null || _styleMap$get8 === void 0 ? void 0 : _styleMap$get8.value) !== null && _styleMap$get$value8 !== void 0 ? _styleMap$get$value8 : 0;
10615
- this.blockStart = borderTopWidth + SCROLLBAR_SIZES[0] + paddingTopWidth;
10616
- this.inlineStart = borderRightWidth + SCROLLBAR_SIZES[1] + paddingRightWidth;
10617
- this.blockEnd = borderBottomWidth + SCROLLBAR_SIZES[2] + paddingBottomWidth;
10618
- this.inlineEnd = borderLeftWidth + SCROLLBAR_SIZES[3] + paddingLeftWidth;
10619
- this.block = this.blockStart + this.blockEnd;
10620
- this.inline = this.inlineStart + this.inlineEnd;
10621
- };
10622
- var delay = function delay(minisecond) {
10623
- if (minisecond === void 0) {
10624
- minisecond = 0;
10625
- }
10626
- return new Promise(function (resolve) {
10627
- setTimeout(function () {
10628
- resolve();
10629
- }, minisecond);
10630
- });
10631
- };
10632
- var LayoutEngine = /*#__PURE__*/function () {
10633
- function LayoutEngine(_layoutRegistry, _layoutContextFactory, _layoutEdgesFactory) {
10634
- this._layoutRegistry = void 0;
10635
- this._layoutContextFactory = void 0;
10636
- this._layoutEdgesFactory = void 0;
10637
- this.layoutRegistry = void 0;
10638
- this.layoutContextFactory = void 0;
10639
- this.layoutEdgesFactory = void 0;
10640
- this._layoutRegistry = _layoutRegistry;
10641
- this._layoutContextFactory = _layoutContextFactory;
10642
- this._layoutEdgesFactory = _layoutEdgesFactory;
10643
- this.layoutRegistry = _layoutRegistry;
10644
- this.layoutContextFactory = _layoutContextFactory;
10645
- this.layoutEdgesFactory = _layoutEdgesFactory;
10646
- // layoutContributions.getContributions().forEach((layoutContrib) => {
10647
- // layoutContrib.registerLayout(_layoutRegistry);
10648
- // });
10649
- }
10650
- /**
10651
- * This function takes the root of the box-tree, a LayoutConstraints object, and compute the position of every node in the tree
10652
- * @param rootNode root node of the layout object tree
10653
- * @param rootPageConstraints layout constraints
10654
- * @returns
10655
- */
10656
- var _proto = LayoutEngine.prototype;
10657
- _proto.computeLayout = /*#__PURE__*/
10658
- function () {
10659
- var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee(rootNode, rootPageConstraints) {
10660
- return _regeneratorRuntime$1().wrap(function _callee$(_context) {
10661
- while (1) switch (_context.prev = _context.next) {
10662
- case 0:
10663
- _context.next = 2;
10664
- return this.determineIntrinsicSizes(rootNode, rootNode.children);
10665
- case 2:
10666
- _context.next = 4;
10667
- return this.calculateLayout(rootNode, rootNode.children, rootPageConstraints);
10668
- case 4:
10669
- case "end":
10670
- return _context.stop();
10671
- }
10672
- }, _callee, this);
10673
- }));
10674
- function computeLayout(_x, _x2) {
10675
- return _computeLayout.apply(this, arguments);
10676
- }
10677
- return computeLayout;
10678
- }()
10679
- /**
10680
- * calculate intrinsicSize of node tree, use depth dirst / post order traversal
10681
- * @param rootNode
10682
- */;
10683
-
10684
- _proto.determineAllIntrinsicSizes = /*#__PURE__*/
10685
- function () {
10686
- var _determineAllIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee2(rootNode) {
10687
- return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
10688
- while (1) switch (_context2.prev = _context2.next) {
10689
- case 0:
10690
- case "end":
10691
- return _context2.stop();
10692
- }
10693
- }, _callee2);
10694
- }));
10695
- function determineAllIntrinsicSizes(_x3) {
10696
- return _determineAllIntrinsicSizes.apply(this, arguments);
10697
- }
10698
- return determineAllIntrinsicSizes;
10699
- }();
10700
- _proto.getLayoutDefinitionName = function getLayoutDefinitionName(node) {
10701
- var layoutStyle = node.getAllStyle().get(exports.PropertyName.LAYOUT);
10702
- if (!layoutStyle) {
10703
- throw new Error('layout property not found');
10704
- }
10705
- return layoutStyle.value;
10706
- }
10707
- /**
10708
- * calculate the min/max content size of node
10709
- * @param node current layout object
10710
- * @param childNodes children of the current node
10711
- */;
10712
- _proto.determineIntrinsicSizes = /*#__PURE__*/
10713
- function () {
10714
- var _determineIntrinsicSizes = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee3(node, childNodes) {
10715
- var layoutName;
10716
- return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
10717
- while (1) switch (_context3.prev = _context3.next) {
10718
- case 0:
10719
- layoutName = this.getLayoutDefinitionName(node);
10720
- _context3.next = 3;
10721
- return this.invokeIntrinsicSizesCallback(layoutName, node, childNodes);
10722
- case 3:
10723
- case "end":
10724
- return _context3.stop();
10725
- }
10726
- }, _callee3, this);
10727
- }));
10728
- function determineIntrinsicSizes(_x4, _x5) {
10729
- return _determineIntrinsicSizes.apply(this, arguments);
10730
- }
10731
- return determineIntrinsicSizes;
10732
- }();
10733
- _proto.invokeIntrinsicSizesCallback = /*#__PURE__*/function () {
10734
- var _invokeIntrinsicSizesCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee4(layoutName, node, childNodes) {
10735
- var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope, inputProperties, children, edges, styleMap, value, generator, intrinsicSizesValue;
10736
- return _regeneratorRuntime$1().wrap(function _callee4$(_context4) {
10737
- while (1) switch (_context4.prev = _context4.next) {
10738
- case 0:
10739
- LayoutDef = this.layoutRegistry.getLayout(layoutName);
10740
- layoutInstance = new LayoutDef();
10741
- context = this.layoutContextFactory({
10742
- mode: exports.LayoutTaskType.IntrinsicSizes
10743
- });
10744
- _LayoutDef$inputPrope = LayoutDef.inputProperties, inputProperties = _LayoutDef$inputPrope === void 0 ? [] : _LayoutDef$inputPrope;
10745
- children = [];
10746
- childNodes.forEach(function (childNode) {
10747
- var layoutChild = context.layoutChildrenFactory({
10748
- node: childNode
10749
- });
10750
- children.push(layoutChild);
10751
- });
10752
- edges = this.layoutEdgesFactory({
10753
- node: node
10754
- });
10755
- styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children edges styleMap )
10756
- value = layoutInstance.intrinsicSizes(children, edges, styleMap);
10757
- generator = this.runWorkQueue(value, context.workQueue);
10758
- generator.next();
10759
- _context4.next = 13;
10760
- return delay();
10761
- case 13:
10762
- intrinsicSizesValue = generator.next().value;
10763
- context.clearWorkQueue();
10764
- node.setIntrisicSizes(intrinsicSizesValue);
10765
- case 16:
10766
- case "end":
10767
- return _context4.stop();
10768
- }
10769
- }, _callee4, this);
10770
- }));
10771
- function invokeIntrinsicSizesCallback(_x6, _x7, _x8) {
10772
- return _invokeIntrinsicSizesCallback.apply(this, arguments);
10773
- }
10774
- return invokeIntrinsicSizesCallback;
10775
- }();
10776
- _proto.calculateLayout = /*#__PURE__*/function () {
10777
- var _calculateLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee5(node, childNodes, layoutConstraints) {
10778
- var layoutName;
10779
- return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
10780
- while (1) switch (_context5.prev = _context5.next) {
10781
- case 0:
10782
- layoutName = this.getLayoutDefinitionName(node);
10783
- _context5.next = 3;
10784
- return this.invokeLayoutCallback(layoutName, node, childNodes, layoutConstraints);
10785
- case 3:
10786
- case "end":
10787
- return _context5.stop();
10788
- }
10789
- }, _callee5, this);
10790
- }));
10791
- function calculateLayout(_x9, _x10, _x11) {
10792
- return _calculateLayout.apply(this, arguments);
10793
- }
10794
- return calculateLayout;
10795
- }();
10796
- _proto.invokeLayoutCallback = /*#__PURE__*/function () {
10797
- var _invokeLayoutCallback = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee6(layoutName, node, childNodes, layoutConstraints) {
10798
- var LayoutDef, layoutInstance, context, _LayoutDef$inputPrope2, inputProperties, children, edges, styleMap, value, generator, fragmentResultvalue, fragmentResult, layoutFragment;
10799
- return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
10800
- while (1) switch (_context6.prev = _context6.next) {
10801
- case 0:
10802
- LayoutDef = this.layoutRegistry.getLayout(layoutName);
10803
- layoutInstance = new LayoutDef();
10804
- context = this.layoutContextFactory({
10805
- mode: exports.LayoutTaskType.Layout
10806
- });
10807
- _LayoutDef$inputPrope2 = LayoutDef.inputProperties, inputProperties = _LayoutDef$inputPrope2 === void 0 ? [] : _LayoutDef$inputPrope2;
10808
- children = [];
10809
- childNodes.forEach(function (childNode) {
10810
- var layoutChild = context.layoutChildrenFactory({
10811
- node: childNode
10812
- });
10813
- children.push(layoutChild);
10814
- });
10815
- edges = this.layoutEdgesFactory({
10816
- node: node
10817
- });
10818
- styleMap = node.getStyle.apply(node, inputProperties); // TODO compare to cache ( children styleMap layoutConstraints )
10819
- value = layoutInstance.layout(children, edges, layoutConstraints, styleMap);
10820
- generator = this.runWorkQueue(value, context.workQueue);
10821
- generator.next();
10822
- _context6.next = 13;
10823
- return delay();
10824
- case 13:
10825
- fragmentResultvalue = generator.next().value;
10826
- context.clearWorkQueue();
10827
- fragmentResult = fragmentResultvalue instanceof FragmentResult ? fragmentResultvalue : context.fragmentResultFactory(fragmentResultvalue);
10828
- layoutFragment = context.layoutFragmentFactory({
10829
- inlineSize: fragmentResult.inlineSize,
10830
- blockSize: fragmentResult.blockSize,
10831
- data: fragmentResult.data
10832
- });
10833
- node.setComputedLayout(layoutFragment);
10834
- childNodes.forEach(function (childNode, index) {
10835
- childNode.setComputedLayout(fragmentResult.childFragments[index]);
10836
- });
10837
- case 19:
10838
- case "end":
10839
- return _context6.stop();
10840
- }
10841
- }, _callee6, this);
10842
- }));
10843
- function invokeLayoutCallback(_x12, _x13, _x14, _x15) {
10844
- return _invokeLayoutCallback.apply(this, arguments);
10845
- }
10846
- return invokeLayoutCallback;
10847
- }();
10848
- _proto.runWorkQueue = /*#__PURE__*/_regeneratorRuntime$1().mark(function runWorkQueue(promise, workQueue) {
10849
- var _this = this;
10850
- var querablePromise;
10851
- return _regeneratorRuntime$1().wrap(function runWorkQueue$(_context7) {
10852
- while (1) switch (_context7.prev = _context7.next) {
10853
- case 0:
10854
- querablePromise = makeQuerablePromise(promise);
10855
- if (workQueue.length > 0 && querablePromise.isPending()) {
10856
- workQueue.forEach(function (workTask) {
10857
- if (workTask.taskType === exports.LayoutTaskType.IntrinsicSizes) {
10858
- var layoutChild = workTask.layoutChild,
10859
- deferred = workTask.deferred;
10860
- var node = layoutChild.node;
10861
- deferred.resolve(_this.getNodeIntrisicSizes(node));
10862
- }
10863
- if (workTask.taskType === exports.LayoutTaskType.Layout) {
10864
- var _layoutChild = workTask.layoutChild,
10865
- _deferred = workTask.deferred,
10866
- layoutConstraints = workTask.layoutConstraints;
10867
- var _node = _layoutChild.node,
10868
- layoutContext = _layoutChild.layoutContext;
10869
- var fragment = _this.getNodeFragment(_node, layoutConstraints);
10870
- _deferred.resolve(layoutContext.layoutFragmentFactory(fragment));
10871
- }
10872
- });
10873
- }
10874
- // wait promise to resolve
10875
- _context7.next = 4;
10876
- return;
10877
- case 4:
10878
- if (querablePromise.isFulfilled()) {
10879
- _context7.next = 6;
10880
- break;
10881
- }
10882
- throw new Error('promise not fullfilled!');
10883
- case 6:
10884
- return _context7.abrupt("return", querablePromise.getFullFilledValue());
10885
- case 7:
10886
- case "end":
10887
- return _context7.stop();
10888
- }
10889
- }, runWorkQueue);
10890
- });
10891
- _proto.getNodeIntrisicSizes = function getNodeIntrisicSizes(node) {
10892
- var _styleMap$get, _node$intrisicSizes, _styleMap$get2, _styleMap$get3, _node$intrisicSizes2, _styleMap$get4, _styleMap$get5, _node$intrisicSizes3, _styleMap$get6, _styleMap$get7, _node$intrisicSizes4, _styleMap$get8;
10893
- // calculate from border box, depend on writing mode of current layout
10894
- var styleMap = node.getAllStyle();
10895
- var minWidth = ((_styleMap$get = styleMap.get(exports.PropertyName.MIN_WIDTH)) === null || _styleMap$get === void 0 ? void 0 : _styleMap$get.value) || ((_node$intrisicSizes = node.intrisicSizes) === null || _node$intrisicSizes === void 0 ? void 0 : _node$intrisicSizes.minContentInlineSize) || ((_styleMap$get2 = styleMap.get(exports.PropertyName.WIDTH)) === null || _styleMap$get2 === void 0 ? void 0 : _styleMap$get2.value) || 0;
10896
- var maxWidth = ((_styleMap$get3 = styleMap.get(exports.PropertyName.MAX_WIDTH)) === null || _styleMap$get3 === void 0 ? void 0 : _styleMap$get3.value) || ((_node$intrisicSizes2 = node.intrisicSizes) === null || _node$intrisicSizes2 === void 0 ? void 0 : _node$intrisicSizes2.maxContentInlineSize) || ((_styleMap$get4 = styleMap.get(exports.PropertyName.WIDTH)) === null || _styleMap$get4 === void 0 ? void 0 : _styleMap$get4.value) || 0;
10897
- var minHeight = ((_styleMap$get5 = styleMap.get(exports.PropertyName.MIN_HEIGHT)) === null || _styleMap$get5 === void 0 ? void 0 : _styleMap$get5.value) || ((_node$intrisicSizes3 = node.intrisicSizes) === null || _node$intrisicSizes3 === void 0 ? void 0 : _node$intrisicSizes3.minContentBlockSize) || ((_styleMap$get6 = styleMap.get(exports.PropertyName.HEIGHT)) === null || _styleMap$get6 === void 0 ? void 0 : _styleMap$get6.value) || 0;
10898
- var maxHeight = ((_styleMap$get7 = styleMap.get(exports.PropertyName.MAX_HEIGHT)) === null || _styleMap$get7 === void 0 ? void 0 : _styleMap$get7.value) || ((_node$intrisicSizes4 = node.intrisicSizes) === null || _node$intrisicSizes4 === void 0 ? void 0 : _node$intrisicSizes4.maxContentBlockSize) || ((_styleMap$get8 = styleMap.get(exports.PropertyName.HEIGHT)) === null || _styleMap$get8 === void 0 ? void 0 : _styleMap$get8.value) || 0;
10899
- return {
10900
- minContentInlineSize: minWidth,
10901
- maxContentInlineSize: maxWidth,
10902
- minContentBlockSize: minHeight,
10903
- maxContentBlockSize: maxHeight
10904
- };
10905
- };
10906
- _proto.getNodeFragment = function getNodeFragment(node, constraints) {
10907
- var _node$getComputedLayo, _node$getAllStyle$get, _node$getAllStyle$get2, _node$getComputedLayo2, _node$getAllStyle$get3, _node$getAllStyle$get4;
10908
- // TODO
10909
- var width = ((_node$getComputedLayo = node.getComputedLayout()) === null || _node$getComputedLayo === void 0 ? void 0 : _node$getComputedLayo.inlineSize) || ((_node$getAllStyle$get = node.getAllStyle().get(exports.PropertyName.MIN_WIDTH)) === null || _node$getAllStyle$get === void 0 ? void 0 : _node$getAllStyle$get.value) || ((_node$getAllStyle$get2 = node.getAllStyle().get(exports.PropertyName.WIDTH)) === null || _node$getAllStyle$get2 === void 0 ? void 0 : _node$getAllStyle$get2.value) || 0;
10910
- var height = ((_node$getComputedLayo2 = node.getComputedLayout()) === null || _node$getComputedLayo2 === void 0 ? void 0 : _node$getComputedLayo2.blockSize) || ((_node$getAllStyle$get3 = node.getAllStyle().get(exports.PropertyName.MIN_HEIGHT)) === null || _node$getAllStyle$get3 === void 0 ? void 0 : _node$getAllStyle$get3.value) || ((_node$getAllStyle$get4 = node.getAllStyle().get(exports.PropertyName.HEIGHT)) === null || _node$getAllStyle$get4 === void 0 ? void 0 : _node$getAllStyle$get4.value) || 0;
10911
- return {
10912
- inlineSize: width,
10913
- blockSize: height,
10914
- data: constraints.data
10915
- };
10916
- };
10917
- return LayoutEngine;
10918
- }();
10919
-
10920
- /**
10921
- * 布局的结果
10922
- */
10923
- var LayoutFragment = function LayoutFragment(_layoutContext, options) {
10924
- this._layoutContext = void 0;
10925
- this.options = void 0;
10926
- this.layoutContext = void 0;
10927
- this.inlineSize = void 0;
10928
- this.blockSize = void 0;
10929
- this.inlineOffset = void 0;
10930
- this.blockOffset = void 0;
10931
- this.data = void 0;
10932
- this._layoutContext = _layoutContext;
10933
- this.options = options;
10934
- this.layoutContext = _layoutContext;
10935
- this.inlineSize = options.inlineSize;
10936
- this.blockSize = options.blockSize;
10937
- this.inlineOffset = 0;
10938
- this.blockOffset = 0;
10939
- this.data = options.data;
10940
- };
10941
- var id$1 = 1;
10942
- var LayoutObject = /*#__PURE__*/function () {
10943
- function LayoutObject(style) {
10944
- if (style === void 0) {
10945
- style = new Map();
10946
- }
10947
- this.id = void 0;
10948
- this.style = void 0;
10949
- this.dirty = void 0;
10950
- this.parent = void 0;
10951
- this.children = void 0;
10952
- this.internalIntrisicSizes = void 0;
10953
- this.computedLayout = void 0;
10954
- this.measureFn = void 0;
10955
- this.id = id$1++;
10956
- this.style = style;
10957
- this.parent = undefined;
10958
- this.children = [];
10959
- this.dirty = false;
10960
- }
10961
- /**
10962
- * set the intrinsic size of leaf node, different basic shape has different size, compsed shape has
10963
- * @param measure measure function
10964
- */
10965
- var _proto = LayoutObject.prototype;
10966
- _proto.setMeasure = function setMeasure(measure) {
10967
- this.measureFn = measure;
10968
- };
10969
- _proto.setIntrisicSizes = function setIntrisicSizes(intrisicSizes) {
10970
- this.internalIntrisicSizes = intrisicSizes;
10971
- };
10972
- _proto.addChild = function addChild(child) {
10973
- var _this$children;
10974
- (_this$children = this.children) === null || _this$children === void 0 ? void 0 : _this$children.push(child);
10975
- };
10976
- _proto.insertChild = function insertChild(index, child) {
10977
- this.children.splice(index, 0, child);
10978
- };
10979
- _proto.removeChild = function removeChild(child) {
10980
- var _this$children2;
10981
- var index = (_this$children2 = this.children) === null || _this$children2 === void 0 ? void 0 : _this$children2.findIndex(function (node) {
10982
- return node.id === child.id;
10983
- });
10984
- this.removeChildAtIndex(index);
10985
- };
10986
- _proto.removeChildAtIndex = function removeChildAtIndex(index) {
10987
- this.children.splice(index, 1);
10988
- };
10989
- _proto.replaceChildAtIndex = function replaceChildAtIndex(index, child) {
10990
- this.children.splice(index, 1, child);
10991
- };
10992
- _proto.setStyle = function setStyle(property, value) {
10993
- this.style.set(property, value);
10994
- }
10995
- // setStyles(styles: Record<StyleProperty, StyleInputValue>) {
10996
- // this.style = StylePropertyMap.create({ styles }).styles;
10997
- // }
10998
- ;
10999
-
11000
- _proto.getStyle = function getStyle() {
11001
- var _this = this;
11002
- var returnStyle = new Map();
11003
- for (var _len = arguments.length, properties = new Array(_len), _key = 0; _key < _len; _key++) {
11004
- properties[_key] = arguments[_key];
11005
- }
11006
- properties.forEach(function (prop) {
11007
- var propertyValue = _this.style.get(prop);
11008
- if (propertyValue) {
11009
- returnStyle.set(prop, propertyValue);
11010
- }
11011
- });
11012
- return returnStyle;
11013
- };
11014
- _proto.getAllStyle = function getAllStyle() {
11015
- return this.style;
11016
- };
11017
- _proto.markDirty = function markDirty() {
11018
- this.dirty = true;
11019
- };
11020
- _proto.idDirty = function idDirty() {
11021
- return this.dirty;
11022
- };
11023
- _proto.getSize = function getSize() {
11024
- var _this$style$get$value, _this$style$get, _this$style$get$value2, _this$style$get2;
11025
- var width = (_this$style$get$value = (_this$style$get = this.style.get(exports.PropertyName.WIDTH)) === null || _this$style$get === void 0 ? void 0 : _this$style$get.value) !== null && _this$style$get$value !== void 0 ? _this$style$get$value : 0;
11026
- var height = (_this$style$get$value2 = (_this$style$get2 = this.style.get(exports.PropertyName.HEIGHT)) === null || _this$style$get2 === void 0 ? void 0 : _this$style$get2.value) !== null && _this$style$get$value2 !== void 0 ? _this$style$get$value2 : 0;
11027
- return {
11028
- width: width,
11029
- height: height
11030
- };
11031
- };
11032
- _proto.computeLayout = /*#__PURE__*/function () {
11033
- var _computeLayout = _asyncToGenerator$1( /*#__PURE__*/_regeneratorRuntime$1().mark(function _callee() {
11034
- var size;
11035
- return _regeneratorRuntime$1().wrap(function _callee$(_context) {
11036
- while (1) switch (_context.prev = _context.next) {
11037
- case 0:
11038
- size = this.getSize();
11039
- _context.next = 3;
11040
- return layoutEngine.computeLayout(this, {
11041
- availableInlineSize: size.width,
11042
- availableBlockSize: size.height,
11043
- fixedInlineSize: size.width,
11044
- fixedBlockSize: size.height,
11045
- percentageInlineSize: size.width,
11046
- percentageBlockSize: size.height,
11047
- data: undefined
11048
- });
11049
- case 3:
11050
- case "end":
11051
- return _context.stop();
11052
- }
11053
- }, _callee, this);
11054
- }));
11055
- function computeLayout() {
11056
- return _computeLayout.apply(this, arguments);
11057
- }
11058
- return computeLayout;
11059
- }();
11060
- _proto.setComputedLayout = function setComputedLayout(computedLayout) {
11061
- this.computedLayout = computedLayout;
11062
- };
11063
- _proto.getComputedLayout = function getComputedLayout() {
11064
- return this.computedLayout;
11065
- };
11066
- _proto.getAllComputedLayout = function getAllComputedLayout() {};
11067
- _proto.toString = function toString() {
11068
- return "LayoutObject " + this.id;
11069
- };
11070
- _createClass$1(LayoutObject, [{
11071
- key: "intrisicSizes",
11072
- get: function get() {
11073
- return this.internalIntrisicSizes;
11074
- }
11075
- }, {
11076
- key: "childCount",
11077
- get: function get() {
11078
- return this.children.length;
11079
- }
11080
- }]);
11081
- return LayoutObject;
11082
- }();
11083
- var DefaultLayoutRegistry = /*#__PURE__*/function () {
11084
- function DefaultLayoutRegistry() {
11085
- this.registry = new Map();
11086
- }
11087
- var _proto = DefaultLayoutRegistry.prototype;
11088
- _proto.hasLayout = function hasLayout(name) {
11089
- return this.registry.has(name);
11090
- }
11091
- /**
11092
- *
11093
- * @param name layout name, default to 'absolute'
11094
- * @returns layout object
11095
- */;
11096
- _proto.getLayout = function getLayout(name) {
11097
- if (name === void 0) {
11098
- name = 'absolute';
11099
- }
11100
- if (!this.hasLayout(name)) {
11101
- throw new Error("invalid layout property: " + name);
11102
- }
11103
- return this.registry.get(name);
11104
- };
11105
- _proto.updateLayout = function updateLayout(name, layout) {
11106
- this.registry.set(name, layout);
11107
- };
11108
- _proto.registerLayout = function registerLayout(name, layout) {
11109
- if (name === '') {
11110
- throw new TypeError("layout name cant't be empty");
11111
- }
11112
- if (DefaultLayoutRegistry.reservedLayout.includes(name)) {
11113
- throw new Error("layout name '" + name + "' is a system reserved layout name, please use another name");
11114
- }
11115
- if (this.hasLayout(name)) {
11116
- throw new Error("layout '" + name + "' already exist.");
11117
- }
11118
- this.registry.set(name, layout);
11119
- };
11120
- _proto.deleteLayout = function deleteLayout(name) {
11121
- this.registry.delete(name);
11122
- };
11123
- _createClass$1(DefaultLayoutRegistry, [{
11124
- key: "size",
11125
- get: function get() {
11126
- return this.registry.size;
11127
- }
11128
- }]);
11129
- return DefaultLayoutRegistry;
11130
- }();
11131
- // 系统保留的布局名称,外部用户不能使用
11132
- // private static reservedLayout = ['relative', 'absolute', 'fixed', 'flex', 'dagre', 'autolayout'];
11133
- DefaultLayoutRegistry.reservedLayout = [];
11134
-
11135
- // import { LayoutEdges, LayoutEdgesOptions } from './LayoutEdges';
11136
- // const layoutRegistry = new DefaultLayoutRegistry();
11137
- // const layoutEdgesFactory = (options: LayoutEdgesOptions) => {
11138
- // return new LayoutEdges(options);
11139
- // };
11140
- // const layoutContextFactory = (options: LayoutEdgesOptions) => {
11141
- // // const layoutChildrenFactory = (childOptions: LayoutChildrenOptions) => {
11142
- // // return new LayoutChildren(childOptions);
11143
- // // };
11144
- // // container.register({
11145
- // // token: LayoutChildrenFactory,
11146
- // // useFactory: (childContext) => {
11147
- // // return (childOptions: LayoutChildrenOptions) => {
11148
- // // const childContainer = childContext.container.createChild();
11149
- // // childContainer.register({
11150
- // // token: LayoutChildrenOptions,
11151
- // // useValue: childOptions,
11152
- // // });
11153
- // // return childContainer.get(LayoutChildren);
11154
- // // };
11155
- // // },
11156
- // // });
11157
- // // container.register(FragmentResult);
11158
- // // container.register({
11159
- // // token: FragmentResultFactory,
11160
- // // useFactory: (childContext) => {
11161
- // // return (childOptions, node) => {
11162
- // // const childContainer = childContext.container.createChild();
11163
- // // childContainer.register({
11164
- // // token: FragmentResultOptions,
11165
- // // useValue: childOptions,
11166
- // // });
11167
- // // childContainer.register({
11168
- // // token: ContextNode,
11169
- // // useValue: node,
11170
- // // });
11171
- // // return childContainer.get(FragmentResult);
11172
- // // };
11173
- // // },
11174
- // // });
11175
- // // container.register(LayoutFragment);
11176
- // // container.register({
11177
- // // token: LayoutFragmentFactory,
11178
- // // useFactory: (childContext) => {
11179
- // // return (childOptions) => {
11180
- // // const childContainer = childContext.container.createChild();
11181
- // // childContainer.register({
11182
- // // token: LayoutFragmentOptions,
11183
- // // useValue: childOptions,
11184
- // // });
11185
- // // return childContainer.get(LayoutFragment);
11186
- // // };
11187
- // // },
11188
- // // });
11189
- // // const layoutChildrenFactory = container.get(LayoutChildrenFactory);
11190
- // // const layoutFragmentFactory = (childContext) => {
11191
- // // return (childOptions) => {
11192
- // // return new LayoutFragment(childOptions);
11193
- // // };
11194
- // // };
11195
- // // const fragmentResultFactory = container.get(FragmentResultFactory);
11196
- // // const layoutContext = new LayoutContext({
11197
- // // ...options,
11198
- // // layoutChildrenFactory,
11199
- // // layoutFragmentFactory,
11200
- // // fragmentResultFactory,
11201
- // // });
11202
- // // return layoutContext;
11203
- // }
11204
- // export const layoutEngine = new LayoutEngine(layoutRegistry);
11205
- var layoutEngine = null;
11206
-
11207
10016
  var MutationRecord = /*#__PURE__*/function () {
11208
10017
  MutationRecord.copy = function copy(original) {
11209
10018
  var record = new MutationRecord(original.type, original.target);
@@ -11600,18 +10409,18 @@
11600
10409
  if (anyNonEmpty) dispatchCallbacks();
11601
10410
  }
11602
10411
 
11603
- function _defineProperties$2(target, props) {
10412
+ function _defineProperties$1(target, props) {
11604
10413
  for (var i = 0; i < props.length; i++) {
11605
10414
  var descriptor = props[i];
11606
10415
  descriptor.enumerable = descriptor.enumerable || false;
11607
10416
  descriptor.configurable = true;
11608
10417
  if ("value" in descriptor) descriptor.writable = true;
11609
- Object.defineProperty(target, _toPropertyKey$2(descriptor.key), descriptor);
10418
+ Object.defineProperty(target, _toPropertyKey$1(descriptor.key), descriptor);
11610
10419
  }
11611
10420
  }
11612
- function _createClass$2(Constructor, protoProps, staticProps) {
11613
- if (protoProps) _defineProperties$2(Constructor.prototype, protoProps);
11614
- if (staticProps) _defineProperties$2(Constructor, staticProps);
10421
+ function _createClass$1(Constructor, protoProps, staticProps) {
10422
+ if (protoProps) _defineProperties$1(Constructor.prototype, protoProps);
10423
+ if (staticProps) _defineProperties$1(Constructor, staticProps);
11615
10424
  Object.defineProperty(Constructor, "prototype", {
11616
10425
  writable: false
11617
10426
  });
@@ -11629,7 +10438,7 @@
11629
10438
  };
11630
10439
  return _setPrototypeOf$2(o, p);
11631
10440
  }
11632
- function _toPrimitive$2(input, hint) {
10441
+ function _toPrimitive$1(input, hint) {
11633
10442
  if (typeof input !== "object" || input === null) return input;
11634
10443
  var prim = input[Symbol.toPrimitive];
11635
10444
  if (prim !== undefined) {
@@ -11639,8 +10448,8 @@
11639
10448
  }
11640
10449
  return (hint === "string" ? String : Number)(input);
11641
10450
  }
11642
- function _toPropertyKey$2(arg) {
11643
- var key = _toPrimitive$2(arg, "string");
10451
+ function _toPropertyKey$1(arg) {
10452
+ var key = _toPrimitive$1(arg, "string");
11644
10453
  return typeof key === "symbol" ? key : String(key);
11645
10454
  }
11646
10455
 
@@ -11956,7 +10765,7 @@
11956
10765
  this._finishedFlag = false;
11957
10766
  }
11958
10767
  };
11959
- _createClass$2(Animation, [{
10768
+ _createClass$1(Animation, [{
11960
10769
  key: "pending",
11961
10770
  get:
11962
10771
  // animation: InternalAnimation | null;
@@ -12864,7 +11673,7 @@
12864
11673
  this.currentIteration = null;
12865
11674
  this.progress = null;
12866
11675
  }
12867
- _createClass$2(AnimationEffectTiming, [{
11676
+ _createClass$1(AnimationEffectTiming, [{
12868
11677
  key: "easing",
12869
11678
  get: function get() {
12870
11679
  return this._easing;
@@ -13349,7 +12158,6 @@
13349
12158
  runtime.AnimationTimeline = AnimationTimeline;
13350
12159
 
13351
12160
  exports.AABB = AABB;
13352
- exports.AbstractLayoutDefinition = AbstractLayoutDefinition;
13353
12161
  exports.AbstractRenderer = AbstractRenderer;
13354
12162
  exports.AbstractRendererPlugin = AbstractRendererPlugin;
13355
12163
  exports.AdvancedCamera = AdvancedCamera;
@@ -13371,7 +12179,6 @@
13371
12179
  exports.CustomElement = CustomElement;
13372
12180
  exports.CustomElementRegistry = CustomElementRegistry;
13373
12181
  exports.CustomEvent = CustomEvent;
13374
- exports.DefaultLayoutRegistry = DefaultLayoutRegistry;
13375
12182
  exports.DefaultSceneGraphSelector = DefaultSceneGraphSelector;
13376
12183
  exports.DefaultSceneGraphService = DefaultSceneGraphService;
13377
12184
  exports.DisplayObject = DisplayObject;
@@ -13387,18 +12194,11 @@
13387
12194
  exports.FederatedMouseEvent = FederatedMouseEvent;
13388
12195
  exports.FederatedPointerEvent = FederatedPointerEvent;
13389
12196
  exports.FederatedWheelEvent = FederatedWheelEvent;
13390
- exports.FragmentResult = FragmentResult;
13391
12197
  exports.Frustum = Frustum;
13392
12198
  exports.Group = Group;
13393
12199
  exports.HTML = HTML;
13394
12200
  exports.Image = Image;
13395
12201
  exports.KeyframeEffect = KeyframeEffect;
13396
- exports.LayoutChildren = LayoutChildren;
13397
- exports.LayoutContext = LayoutContext;
13398
- exports.LayoutEdges = LayoutEdges;
13399
- exports.LayoutEngine = LayoutEngine;
13400
- exports.LayoutFragment = LayoutFragment;
13401
- exports.LayoutObject = LayoutObject;
13402
12202
  exports.Line = Line;
13403
12203
  exports.LineUpdater = LineUpdater;
13404
12204
  exports.MutationEvent = MutationEvent;
@@ -13445,7 +12245,6 @@
13445
12245
  exports.isFederatedEvent = isFederatedEvent;
13446
12246
  exports.isFillOrStrokeAffected = isFillOrStrokeAffected;
13447
12247
  exports.isPattern = isPattern;
13448
- exports.layoutEngine = layoutEngine;
13449
12248
  exports.makeTiming = makeTiming;
13450
12249
  exports.mergeColors = mergeColors;
13451
12250
  exports.normalizeKeyframes = normalizeKeyframes;