@digital-gravy/etch-public-api 0.7.0 → 0.7.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/README.md +65 -62
- package/dist/index.cjs +4 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +129 -58
- package/dist/index.d.ts +129 -58
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +58 -44
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ interface EtchBlockContext {
|
|
|
12
12
|
* panel. This is editor UI state, not document data — most scripts can
|
|
13
13
|
* ignore it.
|
|
14
14
|
*/
|
|
15
|
-
structureState?:
|
|
15
|
+
structureState?: 'open' | 'closed';
|
|
16
16
|
/** Whether the block is hidden (not rendered) on the canvas. */
|
|
17
17
|
hidden?: boolean;
|
|
18
18
|
}
|
|
@@ -64,7 +64,7 @@ interface EtchBlockCommon {
|
|
|
64
64
|
}
|
|
65
65
|
/** A text block (`etch/text`). */
|
|
66
66
|
interface EtchTextBlockJson extends EtchBlockCommon {
|
|
67
|
-
type:
|
|
67
|
+
type: 'etch/text';
|
|
68
68
|
/** The block's text content. */
|
|
69
69
|
text: string;
|
|
70
70
|
}
|
|
@@ -76,7 +76,7 @@ interface EtchTextBlockJson extends EtchBlockCommon {
|
|
|
76
76
|
* `blocks.create()` / `blocks.replace()` ignore them.
|
|
77
77
|
*/
|
|
78
78
|
interface EtchElementBlockJson extends EtchBlockCommon {
|
|
79
|
-
type:
|
|
79
|
+
type: 'etch/element';
|
|
80
80
|
/** The HTML tag name, e.g. `div`, `p`, `h1`. */
|
|
81
81
|
tag: string;
|
|
82
82
|
/** HTML attributes. */
|
|
@@ -90,7 +90,7 @@ interface EtchElementBlockJson extends EtchBlockCommon {
|
|
|
90
90
|
* {@link EtchElementBlockJson}).
|
|
91
91
|
*/
|
|
92
92
|
interface EtchDynamicElementBlockJson extends EtchBlockCommon {
|
|
93
|
-
type:
|
|
93
|
+
type: 'etch/dynamic-element';
|
|
94
94
|
/** HTML attributes (the rendered tag is read from `attributes.tag`). */
|
|
95
95
|
attributes: EtchHtmlAttributes;
|
|
96
96
|
}
|
|
@@ -111,7 +111,7 @@ interface EtchDynamicElementBlockJson extends EtchBlockCommon {
|
|
|
111
111
|
* to `"full"` when omitted.
|
|
112
112
|
*/
|
|
113
113
|
interface EtchDynamicImageBlockJson extends EtchBlockCommon {
|
|
114
|
-
type:
|
|
114
|
+
type: 'etch/dynamic-image';
|
|
115
115
|
/** HTML attributes (e.g. `src`, `alt`). */
|
|
116
116
|
attributes: EtchHtmlAttributes;
|
|
117
117
|
}
|
|
@@ -129,13 +129,13 @@ interface EtchDynamicImageBlockJson extends EtchBlockCommon {
|
|
|
129
129
|
* when `src` is set.
|
|
130
130
|
*/
|
|
131
131
|
interface EtchSvgBlockJson extends EtchBlockCommon {
|
|
132
|
-
type:
|
|
132
|
+
type: 'etch/svg';
|
|
133
133
|
/** HTML/SVG attributes. */
|
|
134
134
|
attributes: EtchHtmlAttributes;
|
|
135
135
|
}
|
|
136
136
|
/** A loop block (`etch/loop`) that repeats its children over a data source. */
|
|
137
137
|
interface EtchLoopBlockJson extends EtchBlockCommon {
|
|
138
|
-
type:
|
|
138
|
+
type: 'etch/loop';
|
|
139
139
|
/** Variable name bound to the current item (e.g. `item`). */
|
|
140
140
|
itemId: string;
|
|
141
141
|
/** What the block iterates over (a dynamic path); omitted when bound via `loopId`. */
|
|
@@ -149,13 +149,13 @@ interface EtchLoopBlockJson extends EtchBlockCommon {
|
|
|
149
149
|
}
|
|
150
150
|
/** A conditional block (`etch/condition`); renders its children when the expression holds. */
|
|
151
151
|
interface EtchConditionBlockJson extends EtchBlockCommon {
|
|
152
|
-
type:
|
|
152
|
+
type: 'etch/condition';
|
|
153
153
|
/** The condition expression. */
|
|
154
154
|
conditionString: string;
|
|
155
155
|
}
|
|
156
156
|
/** An instance of a reusable component (`etch/component`). */
|
|
157
157
|
interface EtchComponentBlockJson extends EtchBlockCommon {
|
|
158
|
-
type:
|
|
158
|
+
type: 'etch/component';
|
|
159
159
|
/** Id of the component being instantiated. */
|
|
160
160
|
componentId: number;
|
|
161
161
|
/** Values bound to the component's properties. */
|
|
@@ -163,23 +163,23 @@ interface EtchComponentBlockJson extends EtchBlockCommon {
|
|
|
163
163
|
}
|
|
164
164
|
/** Content projected into a component slot (`etch/slot-content`). */
|
|
165
165
|
interface EtchSlotContentBlockJson extends EtchBlockCommon {
|
|
166
|
-
type:
|
|
166
|
+
type: 'etch/slot-content';
|
|
167
167
|
/** Name of the slot this content targets. */
|
|
168
168
|
slotName: string;
|
|
169
169
|
}
|
|
170
170
|
/** A slot placeholder inside a component definition (`etch/slot-placeholder`). */
|
|
171
171
|
interface EtchSlotPlaceholderBlockJson extends EtchBlockCommon {
|
|
172
|
-
type:
|
|
172
|
+
type: 'etch/slot-placeholder';
|
|
173
173
|
/** Name of the slot. */
|
|
174
174
|
slotName: string;
|
|
175
175
|
}
|
|
176
176
|
/** The post-content insertion point (`etch/post-content`). No extra fields. */
|
|
177
177
|
interface EtchPostContentBlockJson extends EtchBlockCommon {
|
|
178
|
-
type:
|
|
178
|
+
type: 'etch/post-content';
|
|
179
179
|
}
|
|
180
180
|
/** A raw-HTML block (`etch/raw-html`). */
|
|
181
181
|
interface EtchRawHtmlBlockJson extends EtchBlockCommon {
|
|
182
|
-
type:
|
|
182
|
+
type: 'etch/raw-html';
|
|
183
183
|
/** Sanitized HTML content. */
|
|
184
184
|
content: string;
|
|
185
185
|
/** The original, unsanitized HTML as authored. */
|
|
@@ -187,7 +187,7 @@ interface EtchRawHtmlBlockJson extends EtchBlockCommon {
|
|
|
187
187
|
}
|
|
188
188
|
/** A pass-through wrapper around a native Gutenberg block (`etch/passthrough`). */
|
|
189
189
|
interface EtchPassthroughBlockJson extends EtchBlockCommon {
|
|
190
|
-
type:
|
|
190
|
+
type: 'etch/passthrough';
|
|
191
191
|
/** The wrapped Gutenberg block. */
|
|
192
192
|
gutenbergBlock: GutenbergBlock;
|
|
193
193
|
}
|
|
@@ -201,7 +201,7 @@ interface EtchPassthroughBlockJson extends EtchBlockCommon {
|
|
|
201
201
|
*/
|
|
202
202
|
type EtchBlockJson = EtchTextBlockJson | EtchElementBlockJson | EtchDynamicElementBlockJson | EtchDynamicImageBlockJson | EtchSvgBlockJson | EtchLoopBlockJson | EtchConditionBlockJson | EtchComponentBlockJson | EtchSlotContentBlockJson | EtchSlotPlaceholderBlockJson | EtchPostContentBlockJson | EtchRawHtmlBlockJson | EtchPassthroughBlockJson;
|
|
203
203
|
/** Every known block `type` string (the discriminants of {@link EtchBlockJson}). */
|
|
204
|
-
type EtchBlockTypeName = EtchBlockJson[
|
|
204
|
+
type EtchBlockTypeName = EtchBlockJson['type'];
|
|
205
205
|
/** Read-only identity attached to every serialized (read) block. */
|
|
206
206
|
interface BlockIdentity {
|
|
207
207
|
/** Stable id of this block. */
|
|
@@ -217,7 +217,7 @@ interface BlockIdentity {
|
|
|
217
217
|
* writable {@link EtchBlockJson}, so they cannot be set via
|
|
218
218
|
* `blocks.create()` / `blocks.replace()`.
|
|
219
219
|
*/
|
|
220
|
-
type StyledBlockType =
|
|
220
|
+
type StyledBlockType = 'etch/element' | 'etch/dynamic-element' | 'etch/dynamic-image' | 'etch/svg';
|
|
221
221
|
/** The read-only `styles` exposed on a {@link StyledBlockType} when reading. */
|
|
222
222
|
interface ReadOnlyBlockStyles {
|
|
223
223
|
/** Ids of the global styles applied to this block (read-only). */
|
|
@@ -227,7 +227,7 @@ interface ReadOnlyBlockStyles {
|
|
|
227
227
|
* Attach read-only identity (`id`/`parentId`) to a block, recursively, plus the
|
|
228
228
|
* read-only `styles` array for the {@link StyledBlockType}s that carry one.
|
|
229
229
|
*/
|
|
230
|
-
type WithIdentity<B> = B extends EtchBlockCommon ? Omit<B,
|
|
230
|
+
type WithIdentity<B> = B extends EtchBlockCommon ? Omit<B, 'children'> & BlockIdentity & (B extends {
|
|
231
231
|
type: StyledBlockType;
|
|
232
232
|
} ? ReadOnlyBlockStyles : unknown) : never;
|
|
233
233
|
/**
|
|
@@ -265,6 +265,50 @@ interface BlockPatch {
|
|
|
265
265
|
/** Replace the text content. Only valid on text blocks. */
|
|
266
266
|
text?: string;
|
|
267
267
|
}
|
|
268
|
+
/**
|
|
269
|
+
* A portable, JSON-serializable snapshot of a block subtree produced by
|
|
270
|
+
* {@link EtchBlocksApi.copy} and consumed by {@link EtchBlocksApi.pasteAsync}.
|
|
271
|
+
*
|
|
272
|
+
* Treat it as an **opaque token**: store it, send it over the wire, or hand it
|
|
273
|
+
* straight back to `pasteAsync()`. The fields below are documented so you can
|
|
274
|
+
* inspect a payload, but the bundled `styles` / `loops` / `components` /
|
|
275
|
+
* `customMediaDefinitions` are Etch-internal definitions that `pasteAsync()`
|
|
276
|
+
* re-creates and re-maps to fresh ids — don't depend on their internal shape or
|
|
277
|
+
* mutate them.
|
|
278
|
+
*
|
|
279
|
+
* Unlike the builder's Cmd-C / Cmd-V shortcuts, `copy()` / `pasteAsync()` never
|
|
280
|
+
* touch the system clipboard, so they work for fully programmatic flows (no
|
|
281
|
+
* user gesture or clipboard permission required).
|
|
282
|
+
*/
|
|
283
|
+
interface CopyObject {
|
|
284
|
+
/** Payload kind. Currently always `"block"`. */
|
|
285
|
+
type: 'block';
|
|
286
|
+
/**
|
|
287
|
+
* Payload schema version, derived from the features the copied block uses.
|
|
288
|
+
* `paste()` migrates older payloads forward, so pass it back unchanged.
|
|
289
|
+
*/
|
|
290
|
+
version: number;
|
|
291
|
+
/** The copied block subtree in Gutenberg block grammar. */
|
|
292
|
+
gutenbergBlock: GutenbergBlock;
|
|
293
|
+
/** Global styles referenced by the block, keyed by style id (opaque). */
|
|
294
|
+
styles?: {
|
|
295
|
+
[styleId: string]: unknown;
|
|
296
|
+
};
|
|
297
|
+
/** Loop definitions referenced by the block, keyed by loop id (opaque). */
|
|
298
|
+
loops?: {
|
|
299
|
+
[loopId: string]: unknown;
|
|
300
|
+
};
|
|
301
|
+
/** Component definitions referenced by the block, keyed by component id (opaque). */
|
|
302
|
+
components?: {
|
|
303
|
+
[componentId: number]: unknown;
|
|
304
|
+
};
|
|
305
|
+
/** `@custom-media` definitions referenced by the block's styles (opaque). */
|
|
306
|
+
customMediaDefinitions?: {
|
|
307
|
+
[name: string]: unknown;
|
|
308
|
+
};
|
|
309
|
+
/** ISO 8601 timestamp of when the copy was produced. */
|
|
310
|
+
timestamp?: string;
|
|
311
|
+
}
|
|
268
312
|
/** Block selection, reading, structure and property edits. */
|
|
269
313
|
interface EtchBlocksApi {
|
|
270
314
|
/** Select a block in the canvas by id. */
|
|
@@ -281,9 +325,10 @@ interface EtchBlocksApi {
|
|
|
281
325
|
find(predicate: FindBlocksPredicate): string[];
|
|
282
326
|
/**
|
|
283
327
|
* Build a block from JSON and insert it; returns the new block id.
|
|
284
|
-
* `parentId` defaults to the document root
|
|
328
|
+
* `parentId` defaults to the document root (`null` is treated the same as
|
|
329
|
+
* omitting it, matching {@link move}), `index` to the end of the parent.
|
|
285
330
|
*/
|
|
286
|
-
create(json: EtchBlockJson, parentId?: string, index?: number): string;
|
|
331
|
+
create(json: EtchBlockJson, parentId?: string | null, index?: number): string;
|
|
287
332
|
/** Remove a block and its entire subtree. */
|
|
288
333
|
delete(blockId: string): void;
|
|
289
334
|
/** Deep-copy a block next to the original; returns the new block's id. */
|
|
@@ -297,6 +342,32 @@ interface EtchBlocksApi {
|
|
|
297
342
|
replace(blockId: string, json: EtchBlockJson): string;
|
|
298
343
|
/** Patch a block's common editable properties in place (keeps id/children). */
|
|
299
344
|
update(blockId: string, patch: BlockPatch): void;
|
|
345
|
+
/**
|
|
346
|
+
* Serialize a block and its subtree — along with the global styles, loops and
|
|
347
|
+
* components it references — into a portable {@link CopyObject}. The result is
|
|
348
|
+
* plain JSON: hold it, persist it, or pass it to {@link pasteAsync}. Unlike the
|
|
349
|
+
* Cmd-C shortcut this does **not** write to the system clipboard. Throws
|
|
350
|
+
* `BLOCK_NOT_FOUND` for an unknown id.
|
|
351
|
+
*/
|
|
352
|
+
copy(blockId: string): CopyObject;
|
|
353
|
+
/**
|
|
354
|
+
* Insert a block previously produced by {@link copy}. Any styles, loops and
|
|
355
|
+
* components it carries are re-created and re-mapped to fresh ids. Resolves to
|
|
356
|
+
* the id of the newly inserted block. Throws `INVALID_ARGUMENT` for a
|
|
357
|
+
* malformed payload and `BLOCK_NOT_FOUND` for an unknown `targetId`.
|
|
358
|
+
*
|
|
359
|
+
* Placement (mirrors {@link create}):
|
|
360
|
+
* - **No `targetId`** (omitted or `null`) — appended to the document root, or
|
|
361
|
+
* inserted there at `index` when given.
|
|
362
|
+
* - **`targetId` + `index`** — inserted as a child of the target at `index`.
|
|
363
|
+
* - **`targetId`, no `index`** — inserted into the target when it accepts
|
|
364
|
+
* children, otherwise immediately after it (handy for "paste near this
|
|
365
|
+
* block").
|
|
366
|
+
*
|
|
367
|
+
* `index` is clamped to the valid range; a negative `index` counts from the
|
|
368
|
+
* end (`-1` appends).
|
|
369
|
+
*/
|
|
370
|
+
pasteAsync(payload: CopyObject, targetId?: string | null, index?: number): Promise<string>;
|
|
300
371
|
/** Set the text content of a text block. */
|
|
301
372
|
setText(blockId: string, text: string): void;
|
|
302
373
|
/** Rename a block (sets its label / display name). */
|
|
@@ -390,9 +461,9 @@ interface MetaQueryItem {
|
|
|
390
461
|
/** The value(s) to compare against. */
|
|
391
462
|
value: string | number | Array<string | number>;
|
|
392
463
|
/** Comparison operator (defaults to `=`). */
|
|
393
|
-
compare?:
|
|
464
|
+
compare?: '=' | '!=' | '>' | '>=' | '<' | '<=' | 'LIKE' | 'NOT LIKE' | 'IN' | 'NOT IN' | 'BETWEEN' | 'NOT BETWEEN' | 'EXISTS' | 'NOT EXISTS';
|
|
394
465
|
/** SQL type the value is cast to before comparison. */
|
|
395
|
-
type?:
|
|
466
|
+
type?: 'NUMERIC' | 'BINARY' | 'CHAR' | 'DATE' | 'DATETIME' | 'DECIMAL' | 'SIGNED' | 'TIME' | 'UNSIGNED';
|
|
396
467
|
[key: string]: unknown;
|
|
397
468
|
}
|
|
398
469
|
/**
|
|
@@ -403,11 +474,11 @@ interface TaxQueryItem {
|
|
|
403
474
|
/** The taxonomy to query (e.g. `category`, `post_tag`). */
|
|
404
475
|
taxonomy: string;
|
|
405
476
|
/** Which term field `terms` refers to. */
|
|
406
|
-
field:
|
|
477
|
+
field: 'term_id' | 'slug' | 'name';
|
|
407
478
|
/** The term(s) to match. */
|
|
408
479
|
terms: string | number | Array<string | number>;
|
|
409
480
|
/** How to match the terms (defaults to `IN`). */
|
|
410
|
-
operator?:
|
|
481
|
+
operator?: 'IN' | 'NOT IN' | 'AND';
|
|
411
482
|
/** Whether to include child terms of a hierarchical taxonomy. */
|
|
412
483
|
include_children?: boolean;
|
|
413
484
|
[key: string]: unknown;
|
|
@@ -429,11 +500,11 @@ interface WpQueryArgs {
|
|
|
429
500
|
/** Alias of `paged` used in some contexts. */
|
|
430
501
|
page?: NumericParam;
|
|
431
502
|
/** Field to order results by. */
|
|
432
|
-
orderby?:
|
|
503
|
+
orderby?: 'date' | 'title' | 'menu_order' | 'rand' | 'ID' | 'author' | 'name' | 'modified' | 'parent' | 'comment_count' | (string & {});
|
|
433
504
|
/** Sort direction. */
|
|
434
|
-
order?:
|
|
505
|
+
order?: 'ASC' | 'DESC' | (string & {});
|
|
435
506
|
/** Post status to include. */
|
|
436
|
-
post_status?:
|
|
507
|
+
post_status?: 'publish' | 'pending' | 'draft' | 'auto-draft' | 'future' | 'private' | 'inherit' | 'trash' | (string & {});
|
|
437
508
|
/** Whether to ignore sticky posts. */
|
|
438
509
|
ignore_sticky_posts?: BooleanParam;
|
|
439
510
|
/** Author id (number) or username (string). */
|
|
@@ -459,9 +530,9 @@ interface WpTermsArgs {
|
|
|
459
530
|
/** Taxonomy to fetch terms from. */
|
|
460
531
|
taxonomy?: string;
|
|
461
532
|
/** Field to order terms by. */
|
|
462
|
-
orderby?:
|
|
533
|
+
orderby?: 'name' | 'slug' | 'term_group' | 'term_id' | 'description' | 'count' | (string & {});
|
|
463
534
|
/** Sort direction. */
|
|
464
|
-
order?:
|
|
535
|
+
order?: 'ASC' | 'DESC' | (string & {});
|
|
465
536
|
[key: string]: unknown;
|
|
466
537
|
}
|
|
467
538
|
/** WordPress user query arguments (extensible). */
|
|
@@ -477,9 +548,9 @@ interface WpUsersArgs {
|
|
|
477
548
|
/** Columns the `search` keyword is matched against. */
|
|
478
549
|
search_columns?: string[] | string;
|
|
479
550
|
/** Field to order users by. */
|
|
480
|
-
orderby?:
|
|
551
|
+
orderby?: 'ID' | 'display_name' | 'name' | 'user_login' | 'user_email' | 'user_registered' | 'post_count' | 'meta_value' | 'meta_value_num' | (string & {});
|
|
481
552
|
/** Sort direction. */
|
|
482
|
-
order?:
|
|
553
|
+
order?: 'ASC' | 'DESC' | (string & {});
|
|
483
554
|
/** Number of users to return. */
|
|
484
555
|
number?: NumericParam;
|
|
485
556
|
/** Number of users to skip. */
|
|
@@ -490,19 +561,19 @@ interface WpUsersArgs {
|
|
|
490
561
|
}
|
|
491
562
|
/** Type-specific configuration of an {@link EtchLoop}, discriminated by `type`. */
|
|
492
563
|
type EtchLoopConfig = {
|
|
493
|
-
type:
|
|
564
|
+
type: 'wp-query';
|
|
494
565
|
args: WpQueryArgs;
|
|
495
566
|
} | {
|
|
496
|
-
type:
|
|
567
|
+
type: 'wp-terms';
|
|
497
568
|
args: WpTermsArgs;
|
|
498
569
|
} | {
|
|
499
|
-
type:
|
|
570
|
+
type: 'wp-users';
|
|
500
571
|
args: WpUsersArgs;
|
|
501
572
|
} | {
|
|
502
|
-
type:
|
|
573
|
+
type: 'main-query';
|
|
503
574
|
args: WpQueryArgs;
|
|
504
575
|
} | {
|
|
505
|
-
type:
|
|
576
|
+
type: 'json';
|
|
506
577
|
data: unknown[];
|
|
507
578
|
};
|
|
508
579
|
/** A loop definition (extensible). */
|
|
@@ -566,7 +637,7 @@ interface EtchLoopsApi {
|
|
|
566
637
|
* - `attribute` — `[data-foo]`, `[type="submit"]`, etc.
|
|
567
638
|
* - `custom` — anything else (pseudo-classes, combinators, etc.)
|
|
568
639
|
*/
|
|
569
|
-
type StyleSelectorType =
|
|
640
|
+
type StyleSelectorType = 'class' | 'id' | 'tag' | 'element' | 'attribute' | 'custom';
|
|
570
641
|
/** A style entry as returned by `styles.list()`. */
|
|
571
642
|
interface StyleSummary {
|
|
572
643
|
/** Stable id of the style rule. */
|
|
@@ -653,7 +724,7 @@ interface EtchStylesApi {
|
|
|
653
724
|
* Global stylesheet shapes and the `etch.stylesheets` API surface.
|
|
654
725
|
*/
|
|
655
726
|
/** Type of a global stylesheet. */
|
|
656
|
-
type StylesheetType =
|
|
727
|
+
type StylesheetType = 'default' | '@custom-media';
|
|
657
728
|
/** A global stylesheet entry. */
|
|
658
729
|
interface StylesheetSummary {
|
|
659
730
|
/** Stable id of the stylesheet. */
|
|
@@ -754,8 +825,8 @@ type SelectOptionsString = string;
|
|
|
754
825
|
*/
|
|
755
826
|
interface StringComponentProperty {
|
|
756
827
|
type: {
|
|
757
|
-
primitive:
|
|
758
|
-
specialized?:
|
|
828
|
+
primitive: 'string';
|
|
829
|
+
specialized?: 'color' | 'url' | 'image' | 'select' | 'array' | 'wpMediaId';
|
|
759
830
|
};
|
|
760
831
|
/** Default value. */
|
|
761
832
|
default?: string;
|
|
@@ -777,7 +848,7 @@ interface StringComponentProperty {
|
|
|
777
848
|
*/
|
|
778
849
|
interface NumberComponentProperty {
|
|
779
850
|
type: {
|
|
780
|
-
primitive:
|
|
851
|
+
primitive: 'number';
|
|
781
852
|
};
|
|
782
853
|
/** Default value. */
|
|
783
854
|
default?: number;
|
|
@@ -787,7 +858,7 @@ interface NumberComponentProperty {
|
|
|
787
858
|
/** A boolean property. */
|
|
788
859
|
interface BooleanComponentProperty {
|
|
789
860
|
type: {
|
|
790
|
-
primitive:
|
|
861
|
+
primitive: 'boolean';
|
|
791
862
|
};
|
|
792
863
|
/** Default value (a string is allowed for expression-driven defaults). */
|
|
793
864
|
default?: boolean | string;
|
|
@@ -801,7 +872,7 @@ interface BooleanComponentProperty {
|
|
|
801
872
|
*/
|
|
802
873
|
interface ObjectComponentProperty {
|
|
803
874
|
type: {
|
|
804
|
-
primitive:
|
|
875
|
+
primitive: 'object';
|
|
805
876
|
specialized?: string;
|
|
806
877
|
};
|
|
807
878
|
/** Default value. */
|
|
@@ -816,7 +887,7 @@ interface ObjectComponentProperty {
|
|
|
816
887
|
*/
|
|
817
888
|
interface ArrayComponentProperty {
|
|
818
889
|
type: {
|
|
819
|
-
primitive:
|
|
890
|
+
primitive: 'array';
|
|
820
891
|
specialized?: string;
|
|
821
892
|
};
|
|
822
893
|
/** Default value. */
|
|
@@ -825,8 +896,8 @@ interface ArrayComponentProperty {
|
|
|
825
896
|
/** A list of CSS class names — an `array` specialized as `'class'`. */
|
|
826
897
|
interface ClassComponentProperty {
|
|
827
898
|
type: {
|
|
828
|
-
primitive:
|
|
829
|
-
specialized:
|
|
899
|
+
primitive: 'array';
|
|
900
|
+
specialized: 'class';
|
|
830
901
|
};
|
|
831
902
|
/** Default value. */
|
|
832
903
|
default?: string[];
|
|
@@ -834,8 +905,8 @@ interface ClassComponentProperty {
|
|
|
834
905
|
/** A group of nested properties — an `object` specialized as `'group'` (no default). */
|
|
835
906
|
interface GroupComponentProperty {
|
|
836
907
|
type: {
|
|
837
|
-
primitive:
|
|
838
|
-
specialized:
|
|
908
|
+
primitive: 'object';
|
|
909
|
+
specialized: 'group';
|
|
839
910
|
};
|
|
840
911
|
/** The nested properties in this group. */
|
|
841
912
|
properties: ComponentProperty[];
|
|
@@ -843,8 +914,8 @@ interface GroupComponentProperty {
|
|
|
843
914
|
/** A repeatable group — an `array` specialized as `'repeater'` (no default). */
|
|
844
915
|
interface RepeaterComponentProperty {
|
|
845
916
|
type: {
|
|
846
|
-
primitive:
|
|
847
|
-
specialized:
|
|
917
|
+
primitive: 'array';
|
|
918
|
+
specialized: 'repeater';
|
|
848
919
|
};
|
|
849
920
|
/** The nested properties repeated per row. */
|
|
850
921
|
properties: ComponentProperty[];
|
|
@@ -852,8 +923,8 @@ interface RepeaterComponentProperty {
|
|
|
852
923
|
/** A conditional group gated by an expression — a `string` specialized as `'condition'`. */
|
|
853
924
|
interface ConditionComponentProperty {
|
|
854
925
|
type: {
|
|
855
|
-
primitive:
|
|
856
|
-
specialized:
|
|
926
|
+
primitive: 'string';
|
|
927
|
+
specialized: 'condition';
|
|
857
928
|
};
|
|
858
929
|
/** The nested properties shown when the condition holds. */
|
|
859
930
|
properties: ComponentProperty[];
|
|
@@ -959,7 +1030,7 @@ interface EtchComponentsApi {
|
|
|
959
1030
|
* - `style-manager` — the global style manager
|
|
960
1031
|
* - `loop-manager` — the loop manager
|
|
961
1032
|
*/
|
|
962
|
-
type NavigationPlace =
|
|
1033
|
+
type NavigationPlace = 'builder' | 'templates' | 'style-manager' | 'content-hub' | 'loop-manager';
|
|
963
1034
|
/** Lightweight post entry returned by `navigation.listPostsAsync()`. */
|
|
964
1035
|
interface PostSummary {
|
|
965
1036
|
/** Post id. */
|
|
@@ -1008,7 +1079,7 @@ interface EtchNavigationApi {
|
|
|
1008
1079
|
* Custom field group/value shapes and the `etch.fields` API surface.
|
|
1009
1080
|
*/
|
|
1010
1081
|
/** Custom field type. Open-ended for future field types. */
|
|
1011
|
-
type CustomFieldType =
|
|
1082
|
+
type CustomFieldType = 'text' | 'textarea' | 'number' | 'boolean' | (string & {});
|
|
1012
1083
|
/** A custom field definition (extensible). */
|
|
1013
1084
|
interface CustomField {
|
|
1014
1085
|
/** Display label. */
|
|
@@ -1026,13 +1097,13 @@ interface CustomField {
|
|
|
1026
1097
|
/** Where a custom field group is assigned. */
|
|
1027
1098
|
type CustomFieldAssignment = {
|
|
1028
1099
|
post_types: string[];
|
|
1029
|
-
op:
|
|
1100
|
+
op: 'isIn' | 'isNotIn';
|
|
1030
1101
|
} | {
|
|
1031
1102
|
post_ids: number[];
|
|
1032
|
-
op:
|
|
1103
|
+
op: 'isIn' | 'isNotIn';
|
|
1033
1104
|
} | {
|
|
1034
1105
|
taxonomies: string[];
|
|
1035
|
-
op:
|
|
1106
|
+
op: 'isIn' | 'isNotIn';
|
|
1036
1107
|
};
|
|
1037
1108
|
/** A custom field group definition (extensible). */
|
|
1038
1109
|
interface CustomFieldGroup {
|
|
@@ -1128,7 +1199,7 @@ interface EtchFieldsApi {
|
|
|
1128
1199
|
* Builder chrome controls (`etch.ui`) and undo/redo (`etch.history`).
|
|
1129
1200
|
*/
|
|
1130
1201
|
/** Canvas color scheme. */
|
|
1131
|
-
type ColorScheme =
|
|
1202
|
+
type ColorScheme = 'light' | 'dark';
|
|
1132
1203
|
/** Builder app/chrome controls: color scheme, interface visibility, exit. */
|
|
1133
1204
|
interface EtchUiApi {
|
|
1134
1205
|
/** The current canvas color scheme. */
|
|
@@ -1352,4 +1423,4 @@ declare function isEtchApiError(value: unknown): value is EtchApiError;
|
|
|
1352
1423
|
*/
|
|
1353
1424
|
declare const ETCH_API_VERSION = "0.x";
|
|
1354
1425
|
|
|
1355
|
-
export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
|
|
1426
|
+
export { type ArrayComponentProperty, type BlockLoopBinding, type BlockPatch, type BooleanComponentProperty, type BooleanParam, type BridgeConnectOptions, type ClassComponentProperty, type ColorScheme, type ComponentPatch, type ComponentProperty, type ComponentPropertyBase, type ConditionComponentProperty, type ConnectOptions, type CopyObject, type CustomField, type CustomFieldAssignment, type CustomFieldGroup, type CustomFieldType, ETCH_API_VERSION, type Etch, EtchApiError, type EtchApiErrorCode, type EtchBlockCommon, type EtchBlockContext, type EtchBlockJson, type EtchBlockOptions, type EtchBlockScript, type EtchBlockType, type EtchBlockTypeName, type EtchBlocksApi, type EtchBridgeConnection, type EtchComponentBlockJson, type EtchComponentsApi, type EtchConditionBlockJson, type EtchDynamicElementBlockJson, type EtchDynamicImageBlockJson, type EtchElementBlockJson, type EtchFieldsApi, type EtchHistoryApi, type EtchHtmlAttributes, type EtchLoop, type EtchLoopBlockJson, type EtchLoopConfig, type EtchLoopObj, type EtchLoopsApi, type EtchNavigationApi, type EtchPassthroughBlockJson, type EtchPostContentBlockJson, type EtchRawHtmlBlockJson, type EtchSlotContentBlockJson, type EtchSlotPlaceholderBlockJson, type EtchStylesApi, type EtchStylesheetsApi, type EtchSvgBlockJson, type EtchTextBlockJson, type EtchUiApi, type FindBlocksPredicate, type GroupComponentProperty, type GutenbergBlock, type LoopParamRef, type MetaQueryItem, type NavigationPlace, type NumberComponentProperty, type NumericParam, type ObjectComponentProperty, type PostCustomFieldGroupEntry, type PostCustomFieldValueEntry, type PostCustomFieldValueResponse, type PostCustomFieldValuesResponse, type PostSummary, type PublicBlockJson, type PublicComponentJson, type PublicComponentSummary, type RepeaterComponentProperty, type ResolvedCustomField, type SelectOptionsString, type StringComponentProperty, type StyleListFilter, type StylePatch, type StyleSelectorType, type StyleSummary, type StylesheetInput, type StylesheetPatch, type StylesheetSummary, type StylesheetType, type TaxQueryItem, type TemplateSummary, type WpQueryArgs, type WpTermsArgs, type WpUsersArgs, getEtch, isEtchApiError, isEtchAvailable };
|