@joycostudio/studio 0.1.4 → 0.1.6
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/README.md +17 -2
- package/dist/{chunk-2RGQF5X5.js → chunk-6KZJEKOL.js} +147 -59
- package/dist/chunk-6KZJEKOL.js.map +1 -0
- package/dist/cli.js +1 -1
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +27 -4
- package/dist/client.js +1 -1
- package/dist/next.js +1 -1
- package/dist/react.d.ts +26 -3
- package/dist/react.js +445 -322
- package/dist/react.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-2RGQF5X5.js.map +0 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
import { DebugSchema, DebugFolder } from '@joycostudio/xyz/debug';
|
|
2
2
|
import { f as StudioTool, T as ToolDefinition, j as ToolState, R as Result, i as ToolReference } from './protocol-DjrMADPm.js';
|
|
3
3
|
|
|
4
|
+
type Change = {
|
|
5
|
+
path: string[];
|
|
6
|
+
before: unknown;
|
|
7
|
+
after: unknown;
|
|
8
|
+
};
|
|
9
|
+
|
|
4
10
|
type Connection = {
|
|
5
11
|
phase: 'local';
|
|
6
12
|
} | {
|
|
@@ -15,7 +21,7 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
15
21
|
readonly definition: ToolDefinition<TConfig>;
|
|
16
22
|
/** The live config. Writes sync to same-origin pages and, when connected, the runtime. */
|
|
17
23
|
readonly config: TConfig;
|
|
18
|
-
/** Runtime-owned state; null
|
|
24
|
+
/** Runtime-owned state; null while no runtime is connected or until it answers. */
|
|
19
25
|
readonly state: ToolState<TConfig> | null;
|
|
20
26
|
/** Bumps on every config change. Handy as a React snapshot. */
|
|
21
27
|
readonly version: number;
|
|
@@ -25,10 +31,12 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
25
31
|
controls(): DebugSchema;
|
|
26
32
|
/** Xyz `Debuggable`: `debugManager.register(handle)` mounts this tool in the app's floating pane. */
|
|
27
33
|
debug(): DebugFolder;
|
|
28
|
-
/** The config on disk: the runtime's saved value or, until one answers, the bundled `initial`. */
|
|
34
|
+
/** The config on disk: the runtime's last reported saved value or, until one answers, the bundled `initial`. */
|
|
29
35
|
readonly saved: TConfig;
|
|
30
36
|
/** Dotted paths where the draft differs from `saved`. Tracked locally, so it works without a runtime too. */
|
|
31
37
|
readonly changes: string[];
|
|
38
|
+
/** Each leaf where the draft differs from `saved`: `before` is the saved value, `after` the draft's. */
|
|
39
|
+
readonly diff: Change[];
|
|
32
40
|
/** The draft differs from `saved`. */
|
|
33
41
|
readonly dirty: boolean;
|
|
34
42
|
/** True while `compare(true)` shows the saved config in place of the draft. */
|
|
@@ -47,10 +55,25 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
47
55
|
*/
|
|
48
56
|
undo(): boolean;
|
|
49
57
|
redo(): boolean;
|
|
58
|
+
/** Persist the draft. Needs a connected runtime. */
|
|
50
59
|
save(options?: {
|
|
51
60
|
force?: boolean;
|
|
52
61
|
}): Promise<Result<ToolState<TConfig>>>;
|
|
53
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Reset the draft to `saved`, with or without a runtime, then sync it like any other edit.
|
|
64
|
+
* Undoable as its own step. Returns false when there is nothing to discard.
|
|
65
|
+
*/
|
|
66
|
+
discard(): boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Reset one changed leaf (a dotted path from `changes`, or its keys, which also address keys containing dots) to its saved value, then sync it like any
|
|
69
|
+
* other edit. Undoable as its own step. Returns false when that leaf is unchanged or while comparing.
|
|
70
|
+
*/
|
|
71
|
+
revert(path: string | readonly string[]): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* A link to `base` (the current page by default) carrying the draft. Opening it on another machine applies
|
|
74
|
+
* that draft as an unsaved, undoable edit; a draft that no longer fits the tool's controls is ignored.
|
|
75
|
+
*/
|
|
76
|
+
shareUrl(base?: string | URL): string;
|
|
54
77
|
};
|
|
55
78
|
type Studio = {
|
|
56
79
|
/** Every registered tool in order, including preview-only ones. */
|
|
@@ -78,4 +101,4 @@ declare function postCompare(target: Window | null | undefined, tool: string, sh
|
|
|
78
101
|
declare function everyFrame(refresh: () => void): () => void;
|
|
79
102
|
declare function createStudio(config: StudioOptions, options?: Pick<StudioOptions, 'runtime'>): Studio;
|
|
80
103
|
|
|
81
|
-
export { type Connection, type Studio, type StudioOptions, type ToolHandle, createStudio, everyFrame, postCompare };
|
|
104
|
+
export { type Change, type Connection, type Studio, type StudioOptions, type ToolHandle, createStudio, everyFrame, postCompare };
|
package/dist/client.js
CHANGED
package/dist/next.js
CHANGED
package/dist/react.d.ts
CHANGED
|
@@ -3,6 +3,12 @@ import { ComponentType, ComponentPropsWithRef, ReactNode, ComponentPropsWithoutR
|
|
|
3
3
|
import { DebugSchema, DebugFolder } from '@joycostudio/xyz/debug';
|
|
4
4
|
import { Select } from '@base-ui/react/select';
|
|
5
5
|
|
|
6
|
+
type Change = {
|
|
7
|
+
path: string[];
|
|
8
|
+
before: unknown;
|
|
9
|
+
after: unknown;
|
|
10
|
+
};
|
|
11
|
+
|
|
6
12
|
type Success<T> = {
|
|
7
13
|
ok: true;
|
|
8
14
|
data: T;
|
|
@@ -93,7 +99,7 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
93
99
|
readonly definition: ToolDefinition<TConfig>;
|
|
94
100
|
/** The live config. Writes sync to same-origin pages and, when connected, the runtime. */
|
|
95
101
|
readonly config: TConfig;
|
|
96
|
-
/** Runtime-owned state; null
|
|
102
|
+
/** Runtime-owned state; null while no runtime is connected or until it answers. */
|
|
97
103
|
readonly state: ToolState<TConfig> | null;
|
|
98
104
|
/** Bumps on every config change. Handy as a React snapshot. */
|
|
99
105
|
readonly version: number;
|
|
@@ -103,10 +109,12 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
103
109
|
controls(): DebugSchema;
|
|
104
110
|
/** Xyz `Debuggable`: `debugManager.register(handle)` mounts this tool in the app's floating pane. */
|
|
105
111
|
debug(): DebugFolder;
|
|
106
|
-
/** The config on disk: the runtime's saved value or, until one answers, the bundled `initial`. */
|
|
112
|
+
/** The config on disk: the runtime's last reported saved value or, until one answers, the bundled `initial`. */
|
|
107
113
|
readonly saved: TConfig;
|
|
108
114
|
/** Dotted paths where the draft differs from `saved`. Tracked locally, so it works without a runtime too. */
|
|
109
115
|
readonly changes: string[];
|
|
116
|
+
/** Each leaf where the draft differs from `saved`: `before` is the saved value, `after` the draft's. */
|
|
117
|
+
readonly diff: Change[];
|
|
110
118
|
/** The draft differs from `saved`. */
|
|
111
119
|
readonly dirty: boolean;
|
|
112
120
|
/** True while `compare(true)` shows the saved config in place of the draft. */
|
|
@@ -125,10 +133,25 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
125
133
|
*/
|
|
126
134
|
undo(): boolean;
|
|
127
135
|
redo(): boolean;
|
|
136
|
+
/** Persist the draft. Needs a connected runtime. */
|
|
128
137
|
save(options?: {
|
|
129
138
|
force?: boolean;
|
|
130
139
|
}): Promise<Result<ToolState<TConfig>>>;
|
|
131
|
-
|
|
140
|
+
/**
|
|
141
|
+
* Reset the draft to `saved`, with or without a runtime, then sync it like any other edit.
|
|
142
|
+
* Undoable as its own step. Returns false when there is nothing to discard.
|
|
143
|
+
*/
|
|
144
|
+
discard(): boolean;
|
|
145
|
+
/**
|
|
146
|
+
* Reset one changed leaf (a dotted path from `changes`, or its keys, which also address keys containing dots) to its saved value, then sync it like any
|
|
147
|
+
* other edit. Undoable as its own step. Returns false when that leaf is unchanged or while comparing.
|
|
148
|
+
*/
|
|
149
|
+
revert(path: string | readonly string[]): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* A link to `base` (the current page by default) carrying the draft. Opening it on another machine applies
|
|
152
|
+
* that draft as an unsaved, undoable edit; a draft that no longer fits the tool's controls is ignored.
|
|
153
|
+
*/
|
|
154
|
+
shareUrl(base?: string | URL): string;
|
|
132
155
|
};
|
|
133
156
|
type Studio$1 = {
|
|
134
157
|
/** Every registered tool in order, including preview-only ones. */
|