unframer 4.1.8 → 4.2.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.
Files changed (162) hide show
  1. package/README.md +5 -5
  2. package/dist/babel-jsx.d.ts +9 -0
  3. package/dist/babel-jsx.d.ts.map +1 -1
  4. package/dist/babel-jsx.js +72 -0
  5. package/dist/babel-jsx.js.map +1 -1
  6. package/dist/cli.d.ts +2 -2
  7. package/dist/cli.d.ts.map +1 -1
  8. package/dist/cli.js +262 -42
  9. package/dist/cli.js.map +1 -1
  10. package/dist/css-core.d.ts +50 -0
  11. package/dist/css-core.d.ts.map +1 -0
  12. package/dist/css-core.js +231 -0
  13. package/dist/css-core.js.map +1 -0
  14. package/dist/css.d.ts +9 -43
  15. package/dist/css.d.ts.map +1 -1
  16. package/dist/css.js +9 -232
  17. package/dist/css.js.map +1 -1
  18. package/dist/exporter.d.ts +1 -1
  19. package/dist/exporter.d.ts.map +1 -1
  20. package/dist/exporter.js +72 -11
  21. package/dist/exporter.js.map +1 -1
  22. package/dist/exporter.test.js +78 -0
  23. package/dist/exporter.test.js.map +1 -1
  24. package/dist/framer-chunks/{SqliteDatabase-VAKIICSG-R7ZS6CHH.js → SqliteDatabase-VAKIICSG-OPV4MG3Y.js} +5 -4
  25. package/dist/framer-chunks/{chunk-2DZGP7C2.js → chunk-7ZLQTYXQ.js} +5 -24
  26. package/dist/framer-chunks/chunk-IKQSD2QC.js +10 -0
  27. package/dist/framer-chunks/default-blog-sqlite-7ZHEY3GT-TVGUYU6H.js +7 -0
  28. package/dist/framer-chunks/fontshare-4THNDPMZ-FLLTWCDO.js +7 -0
  29. package/dist/framer-chunks/fontshare-B2QLD7YB-5V3XZJAH.js +7 -0
  30. package/dist/framer-chunks/fontshare-O22OBJ3D-FIG3CRN3.js +7 -0
  31. package/dist/framer-chunks/framer-font-45AI7UCZ-CKGC4MJC.js +7 -0
  32. package/dist/framer-chunks/google-3FCAKCAC-AM34UPJK.js +7 -0
  33. package/dist/framer-chunks/google-3SZHWBC6-2VTQEQ7J.js +7 -0
  34. package/dist/framer-chunks/google-GXDJLGJB-JNEJGCGD.js +7 -0
  35. package/dist/framer-chunks/sqlite-wasm-FGP37EAY-NO5QVZDI.js +7 -0
  36. package/dist/framer-chunks/sqlite3-SISQ6ENZ-5WRKGWTY.js +7 -0
  37. package/dist/framer.d.ts +128 -0
  38. package/dist/framer.js +820 -428
  39. package/dist/plugin-mcp-dist/lib/framer.d.ts +1 -7
  40. package/dist/plugin-mcp-dist/lib/framer.d.ts.map +1 -1
  41. package/dist/plugin-mcp-dist/lib/framer.js +90 -23
  42. package/dist/plugin-mcp-dist/lib/framer.js.map +1 -1
  43. package/dist/plugin-mcp-dist/lib/framer.test.d.ts +2 -0
  44. package/dist/plugin-mcp-dist/lib/framer.test.d.ts.map +1 -0
  45. package/dist/plugin-mcp-dist/lib/framer.test.js +214 -0
  46. package/dist/plugin-mcp-dist/lib/framer.test.js.map +1 -0
  47. package/dist/plugin-mcp-dist/lib/mcp-handlers.d.ts.map +1 -1
  48. package/dist/plugin-mcp-dist/lib/mcp-handlers.js +69 -11
  49. package/dist/plugin-mcp-dist/lib/mcp-handlers.js.map +1 -1
  50. package/dist/plugin-mcp-dist/lib/mcp.test.js +340 -364
  51. package/dist/plugin-mcp-dist/lib/mcp.test.js.map +1 -1
  52. package/dist/plugin-mcp-dist/lib/plugin-websocket.d.ts.map +1 -1
  53. package/dist/plugin-mcp-dist/lib/plugin-websocket.js +0 -3
  54. package/dist/plugin-mcp-dist/lib/plugin-websocket.js.map +1 -1
  55. package/dist/plugin-mcp-dist/lib/react-export.d.ts.map +1 -1
  56. package/dist/plugin-mcp-dist/lib/react-export.js +79 -61
  57. package/dist/plugin-mcp-dist/lib/react-export.js.map +1 -1
  58. package/dist/plugin-mcp-dist/lib/schema.d.ts +8 -0
  59. package/dist/plugin-mcp-dist/lib/schema.d.ts.map +1 -1
  60. package/dist/plugin-mcp-dist/lib/schema.js +18 -1
  61. package/dist/plugin-mcp-dist/lib/schema.js.map +1 -1
  62. package/dist/plugin-mcp-dist/lib/store.d.ts +1 -1
  63. package/dist/plugin-mcp-dist/lib/store.d.ts.map +1 -1
  64. package/dist/plugin-mcp-dist/lib/tunnel-integration.test.d.ts +2 -0
  65. package/dist/plugin-mcp-dist/lib/tunnel-integration.test.d.ts.map +1 -0
  66. package/dist/plugin-mcp-dist/lib/tunnel-integration.test.js +147 -0
  67. package/dist/plugin-mcp-dist/lib/tunnel-integration.test.js.map +1 -0
  68. package/dist/plugin-mcp-dist/lib/tunnel.d.ts +46 -0
  69. package/dist/plugin-mcp-dist/lib/tunnel.d.ts.map +1 -0
  70. package/dist/plugin-mcp-dist/lib/tunnel.js +117 -0
  71. package/dist/plugin-mcp-dist/lib/tunnel.js.map +1 -0
  72. package/dist/plugin-mcp-dist/lib/upstream-socket.d.ts +13 -0
  73. package/dist/plugin-mcp-dist/lib/upstream-socket.d.ts.map +1 -0
  74. package/dist/plugin-mcp-dist/lib/upstream-socket.js +56 -0
  75. package/dist/plugin-mcp-dist/lib/upstream-socket.js.map +1 -0
  76. package/dist/plugin-mcp-dist/lib/upstream-socket.test.d.ts +2 -0
  77. package/dist/plugin-mcp-dist/lib/upstream-socket.test.d.ts.map +1 -0
  78. package/dist/plugin-mcp-dist/lib/upstream-socket.test.js +212 -0
  79. package/dist/plugin-mcp-dist/lib/upstream-socket.test.js.map +1 -0
  80. package/dist/plugin-mcp-dist/lib/utils.d.ts +1 -9
  81. package/dist/plugin-mcp-dist/lib/utils.d.ts.map +1 -1
  82. package/dist/plugin-mcp-dist/lib/utils.js +13 -9
  83. package/dist/plugin-mcp-dist/lib/utils.js.map +1 -1
  84. package/dist/react.d.ts +1 -1
  85. package/dist/react.d.ts.map +1 -1
  86. package/dist/react.js +7 -13
  87. package/dist/react.js.map +1 -1
  88. package/dist/version.d.ts +1 -1
  89. package/dist/version.js +1 -1
  90. package/package.json +7 -8
  91. package/src/babel-jsx.ts +99 -0
  92. package/src/cli.ts +295 -42
  93. package/src/css-core.ts +277 -0
  94. package/src/css.tsx +10 -276
  95. package/src/exporter.test.ts +82 -0
  96. package/src/exporter.ts +92 -11
  97. package/src/framer.d.ts +128 -0
  98. package/src/framer.js +820 -428
  99. package/src/plugin-mcp-dist/lib/framer.d.ts +2 -5
  100. package/src/plugin-mcp-dist/lib/framer.d.ts.map +1 -1
  101. package/src/plugin-mcp-dist/lib/framer.js +90 -23
  102. package/src/plugin-mcp-dist/lib/framer.js.map +1 -1
  103. package/src/plugin-mcp-dist/lib/framer.test.d.ts +2 -0
  104. package/src/plugin-mcp-dist/lib/framer.test.d.ts.map +1 -0
  105. package/src/plugin-mcp-dist/lib/framer.test.js +213 -0
  106. package/src/plugin-mcp-dist/lib/framer.test.js.map +1 -0
  107. package/src/plugin-mcp-dist/lib/mcp-handlers.d.ts +2 -2
  108. package/src/plugin-mcp-dist/lib/mcp-handlers.d.ts.map +1 -1
  109. package/src/plugin-mcp-dist/lib/mcp-handlers.js +69 -11
  110. package/src/plugin-mcp-dist/lib/mcp-handlers.js.map +1 -1
  111. package/src/plugin-mcp-dist/lib/mcp.test.js +340 -364
  112. package/src/plugin-mcp-dist/lib/mcp.test.js.map +1 -1
  113. package/src/plugin-mcp-dist/lib/plugin-websocket.d.ts.map +1 -1
  114. package/src/plugin-mcp-dist/lib/plugin-websocket.js +0 -3
  115. package/src/plugin-mcp-dist/lib/plugin-websocket.js.map +1 -1
  116. package/src/plugin-mcp-dist/lib/react-export.d.ts +1 -1
  117. package/src/plugin-mcp-dist/lib/react-export.d.ts.map +1 -1
  118. package/src/plugin-mcp-dist/lib/react-export.js +79 -61
  119. package/src/plugin-mcp-dist/lib/react-export.js.map +1 -1
  120. package/src/plugin-mcp-dist/lib/schema.d.ts +11 -3
  121. package/src/plugin-mcp-dist/lib/schema.d.ts.map +1 -1
  122. package/src/plugin-mcp-dist/lib/schema.js +18 -1
  123. package/src/plugin-mcp-dist/lib/schema.js.map +1 -1
  124. package/src/plugin-mcp-dist/lib/tunnel-integration.test.d.ts +2 -0
  125. package/src/plugin-mcp-dist/lib/tunnel-integration.test.d.ts.map +1 -0
  126. package/src/plugin-mcp-dist/lib/tunnel-integration.test.js +146 -0
  127. package/src/plugin-mcp-dist/lib/tunnel-integration.test.js.map +1 -0
  128. package/src/plugin-mcp-dist/lib/tunnel.d.ts +55 -0
  129. package/src/plugin-mcp-dist/lib/tunnel.d.ts.map +1 -0
  130. package/src/plugin-mcp-dist/lib/tunnel.js +116 -0
  131. package/src/plugin-mcp-dist/lib/tunnel.js.map +1 -0
  132. package/src/plugin-mcp-dist/lib/upstream-socket.d.ts +28 -0
  133. package/src/plugin-mcp-dist/lib/upstream-socket.d.ts.map +1 -0
  134. package/src/plugin-mcp-dist/lib/upstream-socket.js +55 -0
  135. package/src/plugin-mcp-dist/lib/upstream-socket.js.map +1 -0
  136. package/src/plugin-mcp-dist/lib/upstream-socket.test.d.ts +5 -0
  137. package/src/plugin-mcp-dist/lib/upstream-socket.test.d.ts.map +1 -0
  138. package/src/plugin-mcp-dist/lib/upstream-socket.test.js +211 -0
  139. package/src/plugin-mcp-dist/lib/upstream-socket.test.js.map +1 -0
  140. package/src/plugin-mcp-dist/lib/utils.d.ts +2 -2
  141. package/src/plugin-mcp-dist/lib/utils.d.ts.map +1 -1
  142. package/src/plugin-mcp-dist/lib/utils.js +13 -9
  143. package/src/plugin-mcp-dist/lib/utils.js.map +1 -1
  144. package/src/react.tsx +7 -19
  145. package/src/styles/framer.css +34 -64
  146. package/src/version.ts +1 -1
  147. package/dist/framer-chunks/default-blog-sqlite-7ZHEY3GT-27R5KAAW.js +0 -9
  148. package/dist/framer-chunks/fontshare-4THNDPMZ-BJQGNHXN.js +0 -27099
  149. package/dist/framer-chunks/fontshare-B2QLD7YB-4BZEAA37.js +0 -119
  150. package/dist/framer-chunks/fontshare-O22OBJ3D-ALBQLFE5.js +0 -825
  151. package/dist/framer-chunks/framer-font-45AI7UCZ-LU7DEIDM.js +0 -7
  152. package/dist/framer-chunks/google-3FCAKCAC-P5EL6KGL.js +0 -623876
  153. package/dist/framer-chunks/google-3SZHWBC6-OBXS3UIH.js +0 -1627
  154. package/dist/framer-chunks/google-GXDJLGJB-HHIXFE4M.js +0 -6885
  155. package/dist/framer-chunks/sqlite-wasm-FGP37EAY-HR6PIAJQ.js +0 -11479
  156. package/dist/framer-chunks/sqlite3-SISQ6ENZ-KMXYXSSV.js +0 -9
  157. package/dist/generated/api-client.d.ts +0 -21
  158. package/dist/generated/api-client.d.ts.map +0 -1
  159. package/dist/generated/api-client.js +0 -27
  160. package/dist/generated/api-client.js.map +0 -1
  161. package/src/generated/api-client.d.ts +0 -1238
  162. package/src/generated/api-client.js +0 -26
package/src/exporter.ts CHANGED
@@ -8,8 +8,6 @@ const require = createRequire(import.meta.url)
8
8
 
9
9
  import { Sema } from 'async-sema'
10
10
 
11
- import { nodeModulesPolyfillPlugin } from 'esbuild-plugins-node-modules-polyfill'
12
-
13
11
  import { transform } from '@babel/core'
14
12
  import { exec } from 'child_process'
15
13
  import { error } from 'console'
@@ -19,6 +17,7 @@ import crypto from 'crypto'
19
17
  import { dedent } from './utils.js'
20
18
  import {
21
19
  babelPluginJsxTransform,
20
+ babelPluginSuppressHydration,
22
21
  removeJsxExpressionContainer,
23
22
  } from './babel-jsx.js'
24
23
  import { babelPluginTypedoc } from './babel-typedoc.js'
@@ -31,7 +30,7 @@ import {
31
30
  getFontsStyles,
32
31
  groupBy,
33
32
  logFontsUsage,
34
- } from './css.js'
33
+ } from './css-core.js'
35
34
  import {
36
35
  propControlsToTypedocComments,
37
36
  componentImportedName,
@@ -218,7 +217,6 @@ export async function bundle({
218
217
  missingPackages.add(pkg)
219
218
  },
220
219
  }),
221
- nodeModulesPolyfillPlugin({}),
222
220
  {
223
221
  name: 'virtual loader',
224
222
  setup(build) {
@@ -536,6 +534,15 @@ export async function bundle({
536
534
  name,
537
535
  typedocComments,
538
536
  }
537
+ } catch (e) {
538
+ const name = path
539
+ .relative(out, file.path)
540
+ .replace(/\.jsx?$/, '')
541
+ spinner.error(
542
+ `Failed to extract types for ${name}: ${e instanceof Error ? e.message : e}`,
543
+ )
544
+ logger.log(e instanceof Error ? e.stack : e)
545
+ return undefined
539
546
  } finally {
540
547
  sema.release()
541
548
  }
@@ -567,17 +574,28 @@ export async function bundle({
567
574
  ?.split('\n')
568
575
  .forEach((x) => logger.log(x))
569
576
 
577
+ function isChunkPath(filePath: string) {
578
+ return (
579
+ filePath.includes('/chunks/') ||
580
+ filePath.includes('\\chunks\\')
581
+ )
582
+ }
570
583
  const jsxFiles = buildResult.outputFiles
571
584
  .filter(
572
585
  (x) =>
573
586
  x.path.endsWith('.js') &&
587
+ !isChunkPath(x.path) &&
574
588
  fs.existsSync(getFilePaths(x.path, out).jsxPath),
575
589
  )
576
590
  .map((x) => getFilePaths(x.path, out).jsxPath)
577
591
  const outFiles = buildResult.outputFiles
578
592
  .map((x) => {
579
593
  const paths = getFilePaths(x.path, out)
580
- if (x.path.endsWith('.js') && fs.existsSync(paths.jsxPath)) {
594
+ if (
595
+ x.path.endsWith('.js') &&
596
+ !isChunkPath(x.path) &&
597
+ fs.existsSync(paths.jsxPath)
598
+ ) {
581
599
  return null // Will be handled by jsx files
582
600
  }
583
601
  return paths.finalJsPath
@@ -684,6 +702,7 @@ export async function bundle({
684
702
  try {
685
703
  const plugins = [
686
704
  // babelPluginDeduplicateImports,
705
+ babelPluginSuppressHydration,
687
706
  babelPluginJsxTransform,
688
707
  removeJsxExpressionContainer,
689
708
  ]
@@ -726,8 +745,17 @@ export async function bundle({
726
745
  formatted = result.content
727
746
  }
728
747
  } catch (e) {
748
+ spinner.warn(
749
+ `Babel/Biome formatting failed for ${componentName}: ${e instanceof Error ? e.message : e}`,
750
+ )
751
+ logger.log(e instanceof Error ? e.stack : e)
729
752
  notifyError(e, 'babel transform and format')
730
753
  }
754
+ } else if (tooBig) {
755
+ const sizeMB = (file.text.length / (1024 * 1024)).toFixed(2)
756
+ spinner.warn(
757
+ `Skipping JSX formatting for ${componentName} (${sizeMB} MB exceeds ${(tooBigSize / (1024 * 1024)).toFixed(2)} MB limit)`,
758
+ )
731
759
  }
732
760
 
733
761
  const prefix =
@@ -741,12 +769,24 @@ export async function bundle({
741
769
  // Always write the temp .js file for type extraction
742
770
  await fs.promises.writeFile(paths.tempJsPath, codeJs, 'utf-8')
743
771
 
744
- // Only write .jsx file if it's different from existing or if formatting was done
772
+ // Write .jsx file if formatting succeeded, or fall back to writing
773
+ // unformatted .js content into the .jsx path when formatting fails
774
+ // (babel error, component too big, etc.) but a stale .jsx already
775
+ // exists on disk. Without this fallback the stale .jsx keeps old
776
+ // chunk imports while the old chunks are deleted, breaking the build.
745
777
  if (didFormat && codeJsx !== existing) {
746
778
  await fs.promises.writeFile(paths.jsxPath, codeJsx, 'utf-8')
747
779
  logger.log(`Updated JSX file for ${componentName}`)
748
780
  } else if (didFormat) {
749
781
  logger.log(`JSX file unchanged for ${componentName}`)
782
+ } else if (existing && codeJs !== existing) {
783
+ // Formatting failed but .jsx exists with stale content (e.g.
784
+ // old chunk hashes). Overwrite with unformatted JS so imports
785
+ // stay in sync with the current build's chunks.
786
+ await fs.promises.writeFile(paths.jsxPath, codeJs, 'utf-8')
787
+ logger.log(
788
+ `Updated JSX file (unformatted) for ${componentName}`,
789
+ )
750
790
  }
751
791
  }
752
792
  spinner.stop()
@@ -761,8 +801,12 @@ export async function bundle({
761
801
  if (file.path.endsWith('.js')) {
762
802
  const paths = getFilePaths(file.path, out)
763
803
 
764
- if (fs.existsSync(paths.jsxPath)) {
804
+ if (
805
+ !isChunkPath(paths.tempJsPath) &&
806
+ fs.existsSync(paths.jsxPath)
807
+ ) {
765
808
  // Remove temp .js file if .jsx equivalent exists
809
+ // (never applies to chunks which stay as .js)
766
810
  logger.log(
767
811
  'removing temp JS file with JSX equivalent:',
768
812
  path.relative(out, paths.tempJsPath),
@@ -975,6 +1019,21 @@ export function getDarkModeSelector(opts: {
975
1019
  return '.dark {\n' + content + '\n' + '}'
976
1020
  }
977
1021
 
1022
+ // A CSS custom property value must not contain structural characters that would
1023
+ // terminate the declaration or the surrounding `:root {}` block. Framer color
1024
+ // styles can in rare cases carry malformed color strings (e.g. text scraped from
1025
+ // a code-highlighting component), and an unescaped `}` closes the block early.
1026
+ // The leaked text then becomes a top-level class rule like `.[-:=] { -: =; }`,
1027
+ // which browsers tolerate but lightningcss (Vite's css minifier) rejects with
1028
+ // "Expected identifier in class selector". Skip such tokens to keep styles.css
1029
+ // always minifiable. See the getStyleTokensCss regression test.
1030
+ function isSafeCssColorValue(value: string | null | undefined): value is string {
1031
+ if (typeof value !== 'string' || value === '') {
1032
+ return false
1033
+ }
1034
+ return !/[;{}\n\r]/.test(value)
1035
+ }
1036
+
978
1037
  export function getStyleTokensCss(
979
1038
  tokens: StyleToken[],
980
1039
  darkModeType: 'class' | 'media' = 'class',
@@ -983,12 +1042,34 @@ export function getStyleTokensCss(
983
1042
  return ''
984
1043
  }
985
1044
 
1045
+ // Drop tokens whose color values would produce invalid CSS. Both light and
1046
+ // dark colors must be safe, otherwise the token is skipped entirely so the
1047
+ // --unframer-* and --token-* variables never desync.
1048
+ const validTokens = tokens.filter((token) => {
1049
+ if (
1050
+ !isSafeCssColorValue(token.lightColor) ||
1051
+ !isSafeCssColorValue(token.darkColor)
1052
+ ) {
1053
+ logger.log(
1054
+ `Skipping style token ${JSON.stringify(
1055
+ token.name || token.id,
1056
+ )}: unsafe color value`,
1057
+ )
1058
+ return false
1059
+ }
1060
+ return true
1061
+ })
1062
+
1063
+ if (!validTokens.length) {
1064
+ return ''
1065
+ }
1066
+
986
1067
  // Deduplicate --unframer-* names: multiple Framer tokens can share the same
987
1068
  // user-facing name (e.g. two tokens both called "black" with different UUIDs).
988
1069
  // Keep only the first occurrence of each kebab-cased name to avoid silent
989
1070
  // CSS overwrites. The --token-{uuid} variables are always unique and unaffected.
990
1071
  const seenNames = new Set<string>()
991
- const deduplicatedTokens = tokens.filter((token) => {
1072
+ const deduplicatedTokens = validTokens.filter((token) => {
992
1073
  const name = kebabCase(token.name || token.id)
993
1074
  if (seenNames.has(name)) {
994
1075
  return false
@@ -1008,7 +1089,7 @@ export function getStyleTokensCss(
1008
1089
  )
1009
1090
  .join('\n')
1010
1091
 
1011
- const lightTokens = tokens
1092
+ const lightTokens = validTokens
1012
1093
  .map(
1013
1094
  (token) =>
1014
1095
  ' --token-' + token.id + ': ' + token.lightColor + ';',
@@ -1026,7 +1107,7 @@ export function getStyleTokensCss(
1026
1107
  )
1027
1108
  .join('\n')
1028
1109
 
1029
- const darkTokens = tokens
1110
+ const darkTokens = validTokens
1030
1111
  .map(
1031
1112
  (token) => ' --token-' + token.id + ': ' + token.darkColor + ';',
1032
1113
  )
@@ -1136,7 +1217,7 @@ export async function extractPropControlsUnsafe(
1136
1217
  }
1137
1218
 
1138
1219
  // console.log(stdout)
1139
- return safeJsonParse(stdout)
1220
+ return safeJsonParse(stdout) || {}
1140
1221
  }
1141
1222
 
1142
1223
  function safeJsonParse(text) {
package/src/framer.d.ts CHANGED
@@ -4859,4 +4859,132 @@ export declare const withVariantFX: <T extends MotionProps>(Component: React_2.C
4859
4859
  export { }
4860
4860
  export declare const combinedCSSRules: string[]
4861
4861
 
4862
+ export interface FramerMotionGlobalConfig {
4863
+ useManualTiming?: boolean
4864
+ instantAnimations?: boolean
4865
+ skipAnimations?: boolean
4866
+ mix?: unknown
4867
+ WillChange?: new (value: string) => unknown
4868
+ }
4869
+
4870
+ export interface FramerInjectedRuntimeImage {
4871
+ src?: string
4872
+ srcSet?: string
4873
+ }
4874
+
4875
+ export interface FramerInjectedRuntimeRect {
4876
+ width?: number
4877
+ height?: number
4878
+ }
4879
+
4880
+ export interface FramerInjectedRuntime {
4881
+ imagePlaceholderSvg?: string
4882
+ useImageSource?(image: FramerInjectedRuntimeImage, rect?: FramerInjectedRuntimeRect, nodeId?: string): string
4883
+ useImageElement?(image: FramerInjectedRuntimeImage, rect?: FramerInjectedRuntimeRect, nodeId?: string): HTMLImageElement
4884
+ canRenderOptimizedCanvasImage?(src?: string): boolean
4885
+ isOnPageCanvas?: boolean
4886
+ }
4887
+
4888
+ export interface FramerMotionFrameData {
4889
+ delta: number
4890
+ timestamp: number
4891
+ isProcessing: boolean
4892
+ }
4893
+
4894
+ export type FramerMotionFrameCallback = (frameData: FramerMotionFrameData) => void
4895
+
4896
+ export interface FramerMotionFrameStep {
4897
+ schedule(callback: FramerMotionFrameCallback, keepAlive?: boolean, immediate?: boolean): FramerMotionFrameCallback
4898
+ cancel(callback: FramerMotionFrameCallback): void
4899
+ process(frameData: FramerMotionFrameData): void
4900
+ }
4901
+
4902
+ export type FramerMotionFrameStepName =
4903
+ | 'setup'
4904
+ | 'read'
4905
+ | 'resolveKeyframes'
4906
+ | 'preUpdate'
4907
+ | 'update'
4908
+ | 'preRender'
4909
+ | 'render'
4910
+ | 'postRender'
4911
+
4912
+ export type FramerMotionFrameSteps = Record<FramerMotionFrameStepName, FramerMotionFrameStep>
4913
+
4914
+ export interface FramerMotionTime {
4915
+ now(): number
4916
+ set(newTime: number): void
4917
+ }
4918
+
4919
+ export interface FramerMotionGeneratorState<Value = unknown> {
4920
+ value: Value
4921
+ done?: boolean
4922
+ }
4923
+
4924
+ export interface FramerMotionGenerator<Value = unknown> {
4925
+ calculatedDuration?: number | null
4926
+ next(time: number): FramerMotionGeneratorState<Value>
4927
+ velocity?(time: number): number
4928
+ }
4929
+
4930
+ export interface FramerMotionAnimationDriver {
4931
+ now(): number
4932
+ start(autoplay?: boolean): void
4933
+ stop(): void
4934
+ }
4935
+
4936
+ export interface FramerMotionAnimationOptions<Value = unknown> {
4937
+ keyframes: Value[]
4938
+ autoplay?: boolean
4939
+ delay?: number
4940
+ repeat?: number
4941
+ repeatDelay?: number
4942
+ repeatType?: 'loop' | 'reverse' | 'mirror'
4943
+ velocity?: number
4944
+ finalKeyframe?: Value
4945
+ startTime?: number
4946
+ allowFlatten?: boolean
4947
+ motionValue?: { updatedAt?: number }
4948
+ type?: (options: FramerMotionAnimationOptions<Value>) => FramerMotionGenerator<Value>
4949
+ driver?: (update: (timestamp: number) => void) => FramerMotionAnimationDriver
4950
+ onUpdate?(latest: Value): void
4951
+ onPlay?(): void
4952
+ onComplete?(): void
4953
+ onCancel?(): void
4954
+ onStop?(): void
4955
+ }
4956
+
4957
+ export declare class JSAnimation<Value = unknown> implements PromiseLike<void> {
4958
+ constructor(options: FramerMotionAnimationOptions<Value>)
4959
+ options: FramerMotionAnimationOptions<Value>
4960
+ state: 'idle' | 'running' | 'paused' | 'finished'
4961
+ currentTime: number
4962
+ playbackSpeed: number
4963
+ readonly duration: number
4964
+ readonly iterationDuration: number
4965
+ time: number
4966
+ speed: number
4967
+ readonly finished: Promise<void>
4968
+ then<TResult1 = void, TResult2 = never>(
4969
+ onfulfilled?: ((value: void) => TResult1 | PromiseLike<TResult1>) | null,
4970
+ onrejected?: ((reason: Error) => TResult2 | PromiseLike<TResult2>) | null,
4971
+ ): Promise<TResult1 | TResult2>
4972
+ play(): void
4973
+ pause(): void
4974
+ complete(): void
4975
+ finish(): void
4976
+ cancel(): void
4977
+ stop(): void
4978
+ tick(timestamp: number, sample?: boolean): FramerMotionGeneratorState<Value>
4979
+ sample(sampleTime: number): FramerMotionGeneratorState<Value>
4980
+ attachTimeline(timeline: { observe(animation: JSAnimation<Value>): VoidFunction }): VoidFunction
4981
+ }
4982
+
4983
+ export declare const MotionGlobalConfig: FramerMotionGlobalConfig
4984
+ export declare const frameData: FramerMotionFrameData
4985
+ export declare const frameSteps: FramerMotionFrameSteps
4986
+ export declare const time: FramerMotionTime
4987
+ export declare const visualElementStore: WeakMap<object, unknown>
4988
+ export declare function _injectRuntime(injectedRuntime: FramerInjectedRuntime): void
4989
+
4862
4990
  export * from 'real-framer-motion'