@selvajs/ui 7.0.3-beta.0 → 7.0.3-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/compute/ComputeApp.svelte +2 -8
- package/dist/components/primitives/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
- package/dist/components/primitives/dropdown-menu/dropdown-menu-shortcut.svelte +1 -1
- package/dist/components/viewer/ViewerDock.svelte +4 -4
- package/dist/compute/computeDriver.d.ts +9 -0
- package/dist/compute/computeDriver.js +11 -0
- package/package.json +9 -9
- package/src/lib/components/compute/ComputeApp.svelte +2 -8
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-checkbox-item.svelte +1 -1
- package/src/lib/components/primitives/dropdown-menu/dropdown-menu-shortcut.svelte +1 -1
- package/src/lib/components/viewer/ViewerDock.svelte +4 -4
- package/src/lib/compute/computeDriver.ts +22 -0
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { SolveFn } from '@selvajs/solve/shared';
|
|
7
7
|
import type { PresetLabels } from '../../types/presetLabels';
|
|
8
8
|
import { createSolvingIndicator } from '../../compute/solving.svelte';
|
|
9
|
-
import {
|
|
9
|
+
import { createComputeDriver } from '../../compute/computeDriver';
|
|
10
10
|
import type {
|
|
11
11
|
RetainedSolveResult,
|
|
12
12
|
SolveEventSource,
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
SolveSettlement
|
|
15
15
|
} from '@selvajs/solve/client';
|
|
16
16
|
import SolveMessages from './SolveMessages.svelte';
|
|
17
|
-
import { meshPolicy } from '@selvajs/visualization/parse';
|
|
18
17
|
import type { ThreeViewer } from '@selvajs/visualization/render';
|
|
19
18
|
import { useSolveSession } from '../../compute/useSolveSession.svelte';
|
|
20
19
|
import { useFooterItem } from '../../composables/useFooterItem.svelte';
|
|
@@ -171,13 +170,8 @@
|
|
|
171
170
|
// The session owns the value/lifecycle state machine; the driver is its transport. The
|
|
172
171
|
// session is passed as a getter because the two reference each other.
|
|
173
172
|
// svelte-ignore state_referenced_locally
|
|
174
|
-
const driver =
|
|
173
|
+
const driver = createComputeDriver(onSolve, () => session, {
|
|
175
174
|
solveDeadlineMs,
|
|
176
|
-
// The driver's memo caches whole solve results, meshes included, and the viewer disposes
|
|
177
|
-
// what it renders on the next scene update. `@selvajs/solve` keeps meshes opaque, so the
|
|
178
|
-
// three.js clone/dispose rules come from the renderer that owns them. Without this, a memo
|
|
179
|
-
// hit serves an already-disposed mesh.
|
|
180
|
-
meshPolicy,
|
|
181
175
|
// `isSolving` lives on the driver, which the session can't observe — republish so the
|
|
182
176
|
// spinner and disabled states track it.
|
|
183
177
|
onChange: () => session.notify(),
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
{@render childrenProp?.()}
|
|
39
39
|
{#if asSwitch}
|
|
40
40
|
<span
|
|
41
|
-
class="[[data-slot=dropdown-menu-shortcut]+&]:ml-2 h-4.5 w-8 pointer-events-none relative ml-auto shrink-0 rounded-full transition-colors {checked
|
|
41
|
+
class="not-pointer-coarse:[[data-slot=dropdown-menu-shortcut]+&]:ml-2 h-4.5 w-8 pointer-events-none relative ml-auto shrink-0 rounded-full transition-colors {checked
|
|
42
42
|
? 'bg-primary'
|
|
43
43
|
: 'bg-input'}"
|
|
44
44
|
data-slot="dropdown-menu-checkbox-item-switch"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
bind:this={ref}
|
|
15
15
|
data-slot="dropdown-menu-shortcut"
|
|
16
16
|
class={cn(
|
|
17
|
-
'h-5 min-w-5 px-1 font-mono ml-auto inline-flex items-center justify-center rounded-sm border bg-muted text-2xs text-muted-foreground group-focus/dropdown-menu-item:text-foreground',
|
|
17
|
+
'h-5 min-w-5 px-1 font-mono ml-auto inline-flex items-center justify-center rounded-sm border bg-muted text-2xs text-muted-foreground group-focus/dropdown-menu-item:text-foreground pointer-coarse:hidden',
|
|
18
18
|
className
|
|
19
19
|
)}
|
|
20
20
|
{...restProps}
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
>
|
|
317
317
|
<Spline />
|
|
318
318
|
{t.edges}
|
|
319
|
-
<DropdownMenu.Shortcut
|
|
319
|
+
<DropdownMenu.Shortcut>E</DropdownMenu.Shortcut>
|
|
320
320
|
</DropdownMenu.CheckboxItem>
|
|
321
321
|
</DropdownMenu.Content>
|
|
322
322
|
</DropdownMenu.Root>
|
|
@@ -406,14 +406,14 @@
|
|
|
406
406
|
>
|
|
407
407
|
<Cuboid />
|
|
408
408
|
{t.switchToOrthographic}
|
|
409
|
-
<DropdownMenu.Shortcut
|
|
409
|
+
<DropdownMenu.Shortcut>O</DropdownMenu.Shortcut>
|
|
410
410
|
</DropdownMenu.CheckboxItem>
|
|
411
411
|
|
|
412
412
|
{#if showGrid}
|
|
413
413
|
<DropdownMenu.CheckboxItem switch checked={gridVisible} onCheckedChange={onToggleGrid}>
|
|
414
414
|
<Grid3x3 />
|
|
415
415
|
{t.grid}
|
|
416
|
-
<DropdownMenu.Shortcut
|
|
416
|
+
<DropdownMenu.Shortcut>G</DropdownMenu.Shortcut>
|
|
417
417
|
</DropdownMenu.CheckboxItem>
|
|
418
418
|
{/if}
|
|
419
419
|
|
|
@@ -421,7 +421,7 @@
|
|
|
421
421
|
<DropdownMenu.CheckboxItem switch checked={nightOn} onCheckedChange={onToggleNight}>
|
|
422
422
|
<Moon />
|
|
423
423
|
{t.nightMode}
|
|
424
|
-
<DropdownMenu.Shortcut
|
|
424
|
+
<DropdownMenu.Shortcut>N</DropdownMenu.Shortcut>
|
|
425
425
|
</DropdownMenu.CheckboxItem>
|
|
426
426
|
{/if}
|
|
427
427
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RequestResponseDriverOptions, type SolveDriver, type SolveReporter } from '@selvajs/solve/client';
|
|
2
|
+
import type { SolveFn } from '@selvajs/solve/shared';
|
|
3
|
+
/**
|
|
4
|
+
* The request/response driver `ComputeApp` solves through. Its memo caches whole solve results,
|
|
5
|
+
* meshes included, and the viewer disposes what it renders on the next scene update.
|
|
6
|
+
* `@selvajs/solve` keeps meshes opaque, so the three.js clone/dispose rules come from the renderer
|
|
7
|
+
* that owns them: without `meshPolicy`, a memo hit serves an already-disposed mesh.
|
|
8
|
+
*/
|
|
9
|
+
export declare function createComputeDriver(onSolve: SolveFn, getReporter: () => SolveReporter, options: Omit<RequestResponseDriverOptions<unknown>, 'meshPolicy'>): SolveDriver;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { createRequestResponseDriver } from '@selvajs/solve/client';
|
|
2
|
+
import { meshPolicy } from '@selvajs/visualization/parse';
|
|
3
|
+
/**
|
|
4
|
+
* The request/response driver `ComputeApp` solves through. Its memo caches whole solve results,
|
|
5
|
+
* meshes included, and the viewer disposes what it renders on the next scene update.
|
|
6
|
+
* `@selvajs/solve` keeps meshes opaque, so the three.js clone/dispose rules come from the renderer
|
|
7
|
+
* that owns them: without `meshPolicy`, a memo hit serves an already-disposed mesh.
|
|
8
|
+
*/
|
|
9
|
+
export function createComputeDriver(onSolve, getReporter, options) {
|
|
10
|
+
return createRequestResponseDriver(onSolve, getReporter, { ...options, meshPolicy });
|
|
11
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@selvajs/ui",
|
|
3
|
-
"version": "7.0.3-beta.
|
|
3
|
+
"version": "7.0.3-beta.2",
|
|
4
4
|
"description": "Shared UI components and utilities for Selva applications",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "VektorNode",
|
|
@@ -62,10 +62,10 @@
|
|
|
62
62
|
"svelte": "^5",
|
|
63
63
|
"tailwind-variants": "^3.3.1",
|
|
64
64
|
"three": "^0.187.0",
|
|
65
|
-
"@selvajs/compute": "^5.0.
|
|
66
|
-
"@selvajs/
|
|
67
|
-
"@selvajs/
|
|
68
|
-
"@selvajs/visualization": "^1.7.1-beta.
|
|
65
|
+
"@selvajs/compute": "^5.1.0-beta.0",
|
|
66
|
+
"@selvajs/solve": "^2.1.0-beta.3",
|
|
67
|
+
"@selvajs/schemas": "^5.3.1-beta.1",
|
|
68
|
+
"@selvajs/visualization": "^1.7.1-beta.1"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|
|
71
71
|
"three": {
|
|
@@ -94,11 +94,11 @@
|
|
|
94
94
|
"svelte": "5.57.3",
|
|
95
95
|
"tailwind-variants": "^3.3.1",
|
|
96
96
|
"vitest": "^5.0.5",
|
|
97
|
-
"@selvajs/compute": "5.0.
|
|
98
|
-
"@selvajs/visualization": "1.7.1-beta.0",
|
|
99
|
-
"@selvajs/solve": "2.1.0-beta.0",
|
|
97
|
+
"@selvajs/compute": "5.1.0-beta.0",
|
|
100
98
|
"@selvajs/config": "0.0.4",
|
|
101
|
-
"@selvajs/schemas": "5.3.
|
|
99
|
+
"@selvajs/schemas": "5.3.1-beta.1",
|
|
100
|
+
"@selvajs/solve": "2.1.0-beta.3",
|
|
101
|
+
"@selvajs/visualization": "1.7.1-beta.1"
|
|
102
102
|
},
|
|
103
103
|
"imports": {
|
|
104
104
|
"#lib": "./src/lib/index.js",
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type { SolveFn } from '@selvajs/solve/shared';
|
|
7
7
|
import type { PresetLabels } from '../../types/presetLabels';
|
|
8
8
|
import { createSolvingIndicator } from '../../compute/solving.svelte';
|
|
9
|
-
import {
|
|
9
|
+
import { createComputeDriver } from '../../compute/computeDriver';
|
|
10
10
|
import type {
|
|
11
11
|
RetainedSolveResult,
|
|
12
12
|
SolveEventSource,
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
SolveSettlement
|
|
15
15
|
} from '@selvajs/solve/client';
|
|
16
16
|
import SolveMessages from './SolveMessages.svelte';
|
|
17
|
-
import { meshPolicy } from '@selvajs/visualization/parse';
|
|
18
17
|
import type { ThreeViewer } from '@selvajs/visualization/render';
|
|
19
18
|
import { useSolveSession } from '../../compute/useSolveSession.svelte';
|
|
20
19
|
import { useFooterItem } from '../../composables/useFooterItem.svelte';
|
|
@@ -171,13 +170,8 @@
|
|
|
171
170
|
// The session owns the value/lifecycle state machine; the driver is its transport. The
|
|
172
171
|
// session is passed as a getter because the two reference each other.
|
|
173
172
|
// svelte-ignore state_referenced_locally
|
|
174
|
-
const driver =
|
|
173
|
+
const driver = createComputeDriver(onSolve, () => session, {
|
|
175
174
|
solveDeadlineMs,
|
|
176
|
-
// The driver's memo caches whole solve results, meshes included, and the viewer disposes
|
|
177
|
-
// what it renders on the next scene update. `@selvajs/solve` keeps meshes opaque, so the
|
|
178
|
-
// three.js clone/dispose rules come from the renderer that owns them. Without this, a memo
|
|
179
|
-
// hit serves an already-disposed mesh.
|
|
180
|
-
meshPolicy,
|
|
181
175
|
// `isSolving` lives on the driver, which the session can't observe — republish so the
|
|
182
176
|
// spinner and disabled states track it.
|
|
183
177
|
onChange: () => session.notify(),
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
{@render childrenProp?.()}
|
|
39
39
|
{#if asSwitch}
|
|
40
40
|
<span
|
|
41
|
-
class="[[data-slot=dropdown-menu-shortcut]+&]:ml-2 h-4.5 w-8 pointer-events-none relative ml-auto shrink-0 rounded-full transition-colors {checked
|
|
41
|
+
class="not-pointer-coarse:[[data-slot=dropdown-menu-shortcut]+&]:ml-2 h-4.5 w-8 pointer-events-none relative ml-auto shrink-0 rounded-full transition-colors {checked
|
|
42
42
|
? 'bg-primary'
|
|
43
43
|
: 'bg-input'}"
|
|
44
44
|
data-slot="dropdown-menu-checkbox-item-switch"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
bind:this={ref}
|
|
15
15
|
data-slot="dropdown-menu-shortcut"
|
|
16
16
|
class={cn(
|
|
17
|
-
'h-5 min-w-5 px-1 font-mono ml-auto inline-flex items-center justify-center rounded-sm border bg-muted text-2xs text-muted-foreground group-focus/dropdown-menu-item:text-foreground',
|
|
17
|
+
'h-5 min-w-5 px-1 font-mono ml-auto inline-flex items-center justify-center rounded-sm border bg-muted text-2xs text-muted-foreground group-focus/dropdown-menu-item:text-foreground pointer-coarse:hidden',
|
|
18
18
|
className
|
|
19
19
|
)}
|
|
20
20
|
{...restProps}
|
|
@@ -316,7 +316,7 @@
|
|
|
316
316
|
>
|
|
317
317
|
<Spline />
|
|
318
318
|
{t.edges}
|
|
319
|
-
<DropdownMenu.Shortcut
|
|
319
|
+
<DropdownMenu.Shortcut>E</DropdownMenu.Shortcut>
|
|
320
320
|
</DropdownMenu.CheckboxItem>
|
|
321
321
|
</DropdownMenu.Content>
|
|
322
322
|
</DropdownMenu.Root>
|
|
@@ -406,14 +406,14 @@
|
|
|
406
406
|
>
|
|
407
407
|
<Cuboid />
|
|
408
408
|
{t.switchToOrthographic}
|
|
409
|
-
<DropdownMenu.Shortcut
|
|
409
|
+
<DropdownMenu.Shortcut>O</DropdownMenu.Shortcut>
|
|
410
410
|
</DropdownMenu.CheckboxItem>
|
|
411
411
|
|
|
412
412
|
{#if showGrid}
|
|
413
413
|
<DropdownMenu.CheckboxItem switch checked={gridVisible} onCheckedChange={onToggleGrid}>
|
|
414
414
|
<Grid3x3 />
|
|
415
415
|
{t.grid}
|
|
416
|
-
<DropdownMenu.Shortcut
|
|
416
|
+
<DropdownMenu.Shortcut>G</DropdownMenu.Shortcut>
|
|
417
417
|
</DropdownMenu.CheckboxItem>
|
|
418
418
|
{/if}
|
|
419
419
|
|
|
@@ -421,7 +421,7 @@
|
|
|
421
421
|
<DropdownMenu.CheckboxItem switch checked={nightOn} onCheckedChange={onToggleNight}>
|
|
422
422
|
<Moon />
|
|
423
423
|
{t.nightMode}
|
|
424
|
-
<DropdownMenu.Shortcut
|
|
424
|
+
<DropdownMenu.Shortcut>N</DropdownMenu.Shortcut>
|
|
425
425
|
</DropdownMenu.CheckboxItem>
|
|
426
426
|
{/if}
|
|
427
427
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createRequestResponseDriver,
|
|
3
|
+
type RequestResponseDriverOptions,
|
|
4
|
+
type SolveDriver,
|
|
5
|
+
type SolveReporter
|
|
6
|
+
} from '@selvajs/solve/client';
|
|
7
|
+
import type { SolveFn } from '@selvajs/solve/shared';
|
|
8
|
+
import { meshPolicy } from '@selvajs/visualization/parse';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The request/response driver `ComputeApp` solves through. Its memo caches whole solve results,
|
|
12
|
+
* meshes included, and the viewer disposes what it renders on the next scene update.
|
|
13
|
+
* `@selvajs/solve` keeps meshes opaque, so the three.js clone/dispose rules come from the renderer
|
|
14
|
+
* that owns them: without `meshPolicy`, a memo hit serves an already-disposed mesh.
|
|
15
|
+
*/
|
|
16
|
+
export function createComputeDriver(
|
|
17
|
+
onSolve: SolveFn,
|
|
18
|
+
getReporter: () => SolveReporter,
|
|
19
|
+
options: Omit<RequestResponseDriverOptions<unknown>, 'meshPolicy'>
|
|
20
|
+
): SolveDriver {
|
|
21
|
+
return createRequestResponseDriver(onSolve, getReporter, { ...options, meshPolicy });
|
|
22
|
+
}
|