@fils/sanity-components 0.0.4 → 0.0.6

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.
@@ -1,5 +1,6 @@
1
1
  import { DocumentActionComponent, DocumentActionsContext } from "sanity";
2
2
  import { StructureResolver } from 'sanity/structure';
3
+ import { SiteWidgetOption } from "sanity-plugin-dashboard-widget-netlify";
3
4
  export declare function getActions(singletonTypes: Set<string>): (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
4
5
  export declare function getDefaultConfig(projectId: string, title: string, structure: StructureResolver, schemaTypes: any, singletonTypes: Set<string>): {
5
6
  name: string;
@@ -18,3 +19,20 @@ export declare function getDefaultConfig(projectId: string, title: string, struc
18
19
  actions: (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
19
20
  };
20
21
  };
22
+ export declare function getConfigWithNetlify(projectId: string, title: string, structure: StructureResolver, schemaTypes: any, singletonTypes: Set<string>, sites: SiteWidgetOption[]): {
23
+ name: string;
24
+ title: string;
25
+ projectId: string;
26
+ dataset: string;
27
+ scheduledPublishing: {
28
+ enabled: false;
29
+ };
30
+ plugins: import("sanity").PluginOptions[];
31
+ schema: {
32
+ types: any;
33
+ templates: (templates: import("sanity").Template<any, any>[]) => import("sanity").Template<any, any>[];
34
+ };
35
+ document: {
36
+ actions: (input: DocumentActionComponent[], context: DocumentActionsContext) => DocumentActionComponent[];
37
+ };
38
+ };
@@ -1,5 +1,7 @@
1
1
  import { defineConfig } from "sanity";
2
2
  import { structureTool } from 'sanity/structure';
3
+ import { netlifyWidget } from "sanity-plugin-dashboard-widget-netlify";
4
+ import { dashboardTool } from '@sanity/dashboard';
3
5
  // Define the actions that should be available for singleton documents
4
6
  const singletonActions = new Set(["publish", "discardChanges", "restore"]);
5
7
  export function getActions(singletonTypes) {
@@ -31,3 +33,37 @@ export function getDefaultConfig(projectId, title, structure, schemaTypes, singl
31
33
  },
32
34
  });
33
35
  }
36
+ export function getConfigWithNetlify(projectId, title, structure, schemaTypes, singletonTypes, sites) {
37
+ return defineConfig({
38
+ name: 'default',
39
+ title,
40
+ projectId,
41
+ dataset: 'production',
42
+ scheduledPublishing: {
43
+ enabled: false
44
+ },
45
+ plugins: [
46
+ structureTool({
47
+ structure
48
+ }),
49
+ dashboardTool({
50
+ widgets: [
51
+ netlifyWidget({
52
+ title: 'Deploy Site',
53
+ sites
54
+ })
55
+ ]
56
+ })
57
+ ],
58
+ schema: {
59
+ types: schemaTypes,
60
+ // Filter out singleton types from the global “New document” menu options
61
+ templates: (templates) => templates.filter(({ schemaType }) => !singletonTypes.has(schemaType)),
62
+ },
63
+ document: {
64
+ // For singleton types, filter out actions that are not explicitly included
65
+ // in the `singletonActions` list defined above
66
+ actions: getActions(singletonTypes),
67
+ },
68
+ });
69
+ }
package/lib/main.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './components/core/SEOImage';
1
2
  export * from './components/core/SEO';
2
3
  export * from './config/utils';
3
4
  export * from './validators/utils';
package/lib/main.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './components/core/SEOImage';
1
2
  export * from './components/core/SEO';
2
3
  export * from './config/utils';
3
4
  export * from './validators/utils';
@@ -1,2 +1,6 @@
1
1
  import { Rule } from "sanity";
2
+ /**
3
+ * Deprecated use Sanity's Rule.uri instead!!
4
+ * @returns regexp url validator
5
+ */
2
6
  export declare function urlValidation(): (rule: Rule) => Rule;
@@ -1,3 +1,7 @@
1
+ /**
2
+ * Deprecated use Sanity's Rule.uri instead!!
3
+ * @returns regexp url validator
4
+ */
1
5
  export function urlValidation() {
2
6
  return (rule) => rule.custom((url) => {
3
7
  if (typeof url === 'undefined' || url === null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fils/sanity-components",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "Fil's Components for Sanity Back-Ends",
5
5
  "main": "lib/main.js",
6
6
  "repository": "git@github.com:fil-studio/fils.git",
@@ -15,7 +15,9 @@
15
15
  "lib"
16
16
  ],
17
17
  "dependencies": {
18
- "sanity": "^3.85.1"
18
+ "@sanity/dashboard": "^4.1.3",
19
+ "sanity": "^3.85.1",
20
+ "sanity-plugin-dashboard-widget-netlify": "^2.0.1"
19
21
  },
20
22
  "devDependencies": {
21
23
  "@sanity/types": "^3.85.1",