@selvajs/ui 4.9.0 → 4.10.0
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/preview/InputControl.svelte +2 -1
- package/dist/contexts/clientSlotContext.svelte.d.ts +8 -0
- package/dist/public.js +2 -2
- package/package.json +1 -1
- package/src/lib/components/preview/InputControl.svelte +2 -1
- package/src/lib/contexts/clientSlotContext.svelte.ts +12 -2
- package/src/lib/public.ts +3 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Snippet } from 'svelte';
|
|
2
|
+
import type { SupportedTypes } from '@selvajs/schemas';
|
|
2
3
|
export interface ClientSlotArgs {
|
|
3
4
|
/** Grasshopper parameter instance GUID (LayoutItem.paramId / SchemaInput.id). */
|
|
4
5
|
inputId: string;
|
|
@@ -7,6 +8,13 @@ export interface ClientSlotArgs {
|
|
|
7
8
|
slotLabel?: string;
|
|
8
9
|
/** The current value held for this input (e.g. the prefilled JSON), if any. */
|
|
9
10
|
value: unknown;
|
|
11
|
+
/**
|
|
12
|
+
* Commit a value for this input. Identical channel to a built-in widget's change
|
|
13
|
+
* — the value lands in the solve session and is sent to Compute on the next solve.
|
|
14
|
+
* `forceSolve` requests a solve even in manual-solve mode (system reconciliation).
|
|
15
|
+
* Lets a slot be an interactive control (a custom picker), not just a display cell.
|
|
16
|
+
*/
|
|
17
|
+
onValueChange: (value: SupportedTypes, forceSolve?: boolean) => void;
|
|
10
18
|
}
|
|
11
19
|
export type ClientSlot = Snippet<[ClientSlotArgs]>;
|
|
12
20
|
export declare function setClientSlot(slot: ClientSlot | undefined): void;
|
package/dist/public.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
//
|
|
8
8
|
// Scope: the compute-app SDK — everything an external host app needs to embed a
|
|
9
9
|
// Grasshopper-driven app (ComputeApp), drive solves, and wire pre-step
|
|
10
|
-
// producers. Verified against real
|
|
10
|
+
// producers. Verified against real external host apps: they import
|
|
11
11
|
// ComputeApp + its types, the solve seam, and external/storage. Nothing else.
|
|
12
12
|
//
|
|
13
13
|
// Deliberately NOT public: design-system primitives (Button, Card, Dialog, …),
|
|
@@ -33,7 +33,7 @@ export { default as ErrorScreen } from './components/ErrorScreen.svelte';
|
|
|
33
33
|
// driver interface). Exported so transports outside this package can satisfy
|
|
34
34
|
// SolveDriver and drive a session. See CONTEXT.md.
|
|
35
35
|
export { createSolveSession, createRequestResponseDriver } from './compute/createSolveSession.svelte';
|
|
36
|
-
// Pre-step producer transit storage (
|
|
36
|
+
// Pre-step producer transit storage (host apps wire producers via these).
|
|
37
37
|
export * from './external/storage';
|
|
38
38
|
// Schema utilities a ComputeApp host reasonably needs to read/shape values.
|
|
39
39
|
export * from './schema/defaults';
|
package/package.json
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { getContext, setContext } from 'svelte';
|
|
2
2
|
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { SupportedTypes } from '@selvajs/schemas';
|
|
3
4
|
|
|
4
5
|
// Carries the host app's slot renderer down to InputControl without threading a
|
|
5
6
|
// prop through every layout layer (ComputeApp → AppLayout → TabLayout →
|
|
@@ -7,8 +8,10 @@ import type { Snippet } from 'svelte';
|
|
|
7
8
|
//
|
|
8
9
|
// An input with source.kind === 'client' and source.client.presentation === 'slot'
|
|
9
10
|
// reserves its cell but renders nothing itself. Instead Selva invokes this snippet
|
|
10
|
-
// so the host can render its own element (e.g. an "Edit JSON" button
|
|
11
|
-
// interprets what the host renders; `slotLabel` is passed
|
|
11
|
+
// so the host can render its own element (e.g. an "Edit JSON" button, or a custom
|
|
12
|
+
// picker). Selva never interprets what the host renders; `slotLabel` is passed
|
|
13
|
+
// through untouched. The host may COMMIT a value back via `onValueChange`, which
|
|
14
|
+
// flows into the solve exactly like any built-in widget's change.
|
|
12
15
|
|
|
13
16
|
export interface ClientSlotArgs {
|
|
14
17
|
/** Grasshopper parameter instance GUID (LayoutItem.paramId / SchemaInput.id). */
|
|
@@ -18,6 +21,13 @@ export interface ClientSlotArgs {
|
|
|
18
21
|
slotLabel?: string;
|
|
19
22
|
/** The current value held for this input (e.g. the prefilled JSON), if any. */
|
|
20
23
|
value: unknown;
|
|
24
|
+
/**
|
|
25
|
+
* Commit a value for this input. Identical channel to a built-in widget's change
|
|
26
|
+
* — the value lands in the solve session and is sent to Compute on the next solve.
|
|
27
|
+
* `forceSolve` requests a solve even in manual-solve mode (system reconciliation).
|
|
28
|
+
* Lets a slot be an interactive control (a custom picker), not just a display cell.
|
|
29
|
+
*/
|
|
30
|
+
onValueChange: (value: SupportedTypes, forceSolve?: boolean) => void;
|
|
21
31
|
}
|
|
22
32
|
|
|
23
33
|
export type ClientSlot = Snippet<[ClientSlotArgs]>;
|
package/src/lib/public.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
//
|
|
8
8
|
// Scope: the compute-app SDK — everything an external host app needs to embed a
|
|
9
9
|
// Grasshopper-driven app (ComputeApp), drive solves, and wire pre-step
|
|
10
|
-
// producers. Verified against real
|
|
10
|
+
// producers. Verified against real external host apps: they import
|
|
11
11
|
// ComputeApp + its types, the solve seam, and external/storage. Nothing else.
|
|
12
12
|
//
|
|
13
13
|
// Deliberately NOT public: design-system primitives (Button, Card, Dialog, …),
|
|
@@ -56,10 +56,10 @@ export {
|
|
|
56
56
|
} from './compute/createSolveSession.svelte';
|
|
57
57
|
|
|
58
58
|
// Client-slot context type (host apps render their own cell for client-sourced
|
|
59
|
-
// inputs
|
|
59
|
+
// inputs, and may commit a value back via ClientSlotArgs.onValueChange).
|
|
60
60
|
export type { ClientSlotArgs, ClientSlot } from './contexts/clientSlotContext.svelte';
|
|
61
61
|
|
|
62
|
-
// Pre-step producer transit storage (
|
|
62
|
+
// Pre-step producer transit storage (host apps wire producers via these).
|
|
63
63
|
export * from './external/storage';
|
|
64
64
|
|
|
65
65
|
// Schema utilities a ComputeApp host reasonably needs to read/shape values.
|