@digital-gravy/etch-public-api 0.3.1 → 0.3.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/dist/index.d.cts CHANGED
@@ -112,6 +112,16 @@ interface EtchDynamicElementBlockJson extends EtchBlockCommon {
112
112
  *
113
113
  * The global `styles` applied to the block are **read-only** (see
114
114
  * {@link EtchElementBlockJson}).
115
+ *
116
+ * **Special attributes** (in addition to standard `<img>` attributes):
117
+ * - `mediaId` — WordPress attachment post ID. When set, Etch fetches the media
118
+ * object and uses its URL as `src`, overriding any explicit `src` attribute.
119
+ * Supports dynamic expressions (`{post.featured_image_id}`).
120
+ * - `useSrcSet` — `"true"` to generate a responsive `srcset` from the media
121
+ * (only effective when `mediaId` is set).
122
+ * - `maximumSize` — maximum WordPress image size slug (e.g. `"large"`,
123
+ * `"full"`) used when building `srcset` / resolving the image URL. Defaults
124
+ * to `"full"` when omitted.
115
125
  */
116
126
  interface EtchDynamicImageBlockJson extends EtchBlockCommon {
117
127
  type: "etch/dynamic-image";
@@ -123,6 +133,13 @@ interface EtchDynamicImageBlockJson extends EtchBlockCommon {
123
133
  *
124
134
  * The global `styles` applied to the block are **read-only** (see
125
135
  * {@link EtchElementBlockJson}).
136
+ *
137
+ * **Special attributes** (in addition to standard SVG attributes):
138
+ * - `src` — URL of an external `.svg` file. When set, Etch fetches the file and
139
+ * inlines its contents at render time. Supports dynamic expressions.
140
+ * - `stripColors` — `"true"` to strip `fill` and `stroke` colour declarations
141
+ * from the fetched SVG so CSS can drive its colours instead. Only effective
142
+ * when `src` is set.
126
143
  */
127
144
  interface EtchSvgBlockJson extends EtchBlockCommon {
128
145
  type: "etch/svg";
@@ -764,7 +781,11 @@ interface PublicComponentSummary {
764
781
  id: number;
765
782
  /** Display name. */
766
783
  name: string;
767
- /** Stable key used to reference the component in markup. */
784
+ /**
785
+ * Stable key used to reference the component in markup (e.g. `<Card />`).
786
+ * Always **PascalCase**: starts with an uppercase letter, letters and digits
787
+ * only (no dashes, underscores, or spaces).
788
+ */
768
789
  key: string;
769
790
  /** Optional human-readable description. */
770
791
  description?: string;
@@ -780,7 +801,11 @@ interface PublicComponentJson extends PublicComponentSummary {
780
801
  interface ComponentPatch {
781
802
  /** New display name. */
782
803
  name?: string;
783
- /** New reference key. */
804
+ /**
805
+ * New reference key. It is **converted to PascalCase** before it is stored
806
+ * (e.g. `my card` → `MyCard`), so the key actually saved may differ from the
807
+ * string passed here.
808
+ */
784
809
  key?: string;
785
810
  /** New description. */
786
811
  description?: string;
package/dist/index.d.ts CHANGED
@@ -112,6 +112,16 @@ interface EtchDynamicElementBlockJson extends EtchBlockCommon {
112
112
  *
113
113
  * The global `styles` applied to the block are **read-only** (see
114
114
  * {@link EtchElementBlockJson}).
115
+ *
116
+ * **Special attributes** (in addition to standard `<img>` attributes):
117
+ * - `mediaId` — WordPress attachment post ID. When set, Etch fetches the media
118
+ * object and uses its URL as `src`, overriding any explicit `src` attribute.
119
+ * Supports dynamic expressions (`{post.featured_image_id}`).
120
+ * - `useSrcSet` — `"true"` to generate a responsive `srcset` from the media
121
+ * (only effective when `mediaId` is set).
122
+ * - `maximumSize` — maximum WordPress image size slug (e.g. `"large"`,
123
+ * `"full"`) used when building `srcset` / resolving the image URL. Defaults
124
+ * to `"full"` when omitted.
115
125
  */
116
126
  interface EtchDynamicImageBlockJson extends EtchBlockCommon {
117
127
  type: "etch/dynamic-image";
@@ -123,6 +133,13 @@ interface EtchDynamicImageBlockJson extends EtchBlockCommon {
123
133
  *
124
134
  * The global `styles` applied to the block are **read-only** (see
125
135
  * {@link EtchElementBlockJson}).
136
+ *
137
+ * **Special attributes** (in addition to standard SVG attributes):
138
+ * - `src` — URL of an external `.svg` file. When set, Etch fetches the file and
139
+ * inlines its contents at render time. Supports dynamic expressions.
140
+ * - `stripColors` — `"true"` to strip `fill` and `stroke` colour declarations
141
+ * from the fetched SVG so CSS can drive its colours instead. Only effective
142
+ * when `src` is set.
126
143
  */
127
144
  interface EtchSvgBlockJson extends EtchBlockCommon {
128
145
  type: "etch/svg";
@@ -764,7 +781,11 @@ interface PublicComponentSummary {
764
781
  id: number;
765
782
  /** Display name. */
766
783
  name: string;
767
- /** Stable key used to reference the component in markup. */
784
+ /**
785
+ * Stable key used to reference the component in markup (e.g. `<Card />`).
786
+ * Always **PascalCase**: starts with an uppercase letter, letters and digits
787
+ * only (no dashes, underscores, or spaces).
788
+ */
768
789
  key: string;
769
790
  /** Optional human-readable description. */
770
791
  description?: string;
@@ -780,7 +801,11 @@ interface PublicComponentJson extends PublicComponentSummary {
780
801
  interface ComponentPatch {
781
802
  /** New display name. */
782
803
  name?: string;
783
- /** New reference key. */
804
+ /**
805
+ * New reference key. It is **converted to PascalCase** before it is stored
806
+ * (e.g. `my card` → `MyCard`), so the key actually saved may differ from the
807
+ * string passed here.
808
+ */
784
809
  key?: string;
785
810
  /** New description. */
786
811
  description?: string;
package/package.json CHANGED
@@ -1,43 +1,46 @@
1
1
  {
2
- "name": "@digital-gravy/etch-public-api",
3
- "version": "0.3.1",
4
- "description": "MIT-licensed typed client and contract for the Etch builder scripting API (window.etch). Etch itself is a separate proprietary product governed by its own commercial terms.",
5
- "license": "MIT",
6
- "type": "module",
7
- "main": "./dist/index.cjs",
8
- "module": "./dist/index.js",
9
- "types": "./dist/index.d.ts",
10
- "exports": {
11
- ".": {
12
- "types": "./dist/index.d.ts",
13
- "import": "./dist/index.js",
14
- "require": "./dist/index.cjs"
15
- }
16
- },
17
- "files": ["dist", "README.md"],
18
- "sideEffects": false,
19
- "scripts": {
20
- "build": "tsup",
21
- "dev": "tsup --watch",
22
- "test": "vitest run",
23
- "test:watch": "vitest",
24
- "typecheck": "tsc --noEmit",
25
- "prepublishOnly": "bun run build"
26
- },
27
- "keywords": [
28
- "etch",
29
- "etchwp",
30
- "wordpress",
31
- "builder",
32
- "scripting",
33
- "api"
34
- ],
35
- "publishConfig": {
36
- "access": "public"
37
- },
38
- "devDependencies": {
39
- "tsup": "^8.3.5",
40
- "typescript": "^5.7.2",
41
- "vitest": "^3.0.5"
42
- }
2
+ "name": "@digital-gravy/etch-public-api",
3
+ "version": "0.3.2",
4
+ "description": "MIT-licensed typed client and contract for the Etch builder scripting API (window.etch). Etch itself is a separate proprietary product governed by its own commercial terms.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md"
20
+ ],
21
+ "sideEffects": false,
22
+ "scripts": {
23
+ "build": "tsup",
24
+ "dev": "tsup --watch",
25
+ "test": "vitest run",
26
+ "test:watch": "vitest",
27
+ "typecheck": "tsc --noEmit",
28
+ "prepublishOnly": "bun run build"
29
+ },
30
+ "keywords": [
31
+ "etch",
32
+ "etchwp",
33
+ "wordpress",
34
+ "builder",
35
+ "scripting",
36
+ "api"
37
+ ],
38
+ "publishConfig": {
39
+ "access": "public"
40
+ },
41
+ "devDependencies": {
42
+ "tsup": "^8.3.5",
43
+ "typescript": "^5.7.2",
44
+ "vitest": "^3.0.5"
45
+ }
43
46
  }