@tinacms/app 1.1.0 → 1.1.2

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.
Files changed (136) hide show
  1. package/appFiles/node_modules/.package-lock.json +29 -28
  2. package/appFiles/node_modules/@babel/generator/lib/buffer.js +34 -10
  3. package/appFiles/node_modules/@babel/generator/lib/buffer.js.map +1 -1
  4. package/appFiles/node_modules/@babel/generator/lib/generators/classes.js +3 -4
  5. package/appFiles/node_modules/@babel/generator/lib/generators/classes.js.map +1 -1
  6. package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js +7 -0
  7. package/appFiles/node_modules/@babel/generator/lib/generators/expressions.js.map +1 -1
  8. package/appFiles/node_modules/@babel/generator/lib/generators/methods.js +51 -8
  9. package/appFiles/node_modules/@babel/generator/lib/generators/methods.js.map +1 -1
  10. package/appFiles/node_modules/@babel/generator/lib/generators/modules.js +7 -10
  11. package/appFiles/node_modules/@babel/generator/lib/generators/modules.js.map +1 -1
  12. package/appFiles/node_modules/@babel/generator/lib/generators/types.js +2 -0
  13. package/appFiles/node_modules/@babel/generator/lib/generators/types.js.map +1 -1
  14. package/appFiles/node_modules/@babel/generator/lib/generators/typescript.js +2 -2
  15. package/appFiles/node_modules/@babel/generator/lib/generators/typescript.js.map +1 -1
  16. package/appFiles/node_modules/@babel/generator/lib/index.js +1 -1
  17. package/appFiles/node_modules/@babel/generator/lib/index.js.map +1 -1
  18. package/appFiles/node_modules/@babel/generator/lib/node/parentheses.js.map +1 -1
  19. package/appFiles/node_modules/@babel/generator/lib/printer.js +7 -0
  20. package/appFiles/node_modules/@babel/generator/lib/printer.js.map +1 -1
  21. package/appFiles/node_modules/@babel/generator/lib/source-map.js +40 -9
  22. package/appFiles/node_modules/@babel/generator/lib/source-map.js.map +1 -1
  23. package/appFiles/node_modules/@babel/generator/package.json +5 -5
  24. package/appFiles/node_modules/@babel/helper-function-name/lib/index.js +0 -31
  25. package/appFiles/node_modules/@babel/helper-function-name/lib/index.js.map +1 -1
  26. package/appFiles/node_modules/@babel/helper-function-name/package.json +3 -3
  27. package/appFiles/node_modules/@babel/parser/lib/index.js +1901 -1885
  28. package/appFiles/node_modules/@babel/parser/lib/index.js.map +1 -1
  29. package/appFiles/node_modules/@babel/parser/package.json +2 -2
  30. package/appFiles/node_modules/@babel/parser/typings/babel-parser.d.ts +12 -0
  31. package/appFiles/node_modules/@babel/runtime/helpers/applyDecs2203R.js +173 -170
  32. package/appFiles/node_modules/@babel/runtime/helpers/applyDecs2301.js +221 -0
  33. package/appFiles/node_modules/@babel/runtime/helpers/esm/applyDecs2203R.js +173 -170
  34. package/appFiles/node_modules/@babel/runtime/helpers/esm/applyDecs2301.js +220 -0
  35. package/appFiles/node_modules/@babel/runtime/package.json +10 -1
  36. package/appFiles/node_modules/@babel/traverse/lib/path/modification.js.map +1 -1
  37. package/appFiles/node_modules/@babel/traverse/lib/visitors.js +11 -5
  38. package/appFiles/node_modules/@babel/traverse/lib/visitors.js.map +1 -1
  39. package/appFiles/node_modules/@babel/traverse/package.json +5 -5
  40. package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js +12 -7
  41. package/appFiles/node_modules/@babel/types/lib/asserts/generated/index.js.map +1 -1
  42. package/appFiles/node_modules/@babel/types/lib/ast-types/generated/index.js.map +1 -1
  43. package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js +5 -5
  44. package/appFiles/node_modules/@babel/types/lib/builders/generated/index.js.map +1 -1
  45. package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js +2 -6
  46. package/appFiles/node_modules/@babel/types/lib/clone/cloneNode.js.map +1 -1
  47. package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js +5 -4
  48. package/appFiles/node_modules/@babel/types/lib/constants/generated/index.js.map +1 -1
  49. package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js +0 -3
  50. package/appFiles/node_modules/@babel/types/lib/converters/gatherSequenceExpressions.js.map +1 -1
  51. package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js +1 -2
  52. package/appFiles/node_modules/@babel/types/lib/converters/toComputedKey.js.map +1 -1
  53. package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js +0 -3
  54. package/appFiles/node_modules/@babel/types/lib/converters/toExpression.js.map +1 -1
  55. package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js +0 -3
  56. package/appFiles/node_modules/@babel/types/lib/converters/toIdentifier.js.map +1 -1
  57. package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js +0 -3
  58. package/appFiles/node_modules/@babel/types/lib/converters/toKeyAlias.js.map +1 -1
  59. package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js +0 -1
  60. package/appFiles/node_modules/@babel/types/lib/converters/toSequenceExpression.js.map +1 -1
  61. package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js +0 -3
  62. package/appFiles/node_modules/@babel/types/lib/converters/toStatement.js.map +1 -1
  63. package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js +1 -9
  64. package/appFiles/node_modules/@babel/types/lib/converters/valueToNode.js.map +1 -1
  65. package/appFiles/node_modules/@babel/types/lib/definitions/core.js +21 -57
  66. package/appFiles/node_modules/@babel/types/lib/definitions/core.js.map +1 -1
  67. package/appFiles/node_modules/@babel/types/lib/definitions/deprecated-aliases.js +12 -0
  68. package/appFiles/node_modules/@babel/types/lib/definitions/deprecated-aliases.js.map +1 -0
  69. package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js +0 -3
  70. package/appFiles/node_modules/@babel/types/lib/definitions/experimental.js.map +1 -1
  71. package/appFiles/node_modules/@babel/types/lib/definitions/flow.js +0 -1
  72. package/appFiles/node_modules/@babel/types/lib/definitions/flow.js.map +1 -1
  73. package/appFiles/node_modules/@babel/types/lib/definitions/index.js +10 -0
  74. package/appFiles/node_modules/@babel/types/lib/definitions/index.js.map +1 -1
  75. package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js +6 -4
  76. package/appFiles/node_modules/@babel/types/lib/definitions/typescript.js.map +1 -1
  77. package/appFiles/node_modules/@babel/types/lib/definitions/utils.js +0 -2
  78. package/appFiles/node_modules/@babel/types/lib/definitions/utils.js.map +1 -1
  79. package/appFiles/node_modules/@babel/types/lib/index-legacy.d.ts +10 -3
  80. package/appFiles/node_modules/@babel/types/lib/index.d.ts +23 -6
  81. package/appFiles/node_modules/@babel/types/lib/index.js +9 -2
  82. package/appFiles/node_modules/@babel/types/lib/index.js.flow +8 -3
  83. package/appFiles/node_modules/@babel/types/lib/index.js.map +1 -1
  84. package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js +1 -9
  85. package/appFiles/node_modules/@babel/types/lib/modifications/flow/removeTypeDuplicates.js.map +1 -1
  86. package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js +0 -3
  87. package/appFiles/node_modules/@babel/types/lib/modifications/inherits.js.map +1 -1
  88. package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js +1 -3
  89. package/appFiles/node_modules/@babel/types/lib/modifications/removeProperties.js.map +1 -1
  90. package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js +0 -8
  91. package/appFiles/node_modules/@babel/types/lib/modifications/typescript/removeTypeDuplicates.js.map +1 -1
  92. package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js +2 -6
  93. package/appFiles/node_modules/@babel/types/lib/retrievers/getBindingIdentifiers.js.map +1 -1
  94. package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js +1 -2
  95. package/appFiles/node_modules/@babel/types/lib/traverse/traverseFast.js.map +1 -1
  96. package/appFiles/node_modules/@babel/types/lib/utils/deprecationWarning.js +30 -0
  97. package/appFiles/node_modules/@babel/types/lib/utils/deprecationWarning.js.map +1 -0
  98. package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js +0 -3
  99. package/appFiles/node_modules/@babel/types/lib/utils/react/cleanJSXElementLiteralChild.js.map +1 -1
  100. package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js +1 -2
  101. package/appFiles/node_modules/@babel/types/lib/utils/shallowEqual.js.map +1 -1
  102. package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js +11 -6
  103. package/appFiles/node_modules/@babel/types/lib/validators/generated/index.js.map +1 -1
  104. package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js +2 -4
  105. package/appFiles/node_modules/@babel/types/lib/validators/isBinding.js.map +1 -1
  106. package/appFiles/node_modules/@babel/types/lib/validators/isLet.js +1 -2
  107. package/appFiles/node_modules/@babel/types/lib/validators/isLet.js.map +1 -1
  108. package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js +1 -2
  109. package/appFiles/node_modules/@babel/types/lib/validators/isNodesEquivalent.js.map +1 -1
  110. package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js +0 -21
  111. package/appFiles/node_modules/@babel/types/lib/validators/isReferenced.js.map +1 -1
  112. package/appFiles/node_modules/@babel/types/lib/validators/isScope.js +0 -1
  113. package/appFiles/node_modules/@babel/types/lib/validators/isScope.js.map +1 -1
  114. package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js +1 -2
  115. package/appFiles/node_modules/@babel/types/lib/validators/isSpecifierDefault.js.map +1 -1
  116. package/appFiles/node_modules/@babel/types/lib/validators/isType.js +0 -1
  117. package/appFiles/node_modules/@babel/types/lib/validators/isType.js.map +1 -1
  118. package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js +0 -1
  119. package/appFiles/node_modules/@babel/types/lib/validators/isValidES3Identifier.js.map +1 -1
  120. package/appFiles/node_modules/@babel/types/lib/validators/isVar.js +1 -2
  121. package/appFiles/node_modules/@babel/types/lib/validators/isVar.js.map +1 -1
  122. package/appFiles/node_modules/@babel/types/package.json +3 -3
  123. package/appFiles/node_modules/css-to-react-native/index.d.ts +17 -0
  124. package/appFiles/node_modules/css-to-react-native/index.js +15 -0
  125. package/appFiles/node_modules/css-to-react-native/package.json +2 -1
  126. package/appFiles/node_modules/css-to-react-native/src/__tests__/aspectRatio.js +23 -0
  127. package/appFiles/node_modules/css-to-react-native/src/transforms/aspectRatio.js +12 -0
  128. package/appFiles/node_modules/css-to-react-native/src/transforms/index.js +2 -0
  129. package/appFiles/src/App.tsx +3 -5
  130. package/appFiles/src/fields/rich-text/monaco/error-message.tsx +1 -1
  131. package/appFiles/src/fields/rich-text/monaco/mdx.js +13517 -8946
  132. package/appFiles/src/lib/machines/document-machine.ts +4 -9
  133. package/appFiles/src/lib/machines/query-machine.ts +0 -13
  134. package/appFiles/src/preview.tsx +23 -0
  135. package/dist/index.js +3 -1
  136. package/package.json +5 -5
@@ -3,12 +3,7 @@
3
3
  */
4
4
  import { Client, Field, Form, FormOptions, TinaCMS } from 'tinacms'
5
5
  import { assign, createMachine, sendParent } from 'xstate'
6
- import {
7
- resolveForm,
8
- Templateable,
9
- TinaFieldEnriched,
10
- TinaSchema,
11
- } from 'tinacms'
6
+ import { resolveForm, Template, TinaFieldEnriched, TinaSchema } from 'tinacms'
12
7
 
13
8
  export type FieldType = Field & TinaFieldEnriched
14
9
  export type FormValues = Record<string, unknown>
@@ -53,7 +48,7 @@ export const documentMachine =
53
48
  /** @xstate-layout N4IgpgJg5mDOIC5QAoC2BDAxgCwJYDswBKAOgNwBdd0AbXALwKgGIIB7Qs-ANzYGswJNFjyFS5KrQZMEBXpnRUOAbQAMAXUSgADm1iVcHLSAAeiAEwAWSyUsA2VQE4AzAHYArABoQAT0QAORxJHEMdLd1d7d3NXWIBfOO9hHAJiLgMpRnwWMAAnXLZckm0aRQAzQtQhDBSxdMk6LKhZHjYFJXw1TSQQXX0O4zMEKxt7JzcvXwtVd2DQu2d-ZwBGVWX-dwTEkHw2CDhjZNE0iWpGpmM+gyMeoctzbz8EVaDLUNdAtfvIze2j1NIuTA6AgTx0emu+EGiEszlUtlcdncdnMkyey3WtlC-mWjmW7ncTlRCSSNWOpDyBVylwhA1uMLhCKRKLRFlxcxC4UiSJikRJIH+Yhp-UMUPpz38j0Q6y2cSAA */
54
49
  createMachine(
55
50
  {
56
- tsTypes: {} as import('./document-machine.typegen').Typegen0,
51
+ // tsTypes: {} as ,
57
52
  schema: {
58
53
  context: {} as ContextType,
59
54
  services: {} as {
@@ -174,14 +169,14 @@ export const documentMachine =
174
169
  const collection = schema.getCollection(
175
170
  node._internalSys.collection.name
176
171
  )
177
- let template: Templateable
172
+ let template: Template
178
173
  if (collection.templates) {
179
174
  template = collection.templates.find((template) => {
180
175
  if (typeof template === 'string') {
181
176
  throw new Error(`Global templates not supported`)
182
177
  }
183
178
  return template.name === node._internalSys.template
184
- }) as Templateable
179
+ }) as Template
185
180
  } else {
186
181
  template = collection
187
182
  }
@@ -564,19 +564,6 @@ export const queryMachine =
564
564
  }
565
565
  }
566
566
  })
567
- if (context.cms) {
568
- context.cms.events.subscribe(`forms:fields:onChange`, (event) => {
569
- // Nested forms from rich-text also trigger this event
570
- if (Object.keys(context.documentMap).includes(event.formId)) {
571
- callback({ type: 'FIELD_CHANGE' })
572
- }
573
- })
574
- context.cms.events.subscribe(`forms:reset`, (event) => {
575
- if (Object.keys(context.documentMap).includes(event.formId)) {
576
- callback({ type: 'FIELD_CHANGE' })
577
- }
578
- })
579
- }
580
567
  },
581
568
  },
582
569
  }
@@ -51,6 +51,7 @@ export const Preview = (
51
51
  />
52
52
  )}
53
53
  <iframe
54
+ data-test="tina-iframe"
54
55
  id="tina-iframe"
55
56
  ref={props.iframeRef}
56
57
  className="h-screen w-full bg-white"
@@ -81,6 +82,28 @@ const QueryMachine = (props: {
81
82
  )
82
83
 
83
84
  const [state, send] = useMachine(machine)
85
+ React.useEffect(() => {
86
+ const unsubscribeFieldChange = cms.events.subscribe(
87
+ `forms:fields:onChange`,
88
+ (event) => {
89
+ // Nested forms from rich-text also trigger this event
90
+ if (Object.keys(state.context.documentMap).includes(event.formId)) {
91
+ send({ type: 'FIELD_CHANGE' })
92
+ }
93
+ }
94
+ )
95
+ const unsubscribeReset = cms.events.subscribe(`forms:reset`, (event) => {
96
+ if (Object.keys(state.context.documentMap).includes(event.formId)) {
97
+ send({ type: 'FIELD_CHANGE' })
98
+ }
99
+ })
100
+
101
+ return () => {
102
+ unsubscribeFieldChange()
103
+ unsubscribeReset()
104
+ }
105
+ }, [cms, state.context.documentMap])
106
+
84
107
  React.useEffect(() => {
85
108
  if (state.matches('pipeline.ready')) {
86
109
  cms.events.dispatch({ type: 'forms:register', value: 'complete' })
package/dist/index.js CHANGED
@@ -339,6 +339,7 @@ var viteBuild = async ({
339
339
  const localBuild = l;
340
340
  const node_env = JSON.stringify(process.env.NODE_ENV);
341
341
  const generatedPath = import_path2.default.join(rootPath, ".tina", "__generated__");
342
+ const schemaImport = import_path2.default.join(generatedPath, "_graphql.json");
342
343
  const outputPath = import_path2.default.join(rootPath, publicFolder, outputFolder);
343
344
  const appCopyPath = import_path2.default.join(__dirname, "..", "appFiles");
344
345
  const appRootPath = import_path2.default.join(generatedPath, "app");
@@ -373,7 +374,8 @@ var viteBuild = async ({
373
374
  }
374
375
  await (0, import_vite.build)(prebuildConfig);
375
376
  const alias = {
376
- TINA_IMPORT: configPrebuildPath
377
+ TINA_IMPORT: configPrebuildPath,
378
+ SCHEMA_IMPORT: schemaImport
377
379
  };
378
380
  const publicEnv = {};
379
381
  Object.keys(process.env).forEach((key) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tinacms/app",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "main": "dist/index.js",
5
5
  "exports": {
6
6
  ".": {
@@ -36,10 +36,10 @@
36
36
  "@types/fs-extra": "^9.0.1",
37
37
  "@types/react": "17.0.2",
38
38
  "@types/react-dom": "17.0.2",
39
- "@tinacms/scripts": "1.0.2",
40
- "tinacms": "1.2.1",
41
- "@tinacms/toolkit": "1.3.3",
42
- "@tinacms/mdx": "1.3.0",
39
+ "@tinacms/scripts": "1.0.3",
40
+ "tinacms": "1.3.0",
41
+ "@tinacms/toolkit": "1.4.0",
42
+ "@tinacms/mdx": "1.3.2",
43
43
  "jest": "^27.0.6"
44
44
  },
45
45
  "dependencies": {