@joycostudio/studio 0.1.5 → 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 +14 -0
- package/dist/{chunk-ZH3NEN4V.js → chunk-6KZJEKOL.js} +99 -17
- 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 +19 -1
- package/dist/client.js +1 -1
- package/dist/next.js +1 -1
- package/dist/react.d.ts +18 -0
- package/dist/react.js +434 -314
- package/dist/react.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/chunk-ZH3NEN4V.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
|
} | {
|
|
@@ -29,6 +35,8 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
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. */
|
|
@@ -56,6 +64,16 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
56
64
|
* Undoable as its own step. Returns false when there is nothing to discard.
|
|
57
65
|
*/
|
|
58
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;
|
|
59
77
|
};
|
|
60
78
|
type Studio = {
|
|
61
79
|
/** Every registered tool in order, including preview-only ones. */
|
|
@@ -83,4 +101,4 @@ declare function postCompare(target: Window | null | undefined, tool: string, sh
|
|
|
83
101
|
declare function everyFrame(refresh: () => void): () => void;
|
|
84
102
|
declare function createStudio(config: StudioOptions, options?: Pick<StudioOptions, 'runtime'>): Studio;
|
|
85
103
|
|
|
86
|
-
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;
|
|
@@ -107,6 +113,8 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
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. */
|
|
@@ -134,6 +142,16 @@ type ToolHandle<TConfig extends object = any> = {
|
|
|
134
142
|
* Undoable as its own step. Returns false when there is nothing to discard.
|
|
135
143
|
*/
|
|
136
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;
|
|
137
155
|
};
|
|
138
156
|
type Studio$1 = {
|
|
139
157
|
/** Every registered tool in order, including preview-only ones. */
|