@paged-media/plugin-api 0.2.43-canary.0 → 0.2.46-canary.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/host.d.ts +28 -0
- package/dist/index.d.ts +4 -3
- package/dist/manifest.d.ts +25 -0
- package/dist/mutations.d.ts +1 -1
- package/dist/object-model.d.ts +560 -0
- package/dist/panel-schema.d.ts +113 -1
- package/dist/widgets.d.ts +56 -1
- package/dist/wire.d.ts +124 -9
- package/package.json +1 -1
- package/src/manifest.schema.json +170 -0
package/dist/panel-schema.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { ComponentType } from "react";
|
|
2
2
|
import type { BindingsSurface } from "./host";
|
|
3
|
+
import type { Address, PropertyPathName, Selector } from "./object-model";
|
|
3
4
|
import type { PropertyPath, Value } from "./wire";
|
|
4
5
|
export type WidgetValueBinding = {
|
|
5
6
|
kind: "literal";
|
|
@@ -90,7 +91,113 @@ export interface SchemaListSpec {
|
|
|
90
91
|
/** Per-row action buttons. */
|
|
91
92
|
actions?: SchemaListAction[];
|
|
92
93
|
}
|
|
93
|
-
|
|
94
|
+
/**
|
|
95
|
+
* Which object(s) a property row edits.
|
|
96
|
+
* · `"selection"` — the selected objects. With `kind` set, the objects of
|
|
97
|
+
* that kind HOSTED by each selected object (`<selected> > <kind>`):
|
|
98
|
+
* the web frame of a selected text frame, the layers of a selected
|
|
99
|
+
* image frame.
|
|
100
|
+
* · a selector string (ADR 131) — every address it selects, re-resolved
|
|
101
|
+
* when the object model changes. Also the durable "Bind to data…"
|
|
102
|
+
* target, so prefer a name/label selector over a raw session address.
|
|
103
|
+
* · `{ bind }` — an address, or a list of addresses, the plugin publishes
|
|
104
|
+
* through `host.bindings.publish(name, …)` (its active layer, the cell
|
|
105
|
+
* under the cursor). Absent / empty = no target (the field disables).
|
|
106
|
+
* · `{ addresses }` — explicit addresses, as given.
|
|
107
|
+
*/
|
|
108
|
+
export type PropertyFieldAddress = "selection" | Selector | {
|
|
109
|
+
bind: string;
|
|
110
|
+
} | {
|
|
111
|
+
addresses: readonly Address[];
|
|
112
|
+
};
|
|
113
|
+
/** How a property row presents an `enum` (or a text row offering a
|
|
114
|
+
* collection): the host picks from the schema row otherwise. */
|
|
115
|
+
export type PropertyFieldStyle = "select" | "segments" | "collection";
|
|
116
|
+
/** One option override for a `select` / `segments` presentation (labels
|
|
117
|
+
* for enum members; the member list still comes from the schema). */
|
|
118
|
+
export interface PropertyFieldOption {
|
|
119
|
+
value: string;
|
|
120
|
+
label?: string;
|
|
121
|
+
icon?: string;
|
|
122
|
+
}
|
|
123
|
+
/** One sub-field a property row shows of a STRUCT value (or of each
|
|
124
|
+
* struct item of a list): `field` is the struct field's name; the widget
|
|
125
|
+
* comes from that field's value type, like a row's comes from its schema
|
|
126
|
+
* row. A bare string is `{ field }`. */
|
|
127
|
+
export interface PropertySubField {
|
|
128
|
+
field: string;
|
|
129
|
+
label?: string;
|
|
130
|
+
style?: PropertyFieldStyle;
|
|
131
|
+
options?: readonly PropertyFieldOption[];
|
|
132
|
+
/** Leaf chrome passthrough. */
|
|
133
|
+
props?: Record<string, unknown>;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* How a property row presents a LIST value (`{ kind: "list", of }`): an
|
|
137
|
+
* appearance stack's fills, a gradient's stops. Every edit the host
|
|
138
|
+
* offers is a {@link ListEdit} the SDK lowers to `set` ops (one batch, one
|
|
139
|
+
* undo step) — `planValueEdit` / `editValue` in plugin-sdk.
|
|
140
|
+
*/
|
|
141
|
+
export interface PropertyListPresentation {
|
|
142
|
+
/** Struct items: the fields each item shows, in order. Absent = every
|
|
143
|
+
* declared field of the item struct. Scalar items show one widget. */
|
|
144
|
+
fields?: readonly (string | PropertySubField)[];
|
|
145
|
+
/** The item field whose value titles an item (`name`, `stopColor`). */
|
|
146
|
+
itemLabel?: string;
|
|
147
|
+
/** Offer add / remove / reorder. Each defaults to `true` on a
|
|
148
|
+
* read-write row; `add` also stops at the type's `maxItems`. */
|
|
149
|
+
add?: boolean;
|
|
150
|
+
remove?: boolean;
|
|
151
|
+
reorder?: boolean;
|
|
152
|
+
/** List the LAST item first (a stack painted bottom → top reads
|
|
153
|
+
* top-first, like a layers panel). Indices in the edits stay value
|
|
154
|
+
* indices. Default `false`. */
|
|
155
|
+
reversed?: boolean;
|
|
156
|
+
/** The item `add` inserts. Absent = the item type's default
|
|
157
|
+
* (`defaultValueOf`: struct field defaults, the first enum member,
|
|
158
|
+
* 0, "", false, []). Must satisfy the item type. */
|
|
159
|
+
newItem?: unknown;
|
|
160
|
+
}
|
|
161
|
+
/** The property row (the property row). Mutually exclusive with `widget`: a
|
|
162
|
+
* row is EITHER a catalog widget OR an object-model property field. */
|
|
163
|
+
export interface PanelSchemaPropertyRow {
|
|
164
|
+
field: "property";
|
|
165
|
+
/** The object(s) the field edits — see {@link PropertyFieldAddress}. */
|
|
166
|
+
address: PropertyFieldAddress;
|
|
167
|
+
/** The ADR 132 path on the target's kind (`opacity`, `blendMode`,
|
|
168
|
+
* `points[0].anchor`). */
|
|
169
|
+
path: PropertyPathName;
|
|
170
|
+
/** The qualified kind (`plugin:<id>/<kind>`, or a core kind) whose
|
|
171
|
+
* schema row types the field. Required with `address: "selection"`
|
|
172
|
+
* for plugin objects (it scopes the selection to that kind); otherwise
|
|
173
|
+
* it lets the field show its widget before any target resolves. */
|
|
174
|
+
kind?: string;
|
|
175
|
+
/** Row label (sentence case). Absent = the schema row's `title`, then
|
|
176
|
+
* the path. */
|
|
177
|
+
label?: string;
|
|
178
|
+
style?: PropertyFieldStyle;
|
|
179
|
+
options?: readonly PropertyFieldOption[];
|
|
180
|
+
/** Offer "Bind to data…" (default: when the schema row is bindable). */
|
|
181
|
+
bindable?: boolean;
|
|
182
|
+
/** A STRUCT-typed path: the fields to show, in order (absent = every
|
|
183
|
+
* declared field; an `open` struct with no `fields` shows none and
|
|
184
|
+
* falls back to its JSON text). Edits are {@link StructEdit}s. */
|
|
185
|
+
fields?: readonly (string | PropertySubField)[];
|
|
186
|
+
/** A LIST-typed path: how its items present and which edits are
|
|
187
|
+
* offered. Absent = the defaults of {@link PropertyListPresentation}. */
|
|
188
|
+
items?: PropertyListPresentation;
|
|
189
|
+
/** Leaf chrome passthrough (placeholder, prefix, suffix, icon, …). */
|
|
190
|
+
props?: Record<string, unknown>;
|
|
191
|
+
visible?: SchemaGate;
|
|
192
|
+
enabled?: SchemaGate;
|
|
193
|
+
/** Never set on a property row (keeps `row.widget` readable on the
|
|
194
|
+
* union). */
|
|
195
|
+
widget?: undefined;
|
|
196
|
+
value?: undefined;
|
|
197
|
+
list?: undefined;
|
|
198
|
+
}
|
|
199
|
+
/** The catalog-widget row (schema v1 / v1.1). */
|
|
200
|
+
export interface PanelSchemaWidgetRow {
|
|
94
201
|
/** Catalog widget id (a curated primitive-leaf id the host
|
|
95
202
|
* registered). An unknown id renders a visible "unknown widget"
|
|
96
203
|
* placeholder, not a throw. */
|
|
@@ -112,7 +219,12 @@ export interface PanelSchemaRow {
|
|
|
112
219
|
* always enabled (subject to the widget's own no-write-path
|
|
113
220
|
* disable). */
|
|
114
221
|
enabled?: SchemaGate;
|
|
222
|
+
/** Never set on a widget row. */
|
|
223
|
+
field?: undefined;
|
|
115
224
|
}
|
|
225
|
+
/** One panel row: a catalog widget, or an object-model property
|
|
226
|
+
* field. Discriminate with `isPropertyRow` (plugin-sdk) or `row.field`. */
|
|
227
|
+
export type PanelSchemaRow = PanelSchemaWidgetRow | PanelSchemaPropertyRow;
|
|
116
228
|
export interface PanelSchemaSection {
|
|
117
229
|
/** Section title (the kicker / disclosure header). Absent = an
|
|
118
230
|
* untitled flat group. */
|
package/dist/widgets.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type { ComponentType } from "react";
|
|
1
|
+
import type { ComponentType, ReactNode } from "react";
|
|
2
|
+
import type { Address, PropertyPathName, Selector } from "./object-model";
|
|
3
|
+
import type { PropertyFieldOption, PropertyFieldStyle, PropertyListPresentation, PropertySubField } from "./panel-schema";
|
|
2
4
|
/** Languages the host code editor highlights. `text` = no
|
|
3
5
|
* highlighting (line numbers + gutter only). Additive: a host MAY
|
|
4
6
|
* accept more, but only these are contract-guaranteed. */
|
|
@@ -51,6 +53,59 @@ export interface WidgetSurface {
|
|
|
51
53
|
* `<input type="color">` fallback stands in when the host injects
|
|
52
54
|
* none (probe `host.supports("widgets.colorPicker@1")`). */
|
|
53
55
|
readonly ColorPicker: ComponentType<ColorPickerProps>;
|
|
56
|
+
/** ADR 323 — the host's ONE schema-driven property field, for bundles
|
|
57
|
+
* that render their own React panel: the same field a schema panel's
|
|
58
|
+
* `{ field: "property" }` row renders (widget from the schema row,
|
|
59
|
+
* reads/writes through `host.objects`, one undo step per commit, "Bind
|
|
60
|
+
* to data…" and the bound badge). OPTIONAL: absent on a host without
|
|
61
|
+
* an object-model UI — probe the member (or
|
|
62
|
+
* `host.supports("widgets.propertyField@1")`) and keep your own control
|
|
63
|
+
* as the fallback. */
|
|
64
|
+
readonly PropertyField?: ComponentType<PropertyFieldProps>;
|
|
65
|
+
/** ADR 323 — the field CHROME without a widget, around a control the
|
|
66
|
+
* bundle keeps on purpose (a curve editor, a gradient strip): the
|
|
67
|
+
* host's verdict hooks, "Bind to data…" on right-click and the badges.
|
|
68
|
+
* The bundle's control still writes through its own door; the frame
|
|
69
|
+
* only names the object property it edits. OPTIONAL like
|
|
70
|
+
* `PropertyField`. */
|
|
71
|
+
readonly PropertyFrame?: ComponentType<PropertyFrameProps>;
|
|
72
|
+
}
|
|
73
|
+
/** Which object(s) a React property field edits: the selection (scoped to
|
|
74
|
+
* `kind` when given), a selector, or explicit addresses. (A schema row
|
|
75
|
+
* can also name a published binding; a React panel has its state at hand
|
|
76
|
+
* and passes the addresses.) */
|
|
77
|
+
export type PropertyFieldTarget = "selection" | Selector | {
|
|
78
|
+
addresses: readonly Address[];
|
|
79
|
+
};
|
|
80
|
+
/** Props of {@link WidgetSurface.PropertyField}. */
|
|
81
|
+
export interface PropertyFieldProps {
|
|
82
|
+
address: PropertyFieldTarget;
|
|
83
|
+
path: PropertyPathName;
|
|
84
|
+
/** Qualified kind (`plugin:<id>/<kind>`) — see `PanelSchemaPropertyRow.kind`. */
|
|
85
|
+
kind?: string;
|
|
86
|
+
label?: string;
|
|
87
|
+
style?: PropertyFieldStyle;
|
|
88
|
+
options?: readonly PropertyFieldOption[];
|
|
89
|
+
bindable?: boolean;
|
|
90
|
+
disabled?: boolean;
|
|
91
|
+
/** A struct-typed path: the fields shown (see
|
|
92
|
+
* `PanelSchemaPropertyRow.fields`). Needs
|
|
93
|
+
* `host.supports("widgets.propertyField.values@1")`. */
|
|
94
|
+
fields?: readonly (string | PropertySubField)[];
|
|
95
|
+
/** A list-typed path: item presentation and the offered edits (see
|
|
96
|
+
* `PanelSchemaPropertyRow.items`). Needs
|
|
97
|
+
* `host.supports("widgets.propertyField.values@1")`. */
|
|
98
|
+
items?: PropertyListPresentation;
|
|
99
|
+
/** Leaf chrome passthrough (placeholder, prefix, suffix, icon, …). */
|
|
100
|
+
props?: Record<string, unknown>;
|
|
101
|
+
}
|
|
102
|
+
/** Props of {@link WidgetSurface.PropertyFrame}. */
|
|
103
|
+
export interface PropertyFrameProps {
|
|
104
|
+
address: PropertyFieldTarget;
|
|
105
|
+
path: PropertyPathName;
|
|
106
|
+
kind?: string;
|
|
107
|
+
bindable?: boolean;
|
|
108
|
+
children: ReactNode;
|
|
54
109
|
}
|
|
55
110
|
/** Props of {@link WidgetSurface.ColorPicker}. Colours are sRGB hex. */
|
|
56
111
|
export interface ColorPickerProps {
|