unframer 2.7.11 → 2.9.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 (58) hide show
  1. package/dist/cli.d.ts +10 -0
  2. package/dist/cli.d.ts.map +1 -1
  3. package/dist/cli.js +10 -4
  4. package/dist/cli.js.map +1 -1
  5. package/dist/cli.test.js +8 -0
  6. package/dist/cli.test.js.map +1 -1
  7. package/dist/exporter.d.ts +5 -1
  8. package/dist/exporter.d.ts.map +1 -1
  9. package/dist/exporter.js +75 -14
  10. package/dist/exporter.js.map +1 -1
  11. package/dist/framer.d.ts.map +1 -1
  12. package/dist/framer.js +116 -92
  13. package/dist/framer.js.map +1 -1
  14. package/dist/index.d.ts +1 -1
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +2 -1
  17. package/dist/index.js.map +1 -1
  18. package/dist/react.d.ts +10 -0
  19. package/dist/react.d.ts.map +1 -1
  20. package/dist/react.js +7 -0
  21. package/dist/react.js.map +1 -1
  22. package/dist/utils.d.ts +1 -0
  23. package/dist/utils.d.ts.map +1 -1
  24. package/dist/utils.js +9 -0
  25. package/dist/utils.js.map +1 -1
  26. package/esm/cli.d.ts +10 -0
  27. package/esm/cli.d.ts.map +1 -1
  28. package/esm/cli.js +11 -5
  29. package/esm/cli.js.map +1 -1
  30. package/esm/cli.test.js +9 -1
  31. package/esm/cli.test.js.map +1 -1
  32. package/esm/exporter.d.ts +5 -1
  33. package/esm/exporter.d.ts.map +1 -1
  34. package/esm/exporter.js +75 -14
  35. package/esm/exporter.js.map +1 -1
  36. package/esm/framer.d.ts.map +1 -1
  37. package/esm/framer.js +113 -92
  38. package/esm/framer.js.map +1 -1
  39. package/esm/index.d.ts +1 -1
  40. package/esm/index.d.ts.map +1 -1
  41. package/esm/index.js +1 -1
  42. package/esm/index.js.map +1 -1
  43. package/esm/react.d.ts +10 -0
  44. package/esm/react.d.ts.map +1 -1
  45. package/esm/react.js +14 -0
  46. package/esm/react.js.map +1 -1
  47. package/esm/utils.d.ts +1 -0
  48. package/esm/utils.d.ts.map +1 -1
  49. package/esm/utils.js +8 -0
  50. package/esm/utils.js.map +1 -1
  51. package/package.json +7 -4
  52. package/src/cli.test.ts +20 -3
  53. package/src/cli.tsx +25 -5
  54. package/src/exporter.ts +94 -18
  55. package/src/framer.js +122 -93
  56. package/src/index.ts +1 -1
  57. package/src/react.tsx +46 -1
  58. package/src/utils.ts +9 -0
package/src/react.tsx CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client'
2
- import { combinedCSSRules, LayoutGroup } from './framer.js'
2
+ import { combinedCSSRules, LayoutGroup, MotionConfig } from './framer.js'
3
3
 
4
4
  import {
5
5
  ComponentPropsWithoutRef,
@@ -192,3 +192,48 @@ const onResize = (callback) => {
192
192
  window.addEventListener('resize', callback)
193
193
  return () => window.removeEventListener('resize', callback)
194
194
  }
195
+
196
+ import {
197
+ // @ts-ignore
198
+ CustomCursorHost,
199
+ // @ts-ignore
200
+ FetchClientProvider,
201
+ // @ts-ignore
202
+ FormContext,
203
+ // @ts-ignore
204
+ Router,
205
+ } from './framer.js'
206
+
207
+ export function ContextProviders({
208
+ locale,
209
+ children,
210
+ framerSiteId,
211
+ routes,
212
+ routeId,
213
+ pathVariables,
214
+ collectionUtils,
215
+ locales,
216
+ }) {
217
+ const localeId = locales?.find(
218
+ (l) => l.slug === locale || l.code === locale || l.id === locale,
219
+ )?.id
220
+ return (
221
+ <FetchClientProvider>
222
+ <CustomCursorHost>
223
+ <FormContext.Provider value={framerSiteId}>
224
+ <Router
225
+ initialRoute={routeId}
226
+ initialPathVariables={pathVariables}
227
+ initialLocaleId={localeId}
228
+ enableImproveInpDuringHydration={true}
229
+ routes={routes}
230
+ collectionUtils={collectionUtils}
231
+ locales={locales}
232
+ >
233
+ {children}
234
+ </Router>
235
+ </FormContext.Provider>
236
+ </CustomCursorHost>
237
+ </FetchClientProvider>
238
+ )
239
+ }
package/src/utils.ts CHANGED
@@ -3,6 +3,7 @@ import pico from 'picocolors'
3
3
  import { marked } from 'marked'
4
4
  import { markedTerminal } from 'marked-terminal'
5
5
  import { createSpinner } from 'nanospinner'
6
+ import kebabCase from 'just-kebab-case'
6
7
 
7
8
  export const spinner = createSpinner('Downloading Framer Components') as any
8
9
 
@@ -29,3 +30,11 @@ export const logger = {
29
30
  console.error([prefix, ...args].map((x) => pico.red(x)).join(' '))
30
31
  },
31
32
  }
33
+
34
+ export function componentNameToPath(name: string) {
35
+ return name
36
+ .split('/')
37
+ .filter(Boolean)
38
+ .map((part) => kebabCase(part))
39
+ .join('/')
40
+ }