Skip to content

feat: new API and DX #129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 65 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
742c8af
feat!: simplified `useControls` API
alvarosabu Jan 17, 2025
69d7323
refactor: clean up imports in boolean.vue and useControls.ts
alvarosabu Jan 17, 2025
714bcae
Merge pull request #126 from Tresjs/bugfix/92-rethink-api-value-value
alvarosabu Jan 17, 2025
377a605
fix: add cleanup for controls in TresLeches component
alvarosabu Jan 17, 2025
9d62aaa
Merge pull request #127 from Tresjs/bugfix/dispose-controls-on-unmount
alvarosabu Jan 17, 2025
3b9ef68
fix!: select options values
alvarosabu Jan 17, 2025
d5cb726
chore: add new demo components for various control types
alvarosabu Jan 17, 2025
567b2d0
chore: add SliderControlDemo and TextControlDemo components with routing
alvarosabu Jan 17, 2025
2720225
feat: resizable and collapsable pane
alvarosabu Jan 19, 2025
f2338d3
chore: fix tests
alvarosabu Jan 19, 2025
7b5b02b
fix: update snapshots for BooleanControl tests
alvarosabu Jan 19, 2025
ef00b59
fix: update snapshots for ColorControl tests
alvarosabu Jan 19, 2025
4e6c4d2
fix: update snapshots for BooleanControl tests
alvarosabu Jan 19, 2025
29c93b2
Merge pull request #128 from Tresjs/feature/collapsible-and-resizable
alvarosabu Jan 19, 2025
eff7e7f
refactor: simplify control management and update types
alvarosabu Jan 19, 2025
b0a8cf6
chore: add new control demos and update routing
alvarosabu Jan 19, 2025
890b868
refactor: update control types to LechesControl
alvarosabu Jan 19, 2025
896cb45
Merge pull request #130 from Tresjs/bugfix/typescript-build-issues
alvarosabu Jan 19, 2025
03c8db4
fix: removed dynamic style tag from html for snapshots
alvarosabu Jan 19, 2025
55ce8f8
Merge pull request #131 from Tresjs/chore/fix-snapshot-testing
alvarosabu Jan 19, 2025
1f27a69
feat: add unocss-preset-scrollbar and update component styles
alvarosabu Jan 19, 2025
8c0bd70
Merge branch 'next' into feature/improve-ui
alvarosabu Jan 19, 2025
bf0f134
Merge pull request #132 from Tresjs/feature/improve-ui
alvarosabu Jan 19, 2025
eb41769
feat: enhance component styles and dark mode support
alvarosabu Jan 20, 2025
b42cfa8
feat: add ButtonControl demo and enhance button functionality
alvarosabu Jan 20, 2025
a426a0c
chore: updated snapshots
alvarosabu Jan 20, 2025
55c08a4
Merge pull request #133 from Tresjs/feature/dark-mode-ui
alvarosabu Jan 20, 2025
7a7558c
fix: solve issue with useControls needed on parent.
alvarosabu Jan 20, 2025
0a25292
fix: replace transform directive apply with plain css
alvarosabu Jan 20, 2025
c7358a9
refactor: enhance component styles with unified input classes and add…
alvarosabu Jan 20, 2025
9ec3c85
feat: add new icon and enhance component functionality
alvarosabu Jan 21, 2025
77e29a5
feat: uniquekey now consider uuid to make multiple instances on same …
alvarosabu Jan 22, 2025
4648c68
docs: demo and docs cleanup
alvarosabu Jan 22, 2025
3092a7f
feat: enhance NumberControl and TresLeches components for improved la…
alvarosabu Jan 24, 2025
bdcca6b
docs: improve docs and add multiple instances
alvarosabu Jan 25, 2025
c297c82
feat: add stacked mode for TresLeches component
alvarosabu Jan 26, 2025
e3035bf
feat: add DemoLayout component and UnoCSS shortcuts for consistent de…
alvarosabu Jan 26, 2025
ad65800
test: remove explicit class assertions in ButtonControl and Folder tests
alvarosabu Jan 26, 2025
589d48d
refactor: clean up code and remove unused imports and styles
alvarosabu Jan 26, 2025
7088564
Merge pull request #134 from Tresjs/feature/multiple-improvements-ui-…
alvarosabu Jan 26, 2025
eb1aa99
refactor: update component snapshot tests with refined input and butt…
alvarosabu Jan 26, 2025
52fbf55
Merge branch 'next' of github.com:Tresjs/leches into next
alvarosabu Jan 26, 2025
f34f3b7
fix: resolve merge conflict in component snapshot tests
alvarosabu Jan 26, 2025
b3a9dbe
chore: fixed tests for buttonControls
alvarosabu Jan 26, 2025
afdafbb
fix!: folders controls key handling
alvarosabu Jan 26, 2025
176c261
Merge pull request #135 from Tresjs/bugfix/folders-next
alvarosabu Jan 26, 2025
f5926fc
feat: folder drawer animations
alvarosabu Jan 26, 2025
fe571d6
Merge pull request #136 from Tresjs/feature/folder-animations
alvarosabu Jan 26, 2025
4d89c02
fix: add box-border class to TresLeches component pane
alvarosabu Jan 26, 2025
bbf8c16
fix: update snapshot tests with box-border class for TresLeches pane
alvarosabu Jan 26, 2025
4201750
fix: increased control aprox height for initial calculation
alvarosabu Jan 26, 2025
9ff00b8
fix: tweak fpsgraph extra height on calculation
alvarosabu Jan 26, 2025
5275e27
fix: improve focus and background styles for controls
alvarosabu Jan 26, 2025
faf8aa1
chore: update stats.html with latest build data
alvarosabu Jan 26, 2025
ca9d418
feat: add gap spacing to control components
alvarosabu Jan 26, 2025
ad3f472
feat: increase default width of TresLeches panel to 320px
alvarosabu Jan 26, 2025
9ad0cd3
refactor: reduce gap spacing in control components from 2 to 1
alvarosabu Jan 26, 2025
2071202
feat: add slot content support to TresLeches panele
alvarosabu Feb 21, 2025
10902bb
chore: force install corepack in GitHub Actions workflow
alvarosabu Feb 21, 2025
07c672a
refactor: remove unused imports from TresLeches component
alvarosabu Feb 21, 2025
5369b54
Merge pull request #141 from Tresjs/feature/slots-for-content
alvarosabu Mar 25, 2025
a22e6d6
feat: add graph pane type and corresponding demo component
alvarosabu Mar 25, 2025
7add8b5
docs: added proper graph demo
alvarosabu Mar 27, 2025
b34e795
Merge pull request #142 from Tresjs/feature/graph-pane
alvarosabu Mar 27, 2025
5536ad5
fix: select control now respects option value type
alvarosabu Apr 23, 2025
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
2 changes: 1 addition & 1 deletion .github/workflows/pkg.pr.new.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- run: corepack enable
- run: npm i -g --force corepack && corepack enable
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
Expand Down
22 changes: 19 additions & 3 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from 'pathe'
import { defineConfig } from 'vitepress'
import { groupIconMdPlugin } from 'vitepress-plugin-group-icons'

// https://vitepress.dev/reference/site-config
export default defineConfig({
Expand All @@ -24,7 +25,8 @@ export default defineConfig({
text: 'Guide',
items: [
{ text: 'Getting Started', link: '/guide/getting-started' },
{ text: 'Controls', link: '/guide/controls' },
{ text: 'useControls', link: '/guide/use-controls' },
{ text: 'Icons', link: '/guide/icons' },
],
},
{
Expand All @@ -39,6 +41,15 @@ export default defineConfig({
{ text: 'Select', link: '/controls/index.html#select' },
{ text: 'Vector', link: '/controls/index.html#vector' },
{ text: 'Button', link: '/controls/index.html#button' },
{ text: 'Graph', link: '/controls/index.html#graph' },
],
},
{
text: 'Advanced',
link: '/advanced',
items: [
{ text: 'Multiple Instances', link: '/advanced/multiple-instances' },
{ text: 'Stacked mode', link: '/advanced/stacked' },
],
},
{
Expand Down Expand Up @@ -66,10 +77,15 @@ export default defineConfig({
},
resolve: {
alias: {
'@tresjs/leches': resolve(__dirname, '../../dist/tresleches.js'),
'@leches/styles': resolve(__dirname, '../../dist/style.css'),
'@tresjs/leches': resolve(__dirname, '../../src'),
'@leches/styles': resolve(__dirname, '../../dist/tresleches.css'),
},
dedupe: ['@tresjs/cientos', 'three'],
},
},
markdown: {
config: (md) => {
md.use(groupIconMdPlugin)
},
},
})
15 changes: 6 additions & 9 deletions docs/.vitepress/theme/components/BooleanDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,20 @@
import { TresLeches, useControls } from '@tresjs/leches'

const uuid = 'boolean'
const { value } = useControls({
const { awiwi } = useControls({
awiwi: true,
}, {
uuid,
})
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative grid grid-cols-2 gap-16 items-center">
<div class="leches-demo-layout">
<div class="p-4">
<pre class="bg-dark p-8 rounded text-white">awiwi: {{ value }}</pre>
</div>
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<pre class="leches-demo-preview">awiwi: {{ awiwi }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
13 changes: 5 additions & 8 deletions docs/.vitepress/theme/components/ButtonDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,12 @@ useControls({
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative grid grid-cols-2 gap-16 items-center">
<div class="leches-demo-layout">
<div class="p-4">
<pre class="bg-dark p-8 rounded text-white">{{ value }}</pre>
</div>
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<pre class="leches-demo-preview">{{ value }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
13 changes: 5 additions & 8 deletions docs/.vitepress/theme/components/ButtonSizesDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,12 @@ useControls({
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative grid grid-cols-2 gap-16 items-center">
<div class="leches-demo-layout">
<div class="p-4">
<pre class="bg-dark p-8 rounded text-white">{{ value }}</pre>
</div>
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<pre class="leches-demo-preview">{{ value }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
13 changes: 5 additions & 8 deletions docs/.vitepress/theme/components/ButtonVariantDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,12 @@ useControls({
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative grid grid-cols-2 gap-16 items-center">
<div class="leches-demo-layout">
<div class="p-4">
<pre class="bg-dark p-8 rounded text-white">{{ value }}</pre>
</div>
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<pre class="leches-demo-preview">{{ value }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
15 changes: 6 additions & 9 deletions docs/.vitepress/theme/components/ColorDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { TresLeches, useControls } from '@tresjs/leches'

const uuid = 'color-demo'
const { value: color } = useControls({
const { color } = useControls({
color: '#008080',
}, {
uuid,
Expand All @@ -11,17 +11,14 @@ const { value: color } = useControls({

<template>
<div
class="w-full h-300px bg-gray-200 mb-8 relative grid grid-cols-2 gap-16 items-center"
class="leches-demo-layout"
:style="{ backgroundColor: color }"
>
<div class="p-4">
<pre class="bg-dark p-8 rounded text-white">{{ color }}</pre>
</div>
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<pre class="leches-demo-preview">{{ color }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
11 changes: 4 additions & 7 deletions docs/.vitepress/theme/components/FPSDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,9 @@ useControls('fpsgraph', {
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative flex justify-center items-center">
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 important-top-8"
:uuid="uuid"
/>
</div>
<div class="w-full h-300px bg-gray-200 dark:bg-dark-800 mb-8 relative flex justify-center items-center">
<TresLeches
:uuid="uuid"
/>
</div>
</template>
38 changes: 38 additions & 0 deletions docs/.vitepress/theme/components/FolderDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<script setup lang="ts">
import { TresLeches, useControls } from '@tresjs/leches'
import { Euler, Vector3 } from 'three'

const uuid = 'folder-demo'
const canvasControls = useControls('Canvas', {
clearColor: '#008080',
shadows: true,
}, {
uuid,
})
const cameraControls = useControls('Camera', {
position: {
value: new Vector3(0, 0, 0),
label: 'Position',
},
rotation: {
value: new Euler(0, 0, 0),
label: 'Rotation',
},
}, {
uuid,
})
</script>

<template>
<div
class="w-full h-500px bg-gray-200 dark:bg-dark-800 mb-8 relative grid grid-cols-2 gap-16 items-center"
>
<div class="p-4 text-xs">
<pre class="leches-demo-preview"> {{ canvasControls }}</pre>
<pre class="leches-demo-preview"> {{ cameraControls }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
14 changes: 7 additions & 7 deletions docs/.vitepress/theme/components/GettingStartedDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { TresLeches, useControls } from '@tresjs/leches'

const uuid = 'getting-started'
useControls({
const controls = useControls({
pepe: true,
slider: {
value: 0.5,
Expand All @@ -17,12 +17,12 @@ useControls({
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative flex justify-center items-center">
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<div class="leches-demo-layout">
<div class="p-4">
<pre class="leches-demo-preview">{{ controls }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
51 changes: 51 additions & 0 deletions docs/.vitepress/theme/components/GraphDemo.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<script setup lang="ts">
import { TresLeches, useControls } from '@tresjs/leches'
import { onMounted, onUnmounted, ref } from 'vue'

const wave = ref(0)
const uuid = 'graph-demo'

useControls({
sine: {
type: 'graph',
label: 'Sine Wave',
value: wave,
},
}, {
uuid,
})

// Parameters for the sine wave
const amplitude = 50 // Height of the wave
const frequency = 2 // Speed of the wave (increased from 0.1)
let time = 0
let intervalId: number | null = null

// Function to update the sine wave value
function updateSineWave() {
// Calculate sine value based on time
wave.value = amplitude * Math.sin(time * frequency)
time += 0.1
}

onMounted(() => {
// Start the sine wave animation
intervalId = setInterval(updateSineWave, 100) as unknown as number
})

onUnmounted(() => {
// Clean up interval when component is destroyed
if (intervalId !== null) {
clearInterval(intervalId)
}
})
</script>

<template>
<div class="w-full h-300px bg-gray-200 dark:bg-dark-800 mb-8 relative flex justify-center items-center">
<TresLeches
:uuid="uuid"
/>
{{ wave }}
</div>
</template>
6 changes: 2 additions & 4 deletions docs/.vitepress/theme/components/HeroDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@ useControls({
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative flex justify-center items-center">
<div class="relative w-280px min-h-200px">
<TresLeches class="important-left-0 important-top-0" />
</div>
<div class="w-full h-300px bg-gray-200 dark:bg-dark-800 mb-8 relative flex justify-center items-center">
<TresLeches />
</div>
</template>
15 changes: 6 additions & 9 deletions docs/.vitepress/theme/components/IconDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TresLeches, useControls } from '@tresjs/leches'
import { Vector3 } from 'three'

const uuid = 'icon'
const { value } = useControls({
const { camera } = useControls({
camera: {
label: 'Camera Position',
value: new Vector3(0, 0, 0),
Expand All @@ -15,15 +15,12 @@ const { value } = useControls({
</script>

<template>
<div class="w-full h-300px bg-gray-200 mb-8 relative grid grid-cols-2 gap-16 items-center">
<div class="leches-demo-layout">
<div class="p-4">
<pre class="bg-dark p-8 rounded text-white">{{ value }}</pre>
</div>
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<pre class="leches-demo-preview">{{ camera }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
13 changes: 5 additions & 8 deletions docs/.vitepress/theme/components/MultipleControlDemo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,12 @@ const controls = useControls({
</script>

<template>
<div class="w-full min-h-300px bg-gray-200 mb-8 relative grid grid-cols-2 gap-16 items-center">
<div class="w-full min-h-300px bg-gray-200 dark:bg-dark-800 mb-8 relative grid grid-cols-2 gap-16 items-center">
<div class="p-4">
<pre class="bg-dark p-8 rounded text-white">{{ controls }}</pre>
</div>
<div class="relative w-280px min-h-200px">
<TresLeches
class="important-left-0 -important-top-8"
:uuid="uuid"
/>
<pre class="leches-demo-preview">{{ controls }}</pre>
</div>
<TresLeches
:uuid="uuid"
/>
</div>
</template>
Loading
Loading