img-upload-kit 0.0.0-stage → 2.0.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 (112) hide show
  1. package/CHANGELOG.md +89 -0
  2. package/LICENSE +21 -0
  3. package/MIGRATION.md +192 -0
  4. package/README.md +242 -2
  5. package/dist/bin.js +1186 -0
  6. package/dist/bin.js.map +1 -0
  7. package/dist/blur.cjs +41 -0
  8. package/dist/blur.cjs.map +1 -0
  9. package/dist/blur.d.cts +17 -0
  10. package/dist/blur.d.ts +17 -0
  11. package/dist/blur.js +41 -0
  12. package/dist/blur.js.map +1 -0
  13. package/dist/blurDataUtils-DveBRtqE.d.cts +43 -0
  14. package/dist/blurDataUtils-yx9Q6HlU.d.ts +43 -0
  15. package/dist/blurService-D5TpMNji.d.ts +83 -0
  16. package/dist/blurService-DacwylJx.d.cts +83 -0
  17. package/dist/chunk-2OVNXHTN.cjs +514 -0
  18. package/dist/chunk-2OVNXHTN.cjs.map +1 -0
  19. package/dist/chunk-3ICG2SLL.cjs +135 -0
  20. package/dist/chunk-3ICG2SLL.cjs.map +1 -0
  21. package/dist/chunk-4ASFG3KB.js +514 -0
  22. package/dist/chunk-4ASFG3KB.js.map +1 -0
  23. package/dist/chunk-AI3JJLSA.js +2370 -0
  24. package/dist/chunk-AI3JJLSA.js.map +1 -0
  25. package/dist/chunk-CV23O4YU.js +145 -0
  26. package/dist/chunk-CV23O4YU.js.map +1 -0
  27. package/dist/chunk-G7LLSKBV.js +158 -0
  28. package/dist/chunk-G7LLSKBV.js.map +1 -0
  29. package/dist/chunk-IB3TEDLR.js +294 -0
  30. package/dist/chunk-IB3TEDLR.js.map +1 -0
  31. package/dist/chunk-KJVYWKIG.cjs +158 -0
  32. package/dist/chunk-KJVYWKIG.cjs.map +1 -0
  33. package/dist/chunk-NEDBIIE3.cjs +226 -0
  34. package/dist/chunk-NEDBIIE3.cjs.map +1 -0
  35. package/dist/chunk-QHU7FUO4.cjs +37 -0
  36. package/dist/chunk-QHU7FUO4.cjs.map +1 -0
  37. package/dist/chunk-QQHZJKNA.js +135 -0
  38. package/dist/chunk-QQHZJKNA.js.map +1 -0
  39. package/dist/chunk-S2IFAWJK.js +37 -0
  40. package/dist/chunk-S2IFAWJK.js.map +1 -0
  41. package/dist/chunk-TT5C7K3Q.js +226 -0
  42. package/dist/chunk-TT5C7K3Q.js.map +1 -0
  43. package/dist/chunk-U2TWTEBY.cjs +2370 -0
  44. package/dist/chunk-U2TWTEBY.cjs.map +1 -0
  45. package/dist/chunk-WISG74VL.cjs +294 -0
  46. package/dist/chunk-WISG74VL.cjs.map +1 -0
  47. package/dist/chunk-YRXXQUDE.cjs +145 -0
  48. package/dist/chunk-YRXXQUDE.cjs.map +1 -0
  49. package/dist/cli.cjs +1241 -0
  50. package/dist/cli.cjs.map +1 -0
  51. package/dist/cli.d.cts +99 -0
  52. package/dist/cli.d.ts +99 -0
  53. package/dist/cli.js +1194 -0
  54. package/dist/cli.js.map +1 -0
  55. package/dist/headless.cjs +27 -0
  56. package/dist/headless.cjs.map +1 -0
  57. package/dist/headless.d.cts +4 -0
  58. package/dist/headless.d.ts +4 -0
  59. package/dist/headless.js +27 -0
  60. package/dist/headless.js.map +1 -0
  61. package/dist/index-BIdnqtW8.d.ts +234 -0
  62. package/dist/index-Brk_uHs6.d.cts +234 -0
  63. package/dist/index-CPMlaQsC.d.ts +635 -0
  64. package/dist/index-DHINe-rA.d.cts +635 -0
  65. package/dist/index.cjs +65 -0
  66. package/dist/index.cjs.map +1 -0
  67. package/dist/index.d.cts +43 -0
  68. package/dist/index.d.ts +43 -0
  69. package/dist/index.js +65 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/memoryAdapter-Ck0ccZbF.d.cts +25 -0
  72. package/dist/memoryAdapter-DxEKaG0b.d.ts +25 -0
  73. package/dist/placeholders-C4ftwaII.d.ts +5 -0
  74. package/dist/placeholders-x_3rt65M.d.cts +5 -0
  75. package/dist/react.cjs +3779 -0
  76. package/dist/react.cjs.map +1 -0
  77. package/dist/react.d.cts +476 -0
  78. package/dist/react.d.ts +476 -0
  79. package/dist/react.js +3779 -0
  80. package/dist/react.js.map +1 -0
  81. package/dist/server-handler.cjs +14 -0
  82. package/dist/server-handler.cjs.map +1 -0
  83. package/dist/server-handler.d.cts +3 -0
  84. package/dist/server-handler.d.ts +3 -0
  85. package/dist/server-handler.js +14 -0
  86. package/dist/server-handler.js.map +1 -0
  87. package/dist/server.cjs +1801 -0
  88. package/dist/server.cjs.map +1 -0
  89. package/dist/server.d.cts +142 -0
  90. package/dist/server.d.ts +142 -0
  91. package/dist/server.js +1801 -0
  92. package/dist/server.js.map +1 -0
  93. package/dist/storage.cjs +447 -0
  94. package/dist/storage.cjs.map +1 -0
  95. package/dist/storage.d.cts +163 -0
  96. package/dist/storage.d.ts +163 -0
  97. package/dist/storage.js +447 -0
  98. package/dist/storage.js.map +1 -0
  99. package/dist/styles/animated-image.css +112 -0
  100. package/dist/styles/dropzone-and-tiles.css +247 -0
  101. package/dist/styles/modals-and-dock.css +248 -0
  102. package/dist/styles/primitives.css +197 -0
  103. package/dist/styles/quality-and-inputs.css +184 -0
  104. package/dist/styles/tokens.css +123 -0
  105. package/dist/styles.css +1122 -0
  106. package/dist/types-BrP-o9nd.d.cts +85 -0
  107. package/dist/types-sZ3KoFQY.d.ts +85 -0
  108. package/dist/types-yShGNQnW.d.cts +61 -0
  109. package/dist/types-yShGNQnW.d.ts +61 -0
  110. package/dist/upload-C5Trd6Dh.d.cts +154 -0
  111. package/dist/upload-C5Trd6Dh.d.ts +154 -0
  112. package/package.json +198 -4
@@ -0,0 +1,163 @@
1
+ import { S as StorageAdapter, a as StorageListOptions, b as StoragePaginatedListResult } from './types-BrP-o9nd.cjs';
2
+ export { c as StorageFileEntry, d as StorageFileMetadata, e as StorageListResult, f as StorageUploadOptions, g as StorageUploadParams, h as StorageUploadResult, U as UploadRecordHook, i as createStorageAdapter, t as toPaginatedListResult, v as validateStorageMetadata } from './types-BrP-o9nd.cjs';
3
+ export { M as MemoryStorageAdapter, a as MemoryStorageOptions, S as StoredMemoryObject, c as createMemoryStorageAdapter } from './memoryAdapter-Ck0ccZbF.cjs';
4
+ import './upload-C5Trd6Dh.cjs';
5
+
6
+ interface LocalFsStorageOptions {
7
+ /** Absolute or relative root directory on disk (e.g. `./public/uploads`) */
8
+ rootDir: string;
9
+ /** Public URL prefix matching `rootDir` (e.g. `/uploads` or `https://cdn.example.com/uploads`) */
10
+ baseUrl?: string;
11
+ /** Include the bucket segment as a subdirectory under `rootDir`. Defaults to `true`. */
12
+ includeBucketInPath?: boolean;
13
+ }
14
+ interface LocalFsStorageAdapter extends StorageAdapter {
15
+ exists(bucket: string, relativePath: string): Promise<boolean>;
16
+ getPublicUrl(bucket: string, relativePath: string): string;
17
+ list(bucket: string, folder?: string, options?: StorageListOptions): Promise<StoragePaginatedListResult>;
18
+ deleteByUrl(url: string): Promise<boolean>;
19
+ parseUrl(url: string): {
20
+ bucket?: string;
21
+ path: string;
22
+ } | null;
23
+ }
24
+ declare function createLocalFsStorageAdapter(options: LocalFsStorageOptions): LocalFsStorageAdapter;
25
+
26
+ interface S3PutObjectInput {
27
+ Bucket: string;
28
+ Key: string;
29
+ Body: Buffer | Uint8Array;
30
+ ContentType: string;
31
+ CacheControl?: string;
32
+ Metadata?: Record<string, string>;
33
+ IfNoneMatch?: string;
34
+ }
35
+ interface S3DeleteObjectInput {
36
+ Bucket: string;
37
+ Key: string;
38
+ }
39
+ interface S3HeadObjectInput {
40
+ Bucket: string;
41
+ Key: string;
42
+ }
43
+ interface S3ListObjectsInput {
44
+ Bucket: string;
45
+ Prefix?: string;
46
+ MaxKeys?: number;
47
+ ContinuationToken?: string;
48
+ }
49
+ interface S3ListedObject {
50
+ Key?: string;
51
+ Size?: number;
52
+ LastModified?: Date | string;
53
+ }
54
+ interface S3ListObjectsOutput {
55
+ Contents?: S3ListedObject[];
56
+ NextContinuationToken?: string;
57
+ IsTruncated?: boolean;
58
+ }
59
+ /** Structural S3 / Cloudflare R2 / MinIO transport with zero runtime SDK dependency. */
60
+ interface S3TransportLike {
61
+ putObject(input: S3PutObjectInput): Promise<unknown>;
62
+ deleteObject(input: S3DeleteObjectInput): Promise<unknown>;
63
+ headObject?(input: S3HeadObjectInput): Promise<unknown>;
64
+ listObjects?(input: S3ListObjectsInput): Promise<S3ListObjectsOutput>;
65
+ listObjectsV2?(input: S3ListObjectsInput): Promise<S3ListObjectsOutput>;
66
+ }
67
+ type S3PublicUrlBuilder = (bucket: string, path: string) => string;
68
+ interface S3StorageBaseOptions {
69
+ /** Public base URL prefix (e.g. `'https://cdn.example.com'`) or `(bucket, path) => string` builder. */
70
+ publicBaseUrl: string | S3PublicUrlBuilder;
71
+ /** Default `Cache-Control` header applied when `StorageUploadParams.cacheControl` is omitted. */
72
+ cacheControl?: string;
73
+ /** Include `bucket` segment in string-prefix URLs (`${publicBaseUrl}/${bucket}/${path}`). Defaults to `true`. */
74
+ includeBucketInUrl?: boolean;
75
+ /** Fallback bucket used by `deleteByUrl` when `includeBucketInUrl` is `false`. */
76
+ defaultBucket?: string;
77
+ }
78
+ type S3StorageAdapterOptions = S3StorageBaseOptions & ((S3TransportLike & {
79
+ client?: never;
80
+ transport?: never;
81
+ }) | {
82
+ client: S3TransportLike;
83
+ transport?: never;
84
+ putObject?: never;
85
+ } | {
86
+ transport: S3TransportLike;
87
+ client?: never;
88
+ putObject?: never;
89
+ });
90
+ /** Zero-dependency S3 / Cloudflare R2 / MinIO `StorageAdapter`. */
91
+ declare function createS3StorageAdapter(options: S3StorageAdapterOptions): StorageAdapter;
92
+
93
+ /**
94
+ * Minimal structural interface matching `@supabase/supabase-js` Storage client,
95
+ * avoiding a mandatory `@supabase/supabase-js` runtime dependency.
96
+ */
97
+ interface SupabaseBucketClientLike {
98
+ upload(path: string, fileBody: Buffer | Uint8Array, fileOptions?: {
99
+ contentType?: string;
100
+ upsert?: boolean;
101
+ cacheControl?: string;
102
+ metadata?: Record<string, string>;
103
+ }): Promise<{
104
+ data: {
105
+ path: string;
106
+ } | null;
107
+ error: {
108
+ message: string;
109
+ } | null;
110
+ }>;
111
+ remove(paths: string[]): Promise<{
112
+ data?: unknown;
113
+ error: {
114
+ message: string;
115
+ } | null;
116
+ }>;
117
+ getPublicUrl(path: string): {
118
+ data: {
119
+ publicUrl: string;
120
+ };
121
+ };
122
+ list?(path?: string, options?: {
123
+ limit?: number;
124
+ offset?: number;
125
+ sortBy?: {
126
+ column: string;
127
+ order: string;
128
+ };
129
+ }): Promise<{
130
+ data: Array<{
131
+ name: string;
132
+ id: string | null;
133
+ created_at: string | null;
134
+ }> | null;
135
+ error: {
136
+ message: string;
137
+ } | null;
138
+ }>;
139
+ }
140
+ interface SupabaseStorageClientLike {
141
+ storage: {
142
+ from(bucket: string): SupabaseBucketClientLike;
143
+ };
144
+ }
145
+ interface SupabaseStorageAdapterOptions {
146
+ publicUrlPrefix?: string;
147
+ }
148
+ /**
149
+ * Plug in any `@supabase/supabase-js` client instance (e.g., service-role client)
150
+ * as a `StorageAdapter` with zero extra wrapper boilerplate.
151
+ */
152
+ declare function createSupabaseStorageAdapter(client: SupabaseStorageClientLike, options?: SupabaseStorageAdapterOptions): StorageAdapter;
153
+
154
+ interface PublicStorageInfo {
155
+ bucket: string;
156
+ path: string;
157
+ filename: string;
158
+ extension: string | null;
159
+ }
160
+ declare const DEFAULT_PUBLIC_STORAGE_PREFIX = "/storage/v1/object/public/";
161
+ declare function parsePublicStorageUrl(url?: string | null, publicPrefix?: string): PublicStorageInfo | null;
162
+
163
+ export { DEFAULT_PUBLIC_STORAGE_PREFIX, type LocalFsStorageAdapter, type LocalFsStorageOptions, type PublicStorageInfo, type S3DeleteObjectInput, type S3HeadObjectInput, type S3ListObjectsInput, type S3ListObjectsOutput, type S3ListedObject, type S3PublicUrlBuilder, type S3PutObjectInput, type S3StorageAdapterOptions, type S3StorageBaseOptions, type S3TransportLike, StorageAdapter, StorageListOptions, StoragePaginatedListResult, type SupabaseBucketClientLike, type SupabaseStorageAdapterOptions, type SupabaseStorageClientLike, createLocalFsStorageAdapter, createS3StorageAdapter, createSupabaseStorageAdapter, parsePublicStorageUrl };
@@ -0,0 +1,163 @@
1
+ import { S as StorageAdapter, a as StorageListOptions, b as StoragePaginatedListResult } from './types-sZ3KoFQY.js';
2
+ export { c as StorageFileEntry, d as StorageFileMetadata, e as StorageListResult, f as StorageUploadOptions, g as StorageUploadParams, h as StorageUploadResult, U as UploadRecordHook, i as createStorageAdapter, t as toPaginatedListResult, v as validateStorageMetadata } from './types-sZ3KoFQY.js';
3
+ export { M as MemoryStorageAdapter, a as MemoryStorageOptions, S as StoredMemoryObject, c as createMemoryStorageAdapter } from './memoryAdapter-DxEKaG0b.js';
4
+ import './upload-C5Trd6Dh.js';
5
+
6
+ interface LocalFsStorageOptions {
7
+ /** Absolute or relative root directory on disk (e.g. `./public/uploads`) */
8
+ rootDir: string;
9
+ /** Public URL prefix matching `rootDir` (e.g. `/uploads` or `https://cdn.example.com/uploads`) */
10
+ baseUrl?: string;
11
+ /** Include the bucket segment as a subdirectory under `rootDir`. Defaults to `true`. */
12
+ includeBucketInPath?: boolean;
13
+ }
14
+ interface LocalFsStorageAdapter extends StorageAdapter {
15
+ exists(bucket: string, relativePath: string): Promise<boolean>;
16
+ getPublicUrl(bucket: string, relativePath: string): string;
17
+ list(bucket: string, folder?: string, options?: StorageListOptions): Promise<StoragePaginatedListResult>;
18
+ deleteByUrl(url: string): Promise<boolean>;
19
+ parseUrl(url: string): {
20
+ bucket?: string;
21
+ path: string;
22
+ } | null;
23
+ }
24
+ declare function createLocalFsStorageAdapter(options: LocalFsStorageOptions): LocalFsStorageAdapter;
25
+
26
+ interface S3PutObjectInput {
27
+ Bucket: string;
28
+ Key: string;
29
+ Body: Buffer | Uint8Array;
30
+ ContentType: string;
31
+ CacheControl?: string;
32
+ Metadata?: Record<string, string>;
33
+ IfNoneMatch?: string;
34
+ }
35
+ interface S3DeleteObjectInput {
36
+ Bucket: string;
37
+ Key: string;
38
+ }
39
+ interface S3HeadObjectInput {
40
+ Bucket: string;
41
+ Key: string;
42
+ }
43
+ interface S3ListObjectsInput {
44
+ Bucket: string;
45
+ Prefix?: string;
46
+ MaxKeys?: number;
47
+ ContinuationToken?: string;
48
+ }
49
+ interface S3ListedObject {
50
+ Key?: string;
51
+ Size?: number;
52
+ LastModified?: Date | string;
53
+ }
54
+ interface S3ListObjectsOutput {
55
+ Contents?: S3ListedObject[];
56
+ NextContinuationToken?: string;
57
+ IsTruncated?: boolean;
58
+ }
59
+ /** Structural S3 / Cloudflare R2 / MinIO transport with zero runtime SDK dependency. */
60
+ interface S3TransportLike {
61
+ putObject(input: S3PutObjectInput): Promise<unknown>;
62
+ deleteObject(input: S3DeleteObjectInput): Promise<unknown>;
63
+ headObject?(input: S3HeadObjectInput): Promise<unknown>;
64
+ listObjects?(input: S3ListObjectsInput): Promise<S3ListObjectsOutput>;
65
+ listObjectsV2?(input: S3ListObjectsInput): Promise<S3ListObjectsOutput>;
66
+ }
67
+ type S3PublicUrlBuilder = (bucket: string, path: string) => string;
68
+ interface S3StorageBaseOptions {
69
+ /** Public base URL prefix (e.g. `'https://cdn.example.com'`) or `(bucket, path) => string` builder. */
70
+ publicBaseUrl: string | S3PublicUrlBuilder;
71
+ /** Default `Cache-Control` header applied when `StorageUploadParams.cacheControl` is omitted. */
72
+ cacheControl?: string;
73
+ /** Include `bucket` segment in string-prefix URLs (`${publicBaseUrl}/${bucket}/${path}`). Defaults to `true`. */
74
+ includeBucketInUrl?: boolean;
75
+ /** Fallback bucket used by `deleteByUrl` when `includeBucketInUrl` is `false`. */
76
+ defaultBucket?: string;
77
+ }
78
+ type S3StorageAdapterOptions = S3StorageBaseOptions & ((S3TransportLike & {
79
+ client?: never;
80
+ transport?: never;
81
+ }) | {
82
+ client: S3TransportLike;
83
+ transport?: never;
84
+ putObject?: never;
85
+ } | {
86
+ transport: S3TransportLike;
87
+ client?: never;
88
+ putObject?: never;
89
+ });
90
+ /** Zero-dependency S3 / Cloudflare R2 / MinIO `StorageAdapter`. */
91
+ declare function createS3StorageAdapter(options: S3StorageAdapterOptions): StorageAdapter;
92
+
93
+ /**
94
+ * Minimal structural interface matching `@supabase/supabase-js` Storage client,
95
+ * avoiding a mandatory `@supabase/supabase-js` runtime dependency.
96
+ */
97
+ interface SupabaseBucketClientLike {
98
+ upload(path: string, fileBody: Buffer | Uint8Array, fileOptions?: {
99
+ contentType?: string;
100
+ upsert?: boolean;
101
+ cacheControl?: string;
102
+ metadata?: Record<string, string>;
103
+ }): Promise<{
104
+ data: {
105
+ path: string;
106
+ } | null;
107
+ error: {
108
+ message: string;
109
+ } | null;
110
+ }>;
111
+ remove(paths: string[]): Promise<{
112
+ data?: unknown;
113
+ error: {
114
+ message: string;
115
+ } | null;
116
+ }>;
117
+ getPublicUrl(path: string): {
118
+ data: {
119
+ publicUrl: string;
120
+ };
121
+ };
122
+ list?(path?: string, options?: {
123
+ limit?: number;
124
+ offset?: number;
125
+ sortBy?: {
126
+ column: string;
127
+ order: string;
128
+ };
129
+ }): Promise<{
130
+ data: Array<{
131
+ name: string;
132
+ id: string | null;
133
+ created_at: string | null;
134
+ }> | null;
135
+ error: {
136
+ message: string;
137
+ } | null;
138
+ }>;
139
+ }
140
+ interface SupabaseStorageClientLike {
141
+ storage: {
142
+ from(bucket: string): SupabaseBucketClientLike;
143
+ };
144
+ }
145
+ interface SupabaseStorageAdapterOptions {
146
+ publicUrlPrefix?: string;
147
+ }
148
+ /**
149
+ * Plug in any `@supabase/supabase-js` client instance (e.g., service-role client)
150
+ * as a `StorageAdapter` with zero extra wrapper boilerplate.
151
+ */
152
+ declare function createSupabaseStorageAdapter(client: SupabaseStorageClientLike, options?: SupabaseStorageAdapterOptions): StorageAdapter;
153
+
154
+ interface PublicStorageInfo {
155
+ bucket: string;
156
+ path: string;
157
+ filename: string;
158
+ extension: string | null;
159
+ }
160
+ declare const DEFAULT_PUBLIC_STORAGE_PREFIX = "/storage/v1/object/public/";
161
+ declare function parsePublicStorageUrl(url?: string | null, publicPrefix?: string): PublicStorageInfo | null;
162
+
163
+ export { DEFAULT_PUBLIC_STORAGE_PREFIX, type LocalFsStorageAdapter, type LocalFsStorageOptions, type PublicStorageInfo, type S3DeleteObjectInput, type S3HeadObjectInput, type S3ListObjectsInput, type S3ListObjectsOutput, type S3ListedObject, type S3PublicUrlBuilder, type S3PutObjectInput, type S3StorageAdapterOptions, type S3StorageBaseOptions, type S3TransportLike, StorageAdapter, StorageListOptions, StoragePaginatedListResult, type SupabaseBucketClientLike, type SupabaseStorageAdapterOptions, type SupabaseStorageClientLike, createLocalFsStorageAdapter, createS3StorageAdapter, createSupabaseStorageAdapter, parsePublicStorageUrl };