@fils/sanity-components 0.0.1

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 ADDED
@@ -0,0 +1,25 @@
1
+ # @fils/sanity
2
+ Front-End Utils for Sanity Back-Ends.
3
+
4
+ You will need top have a `.env` file properly set up in your project.
5
+
6
+ This is part of a series of packages that we use in our studio for personal and commercial web & [THREEjs](https://threejs.org) based work. It might remain undocumented for a long while but feel free to try it out!
7
+
8
+ ### License
9
+ © Copyright 2025, fil studio
10
+
11
+ [fil](https://fil.studio) is a studio with a creative tech soul. We build bespoke interactive journeys primarily using modern web technologies. We deliver tailored solutions for installations and on-line experiences using our internal toolkit + [ThreeJS](https://threejs.org).
12
+
13
+ fil is the Catalan word for thread. We love threads cause we often talk about them when building applications and, at the same time, threads are something so organic, colourful and playful.
14
+
15
+ Licensed under the Apache License, Version 2.0 (the "License");
16
+ you may not use this file except in compliance with the License.
17
+ You may obtain a copy of the License at
18
+
19
+ [http://www.apache.org/licenses/LICENSE-2.0](http://www.apache.org/licenses/LICENSE-2.0)
20
+
21
+ Unless required by applicable law or agreed to in writing, software
22
+ distributed under the License is distributed on an "AS IS" BASIS,
23
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
24
+ See the License for the specific language governing permissions and
25
+ limitations under the License.
@@ -0,0 +1,12 @@
1
+ export declare const SEO: {
2
+ type: "document";
3
+ name: "seo";
4
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
5
+ preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
6
+ };
7
+ export declare const LocalizedSEO: {
8
+ type: "document";
9
+ name: "localseo";
10
+ } & Omit<import("sanity").DocumentDefinition, "preview"> & {
11
+ preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
12
+ };
@@ -0,0 +1,34 @@
1
+ import { defineField, defineType } from "sanity";
2
+ import { SEOImage } from "./SEOImage";
3
+ export const SEO = defineType({
4
+ name: 'seo',
5
+ title: "SEO",
6
+ type: "document",
7
+ fields: [
8
+ defineField({
9
+ name: 'title',
10
+ type: 'string'
11
+ }),
12
+ defineField({
13
+ name: 'description',
14
+ type: 'text'
15
+ }),
16
+ SEOImage
17
+ ]
18
+ });
19
+ export const LocalizedSEO = defineType({
20
+ name: 'localseo',
21
+ title: "SEO",
22
+ type: "document",
23
+ fields: [
24
+ defineField({
25
+ name: 'title',
26
+ type: 'internationalizedArrayString'
27
+ }),
28
+ defineField({
29
+ name: 'description',
30
+ type: 'internationalizedArrayText'
31
+ }),
32
+ SEOImage
33
+ ]
34
+ });
@@ -0,0 +1,6 @@
1
+ export declare const SEOImage: {
2
+ type: "image";
3
+ name: "card";
4
+ } & Omit<import("sanity").ImageDefinition, "preview"> & {
5
+ preview?: import("sanity").PreviewConfig<Record<string, string>, Record<never, any>> | undefined;
6
+ } & import("sanity").FieldDefinitionBase & import("sanity").WidenValidation & import("sanity").WidenInitialValue;
@@ -0,0 +1,7 @@
1
+ import { defineField } from "sanity";
2
+ export const SEOImage = defineField({
3
+ name: 'card',
4
+ type: 'image',
5
+ title: 'Sharing Image',
6
+ description: "Used on site embedding preview. Optimal size is at 1200px x 600px"
7
+ });
@@ -0,0 +1,20 @@
1
+ import { DocumentActionComponent, DocumentActionsContext } from "sanity";
2
+ import { StructureResolver } from 'sanity/structure';
3
+ export declare function getActions(singletonTypes: Set<string>): (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
4
+ export declare function getDefaultConfig(projectId: string, title: string, structure: StructureResolver, schemaTypes: any, singletonTypes: Set<string>): {
5
+ name: string;
6
+ title: string;
7
+ projectId: string;
8
+ dataset: string;
9
+ scheduledPublishing: {
10
+ enabled: false;
11
+ };
12
+ plugins: import("sanity").PluginOptions[];
13
+ schema: {
14
+ types: any;
15
+ templates: (templates: import("sanity").Template<any, any>[]) => import("sanity").Template<any, any>[];
16
+ };
17
+ document: {
18
+ actions: (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
19
+ };
20
+ };
@@ -0,0 +1,33 @@
1
+ import { defineConfig } from "sanity";
2
+ import { structureTool } from 'sanity/structure';
3
+ // Define the actions that should be available for singleton documents
4
+ const singletonActions = new Set(["publish", "discardChanges", "restore"]);
5
+ export function getActions(singletonTypes) {
6
+ return (input, context) => singletonTypes.has(context.schemaType)
7
+ ? input.filter(({ action }) => action && singletonActions.has(action))
8
+ : input;
9
+ }
10
+ export function getDefaultConfig(projectId, title, structure, schemaTypes, singletonTypes) {
11
+ return defineConfig({
12
+ name: 'default',
13
+ title,
14
+ projectId,
15
+ dataset: 'production',
16
+ scheduledPublishing: {
17
+ enabled: false
18
+ },
19
+ plugins: [structureTool({
20
+ structure
21
+ })],
22
+ schema: {
23
+ types: schemaTypes,
24
+ // Filter out singleton types from the global “New document” menu options
25
+ templates: (templates) => templates.filter(({ schemaType }) => !singletonTypes.has(schemaType)),
26
+ },
27
+ document: {
28
+ // For singleton types, filter out actions that are not explicitly included
29
+ // in the `singletonActions` list defined above
30
+ actions: getActions(singletonTypes),
31
+ },
32
+ });
33
+ }
package/lib/main.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/core/SEO';
2
+ export * from './config/utils';
package/lib/main.js ADDED
@@ -0,0 +1,2 @@
1
+ export * from './components/core/SEO';
2
+ export * from './config/utils';
package/package.json ADDED
@@ -0,0 +1,26 @@
1
+ {
2
+ "name": "@fils/sanity-components",
3
+ "version": "0.0.1",
4
+ "description": "Fil's Components for Sanity Back-Ends",
5
+ "main": "src/main.cjs",
6
+ "repository": "git@github.com:fil-studio/fils.git",
7
+ "author": "Fil Studio <hello@fil.studio>",
8
+ "license": "Apache-2.0",
9
+ "private": false,
10
+ "scripts": {
11
+ "prepare": "yarn build",
12
+ "build": "tsc"
13
+ },
14
+ "files": [
15
+ "lib"
16
+ ],
17
+ "dependencies": {
18
+ "sanity": "^3.85.1"
19
+ },
20
+ "devDependencies": {
21
+ "@sanity/types": "^3.85.1",
22
+ "@types/react": "^19.1.2",
23
+ "@types/react-dom": "^19.1.2",
24
+ "typescript": "^5.8.3"
25
+ }
26
+ }