feat(ui): remove storybook
This commit is contained in:
@@ -1,21 +0,0 @@
|
|||||||
import type { StorybookConfig } from '@storybook/sveltekit';
|
|
||||||
|
|
||||||
const config: StorybookConfig = {
|
|
||||||
"stories": [
|
|
||||||
"../src/**/*.stories.@(js|ts|svelte)"
|
|
||||||
],
|
|
||||||
|
|
||||||
"addons": [
|
|
||||||
"@storybook/addon-svelte-csf",
|
|
||||||
"@storybook/addon-essentials",
|
|
||||||
"@storybook/addon-themes",
|
|
||||||
],
|
|
||||||
|
|
||||||
"framework": {
|
|
||||||
"name": "@storybook/sveltekit",
|
|
||||||
"options": {}
|
|
||||||
},
|
|
||||||
|
|
||||||
docs: {}
|
|
||||||
};
|
|
||||||
export default config;
|
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<style>
|
|
||||||
.sidebar-header {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
#downshift-0-label {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
#downshift-0-label ~ div {
|
|
||||||
margin-top: 0 !important;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
import { withThemeByClassName } from "@storybook/addon-themes";
|
|
||||||
import type { Preview } from '@storybook/svelte';
|
|
||||||
|
|
||||||
import "../src/lib/app.css";
|
|
||||||
|
|
||||||
const preview: Preview = {
|
|
||||||
parameters: {
|
|
||||||
controls: {
|
|
||||||
matchers: {
|
|
||||||
color: /(background|color)$/i,
|
|
||||||
date: /Date$/i,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
decorators: [withThemeByClassName({
|
|
||||||
themes: {
|
|
||||||
dark: 'theme-dark',
|
|
||||||
light: 'theme-light',
|
|
||||||
catppuccin: 'theme-catppuccin',
|
|
||||||
solarized: 'theme-solarized',
|
|
||||||
high: 'theme-high-contrast',
|
|
||||||
nord: 'theme-nord',
|
|
||||||
dracula: 'theme-dracula',
|
|
||||||
},
|
|
||||||
defaultTheme: 'light',
|
|
||||||
})],
|
|
||||||
};
|
|
||||||
|
|
||||||
export default preview;
|
|
||||||
45
packages/ui/src/lib/Checkbox.svelte
Normal file
45
packages/ui/src/lib/Checkbox.svelte
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
interface Props {
|
||||||
|
value: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
let { value = $bindable(false) }: Props = $props();
|
||||||
|
|
||||||
|
$effect(() => {
|
||||||
|
if (typeof value === 'string') {
|
||||||
|
value = value === 'true';
|
||||||
|
} else if (typeof value === 'number') {
|
||||||
|
value = value === 1;
|
||||||
|
} else if (!(typeof value === 'boolean')) {
|
||||||
|
value = !!value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<label
|
||||||
|
class="relative inline-flex h-[22px] w-[22px] cursor-pointer items-center justify-center bg-[var(--layer-2)] rounded-[5px]"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={value}
|
||||||
|
class="peer absolute h-px w-px overflow-hidden whitespace-nowrap border-0 p-0 [clip:rect(0,0,0,0)]"
|
||||||
|
/>
|
||||||
|
<span
|
||||||
|
class="absolute opacity-0 peer-checked:opacity-100 transition-opacity duration-100 flex w-full h-full items-center justify-center"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
viewBox="0 0 19 14"
|
||||||
|
fill="none"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
class="h-[10px] w-[12px] text-[var(--text-color)]"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="M2 7L7 12L17 2"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="3"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
@@ -6,7 +6,12 @@
|
|||||||
open?: boolean;
|
open?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { title = "Details", transparent = false, children, open = $bindable(false) }: Props = $props();
|
let {
|
||||||
|
title = 'Details',
|
||||||
|
transparent = false,
|
||||||
|
children,
|
||||||
|
open = $bindable(false)
|
||||||
|
}: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<details class:transparent bind:open>
|
<details class:transparent bind:open>
|
||||||
@@ -33,5 +38,4 @@
|
|||||||
padding: 0;
|
padding: 0;
|
||||||
outline: none;
|
outline: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -4,15 +4,13 @@
|
|||||||
step?: number;
|
step?: number;
|
||||||
min?: number;
|
min?: number;
|
||||||
max?: number;
|
max?: number;
|
||||||
id?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
value = $bindable(0.5),
|
value = $bindable(0.5),
|
||||||
step = 0.01,
|
step = 0.01,
|
||||||
min = $bindable(0),
|
min = $bindable(0),
|
||||||
max = $bindable(1),
|
max = $bindable(1)
|
||||||
id = ''
|
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
if (min > max) {
|
if (min > max) {
|
||||||
@@ -55,6 +53,7 @@
|
|||||||
window.addEventListener('mousemove', handleMouseMove);
|
window.addEventListener('mousemove', handleMouseMove);
|
||||||
window.addEventListener('mouseup', handleMouseUp);
|
window.addEventListener('mouseup', handleMouseUp);
|
||||||
document.body.style.cursor = 'ew-resize';
|
document.body.style.cursor = 'ew-resize';
|
||||||
|
(ev.target as HTMLElement)?.blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMouseUp() {
|
function handleMouseUp() {
|
||||||
@@ -93,6 +92,7 @@
|
|||||||
} else {
|
} else {
|
||||||
value = Math.max(Math.min(min + (max - min) * vx, max), min);
|
value = Math.max(Math.min(min + (max - min) * vx, max), min);
|
||||||
}
|
}
|
||||||
|
(ev.target as HTMLElement)?.blur();
|
||||||
}
|
}
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
if ((value || 0).toString().length > 5) {
|
if ((value || 0).toString().length > 5) {
|
||||||
@@ -110,7 +110,6 @@
|
|||||||
<input
|
<input
|
||||||
bind:value
|
bind:value
|
||||||
bind:this={inputEl}
|
bind:this={inputEl}
|
||||||
{id}
|
|
||||||
{step}
|
{step}
|
||||||
{max}
|
{max}
|
||||||
{min}
|
{min}
|
||||||
@@ -1,29 +1,28 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import Checkbox from './elements/Checkbox.svelte';
|
import Checkbox from './Checkbox.svelte';
|
||||||
import Float from './elements/Float.svelte';
|
import Float from './Float.svelte';
|
||||||
import Integer from './elements/Integer.svelte';
|
import Integer from './Integer.svelte';
|
||||||
import Select from './elements/Select.svelte';
|
import Select from './Select.svelte';
|
||||||
|
import Vec3 from './Vec3.svelte';
|
||||||
|
|
||||||
import type { NodeInput } from '@nodarium/types';
|
import type { NodeInput } from '@nodarium/types';
|
||||||
import Vec3 from './elements/Vec3.svelte';
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
input: NodeInput;
|
input: NodeInput;
|
||||||
value: any;
|
value: any;
|
||||||
id: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let { input, value = $bindable(), id }: Props = $props();
|
let { input, value = $bindable() }: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if input.type === 'float'}
|
{#if input.type === 'float'}
|
||||||
<Float {id} bind:value min={input?.min} max={input?.max} />
|
<Float bind:value min={input?.min} max={input?.max} />
|
||||||
{:else if input.type === 'integer'}
|
{:else if input.type === 'integer'}
|
||||||
<Integer {id} bind:value min={input?.min} max={input?.max} />
|
<Integer bind:value min={input?.min} max={input?.max} />
|
||||||
{:else if input.type === 'boolean'}
|
{:else if input.type === 'boolean'}
|
||||||
<Checkbox {id} bind:value />
|
<Checkbox bind:value />
|
||||||
{:else if input.type === 'select'}
|
{:else if input.type === 'select'}
|
||||||
<Select {id} bind:value options={input.options} />
|
<Select bind:value options={input.options} />
|
||||||
{:else if input.type === 'vec3'}
|
{:else if input.type === 'vec3'}
|
||||||
<Vec3 {id} bind:value />
|
<Vec3 bind:value />
|
||||||
{/if}
|
{/if}
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { createEventDispatcher } from 'svelte';
|
|
||||||
const dispatch = createEventDispatcher();
|
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
min?: number | undefined;
|
min?: number | undefined;
|
||||||
max?: number | undefined;
|
max?: number | undefined;
|
||||||
step?: number;
|
step?: number;
|
||||||
value?: number;
|
value?: number;
|
||||||
id?: string;
|
onchange?: (value: number) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -15,21 +12,21 @@
|
|||||||
max = undefined,
|
max = undefined,
|
||||||
step = 1,
|
step = 1,
|
||||||
value = $bindable(0),
|
value = $bindable(0),
|
||||||
id = ''
|
onchange
|
||||||
}: Props = $props();
|
}: Props = $props();
|
||||||
|
|
||||||
if (!value) {
|
if (!value) {
|
||||||
value = 0;
|
value = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
let inputEl: HTMLInputElement | undefined = $state();
|
let inputEl = $state<HTMLInputElement>();
|
||||||
let wrapper: HTMLDivElement | undefined = $state();
|
let wrapper = $state<HTMLDivElement>();
|
||||||
|
|
||||||
let prev = -1;
|
let prev = -1;
|
||||||
function update() {
|
function update() {
|
||||||
if (prev === value) return;
|
if (prev === value) return;
|
||||||
prev = value;
|
prev = value;
|
||||||
dispatch('change', parseFloat(value + ''));
|
onchange?.(parseFloat(value + ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleChange(change: number) {
|
function handleChange(change: number) {
|
||||||
@@ -45,7 +42,7 @@
|
|||||||
|
|
||||||
downV = value;
|
downV = value;
|
||||||
downX = ev.clientX;
|
downX = ev.clientX;
|
||||||
rect = wrapper.getBoundingClientRect();
|
rect = wrapper?.getBoundingClientRect()!;
|
||||||
|
|
||||||
window.removeEventListener('mousemove', handleMouseMove);
|
window.removeEventListener('mousemove', handleMouseMove);
|
||||||
window.addEventListener('mousemove', handleMouseMove);
|
window.addEventListener('mousemove', handleMouseMove);
|
||||||
@@ -55,9 +52,9 @@
|
|||||||
|
|
||||||
function handleMouseUp() {
|
function handleMouseUp() {
|
||||||
if (downV === value) {
|
if (downV === value) {
|
||||||
inputEl.focus();
|
inputEl?.focus();
|
||||||
} else {
|
} else {
|
||||||
inputEl.blur();
|
inputEl?.blur();
|
||||||
}
|
}
|
||||||
|
|
||||||
document.body.style.cursor = 'unset';
|
document.body.style.cursor = 'unset';
|
||||||
@@ -100,7 +97,6 @@
|
|||||||
<input
|
<input
|
||||||
bind:value
|
bind:value
|
||||||
bind:this={inputEl}
|
bind:this={inputEl}
|
||||||
{id}
|
|
||||||
{step}
|
{step}
|
||||||
{max}
|
{max}
|
||||||
{min}
|
{min}
|
||||||
@@ -2,13 +2,12 @@
|
|||||||
interface Props {
|
interface Props {
|
||||||
options?: string[];
|
options?: string[];
|
||||||
value?: number;
|
value?: number;
|
||||||
id?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let { options = [], value = $bindable(0), id = '' }: Props = $props();
|
let { options = [], value = $bindable(0) }: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<select {id} bind:value>
|
<select bind:value>
|
||||||
{#each options as label, i}
|
{#each options as label, i}
|
||||||
<option value={i}>{label}</option>
|
<option value={i}>{label}</option>
|
||||||
{/each}
|
{/each}
|
||||||
@@ -3,16 +3,15 @@
|
|||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
value?: any;
|
value?: any;
|
||||||
id?: string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
let { value = $bindable([0, 0, 0]), id = '' }: Props = $props();
|
let { value = $bindable([0, 0, 0]) }: Props = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<Float id={`${id}-x`} bind:value={value[0]} />
|
<Float bind:value={value[0]} />
|
||||||
<Float id={`${id}-y`} bind:value={value[1]} />
|
<Float bind:value={value[1]} />
|
||||||
<Float id={`${id}-z`} bind:value={value[2]} />
|
<Float bind:value={value[2]} />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
@@ -1,3 +1,5 @@
|
|||||||
|
@import "tailwindcss";
|
||||||
|
|
||||||
/* fira-code-300 - latin */
|
/* fira-code-300 - latin */
|
||||||
@font-face {
|
@font-face {
|
||||||
font-display: swap;
|
font-display: swap;
|
||||||
@@ -63,9 +65,6 @@ html {
|
|||||||
}
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
|
|
||||||
color: var(--text-color);
|
color: var(--text-color);
|
||||||
background-color: var(--layer-0);
|
background-color: var(--layer-0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,100 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
interface Props {
|
|
||||||
value: boolean;
|
|
||||||
id?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
let { value = $bindable(false), id = '' }: Props = $props();
|
|
||||||
$effect(() => {
|
|
||||||
if (typeof value === 'string') {
|
|
||||||
value = value === 'true';
|
|
||||||
} else if (typeof value === 'number') {
|
|
||||||
value = value === 1;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<input {id} type="checkbox" bind:checked={value} />
|
|
||||||
<label for={id}>
|
|
||||||
<svg viewBox="0 0 19 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<path
|
|
||||||
d="M2 7L7 12L17 2"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="3"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
/>
|
|
||||||
</svg>
|
|
||||||
</label>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
input[type='checkbox'] {
|
|
||||||
position: absolute;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0 0 0 0);
|
|
||||||
height: 1px;
|
|
||||||
width: 1px;
|
|
||||||
margin: -1px;
|
|
||||||
padding: 0;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
#inputPreview {
|
|
||||||
display: flex;
|
|
||||||
gap: 20px;
|
|
||||||
justify-content: center;
|
|
||||||
}
|
|
||||||
input + label {
|
|
||||||
position: relative;
|
|
||||||
font-size: 14px;
|
|
||||||
cursor: pointer;
|
|
||||||
display: inline-flex;
|
|
||||||
align-items: center;
|
|
||||||
height: 22px;
|
|
||||||
color: rgb(0, 0, 0);
|
|
||||||
}
|
|
||||||
input + label::before {
|
|
||||||
content: ' ';
|
|
||||||
display: inline;
|
|
||||||
vertical-align: middle;
|
|
||||||
margin-right: 3px;
|
|
||||||
width: 22px;
|
|
||||||
height: 22px;
|
|
||||||
background-color: var(--layer-2);
|
|
||||||
border-radius: 5px;
|
|
||||||
border: none;
|
|
||||||
box-shadow: none;
|
|
||||||
}
|
|
||||||
input:checked + label::after {
|
|
||||||
content: ' ';
|
|
||||||
background-repeat: no-repeat;
|
|
||||||
background-size: 12px 12px;
|
|
||||||
background-position: center center;
|
|
||||||
position: absolute;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
margin-left: 0px;
|
|
||||||
left: 0px;
|
|
||||||
top: 0px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: transparent;
|
|
||||||
color: red;
|
|
||||||
font-size: 10px;
|
|
||||||
height: 22px;
|
|
||||||
width: 22px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input + label > svg {
|
|
||||||
position: absolute;
|
|
||||||
display: none;
|
|
||||||
width: 12px;
|
|
||||||
height: 10px;
|
|
||||||
left: 5px;
|
|
||||||
color: var(--text-color);
|
|
||||||
top: 5.9px;
|
|
||||||
}
|
|
||||||
|
|
||||||
input:checked + label > svg {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<script module>
|
|
||||||
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
||||||
import FloatComp from './Float.svelte';
|
|
||||||
|
|
||||||
const { Story } = defineMeta({
|
|
||||||
title: 'Inputs/Float',
|
|
||||||
component: FloatComp
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Story name="Float" />
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
<script module>
|
|
||||||
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
||||||
import IntegerComp from './Integer.svelte';
|
|
||||||
|
|
||||||
const { Story } = defineMeta({
|
|
||||||
title: 'Inputs/Integer',
|
|
||||||
component: IntegerComp
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Story name="Integer" />
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<script module>
|
|
||||||
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
||||||
import SelectComp from '$lib/elements/Select.svelte';
|
|
||||||
const { Story } = defineMeta({
|
|
||||||
title: 'Inputs/Select',
|
|
||||||
component: SelectComp,
|
|
||||||
|
|
||||||
argTypes: {
|
|
||||||
options: {
|
|
||||||
control: {
|
|
||||||
type: 'select'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
parameters: {
|
|
||||||
actions: {
|
|
||||||
handles: ['change']
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Story name="Select" args={{ options: ['strawberry', 'raspberry', 'chickpeas'] }} />
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<script module>
|
|
||||||
import { defineMeta } from '@storybook/addon-svelte-csf';
|
|
||||||
import Vec3Comp from './Vec3.svelte';
|
|
||||||
const { Story } = defineMeta({
|
|
||||||
title: 'Inputs/Vec3',
|
|
||||||
component: Vec3Comp
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Story name="Vec3" />
|
|
||||||
@@ -1,16 +1,8 @@
|
|||||||
// Reexport your entry components here
|
export { default as Input } from './Input.svelte';
|
||||||
import Input from './Input.svelte';
|
export { default as Float } from "./Float.svelte";
|
||||||
|
export { default as Integer } from "./Integer.svelte";
|
||||||
import Float from "./elements/Float.svelte";
|
export { default as Vec3 } from "./Vec3.svelte";
|
||||||
import Integer from "./elements/Integer.svelte";
|
export { default as Select } from "./Select.svelte";
|
||||||
import Select from "./elements/Select.svelte";
|
export { default as Checkbox } from "./Checkbox.svelte";
|
||||||
import Checkbox from "./elements/Checkbox.svelte";
|
export { default as Details } from "./Details.svelte";
|
||||||
import Details from "./Details.svelte";
|
|
||||||
|
|
||||||
export const icons = import.meta.glob('./icons/*.svg?raw', { eager: true })
|
|
||||||
|
|
||||||
export { Float, Integer, Select, Checkbox, Input, Details };
|
|
||||||
|
|
||||||
export default Input;
|
|
||||||
|
|
||||||
export { default as ShortCut } from "./ShortCut.svelte";
|
export { default as ShortCut } from "./ShortCut.svelte";
|
||||||
|
|||||||
@@ -1,29 +1,51 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import '$lib/app.css';
|
import '$lib/app.css';
|
||||||
import Float from '$lib/elements/Float.svelte';
|
import { Checkbox, Details, Float, Integer, Select, ShortCut, Vec3 } from '$lib/index.js';
|
||||||
import Integer from '$lib/elements/Integer.svelte';
|
import Section from './Section.svelte';
|
||||||
import Vec3 from '$lib/elements/Vec3.svelte';
|
|
||||||
|
|
||||||
let intValue = $state(0);
|
let intValue = $state(0);
|
||||||
let floatValue = $state(0.2);
|
let floatValue = $state(0.2);
|
||||||
let vecValue = $state([0.2, 0.3, 0.4]);
|
let vecValue = $state([0.2, 0.3, 0.4]);
|
||||||
|
const options = ['strawberry', 'raspberry', 'chickpeas'];
|
||||||
|
let selectValue = $state(0);
|
||||||
|
const d = $derived(options[selectValue]);
|
||||||
|
|
||||||
|
let checked = $state(false);
|
||||||
|
let detailsOpen = $state(false);
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<main>
|
<main class="flex flex-col gap-8 py-8">
|
||||||
<section>
|
<h1 class="text-4xl">@nodarium/ui</h1>
|
||||||
<h3>Integer {intValue}</h3>
|
|
||||||
|
<Section title="Integer" value={intValue}>
|
||||||
<Integer bind:value={intValue} />
|
<Integer bind:value={intValue} />
|
||||||
</section>
|
</Section>
|
||||||
|
|
||||||
<section>
|
<Section title="Float" value={floatValue}>
|
||||||
<h3>Float {floatValue}</h3>
|
|
||||||
<Float bind:value={floatValue} />
|
<Float bind:value={floatValue} />
|
||||||
</section>
|
</Section>
|
||||||
|
|
||||||
<section>
|
<Section title="Vec3" value={JSON.stringify(vecValue)}>
|
||||||
<h3>Vec3 {JSON.stringify(vecValue)}</h3>
|
|
||||||
<Vec3 bind:value={vecValue} />
|
<Vec3 bind:value={vecValue} />
|
||||||
</section>
|
</Section>
|
||||||
|
|
||||||
|
<Section title="Select" value={d}>
|
||||||
|
<Select bind:value={selectValue} {options} />
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
<Section title="Checkbox" value={checked}>
|
||||||
|
<Checkbox bind:value={checked} />
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
<Section title="Details" value={detailsOpen}>
|
||||||
|
<Details title="More Information" bind:open={detailsOpen}>
|
||||||
|
<p>Here is some more information that was previously hidden.</p>
|
||||||
|
</Details>
|
||||||
|
</Section>
|
||||||
|
|
||||||
|
<Section title="Shortcut">
|
||||||
|
<ShortCut ctrl key="S" />
|
||||||
|
</Section>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
|||||||
18
packages/ui/src/routes/Section.svelte
Normal file
18
packages/ui/src/routes/Section.svelte
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { type Snippet } from 'svelte';
|
||||||
|
let { title, value, children } = $props<{
|
||||||
|
title?: string;
|
||||||
|
value?: unknown;
|
||||||
|
children?: Snippet;
|
||||||
|
}>();
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<section class="border border-1/2 mb-4 p-4 flex flex-col gap-4">
|
||||||
|
<h3 class="flex gap-2 font-bold">
|
||||||
|
{title}
|
||||||
|
<p class="font-normal! opacity-50!">{value}</p>
|
||||||
|
</h3>
|
||||||
|
<div>
|
||||||
|
{@render children()}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
@@ -1,8 +1,9 @@
|
|||||||
import { sveltekit } from '@sveltejs/kit/vite';
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
import { defineConfig } from 'vitest/config';
|
import { defineConfig } from 'vitest/config';
|
||||||
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [sveltekit()],
|
plugins: [tailwindcss(), sveltekit()],
|
||||||
test: {
|
test: {
|
||||||
include: ['src/**/*.{test,spec}.{js,ts}']
|
include: ['src/**/*.{test,spec}.{js,ts}']
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user