debug-vfx 0.1.0 → 0.1.2
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.js +87 -18
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -32425,6 +32425,75 @@ ${" ".repeat(indent - 2)}}`;
|
|
|
32425
32425
|
}
|
|
32426
32426
|
return null;
|
|
32427
32427
|
};
|
|
32428
|
+
var camelToKebab = (str) => str.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
32429
|
+
var formatVueValue = (key, value) => {
|
|
32430
|
+
if (value === void 0 || value === null) return null;
|
|
32431
|
+
const kebab = camelToKebab(key);
|
|
32432
|
+
if (typeof value === "boolean") {
|
|
32433
|
+
return value ? kebab : `:${kebab}="false"`;
|
|
32434
|
+
}
|
|
32435
|
+
if (typeof value === "number") {
|
|
32436
|
+
return `:${kebab}="${value}"`;
|
|
32437
|
+
}
|
|
32438
|
+
if (typeof value === "string") {
|
|
32439
|
+
return `${kebab}="${value}"`;
|
|
32440
|
+
}
|
|
32441
|
+
if (Array.isArray(value)) {
|
|
32442
|
+
if (value.length > 0 && typeof value[0] === "string" && value[0].startsWith("#")) {
|
|
32443
|
+
return `:${kebab}="[${value.map((v) => `'${v}'`).join(", ")}]"`;
|
|
32444
|
+
}
|
|
32445
|
+
if (value.length > 0 && Array.isArray(value[0])) {
|
|
32446
|
+
return `:${kebab}="[${value.map((v) => `[${v.join(", ")}]`).join(", ")}]"`;
|
|
32447
|
+
}
|
|
32448
|
+
return `:${kebab}="[${value.join(", ")}]"`;
|
|
32449
|
+
}
|
|
32450
|
+
if (typeof value === "object") {
|
|
32451
|
+
const fmtVal = (v) => {
|
|
32452
|
+
if (v === void 0 || v === null) return "null";
|
|
32453
|
+
if (typeof v === "string") return `'${v}'`;
|
|
32454
|
+
if (typeof v === "number" || typeof v === "boolean") return String(v);
|
|
32455
|
+
if (Array.isArray(v)) {
|
|
32456
|
+
if (v.length > 0 && typeof v[0] === "object" && !Array.isArray(v[0])) {
|
|
32457
|
+
return `[${v.map((item) => fmtVal(item)).join(", ")}]`;
|
|
32458
|
+
}
|
|
32459
|
+
return `[${v.map((item) => fmtVal(item)).join(", ")}]`;
|
|
32460
|
+
}
|
|
32461
|
+
if (typeof v === "object") return fmtObj(v);
|
|
32462
|
+
return String(v);
|
|
32463
|
+
};
|
|
32464
|
+
const fmtObj = (obj) => {
|
|
32465
|
+
const entries = Object.entries(obj).filter(
|
|
32466
|
+
([, v]) => v !== void 0 && v !== null
|
|
32467
|
+
);
|
|
32468
|
+
if (entries.length === 0) return "{}";
|
|
32469
|
+
return `{ ${entries.map(([k, v]) => `${k}: ${fmtVal(v)}`).join(", ")} }`;
|
|
32470
|
+
};
|
|
32471
|
+
return `:${kebab}="${fmtObj(value)}"`;
|
|
32472
|
+
}
|
|
32473
|
+
return null;
|
|
32474
|
+
};
|
|
32475
|
+
var generateVueTemplate = (values) => {
|
|
32476
|
+
const props = [];
|
|
32477
|
+
if (values.geometryType && values.geometryType !== GeometryType.NONE) {
|
|
32478
|
+
const geoCode = geometryTypeToJSX(values.geometryType, values.geometryArgs);
|
|
32479
|
+
if (geoCode) {
|
|
32480
|
+
props.push(`:geometry="${geoCode}"`);
|
|
32481
|
+
}
|
|
32482
|
+
}
|
|
32483
|
+
for (const key of propOrder) {
|
|
32484
|
+
const value = values[key];
|
|
32485
|
+
if (shouldSkipDefault(key, value, values)) continue;
|
|
32486
|
+
const formatted = formatVueValue(key, value);
|
|
32487
|
+
if (formatted) props.push(formatted);
|
|
32488
|
+
}
|
|
32489
|
+
if (props.length === 0) {
|
|
32490
|
+
return "<VFXParticles />";
|
|
32491
|
+
}
|
|
32492
|
+
return `<VFXParticles
|
|
32493
|
+
${props.join("\n ")}
|
|
32494
|
+
/>`;
|
|
32495
|
+
};
|
|
32496
|
+
var generateSvelteTemplate = generateVFXParticlesJSX;
|
|
32428
32497
|
var generateVanillaCode = (values) => {
|
|
32429
32498
|
const props = [];
|
|
32430
32499
|
if (values.geometryType && values.geometryType !== GeometryType.NONE) {
|
|
@@ -32573,7 +32642,7 @@ var styles = {
|
|
|
32573
32642
|
position: "relative"
|
|
32574
32643
|
},
|
|
32575
32644
|
sectionHover: {
|
|
32576
|
-
|
|
32645
|
+
border: "1px solid transparent",
|
|
32577
32646
|
background: `linear-gradient(${wrapped.bgSection}, ${wrapped.bgSection}) padding-box, linear-gradient(135deg, ${wrapped.accent} 0%, ${wrapped.accentLight} 50%, rgba(251, 191, 36, 0.6) 100%) border-box`
|
|
32578
32647
|
},
|
|
32579
32648
|
sectionHeader: {
|
|
@@ -32808,21 +32877,21 @@ var styles = {
|
|
|
32808
32877
|
},
|
|
32809
32878
|
copyBtnHover: {
|
|
32810
32879
|
background: `linear-gradient(135deg, rgba(249, 115, 22, 0.25) 0%, rgba(251, 146, 60, 0.15) 100%)`,
|
|
32811
|
-
|
|
32880
|
+
border: `1px solid ${wrapped.accent}`,
|
|
32812
32881
|
boxShadow: `0 0 20px rgba(249, 115, 22, 0.4), 0 0 40px rgba(249, 115, 22, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1)`,
|
|
32813
32882
|
color: wrapped.accentLight,
|
|
32814
32883
|
textShadow: `0 0 12px rgba(249, 115, 22, 0.8)`
|
|
32815
32884
|
},
|
|
32816
32885
|
copyBtnSuccess: {
|
|
32817
32886
|
background: `linear-gradient(135deg, rgba(34, 197, 94, 0.25) 0%, rgba(34, 197, 94, 0.15) 100%)`,
|
|
32818
|
-
|
|
32887
|
+
border: "1px solid rgba(34, 197, 94, 0.6)",
|
|
32819
32888
|
color: "#4ade80",
|
|
32820
32889
|
boxShadow: `0 0 16px rgba(34, 197, 94, 0.4), 0 0 32px rgba(34, 197, 94, 0.2)`,
|
|
32821
32890
|
textShadow: `0 0 8px rgba(34, 197, 94, 0.6)`
|
|
32822
32891
|
},
|
|
32823
32892
|
inputDragging: {
|
|
32824
32893
|
background: `rgba(249, 115, 22, 0.15) !important`,
|
|
32825
|
-
|
|
32894
|
+
border: `1px solid ${wrapped.accent} !important`,
|
|
32826
32895
|
boxShadow: `0 0 0 2px ${wrapped.accentGlow}, 0 0 12px rgba(249, 115, 22, 0.3)`,
|
|
32827
32896
|
color: wrapped.accentLight
|
|
32828
32897
|
},
|
|
@@ -33133,7 +33202,7 @@ var ScrubInput = ({
|
|
|
33133
33202
|
cursor: "ew-resize"
|
|
33134
33203
|
}), isDragging ? {
|
|
33135
33204
|
background: `rgba(249, 115, 22, 0.15)`,
|
|
33136
|
-
|
|
33205
|
+
border: `1px solid ${wrapped.accent}`,
|
|
33137
33206
|
boxShadow: `0 0 0 2px ${wrapped.accentGlow}, 0 0 12px rgba(249, 115, 22, 0.3)`,
|
|
33138
33207
|
color: wrapped.accentLight
|
|
33139
33208
|
} : {});
|
|
@@ -34919,13 +34988,13 @@ var EasingCurveEditor = ({ value, onChange, label = "Easing Curve" }) => {
|
|
|
34919
34988
|
onMouseEnter: (e) => {
|
|
34920
34989
|
e.currentTarget.style.background = "rgba(249, 115, 22, 0.25)";
|
|
34921
34990
|
e.currentTarget.style.color = wrapped.accent;
|
|
34922
|
-
e.currentTarget.style.
|
|
34991
|
+
e.currentTarget.style.border = `1px solid ${wrapped.accent}`;
|
|
34923
34992
|
e.currentTarget.style.boxShadow = "0 0 8px rgba(249, 115, 22, 0.3)";
|
|
34924
34993
|
},
|
|
34925
34994
|
onMouseLeave: (e) => {
|
|
34926
34995
|
e.currentTarget.style.background = "rgba(249, 115, 22, 0.1)";
|
|
34927
34996
|
e.currentTarget.style.color = wrapped.textMuted;
|
|
34928
|
-
e.currentTarget.style.
|
|
34997
|
+
e.currentTarget.style.border = `1px solid ${wrapped.border}`;
|
|
34929
34998
|
e.currentTarget.style.boxShadow = "none";
|
|
34930
34999
|
},
|
|
34931
35000
|
children: preset.name
|
|
@@ -34961,12 +35030,12 @@ var EasingCurveEditor = ({ value, onChange, label = "Easing Curve" }) => {
|
|
|
34961
35030
|
},
|
|
34962
35031
|
onMouseEnter: (e) => {
|
|
34963
35032
|
e.currentTarget.style.background = "rgba(100, 200, 255, 0.25)";
|
|
34964
|
-
e.currentTarget.style.
|
|
35033
|
+
e.currentTarget.style.border = "1px solid #64c8ff";
|
|
34965
35034
|
e.currentTarget.style.boxShadow = "0 0 8px rgba(100, 200, 255, 0.4)";
|
|
34966
35035
|
},
|
|
34967
35036
|
onMouseLeave: (e) => {
|
|
34968
35037
|
e.currentTarget.style.background = "rgba(100, 200, 255, 0.1)";
|
|
34969
|
-
e.currentTarget.style.
|
|
35038
|
+
e.currentTarget.style.border = "1px solid rgba(100, 200, 255, 0.3)";
|
|
34970
35039
|
e.currentTarget.style.boxShadow = "none";
|
|
34971
35040
|
},
|
|
34972
35041
|
children: "\u2195 invert"
|
|
@@ -35101,12 +35170,12 @@ var EasingCurveEditor = ({ value, onChange, label = "Easing Curve" }) => {
|
|
|
35101
35170
|
},
|
|
35102
35171
|
onMouseEnter: (e) => {
|
|
35103
35172
|
e.currentTarget.style.background = "rgba(168, 85, 247, 0.3)";
|
|
35104
|
-
e.currentTarget.style.
|
|
35173
|
+
e.currentTarget.style.border = "1px solid #a855f7";
|
|
35105
35174
|
e.currentTarget.style.boxShadow = "0 0 8px rgba(168, 85, 247, 0.4)";
|
|
35106
35175
|
},
|
|
35107
35176
|
onMouseLeave: (e) => {
|
|
35108
35177
|
e.currentTarget.style.background = "rgba(168, 85, 247, 0.15)";
|
|
35109
|
-
e.currentTarget.style.
|
|
35178
|
+
e.currentTarget.style.border = "1px solid rgba(168, 85, 247, 0.3)";
|
|
35110
35179
|
e.currentTarget.style.boxShadow = "none";
|
|
35111
35180
|
},
|
|
35112
35181
|
children: "bounce"
|
|
@@ -35147,12 +35216,12 @@ var EasingCurveEditor = ({ value, onChange, label = "Easing Curve" }) => {
|
|
|
35147
35216
|
},
|
|
35148
35217
|
onMouseEnter: (e) => {
|
|
35149
35218
|
e.currentTarget.style.background = "rgba(168, 85, 247, 0.3)";
|
|
35150
|
-
e.currentTarget.style.
|
|
35219
|
+
e.currentTarget.style.border = "1px solid #a855f7";
|
|
35151
35220
|
e.currentTarget.style.boxShadow = "0 0 8px rgba(168, 85, 247, 0.4)";
|
|
35152
35221
|
},
|
|
35153
35222
|
onMouseLeave: (e) => {
|
|
35154
35223
|
e.currentTarget.style.background = "rgba(168, 85, 247, 0.15)";
|
|
35155
|
-
e.currentTarget.style.
|
|
35224
|
+
e.currentTarget.style.border = "1px solid rgba(168, 85, 247, 0.3)";
|
|
35156
35225
|
e.currentTarget.style.boxShadow = "none";
|
|
35157
35226
|
},
|
|
35158
35227
|
children: name
|
|
@@ -35192,12 +35261,12 @@ var EasingCurveEditor = ({ value, onChange, label = "Easing Curve" }) => {
|
|
|
35192
35261
|
},
|
|
35193
35262
|
onMouseEnter: (e) => {
|
|
35194
35263
|
e.currentTarget.style.background = "rgba(168, 85, 247, 0.3)";
|
|
35195
|
-
e.currentTarget.style.
|
|
35264
|
+
e.currentTarget.style.border = "1px solid #a855f7";
|
|
35196
35265
|
e.currentTarget.style.boxShadow = "0 0 8px rgba(168, 85, 247, 0.4)";
|
|
35197
35266
|
},
|
|
35198
35267
|
onMouseLeave: (e) => {
|
|
35199
35268
|
e.currentTarget.style.background = "rgba(168, 85, 247, 0.15)";
|
|
35200
|
-
e.currentTarget.style.
|
|
35269
|
+
e.currentTarget.style.border = "1px solid rgba(168, 85, 247, 0.3)";
|
|
35201
35270
|
e.currentTarget.style.boxShadow = "none";
|
|
35202
35271
|
},
|
|
35203
35272
|
children: name
|
|
@@ -35343,7 +35412,7 @@ var DebugPanelContent = ({ initialValues, onUpdate, mode = "r3f" }) => {
|
|
|
35343
35412
|
if (hasPendingChanges) {
|
|
35344
35413
|
flushChanges();
|
|
35345
35414
|
}
|
|
35346
|
-
const code = mode === "vanilla" ? generateVanillaCode(valuesRef.current) : generateVFXParticlesJSX(valuesRef.current);
|
|
35415
|
+
const code = mode === "vanilla" ? generateVanillaCode(valuesRef.current) : mode === "tres" ? generateVueTemplate(valuesRef.current) : mode === "threlte" ? generateSvelteTemplate(valuesRef.current) : generateVFXParticlesJSX(valuesRef.current);
|
|
35347
35416
|
try {
|
|
35348
35417
|
await navigator.clipboard.writeText(code);
|
|
35349
35418
|
setCopySuccess(true);
|
|
@@ -35744,7 +35813,7 @@ var DebugPanelContent = ({ initialValues, onUpdate, mode = "r3f" }) => {
|
|
|
35744
35813
|
if (!copySuccess) {
|
|
35745
35814
|
Object.assign(e.currentTarget.style, {
|
|
35746
35815
|
background: `linear-gradient(135deg, rgba(249, 115, 22, 0.25) 0%, rgba(251, 146, 60, 0.15) 100%)`,
|
|
35747
|
-
|
|
35816
|
+
border: `1px solid ${wrapped.accent}`,
|
|
35748
35817
|
boxShadow: `0 0 20px rgba(249, 115, 22, 0.4), 0 0 40px rgba(249, 115, 22, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1)`,
|
|
35749
35818
|
color: wrapped.accentLight,
|
|
35750
35819
|
textShadow: `0 0 12px rgba(249, 115, 22, 0.8)`
|
|
@@ -35755,7 +35824,7 @@ var DebugPanelContent = ({ initialValues, onUpdate, mode = "r3f" }) => {
|
|
|
35755
35824
|
if (!copySuccess) {
|
|
35756
35825
|
Object.assign(e.currentTarget.style, {
|
|
35757
35826
|
background: `linear-gradient(135deg, rgba(249, 115, 22, 0.15) 0%, rgba(251, 146, 60, 0.1) 100%)`,
|
|
35758
|
-
|
|
35827
|
+
border: `1px solid ${wrapped.borderLit}`,
|
|
35759
35828
|
boxShadow: `0 0 12px rgba(249, 115, 22, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.05)`,
|
|
35760
35829
|
color: wrapped.accent,
|
|
35761
35830
|
textShadow: `0 0 8px rgba(249, 115, 22, 0.5)`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "debug-vfx",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"typecheck": "tsc"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"core-vfx": "0.
|
|
25
|
+
"core-vfx": "0.2.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/react": "19.2.10",
|