2024-02-11 12:59:00 +11:00
|
|
|
import { OnboardingButtons, useDismiss, useNextClick } from '.'
|
|
|
|
import { onboardingPaths } from 'routes/Onboarding/paths'
|
2023-09-15 22:37:40 -04:00
|
|
|
import { useStore } from '../../useStore'
|
|
|
|
import { useBackdropHighlight } from 'hooks/useBackdropHighlight'
|
|
|
|
|
|
|
|
export default function CodeEditor() {
|
|
|
|
const { buttonDownInStream } = useStore((s) => ({
|
|
|
|
buttonDownInStream: s.buttonDownInStream,
|
|
|
|
}))
|
|
|
|
const dismiss = useDismiss()
|
|
|
|
const next = useNextClick(onboardingPaths.PARAMETRIC_MODELING)
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="fixed grid justify-end items-center inset-0 z-50 pointer-events-none">
|
|
|
|
<div
|
2024-03-08 17:59:14 -05:00
|
|
|
className="fixed inset-0 bg-black opacity-50 dark:opacity-80 pointer-events-none"
|
2024-04-25 21:09:08 -07:00
|
|
|
style={
|
|
|
|
{
|
|
|
|
/*clipPath: useBackdropHighlight('code-pane')*/
|
|
|
|
}
|
|
|
|
}
|
2023-09-15 22:37:40 -04:00
|
|
|
></div>
|
|
|
|
<div
|
|
|
|
className={
|
2023-12-18 06:15:26 -05:00
|
|
|
'z-10 max-w-xl border border-chalkboard-50 dark:border-chalkboard-80 shadow-lg h-3/4 flex flex-col justify-center bg-chalkboard-10 dark:bg-chalkboard-90 p-8 rounded' +
|
2023-09-15 22:37:40 -04:00
|
|
|
(buttonDownInStream ? '' : ' pointer-events-auto')
|
|
|
|
}
|
|
|
|
>
|
|
|
|
<section className="flex-1">
|
2024-03-08 17:59:14 -05:00
|
|
|
<h2 className="text-3xl font-bold">
|
2024-04-05 00:59:02 -04:00
|
|
|
Editing code with <span className="text-primary">kcl</span>
|
2023-09-15 22:37:40 -04:00
|
|
|
</h2>
|
2024-03-08 17:59:14 -05:00
|
|
|
<p className="my-4">
|
|
|
|
kcl is our language for describing geometry. Building our own
|
|
|
|
language is difficult, but we chose to do it to have a language
|
|
|
|
honed for spatial relationships and geometric computation. It'll
|
|
|
|
always be open-source, and we hope it can grow into a new standard
|
|
|
|
for describing parametric objects.
|
|
|
|
</p>
|
2023-09-15 22:37:40 -04:00
|
|
|
<p className="my-4">
|
|
|
|
The left pane is where you write your code. It's a code editor with
|
2024-03-08 17:59:14 -05:00
|
|
|
syntax highlighting and autocompletion for kcl. New features arrive
|
|
|
|
in kcl before they're available as point-and-click tools, so it's
|
|
|
|
good to have a link to{' '}
|
|
|
|
<a
|
2024-03-13 15:43:42 -07:00
|
|
|
href="https://zoo.dev/docs/kcl"
|
2024-03-08 17:59:14 -05:00
|
|
|
rel="noreferrer noopener"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
our kcl docs
|
|
|
|
</a>{' '}
|
|
|
|
handy while you design for now. It's also available in the menu in
|
|
|
|
the corner of the code pane.
|
2023-09-15 22:37:40 -04:00
|
|
|
</p>
|
|
|
|
<p className="my-4">
|
2024-03-08 17:59:14 -05:00
|
|
|
We've built a{' '}
|
|
|
|
<a
|
|
|
|
href="https://github.com/KittyCAD/kcl-lsp"
|
|
|
|
rel="noreferrer noopener"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
language server
|
|
|
|
</a>{' '}
|
|
|
|
for kcl that provides documentation and autocompletion automatically
|
|
|
|
generated from our compiler code. You can try it out by hovering
|
|
|
|
over some of the function names in the pane now. If you like using
|
|
|
|
VSCode, you can try out our{' '}
|
2023-09-15 22:37:40 -04:00
|
|
|
<a
|
|
|
|
href="https://marketplace.visualstudio.com/items?itemName=KittyCAD.kcl-language-server"
|
|
|
|
rel="noreferrer noopener"
|
|
|
|
target="_blank"
|
|
|
|
>
|
|
|
|
VSCode extension
|
|
|
|
</a>
|
|
|
|
.
|
|
|
|
</p>
|
|
|
|
<p className="my-4">
|
|
|
|
You can resize the pane by dragging the handle on the right, and you
|
|
|
|
can collapse it by clicking the title bar or pressing{' '}
|
|
|
|
<kbd>Shift</kbd> + <kbd>C</kbd>.
|
|
|
|
</p>
|
|
|
|
</section>
|
2023-12-06 14:44:13 -05:00
|
|
|
<OnboardingButtons
|
2024-03-08 17:59:14 -05:00
|
|
|
currentSlug={onboardingPaths.EDITOR}
|
2023-12-06 14:44:13 -05:00
|
|
|
dismiss={dismiss}
|
|
|
|
next={next}
|
|
|
|
nextText="Next: Parametric Modeling"
|
|
|
|
/>
|
2023-09-15 22:37:40 -04:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|