Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/puck/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
extends: ['@dnd-kit/eslint-config'],
};
12 changes: 12 additions & 0 deletions apps/puck/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Puck demo</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.jsx"></script>
</body>
</html>
28 changes: 28 additions & 0 deletions apps/puck/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"name": "puck",
"private": true,
"version": "0.0.0",
"type": "module",
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint .",
"preview": "vite preview"
},
"dependencies": {
"@measured/puck": "0.19.0-canary.eda38b34",
"react": "^19.0.0",
"react-dom": "^19.0.0"
},
"devDependencies": {
"@eslint/js": "^9.22.0",
"@types/react": "^19.0.10",
"@types/react-dom": "^19.0.4",
"@vitejs/plugin-react": "^4.3.4",
"eslint": "^9.22.0",
"eslint-plugin-react-hooks": "^5.2.0",
"eslint-plugin-react-refresh": "^0.4.19",
"globals": "^16.0.0",
"vite": "^6.3.1"
}
}
51 changes: 51 additions & 0 deletions apps/puck/src/App.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// App.jsx
import {Puck} from '@measured/puck';
import '@measured/puck/puck.css';

const config = {
components: {
Card: {
inline: true,
render: ({puck}) => {
return (
<div
style={{
alignItems: 'center',
background: 'white',
border: '1px solid black',
borderRadius: 8,
display: 'flex',
justifyContent: 'center',
flexGrow: 1,
padding: 24,
height: 128,
}}
ref={puck.dragRef} // Use inline ref so we can use flexGrow
>
Card
</div>
);
},
},
Container: {
fields: {
Content: {
type: 'slot', // NB This is triggering DropZone deprecation warning when it shouldn't. Puck bug.
},
},
render: ({Content}) => {
return (
<div style={{background: '#eee', padding: 32}}>
<Content style={{display: 'flex', flexWrap: 'wrap', gap: 16}} />
</div>
);
},
},
},
};

const App = () => {
return <Puck config={config} data={{}} />;
};

export default App;
4 changes: 4 additions & 0 deletions apps/puck/src/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
body {
font-family: sans-serif;
margin: 0;
}
10 changes: 10 additions & 0 deletions apps/puck/src/main.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import {StrictMode} from 'react';
import {createRoot} from 'react-dom/client';
import './index.css';
import App from './App.jsx';

createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>
);
7 changes: 7 additions & 0 deletions apps/puck/vite.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vite.dev/config/
export default defineConfig({
plugins: [react()],
})
Binary file modified bun.lockb
Binary file not shown.
Loading