tinacms 1.2.2 → 1.3.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.
@@ -2,7 +2,7 @@ import { TokenObject } from '../auth/authenticate';
2
2
  import { BranchData, EventBus } from '@tinacms/toolkit';
3
3
  import { DocumentNode, GraphQLSchema } from 'graphql';
4
4
  import gql from 'graphql-tag';
5
- import { TinaSchema, TinaCloudSchema } from '@tinacms/schema-tools';
5
+ import { TinaSchema, Schema } from '@tinacms/schema-tools';
6
6
  export declare type OnLoginFunc = (args: {
7
7
  token: TokenObject;
8
8
  }) => Promise<void>;
@@ -13,7 +13,7 @@ export declare type TinaIOConfig = {
13
13
  contentApiUrlOverride?: string;
14
14
  };
15
15
  interface ServerOptions {
16
- schema?: TinaCloudSchema<false>;
16
+ schema?: Schema;
17
17
  clientId: string;
18
18
  branch: string;
19
19
  customContentApiUrl?: string;
@@ -155,10 +155,6 @@ export declare class Client {
155
155
  * }
156
156
  */
157
157
  getOptimizedQuery: (documentNode: DocumentNode) => Promise<DocumentNode>;
158
- requestWithForm<ReturnType>(query: (gqlTag: typeof gql) => DocumentNode, { variables, useUnstableFormify, }: {
159
- variables: any;
160
- useUnstableFormify?: boolean;
161
- }): Promise<ReturnType>;
162
158
  request<ReturnType>(query: ((gqlTag: typeof gql) => DocumentNode) | string, { variables }: {
163
159
  variables: object;
164
160
  }): Promise<ReturnType>;
@@ -229,7 +225,7 @@ export declare const DEFAULT_LOCAL_TINA_GQL_SERVER_URL = "http://localhost:4001/
229
225
  export declare class LocalClient extends Client {
230
226
  constructor(props?: {
231
227
  customContentApiUrl?: string;
232
- schema?: TinaCloudSchema<false>;
228
+ schema?: Schema;
233
229
  } & Omit<ServerOptions, 'clientId' | 'branch'>);
234
230
  get isLocalMode(): boolean;
235
231
  logout(): Promise<void>;
package/dist/style.css CHANGED
@@ -375,6 +375,15 @@
375
375
  margin-left: auto;
376
376
  margin-right: auto;
377
377
  }
378
+ .tina-tailwind .mb-6 {
379
+ margin-bottom: 24px;
380
+ }
381
+ .tina-tailwind .mr-1 {
382
+ margin-right: 4px;
383
+ }
384
+ .tina-tailwind .mb-8 {
385
+ margin-bottom: 32px;
386
+ }
378
387
  .tina-tailwind .-ml-px {
379
388
  margin-left: -1px;
380
389
  }
@@ -408,18 +417,12 @@
408
417
  .tina-tailwind .mr-1\.5 {
409
418
  margin-right: 6px;
410
419
  }
411
- .tina-tailwind .mr-1 {
412
- margin-right: 4px;
413
- }
414
420
  .tina-tailwind .block {
415
421
  display: block;
416
422
  }
417
423
  .tina-tailwind .inline-block {
418
424
  display: inline-block;
419
425
  }
420
- .tina-tailwind .inline {
421
- display: inline;
422
- }
423
426
  .tina-tailwind .flex {
424
427
  display: flex;
425
428
  }
@@ -462,6 +465,12 @@
462
465
  .tina-tailwind .w-10 {
463
466
  width: 40px;
464
467
  }
468
+ .tina-tailwind .w-12 {
469
+ width: 48px;
470
+ }
471
+ .tina-tailwind .w-7 {
472
+ width: 28px;
473
+ }
465
474
  .tina-tailwind .w-auto {
466
475
  width: auto;
467
476
  }
@@ -657,6 +666,10 @@
657
666
  --tw-bg-opacity: 1;
658
667
  background-color: rgb(255 255 255 / var(--tw-bg-opacity));
659
668
  }
669
+ .tina-tailwind .bg-gray-100 {
670
+ --tw-bg-opacity: 1;
671
+ background-color: rgb(237 236 243 / var(--tw-bg-opacity));
672
+ }
660
673
  .tina-tailwind .bg-gray-50 {
661
674
  --tw-bg-opacity: 1;
662
675
  background-color: rgb(246 246 249 / var(--tw-bg-opacity));
@@ -699,6 +712,9 @@
699
712
  .tina-tailwind .to-black {
700
713
  --tw-gradient-to: #000;
701
714
  }
715
+ .tina-tailwind .fill-current {
716
+ fill: currentColor;
717
+ }
702
718
  .tina-tailwind .px-4 {
703
719
  padding-left: 16px;
704
720
  padding-right: 16px;
@@ -793,14 +809,18 @@
793
809
  font-size: 16px;
794
810
  line-height: 1.5;
795
811
  }
796
- .tina-tailwind .text-sm {
797
- font-size: 14px;
798
- line-height: 1.43;
812
+ .tina-tailwind .text-4xl {
813
+ font-size: 36px;
814
+ line-height: 1.1;
799
815
  }
800
816
  .tina-tailwind .text-xl {
801
817
  font-size: 20px;
802
818
  line-height: 1.4;
803
819
  }
820
+ .tina-tailwind .text-sm {
821
+ font-size: 14px;
822
+ line-height: 1.43;
823
+ }
804
824
  .tina-tailwind .text-md {
805
825
  font-size: 16px;
806
826
  line-height: 1.5;
@@ -841,6 +861,14 @@
841
861
  --tw-text-opacity: 1;
842
862
  color: rgb(67 62 82 / var(--tw-text-opacity));
843
863
  }
864
+ .tina-tailwind .text-red-500 {
865
+ --tw-text-opacity: 1;
866
+ color: rgb(239 68 68 / var(--tw-text-opacity));
867
+ }
868
+ .tina-tailwind .text-red-400 {
869
+ --tw-text-opacity: 1;
870
+ color: rgb(248 113 113 / var(--tw-text-opacity));
871
+ }
844
872
  .tina-tailwind .text-blue-600 {
845
873
  --tw-text-opacity: 1;
846
874
  color: rgb(5 116 228 / var(--tw-text-opacity));
@@ -876,13 +904,12 @@
876
904
  --tw-text-opacity: 1;
877
905
  color: rgb(37 35 54 / var(--tw-text-opacity));
878
906
  }
879
- .tina-tailwind .text-red-500 {
880
- --tw-text-opacity: 1;
881
- color: rgb(239 68 68 / var(--tw-text-opacity));
882
- }
883
907
  .tina-tailwind .underline {
884
908
  text-decoration-line: underline;
885
909
  }
910
+ .tina-tailwind .opacity-70 {
911
+ opacity: .7;
912
+ }
886
913
  .tina-tailwind .opacity-100 {
887
914
  opacity: 1;
888
915
  }
@@ -901,9 +928,6 @@
901
928
  .tina-tailwind .opacity-50 {
902
929
  opacity: .5;
903
930
  }
904
- .tina-tailwind .opacity-70 {
905
- opacity: .7;
906
- }
907
931
  .tina-tailwind .shadow-lg {
908
932
  --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
909
933
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
@@ -2,7 +2,6 @@
2
2
 
3
3
  */
4
4
  /// <reference types="react" />
5
- import type { formifyCallback } from './hooks/use-graphql-forms';
6
5
  import { useDocumentCreatorPlugin } from './hooks/use-content-creator';
7
6
  import { TinaCMSProviderDefaultProps } from './types/cms';
8
7
  /**
@@ -12,10 +11,6 @@ import { TinaCMSProviderDefaultProps } from './types/cms';
12
11
  */
13
12
  export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, schema, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
14
13
  export declare type DocumentCreatorCallback = Parameters<typeof useDocumentCreatorPlugin>[0];
15
- export declare const TinaDataProvider: ({ children, formifyCallback, }: {
16
- children: any;
17
- formifyCallback: formifyCallback;
18
- }) => JSX.Element;
19
14
  /**
20
15
  * @deprecated v0.62.0: Use `staticRequest` and a "try catch" block instead. see https://tina.io/docs/features/data-fetching/#querying-tina-content-in-nextjs for more details
21
16
  *
@@ -3,7 +3,7 @@
3
3
  */
4
4
  /// <reference types="react" />
5
5
  import type { TinaCMS } from '@tinacms/toolkit';
6
- import type { TinaCloudSchema, TinaCloudSchemaConfig } from '@tinacms/schema-tools';
6
+ import type { Schema, Config } from '@tinacms/schema-tools';
7
7
  import type { TinaCloudMediaStoreClass } from '../auth';
8
8
  import type { useDocumentCreatorPlugin } from '../hooks/use-content-creator';
9
9
  import type { formifyCallback } from '../hooks/use-graphql-forms';
@@ -30,7 +30,7 @@ interface BaseProviderProps {
30
30
  /** TinaCMS media store instance */
31
31
  mediaStore?: TinaCloudMediaStoreClass | (() => Promise<TinaCloudMediaStoreClass>);
32
32
  tinaioConfig?: TinaIOConfig;
33
- schema?: TinaCloudSchema<false>;
33
+ schema?: Schema;
34
34
  }
35
35
  declare type QueryProviderProps = {
36
36
  /** Your React page component */
@@ -51,5 +51,5 @@ declare type QueryProviderProps = {
51
51
  /** The `data` from getStaticProps */
52
52
  data?: never;
53
53
  };
54
- export declare type TinaCMSProviderDefaultProps = QueryProviderProps & APIProviderProps & BaseProviderProps & TinaCloudSchemaConfig;
54
+ export declare type TinaCMSProviderDefaultProps = QueryProviderProps & APIProviderProps & BaseProviderProps & Config;
55
55
  export {};
@@ -4,7 +4,7 @@
4
4
  import { Client } from '../internalClient';
5
5
  import type { TinaIOConfig } from '../internalClient';
6
6
  import * as yup from 'yup';
7
- import { TinaCloudSchema } from '@tinacms/schema-tools';
7
+ import { Schema } from '@tinacms/schema-tools';
8
8
  export interface CreateClientProps {
9
9
  clientId?: string;
10
10
  isLocalClient?: boolean;
@@ -12,7 +12,7 @@ export interface CreateClientProps {
12
12
  owner?: string;
13
13
  repo?: string;
14
14
  branch?: string;
15
- schema?: TinaCloudSchema<false>;
15
+ schema?: Schema;
16
16
  apiUrl?: string;
17
17
  }
18
18
  export declare const createClient: ({ clientId, isLocalClient, branch, tinaioConfig, schema, apiUrl, }: CreateClientProps) => Client;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "1.2.2",
3
+ "version": "1.3.0",
4
4
  "main": "dist/index.js",
5
5
  "module": "./dist/index.es.js",
6
6
  "exports": {
@@ -56,9 +56,9 @@
56
56
  "@headlessui/react": "^1.5.0",
57
57
  "@heroicons/react": "^1.0.4",
58
58
  "@react-hook/window-size": "^3.0.7",
59
- "@tinacms/schema-tools": "1.3.2",
59
+ "@tinacms/schema-tools": "1.3.3",
60
60
  "@tinacms/sharedctx": "1.0.1",
61
- "@tinacms/toolkit": "1.3.4",
61
+ "@tinacms/toolkit": "1.4.0",
62
62
  "crypto-js": "^4.0.0",
63
63
  "encoding": "0.1.13",
64
64
  "fetch-ponyfill": "^7.1.0",
@@ -78,7 +78,7 @@
78
78
  "@testing-library/react": "^12.0.0",
79
79
  "@testing-library/react-hooks": "^7.0.2",
80
80
  "@testing-library/user-event": "^12.7.0",
81
- "@tinacms/scripts": "1.0.2",
81
+ "@tinacms/scripts": "1.0.3",
82
82
  "@types/jest": "^27.0.1",
83
83
  "@types/lodash": "^4.14.169",
84
84
  "@types/node": "^14.0.13",
@@ -1,81 +0,0 @@
1
- /**
2
-
3
- */
4
- import * as G from 'graphql';
5
- import type { BlueprintPath } from './types';
6
- /**
7
- *
8
- * This check ensures that at type is a Document, but only one
9
- * that can be "formified". When using `Node` or `Document`, those
10
- * query fields should not have forms generated since they can't contain
11
- * fields.
12
- *
13
- * ```graphql
14
- * # Can be formified
15
- * {
16
- * getPostDocument(relativePath: "") {
17
- * data {
18
- * title
19
- * }
20
- * }
21
- * }
22
- * ```
23
- *
24
- * ```graphql
25
- * # cannot be formified, even though it is a document field
26
- * {
27
- * getPostDocument(relativePath: "") {
28
- * ...on Document {
29
- * id
30
- * }
31
- * }
32
- * }
33
- * ```
34
- */
35
- export declare const isFormifiableDocument: (t: G.GraphQLOutputType) => boolean;
36
- export declare const isScalarType: (t: G.GraphQLOutputType) => boolean;
37
- export declare const isConnectionField: (t: G.GraphQLOutputType) => boolean;
38
- /**
39
- * Selects the appropriate field from a GraphQLObject based on the selection's name
40
- */
41
- export declare const getObjectField: (object: G.GraphQLOutputType, selectionNode: G.FieldNode) => G.GraphQLField<any, any, {
42
- [key: string]: any;
43
- }>;
44
- /**
45
- * Selects the appropriate type from a union based on the selection's typeCondition
46
- *
47
- * ```graphql
48
- * post {
49
- * # would return PostDocument
50
- * ...on PostDocument { ... }
51
- * }
52
- * ```
53
- */
54
- export declare const getSelectedUnionType: (unionType: G.GraphQLOutputType, selectionNode: G.InlineFragmentNode) => any;
55
- /**
56
- * Checks if the given type is a list type. Even though
57
- * this function is built-in to GraphQL it doesn't handle
58
- * the scenario where the list type is wrapped in a non-null
59
- * type, so the extra check here is needed.
60
- */
61
- export declare function isListType(type: unknown): boolean;
62
- /**
63
- *
64
- * Throws an error if the provided type is not a GraphQLUnionType
65
- */
66
- export declare function ensureOperationDefinition(type: G.DefinitionNode): asserts type is G.OperationDefinitionNode;
67
- /**
68
- * Generates the name and alias information for a given field node
69
- * and appends it to a shallow copy of the path provided
70
- */
71
- export declare function buildPath({ fieldNode, type, parentTypename, path, }: {
72
- fieldNode: G.FieldNode;
73
- type: G.GraphQLOutputType;
74
- parentTypename?: string;
75
- path?: BlueprintPath[];
76
- }): BlueprintPath[];
77
- export declare const metaFields: G.SelectionNode[];
78
- export declare const getRelativeBlueprint: (path: BlueprintPath[]) => string;
79
- export declare const isSysField: (fieldNode: G.FieldNode) => boolean;
80
- export declare const getBlueprintId: (path: BlueprintPath[]) => string;
81
- export declare const getFieldAliasForBlueprint: (path: BlueprintPath[]) => string;
@@ -1,13 +0,0 @@
1
- /**
2
-
3
- */
4
- import * as G from 'graphql';
5
- import type { DocumentBlueprint } from './types';
6
- export declare const formify: ({ schema, query, getOptimizedQuery, }: {
7
- schema: G.GraphQLSchema;
8
- query: string;
9
- getOptimizedQuery: (query: G.DocumentNode) => Promise<G.DocumentNode>;
10
- }) => Promise<{
11
- formifiedQuery: G.DocumentNode;
12
- blueprints: DocumentBlueprint[];
13
- }>;
@@ -1,16 +0,0 @@
1
- /**
2
-
3
- */
4
- import type { TinaCMS } from '@tinacms/toolkit';
5
- import { formify } from './formify';
6
- import { onSubmitArgs } from '../use-graphql-forms';
7
- import type { OnChangeEvent, State } from './types';
8
- export { formify };
9
- export declare const useFormify: ({ query, cms, variables, onSubmit, formify: formifyFunc, eventList, }: {
10
- query?: string;
11
- cms: TinaCMS;
12
- variables: object;
13
- onSubmit?: (args: onSubmitArgs) => void;
14
- formify: any;
15
- eventList?: OnChangeEvent[];
16
- }) => State;
@@ -1,18 +0,0 @@
1
- /**
2
-
3
- */
4
- import { FormNode, State, Action, OnChangeEvent } from './types';
5
- export declare function reducer(state: State, action: Action): State;
6
- export declare const buildChangeSet: (event: OnChangeEvent, formNode: FormNode) => {
7
- fieldDefinition: {
8
- name: string;
9
- type: "string" | "object" | "reference";
10
- list?: boolean;
11
- parentTypename: string;
12
- };
13
- name: string;
14
- formId: string;
15
- mutationType: import("./types").ChangeMutation | import("./types").ReferenceChangeMutation | import("./types").InsertMutation | import("./types").MoveMutation | import("./types").RemoveMutation | import("./types").ResetMutation | import("./types").GlobalMutation;
16
- value: unknown;
17
- formNode: FormNode;
18
- };
@@ -1,4 +0,0 @@
1
- /**
2
-
3
- */
4
- export declare const testRunner: (query: any, events: any, dirname: any, expectNoChange?: boolean) => Promise<void>;
@@ -1,3 +0,0 @@
1
- declare const schema: any;
2
- export declare const tinaConfig: import("@tinacms/schema-tools/dist/types").Config<(cms: import("@tinacms/toolkit/dist/tina-cms").TinaCMS) => import("@tinacms/toolkit/dist/tina-cms").TinaCMS, import("../../use-graphql-forms").formifyCallback, import("../../use-content-creator").DocumentCreatorArgs, undefined>;
3
- export default schema;
@@ -1,16 +0,0 @@
1
- /**
2
-
3
- */
4
- import { TinaCMS } from '@tinacms/toolkit';
5
- import 'isomorphic-fetch';
6
- /**
7
- * We're just mocking the tina api so we can mimic the real-world getSchema
8
- */
9
- declare const cms: TinaCMS;
10
- export declare const printOutput: (event: any, previous: any, after: any) => string;
11
- export { printState } from '../util';
12
- export declare function sleep(ms: any): Promise<unknown>;
13
- export { cms };
14
- export declare const sequential: <A, B>(items: A[], callback: (args: A, idx: number) => Promise<B>) => Promise<B[]>;
15
- export declare const buildFileOutput: (dirname: any) => string;
16
- export declare const buildMarkdownOutput: (dirname: any, counter: any) => string;
@@ -1,166 +0,0 @@
1
- /**
2
-
3
- */
4
- /// <reference types="react" />
5
- import type * as G from 'graphql';
6
- import type { Form } from '@tinacms/toolkit';
7
- export declare type Action = {
8
- type: 'start';
9
- value: {
10
- query: string;
11
- };
12
- } | {
13
- type: 'setData';
14
- value: object;
15
- } | {
16
- type: 'addDocumentBlueprints';
17
- value: {
18
- blueprints: DocumentBlueprint[];
19
- formifiedQuery: G.DocumentNode;
20
- };
21
- } | {
22
- type: 'addOrReplaceDocumentFormNode';
23
- value: {
24
- formNode: FormNode;
25
- documentForm?: DocumentForm;
26
- };
27
- } | {
28
- type: 'onFieldChange';
29
- value: {
30
- event: OnChangeEvent;
31
- form?: Form;
32
- };
33
- } | {
34
- type: 'formOnReset';
35
- value: {
36
- event: OnChangeEvent;
37
- form?: Form;
38
- };
39
- } | {
40
- type: 'ready';
41
- } | {
42
- type: 'done';
43
- } | {
44
- type: 'setIn';
45
- value: Pick<ChangeSet, 'path' | 'value' | 'displaceIndex'>;
46
- };
47
- export declare type Dispatch = React.Dispatch<Action>;
48
- export declare type FormifiedDocumentNode = {
49
- id: string;
50
- _internalSys: {
51
- path: string;
52
- relativePath: string;
53
- collection: {
54
- name: any;
55
- };
56
- };
57
- _values: object;
58
- };
59
- export declare type ChangeMutation = {
60
- type: 'change';
61
- };
62
- export declare type ReferenceChangeMutation = {
63
- type: 'referenceChange';
64
- };
65
- export declare type InsertMutation = {
66
- type: 'insert';
67
- at: number;
68
- };
69
- export declare type MoveMutation = {
70
- type: 'move';
71
- from: number;
72
- to: number;
73
- };
74
- export declare type RemoveMutation = {
75
- type: 'remove';
76
- at: number;
77
- };
78
- export declare type ResetMutation = {
79
- type: 'reset';
80
- };
81
- export declare type GlobalMutation = {
82
- type: 'global';
83
- };
84
- declare type MutationType = ChangeMutation | ReferenceChangeMutation | InsertMutation | MoveMutation | RemoveMutation | ResetMutation | GlobalMutation;
85
- export declare type OnChangeEvent = {
86
- type: 'forms:fields:onChange' | 'forms:reset';
87
- value: unknown;
88
- previousValue: unknown;
89
- mutationType: MutationType;
90
- formId: string;
91
- field: {
92
- data: {
93
- tinaField: {
94
- name: string;
95
- type: 'string' | 'reference' | 'object';
96
- list?: boolean;
97
- parentTypename: string;
98
- };
99
- };
100
- name: string;
101
- };
102
- };
103
- export declare type ChangeSet = {
104
- path: string;
105
- value: unknown;
106
- formId: string;
107
- fieldDefinition: {
108
- name: string;
109
- type: 'string' | 'reference' | 'object';
110
- list?: boolean;
111
- };
112
- mutationType: MutationType;
113
- name: string;
114
- displaceIndex?: boolean;
115
- formNode: FormNode;
116
- };
117
- export declare type BlueprintPath = {
118
- name: string;
119
- alias: string;
120
- parentTypename?: string;
121
- list?: boolean;
122
- isNode?: boolean;
123
- };
124
- export declare type DocumentBlueprint = {
125
- /** The stringified representation of a path relative to root or it's parent document */
126
- id: string;
127
- /** The path to a field node */
128
- path: BlueprintPath[];
129
- /** The GraphQL SelectionNode, useful for re-fetching the given node */
130
- selection: G.SelectionNode;
131
- fields: FieldBlueprint[];
132
- /** For now, only top-level, non-list nodes will be shown in the sidebar */
133
- showInSidebar: boolean;
134
- /** these 2 are not traditional GraphQL fields but need be kept in-sync regardless */
135
- hasDataJSONField: boolean;
136
- hasValuesField: boolean;
137
- };
138
- export declare type FieldBlueprint = {
139
- /** The stringified representation of a path relative to root or it's parent document */
140
- id: string;
141
- documentBlueprintId: string;
142
- /** The path to a field node */
143
- path: BlueprintPath[];
144
- };
145
- export declare type FormNode = {
146
- /** The stringified path with location values injected (eg. 'getBlockPageList.edges.0.node.data.social.1.relatedPage') */
147
- documentFormId: string;
148
- documentBlueprintId: string;
149
- /** Coordinates for the DocumentBlueprint's '[]' values */
150
- location: number[];
151
- };
152
- /** The document ID is the true ID 'content/pages/hello-world.md') */
153
- declare type DocumentForm = Form;
154
- export declare type State = {
155
- schema: G.GraphQLSchema;
156
- query: G.DocumentNode;
157
- queryString: string;
158
- status: 'idle' | 'initialized' | 'formified' | 'ready' | 'done';
159
- count: number;
160
- data: object;
161
- changeSets: ChangeSet[];
162
- blueprints: DocumentBlueprint[];
163
- formNodes: FormNode[];
164
- documentForms: DocumentForm[];
165
- };
166
- export {};