@kolkrabbi/design-editor 0.24.0 → 0.27.0

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 (35) hide show
  1. package/README.md +2 -2
  2. package/dist/BindDot-CMUtpJPX.js +84 -0
  3. package/dist/BufferGeometryUtils-Cc8LNd5v.js +150 -0
  4. package/dist/ColorModesWindow-CWhL6nfm.js +1493 -0
  5. package/dist/GLTFLoader-BFir8PCc.js +1361 -0
  6. package/dist/OBJLoader-BgqC_-Jn.js +287 -0
  7. package/dist/{OrbitControls-Cql8Rn2i.js → OrbitControls-DVpLgmKv.js} +2755 -2202
  8. package/dist/STLLoader-C6DGLf6r.js +83 -0
  9. package/dist/Timeline-BObvcdXF.js +3014 -0
  10. package/dist/TreePicker-nMf17QGH.js +68 -0
  11. package/dist/core-EWu8GfXL.js +17504 -0
  12. package/dist/core.js +5 -3
  13. package/dist/design-editor.css +1 -1
  14. package/dist/design-editor.js +2114 -916
  15. package/dist/effects-DZEmfY7a.js +444 -0
  16. package/dist/effects.js +1 -1
  17. package/dist/generators-D1tFSZgG.js +2961 -0
  18. package/dist/generators.js +1 -1
  19. package/dist/{host-qtFVROOD.js → host-CRsCCafL.js} +429 -370
  20. package/dist/{host-be1CWhN1.js → host-ZLJKCZ54.js} +137 -136
  21. package/dist/motion-C_u7tsis.js +2295 -0
  22. package/dist/motion.js +1 -1
  23. package/dist/previewScale-BMkeLc6w.js +26 -0
  24. package/dist/{rolls-Bg1XHuvJ.js → rolls-BGtqxVYq.js} +2621 -1522
  25. package/dist/{src-B5fQgAVE.js → src-BpTckTDZ.js} +1 -1
  26. package/dist/{useLayerEdit-ieOjHx6x.js → useLayerEdit-BFcZhiNX.js} +20992 -12580
  27. package/package.json +9 -7
  28. package/dist/RuleRow-DIbuUt37.js +0 -650
  29. package/dist/TreePicker-DLmMl0aU.js +0 -68
  30. package/dist/core-CNI8b_83.js +0 -12314
  31. package/dist/effectCategories-0PnGZvjd.js +0 -4210
  32. package/dist/effects-BujxwoNY.js +0 -469
  33. package/dist/generators-SpRHQDMq.js +0 -2517
  34. package/dist/labels-B5qkocWy.js +0 -2007
  35. package/dist/motion-Bn3FVkCS.js +0 -2260
package/README.md CHANGED
@@ -25,8 +25,8 @@ like everything else in this repo. kol-fxr is now its first consumer.
25
25
 
26
26
  ```sh
27
27
  npm install @kolkrabbi/design-editor \
28
- @kolkrabbi/kol-component @kolkrabbi/kol-framework @kolkrabbi/kol-icons \
29
- @kolkrabbi/kol-shell @kolkrabbi/kol-media-client react react-dom
28
+ @kolkrabbi/kol-component @kolkrabbi/kol-framework @kolkrabbi/kol-hardware @kolkrabbi/kol-icons \
29
+ @kolkrabbi/kol-shell @kolkrabbi/kol-media-client @kolkrabbi/kol-theme react react-dom
30
30
  ```
31
31
 
32
32
  Peers are pinned to the DS versions the bundle was built against (see
@@ -0,0 +1,84 @@
1
+ import { D as e, L as t, an as n, en as r, j as i, ln as a, on as o } from "./rolls-BGtqxVYq.js";
2
+ import { ParamBindDot as s } from "@kolkrabbi/kol-component";
3
+ import { useEffect as c, useState as l } from "react";
4
+ import { jsx as u } from "react/jsx-runtime";
5
+ //#region src/editor/params/dotVisibility.js
6
+ var d = "kol-editor-show-dots", f = !1;
7
+ try {
8
+ f = localStorage.getItem(d) === "1";
9
+ } catch {}
10
+ var p = /* @__PURE__ */ new Set();
11
+ function m() {
12
+ f = !f;
13
+ try {
14
+ localStorage.setItem(d, f ? "1" : "0");
15
+ } catch {}
16
+ p.forEach((e) => e(f));
17
+ }
18
+ function h() {
19
+ let [e, t] = l(f);
20
+ return c(() => {
21
+ let e = (e) => t(e);
22
+ return p.add(e), () => p.delete(e);
23
+ }, []), e;
24
+ }
25
+ //#endregion
26
+ //#region src/editor/params/BindDot.jsx
27
+ function g({ layer: c, param: l, setProp: d }) {
28
+ let f = t(), p = h(), m = c[l.key], g = e(m), _ = g ? m.bind === "track" ? "track" : m.source : "none";
29
+ if (!p && !g) return null;
30
+ let v = () => i(m, r.getCtx(), c) ?? l.default ?? 0, y = () => l.min != null && l.max != null ? [l.min, l.max] : [0, 1], b = (e) => {
31
+ if (e === "none") d(l.key, v());
32
+ else if (e === "track") {
33
+ let e = v();
34
+ d(l.key, {
35
+ bind: "track",
36
+ keys: [{
37
+ t: 0,
38
+ v: e,
39
+ easing: "linear"
40
+ }, {
41
+ t: 1,
42
+ v: e,
43
+ easing: "linear"
44
+ }]
45
+ });
46
+ } else n(e)?.ensure?.().catch(() => {}), d(l.key, {
47
+ bind: "mod",
48
+ source: e,
49
+ transform: { range: y() }
50
+ });
51
+ }, x = l.type === "color" ? [] : o().filter((e) => !e.hidden), S = x.find((e) => a(e.id)), C = [
52
+ {
53
+ value: "none",
54
+ label: "Constant"
55
+ },
56
+ {
57
+ value: "track",
58
+ label: "Keyframes"
59
+ },
60
+ ...x.filter((e) => !a(e.id)).map((e) => ({
61
+ value: e.id,
62
+ label: e.label
63
+ })),
64
+ ...S ? [{
65
+ value: S.id,
66
+ label: "Joystick"
67
+ }] : []
68
+ ];
69
+ return /* @__PURE__ */ u(s, {
70
+ size: f,
71
+ bound: g,
72
+ mode: C.find((e) => e.value === _)?.label ?? _,
73
+ label: l.label ?? l.key,
74
+ tooltip: g ? `Modulated (${_}) — shape it in the Animation tab` : "Modulate",
75
+ minWidth: 220,
76
+ items: C.map((e) => ({
77
+ label: e.label,
78
+ onClick: () => b(e.value),
79
+ checked: _ === e.value
80
+ }))
81
+ });
82
+ }
83
+ //#endregion
84
+ export { m as n, h as r, g as t };
@@ -0,0 +1,150 @@
1
+ import { f as e, p as t } from "./OrbitControls-DVpLgmKv.js";
2
+ //#region ../../node_modules/.pnpm/three@0.185.1/node_modules/three/examples/jsm/utils/BufferGeometryUtils.js
3
+ function n(e, n = !1) {
4
+ let i = e[0].index !== null, a = new Set(Object.keys(e[0].attributes)), o = new Set(Object.keys(e[0].morphAttributes)), s = {}, c = {}, l = e[0].morphTargetsRelative, u = new t(), d = 0;
5
+ for (let t = 0; t < e.length; ++t) {
6
+ let r = e[t], f = 0;
7
+ if (i !== (r.index !== null)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". All geometries must have compatible attributes; make sure index attribute exists among all geometries, or in none of them."), null;
8
+ for (let e in r.attributes) {
9
+ if (!a.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". All geometries must have compatible attributes; make sure \"" + e + "\" attribute exists among all geometries, or in none of them."), null;
10
+ s[e] === void 0 && (s[e] = []), s[e].push(r.attributes[e]), f++;
11
+ }
12
+ if (f !== a.size) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". Make sure all geometries have the same number of attributes."), null;
13
+ if (l !== r.morphTargetsRelative) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". .morphTargetsRelative must be consistent throughout all geometries."), null;
14
+ for (let e in r.morphAttributes) {
15
+ if (!o.has(e)) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". .morphAttributes must be consistent throughout all geometries."), null;
16
+ c[e] === void 0 && (c[e] = []), c[e].push(r.morphAttributes[e]);
17
+ }
18
+ if (n) {
19
+ let e;
20
+ if (i) e = r.index.count;
21
+ else if (r.attributes.position !== void 0) e = r.attributes.position.count;
22
+ else return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed with geometry at index " + t + ". The geometry must have either an index or a position attribute"), null;
23
+ u.addGroup(d, e, t), d += e;
24
+ }
25
+ }
26
+ if (i) {
27
+ let t = 0, n = [];
28
+ for (let r = 0; r < e.length; ++r) {
29
+ let i = e[r].index;
30
+ for (let e = 0; e < i.count; ++e) n.push(i.getX(e) + t);
31
+ t += e[r].attributes.position.count;
32
+ }
33
+ u.setIndex(n);
34
+ }
35
+ for (let e in s) {
36
+ let t = r(s[e]);
37
+ if (!t) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " attribute."), null;
38
+ u.setAttribute(e, t);
39
+ }
40
+ for (let e in c) {
41
+ let t = c[e][0].length;
42
+ if (t !== 0) {
43
+ u.morphAttributes = u.morphAttributes || {}, u.morphAttributes[e] = [];
44
+ for (let n = 0; n < t; ++n) {
45
+ let t = [];
46
+ for (let r = 0; r < c[e].length; ++r) t.push(c[e][r][n]);
47
+ let i = r(t);
48
+ if (!i) return console.error("THREE.BufferGeometryUtils: .mergeGeometries() failed while trying to merge the " + e + " morphAttribute."), null;
49
+ u.morphAttributes[e].push(i);
50
+ }
51
+ }
52
+ }
53
+ return u;
54
+ }
55
+ function r(t) {
56
+ let n, r, i, a = -1, o = 0;
57
+ for (let e = 0; e < t.length; ++e) {
58
+ let s = t[e];
59
+ if (n === void 0 && (n = s.array.constructor), n !== s.array.constructor) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes."), null;
60
+ if (r === void 0 && (r = s.itemSize), r !== s.itemSize) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.itemSize must be consistent across matching attributes."), null;
61
+ if (i === void 0 && (i = s.normalized), i !== s.normalized) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.normalized must be consistent across matching attributes."), null;
62
+ if (a === -1 && (a = s.gpuType), a !== s.gpuType) return console.error("THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes."), null;
63
+ o += s.count * r;
64
+ }
65
+ let s = new n(o), c = new e(s, r, i), l = 0;
66
+ for (let e = 0; e < t.length; ++e) {
67
+ let n = t[e];
68
+ if (n.isInterleavedBufferAttribute) {
69
+ let e = l / r;
70
+ for (let t = 0, i = n.count; t < i; t++) for (let i = 0; i < r; i++) {
71
+ let r = n.getComponent(t, i);
72
+ c.setComponent(t + e, i, r);
73
+ }
74
+ } else s.set(n.array, l);
75
+ l += n.count * r;
76
+ }
77
+ return a !== void 0 && (c.gpuType = a), c;
78
+ }
79
+ function i(e, t = 1e-4) {
80
+ t = Math.max(t, 2 ** -52);
81
+ let n = {}, r = e.getIndex(), i = e.getAttribute("position"), a = r ? r.count : i.count, o = 0, s = Object.keys(e.attributes), c = {}, l = {}, u = [], d = [
82
+ "getX",
83
+ "getY",
84
+ "getZ",
85
+ "getW"
86
+ ], f = [
87
+ "setX",
88
+ "setY",
89
+ "setZ",
90
+ "setW"
91
+ ];
92
+ for (let t = 0, n = s.length; t < n; t++) {
93
+ let n = s[t], r = e.attributes[n];
94
+ c[n] = new r.constructor(new r.array.constructor(r.count * r.itemSize), r.itemSize, r.normalized);
95
+ let i = e.morphAttributes[n];
96
+ i && (l[n] || (l[n] = []), i.forEach((e, t) => {
97
+ let r = new e.array.constructor(e.count * e.itemSize);
98
+ l[n][t] = new e.constructor(r, e.itemSize, e.normalized);
99
+ }));
100
+ }
101
+ let p = t * .5, m = 10 ** Math.log10(1 / t), h = p * m;
102
+ for (let t = 0; t < a; t++) {
103
+ let i = r ? r.getX(t) : t, a = "";
104
+ for (let t = 0, n = s.length; t < n; t++) {
105
+ let n = s[t], r = e.getAttribute(n), o = r.itemSize;
106
+ for (let e = 0; e < o; e++) a += `${~~(r[d[e]](i) * m + h)},`;
107
+ }
108
+ if (a in n) u.push(n[a]);
109
+ else {
110
+ for (let t = 0, n = s.length; t < n; t++) {
111
+ let n = s[t], r = e.getAttribute(n), a = e.morphAttributes[n], u = r.itemSize, p = c[n], m = l[n];
112
+ for (let e = 0; e < u; e++) {
113
+ let t = d[e], n = f[e];
114
+ if (p[n](o, r[t](i)), a) for (let e = 0, r = a.length; e < r; e++) m[e][n](o, a[e][t](i));
115
+ }
116
+ }
117
+ n[a] = o, u.push(o), o++;
118
+ }
119
+ }
120
+ let g = e.clone();
121
+ for (let t in e.attributes) {
122
+ let e = c[t];
123
+ if (g.setAttribute(t, new e.constructor(e.array.slice(0, o * e.itemSize), e.itemSize, e.normalized)), t in l) for (let e = 0; e < l[t].length; e++) {
124
+ let n = l[t][e];
125
+ g.morphAttributes[t][e] = new n.constructor(n.array.slice(0, o * n.itemSize), n.itemSize, n.normalized);
126
+ }
127
+ }
128
+ return g.setIndex(u), g;
129
+ }
130
+ function a(e, t) {
131
+ if (t === 0) return console.warn("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Geometry already defined as triangles."), e;
132
+ if (t === 2 || t === 1) {
133
+ let n = e.getIndex();
134
+ if (n === null) {
135
+ let t = [], r = e.getAttribute("position");
136
+ if (r !== void 0) {
137
+ for (let e = 0; e < r.count; e++) t.push(e);
138
+ e.setIndex(t), n = e.getIndex();
139
+ } else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Undefined position attribute. Processing not possible."), e;
140
+ }
141
+ let r = n.count - 2, i = [];
142
+ if (t === 2) for (let e = 1; e <= r; e++) i.push(n.getX(0)), i.push(n.getX(e)), i.push(n.getX(e + 1));
143
+ else for (let e = 0; e < r; e++) e % 2 == 0 ? (i.push(n.getX(e)), i.push(n.getX(e + 1)), i.push(n.getX(e + 2))) : (i.push(n.getX(e + 2)), i.push(n.getX(e + 1)), i.push(n.getX(e)));
144
+ i.length / 3 !== r && console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unable to generate correct amount of triangles.");
145
+ let a = e.clone();
146
+ return a.setIndex(i), a.clearGroups(), a;
147
+ } else return console.error("THREE.BufferGeometryUtils.toTrianglesDrawMode(): Unknown draw mode:", t), e;
148
+ }
149
+ //#endregion
150
+ export { i as n, a as r, n as t };