@happyvertical/smrt-images 0.30.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/AGENTS.md +48 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +7 -0
- package/README.md +92 -0
- package/dist/__smrt-register__.d.ts +2 -0
- package/dist/__smrt-register__.d.ts.map +1 -0
- package/dist/categorizer.d.ts +26 -0
- package/dist/categorizer.d.ts.map +1 -0
- package/dist/deriver.d.ts +33 -0
- package/dist/deriver.d.ts.map +1 -0
- package/dist/editor.d.ts +72 -0
- package/dist/editor.d.ts.map +1 -0
- package/dist/image.d.ts +53 -0
- package/dist/image.d.ts.map +1 -0
- package/dist/images.d.ts +80 -0
- package/dist/images.d.ts.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +839 -0
- package/dist/index.js.map +1 -0
- package/dist/manifest.json +1179 -0
- package/dist/media-bundle-persistence.d.ts +15 -0
- package/dist/media-bundle-persistence.d.ts.map +1 -0
- package/dist/metadata.d.ts +19 -0
- package/dist/metadata.d.ts.map +1 -0
- package/dist/playground.d.ts +2 -0
- package/dist/playground.d.ts.map +1 -0
- package/dist/playground.js +140 -0
- package/dist/playground.js.map +1 -0
- package/dist/prompts.d.ts +8 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/search.d.ts +42 -0
- package/dist/search.d.ts.map +1 -0
- package/dist/smrt-knowledge.json +561 -0
- package/dist/svelte/components/AssetsGallery.svelte +436 -0
- package/dist/svelte/components/AssetsGallery.svelte.d.ts +11 -0
- package/dist/svelte/components/AssetsGallery.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ImageEditor.svelte +485 -0
- package/dist/svelte/components/ImageEditor.svelte.d.ts +12 -0
- package/dist/svelte/components/ImageEditor.svelte.d.ts.map +1 -0
- package/dist/svelte/components/ImageUploader.svelte +922 -0
- package/dist/svelte/components/ImageUploader.svelte.d.ts +15 -0
- package/dist/svelte/components/ImageUploader.svelte.d.ts.map +1 -0
- package/dist/svelte/i18n.d.ts +42 -0
- package/dist/svelte/i18n.d.ts.map +1 -0
- package/dist/svelte/i18n.js +46 -0
- package/dist/svelte/image-clients.d.ts +45 -0
- package/dist/svelte/image-clients.d.ts.map +1 -0
- package/dist/svelte/image-clients.js +1 -0
- package/dist/svelte/index.d.ts +14 -0
- package/dist/svelte/index.d.ts.map +1 -0
- package/dist/svelte/index.js +21 -0
- package/dist/svelte/playground.d.ts +74 -0
- package/dist/svelte/playground.d.ts.map +1 -0
- package/dist/svelte/playground.js +105 -0
- package/dist/svelte/routes/ImageStudioRoute.svelte +194 -0
- package/dist/svelte/routes/ImageStudioRoute.svelte.d.ts +7 -0
- package/dist/svelte/routes/ImageStudioRoute.svelte.d.ts.map +1 -0
- package/dist/svelte/routes/index.d.ts +2 -0
- package/dist/svelte/routes/index.d.ts.map +1 -0
- package/dist/svelte/routes/index.js +1 -0
- package/dist/svelte/routes/shared.d.ts +25 -0
- package/dist/svelte/routes/shared.d.ts.map +1 -0
- package/dist/svelte/routes/shared.js +31 -0
- package/dist/types.d.ts +51 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/ui.d.ts +10 -0
- package/dist/ui.d.ts.map +1 -0
- package/dist/ui.js +42 -0
- package/dist/ui.js.map +1 -0
- package/dist/upstream.d.ts +65 -0
- package/dist/upstream.d.ts.map +1 -0
- package/package.json +95 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MediaBundleFileDescriptor, MediaBundleGpsTrackPoint, MediaBundleInspection, MediaBundleInspectionLike, MediaBundleNormalizedMetadata, MediaBundleSupportFileInspection, PersistMediaBundleAssetInput, PersistMediaBundleAssociationInput, PersistMediaBundleInspectionOptions, PersistMediaBundleInspectionResult, PersistMediaBundleMetadataArtifactInput, SmrtMediaBundlePersistenceAdapter } from '@happyvertical/smrt-assets';
|
|
2
|
+
export { type MediaSupportFileVisibility, persistMediaBundleInspection as persistImageMediaBundleInspection, } from '@happyvertical/smrt-assets';
|
|
3
|
+
export type ImageMediaBundleFileDescriptor = MediaBundleFileDescriptor;
|
|
4
|
+
export type ImageMediaBundleGpsTrackPoint = MediaBundleGpsTrackPoint;
|
|
5
|
+
export type ImageMediaBundleInspection = MediaBundleInspection;
|
|
6
|
+
export type ImageMediaBundleInspectionLike = MediaBundleInspectionLike;
|
|
7
|
+
export type ImageMediaBundleNormalizedMetadata = MediaBundleNormalizedMetadata;
|
|
8
|
+
export type ImageMediaBundleSupportFileInspection = MediaBundleSupportFileInspection;
|
|
9
|
+
export type PersistImageMediaBundleAssetInput = PersistMediaBundleAssetInput;
|
|
10
|
+
export type PersistImageMediaBundleAssociationInput = PersistMediaBundleAssociationInput;
|
|
11
|
+
export type PersistImageMediaBundleInspectionOptions = PersistMediaBundleInspectionOptions;
|
|
12
|
+
export type PersistImageMediaBundleInspectionResult = PersistMediaBundleInspectionResult;
|
|
13
|
+
export type PersistImageMediaBundleMetadataArtifactInput = PersistMediaBundleMetadataArtifactInput;
|
|
14
|
+
export type SmrtImageMediaBundlePersistenceAdapter = SmrtMediaBundlePersistenceAdapter;
|
|
15
|
+
//# sourceMappingURL=media-bundle-persistence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media-bundle-persistence.d.ts","sourceRoot":"","sources":["../src/media-bundle-persistence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,wBAAwB,EACxB,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,EAC7B,gCAAgC,EAChC,4BAA4B,EAC5B,kCAAkC,EAClC,mCAAmC,EACnC,kCAAkC,EAClC,uCAAuC,EACvC,iCAAiC,EAClC,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EACL,KAAK,0BAA0B,EAC/B,4BAA4B,IAAI,iCAAiC,GAClE,MAAM,4BAA4B,CAAC;AAEpC,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;AACvE,MAAM,MAAM,6BAA6B,GAAG,wBAAwB,CAAC;AACrE,MAAM,MAAM,0BAA0B,GAAG,qBAAqB,CAAC;AAC/D,MAAM,MAAM,8BAA8B,GAAG,yBAAyB,CAAC;AACvE,MAAM,MAAM,kCAAkC,GAAG,6BAA6B,CAAC;AAC/E,MAAM,MAAM,qCAAqC,GAC/C,gCAAgC,CAAC;AACnC,MAAM,MAAM,iCAAiC,GAAG,4BAA4B,CAAC;AAC7E,MAAM,MAAM,uCAAuC,GACjD,kCAAkC,CAAC;AACrC,MAAM,MAAM,wCAAwC,GAClD,mCAAmC,CAAC;AACtC,MAAM,MAAM,uCAAuC,GACjD,kCAAkC,CAAC;AACrC,MAAM,MAAM,4CAA4C,GACtD,uCAAuC,CAAC;AAC1C,MAAM,MAAM,sCAAsC,GAChD,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Image } from './image';
|
|
2
|
+
import { ImageMetadataResult } from './types';
|
|
3
|
+
export declare class ImageMetadataExtractor {
|
|
4
|
+
/**
|
|
5
|
+
* Extract metadata from an image buffer
|
|
6
|
+
*
|
|
7
|
+
* @param buffer - Raw image data
|
|
8
|
+
* @returns Extracted metadata including dimensions and format
|
|
9
|
+
*/
|
|
10
|
+
extract(buffer: Buffer): Promise<ImageMetadataResult>;
|
|
11
|
+
/**
|
|
12
|
+
* Extract metadata and apply it to an Image instance
|
|
13
|
+
*
|
|
14
|
+
* @param image - The Image instance to update
|
|
15
|
+
* @param buffer - Raw image data
|
|
16
|
+
*/
|
|
17
|
+
extractAndApply(image: Image, buffer: Buffer): Promise<void>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=metadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../src/metadata.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAC;AAEnD,qBAAa,sBAAsB;IACjC;;;;;OAKG;IACG,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAiB3D;;;;;OAKG;IACG,eAAe,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAMnE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../src/playground.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const IMAGES_ROUTE_IDS = {
|
|
2
|
+
studio: "@happyvertical/smrt-images:studio"
|
|
3
|
+
};
|
|
4
|
+
const IMAGES_ROUTE_META = {
|
|
5
|
+
studio: {
|
|
6
|
+
id: IMAGES_ROUTE_IDS.studio,
|
|
7
|
+
title: "Image Studio",
|
|
8
|
+
description: "Browse images, run uploads, and hand off selected assets into the package-owned image editor surface.",
|
|
9
|
+
defaultPath: "/images",
|
|
10
|
+
loadKind: void 0,
|
|
11
|
+
nav: {
|
|
12
|
+
label: "Images",
|
|
13
|
+
description: "Browse image assets and open the image editor.",
|
|
14
|
+
icon: "image",
|
|
15
|
+
order: 20,
|
|
16
|
+
group: "content"
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
function createImagesRouteNavigation(mounts = {}) {
|
|
21
|
+
return [IMAGES_ROUTE_META.studio].map((route) => ({
|
|
22
|
+
routeId: route.id,
|
|
23
|
+
href: mounts[route.id] ?? route.defaultPath,
|
|
24
|
+
label: route.nav?.label ?? route.title,
|
|
25
|
+
description: route.nav?.description ?? route.description,
|
|
26
|
+
icon: route.nav?.icon,
|
|
27
|
+
order: route.nav?.order,
|
|
28
|
+
group: route.nav?.group
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
createImagesRouteNavigation();
|
|
32
|
+
const DEFAULT_IMAGES_PLAYGROUND_API_BASE_URL = "/api/v1";
|
|
33
|
+
function resolveImagesPlaygroundApiBaseUrl() {
|
|
34
|
+
const configuredViaGlobal = globalThis.__SMRT_IMAGES_PLAYGROUND_API_BASE_URL__;
|
|
35
|
+
if (configuredViaGlobal) {
|
|
36
|
+
return configuredViaGlobal;
|
|
37
|
+
}
|
|
38
|
+
const browserLocation = globalThis.location;
|
|
39
|
+
if (browserLocation) {
|
|
40
|
+
const configuredViaQuery = new URLSearchParams(browserLocation.search).get(
|
|
41
|
+
"smrtImagesApiBaseUrl"
|
|
42
|
+
);
|
|
43
|
+
if (configuredViaQuery) {
|
|
44
|
+
return configuredViaQuery;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return DEFAULT_IMAGES_PLAYGROUND_API_BASE_URL;
|
|
48
|
+
}
|
|
49
|
+
function createPreviewImageUri(label, accent) {
|
|
50
|
+
const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720">
|
|
51
|
+
<defs>
|
|
52
|
+
<linearGradient id="bg" x1="0%" x2="100%" y1="0%" y2="100%">
|
|
53
|
+
<stop offset="0%" stop-color="${accent}" />
|
|
54
|
+
<stop offset="100%" stop-color="#111827" />
|
|
55
|
+
</linearGradient>
|
|
56
|
+
</defs>
|
|
57
|
+
<rect width="1280" height="720" fill="url(#bg)" rx="40" />
|
|
58
|
+
<circle cx="1040" cy="170" r="92" fill="rgba(255,255,255,0.18)" />
|
|
59
|
+
<path d="M110 590L360 320l182 170 146-104 210 204H110z" fill="rgba(255,255,255,0.22)" />
|
|
60
|
+
<text x="92" y="118" fill="#f8fafc" font-size="60" font-family="Arial, sans-serif" font-weight="700">${label}</text>
|
|
61
|
+
<text x="92" y="662" fill="#dbeafe" font-size="30" font-family="Arial, sans-serif">SMRT Images preview</text>
|
|
62
|
+
</svg>`;
|
|
63
|
+
return `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(svg)}`;
|
|
64
|
+
}
|
|
65
|
+
const sampleImage = {
|
|
66
|
+
id: "image-harbor-dusk",
|
|
67
|
+
name: "Harbor Dusk",
|
|
68
|
+
description: "Wide editorial frame used for feature headers.",
|
|
69
|
+
sourceUri: createPreviewImageUri("Harbor Dusk", "#2563eb"),
|
|
70
|
+
url: createPreviewImageUri("Harbor Dusk", "#2563eb"),
|
|
71
|
+
mimeType: "image/jpeg",
|
|
72
|
+
width: 1280,
|
|
73
|
+
height: 720,
|
|
74
|
+
alt: "Cargo cranes and harbor lights reflected at dusk."
|
|
75
|
+
};
|
|
76
|
+
const loadImageEditor = () => import("./svelte/components/ImageEditor.svelte");
|
|
77
|
+
const loadImageStudioRoute = () => import("./svelte/routes/ImageStudioRoute.svelte");
|
|
78
|
+
const loadImageUploader = () => import("./svelte/components/ImageUploader.svelte");
|
|
79
|
+
const playground = {
|
|
80
|
+
packageName: "@happyvertical/smrt-images",
|
|
81
|
+
displayName: "Images",
|
|
82
|
+
description: IMAGES_ROUTE_META.studio.description,
|
|
83
|
+
entries: [
|
|
84
|
+
{
|
|
85
|
+
id: "image-uploader",
|
|
86
|
+
title: "Image Uploader",
|
|
87
|
+
description: "Mock-safe uploader preview for local files and external image URLs.",
|
|
88
|
+
loadComponent: loadImageUploader,
|
|
89
|
+
order: 1,
|
|
90
|
+
tags: ["uploader", "images", "media"],
|
|
91
|
+
props: {
|
|
92
|
+
allowedTabs: ["upload", "external"],
|
|
93
|
+
onSelect: () => void 0
|
|
94
|
+
},
|
|
95
|
+
modes: {
|
|
96
|
+
mock: {
|
|
97
|
+
label: "Mock"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: "image-editor",
|
|
103
|
+
title: "Image Editor",
|
|
104
|
+
description: "Editor controls for resizing, cropping, and AI-assisted image edits.",
|
|
105
|
+
loadComponent: loadImageEditor,
|
|
106
|
+
order: 2,
|
|
107
|
+
tags: ["editor", "images", "media"],
|
|
108
|
+
props: {
|
|
109
|
+
image: sampleImage,
|
|
110
|
+
onSave: () => void 0
|
|
111
|
+
},
|
|
112
|
+
modes: {
|
|
113
|
+
mock: {
|
|
114
|
+
label: "Mock"
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: "image-studio-route",
|
|
120
|
+
title: "Image Studio Route",
|
|
121
|
+
description: "Package-owned acquisition and editing flow backed by the generated images API.",
|
|
122
|
+
loadComponent: loadImageStudioRoute,
|
|
123
|
+
order: 3,
|
|
124
|
+
tags: ["route", "images", "admin"],
|
|
125
|
+
modes: {
|
|
126
|
+
live: {
|
|
127
|
+
label: "Live",
|
|
128
|
+
description: "Requires the images package dev server and generated routes. Override the base URL with ?smrtImagesApiBaseUrl=... or window.__SMRT_IMAGES_PLAYGROUND_API_BASE_URL__ when needed.",
|
|
129
|
+
props: {
|
|
130
|
+
apiBaseUrl: resolveImagesPlaygroundApiBaseUrl()
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
]
|
|
136
|
+
};
|
|
137
|
+
export {
|
|
138
|
+
playground as default
|
|
139
|
+
};
|
|
140
|
+
//# sourceMappingURL=playground.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playground.js","sources":["../src/svelte/routes/shared.ts","../src/svelte/playground.ts"],"sourcesContent":["import type {\n SmrtRouteDefinition,\n SmrtRouteNavigationItem,\n} from '@happyvertical/smrt-types';\n\nexport const IMAGES_ROUTE_IDS = {\n studio: '@happyvertical/smrt-images:studio',\n} as const;\n\nexport type ImagesRouteId =\n (typeof IMAGES_ROUTE_IDS)[keyof typeof IMAGES_ROUTE_IDS];\n\nexport type ImagesRouteNavigationItem = SmrtRouteNavigationItem;\n\nexport const IMAGES_ROUTE_META = {\n studio: {\n id: IMAGES_ROUTE_IDS.studio,\n title: 'Image Studio',\n description:\n 'Browse images, run uploads, and hand off selected assets into the package-owned image editor surface.',\n defaultPath: '/images',\n loadKind: undefined,\n nav: {\n label: 'Images',\n description: 'Browse image assets and open the image editor.',\n icon: 'image',\n order: 20,\n group: 'content',\n },\n } satisfies Omit<SmrtRouteDefinition, 'component'>,\n} as const;\n\nexport function createImagesRouteNavigation(\n mounts: Partial<Record<ImagesRouteId, string>> = {},\n): ImagesRouteNavigationItem[] {\n return [IMAGES_ROUTE_META.studio].map((route) => ({\n routeId: route.id,\n href: mounts[route.id] ?? route.defaultPath,\n label: route.nav?.label ?? route.title,\n description: route.nav?.description ?? route.description,\n icon: route.nav?.icon,\n order: route.nav?.order,\n group: route.nav?.group,\n }));\n}\n\nexport const IMAGES_DEFAULT_ROUTE_NAVIGATION = createImagesRouteNavigation();\n","import { IMAGES_ROUTE_META } from './routes/shared.js';\n\nconst DEFAULT_IMAGES_PLAYGROUND_API_BASE_URL = '/api/v1';\n\ntype ImagesPlaygroundGlobal = typeof globalThis & {\n __SMRT_IMAGES_PLAYGROUND_API_BASE_URL__?: string;\n location?: {\n search: string;\n };\n};\n\nfunction resolveImagesPlaygroundApiBaseUrl(): string {\n const configuredViaGlobal = (globalThis as ImagesPlaygroundGlobal)\n .__SMRT_IMAGES_PLAYGROUND_API_BASE_URL__;\n if (configuredViaGlobal) {\n return configuredViaGlobal;\n }\n\n const browserLocation = (globalThis as ImagesPlaygroundGlobal).location;\n if (browserLocation) {\n const configuredViaQuery = new URLSearchParams(browserLocation.search).get(\n 'smrtImagesApiBaseUrl',\n );\n\n if (configuredViaQuery) {\n return configuredViaQuery;\n }\n }\n\n return DEFAULT_IMAGES_PLAYGROUND_API_BASE_URL;\n}\n\nfunction createPreviewImageUri(label: string, accent: string): string {\n const svg = `<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 1280 720\">\n <defs>\n <linearGradient id=\"bg\" x1=\"0%\" x2=\"100%\" y1=\"0%\" y2=\"100%\">\n <stop offset=\"0%\" stop-color=\"${accent}\" />\n <stop offset=\"100%\" stop-color=\"#111827\" />\n </linearGradient>\n </defs>\n <rect width=\"1280\" height=\"720\" fill=\"url(#bg)\" rx=\"40\" />\n <circle cx=\"1040\" cy=\"170\" r=\"92\" fill=\"rgba(255,255,255,0.18)\" />\n <path d=\"M110 590L360 320l182 170 146-104 210 204H110z\" fill=\"rgba(255,255,255,0.22)\" />\n <text x=\"92\" y=\"118\" fill=\"#f8fafc\" font-size=\"60\" font-family=\"Arial, sans-serif\" font-weight=\"700\">${label}</text>\n <text x=\"92\" y=\"662\" fill=\"#dbeafe\" font-size=\"30\" font-family=\"Arial, sans-serif\">SMRT Images preview</text>\n </svg>`;\n\n return `data:image/svg+xml;charset=UTF-8,${encodeURIComponent(svg)}`;\n}\n\nconst sampleImage = {\n id: 'image-harbor-dusk',\n name: 'Harbor Dusk',\n description: 'Wide editorial frame used for feature headers.',\n sourceUri: createPreviewImageUri('Harbor Dusk', '#2563eb'),\n url: createPreviewImageUri('Harbor Dusk', '#2563eb'),\n mimeType: 'image/jpeg',\n width: 1280,\n height: 720,\n alt: 'Cargo cranes and harbor lights reflected at dusk.',\n};\n\nconst loadImageEditor = () => import('./components/ImageEditor.svelte');\nconst loadImageStudioRoute = () => import('./routes/ImageStudioRoute.svelte');\nconst loadImageUploader = () => import('./components/ImageUploader.svelte');\n\nexport default {\n packageName: '@happyvertical/smrt-images',\n displayName: 'Images',\n description: IMAGES_ROUTE_META.studio.description,\n entries: [\n {\n id: 'image-uploader',\n title: 'Image Uploader',\n description:\n 'Mock-safe uploader preview for local files and external image URLs.',\n loadComponent: loadImageUploader,\n order: 1,\n tags: ['uploader', 'images', 'media'],\n props: {\n allowedTabs: ['upload', 'external'],\n onSelect: () => undefined,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'image-editor',\n title: 'Image Editor',\n description:\n 'Editor controls for resizing, cropping, and AI-assisted image edits.',\n loadComponent: loadImageEditor,\n order: 2,\n tags: ['editor', 'images', 'media'],\n props: {\n image: sampleImage,\n onSave: () => undefined,\n },\n modes: {\n mock: {\n label: 'Mock',\n },\n },\n },\n {\n id: 'image-studio-route',\n title: 'Image Studio Route',\n description:\n 'Package-owned acquisition and editing flow backed by the generated images API.',\n loadComponent: loadImageStudioRoute,\n order: 3,\n tags: ['route', 'images', 'admin'],\n modes: {\n live: {\n label: 'Live',\n description:\n 'Requires the images package dev server and generated routes. Override the base URL with ?smrtImagesApiBaseUrl=... or window.__SMRT_IMAGES_PLAYGROUND_API_BASE_URL__ when needed.',\n props: {\n apiBaseUrl: resolveImagesPlaygroundApiBaseUrl(),\n },\n },\n },\n },\n ],\n};\n"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ResolvedPromptAI } from '@happyvertical/smrt-prompts';
|
|
2
|
+
export declare const smrtImagesGenerateAltTextPrompt: import('@happyvertical/smrt-prompts').PromptDefinition;
|
|
3
|
+
export declare function promptMessageOptions(ai: ResolvedPromptAI): {
|
|
4
|
+
maxTokens?: number | undefined;
|
|
5
|
+
temperature?: number | undefined;
|
|
6
|
+
model?: string | undefined;
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,6BAA6B,CAAC;AASrC,eAAO,MAAM,+BAA+B,wDAgB1C,CAAC;AAEH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,gBAAgB;;;;EASxD"}
|
package/dist/search.d.ts
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { AIClientOptions } from '@happyvertical/ai';
|
|
2
|
+
import { Image } from './image';
|
|
3
|
+
import { ImageCollection } from './images';
|
|
4
|
+
import { ImageSearchOptions } from './types';
|
|
5
|
+
export declare class ImageSearch {
|
|
6
|
+
private readonly collection;
|
|
7
|
+
readonly _options: {
|
|
8
|
+
ai?: AIClientOptions;
|
|
9
|
+
};
|
|
10
|
+
constructor(collection: ImageCollection, _options?: {
|
|
11
|
+
ai?: AIClientOptions;
|
|
12
|
+
});
|
|
13
|
+
/**
|
|
14
|
+
* Search images by text query with optional dimension/orientation filters
|
|
15
|
+
*
|
|
16
|
+
* @param query - Text search query
|
|
17
|
+
* @param searchOptions - Optional filters for dimensions, orientation, etc.
|
|
18
|
+
* @returns Matching images
|
|
19
|
+
*/
|
|
20
|
+
search(query: string, searchOptions?: ImageSearchOptions): Promise<Image[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Find images similar to a given image
|
|
23
|
+
*
|
|
24
|
+
* @param image - The reference image
|
|
25
|
+
* @param options - Search options
|
|
26
|
+
* @returns Similar images
|
|
27
|
+
*/
|
|
28
|
+
findSimilar(image: Image, options?: {
|
|
29
|
+
limit?: number;
|
|
30
|
+
}): Promise<Image[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Find images matching a natural language prompt
|
|
33
|
+
*
|
|
34
|
+
* @param prompt - Natural language description of desired images
|
|
35
|
+
* @param options - Search options
|
|
36
|
+
* @returns Matching images
|
|
37
|
+
*/
|
|
38
|
+
findByPrompt(prompt: string, options?: {
|
|
39
|
+
limit?: number;
|
|
40
|
+
}): Promise<Image[]>;
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../src/search.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAElD,qBAAa,WAAW;IAEpB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,QAAQ,CAAC,QAAQ,EAAE;QAAE,EAAE,CAAC,EAAE,eAAe,CAAA;KAAE;gBAD1B,UAAU,EAAE,eAAe,EACnC,QAAQ,GAAE;QAAE,EAAE,CAAC,EAAE,eAAe,CAAA;KAAO;IAGlD;;;;;;OAMG;IACG,MAAM,CACV,KAAK,EAAE,MAAM,EACb,aAAa,GAAE,kBAAuB,GACrC,OAAO,CAAC,KAAK,EAAE,CAAC;IAsDnB;;;;;;OAMG;IACG,WAAW,CACf,KAAK,EAAE,KAAK,EACZ,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;IAiBnB;;;;;;OAMG;IACG,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,OAAO,GAAE;QAAE,KAAK,CAAC,EAAE,MAAM,CAAA;KAAO,GAC/B,OAAO,CAAC,KAAK,EAAE,CAAC;CAIpB"}
|