@nova-lab/core 1.2.2-dev.259 → 1.2.2-dev.272

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 (30) hide show
  1. package/README.md +55 -0
  2. package/dist/2d/effects.js +165 -404
  3. package/dist/2d/lighting.d.ts +2 -0
  4. package/dist/2d/lighting.js +483 -227
  5. package/dist/2d/lottie.js +1 -1
  6. package/dist/2d/meshes.js +2 -2
  7. package/dist/2d/render-textures.js +3 -537
  8. package/dist/2d.js +3 -3
  9. package/dist/{NovaNode-CBZ-Ol-W.js → NovaNode-CshmSV9Y.js} +21 -21
  10. package/dist/{NovaRenderCommandWriter-CWQRa42y.js → NovaRenderCommandWriter-DeHyKjke.js} +272 -251
  11. package/dist/NovaRenderTexture-Desjl5-m.js +539 -0
  12. package/dist/{NovaTextSelectionService-7JqMcRrP.js → NovaTextSelectionService-CWJKn7TW.js} +3948 -3517
  13. package/dist/{NovaWebGLProgram-BO250QNF.js → NovaWebGLProgram-ytnblA5d.js} +28 -25
  14. package/dist/core.js +3 -3
  15. package/dist/model/lighting/LightingFields2D.d.ts +35 -0
  16. package/dist/model/lighting/LightingRenderer2D.d.ts +11 -18
  17. package/dist/model/lighting/LightingScene2D.d.ts +43 -0
  18. package/dist/model/lighting/NovaLighting2D.d.ts +18 -33
  19. package/dist/model/lighting/NovaLightingEffect2D.d.ts +46 -0
  20. package/dist/model/lighting/lighting-effect.d.ts +24 -0
  21. package/dist/model/lighting/lighting-shaders.d.ts +2 -2
  22. package/dist/model/lighting/lighting.types.d.ts +5 -1
  23. package/dist/model/render/backends/webgl/NovaWebGLCompositionPass.d.ts +2 -1
  24. package/dist/model/render/backends/webgl/NovaWebGLFrameRenderer.d.ts +26 -2
  25. package/dist/model/render/backends/webgl/NovaWebGLPathClipPass.d.ts +3 -2
  26. package/dist/model/render/backends/webgl/NovaWebGLProgram.d.ts +1 -1
  27. package/dist/model/render/graph/nova-render-dirty-items.d.ts +12 -0
  28. package/dist/model/runtime/cursor/NovaCursorManager.d.ts +7 -0
  29. package/dist/shader-effect-CHXZBHrO.js +247 -0
  30. package/package.json +2 -2
@@ -105,10 +105,10 @@ function J(r, e) {
105
105
  const f = t[y];
106
106
  if (Math.max(u.a.x, u.b.x) < Math.min(f.a.x, f.b.x) || Math.max(f.a.x, f.b.x) < Math.min(u.a.x, u.b.x))
107
107
  continue;
108
- const x = u.b.x - u.a.x, R = u.b.y - u.a.y, k = f.b.x - f.a.x, S = f.b.y - f.a.y, g = x * S - R * k;
108
+ const x = u.b.x - u.a.x, R = u.b.y - u.a.y, w = f.b.x - f.a.x, S = f.b.y - f.a.y, g = x * S - R * w;
109
109
  if (g === 0)
110
110
  continue;
111
- const b = f.a.x - u.a.x, P = f.a.y - u.a.y, D = (b * S - P * k) / g, M = (b * R - P * x) / g;
111
+ const b = f.a.x - u.a.x, P = f.a.y - u.a.y, D = (b * S - P * w) / g, M = (b * R - P * x) / g;
112
112
  D > 0 && D < 1 && M > 0 && M < 1 && s.add(u.a.y + D * R);
113
113
  }
114
114
  }
@@ -124,7 +124,7 @@ function J(r, e) {
124
124
  o.push(t[c++]);
125
125
  o = o.filter((S) => S.maximum > u), o.sort((S, g) => l(S, f) - l(g, f));
126
126
  const x = /* @__PURE__ */ new Map();
127
- let R = 0, k;
127
+ let R = 0, w;
128
128
  for (let S = 0; S < o.length; S++) {
129
129
  const g = o[S], b = l(g, f), P = e === "evenodd" ? Math.abs(R) % 2 !== 0 : R !== 0;
130
130
  for (R += g.winding; S + 1 < o.length && l(o[S + 1], f) === b; )
@@ -133,17 +133,17 @@ function J(r, e) {
133
133
  if (P === D)
134
134
  continue;
135
135
  if (D) {
136
- k = g;
136
+ w = g;
137
137
  continue;
138
138
  }
139
- if (!k || l(g, f) <= l(k, f))
139
+ if (!w || l(g, f) <= l(w, f))
140
140
  continue;
141
- let M = h.get(k);
141
+ let M = h.get(w);
142
142
  if (M?.right === g && M.bottom === u)
143
143
  M.bottom = y;
144
- else if (M = { left: k, right: g, top: u, bottom: y }, a.push(M), a.length * 6 > 3e6)
144
+ else if (M = { left: w, right: g, top: u, bottom: y }, a.push(M), a.length * 6 > 3e6)
145
145
  throw new RangeError("[Nova] Path triangle budget exceeded");
146
- x.set(k, M);
146
+ x.set(w, M);
147
147
  }
148
148
  h = x;
149
149
  }
@@ -153,16 +153,16 @@ function J(r, e) {
153
153
  let y = m.get(u);
154
154
  y || (y = /* @__PURE__ */ new Set(), m.set(u, y)), y.add(l(d.left, u)), y.add(l(d.right, u));
155
155
  }
156
- const _ = new Map([...m].map(([d, u]) => [d, [...u].sort((y, f) => y - f)])), v = [], w = (d, u, y, f, x, R) => {
156
+ const _ = new Map([...m].map(([d, u]) => [d, [...u].sort((y, f) => y - f)])), v = [], k = (d, u, y, f, x, R) => {
157
157
  if (v.push(d, u, y, f, x, R), v.length > 3e6)
158
158
  throw new RangeError("[Nova] Path triangle budget exceeded");
159
159
  };
160
160
  for (const { left: d, right: u, top: y, bottom: f } of a) {
161
- const x = l(d, y), R = l(d, f), k = l(u, y), S = l(u, f), g = _.get(y), b = _.get(f), P = j(g, x, !1), D = j(g, k, !0) - 1, M = j(b, R, !1), ue = j(b, S, !0) - 1;
161
+ const x = l(d, y), R = l(d, f), w = l(u, y), S = l(u, f), g = _.get(y), b = _.get(f), P = j(g, x, !1), D = j(g, w, !0) - 1, M = j(b, R, !1), ue = j(b, S, !0) - 1;
162
162
  for (let B = P; B < D; B++)
163
- w(g[B], y, g[B + 1], y, R, f);
163
+ k(g[B], y, g[B + 1], y, R, f);
164
164
  for (let B = M; B < ue; B++)
165
- w(k, y, b[B + 1], f, b[B], f);
165
+ k(w, y, b[B + 1], f, b[B], f);
166
166
  }
167
167
  return Object.freeze(v);
168
168
  }
@@ -192,16 +192,16 @@ function Ve(r, e, t = 1, s) {
192
192
  throw new RangeError("[Nova] Path transform and DPR must be finite");
193
193
  if (r.fillRule !== void 0 && !["nonzero", "evenodd"].includes(r.fillRule))
194
194
  throw new RangeError("[Nova] Invalid path fill rule");
195
- const n = Math.hypot(i[0], i[1], i[2], i[3]), a = 2 ** Math.floor(Math.log2(0.25 / Math.max(n * t, 1e-12))), o = r.styles?.stroke, c = o?.widthUnits === "screen", h = c ? [i[0], i[1], i[2], i[3], 0, 0] : void 0, l = [a, r.fillRule ?? "nonzero", !!r.styles?.fill, o?.width ?? 1, o?.lineCap ?? "butt", o?.lineJoin ?? "miter", o?.miterLimit ?? 10, o?.dashOffset ?? 0, o?.dashPattern?.join(","), !!o, h?.join(","), c ? t : ""].join("|"), m = s?.prepared ?? Fe, _ = s?.flatten, v = U(r.path) ? m.get(r.path) : void 0, w = v?.get(l);
196
- if (w)
197
- return w;
195
+ const n = Math.hypot(i[0], i[1], i[2], i[3]), a = 2 ** Math.floor(Math.log2(0.25 / Math.max(n * t, 1e-12))), o = r.styles?.stroke, c = o?.widthUnits === "screen", h = c ? [i[0], i[1], i[2], i[3], 0, 0] : void 0, l = [a, r.fillRule ?? "nonzero", !!r.styles?.fill, o?.width ?? 1, o?.lineCap ?? "butt", o?.lineJoin ?? "miter", o?.miterLimit ?? 10, o?.dashOffset ?? 0, o?.dashPattern?.join(","), !!o, h?.join(","), c ? t : ""].join("|"), m = s?.prepared ?? Fe, _ = s?.flatten, v = U(r.path) ? m.get(r.path) : void 0, k = v?.get(l);
196
+ if (k)
197
+ return k;
198
198
  const d = r.styles?.fill ? ne(r.path, { tolerance: a, cache: _ }) : [], u = c ? 0.25 / t : a, y = o ? Ae(r.path, o, u, h, _) : [], f = r.fillRule ?? "nonzero";
199
- let x, R, k, S;
199
+ let x, R, w, S;
200
200
  const g = Object.freeze({
201
201
  fillContours: d,
202
202
  strokeOutlineContours: y,
203
203
  get fillBounds() {
204
- return k ??= X(r.path);
204
+ return w ??= X(r.path);
205
205
  },
206
206
  get strokeBounds() {
207
207
  return o ? S ??= be(y) : void 0;
@@ -231,8 +231,8 @@ function je(r, e, t, s = 1) {
231
231
  const _ = Ve(r, t, s);
232
232
  if (m && r.styles?.fill && $(r.styles.fill).a > 0 && xe(r.path, m, r.fillRule ?? "nonzero", { tolerance: _.tolerance }))
233
233
  return !0;
234
- const v = r.styles?.stroke, w = _.strokeInScreenSpace ? { x: e.x - c, y: e.y - h } : m;
235
- return !!v && !!w && $(v.color).a > 0 && Re(_.strokeContours, w, v);
234
+ const v = r.styles?.stroke, k = _.strokeInScreenSpace ? { x: e.x - c, y: e.y - h } : m;
235
+ return !!v && !!k && $(v.color).a > 0 && Re(_.strokeContours, k, v);
236
236
  }
237
237
  const Ne = Object.freeze({
238
238
  group: "auto",
@@ -728,8 +728,8 @@ class N extends Me {
728
728
  _computeWorldMatrix() {
729
729
  const e = this._transformState, t = e.matrix, s = e.rotation, i = s === 0 ? 1 : Math.cos(s), n = s === 0 ? 0 : Math.sin(s), a = i * e.scaleX, o = n * e.scaleX, c = -n * e.scaleY, h = i * e.scaleY, l = this.parent?._transformState.matrix;
730
730
  if (l) {
731
- const m = l[0], _ = l[1], v = l[3], w = l[4];
732
- t[0] = a * m + o * v, t[1] = a * _ + o * w, t[3] = c * m + h * v, t[4] = c * _ + h * w, t[6] = e.x * m + e.y * v + l[6], t[7] = e.x * _ + e.y * w + l[7];
731
+ const m = l[0], _ = l[1], v = l[3], k = l[4];
732
+ a === 1 && o === 0 && c === 0 && h === 1 && m === 1 && _ === 0 && v === 0 && k === 1 ? (t[0] = 1, t[1] = _ + o, t[3] = c + v, t[4] = 1) : (t[0] = a * m + o * v, t[1] = a * _ + o * k, t[3] = c * m + h * v, t[4] = c * _ + h * k), t[6] = e.x * m + e.y * v + l[6], t[7] = e.x * _ + e.y * k + l[7];
733
733
  } else
734
734
  t[0] = a, t[1] = o, t[3] = c, t[4] = h, t[6] = e.x, t[7] = e.y;
735
735
  return t[2] = 0, t[5] = 0, t[8] = 1, t;