@salesforce/ui-design-mode 10.9.2 → 10.10.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.
Files changed (35) hide show
  1. package/dist/authoring/core/DesignPropertyPanelRoot.d.cts +31 -1
  2. package/dist/authoring/core/DesignPropertyPanelRoot.d.ts +31 -1
  3. package/dist/authoring/core/DesignPropertyPanelRoot.d.ts.map +1 -1
  4. package/dist/authoring/core/editors/ImageEditor.d.cts +110 -0
  5. package/dist/authoring/core/editors/ImageEditor.d.ts +110 -0
  6. package/dist/authoring/core/editors/ImageEditor.d.ts.map +1 -0
  7. package/dist/authoring/core/history/historyService.d.cts +3 -1
  8. package/dist/authoring/core/history/historyService.d.ts +3 -1
  9. package/dist/authoring/core/history/historyService.d.ts.map +1 -1
  10. package/dist/authoring/core/history/iframeCommandExecutor.d.cts +1 -1
  11. package/dist/authoring/core/history/iframeCommandExecutor.d.ts +1 -1
  12. package/dist/authoring/core/history/iframeCommandExecutor.d.ts.map +1 -1
  13. package/dist/authoring/core/labels/labels.d.cts +106 -0
  14. package/dist/authoring/core/labels/labels.d.ts +106 -0
  15. package/dist/authoring/core/labels/labels.d.ts.map +1 -1
  16. package/dist/authoring/host/index.cjs +111 -0
  17. package/dist/authoring/host/index.d.cts +86 -0
  18. package/dist/authoring/host/index.d.ts +86 -0
  19. package/dist/authoring/host/index.d.ts.map +1 -0
  20. package/dist/authoring/host/index.js +111 -0
  21. package/dist/authoring/react/index.d.cts +2 -1
  22. package/dist/authoring/react/index.d.ts +2 -1
  23. package/dist/authoring/react/index.d.ts.map +1 -1
  24. package/dist/authoring/react/index.js +4 -4
  25. package/dist/authoring/react/styles.css +1 -1
  26. package/dist/authoring/web-component/index.d.cts +8 -1
  27. package/dist/authoring/web-component/index.d.ts +8 -1
  28. package/dist/authoring/web-component/index.d.ts.map +1 -1
  29. package/dist/authoring/web-component/index.js +430 -21
  30. package/dist/protocol/messageTypes.d.cts +13 -1
  31. package/dist/protocol/messageTypes.d.ts +13 -1
  32. package/dist/protocol/messageTypes.d.ts.map +1 -1
  33. package/dist/runtime/design-mode-interactions.js +4 -0
  34. package/dist/runtime/interactions/interactionsController.d.ts.map +1 -1
  35. package/package.json +12 -1
@@ -53,6 +53,7 @@ export interface PanelLabels {
53
53
  ariaElementStyling: string;
54
54
  };
55
55
  sections: {
56
+ imageSource: string;
56
57
  background: string;
57
58
  spacing: string;
58
59
  border: string;
@@ -60,6 +61,7 @@ export interface PanelLabels {
60
61
  elementDimensions: string;
61
62
  };
62
63
  instances: {
64
+ imageSource: string;
63
65
  backgroundColor: string;
64
66
  padding: string;
65
67
  margin: string;
@@ -86,6 +88,40 @@ export interface PanelLabels {
86
88
  overflow: string;
87
89
  };
88
90
  editors: {
91
+ image: {
92
+ tabCms: string;
93
+ tabLocal: string;
94
+ tabUrl: string;
95
+ ariaTablist: string;
96
+ clearImage: string;
97
+ chooseFile: string;
98
+ ariaChooseFile: string;
99
+ useThisImage: string;
100
+ ariaImageUrl: string;
101
+ urlPlaceholder: string;
102
+ previewAlt: string;
103
+ altText: string;
104
+ altPlaceholder: string;
105
+ width: string;
106
+ height: string;
107
+ autoPlaceholder: string;
108
+ workspace: string;
109
+ selectWorkspace: string;
110
+ selectImage: string;
111
+ loadingWorkspaces: string;
112
+ noWorkspaces: string;
113
+ loadingImages: string;
114
+ noImages: string;
115
+ loadingMore: string;
116
+ untitled: string;
117
+ downloadingImage: string;
118
+ downloadFailed: string;
119
+ closePicker: string;
120
+ cancel: string;
121
+ done: string;
122
+ pickerTitle: string;
123
+ pickerError: string;
124
+ };
89
125
  boxDimension: {
90
126
  sides: {
91
127
  top: string;
@@ -239,6 +275,8 @@ export declare const REQUIRED_LABEL_KEYS: readonly [{
239
275
  readonly path: "general.ariaSelectedComponent";
240
276
  }, {
241
277
  readonly path: "general.ariaElementStyling";
278
+ }, {
279
+ readonly path: "sections.imageSource";
242
280
  }, {
243
281
  readonly path: "sections.background";
244
282
  }, {
@@ -249,6 +287,8 @@ export declare const REQUIRED_LABEL_KEYS: readonly [{
249
287
  readonly path: "sections.typography";
250
288
  }, {
251
289
  readonly path: "sections.elementDimensions";
290
+ }, {
291
+ readonly path: "instances.imageSource";
252
292
  }, {
253
293
  readonly path: "instances.backgroundColor";
254
294
  }, {
@@ -297,6 +337,72 @@ export declare const REQUIRED_LABEL_KEYS: readonly [{
297
337
  readonly path: "instances.maxHeight";
298
338
  }, {
299
339
  readonly path: "instances.overflow";
340
+ }, {
341
+ readonly path: "editors.image.tabCms";
342
+ }, {
343
+ readonly path: "editors.image.tabLocal";
344
+ }, {
345
+ readonly path: "editors.image.tabUrl";
346
+ }, {
347
+ readonly path: "editors.image.ariaTablist";
348
+ }, {
349
+ readonly path: "editors.image.clearImage";
350
+ }, {
351
+ readonly path: "editors.image.chooseFile";
352
+ }, {
353
+ readonly path: "editors.image.ariaChooseFile";
354
+ }, {
355
+ readonly path: "editors.image.useThisImage";
356
+ }, {
357
+ readonly path: "editors.image.ariaImageUrl";
358
+ }, {
359
+ readonly path: "editors.image.urlPlaceholder";
360
+ }, {
361
+ readonly path: "editors.image.previewAlt";
362
+ }, {
363
+ readonly path: "editors.image.altText";
364
+ }, {
365
+ readonly path: "editors.image.altPlaceholder";
366
+ }, {
367
+ readonly path: "editors.image.width";
368
+ }, {
369
+ readonly path: "editors.image.height";
370
+ }, {
371
+ readonly path: "editors.image.autoPlaceholder";
372
+ }, {
373
+ readonly path: "editors.image.workspace";
374
+ }, {
375
+ readonly path: "editors.image.selectWorkspace";
376
+ }, {
377
+ readonly path: "editors.image.selectImage";
378
+ }, {
379
+ readonly path: "editors.image.loadingWorkspaces";
380
+ }, {
381
+ readonly path: "editors.image.noWorkspaces";
382
+ }, {
383
+ readonly path: "editors.image.loadingImages";
384
+ }, {
385
+ readonly path: "editors.image.noImages";
386
+ }, {
387
+ readonly path: "editors.image.loadingMore";
388
+ }, {
389
+ readonly path: "editors.image.untitled";
390
+ }, {
391
+ readonly path: "editors.image.downloadingImage";
392
+ }, {
393
+ readonly path: "editors.image.downloadFailed";
394
+ }, {
395
+ readonly path: "editors.image.closePicker";
396
+ }, {
397
+ readonly path: "editors.image.cancel";
398
+ }, {
399
+ readonly path: "editors.image.done";
400
+ }, {
401
+ readonly path: "editors.image.pickerTitle";
402
+ readonly placeholders: readonly [0];
403
+ }, {
404
+ readonly path: "editors.image.pickerError";
405
+ readonly placeholders: readonly [0];
300
406
  }, {
301
407
  readonly path: "editors.boxDimension.sides.top";
302
408
  }, {
@@ -1 +1 @@
1
- {"version":3,"file":"labels.d.ts","sourceRoot":"","sources":["../../../../src/authoring/core/labels/labels.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAEH,kFAAkF;AAClF,MAAM,WAAW,WAAW;IAE3B,OAAO,EAAE;QACR,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,EAAE,MAAM,CAAC;QACzB,kBAAkB,EAAE,MAAM,CAAC;QAC3B,qBAAqB,EAAE,MAAM,CAAC;QAC9B,gBAAgB,EAAE,MAAM,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;QAC1B,qBAAqB,EAAE,MAAM,CAAC;QAC9B,kBAAkB,EAAE,MAAM,CAAC;KAC3B,CAAC;IAGF,QAAQ,EAAE;QACT,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,iBAAiB,EAAE,MAAM,CAAC;KAC1B,CAAC;IAGF,SAAS,EAAE;QACV,eAAe,EAAE,MAAM,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,U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AAC,SAAS,EAAE,MAAM,CAAC;gBAAC,UAAU,EAAE,MAAM,CAAA;aAAE,CAAC;SACpF,CAAC;QAGF,UAAU,EAAE;YAAE,OAAO,EAAE;gBAAE,OAAO,EAAE,MAAM,CAAA;aAAE,CAAA;SAAE,CAAC;KAC7C,CAAC;CACF;AAED;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,GAAG,MAAM,CAKxF;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,CAAC,CAgBjE;AAED;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB;IAChC,iFAAiF;IACjF,IAAI,EAAE,MAAM,CAAC;IACb,gFAAgF;IAChF,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACjC;AAED,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkJgB,CAAC;AAgBjD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,EAAE,CAyBxD"}
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const ASSETS_DIR = "src/assets/images";
4
+ const DEV_URL_PREFIX = "/src/assets/images";
5
+ const MAX_FILENAME_COLLISIONS = 1e3;
6
+ const EXT_BY_MIME = {
7
+ "image/png": ".png",
8
+ "image/jpeg": ".jpg",
9
+ "image/gif": ".gif",
10
+ "image/webp": ".webp",
11
+ "image/svg+xml": ".svg"
12
+ };
13
+ const MIME_BY_EXT = {
14
+ png: "image/png",
15
+ jpg: "image/jpeg",
16
+ jpeg: "image/jpeg",
17
+ gif: "image/gif",
18
+ webp: "image/webp",
19
+ svg: "image/svg+xml"
20
+ };
21
+ const normalizeSeparators = (p) => p.replace(/\\/g, "/");
22
+ const dirname = (p) => {
23
+ const normalized = normalizeSeparators(p).replace(/\/+$/, "");
24
+ const idx = normalized.lastIndexOf("/");
25
+ if (idx < 0) return "";
26
+ return idx === 0 ? "/" : normalized.slice(0, idx);
27
+ };
28
+ const basename = (p) => {
29
+ const normalized = normalizeSeparators(p).replace(/\/+$/, "");
30
+ const idx = normalized.lastIndexOf("/");
31
+ return idx < 0 ? normalized : normalized.slice(idx + 1);
32
+ };
33
+ const extname = (filename) => {
34
+ const base = basename(filename);
35
+ const idx = base.lastIndexOf(".");
36
+ return idx <= 0 ? "" : base.slice(idx);
37
+ };
38
+ const joinPath = (...segments) => segments.map((s) => normalizeSeparators(s)).join("/").replace(/\/{2,}/g, "/");
39
+ const mimeTypeForFilename = (filename) => {
40
+ const ext = extname(filename).slice(1).toLowerCase();
41
+ return MIME_BY_EXT[ext] ?? "image/png";
42
+ };
43
+ const sanitizeFilename = (name, contentType) => {
44
+ const ext = EXT_BY_MIME[contentType] || ".png";
45
+ const baseOnly = name.split(/[/\\]/).pop() ?? name;
46
+ const withoutExt = baseOnly.replace(/\.(png|jpe?g|gif|webp|svg)$/i, "");
47
+ const safe = withoutExt.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
48
+ return (safe || "image") + ext;
49
+ };
50
+ const uint8ToBase64 = (bytes) => {
51
+ let binary = "";
52
+ const chunk = 8192;
53
+ for (let i = 0; i < bytes.length; i += chunk) {
54
+ binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
55
+ }
56
+ return btoa(binary);
57
+ };
58
+ const dataUriForImage = (bytes, contentType) => `data:${contentType};base64,${uint8ToBase64(bytes)}`;
59
+ const findAppRoot = async (sourceFilePath, fs) => {
60
+ let dir = dirname(sourceFilePath);
61
+ let prev = "";
62
+ while (dir && dir !== prev) {
63
+ if (await fs.stat(joinPath(dir, "package.json"))) {
64
+ return dir;
65
+ }
66
+ prev = dir;
67
+ dir = dirname(dir);
68
+ }
69
+ return void 0;
70
+ };
71
+ const bytesEqual = (a, b) => {
72
+ if (a.length !== b.length) return false;
73
+ for (let i = 0; i < a.length; i++) {
74
+ if (a[i] !== b[i]) return false;
75
+ }
76
+ return true;
77
+ };
78
+ const saveImageToAssets = async (appRoot, filename, bytes, fs) => {
79
+ const assetsDir = joinPath(appRoot, ASSETS_DIR);
80
+ await fs.mkdir(assetsDir);
81
+ let savedName = filename;
82
+ let targetPath = joinPath(assetsDir, savedName);
83
+ if (await fs.stat(targetPath)) {
84
+ const existing = await fs.readFile(targetPath);
85
+ if (bytesEqual(existing, bytes)) {
86
+ return savedName;
87
+ }
88
+ const ext = extname(filename);
89
+ const base = ext ? filename.slice(0, -ext.length) : filename;
90
+ let counter = 2;
91
+ do {
92
+ if (counter > MAX_FILENAME_COLLISIONS) {
93
+ throw new Error(`saveImageToAssets: too many filename collisions for "${filename}"`);
94
+ }
95
+ savedName = `${base}-${counter}${ext}`;
96
+ targetPath = joinPath(assetsDir, savedName);
97
+ counter++;
98
+ } while (await fs.stat(targetPath));
99
+ }
100
+ await fs.writeFile(targetPath, bytes);
101
+ return savedName;
102
+ };
103
+ const assetDevUrl = (filename) => `${DEV_URL_PREFIX}/${filename}`;
104
+ exports.ASSETS_DIR = ASSETS_DIR;
105
+ exports.DEV_URL_PREFIX = DEV_URL_PREFIX;
106
+ exports.assetDevUrl = assetDevUrl;
107
+ exports.dataUriForImage = dataUriForImage;
108
+ exports.findAppRoot = findAppRoot;
109
+ exports.mimeTypeForFilename = mimeTypeForFilename;
110
+ exports.sanitizeFilename = sanitizeFilename;
111
+ exports.saveImageToAssets = saveImageToAssets;
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ /**
7
+ * `/authoring/host` entry: host-neutral, design-only *policy* for importing an
8
+ * image into a previewed app — app-root discovery, the `src/assets/images`
9
+ * placement convention, content-dedupe, the dev-URL shape, filename
10
+ * sanitization, and MIME lookup.
11
+ *
12
+ * This is the shared half of the local-file (and, later, CMS) image-import flow.
13
+ * Each surface (the VS Code extension, Codey Studio, ...) supplies only the two
14
+ * genuinely host-specific pieces:
15
+ * 1. a native file picker, and
16
+ * 2. a {@link FileSystemAdapter} over its filesystem.
17
+ * Everything else lives here so it isn't re-implemented and kept in sync per
18
+ * surface.
19
+ *
20
+ * Environment-neutral by construction: no `vscode`, no `@salesforce/core`, and
21
+ * no `node:path` / `node:fs`. Path work is plain string ops (separators are
22
+ * normalized at the boundary) and the only I/O seam is the injected
23
+ * `FileSystemAdapter`, so the same compiled code runs in a Node host (VS Code)
24
+ * and a browser/LWC host (Codey Studio). This matches the `no-host-imports`
25
+ * boundary that also guards `authoring/core`.
26
+ */
27
+ /**
28
+ * Minimal filesystem seam each surface implements over its own backend
29
+ * (`vscode.workspace.fs`, `node:fs`, an in-memory store, ...). Paths are plain
30
+ * strings using `/` separators (see {@link normalizeSeparators}).
31
+ *
32
+ * `stat` returns whether the path exists (an exists-boolean keeps the surface
33
+ * adapter tiny — a thrown "not found" becomes `false`); the other three mirror
34
+ * the operations the import pipeline needs.
35
+ */
36
+ export interface FileSystemAdapter {
37
+ /** Resolve to `true` if `path` exists, `false` otherwise (never throws for "missing"). */
38
+ stat(path: string): Promise<boolean>;
39
+ /** Read the file's bytes. Only called after `stat` reports the path exists. */
40
+ readFile(path: string): Promise<Uint8Array>;
41
+ /** Write `bytes` to `path`, overwriting if present. */
42
+ writeFile(path: string, bytes: Uint8Array): Promise<void>;
43
+ /** Create the directory at `path` (recursively); a no-op if it already exists. */
44
+ mkdir(path: string): Promise<void>;
45
+ }
46
+ /**
47
+ * The app-relative directory imported images are written under. Owned here
48
+ * because the convention is invented by this feature — `@salesforce/ui-bundle`
49
+ * defines no such constant (its vite config uses the default `assetsDir`; only
50
+ * template apps reference `src/assets`, via an `@assets` alias). The runtime
51
+ * assumption: this folder sits under the app root so the dev server (vite
52
+ * default) serves it at {@link DEV_URL_PREFIX}.
53
+ */
54
+ export declare const ASSETS_DIR = "src/assets/images";
55
+ /** Root-relative URL prefix the dev server serves {@link ASSETS_DIR} at. */
56
+ export declare const DEV_URL_PREFIX = "/src/assets/images";
57
+ /** Best-effort MIME type for a filename's extension; defaults to image/png. */
58
+ export declare const mimeTypeForFilename: (filename: string) => string;
59
+ /**
60
+ * Turn an arbitrary name + content type into a safe, URL- and filesystem-friendly
61
+ * filename. Strips any directory components (path-traversal safe), lowercases,
62
+ * collapses non-alphanumerics to hyphens, and appends the extension for the
63
+ * content type. E.g. "Hero Banner (large).PNG" + "image/png" -> "hero-banner-large.png";
64
+ * "../../etc/passwd" + "image/png" -> "passwd.png".
65
+ */
66
+ export declare const sanitizeFilename: (name: string, contentType: string) => string;
67
+ /** Build a base64 `data:` URI for image bytes — usable as a preview `<img src>` in any host. */
68
+ export declare const dataUriForImage: (bytes: Uint8Array, contentType: string) => string;
69
+ /**
70
+ * Walk up from a source file to the nearest directory containing a `package.json`
71
+ * — the ui-bundle/React app root. This makes asset placement independent of where
72
+ * the workspace is rooted or where the dev server was launched: the app root is
73
+ * derived from the edited element's own source location. Returns `undefined` if no
74
+ * `package.json` is found before reaching the filesystem root.
75
+ */
76
+ export declare const findAppRoot: (sourceFilePath: string, fs: FileSystemAdapter) => Promise<string | undefined>;
77
+ /**
78
+ * Save image bytes under `<appRoot>/{@link ASSETS_DIR}`, creating the directory
79
+ * if needed. If a file with the same name already holds identical bytes it is
80
+ * reused; if it holds different bytes a numeric suffix is added (`hero.png` ->
81
+ * `hero-2.png`). Returns the filename actually written/reused.
82
+ */
83
+ export declare const saveImageToAssets: (appRoot: string, filename: string, bytes: Uint8Array, fs: FileSystemAdapter) => Promise<string>;
84
+ /** Vite-servable dev URL for a saved asset filename. */
85
+ export declare const assetDevUrl: (filename: string) => string;
86
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,86 @@
1
+ /**
2
+ * Copyright (c) 2026, Salesforce, Inc.,
3
+ * All rights reserved.
4
+ * For full license text, see the LICENSE.txt file
5
+ */
6
+ /**
7
+ * `/authoring/host` entry: host-neutral, design-only *policy* for importing an
8
+ * image into a previewed app — app-root discovery, the `src/assets/images`
9
+ * placement convention, content-dedupe, the dev-URL shape, filename
10
+ * sanitization, and MIME lookup.
11
+ *
12
+ * This is the shared half of the local-file (and, later, CMS) image-import flow.
13
+ * Each surface (the VS Code extension, Codey Studio, ...) supplies only the two
14
+ * genuinely host-specific pieces:
15
+ * 1. a native file picker, and
16
+ * 2. a {@link FileSystemAdapter} over its filesystem.
17
+ * Everything else lives here so it isn't re-implemented and kept in sync per
18
+ * surface.
19
+ *
20
+ * Environment-neutral by construction: no `vscode`, no `@salesforce/core`, and
21
+ * no `node:path` / `node:fs`. Path work is plain string ops (separators are
22
+ * normalized at the boundary) and the only I/O seam is the injected
23
+ * `FileSystemAdapter`, so the same compiled code runs in a Node host (VS Code)
24
+ * and a browser/LWC host (Codey Studio). This matches the `no-host-imports`
25
+ * boundary that also guards `authoring/core`.
26
+ */
27
+ /**
28
+ * Minimal filesystem seam each surface implements over its own backend
29
+ * (`vscode.workspace.fs`, `node:fs`, an in-memory store, ...). Paths are plain
30
+ * strings using `/` separators (see {@link normalizeSeparators}).
31
+ *
32
+ * `stat` returns whether the path exists (an exists-boolean keeps the surface
33
+ * adapter tiny — a thrown "not found" becomes `false`); the other three mirror
34
+ * the operations the import pipeline needs.
35
+ */
36
+ export interface FileSystemAdapter {
37
+ /** Resolve to `true` if `path` exists, `false` otherwise (never throws for "missing"). */
38
+ stat(path: string): Promise<boolean>;
39
+ /** Read the file's bytes. Only called after `stat` reports the path exists. */
40
+ readFile(path: string): Promise<Uint8Array>;
41
+ /** Write `bytes` to `path`, overwriting if present. */
42
+ writeFile(path: string, bytes: Uint8Array): Promise<void>;
43
+ /** Create the directory at `path` (recursively); a no-op if it already exists. */
44
+ mkdir(path: string): Promise<void>;
45
+ }
46
+ /**
47
+ * The app-relative directory imported images are written under. Owned here
48
+ * because the convention is invented by this feature — `@salesforce/ui-bundle`
49
+ * defines no such constant (its vite config uses the default `assetsDir`; only
50
+ * template apps reference `src/assets`, via an `@assets` alias). The runtime
51
+ * assumption: this folder sits under the app root so the dev server (vite
52
+ * default) serves it at {@link DEV_URL_PREFIX}.
53
+ */
54
+ export declare const ASSETS_DIR = "src/assets/images";
55
+ /** Root-relative URL prefix the dev server serves {@link ASSETS_DIR} at. */
56
+ export declare const DEV_URL_PREFIX = "/src/assets/images";
57
+ /** Best-effort MIME type for a filename's extension; defaults to image/png. */
58
+ export declare const mimeTypeForFilename: (filename: string) => string;
59
+ /**
60
+ * Turn an arbitrary name + content type into a safe, URL- and filesystem-friendly
61
+ * filename. Strips any directory components (path-traversal safe), lowercases,
62
+ * collapses non-alphanumerics to hyphens, and appends the extension for the
63
+ * content type. E.g. "Hero Banner (large).PNG" + "image/png" -> "hero-banner-large.png";
64
+ * "../../etc/passwd" + "image/png" -> "passwd.png".
65
+ */
66
+ export declare const sanitizeFilename: (name: string, contentType: string) => string;
67
+ /** Build a base64 `data:` URI for image bytes — usable as a preview `<img src>` in any host. */
68
+ export declare const dataUriForImage: (bytes: Uint8Array, contentType: string) => string;
69
+ /**
70
+ * Walk up from a source file to the nearest directory containing a `package.json`
71
+ * — the ui-bundle/React app root. This makes asset placement independent of where
72
+ * the workspace is rooted or where the dev server was launched: the app root is
73
+ * derived from the edited element's own source location. Returns `undefined` if no
74
+ * `package.json` is found before reaching the filesystem root.
75
+ */
76
+ export declare const findAppRoot: (sourceFilePath: string, fs: FileSystemAdapter) => Promise<string | undefined>;
77
+ /**
78
+ * Save image bytes under `<appRoot>/{@link ASSETS_DIR}`, creating the directory
79
+ * if needed. If a file with the same name already holds identical bytes it is
80
+ * reused; if it holds different bytes a numeric suffix is added (`hero.png` ->
81
+ * `hero-2.png`). Returns the filename actually written/reused.
82
+ */
83
+ export declare const saveImageToAssets: (appRoot: string, filename: string, bytes: Uint8Array, fs: FileSystemAdapter) => Promise<string>;
84
+ /** Vite-servable dev URL for a saved asset filename. */
85
+ export declare const assetDevUrl: (filename: string) => string;
86
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authoring/host/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IACjC,0FAA0F;IAC1F,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACrC,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IAC5C,uDAAuD;IACvD,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC1D,kFAAkF;IAClF,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,sBAAsB,CAAC;AAE9C,4EAA4E;AAC5E,eAAO,MAAM,cAAc,uBAAuB,CAAC;AA6DnD,+EAA+E;AAC/E,eAAO,MAAM,mBAAmB,GAAI,UAAU,MAAM,KAAG,MAGtD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,MAAM,EAAE,aAAa,MAAM,KAAG,MAUpE,CAAC;AAgBF,gGAAgG;AAChG,eAAO,MAAM,eAAe,GAAI,OAAO,UAAU,EAAE,aAAa,MAAM,KAAG,MACpB,CAAC;AAEtD;;;;;;GAMG;AACH,eAAO,MAAM,WAAW,GACvB,gBAAgB,MAAM,EACtB,IAAI,iBAAiB,KACnB,OAAO,CAAC,MAAM,GAAG,SAAS,CAY5B,CAAC;AAWF;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,GAC7B,SAAS,MAAM,EACf,UAAU,MAAM,EAChB,OAAO,UAAU,EACjB,IAAI,iBAAiB,KACnB,OAAO,CAAC,MAAM,CA8BhB,CAAC;AAEF,wDAAwD;AACxD,eAAO,MAAM,WAAW,GAAI,UAAU,MAAM,KAAG,MAAyC,CAAC"}
@@ -0,0 +1,111 @@
1
+ const ASSETS_DIR = "src/assets/images";
2
+ const DEV_URL_PREFIX = "/src/assets/images";
3
+ const MAX_FILENAME_COLLISIONS = 1e3;
4
+ const EXT_BY_MIME = {
5
+ "image/png": ".png",
6
+ "image/jpeg": ".jpg",
7
+ "image/gif": ".gif",
8
+ "image/webp": ".webp",
9
+ "image/svg+xml": ".svg"
10
+ };
11
+ const MIME_BY_EXT = {
12
+ png: "image/png",
13
+ jpg: "image/jpeg",
14
+ jpeg: "image/jpeg",
15
+ gif: "image/gif",
16
+ webp: "image/webp",
17
+ svg: "image/svg+xml"
18
+ };
19
+ const normalizeSeparators = (p) => p.replace(/\\/g, "/");
20
+ const dirname = (p) => {
21
+ const normalized = normalizeSeparators(p).replace(/\/+$/, "");
22
+ const idx = normalized.lastIndexOf("/");
23
+ if (idx < 0) return "";
24
+ return idx === 0 ? "/" : normalized.slice(0, idx);
25
+ };
26
+ const basename = (p) => {
27
+ const normalized = normalizeSeparators(p).replace(/\/+$/, "");
28
+ const idx = normalized.lastIndexOf("/");
29
+ return idx < 0 ? normalized : normalized.slice(idx + 1);
30
+ };
31
+ const extname = (filename) => {
32
+ const base = basename(filename);
33
+ const idx = base.lastIndexOf(".");
34
+ return idx <= 0 ? "" : base.slice(idx);
35
+ };
36
+ const joinPath = (...segments) => segments.map((s) => normalizeSeparators(s)).join("/").replace(/\/{2,}/g, "/");
37
+ const mimeTypeForFilename = (filename) => {
38
+ const ext = extname(filename).slice(1).toLowerCase();
39
+ return MIME_BY_EXT[ext] ?? "image/png";
40
+ };
41
+ const sanitizeFilename = (name, contentType) => {
42
+ const ext = EXT_BY_MIME[contentType] || ".png";
43
+ const baseOnly = name.split(/[/\\]/).pop() ?? name;
44
+ const withoutExt = baseOnly.replace(/\.(png|jpe?g|gif|webp|svg)$/i, "");
45
+ const safe = withoutExt.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
46
+ return (safe || "image") + ext;
47
+ };
48
+ const uint8ToBase64 = (bytes) => {
49
+ let binary = "";
50
+ const chunk = 8192;
51
+ for (let i = 0; i < bytes.length; i += chunk) {
52
+ binary += String.fromCharCode(...bytes.subarray(i, i + chunk));
53
+ }
54
+ return btoa(binary);
55
+ };
56
+ const dataUriForImage = (bytes, contentType) => `data:${contentType};base64,${uint8ToBase64(bytes)}`;
57
+ const findAppRoot = async (sourceFilePath, fs) => {
58
+ let dir = dirname(sourceFilePath);
59
+ let prev = "";
60
+ while (dir && dir !== prev) {
61
+ if (await fs.stat(joinPath(dir, "package.json"))) {
62
+ return dir;
63
+ }
64
+ prev = dir;
65
+ dir = dirname(dir);
66
+ }
67
+ return void 0;
68
+ };
69
+ const bytesEqual = (a, b) => {
70
+ if (a.length !== b.length) return false;
71
+ for (let i = 0; i < a.length; i++) {
72
+ if (a[i] !== b[i]) return false;
73
+ }
74
+ return true;
75
+ };
76
+ const saveImageToAssets = async (appRoot, filename, bytes, fs) => {
77
+ const assetsDir = joinPath(appRoot, ASSETS_DIR);
78
+ await fs.mkdir(assetsDir);
79
+ let savedName = filename;
80
+ let targetPath = joinPath(assetsDir, savedName);
81
+ if (await fs.stat(targetPath)) {
82
+ const existing = await fs.readFile(targetPath);
83
+ if (bytesEqual(existing, bytes)) {
84
+ return savedName;
85
+ }
86
+ const ext = extname(filename);
87
+ const base = ext ? filename.slice(0, -ext.length) : filename;
88
+ let counter = 2;
89
+ do {
90
+ if (counter > MAX_FILENAME_COLLISIONS) {
91
+ throw new Error(`saveImageToAssets: too many filename collisions for "${filename}"`);
92
+ }
93
+ savedName = `${base}-${counter}${ext}`;
94
+ targetPath = joinPath(assetsDir, savedName);
95
+ counter++;
96
+ } while (await fs.stat(targetPath));
97
+ }
98
+ await fs.writeFile(targetPath, bytes);
99
+ return savedName;
100
+ };
101
+ const assetDevUrl = (filename) => `${DEV_URL_PREFIX}/${filename}`;
102
+ export {
103
+ ASSETS_DIR,
104
+ DEV_URL_PREFIX,
105
+ assetDevUrl,
106
+ dataUriForImage,
107
+ findAppRoot,
108
+ mimeTypeForFilename,
109
+ sanitizeFilename,
110
+ saveImageToAssets
111
+ };
@@ -10,7 +10,8 @@
10
10
  * use `/authoring/web-component` instead.
11
11
  */
12
12
  export { DesignPropertyPanel, mountDesignPropertyPanel } from '../core/DesignPropertyPanelRoot.cjs';
13
- export type { DesignPropertyPanelProps, DesignPropertyPanelHandle, DesignPanelComponent, StylesEntryMap, SelectedComponentContext, OpenSourceFilePayload, } from '../core/DesignPropertyPanelRoot.cjs';
13
+ export type { DesignPropertyPanelProps, DesignPropertyPanelHandle, DesignPanelComponent, StylesEntryMap, SelectedComponentContext, OpenSourceFilePayload, ImageSourceBindings, } from '../core/DesignPropertyPanelRoot.cjs';
14
14
  export { interpolate, validateLabels, REQUIRED_LABEL_KEYS } from '../core/labels/labels.cjs';
15
15
  export type { PanelLabels, RequiredLabelKey } from '../core/labels/labels.cjs';
16
+ export type { CmsSpace, CmsImage, CmsFolderItem, CmsFolderItemsResult, CmsContentDetailResult, CmsThumbnailResult, ImageImportResult, ImageAttributes, LocalFilePreview, } from '../core/editors/ImageEditor.cjs';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -10,7 +10,8 @@
10
10
  * use `/authoring/web-component` instead.
11
11
  */
12
12
  export { DesignPropertyPanel, mountDesignPropertyPanel } from '../core/DesignPropertyPanelRoot.js';
13
- export type { DesignPropertyPanelProps, DesignPropertyPanelHandle, DesignPanelComponent, StylesEntryMap, SelectedComponentContext, OpenSourceFilePayload, } from '../core/DesignPropertyPanelRoot.js';
13
+ export type { DesignPropertyPanelProps, DesignPropertyPanelHandle, DesignPanelComponent, StylesEntryMap, SelectedComponentContext, OpenSourceFilePayload, ImageSourceBindings, } from '../core/DesignPropertyPanelRoot.js';
14
14
  export { interpolate, validateLabels, REQUIRED_LABEL_KEYS } from '../core/labels/labels.js';
15
15
  export type { PanelLabels, RequiredLabelKey } from '../core/labels/labels.js';
16
+ export type { CmsSpace, CmsImage, CmsFolderItem, CmsFolderItemsResult, CmsContentDetailResult, CmsThumbnailResult, ImageImportResult, ImageAttributes, LocalFilePreview, } from '../core/editors/ImageEditor.js';
16
17
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authoring/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChG,YAAY,EACX,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,qBAAqB,GACrB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzF,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/authoring/react/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;GAKG;AAEH,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAChG,YAAY,EACX,wBAAwB,EACxB,yBAAyB,EACzB,oBAAoB,EACpB,cAAc,EACd,wBAAwB,EACxB,qBAAqB,EACrB,mBAAmB,GACnB,MAAM,iCAAiC,CAAC;AAMzC,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AACzF,YAAY,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAC3E,YAAY,EACX,QAAQ,EACR,QAAQ,EACR,aAAa,EACb,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,gBAAgB,GAChB,MAAM,6BAA6B,CAAC"}