@fulate/core 1.0.10 → 1.0.12

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.
Files changed (2) hide show
  1. package/dist/index.js +9 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { clamp, isEqual, isFunction, isNull, isNumber, isObjectLike, isString, isUndefined } from "lodash-es";
1
+ import { clamp, cloneDeep, has, isEqual, isFunction, isNull, isNumber, isObjectLike, isString, isUndefined, last } from "lodash-es";
2
2
  import { Bound, Intersection, clipPolygonToRect, createCanvasGradient, createPointView, formatPremultipliedColor, isGradient, isIdentityMatrix, makeBoundingBoxFromRects, parsePremultipliedColor, qrDecompose, rectEdgePosition, transformPoint } from "@fulate/share";
3
3
  import RBush from "rbush";
4
4
  import { Easing, Group, Tween } from "@tweenjs/tween.js";
@@ -248,7 +248,7 @@ var ChangeImpact = /* @__PURE__ */ function(ChangeImpact) {
248
248
  return ChangeImpact;
249
249
  }({});
250
250
  function clonePropertyValue(value) {
251
- return isObjectLike(value) ? structuredClone(value) : value;
251
+ return isObjectLike(value) ? cloneDeep(value) : value;
252
252
  }
253
253
  /** snapshot/serialization 边界按结构内容比较独立值。 */
254
254
  function sameSnapshotValue(left, right) {
@@ -297,7 +297,7 @@ var NodeProperties = class {
297
297
  function getConfiguredPropertyValue(properties, key) {
298
298
  const configured = properties[CONFIGURED_STATE];
299
299
  const runtime = properties[RUNTIME_OVERRIDE_STATE];
300
- return runtime && Object.hasOwn(runtime, key) ? configured[key] : properties[key];
300
+ return runtime && has(runtime, [key]) ? configured[key] : properties[key];
301
301
  }
302
302
  /** @internal 一次借用同一 owner 多个字段的当前 configured source。 */
303
303
  function readConfiguredPropertyValues(properties, targets) {
@@ -307,7 +307,7 @@ function readConfiguredPropertyValues(properties, targets) {
307
307
  for (const [key, target] of targets) target.value = properties[key];
308
308
  return;
309
309
  }
310
- for (const [key, target] of targets) target.value = Object.hasOwn(runtime, key) ? configured[key] : properties[key];
310
+ for (const [key, target] of targets) target.value = has(runtime, [key]) ? configured[key] : properties[key];
311
311
  }
312
312
  function createPropertiesLike(properties, values) {
313
313
  const Constructor = properties.constructor;
@@ -325,7 +325,7 @@ function preparePropertyAnimationValues(properties, patch, keys) {
325
325
  const start = {};
326
326
  const target = {};
327
327
  for (const key of keys) {
328
- start[key] = runtime && Object.hasOwn(runtime, key) ? configured[key] : properties[key];
328
+ start[key] = runtime && has(runtime, [key]) ? configured[key] : properties[key];
329
329
  target[key] = isUndefined(patch[key]) ? defaultValue(key) : patch[key];
330
330
  }
331
331
  return {
@@ -347,7 +347,7 @@ function preparePropertyUpdate(properties, patch, source) {
347
347
  for (const key of Object.keys(patch)) {
348
348
  if (key === "key") continue;
349
349
  const requested = patch[key];
350
- const runtimeMasked = runtime !== null && Object.hasOwn(runtime, key);
350
+ const runtimeMasked = runtime !== null && has(runtime, [key]);
351
351
  const sourceRecordBefore = runtimeMasked;
352
352
  if (source === "runtime" && isUndefined(requested) && !sourceRecordBefore) continue;
353
353
  const beforeValue = properties[key];
@@ -408,7 +408,7 @@ function prepareRuntimePropertyClear(properties, keys) {
408
408
  const runtime = properties[RUNTIME_OVERRIDE_STATE];
409
409
  if (!runtime) return null;
410
410
  const patch = {};
411
- for (const key of keys ?? Object.keys(runtime)) if (typeof key === "string" && Object.hasOwn(runtime, key)) patch[key] = void 0;
411
+ for (const key of keys ?? Object.keys(runtime)) if (typeof key === "string" && has(runtime, [key])) patch[key] = void 0;
412
412
  return prepareRuntimePropertyUpdate(properties, patch);
413
413
  }
414
414
  /** @internal 安装已经 finalize 的 changed source fields 与 effective values。 */
@@ -3008,7 +3008,7 @@ var Skin = class {
3008
3008
  * 子类新增的持久化字段由子类覆写并追加。
3009
3009
  */
3010
3010
  toJSON() {
3011
- return structuredClone({
3011
+ return cloneDeep({
3012
3012
  shapeFill: this.shapeFill,
3013
3013
  shapeStroke: this.shapeStroke,
3014
3014
  lineStroke: this.lineStroke,
@@ -5836,7 +5836,7 @@ var Root = class extends Node {
5836
5836
  enablePorts;
5837
5837
  /** 当前 hover 路径中最深的元素。 */
5838
5838
  get currentElement() {
5839
- return this.hoverPath.at(-1);
5839
+ return last(this.hoverPath);
5840
5840
  }
5841
5841
  /** @internal 当前命中元素从祖先到叶子的 hover 路径。 */
5842
5842
  hoverPath = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fulate/core",
3
- "version": "1.0.10",
3
+ "version": "1.0.12",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",