tinacms 0.66.9 → 0.67.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.
@@ -70,6 +70,7 @@ declare type BaseComponents = {
70
70
  alt?: string;
71
71
  };
72
72
  hr?: {};
73
+ break?: {};
73
74
  maybe_mdx?: {
74
75
  children: JSX.Element;
75
76
  };
@@ -129,6 +129,16 @@ const TinaMarkdown = ({
129
129
  return /* @__PURE__ */ React.createElement("hr", {
130
130
  key
131
131
  });
132
+ case "break":
133
+ if (components[child.type]) {
134
+ const Component2 = components[child.type];
135
+ return /* @__PURE__ */ React.createElement(Component2, __spreadValues({
136
+ key
137
+ }, props));
138
+ }
139
+ return /* @__PURE__ */ React.createElement("br", {
140
+ key
141
+ });
132
142
  case "text":
133
143
  return /* @__PURE__ */ React.createElement(Leaf, __spreadValues({
134
144
  key,
package/dist/rich-text.js CHANGED
@@ -136,6 +136,16 @@ var __objRest = (source, exclude) => {
136
136
  return /* @__PURE__ */ React__default["default"].createElement("hr", {
137
137
  key
138
138
  });
139
+ case "break":
140
+ if (components[child.type]) {
141
+ const Component2 = components[child.type];
142
+ return /* @__PURE__ */ React__default["default"].createElement(Component2, __spreadValues({
143
+ key
144
+ }, props));
145
+ }
146
+ return /* @__PURE__ */ React__default["default"].createElement("br", {
147
+ key
148
+ });
139
149
  case "text":
140
150
  return /* @__PURE__ */ React__default["default"].createElement(Leaf, __spreadValues({
141
151
  key,
package/dist/style.css CHANGED
@@ -145,6 +145,9 @@
145
145
  .tina-tailwind .w-56 {
146
146
  width: 224px;
147
147
  }
148
+ .tina-tailwind .w-0 {
149
+ width: 0px;
150
+ }
148
151
  .tina-tailwind .w-6 {
149
152
  width: 24px;
150
153
  }
@@ -390,6 +393,10 @@
390
393
  .tina-tailwind .tracking-wide {
391
394
  letter-spacing: 0.025em;
392
395
  }
396
+ .tina-tailwind .text-gray-600 {
397
+ --tw-text-opacity: 1;
398
+ color: rgb(86 81 101 / var(--tw-text-opacity));
399
+ }
393
400
  .tina-tailwind .text-gray-700 {
394
401
  --tw-text-opacity: 1;
395
402
  color: rgb(67 62 82 / var(--tw-text-opacity));
@@ -413,10 +420,6 @@
413
420
  --tw-text-opacity: 1;
414
421
  color: rgb(255 255 255 / var(--tw-text-opacity));
415
422
  }
416
- .tina-tailwind .text-gray-600 {
417
- --tw-text-opacity: 1;
418
- color: rgb(86 81 101 / var(--tw-text-opacity));
419
- }
420
423
  .tina-tailwind .text-gray-800 {
421
424
  --tw-text-opacity: 1;
422
425
  color: rgb(54 49 69 / var(--tw-text-opacity));
@@ -425,6 +428,10 @@
425
428
  --tw-text-opacity: 1;
426
429
  color: rgb(37 35 54 / var(--tw-text-opacity));
427
430
  }
431
+ .tina-tailwind .text-red-500 {
432
+ --tw-text-opacity: 1;
433
+ color: rgb(239 68 68 / var(--tw-text-opacity));
434
+ }
428
435
  .tina-tailwind .underline {
429
436
  text-decoration-line: underline;
430
437
  }
@@ -11,11 +11,12 @@ See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
13
  import React from 'react';
14
- import { useDocumentCreatorPlugin } from './hooks/use-content-creator';
15
14
  import { TinaCloudMediaStoreClass } from './auth';
16
- import type { TinaIOConfig } from './client/index';
17
15
  import type { TinaCMS } from '@tinacms/toolkit';
16
+ import type { TinaCloudSchema } from '@tinacms/schema-tools';
17
+ import type { TinaIOConfig } from './client/index';
18
18
  import type { formifyCallback } from './hooks/use-graphql-forms';
19
+ import { useDocumentCreatorPlugin } from './hooks/use-content-creator';
19
20
  declare type APIProviderProps = {
20
21
  /**
21
22
  * Content API URL
@@ -77,6 +78,7 @@ interface BaseProviderProps {
77
78
  /** TinaCMS media store instance */
78
79
  mediaStore?: TinaCloudMediaStoreClass | (() => Promise<TinaCloudMediaStoreClass>);
79
80
  tinaioConfig?: TinaIOConfig;
81
+ schema?: TinaCloudSchema<false>;
80
82
  }
81
83
  declare type QueryProviderProps = {
82
84
  /** Your React page component */
@@ -98,7 +100,7 @@ declare type QueryProviderProps = {
98
100
  data?: never;
99
101
  };
100
102
  export declare type TinaCMSProviderDefaultProps = QueryProviderProps & APIProviderProps & BaseProviderProps;
101
- export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
103
+ export declare const TinaCMSProvider2: ({ query, documentCreatorCallback, formifyCallback, schema, ...props }: TinaCMSProviderDefaultProps) => JSX.Element;
102
104
  export declare const TinaDataProvider: ({ children, formifyCallback, }: {
103
105
  children: any;
104
106
  formifyCallback: formifyCallback;
@@ -13,6 +13,7 @@ limitations under the License.
13
13
  import { Client } from '../client';
14
14
  import type { TinaIOConfig } from '../client';
15
15
  import * as yup from 'yup';
16
+ import { TinaCloudSchema } from '@tinacms/schema-tools';
16
17
  export interface CreateClientProps {
17
18
  clientId?: string;
18
19
  isLocalClient?: boolean;
@@ -20,7 +21,8 @@ export interface CreateClientProps {
20
21
  owner?: string;
21
22
  repo?: string;
22
23
  branch?: string;
24
+ schema?: TinaCloudSchema<false>;
23
25
  }
24
- export declare const createClient: ({ clientId, isLocalClient, branch, tinaioConfig, }: CreateClientProps) => Client;
26
+ export declare const createClient: ({ clientId, isLocalClient, branch, tinaioConfig, schema, }: CreateClientProps) => Client;
25
27
  export declare function assertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => yup.AnySchema, errorMessage?: string): asserts value is T;
26
28
  export declare function safeAssertShape<T extends unknown>(value: unknown, yupSchema: (args: typeof yup) => yup.AnySchema): boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tinacms",
3
- "version": "0.66.9",
3
+ "version": "0.67.1",
4
4
  "main": "dist/index.js",
5
5
  "files": [
6
6
  "dist"
@@ -24,8 +24,9 @@
24
24
  "@graphql-tools/relay-operation-optimizer": "^6.4.1",
25
25
  "@headlessui/react": "^1.4.1",
26
26
  "@heroicons/react": "^1.0.4",
27
- "@tinacms/sharedctx": "0.1.0",
28
- "@tinacms/toolkit": "0.56.18",
27
+ "@tinacms/schema-tools": "0.0.3",
28
+ "@tinacms/sharedctx": "0.1.1",
29
+ "@tinacms/toolkit": "0.56.19",
29
30
  "crypto-js": "^4.0.0",
30
31
  "final-form": "4.20.1",
31
32
  "graphql": "^15.1.0",
@@ -1,258 +0,0 @@
1
- /**
2
- Copyright 2021 Forestry.io Holdings, Inc.
3
- Licensed under the Apache License, Version 2.0 (the "License");
4
- you may not use this file except in compliance with the License.
5
- You may obtain a copy of the License at
6
- http://www.apache.org/licenses/LICENSE-2.0
7
- Unless required by applicable law or agreed to in writing, software
8
- distributed under the License is distributed on an "AS IS" BASIS,
9
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10
- See the License for the specific language governing permissions and
11
- limitations under the License.
12
- */
13
- export interface TinaCloudSchema<WithNamespace extends boolean> {
14
- templates?: GlobalTemplate<WithNamespace>[];
15
- collections: TinaCloudCollection<WithNamespace>[];
16
- }
17
- export declare type TinaCloudSchemaBase = TinaCloudSchema<false>;
18
- export declare type TinaCloudSchemaEnriched = TinaCloudSchema<true>;
19
- /**
20
- * As part of the build process, each node is given a `path: string[]` key
21
- * to help with namespacing type names, this is added as part of the
22
- * createTinaSchema step
23
- */
24
- export interface TinaCloudSchemaWithNamespace {
25
- templates?: GlobalTemplate<true>[];
26
- collections: TinaCloudCollection<true>[];
27
- namespace: string[];
28
- }
29
- export declare type TinaCloudCollection<WithNamespace extends boolean> = CollectionFields<WithNamespace> | CollectionTemplates<WithNamespace>;
30
- export declare type TinaCloudCollectionBase = TinaCloudCollection<false>;
31
- export declare type TinaCloudCollectionEnriched = TinaCloudCollection<true>;
32
- declare type FormatType = 'json' | 'md' | 'markdown' | 'mdx';
33
- interface BaseCollection {
34
- label?: string;
35
- name: string;
36
- path: string;
37
- format?: FormatType;
38
- match?: string;
39
- }
40
- declare type CollectionTemplates<WithNamespace extends boolean> = WithNamespace extends true ? CollectionTemplatesWithNamespace<WithNamespace> : CollectionTemplatesInner<WithNamespace>;
41
- interface CollectionTemplatesInner<WithNamespace extends boolean> extends BaseCollection {
42
- templates: (string | Template<WithNamespace>)[];
43
- fields?: undefined;
44
- }
45
- export interface CollectionTemplatesWithNamespace<WithNamespace extends boolean> extends BaseCollection {
46
- templates: (string | Template<WithNamespace>)[];
47
- fields?: undefined;
48
- references?: ReferenceType<WithNamespace>[];
49
- namespace: WithNamespace extends true ? string[] : undefined;
50
- }
51
- declare type CollectionFields<WithNamespace extends boolean> = WithNamespace extends true ? CollectionFieldsWithNamespace<WithNamespace> : CollectionFieldsInner<WithNamespace>;
52
- export interface CollectionFieldsWithNamespace<WithNamespace extends boolean> extends BaseCollection {
53
- fields: string | TinaFieldInner<WithNamespace>[];
54
- templates?: undefined;
55
- references?: ReferenceType<WithNamespace>[];
56
- namespace: string[];
57
- }
58
- interface CollectionFieldsInner<WithNamespace extends boolean> extends BaseCollection {
59
- fields: string | TinaFieldInner<WithNamespace>[];
60
- templates?: undefined;
61
- }
62
- export declare type TinaFieldInner<WithNamespace extends boolean> = ScalarType<WithNamespace> | ObjectType<WithNamespace> | ReferenceType<WithNamespace> | RichType<WithNamespace>;
63
- export declare type TinaFieldBase = TinaFieldInner<false>;
64
- export declare type TinaFieldEnriched = TinaFieldInner<true>;
65
- interface TinaField {
66
- name: string;
67
- label?: string;
68
- description?: string;
69
- required?: boolean;
70
- list?: boolean;
71
- /**
72
- * Any items passed to the UI field will be passed to the underlying field.
73
- * NOTE: only serializable values are supported, so functions like `validate`
74
- * will be ignored.
75
- */
76
- ui?: object;
77
- }
78
- declare type ScalarType<WithNamespace extends boolean> = WithNamespace extends true ? ScalarTypeWithNamespace : ScalarTypeInner;
79
- declare type Option = string | {
80
- label: string;
81
- value: string;
82
- };
83
- declare type ScalarTypeInner = TinaField & TinaScalarField & {
84
- options?: Option[];
85
- };
86
- declare type ScalarTypeWithNamespace = TinaField & TinaScalarField & {
87
- options?: Option[];
88
- namespace: string[];
89
- };
90
- declare type TinaScalarField = StringField | BooleanField | DateTimeField | NumberField | ImageField;
91
- declare type StringField = {
92
- type: 'string';
93
- isBody?: boolean;
94
- };
95
- declare type BooleanField = {
96
- type: 'boolean';
97
- };
98
- declare type NumberField = {
99
- type: 'number';
100
- };
101
- declare type DateTimeField = {
102
- type: 'datetime';
103
- dateFormat?: string;
104
- timeFormat?: string;
105
- };
106
- declare type ImageField = {
107
- type: 'image';
108
- };
109
- export declare type ReferenceType<WithNamespace extends boolean> = WithNamespace extends true ? ReferenceTypeWithNamespace : ReferenceTypeInner;
110
- export declare type RichType<WithNamespace extends boolean> = WithNamespace extends true ? RichTypeWithNamespace : RichTypeInner;
111
- export interface ReferenceTypeInner extends TinaField {
112
- type: 'reference';
113
- reverseLookup?: {
114
- label: string;
115
- name: string;
116
- };
117
- collections: string[];
118
- }
119
- export interface ReferenceTypeWithNamespace extends TinaField {
120
- type: 'reference';
121
- collections: string[];
122
- reverseLookup?: {
123
- label: string;
124
- name: string;
125
- };
126
- namespace: string[];
127
- }
128
- export interface RichTypeWithNamespace extends TinaField {
129
- type: 'rich-text';
130
- namespace: string[];
131
- isBody?: boolean;
132
- templates?: (string | (Template<true> & {
133
- inline?: boolean;
134
- }))[];
135
- }
136
- export interface RichTypeInner extends TinaField {
137
- type: 'rich-text';
138
- isBody?: boolean;
139
- templates?: (string | (Template<false> & {
140
- inline?: boolean;
141
- }))[];
142
- }
143
- export declare type ObjectType<WithNamespace extends boolean> = ObjectTemplates<WithNamespace> | ObjectFields<WithNamespace>;
144
- declare type ObjectTemplates<WithNamespace extends boolean> = WithNamespace extends true ? ObjectTemplatesWithNamespace<WithNamespace> : ObjectTemplatesInner<WithNamespace>;
145
- interface ObjectTemplatesInner<WithNamespace extends boolean> extends TinaField {
146
- type: 'object';
147
- required?: false;
148
- /**
149
- * templates can either be an array of Tina templates or a reference to
150
- * global template definition.
151
- *
152
- * You should use `templates` when your object can be any one of multiple shapes (polymorphic)
153
- *
154
- * You can only provide one of `fields` or `template`, but not both
155
- */
156
- templates: (string | Template<WithNamespace>)[];
157
- fields?: undefined;
158
- }
159
- interface ObjectTemplatesWithNamespace<WithNamespace extends boolean> extends TinaField {
160
- type: 'object';
161
- required?: false;
162
- /**
163
- * templates can either be an array of Tina templates or a reference to
164
- * global template definition.
165
- *
166
- * You should use `templates` when your object can be any one of multiple shapes (polymorphic)
167
- *
168
- * You can only provide one of `fields` or `template`, but not both
169
- */
170
- templates: (string | Template<WithNamespace>)[];
171
- fields?: undefined;
172
- namespace: WithNamespace extends true ? string[] : undefined;
173
- }
174
- declare type ObjectFields<WithNamespace extends boolean> = WithNamespace extends true ? InnerObjectFieldsWithNamespace<WithNamespace> : InnerObjectFields<WithNamespace>;
175
- interface InnerObjectFields<WithNamespace extends boolean> extends TinaField {
176
- type: 'object';
177
- required?: false;
178
- /**
179
- * fields can either be an array of Tina fields, or a reference to the fields
180
- * of a global template definition.
181
- *
182
- * You can only provide one of `fields` or `templates`, but not both.
183
- */
184
- fields: string | TinaFieldInner<WithNamespace>[];
185
- templates?: undefined;
186
- }
187
- interface InnerObjectFieldsWithNamespace<WithNamespace extends boolean> extends TinaField {
188
- type: 'object';
189
- required?: false;
190
- /**
191
- * fields can either be an array of Tina fields, or a reference to the fields
192
- * of a global template definition.
193
- *
194
- * You can only provide one of `fields` or `templates`, but not both.
195
- */
196
- fields: string | TinaFieldInner<WithNamespace>[];
197
- templates?: undefined;
198
- namespace: WithNamespace extends true ? string[] : undefined;
199
- }
200
- /**
201
- * Global Templates are defined once, and can be used anywhere by referencing the 'name' of the template
202
- *
203
- * TODO: ensure we don't permit infite loop with self-references
204
- */
205
- export declare type GlobalTemplate<WithNamespace extends boolean> = WithNamespace extends true ? {
206
- label: string;
207
- name: string;
208
- ui?: object;
209
- fields: TinaFieldInner<WithNamespace>[];
210
- namespace: WithNamespace extends true ? string[] : undefined;
211
- } : {
212
- label: string;
213
- name: string;
214
- ui?: object;
215
- fields: TinaFieldInner<WithNamespace>[];
216
- };
217
- export declare type TinaCloudTemplateBase = GlobalTemplate<false>;
218
- export declare type TinaCloudTemplateEnriched = GlobalTemplate<true>;
219
- /**
220
- * Templates allow you to define an object as polymorphic
221
- */
222
- export declare type Template<WithNamespace extends boolean> = WithNamespace extends true ? {
223
- label: string;
224
- name: string;
225
- fields: TinaFieldInner<WithNamespace>[];
226
- ui?: object;
227
- namespace: WithNamespace extends true ? string[] : undefined;
228
- } : {
229
- label: string;
230
- name: string;
231
- ui?: object;
232
- fields: TinaFieldInner<WithNamespace>[];
233
- };
234
- export declare type CollectionTemplateableUnion = {
235
- namespace: string[];
236
- type: 'union';
237
- templates: Templateable[];
238
- };
239
- export declare type CollectionTemplateableObject = {
240
- namespace: string[];
241
- type: 'object';
242
- required?: false;
243
- template: Templateable;
244
- };
245
- export declare type CollectionTemplateable = CollectionTemplateableUnion | CollectionTemplateableObject;
246
- export declare type Collectable = {
247
- namespace: string[];
248
- templates?: (string | Templateable)[];
249
- fields?: string | TinaFieldEnriched[];
250
- references?: ReferenceType<true>[];
251
- };
252
- export declare type Templateable = {
253
- name: string;
254
- namespace: string[];
255
- fields: TinaFieldEnriched[];
256
- ui?: object;
257
- };
258
- export {};
@@ -1,18 +0,0 @@
1
- /**
2
-
3
- Copyright 2021 Forestry.io Holdings, Inc.
4
-
5
- Licensed under the Apache License, Version 2.0 (the "License");
6
- you may not use this file except in compliance with the License.
7
- You may obtain a copy of the License at
8
-
9
- http://www.apache.org/licenses/LICENSE-2.0
10
-
11
- Unless required by applicable law or agreed to in writing, software
12
- distributed under the License is distributed on an "AS IS" BASIS,
13
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- See the License for the specific language governing permissions and
15
- limitations under the License.
16
-
17
- */
18
- export * from './SchemaTypes';