@happyvertical/smrt-assets 0.53.4 → 0.53.5
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 +8 -0
- package/agents/attachments.md +78 -0
- package/dist/chunks/{playground-HIASY7_c.js → playground-CGd8_X0M.js} +9 -1
- package/dist/chunks/{playground-HIASY7_c.js.map → playground-CGd8_X0M.js.map} +1 -1
- package/dist/index.js +1 -1
- package/dist/manifest.json +1 -1
- package/dist/playground.js +1 -1
- package/dist/smrt-knowledge.json +3 -3
- package/dist/svelte/attachments/link.d.ts +3 -0
- package/dist/svelte/attachments/link.d.ts.map +1 -0
- package/dist/svelte/attachments/link.js +14 -0
- package/dist/svelte/attachments/messages.d.ts +17 -0
- package/dist/svelte/attachments/messages.d.ts.map +1 -0
- package/dist/svelte/attachments/messages.js +17 -0
- package/dist/svelte/attachments/types.d.ts +95 -0
- package/dist/svelte/attachments/types.d.ts.map +1 -0
- package/dist/svelte/attachments/types.js +1 -0
- package/dist/svelte/components/AttachmentList.svelte +65 -0
- package/dist/svelte/components/AttachmentList.svelte.d.ts +8 -0
- package/dist/svelte/components/AttachmentList.svelte.d.ts.map +1 -0
- package/dist/svelte/components/AttachmentPanel.svelte +13 -0
- package/dist/svelte/components/AttachmentPanel.svelte.d.ts +8 -0
- package/dist/svelte/components/AttachmentPanel.svelte.d.ts.map +1 -0
- package/dist/svelte/components/AttachmentUpload.svelte +78 -0
- package/dist/svelte/components/AttachmentUpload.svelte.d.ts +8 -0
- package/dist/svelte/components/AttachmentUpload.svelte.d.ts.map +1 -0
- package/dist/svelte/index.d.ts +5 -0
- package/dist/svelte/index.d.ts.map +1 -1
- package/dist/svelte/index.js +7 -0
- package/dist/svelte/playground/AttachmentPanelPreview.svelte +21 -0
- package/dist/svelte/playground/AttachmentPanelPreview.svelte.d.ts +4 -0
- package/dist/svelte/playground/AttachmentPanelPreview.svelte.d.ts.map +1 -0
- package/dist/svelte/playground.d.ts +21 -2
- package/dist/svelte/playground.d.ts.map +1 -1
- package/dist/svelte/playground.js +9 -0
- package/dist/ui.d.ts.map +1 -1
- package/dist/ui.js +27 -0
- package/dist/ui.js.map +1 -1
- package/dist/workbench.js +1 -1
- package/package.json +18 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/svelte/attachments/link.ts"],"names":[],"mappings":"AAAA,sFAAsF;AACtF,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,CAU3E"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Accept only caller-supplied HTTP(S) or relative navigation URLs, never scripts. */
|
|
2
|
+
export function attachmentLink(href) {
|
|
3
|
+
if (!href?.trim())
|
|
4
|
+
return undefined;
|
|
5
|
+
try {
|
|
6
|
+
const url = new URL(href, 'https://attachment.invalid/');
|
|
7
|
+
return url.protocol === 'https:' || url.protocol === 'http:'
|
|
8
|
+
? href
|
|
9
|
+
: undefined;
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const attachmentMessages: {
|
|
2
|
+
readonly 'assets.attachments.title': "assets.attachments.title";
|
|
3
|
+
readonly 'assets.attachments.empty': "assets.attachments.empty";
|
|
4
|
+
readonly 'assets.attachments.loading': "assets.attachments.loading";
|
|
5
|
+
readonly 'assets.attachments.view': "assets.attachments.view";
|
|
6
|
+
readonly 'assets.attachments.download': "assets.attachments.download";
|
|
7
|
+
readonly 'assets.attachments.version': "assets.attachments.version";
|
|
8
|
+
readonly 'assets.attachments.history': "assets.attachments.history";
|
|
9
|
+
readonly 'assets.attachments.choose': "assets.attachments.choose";
|
|
10
|
+
readonly 'assets.attachments.browse': "assets.attachments.browse";
|
|
11
|
+
readonly 'assets.attachments.description': "assets.attachments.description";
|
|
12
|
+
readonly 'assets.attachments.upload': "assets.attachments.upload";
|
|
13
|
+
readonly 'assets.attachments.readonly': "assets.attachments.readonly";
|
|
14
|
+
readonly 'assets.attachments.reselect': "assets.attachments.reselect";
|
|
15
|
+
readonly 'assets.attachments.uncertain': "assets.attachments.uncertain";
|
|
16
|
+
};
|
|
17
|
+
//# sourceMappingURL=messages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/svelte/attachments/messages.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;CAiB7B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { defineMessages } from '@happyvertical/smrt-ui/i18n';
|
|
2
|
+
export const attachmentMessages = defineMessages({
|
|
3
|
+
'assets.attachments.title': 'Attachments',
|
|
4
|
+
'assets.attachments.empty': 'No files attached.',
|
|
5
|
+
'assets.attachments.loading': 'Loading attachments…',
|
|
6
|
+
'assets.attachments.view': 'View {name}',
|
|
7
|
+
'assets.attachments.download': 'Download {name}',
|
|
8
|
+
'assets.attachments.version': 'Version {version}',
|
|
9
|
+
'assets.attachments.history': 'Version history',
|
|
10
|
+
'assets.attachments.choose': 'Choose attachment',
|
|
11
|
+
'assets.attachments.browse': 'Select a file to attach',
|
|
12
|
+
'assets.attachments.description': 'Description',
|
|
13
|
+
'assets.attachments.upload': 'Upload attachment',
|
|
14
|
+
'assets.attachments.readonly': 'Attachments are read-only.',
|
|
15
|
+
'assets.attachments.reselect': 'Choose the file again before retrying. Browsers do not restore file selections after a failed upload.',
|
|
16
|
+
'assets.attachments.uncertain': 'The upload outcome is uncertain. Follow the application’s recovery guidance before retrying; the request identity and description are retained.',
|
|
17
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import type { FormRetryStatus } from '@happyvertical/smrt-ui/form-retry';
|
|
2
|
+
import type { Snippet } from 'svelte';
|
|
3
|
+
import type { HTMLFormAttributes } from 'svelte/elements';
|
|
4
|
+
import type { Asset } from '../../asset.js';
|
|
5
|
+
/** Authorized display projection of an Asset; intentionally excludes sourceUri. */
|
|
6
|
+
export interface AssetAttachmentVersion extends Pick<Asset, 'name' | 'mimeType'> {
|
|
7
|
+
/** Asset or owning attachment-join identity. */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Existing Asset version number, when relevant to this workflow. */
|
|
10
|
+
version?: Asset['version'];
|
|
11
|
+
/** Caller-localized timestamp or other recorded-date description. */
|
|
12
|
+
recordedAtLabel?: string;
|
|
13
|
+
/** Caller-localized correction reason or other version detail. */
|
|
14
|
+
note?: string;
|
|
15
|
+
/** Server-authorized view endpoint; never a storage path. */
|
|
16
|
+
viewHref?: string;
|
|
17
|
+
/** Server-authorized download endpoint; may differ from the view URL. */
|
|
18
|
+
downloadHref?: string;
|
|
19
|
+
}
|
|
20
|
+
/** An authorized attachment plus optional caller-ordered version history. */
|
|
21
|
+
export interface AssetAttachment extends AssetAttachmentVersion {
|
|
22
|
+
/** Caller-localized status, including unknown or application-specific states. */
|
|
23
|
+
statusLabel?: string;
|
|
24
|
+
/** Earlier versions already authorized by the caller. No history is fetched. */
|
|
25
|
+
versions?: readonly AssetAttachmentVersion[];
|
|
26
|
+
}
|
|
27
|
+
/** Native hidden request value, preserving repeated names and original identity. */
|
|
28
|
+
export interface AttachmentRequestField {
|
|
29
|
+
/** Native field name. */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Value forwarded without normalization or rotation. */
|
|
32
|
+
value: string;
|
|
33
|
+
}
|
|
34
|
+
/** Authorized attachment listing with private links and version metadata. */
|
|
35
|
+
export interface AttachmentListProps {
|
|
36
|
+
/** Authorized attachments in display order. */
|
|
37
|
+
attachments: readonly AssetAttachment[];
|
|
38
|
+
/** Optional caller-localized heading. */
|
|
39
|
+
title?: string;
|
|
40
|
+
/** Whether to display supplied version history. */
|
|
41
|
+
showHistory?: boolean;
|
|
42
|
+
/** Caller-localized load/error state. */
|
|
43
|
+
message?: string;
|
|
44
|
+
/** Loading presentation; existing items remain visible. */
|
|
45
|
+
loading?: boolean;
|
|
46
|
+
}
|
|
47
|
+
/** Native private upload transport, owned and authorized by the consumer. */
|
|
48
|
+
export interface AttachmentUploadProps {
|
|
49
|
+
/** Authorized endpoint; supplied by the consumer, never constructed here. */
|
|
50
|
+
action: string;
|
|
51
|
+
/** Optional stable form identity for enhancement. */
|
|
52
|
+
id?: string;
|
|
53
|
+
/** Presentation capability only. The endpoint must authorize each request. */
|
|
54
|
+
canUpload?: boolean;
|
|
55
|
+
/** File input name, default file. */
|
|
56
|
+
fileField?: string;
|
|
57
|
+
/** Description input name, default description. */
|
|
58
|
+
descriptionField?: string;
|
|
59
|
+
/** Caller-retained description, including values from rejected submissions. */
|
|
60
|
+
description?: string;
|
|
61
|
+
/** Native accept hint; server must independently validate bytes and policy. */
|
|
62
|
+
accept?: string;
|
|
63
|
+
/** Caller-localized allowed types/size/help. No upload policy is hardcoded. */
|
|
64
|
+
help?: string;
|
|
65
|
+
/** Caller field-level file validation error. */
|
|
66
|
+
fileError?: string;
|
|
67
|
+
/** Caller field-level description validation error. */
|
|
68
|
+
descriptionError?: string;
|
|
69
|
+
/** Caller server error or uncertain-outcome message. */
|
|
70
|
+
message?: string;
|
|
71
|
+
/** Re-render recovery needs a new file selection; browsers cannot restore files. */
|
|
72
|
+
reselectFile?: boolean;
|
|
73
|
+
/** Pending caller request; disables submit without changing values. */
|
|
74
|
+
pending?: boolean;
|
|
75
|
+
/** Optional state from caller-owned smrt-ui/form-retry. */
|
|
76
|
+
retryStatus?: FormRetryStatus;
|
|
77
|
+
/** Request/tenant/revision fields, kept verbatim and repeated as provided. */
|
|
78
|
+
hiddenFields?: readonly AttachmentRequestField[];
|
|
79
|
+
/** Native submitter name, default intent. */
|
|
80
|
+
intentField?: string;
|
|
81
|
+
/** Native submitter value, default upload. */
|
|
82
|
+
intent?: string;
|
|
83
|
+
/** Optional caller-localized upload label. */
|
|
84
|
+
submitLabel?: string;
|
|
85
|
+
/** Extra consumer fields inside the multipart form. */
|
|
86
|
+
children?: Snippet;
|
|
87
|
+
/** Optional enhancement; native navigation is the default. */
|
|
88
|
+
onsubmit?: HTMLFormAttributes['onsubmit'];
|
|
89
|
+
}
|
|
90
|
+
/** Attachment display with an optional, independently authorized upload form. */
|
|
91
|
+
export interface AttachmentPanelProps extends AttachmentListProps {
|
|
92
|
+
/** Omit when uploads are unavailable. */
|
|
93
|
+
upload?: AttachmentUploadProps;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/svelte/attachments/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
3
|
+
import { Button } from '@happyvertical/smrt-ui/ui';
|
|
4
|
+
import { attachmentLink } from '../attachments/link.js';
|
|
5
|
+
import { attachmentMessages as M } from '../attachments/messages.js';
|
|
6
|
+
import type {
|
|
7
|
+
AssetAttachmentVersion,
|
|
8
|
+
AttachmentListProps,
|
|
9
|
+
} from '../attachments/types.js';
|
|
10
|
+
/** Authorized attachment metadata, navigation and caller-ordered history. */
|
|
11
|
+
export interface Props extends AttachmentListProps {}
|
|
12
|
+
let {
|
|
13
|
+
attachments,
|
|
14
|
+
title,
|
|
15
|
+
showHistory = true,
|
|
16
|
+
message,
|
|
17
|
+
loading = false,
|
|
18
|
+
}: Props = $props();
|
|
19
|
+
const { t } = useI18n();
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
{#snippet entry(item: AssetAttachmentVersion)}
|
|
23
|
+
<strong>{item.name}</strong>
|
|
24
|
+
<div class="metadata">
|
|
25
|
+
<span>{item.mimeType}</span>
|
|
26
|
+
{#if item.version !== undefined}<span>{t(M['assets.attachments.version'], { version: item.version })}</span>{/if}
|
|
27
|
+
{#if item.recordedAtLabel}<span>{item.recordedAtLabel}</span>{/if}
|
|
28
|
+
</div>
|
|
29
|
+
{#if item.note}<p>{item.note}</p>{/if}
|
|
30
|
+
<div class="links">
|
|
31
|
+
{#if attachmentLink(item.viewHref)}<Button href={attachmentLink(item.viewHref)} target="_blank" rel="noopener noreferrer" variant="ghost">{t(M['assets.attachments.view'], { name: item.name })}</Button>{/if}
|
|
32
|
+
{#if attachmentLink(item.downloadHref)}<Button href={attachmentLink(item.downloadHref)} variant="ghost">{t(M['assets.attachments.download'], { name: item.name })}</Button>{/if}
|
|
33
|
+
</div>
|
|
34
|
+
{/snippet}
|
|
35
|
+
|
|
36
|
+
<section class="attachment-list" aria-label={title ?? t(M['assets.attachments.title'])} aria-busy={loading}>
|
|
37
|
+
<h3>{title ?? t(M['assets.attachments.title'])}</h3>
|
|
38
|
+
{#if message}<p role="alert">{message}</p>{/if}
|
|
39
|
+
{#if loading}<p role="status">{t(M['assets.attachments.loading'])}</p>{/if}
|
|
40
|
+
{#if attachments.length === 0 && !loading}<p>{t(M['assets.attachments.empty'])}</p>{/if}
|
|
41
|
+
<ul>
|
|
42
|
+
{#each attachments as attachment (attachment.id)}
|
|
43
|
+
<li>
|
|
44
|
+
{@render entry(attachment)}
|
|
45
|
+
{#if attachment.statusLabel}<p>{attachment.statusLabel}</p>{/if}
|
|
46
|
+
{#if showHistory && attachment.versions?.length}
|
|
47
|
+
<h4>{t(M['assets.attachments.history'])}</h4>
|
|
48
|
+
<ol>{#each attachment.versions as version (version.id)}<li>{@render entry(version)}</li>{/each}</ol>
|
|
49
|
+
{/if}
|
|
50
|
+
</li>
|
|
51
|
+
{/each}
|
|
52
|
+
</ul>
|
|
53
|
+
</section>
|
|
54
|
+
|
|
55
|
+
<style>
|
|
56
|
+
.attachment-list { min-width: 0; overflow-wrap: anywhere; }
|
|
57
|
+
ul { list-style: none; padding: 0; }
|
|
58
|
+
ul, ol { display: grid; gap: var(--smrt-spacing-4); }
|
|
59
|
+
ol { padding-inline-start: var(--smrt-spacing-5); }
|
|
60
|
+
li { min-width: 0; display: grid; gap: var(--smrt-spacing-2); }
|
|
61
|
+
.links, .metadata { display: flex; flex-wrap: wrap; gap: var(--smrt-spacing-2); min-width: 0; }
|
|
62
|
+
.metadata { color: var(--smrt-color-on-surface-variant); }
|
|
63
|
+
h3, h4, p { margin: 0; }
|
|
64
|
+
.links :global(a) { max-width: 100%; white-space: normal; overflow-wrap: anywhere; min-width: 0; }
|
|
65
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttachmentListProps } from '../attachments/types.js';
|
|
2
|
+
/** Authorized attachment metadata, navigation and caller-ordered history. */
|
|
3
|
+
export interface Props extends AttachmentListProps {
|
|
4
|
+
}
|
|
5
|
+
declare const AttachmentList: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type AttachmentList = ReturnType<typeof AttachmentList>;
|
|
7
|
+
export default AttachmentList;
|
|
8
|
+
//# sourceMappingURL=AttachmentList.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentList.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/AttachmentList.svelte.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,6EAA6E;AAC7E,MAAM,WAAW,KAAM,SAAQ,mBAAmB;CAAG;AAuDrD,QAAA,MAAM,cAAc,2CAAwC,CAAC;AAC7D,KAAK,cAAc,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AACxD,eAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { AttachmentPanelProps } from '../attachments/types.js';
|
|
3
|
+
import AttachmentList from './AttachmentList.svelte';
|
|
4
|
+
import AttachmentUpload from './AttachmentUpload.svelte';
|
|
5
|
+
/** Composes authorized attachment display and optional native upload. */
|
|
6
|
+
export interface Props extends AttachmentPanelProps {}
|
|
7
|
+
let { upload, ...list }: Props = $props();
|
|
8
|
+
</script>
|
|
9
|
+
<div class="attachment-panel">
|
|
10
|
+
<AttachmentList {...list} />
|
|
11
|
+
{#if upload}<AttachmentUpload {...upload} />{/if}
|
|
12
|
+
</div>
|
|
13
|
+
<style>.attachment-panel { display: grid; gap: var(--smrt-spacing-4); min-width: 0; }</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttachmentPanelProps } from '../attachments/types.js';
|
|
2
|
+
/** Composes authorized attachment display and optional native upload. */
|
|
3
|
+
export interface Props extends AttachmentPanelProps {
|
|
4
|
+
}
|
|
5
|
+
declare const AttachmentPanel: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type AttachmentPanel = ReturnType<typeof AttachmentPanel>;
|
|
7
|
+
export default AttachmentPanel;
|
|
8
|
+
//# sourceMappingURL=AttachmentPanel.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentPanel.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/AttachmentPanel.svelte.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAIpE,yEAAyE;AACzE,MAAM,WAAW,KAAM,SAAQ,oBAAoB;CAAG;AAgBtD,QAAA,MAAM,eAAe,2CAAwC,CAAC;AAC9D,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC;AAC1D,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import {
|
|
3
|
+
FilePicker,
|
|
4
|
+
Form,
|
|
5
|
+
FormGroup,
|
|
6
|
+
Input,
|
|
7
|
+
Textarea,
|
|
8
|
+
} from '@happyvertical/smrt-ui/forms';
|
|
9
|
+
import { useI18n } from '@happyvertical/smrt-ui/i18n';
|
|
10
|
+
import { Button } from '@happyvertical/smrt-ui/ui';
|
|
11
|
+
import { attachmentMessages as M } from '../attachments/messages.js';
|
|
12
|
+
import type { AttachmentUploadProps } from '../attachments/types.js';
|
|
13
|
+
/** Native multipart upload preserving caller request identity and failure values. */
|
|
14
|
+
export interface Props extends AttachmentUploadProps {}
|
|
15
|
+
let {
|
|
16
|
+
action,
|
|
17
|
+
id,
|
|
18
|
+
canUpload = true,
|
|
19
|
+
fileField = 'file',
|
|
20
|
+
descriptionField = 'description',
|
|
21
|
+
description = '',
|
|
22
|
+
accept,
|
|
23
|
+
help,
|
|
24
|
+
fileError,
|
|
25
|
+
descriptionError,
|
|
26
|
+
message,
|
|
27
|
+
reselectFile = false,
|
|
28
|
+
pending = false,
|
|
29
|
+
retryStatus = 'idle',
|
|
30
|
+
hiddenFields = [],
|
|
31
|
+
intentField = 'intent',
|
|
32
|
+
intent = 'upload',
|
|
33
|
+
submitLabel,
|
|
34
|
+
children,
|
|
35
|
+
onsubmit,
|
|
36
|
+
}: Props = $props();
|
|
37
|
+
const { t } = useI18n();
|
|
38
|
+
const instanceId = $props.id();
|
|
39
|
+
const formId = $derived(id ?? `attachment-upload-${instanceId}`);
|
|
40
|
+
const busy = $derived(
|
|
41
|
+
pending || retryStatus === 'submitting' || retryStatus === 'busy',
|
|
42
|
+
);
|
|
43
|
+
const fileHelp = $derived(
|
|
44
|
+
[
|
|
45
|
+
help ? `${formId}-help` : '',
|
|
46
|
+
fileError ? `${formId}-file-error` : '',
|
|
47
|
+
reselectFile ? `${formId}-reselect` : '',
|
|
48
|
+
]
|
|
49
|
+
.filter(Boolean)
|
|
50
|
+
.join(' ') || undefined,
|
|
51
|
+
);
|
|
52
|
+
</script>
|
|
53
|
+
|
|
54
|
+
{#if canUpload}
|
|
55
|
+
<Form id={formId} {action} method="post" enctype="multipart/form-data" preventDefault={false} {onsubmit} aria-busy={busy}>
|
|
56
|
+
<div class="upload-fields">
|
|
57
|
+
{#each hiddenFields as field}<Input type="hidden" name={field.name} value={field.value} interaction={false} />{/each}
|
|
58
|
+
{#if message}<p role="alert">{message}</p>{/if}
|
|
59
|
+
{#if retryStatus === 'transport-error'}<p role="status">{t(M['assets.attachments.uncertain'])}</p>{/if}
|
|
60
|
+
<FilePicker id={`${formId}-file`} name={fileField} {accept} required label={t(M['assets.attachments.choose'])} description={t(M['assets.attachments.browse'])} aria-describedby={fileHelp} aria-invalid={fileError ? 'true' : undefined} />
|
|
61
|
+
{#if help}<p id={`${formId}-help`}>{help}</p>{/if}
|
|
62
|
+
{#if fileError}<p id={`${formId}-file-error`} role="alert">{fileError}</p>{/if}
|
|
63
|
+
{#if reselectFile}<p id={`${formId}-reselect`}>{t(M['assets.attachments.reselect'])}</p>{/if}
|
|
64
|
+
<FormGroup label={t(M['assets.attachments.description'])} id={`${formId}-description`} error={descriptionError}>
|
|
65
|
+
<Textarea name={descriptionField} value={description} />
|
|
66
|
+
</FormGroup>
|
|
67
|
+
{@render children?.()}
|
|
68
|
+
<div><Button type="submit" name={intentField} value={intent} disabled={busy}>{submitLabel ?? t(M['assets.attachments.upload'])}</Button></div>
|
|
69
|
+
</div>
|
|
70
|
+
</Form>
|
|
71
|
+
{:else}
|
|
72
|
+
<p>{t(M['assets.attachments.readonly'])}</p>
|
|
73
|
+
{/if}
|
|
74
|
+
|
|
75
|
+
<style>
|
|
76
|
+
.upload-fields { display: grid; gap: var(--smrt-spacing-3); min-width: 0; overflow-wrap: anywhere; }
|
|
77
|
+
p { margin: 0; }
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AttachmentUploadProps } from '../attachments/types.js';
|
|
2
|
+
/** Native multipart upload preserving caller request identity and failure values. */
|
|
3
|
+
export interface Props extends AttachmentUploadProps {
|
|
4
|
+
}
|
|
5
|
+
declare const AttachmentUpload: import("svelte").Component<Props, {}, "">;
|
|
6
|
+
type AttachmentUpload = ReturnType<typeof AttachmentUpload>;
|
|
7
|
+
export default AttachmentUpload;
|
|
8
|
+
//# sourceMappingURL=AttachmentUpload.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentUpload.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/components/AttachmentUpload.svelte.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAErE,qFAAqF;AACrF,MAAM,WAAW,KAAM,SAAQ,qBAAqB;CAAG;AAwEvD,QAAA,MAAM,gBAAgB,2CAAwC,CAAC;AAC/D,KAAK,gBAAgB,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAC5D,eAAe,gBAAgB,CAAC"}
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -16,4 +16,9 @@ import AssetToolbar from './AssetToolbar.svelte';
|
|
|
16
16
|
import CreateAssetModal from './CreateAssetModal.svelte';
|
|
17
17
|
export type { ActionBarProps, AssetAction, AssetFilters, AssetGridProps, AssetListProps, AssetManagerMode, AssetManagerProps, AssetSort, AssetSortDirection, AssetSortField, AssetToolbarProps, AssetViewMode, } from './types';
|
|
18
18
|
export { ActionBar, AssetDetail, AssetGrid, AssetList, AssetManager, AssetToolbar, CreateAssetModal, };
|
|
19
|
+
import AttachmentList from './components/AttachmentList.svelte';
|
|
20
|
+
import AttachmentPanel from './components/AttachmentPanel.svelte';
|
|
21
|
+
import AttachmentUpload from './components/AttachmentUpload.svelte';
|
|
22
|
+
export type { AssetAttachment, AssetAttachmentVersion, AttachmentListProps, AttachmentPanelProps, AttachmentRequestField, AttachmentUploadProps, } from './attachments/types.js';
|
|
23
|
+
export { AttachmentList, AttachmentPanel, AttachmentUpload };
|
|
19
24
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/svelte/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AAGzD,YAAY,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/svelte/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,WAAW,MAAM,sBAAsB,CAAC;AAC/C,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAC3C,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,gBAAgB,MAAM,2BAA2B,CAAC;AAGzD,YAAY,EACV,cAAc,EACd,WAAW,EACX,YAAY,EACZ,cAAc,EACd,cAAc,EACd,gBAAgB,EAChB,iBAAiB,EACjB,SAAS,EACT,kBAAkB,EAClB,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC;AAEjB,OAAO,EACL,SAAS,EACT,WAAW,EACX,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,GACjB,CAAC;AAwCF,OAAO,cAAc,MAAM,oCAAoC,CAAC;AAChE,OAAO,eAAe,MAAM,qCAAqC,CAAC;AAClE,OAAO,gBAAgB,MAAM,sCAAsC,CAAC;AAEpE,YAAY,EACV,eAAe,EACf,sBAAsB,EACtB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/svelte/index.js
CHANGED
|
@@ -28,3 +28,10 @@ ModuleUIRegistry.register('@happyvertical/smrt-assets', 'asset-detail', AssetDet
|
|
|
28
28
|
ModuleUIRegistry.register('@happyvertical/smrt-assets', 'asset-toolbar', AssetToolbar);
|
|
29
29
|
ModuleUIRegistry.register('@happyvertical/smrt-assets', 'asset-action-bar', ActionBar);
|
|
30
30
|
ModuleUIRegistry.register('@happyvertical/smrt-assets', 'asset-create-modal', CreateAssetModal);
|
|
31
|
+
import AttachmentList from './components/AttachmentList.svelte';
|
|
32
|
+
import AttachmentPanel from './components/AttachmentPanel.svelte';
|
|
33
|
+
import AttachmentUpload from './components/AttachmentUpload.svelte';
|
|
34
|
+
export { AttachmentList, AttachmentPanel, AttachmentUpload };
|
|
35
|
+
ModuleUIRegistry.register('@happyvertical/smrt-assets', 'attachment-list', AttachmentList);
|
|
36
|
+
ModuleUIRegistry.register('@happyvertical/smrt-assets', 'attachment-upload', AttachmentUpload);
|
|
37
|
+
ModuleUIRegistry.register('@happyvertical/smrt-assets', 'attachment-panel', AttachmentPanel);
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { Checkbox } from '@happyvertical/smrt-ui/forms';
|
|
3
|
+
import AttachmentPanel from '../components/AttachmentPanel.svelte';
|
|
4
|
+
|
|
5
|
+
let canUpload = $state(true);
|
|
6
|
+
let description = $state('Supporting document for review');
|
|
7
|
+
let message = $state('');
|
|
8
|
+
function submit(event: SubmitEvent & { currentTarget: HTMLFormElement }) {
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
const data = new FormData(event.currentTarget, event.submitter);
|
|
11
|
+
description = String(data.get('description') ?? '');
|
|
12
|
+
message =
|
|
13
|
+
'Simulated server rejection. Your description and request identity are retained; this preview does not upload files.';
|
|
14
|
+
}
|
|
15
|
+
</script>
|
|
16
|
+
<div class="preview">
|
|
17
|
+
<Checkbox label="May upload attachments" bind:checked={canUpload} />
|
|
18
|
+
<AttachmentPanel attachments={[{ id: 'document-v2', name: 'Supplier quote.pdf', mimeType: 'application/pdf', version: 2, note: 'Corrected supplier reference', statusLabel: 'Awaiting review', versions: [{ id: 'document-v1', name: 'Supplier quote.pdf', mimeType: 'application/pdf', version: 1, note: 'Original supplied document' }] }]}
|
|
19
|
+
upload={{ action: '', canUpload, description, message, help: 'Preview accepts a local file but never sends it.', hiddenFields: [{ name: 'requestId', value: 'preview-request-retained' }], onsubmit: submit }} />
|
|
20
|
+
</div>
|
|
21
|
+
<style>.preview { display: grid; gap: var(--smrt-spacing-4); }</style>
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
declare const AttachmentPanelPreview: import("svelte").Component<Record<string, never>, {}, "">;
|
|
2
|
+
type AttachmentPanelPreview = ReturnType<typeof AttachmentPanelPreview>;
|
|
3
|
+
export default AttachmentPanelPreview;
|
|
4
|
+
//# sourceMappingURL=AttachmentPanelPreview.svelte.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AttachmentPanelPreview.svelte.d.ts","sourceRoot":"","sources":["../../../src/svelte/playground/AttachmentPanelPreview.svelte.ts"],"names":[],"mappings":"AA6BA,QAAA,MAAM,sBAAsB,2DAAwC,CAAC;AACrE,KAAK,sBAAsB,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC;AACxE,eAAe,sBAAsB,CAAC"}
|
|
@@ -2,7 +2,26 @@ declare const _default: {
|
|
|
2
2
|
packageName: string;
|
|
3
3
|
displayName: string;
|
|
4
4
|
description: string;
|
|
5
|
-
entries: {
|
|
5
|
+
entries: ({
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
loadComponent: () => Promise<typeof import("./playground/AttachmentPanelPreview.svelte")>;
|
|
10
|
+
order: number;
|
|
11
|
+
props: {
|
|
12
|
+
assets?: undefined;
|
|
13
|
+
selectedIds?: undefined;
|
|
14
|
+
loading?: undefined;
|
|
15
|
+
onSelectionChange?: undefined;
|
|
16
|
+
onAssetClick?: undefined;
|
|
17
|
+
};
|
|
18
|
+
modes: {
|
|
19
|
+
mock: {
|
|
20
|
+
label: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
tags?: undefined;
|
|
24
|
+
} | {
|
|
6
25
|
id: string;
|
|
7
26
|
title: string;
|
|
8
27
|
description: string;
|
|
@@ -41,7 +60,7 @@ declare const _default: {
|
|
|
41
60
|
label: string;
|
|
42
61
|
};
|
|
43
62
|
};
|
|
44
|
-
}[];
|
|
63
|
+
})[];
|
|
45
64
|
};
|
|
46
65
|
export default _default;
|
|
47
66
|
//# sourceMappingURL=playground.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"playground.d.ts","sourceRoot":"","sources":["../../src/svelte/playground.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDA,wBAqCE"}
|
|
@@ -54,6 +54,15 @@ export default {
|
|
|
54
54
|
displayName: 'Assets',
|
|
55
55
|
description: 'Component previews for asset browsing, selection, and media states.',
|
|
56
56
|
entries: [
|
|
57
|
+
{
|
|
58
|
+
id: 'private-attachments',
|
|
59
|
+
title: 'Private Attachments',
|
|
60
|
+
description: 'Native upload, retained metadata and version history.',
|
|
61
|
+
loadComponent: () => import('./playground/AttachmentPanelPreview.svelte'),
|
|
62
|
+
order: 8,
|
|
63
|
+
props: {},
|
|
64
|
+
modes: { mock: { label: 'Mock' } },
|
|
65
|
+
},
|
|
57
66
|
{
|
|
58
67
|
id: 'asset-grid',
|
|
59
68
|
title: 'Asset Grid',
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE9E;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CA6FxD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,EAAE,cAehC,CAAC"}
|
package/dist/ui.js
CHANGED
|
@@ -1,5 +1,32 @@
|
|
|
1
1
|
//#region src/ui.ts
|
|
2
2
|
var ASSETS_UI_SLOTS = {
|
|
3
|
+
"attachment-list": {
|
|
4
|
+
id: "attachment-list",
|
|
5
|
+
label: "Attachment List",
|
|
6
|
+
description: "Authorized private links and supplied version history",
|
|
7
|
+
icon: "file-text",
|
|
8
|
+
category: "list",
|
|
9
|
+
order: 8,
|
|
10
|
+
propsInterface: "AttachmentListProps"
|
|
11
|
+
},
|
|
12
|
+
"attachment-upload": {
|
|
13
|
+
id: "attachment-upload",
|
|
14
|
+
label: "Attachment Upload",
|
|
15
|
+
description: "Native multipart upload with retained request fields and recovery guidance",
|
|
16
|
+
icon: "upload",
|
|
17
|
+
category: "form",
|
|
18
|
+
order: 9,
|
|
19
|
+
propsInterface: "AttachmentUploadProps"
|
|
20
|
+
},
|
|
21
|
+
"attachment-panel": {
|
|
22
|
+
id: "attachment-panel",
|
|
23
|
+
label: "Attachments",
|
|
24
|
+
description: "Attachment list and optional native upload composition",
|
|
25
|
+
icon: "file-text",
|
|
26
|
+
category: "display",
|
|
27
|
+
order: 10,
|
|
28
|
+
propsInterface: "AttachmentPanelProps"
|
|
29
|
+
},
|
|
3
30
|
"asset-manager": {
|
|
4
31
|
id: "asset-manager",
|
|
5
32
|
label: "Asset Manager",
|
package/dist/ui.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","names":[],"sources":["../src/ui.ts"],"sourcesContent":["/**\n * Assets Module UI Slot Declarations\n *\n * This file defines the UI extension points for the assets module.\n * UI components are implemented in the ./svelte subpath.\n */\n\nimport type { ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';\n\n/**\n * Assets module UI slots\n */\nexport const ASSETS_UI_SLOTS: Record<string, ModuleUISlot> = {\n 'asset-manager': {\n id: 'asset-manager',\n label: 'Asset Manager',\n description:\n 'Combined asset management surface with toolbar, grid/list view, detail, and selection',\n icon: 'folder-image',\n category: 'admin',\n order: 1,\n propsInterface: 'AssetManagerProps',\n },\n 'asset-grid': {\n id: 'asset-grid',\n label: 'Asset Grid',\n description: 'Grid view of asset thumbnails with selection',\n icon: 'grid',\n category: 'list',\n order: 2,\n propsInterface: 'AssetGridProps',\n },\n 'asset-list': {\n id: 'asset-list',\n label: 'Asset List',\n description: 'Sortable list view of assets with metadata columns',\n icon: 'list',\n category: 'list',\n order: 3,\n propsInterface: 'AssetListProps',\n },\n 'asset-detail': {\n id: 'asset-detail',\n label: 'Asset Detail',\n description: 'Detailed view of a single asset with metadata and preview',\n icon: 'file-text',\n category: 'detail',\n order: 4,\n propsInterface: 'AssetDetailProps',\n },\n 'asset-toolbar': {\n id: 'asset-toolbar',\n label: 'Asset Toolbar',\n description: 'Toolbar with view toggle, filters, sort, and upload action',\n icon: 'sliders',\n category: 'action',\n order: 5,\n propsInterface: 'AssetToolbarProps',\n },\n 'asset-action-bar': {\n id: 'asset-action-bar',\n label: 'Asset Action Bar',\n description: 'Bulk action bar shown when assets are selected',\n icon: 'more-horizontal',\n category: 'action',\n order: 6,\n propsInterface: 'ActionBarProps',\n },\n 'asset-create-modal': {\n id: 'asset-create-modal',\n label: 'Create Asset Modal',\n description: 'Modal dialog for uploading and creating a new asset',\n icon: 'upload',\n category: 'form',\n order: 7,\n propsInterface: 'CreateAssetModalProps',\n },\n};\n\n/**\n * Assets module metadata\n */\nexport const ASSETS_MODULE_META: SmrtModuleMeta = {\n name: '@happyvertical/smrt-assets',\n displayName: 'Assets',\n description:\n 'Provider-agnostic asset management with versioning, metadata, folders, and associations',\n uiSlots: ASSETS_UI_SLOTS,\n models: ['Asset', 'AssetType', 'AssetStatus', 'AssetMetafield', 'Folder'],\n collections: [\n 'AssetCollection',\n 'AssetTypeCollection',\n 'AssetStatusCollection',\n 'AssetMetafieldCollection',\n 'AssetAssociationCollection',\n 'FolderCollection',\n ],\n};\n"],"mappings":";AAYO,IAAM,kBAAgD;CAC3D,iBAAiB;EACf,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,cAAc;EACZ,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,cAAc;EACZ,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,gBAAgB;EACd,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,iBAAiB;EACf,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,oBAAoB;EAClB,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,sBAAsB;EACpB,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;AACF;AAKO,IAAM,qBAAqC;CAChD,MAAM;CACN,aAAa;CACb,aACE;CACF,SAAS;CACT,QAAQ;EAAC;EAAS;EAAa;EAAe;EAAkB;CAAQ;CACxE,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"ui.js","names":[],"sources":["../src/ui.ts"],"sourcesContent":["/**\n * Assets Module UI Slot Declarations\n *\n * This file defines the UI extension points for the assets module.\n * UI components are implemented in the ./svelte subpath.\n */\n\nimport type { ModuleUISlot, SmrtModuleMeta } from '@happyvertical/smrt-types';\n\n/**\n * Assets module UI slots\n */\nexport const ASSETS_UI_SLOTS: Record<string, ModuleUISlot> = {\n 'attachment-list': {\n id: 'attachment-list',\n label: 'Attachment List',\n description: 'Authorized private links and supplied version history',\n icon: 'file-text',\n category: 'list',\n order: 8,\n propsInterface: 'AttachmentListProps',\n },\n 'attachment-upload': {\n id: 'attachment-upload',\n label: 'Attachment Upload',\n description:\n 'Native multipart upload with retained request fields and recovery guidance',\n icon: 'upload',\n category: 'form',\n order: 9,\n propsInterface: 'AttachmentUploadProps',\n },\n 'attachment-panel': {\n id: 'attachment-panel',\n label: 'Attachments',\n description: 'Attachment list and optional native upload composition',\n icon: 'file-text',\n category: 'display',\n order: 10,\n propsInterface: 'AttachmentPanelProps',\n },\n 'asset-manager': {\n id: 'asset-manager',\n label: 'Asset Manager',\n description:\n 'Combined asset management surface with toolbar, grid/list view, detail, and selection',\n icon: 'folder-image',\n category: 'admin',\n order: 1,\n propsInterface: 'AssetManagerProps',\n },\n 'asset-grid': {\n id: 'asset-grid',\n label: 'Asset Grid',\n description: 'Grid view of asset thumbnails with selection',\n icon: 'grid',\n category: 'list',\n order: 2,\n propsInterface: 'AssetGridProps',\n },\n 'asset-list': {\n id: 'asset-list',\n label: 'Asset List',\n description: 'Sortable list view of assets with metadata columns',\n icon: 'list',\n category: 'list',\n order: 3,\n propsInterface: 'AssetListProps',\n },\n 'asset-detail': {\n id: 'asset-detail',\n label: 'Asset Detail',\n description: 'Detailed view of a single asset with metadata and preview',\n icon: 'file-text',\n category: 'detail',\n order: 4,\n propsInterface: 'AssetDetailProps',\n },\n 'asset-toolbar': {\n id: 'asset-toolbar',\n label: 'Asset Toolbar',\n description: 'Toolbar with view toggle, filters, sort, and upload action',\n icon: 'sliders',\n category: 'action',\n order: 5,\n propsInterface: 'AssetToolbarProps',\n },\n 'asset-action-bar': {\n id: 'asset-action-bar',\n label: 'Asset Action Bar',\n description: 'Bulk action bar shown when assets are selected',\n icon: 'more-horizontal',\n category: 'action',\n order: 6,\n propsInterface: 'ActionBarProps',\n },\n 'asset-create-modal': {\n id: 'asset-create-modal',\n label: 'Create Asset Modal',\n description: 'Modal dialog for uploading and creating a new asset',\n icon: 'upload',\n category: 'form',\n order: 7,\n propsInterface: 'CreateAssetModalProps',\n },\n};\n\n/**\n * Assets module metadata\n */\nexport const ASSETS_MODULE_META: SmrtModuleMeta = {\n name: '@happyvertical/smrt-assets',\n displayName: 'Assets',\n description:\n 'Provider-agnostic asset management with versioning, metadata, folders, and associations',\n uiSlots: ASSETS_UI_SLOTS,\n models: ['Asset', 'AssetType', 'AssetStatus', 'AssetMetafield', 'Folder'],\n collections: [\n 'AssetCollection',\n 'AssetTypeCollection',\n 'AssetStatusCollection',\n 'AssetMetafieldCollection',\n 'AssetAssociationCollection',\n 'FolderCollection',\n ],\n};\n"],"mappings":";AAYO,IAAM,kBAAgD;CAC3D,mBAAmB;EACjB,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,qBAAqB;EACnB,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,oBAAoB;EAClB,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,iBAAiB;EACf,IAAI;EACJ,OAAO;EACP,aACE;EACF,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,cAAc;EACZ,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,cAAc;EACZ,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,gBAAgB;EACd,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,iBAAiB;EACf,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,oBAAoB;EAClB,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;CACA,sBAAsB;EACpB,IAAI;EACJ,OAAO;EACP,aAAa;EACb,MAAM;EACN,UAAU;EACV,OAAO;EACP,gBAAgB;CAClB;AACF;AAKO,IAAM,qBAAqC;CAChD,MAAM;CACN,aAAa;CACb,aACE;CACF,SAAS;CACT,QAAQ;EAAC;EAAS;EAAa;EAAe;EAAkB;CAAQ;CACxE,aAAa;EACX;EACA;EACA;EACA;EACA;EACA;CACF;AACF"}
|
package/dist/workbench.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as playground_default } from "./chunks/playground-
|
|
1
|
+
import { t as playground_default } from "./chunks/playground-CGd8_X0M.js";
|
|
2
2
|
import AssetManagerRoute from "./svelte/routes/AssetManagerRoute.svelte";
|
|
3
3
|
var ASSETS_ROUTE_META = { manager: {
|
|
4
4
|
id: { manager: "@happyvertical/smrt-assets:manager" }.manager,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@happyvertical/smrt-assets",
|
|
3
|
-
"version": "0.53.
|
|
3
|
+
"version": "0.53.5",
|
|
4
4
|
"smrtJsdoc": "strict",
|
|
5
5
|
"description": "Asset management system with versioning, metadata, and AI-powered operations for SMRT framework",
|
|
6
6
|
"type": "module",
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
"types": "./dist/index.d.ts",
|
|
10
10
|
"files": [
|
|
11
11
|
"dist",
|
|
12
|
+
"agents",
|
|
12
13
|
"CLAUDE.md",
|
|
13
14
|
"AGENTS.md"
|
|
14
15
|
],
|
|
@@ -43,16 +44,16 @@
|
|
|
43
44
|
}
|
|
44
45
|
},
|
|
45
46
|
"dependencies": {
|
|
46
|
-
"@happyvertical/ai": "^0.
|
|
47
|
-
"@happyvertical/files": "^0.
|
|
48
|
-
"@happyvertical/logger": "^0.
|
|
49
|
-
"@happyvertical/smrt-core": "0.53.
|
|
50
|
-
"@happyvertical/smrt-tags": "0.53.
|
|
51
|
-
"@happyvertical/smrt-tenancy": "0.53.
|
|
52
|
-
"@happyvertical/smrt-types": "0.53.
|
|
53
|
-
"@happyvertical/smrt-ui": "0.53.
|
|
54
|
-
"@happyvertical/sql": "^0.
|
|
55
|
-
"@happyvertical/utils": "^0.
|
|
47
|
+
"@happyvertical/ai": "^0.100.3",
|
|
48
|
+
"@happyvertical/files": "^0.100.3",
|
|
49
|
+
"@happyvertical/logger": "^0.100.3",
|
|
50
|
+
"@happyvertical/smrt-core": "0.53.5",
|
|
51
|
+
"@happyvertical/smrt-tags": "0.53.5",
|
|
52
|
+
"@happyvertical/smrt-tenancy": "0.53.5",
|
|
53
|
+
"@happyvertical/smrt-types": "0.53.5",
|
|
54
|
+
"@happyvertical/smrt-ui": "0.53.5",
|
|
55
|
+
"@happyvertical/sql": "^0.100.3",
|
|
56
|
+
"@happyvertical/utils": "^0.100.3"
|
|
56
57
|
},
|
|
57
58
|
"peerDependencies": {
|
|
58
59
|
"svelte": "^5.57.0"
|
|
@@ -63,8 +64,8 @@
|
|
|
63
64
|
}
|
|
64
65
|
},
|
|
65
66
|
"devDependencies": {
|
|
66
|
-
"@happyvertical/smrt-playground": "0.53.
|
|
67
|
-
"@happyvertical/smrt-vitest": "0.53.
|
|
67
|
+
"@happyvertical/smrt-playground": "0.53.5",
|
|
68
|
+
"@happyvertical/smrt-vitest": "0.53.5",
|
|
68
69
|
"@sveltejs/adapter-auto": "^7.0.1",
|
|
69
70
|
"@sveltejs/kit": "2.69.1",
|
|
70
71
|
"@sveltejs/package": "^2.5.8",
|
|
@@ -104,9 +105,11 @@
|
|
|
104
105
|
"dev": "vite dev",
|
|
105
106
|
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.kit.json",
|
|
106
107
|
"pretest": "[ -f ../cli/dist/index.js ] && node ../cli/dist/index.js test --manifest-only || true",
|
|
107
|
-
"test": "vitest run",
|
|
108
|
+
"test": "vitest run && pnpm run test:ui",
|
|
108
109
|
"test:watch": "vitest",
|
|
109
110
|
"typecheck": "svelte-kit sync && tsc -p tsconfig.typecheck.json && node ../../scripts/svelte-check-a11y.mjs --tsconfig ./tsconfig.kit.json",
|
|
110
|
-
"verify:pack": "node ../../scripts/verify-package-types-exports.js ."
|
|
111
|
+
"verify:pack": "node ../../scripts/verify-package-types-exports.js .",
|
|
112
|
+
"test:ui": "vitest run --config vitest.attachments.config.ts",
|
|
113
|
+
"test:e2e": "playwright test -c e2e/attachments/playwright.config.ts"
|
|
111
114
|
}
|
|
112
115
|
}
|