@fils/sanity-components 0.0.8 → 0.1.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/lib/components/ui/DeployButton.d.ts +23 -0
- package/lib/components/ui/DeployButton.js +225 -0
- package/lib/components/ui/DeployButton.jsx.d.ts +15 -0
- package/lib/components/ui/DeployButton.jsx.js +249 -0
- package/lib/components/video/CreateVideoInput.d.ts +8 -0
- package/lib/components/video/CreateVideoInput.js +8 -0
- package/lib/components/video/VideoAndThumb.d.ts +7 -0
- package/lib/components/video/VideoAndThumb.js +101 -0
- package/lib/components/video/VideoSchemas.d.ts +58 -0
- package/lib/components/video/VideoSchemas.js +197 -0
- package/lib/main.d.ts +2 -0
- package/lib/main.js +2 -0
- package/package.json +41 -10
- package/src/components/core/SEO.ts +36 -0
- package/src/components/core/SEOImage.ts +8 -0
- package/src/components/ui/DeployButton.tsx +424 -0
- package/src/components/video/CreateVideoInput.tsx +26 -0
- package/src/components/video/VideoAndThumb.tsx +187 -0
- package/src/components/video/VideoSchemas.ts +205 -0
- package/src/config/utils.ts +86 -0
- package/src/main.ts +6 -0
- package/src/validators/utils.ts +17 -0
- package/tsconfig.json +20 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Video File Schema
|
|
3
|
+
* Document type for uploaded video files with thumbnail generation
|
|
4
|
+
*/
|
|
5
|
+
export declare const VideoFile: {
|
|
6
|
+
type: "document";
|
|
7
|
+
name: "videoFile";
|
|
8
|
+
} & Omit<import("sanity").DocumentDefinition, "preview"> & {
|
|
9
|
+
preview?: import("sanity").PreviewConfig<{
|
|
10
|
+
video: string;
|
|
11
|
+
media: string;
|
|
12
|
+
}, Record<"media" | "video", any>> | undefined;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* Video URL Schema
|
|
16
|
+
* Document type for external video URLs (e.g., Vimeo, YouTube)
|
|
17
|
+
*/
|
|
18
|
+
export declare const VideoURL: {
|
|
19
|
+
type: "document";
|
|
20
|
+
name: "videoUrl";
|
|
21
|
+
} & Omit<import("sanity").DocumentDefinition, "preview"> & {
|
|
22
|
+
preview?: import("sanity").PreviewConfig<{
|
|
23
|
+
video: string;
|
|
24
|
+
media: string;
|
|
25
|
+
}, Record<"media" | "video", any>> | undefined;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Video File Object Schema
|
|
29
|
+
* Object type for use as a field in other schemas
|
|
30
|
+
*/
|
|
31
|
+
export declare const VideoFileObject: {
|
|
32
|
+
type: "object";
|
|
33
|
+
name: "videoFileObject";
|
|
34
|
+
} & Omit<import("sanity").ObjectDefinition, "preview"> & {
|
|
35
|
+
preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Video URL Object Schema
|
|
39
|
+
* Object type for use as a field in other schemas (URL version)
|
|
40
|
+
*/
|
|
41
|
+
export declare const VideoURLObject: {
|
|
42
|
+
type: "object";
|
|
43
|
+
name: "videoUrlObject";
|
|
44
|
+
} & Omit<import("sanity").ObjectDefinition, "preview"> & {
|
|
45
|
+
preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
|
|
46
|
+
};
|
|
47
|
+
export declare const VideoFileNoThumb: {
|
|
48
|
+
type: "object";
|
|
49
|
+
name: "videoFileNoThumb";
|
|
50
|
+
} & Omit<import("sanity").ObjectDefinition, "preview"> & {
|
|
51
|
+
preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
|
|
52
|
+
};
|
|
53
|
+
export declare const VideoURLNoThumb: {
|
|
54
|
+
type: "object";
|
|
55
|
+
name: "videoFileNoThumb";
|
|
56
|
+
} & Omit<import("sanity").ObjectDefinition, "preview"> & {
|
|
57
|
+
preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
|
|
58
|
+
};
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { LinkIcon, PlayIcon, VideoIcon } from "@sanity/icons";
|
|
2
|
+
import { defineField, defineType } from "sanity";
|
|
3
|
+
import { createVideoInput } from "./CreateVideoInput";
|
|
4
|
+
/**
|
|
5
|
+
* Video File Schema
|
|
6
|
+
* Document type for uploaded video files with thumbnail generation
|
|
7
|
+
*/
|
|
8
|
+
export const VideoFile = defineType({
|
|
9
|
+
name: 'videoFile',
|
|
10
|
+
type: 'document',
|
|
11
|
+
title: 'Video File',
|
|
12
|
+
description: 'Video File + Thumbnail',
|
|
13
|
+
icon: VideoIcon,
|
|
14
|
+
fields: [
|
|
15
|
+
defineField({
|
|
16
|
+
name: 'video',
|
|
17
|
+
type: 'file',
|
|
18
|
+
options: {
|
|
19
|
+
accept: "video/mp4, video/webm"
|
|
20
|
+
},
|
|
21
|
+
icon: PlayIcon,
|
|
22
|
+
description: 'Video File. Supported formats: MP4 & WebM',
|
|
23
|
+
validation: Rule => Rule.required()
|
|
24
|
+
}),
|
|
25
|
+
defineField({
|
|
26
|
+
name: 'image',
|
|
27
|
+
title: 'Video Thumbnail',
|
|
28
|
+
type: 'image',
|
|
29
|
+
validation: Rule => Rule.required()
|
|
30
|
+
})
|
|
31
|
+
],
|
|
32
|
+
components: {
|
|
33
|
+
input: createVideoInput({
|
|
34
|
+
inputType: 'file',
|
|
35
|
+
enableThumbnailGeneration: true
|
|
36
|
+
})
|
|
37
|
+
},
|
|
38
|
+
preview: {
|
|
39
|
+
select: {
|
|
40
|
+
video: 'video',
|
|
41
|
+
media: 'image'
|
|
42
|
+
},
|
|
43
|
+
prepare(selected) {
|
|
44
|
+
const { video, media } = selected;
|
|
45
|
+
// Just use the original filename from the asset if available
|
|
46
|
+
const filename = video?.asset?._ref
|
|
47
|
+
? video.asset._ref.split('-').slice(1, -1).join('-')
|
|
48
|
+
: 'No video';
|
|
49
|
+
return {
|
|
50
|
+
title: filename,
|
|
51
|
+
media
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
/**
|
|
57
|
+
* Video URL Schema
|
|
58
|
+
* Document type for external video URLs (e.g., Vimeo, YouTube)
|
|
59
|
+
*/
|
|
60
|
+
export const VideoURL = defineType({
|
|
61
|
+
name: 'videoUrl',
|
|
62
|
+
type: 'document',
|
|
63
|
+
title: 'Video URL',
|
|
64
|
+
description: 'External video URL + Thumbnail',
|
|
65
|
+
icon: VideoIcon,
|
|
66
|
+
fields: [
|
|
67
|
+
defineField({
|
|
68
|
+
name: 'video',
|
|
69
|
+
type: 'url',
|
|
70
|
+
icon: LinkIcon,
|
|
71
|
+
description: 'Video URL (e.g., Vimeo, YouTube)',
|
|
72
|
+
validation: Rule => Rule.required().uri({
|
|
73
|
+
scheme: ['http', 'https']
|
|
74
|
+
})
|
|
75
|
+
}),
|
|
76
|
+
defineField({
|
|
77
|
+
name: 'image',
|
|
78
|
+
title: 'Video Thumbnail',
|
|
79
|
+
type: 'image',
|
|
80
|
+
validation: Rule => Rule.required()
|
|
81
|
+
})
|
|
82
|
+
],
|
|
83
|
+
components: {
|
|
84
|
+
input: createVideoInput({
|
|
85
|
+
inputType: 'url',
|
|
86
|
+
enableThumbnailGeneration: false // Can't generate from external URLs
|
|
87
|
+
})
|
|
88
|
+
},
|
|
89
|
+
preview: {
|
|
90
|
+
select: {
|
|
91
|
+
video: 'video',
|
|
92
|
+
media: 'image'
|
|
93
|
+
},
|
|
94
|
+
prepare(selected) {
|
|
95
|
+
const { video, media } = selected;
|
|
96
|
+
return {
|
|
97
|
+
title: video || 'No URL',
|
|
98
|
+
media
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* Video File Object Schema
|
|
105
|
+
* Object type for use as a field in other schemas
|
|
106
|
+
*/
|
|
107
|
+
export const VideoFileObject = defineType({
|
|
108
|
+
name: 'videoFileObject',
|
|
109
|
+
type: 'object',
|
|
110
|
+
title: 'Video with Thumbnail',
|
|
111
|
+
fields: [
|
|
112
|
+
defineField({
|
|
113
|
+
name: 'video',
|
|
114
|
+
type: 'file',
|
|
115
|
+
options: {
|
|
116
|
+
accept: "video/mp4, video/webm"
|
|
117
|
+
}
|
|
118
|
+
}),
|
|
119
|
+
defineField({
|
|
120
|
+
name: 'image',
|
|
121
|
+
title: 'Thumbnail',
|
|
122
|
+
type: 'image'
|
|
123
|
+
})
|
|
124
|
+
],
|
|
125
|
+
components: {
|
|
126
|
+
input: createVideoInput({
|
|
127
|
+
inputType: 'file',
|
|
128
|
+
enableThumbnailGeneration: true
|
|
129
|
+
})
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
/**
|
|
133
|
+
* Video URL Object Schema
|
|
134
|
+
* Object type for use as a field in other schemas (URL version)
|
|
135
|
+
*/
|
|
136
|
+
export const VideoURLObject = defineType({
|
|
137
|
+
name: 'videoUrlObject',
|
|
138
|
+
type: 'object',
|
|
139
|
+
title: 'Video URL with Thumbnail',
|
|
140
|
+
fields: [
|
|
141
|
+
defineField({
|
|
142
|
+
name: 'video',
|
|
143
|
+
type: 'url'
|
|
144
|
+
}),
|
|
145
|
+
defineField({
|
|
146
|
+
name: 'image',
|
|
147
|
+
title: 'Thumbnail',
|
|
148
|
+
type: 'image'
|
|
149
|
+
})
|
|
150
|
+
],
|
|
151
|
+
components: {
|
|
152
|
+
input: createVideoInput({
|
|
153
|
+
inputType: 'url',
|
|
154
|
+
enableThumbnailGeneration: false
|
|
155
|
+
})
|
|
156
|
+
}
|
|
157
|
+
});
|
|
158
|
+
export const VideoFileNoThumb = defineType({
|
|
159
|
+
name: 'videoFileNoThumb',
|
|
160
|
+
type: 'object',
|
|
161
|
+
title: 'Video File',
|
|
162
|
+
fields: [
|
|
163
|
+
defineField({
|
|
164
|
+
name: 'video',
|
|
165
|
+
type: 'file',
|
|
166
|
+
options: {
|
|
167
|
+
accept: 'video/mp4, video/webm'
|
|
168
|
+
}
|
|
169
|
+
})
|
|
170
|
+
],
|
|
171
|
+
components: {
|
|
172
|
+
input: createVideoInput({
|
|
173
|
+
inputType: 'file',
|
|
174
|
+
enableThumbnailGeneration: false
|
|
175
|
+
})
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
export const VideoURLNoThumb = defineType({
|
|
179
|
+
name: 'videoFileNoThumb',
|
|
180
|
+
type: 'object',
|
|
181
|
+
title: 'Video URL',
|
|
182
|
+
fields: [
|
|
183
|
+
defineField({
|
|
184
|
+
name: 'video',
|
|
185
|
+
type: 'file',
|
|
186
|
+
options: {
|
|
187
|
+
accept: 'video/mp4, video/webm'
|
|
188
|
+
}
|
|
189
|
+
})
|
|
190
|
+
],
|
|
191
|
+
components: {
|
|
192
|
+
input: createVideoInput({
|
|
193
|
+
inputType: 'url',
|
|
194
|
+
enableThumbnailGeneration: false
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
});
|
package/lib/main.d.ts
CHANGED
package/lib/main.js
CHANGED
package/package.json
CHANGED
|
@@ -1,31 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fils/sanity-components",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "Fil's Components for Sanity Back-Ends",
|
|
5
|
-
"main": "lib/main.js",
|
|
6
5
|
"repository": "git@github.com:fil-studio/fils.git",
|
|
7
6
|
"author": "Fil Studio <hello@fil.studio>",
|
|
8
7
|
"license": "Apache-2.0",
|
|
9
8
|
"private": false,
|
|
10
9
|
"scripts": {
|
|
11
|
-
"
|
|
10
|
+
"prepublishOnly": "yarn build",
|
|
12
11
|
"build": "tsc"
|
|
13
12
|
},
|
|
14
|
-
"
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
"main": "./lib/main.js",
|
|
14
|
+
"types": "./lib/main.d.ts",
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"import": "./lib/main.js",
|
|
18
|
+
"types": "./lib/main.d.ts"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"publishConfig": {
|
|
22
|
+
"access": "public"
|
|
23
|
+
},
|
|
17
24
|
"peerDependencies": {
|
|
18
25
|
"@sanity/dashboard": "^4.1.3",
|
|
19
26
|
"sanity": "^3.85.1",
|
|
20
|
-
"sanity-plugin-dashboard-widget-netlify": "^2.0.1"
|
|
27
|
+
"sanity-plugin-dashboard-widget-netlify": "^2.0.1",
|
|
28
|
+
"@sanity/icons": "^3.7.4",
|
|
29
|
+
"@sanity/studio-secrets": "^3.0.2",
|
|
30
|
+
"react": "^19.2.1"
|
|
21
31
|
},
|
|
22
32
|
"devDependencies": {
|
|
33
|
+
"@sanity/dashboard": "^4.1.3",
|
|
34
|
+
"@sanity/icons": "^3.7.4",
|
|
35
|
+
"@sanity/studio-secrets": "^3.0.2",
|
|
23
36
|
"@sanity/types": "^3.85.1",
|
|
37
|
+
"@sanity/ui": "^3.1.11",
|
|
24
38
|
"@types/react": "^19.1.2",
|
|
25
39
|
"@types/react-dom": "^19.1.2",
|
|
26
|
-
"
|
|
40
|
+
"react": "^19.2.1",
|
|
27
41
|
"sanity": "^3.85.1",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
42
|
+
"sanity-plugin-dashboard-widget-netlify": "^2.0.1",
|
|
43
|
+
"typescript": "^5.8.3"
|
|
44
|
+
},
|
|
45
|
+
"peerDependenciesMeta": {
|
|
46
|
+
"sanity-plugin-dashboard-widget-netlify": {
|
|
47
|
+
"optional": true
|
|
48
|
+
},
|
|
49
|
+
"@sanity/studio-secrets": {
|
|
50
|
+
"optional": true
|
|
51
|
+
},
|
|
52
|
+
"@sanity/dashboard": {
|
|
53
|
+
"optional": true
|
|
54
|
+
},
|
|
55
|
+
"@sanity/icons": {
|
|
56
|
+
"optional": true
|
|
57
|
+
},
|
|
58
|
+
"react": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
30
61
|
}
|
|
31
62
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { defineField, defineType } from "sanity";
|
|
2
|
+
import { SEOImage } from "./SEOImage";
|
|
3
|
+
|
|
4
|
+
export const SEO = defineType({
|
|
5
|
+
name: 'seo',
|
|
6
|
+
title: "SEO",
|
|
7
|
+
type: "object",
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'title',
|
|
11
|
+
type: 'string'
|
|
12
|
+
}),
|
|
13
|
+
defineField({
|
|
14
|
+
name: 'description',
|
|
15
|
+
type: 'text'
|
|
16
|
+
}),
|
|
17
|
+
SEOImage
|
|
18
|
+
]
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
export const LocalizedSEO = defineType({
|
|
22
|
+
name: 'localseo',
|
|
23
|
+
title: "SEO",
|
|
24
|
+
type: "object",
|
|
25
|
+
fields: [
|
|
26
|
+
defineField({
|
|
27
|
+
name: 'title',
|
|
28
|
+
type: 'internationalizedArrayString'
|
|
29
|
+
}),
|
|
30
|
+
defineField({
|
|
31
|
+
name: 'description',
|
|
32
|
+
type: 'internationalizedArrayText'
|
|
33
|
+
}),
|
|
34
|
+
SEOImage
|
|
35
|
+
]
|
|
36
|
+
});
|