Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.
Rust agentai-agentapplecomputer-usecomputer-use-agentcontainerizationcuadesktop-automationhacktoberfestlumemacosmanusoperatorswiftvirtualizationvirtualization-frameworkwindowswindows-sandbox
<main
class="flex flex-col h-full w-full p-6 overflow-auto"
role="main"
aria-label="Drag and drop interface"
>
<div class="max-w-2xl mx-auto w-full">
<h1 class="text-xl font-semibold text-gray-900 mb-6">Drag and Drop</h1>
<!-- Draggable Items -->
<div class="mb-6">
<p class="text-sm font-medium text-gray-700 mb-3">Items:</p>
<div class="flex flex-wrap gap-3">
<div
id="item-apple"
class="draggable px-4 py-2 bg-red-100 border-2 border-red-300 rounded-lg cursor-move flex items-center gap-2 hover:bg-red-200 transition-colors"
draggable="true"
data-item="apple"
role="button"
aria-label="Apple item"
>
<iconify-icon
icon="mdi:food-apple"
class="text-red-600"
style="font-size: 1.25rem"
></iconify-icon>
<span class="font-medium text-red-900">Apple</span>
</div>
<div
id="item-carrot"
class="draggable px-4 py-2 bg-orange-100 border-2 border-orange-300 rounded-lg cursor-move flex items-center gap-2 hover:bg-orange-200 transition-colors"
draggable="true"
data-item="carrot"
role="button"
aria-label="Carrot item"
>
<iconify-icon
icon="mdi:carrot"
class="text-orange-600"
style="font-size: 1.25rem"
></iconify-icon>
<span class="font-medium text-orange-900">Carrot</span>
</div>
<div
id="item-banana"
class="draggable px-4 py-2 bg-yellow-100 border-2 border-yellow-300 rounded-lg cursor-move flex items-center gap-2 hover:bg-yellow-200 transition-colors"
draggable="true"
data-item="banana"
role="button"
aria-label="Banana item"
>
<iconify-icon
icon="mdi:food-variant"
class="text-yellow-600"
style="font-size: 1.25rem"
></iconify-icon>
<span class="font-medium text-yellow-900">Banana</span>
</div>
<div
id="item-broccoli"
class="draggable px-4 py-2 bg-green-100 border-2 border-green-300 rounded-lg cursor-move flex items-center gap-2 hover:bg-green-200 transition-colors"
draggable="true"
data-item="broccoli"
role="button"
aria-label="Broccoli item"
>
<iconify-icon
icon="mdi:food-variant"
class="text-green-600"
style="font-size: 1.25rem"
></iconify-icon>
<span class="font-medium text-green-900">Broccoli</span>
</div>
<div
id="item-orange"
class="draggable px-4 py-2 bg-orange-100 border-2 border-orange-400 rounded-lg cursor-move flex items-center gap-2 hover:bg-orange-200 transition-colors"
draggable="true"
data-item="orange"
role="button"
aria-label="Orange item"
>
<iconify-icon
icon="mdi:fruit-citrus"
class="text-orange-600"
style="font-size: 1.25rem"
></iconify-icon>
<span class="font-medium text-orange-900">Orange</span>
</div>
</div>
</div>
<!-- Drop Targets -->
<div class="grid grid-cols-2 gap-4">
<!-- Fruits Box -->
<div
id="drop-fruit"
class="drop-zone min-h-[200px] p-4 border-2 border-dashed border-blue-300 rounded-lg bg-blue-50"
data-target="fruit"
role="region"
aria-label="Fruits drop zone"
>
<div class="flex items-center gap-2 mb-3">
<iconify-icon
icon="mdi:fruit-grapes"
class="text-blue-600"
style="font-size: 1.5rem"
></iconify-icon>
<h2 class="text-lg font-semibold text-blue-900">Fruits</h2>
</div>
<div id="fruit-items" class="space-y-2"></div>
</div>
<!-- Vegetables Box -->
<div
id="drop-vegetable"
class="drop-zone min-h-[200px] p-4 border-2 border-dashed border-green-300 rounded-lg bg-green-50"
data-target="vegetable"
role="region"
aria-label="Vegetables drop zone"
>
<div class="flex items-center gap-2 mb-3">
<iconify-icon
icon="mdi:corn"
class="text-green-600"
style="font-size: 1.5rem"
></iconify-icon>
<h2 class="text-lg font-semibold text-green-900">Vegetables</h2>
</div>
<div id="vegetable-items" class="space-y-2"></div>
</div>
</div>
<div class="mt-4 p-3 bg-blue-50 border border-blue-200 rounded">
<p class="text-sm text-blue-800">
<iconify-icon icon="mdi:information" class="text-blue-600"></iconify-icon>
Drag items to the correct category
</p>
</div>
</div>
<script>
// Store drop results globally for evaluation
window.__dropResults = {};
let draggedElement = null;
// Drag start
document.querySelectorAll('.draggable').forEach((item) => {
item.addEventListener('dragstart', function (e) {
draggedElement = this;
this.style.opacity = '0.5';
});
item.addEventListener('dragend', function (e) {
this.style.opacity = '1';
});
});
// Drop zones
document.querySelectorAll('.drop-zone').forEach((zone) => {
zone.addEventListener('dragover', function (e) {
e.preventDefault();
this.classList.add('ring-2', 'ring-blue-500');
});
zone.addEventListener('dragleave', function (e) {
this.classList.remove('ring-2', 'ring-blue-500');
});
zone.addEventListener('drop', function (e) {
e.preventDefault();
this.classList.remove('ring-2', 'ring-blue-500');
if (draggedElement) {
const itemName = draggedElement.getAttribute('data-item');
const targetName = this.getAttribute('data-target');
// Record the drop result
window.__dropResults[itemName] = targetName;
// Move the item to the target container
const targetContainer = document.getElementById(targetName + '-items');
const clonedItem = draggedElement.cloneNode(true);
clonedItem.classList.remove(
'cursor-move',
'hover:bg-red-200',
'hover:bg-orange-200',
'hover:bg-yellow-200',
'hover:bg-green-200'
);
clonedItem.classList.add('cursor-default', 'opacity-90');
clonedItem.setAttribute('draggable', 'false');
targetContainer.appendChild(clonedItem);
// Hide the original item
draggedElement.style.display = 'none';
}
});
});
</script>
</main>