unframer 2.7.8 → 2.7.10

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unframer",
3
- "version": "2.7.8",
3
+ "version": "2.7.10",
4
4
  "description": "Import Framer components directly in your React app, type safe and customizable",
5
5
  "sideEffects": false,
6
6
  "repository": "https://github.com/remorses/unframer",
package/src/cli.tsx CHANGED
@@ -7,7 +7,7 @@ import findUp from 'find-up'
7
7
  import fs from 'fs-extra'
8
8
  import path, { basename } from 'path'
9
9
  import { BreakpointSizes } from './css.js'
10
- import { logger } from './utils.js'
10
+ import { logger, spinner } from './utils.js'
11
11
  const configNames = ['unframer.config.json', 'unframer.json']
12
12
  import kebabCase from 'just-kebab-case'
13
13
 
@@ -34,6 +34,10 @@ cli.command('[projectId]', 'Run unframer with optional project ID')
34
34
  }
35
35
  const data = await response.json()
36
36
  logger.log('unframer data', data)
37
+ const projectName = data?.project?.projectName ||''
38
+ if (projectName) {
39
+ spinner.info(`Using project: ${projectName}`)
40
+ }
37
41
  let cwd = path.resolve(process.cwd(), outDir || 'framer')
38
42
  return await bundle({
39
43
  config: {
package/src/exporter.ts CHANGED
@@ -441,9 +441,7 @@ export async function bundle({
441
441
  />
442
442
  ${responsiveComponent
443
443
  .split('\n')
444
- .map((line, i) =>
445
- !i ? line : ' ' + line,
446
- )
444
+ .map((line, i) => (!i ? line : ' ' + line))
447
445
  .join('\n')}
448
446
  </div>
449
447
  );
@@ -731,12 +729,15 @@ export async function extractPropControlsUnsafe(
731
729
  unframer: url.pathToFileURL(require.resolve('../esm/index.js')).href,
732
730
  react: url.pathToFileURL(require.resolve('react')).href,
733
731
  'react-dom': url.pathToFileURL(require.resolve('react-dom')).href,
732
+ 'react/jsx-runtime': url.pathToFileURL(
733
+ require.resolve('react/jsx-runtime'),
734
+ ).href,
734
735
  })
735
736
  let stdout = await new Promise<string>((res, rej) => {
736
737
  let childProcess = exec(
737
738
  `${JSON.stringify(
738
739
  nodePath,
739
- )} --input-type=module --loader ${require.resolve(
740
+ )} --no-warnings --input-type=module --loader ${require.resolve(
740
741
  '../dist/unframer-loader.js',
741
742
  )} -e ${JSON.stringify(code)}`,
742
743
  {
package/src/framer.js CHANGED
@@ -15349,7 +15349,7 @@ function steps(numSteps, direction = 'end',) {
15349
15349
  };
15350
15350
  }
15351
15351
 
15352
- // https :https://app.framerstatic.com/framer.NFOIY3CW.mjs
15352
+ // https :https://app.framerstatic.com/framer.ZONHQAMM.mjs
15353
15353
  init_chunk_QLPHEVXG();
15354
15354
  import React4 from 'react';
15355
15355
  import { startTransition as startTransition2, } from 'react';
@@ -18214,6 +18214,7 @@ function useMarkRouterEffects() {
18214
18214
  var hydrationInsertionEffectStartHasRun = false;
18215
18215
  var hydrationLayoutEffectStartHasRun = false;
18216
18216
  var hydrationEffectStartHasRun = false;
18217
+ var wasInBackground = false;
18217
18218
  function useMarkSuspenseEffectsStart() {
18218
18219
  const hydrationMarkPrefix = 'framer-hydration-';
18219
18220
  const hydrationLayoutEffectsEnd = `${hydrationMarkPrefix}layout-effects-end`;
@@ -18231,6 +18232,10 @@ function useMarkSuspenseEffectsStart() {
18231
18232
  if (hydrationLayoutEffectStartHasRun || !shouldMark) return;
18232
18233
  hydrationLayoutEffectStartHasRun = true;
18233
18234
  performance.mark(`${hydrationMarkPrefix}layout-effects-start`,);
18235
+ if (document.visibilityState !== 'visible') {
18236
+ wasInBackground = true;
18237
+ return;
18238
+ }
18234
18239
  requestAnimationFrame(() => {
18235
18240
  var _a, _b, _c;
18236
18241
  performance.mark(hydrationBrowserRenderStart,);
@@ -18265,7 +18270,6 @@ function useMarkSuspenseEffectsStart() {
18265
18270
  var hydrationInsertionEffectHasRun = false;
18266
18271
  var hydrationLayoutEffectHasRun = false;
18267
18272
  var hydrationEffectHasRun = false;
18268
- var hydrationPaintEffectHasRun = false;
18269
18273
  function useMarkSuspenseEffectEnd() {
18270
18274
  const hydrationMarkPrefix = 'framer-hydration-';
18271
18275
  const hydrationLayoutEffectsEnd = `${hydrationMarkPrefix}layout-effects-end`;
@@ -18286,9 +18290,15 @@ function useMarkSuspenseEffectEnd() {
18286
18290
  hydrationLayoutEffectHasRun = true;
18287
18291
  performance.mark(hydrationLayoutEffectsEnd,);
18288
18292
  measureSafe(`${hydrationMarkPrefix}layout-effects`, `${hydrationMarkPrefix}layout-effects-start`, hydrationLayoutEffectsEnd,);
18293
+ if (wasInBackground || document.visibilityState !== 'visible') return;
18289
18294
  requestAnimationFrame(() => {
18290
18295
  performance.mark(hydrationAnimationFrameEnd,);
18291
18296
  measureSafe(`${hydrationMarkPrefix}raf`, hydrationBrowserRenderStart, hydrationAnimationFrameEnd,);
18297
+ void yieldBefore(() => {
18298
+ performance.mark(hydrationFP,);
18299
+ measureSafe(`${hydrationMarkPrefix}time-to-first-paint`, hydrationStart, hydrationFP,);
18300
+ measureSafe(`${hydrationMarkPrefix}browser-render`, hydrationAnimationFrameEnd, hydrationFP,);
18301
+ },);
18292
18302
  },);
18293
18303
  }, [],);
18294
18304
  useEffect(() => {
@@ -18306,22 +18316,6 @@ function useMarkSuspenseEffectEnd() {
18306
18316
  hydrationEffectsEnd,
18307
18317
  );
18308
18318
  }, [],);
18309
- useAfterPaintEffect(
18310
- () => {
18311
- if (hydrationPaintEffectHasRun || !shouldMark) return;
18312
- hydrationPaintEffectHasRun = true;
18313
- performance.mark(hydrationFP,);
18314
- measureSafe(`${hydrationMarkPrefix}time-to-first-paint`, hydrationStart, hydrationFP,);
18315
- queueMicrotask(() => {
18316
- measureSafe(`${hydrationMarkPrefix}browser-render`, hydrationAnimationFrameEnd, hydrationFP,);
18317
- },);
18318
- },
18319
- [],
18320
- // user-blocking ensures we get the correct timings here. Other priorites might delay this effect a little bit.
18321
- {
18322
- priority: 'user-blocking',
18323
- },
18324
- );
18325
18319
  return null;
18326
18320
  }
18327
18321
  function MarkSuspenseEffectsStart() {
@@ -37511,20 +37505,17 @@ var NestedLinksCollector = class {
37511
37505
  this.links.clear();
37512
37506
  }
37513
37507
  getLinks() {
37514
- return [...this.links.values(),];
37508
+ return this.links;
37515
37509
  }
37516
- addLink(parentLink, linkData,) {
37517
- if (typeof window !== 'undefined' && true || !parentLink || !linkData) {
37510
+ addLink(parentLinkNodeId, linkNodeId,) {
37511
+ if (typeof window !== 'undefined' && true || !parentLinkNodeId || !linkNodeId) {
37518
37512
  return;
37519
37513
  }
37520
- if (!this.links.has(parentLink.nodeId,)) {
37521
- this.links.set(parentLink.nodeId, {
37522
- parent: parentLink,
37523
- links: [],
37524
- },);
37514
+ if (!this.links.has(parentLinkNodeId,)) {
37515
+ this.links.set(parentLinkNodeId, /* @__PURE__ */ new Set(),);
37525
37516
  }
37526
- const entry = this.links.get(parentLink.nodeId,);
37527
- entry.links.push(linkData,);
37517
+ const entry = this.links.get(parentLinkNodeId,);
37518
+ entry.add(linkNodeId,);
37528
37519
  }
37529
37520
  };
37530
37521
  var nestedLinksCollector = /* @__PURE__ */ new NestedLinksCollector();
@@ -38022,20 +38013,18 @@ var Link = /* @__PURE__ */ withChildrenCanSuspend(/* @__PURE__ */ forwardRef(({
38022
38013
  if (node === null) return;
38023
38014
  return observerCallback(node,);
38024
38015
  }, [observerCallback,],);
38025
- const el = useMemo(() => {
38026
- const {
38027
- navigate: _,
38028
- ...linkProps
38029
- } = props;
38030
- return clone.cloneAsArray(children, {
38031
- ...restProps,
38032
- ...linkProps,
38033
- ref: observerRef,
38034
- },);
38035
- }, [props, clone, children, restProps, observerRef,],);
38016
+ const {
38017
+ navigate: _,
38018
+ ...linkProps
38019
+ } = props;
38020
+ const el = clone.cloneAsArray(children, {
38021
+ ...restProps,
38022
+ ...linkProps,
38023
+ ref: observerRef,
38024
+ },);
38036
38025
  return getChildren(el,);
38037
38026
  },),);
38038
- var ParentLinkContext = /* @__PURE__ */ createContext(null,);
38027
+ var ParentLinkContext = /* @__PURE__ */ createContext(void 0,);
38039
38028
  function useReplaceNestedLinks(nodeId, href, propsAddedByLink,) {
38040
38029
  const parentLink = useContext(ParentLinkContext,);
38041
38030
  const isOnFramerCanvas = useIsOnFramerCanvas();
@@ -38049,30 +38038,6 @@ function useReplaceNestedLinks(nodeId, href, propsAddedByLink,) {
38049
38038
  if (!pageLink) return;
38050
38039
  return getRouteFromPageLink(pageLink, router, currentRoute,);
38051
38040
  }, [currentRoute, href, router,],);
38052
- const linkData = useMemo(() => {
38053
- if (!nodeId || !href) return null;
38054
- if (isLinkToWebPage(href,)) {
38055
- return {
38056
- nodeId,
38057
- targetNodeId: href.webPageId,
38058
- href: propsAddedByLink.href,
38059
- };
38060
- }
38061
- if (route && href.startsWith('#',)) {
38062
- const routeNodeId = Object.keys(route.elements ?? {},)[0];
38063
- if (routeNodeId) {
38064
- return {
38065
- nodeId,
38066
- targetNodeId: routeNodeId,
38067
- href,
38068
- };
38069
- }
38070
- }
38071
- return {
38072
- nodeId,
38073
- href,
38074
- };
38075
- }, [href, nodeId, propsAddedByLink, route,],);
38076
38041
  const isValidLink = Object.keys(propsAddedByLink,).length > 0;
38077
38042
  const shouldReplaceLink = Boolean(replaceNestedLinks && !isOnFramerCanvas && (parentLink || !isValidLink),);
38078
38043
  const onClick = useCallback((event) => {
@@ -38121,7 +38086,7 @@ function useReplaceNestedLinks(nodeId, href, propsAddedByLink,) {
38121
38086
  };
38122
38087
  const replacedChildren = !shouldReplaceLink ? children : Children.map(children, (child) => {
38123
38088
  if (!isChildReplaceable(child,)) return child;
38124
- nestedLinksCollector.addLink(parentLink, linkData,);
38089
+ nestedLinksCollector.addLink(parentLink, nodeId,);
38125
38090
  const tag = maybeReplaceAnchorWithSpan(child.type,);
38126
38091
  const {
38127
38092
  children: childChildren,
@@ -38142,10 +38107,10 @@ function useReplaceNestedLinks(nodeId, href, propsAddedByLink,) {
38142
38107
  }, childChildren,);
38143
38108
  },);
38144
38109
  return /* @__PURE__ */ jsx(ParentLinkContext.Provider, {
38145
- value: linkData,
38110
+ value: nodeId,
38146
38111
  children: replacedChildren,
38147
38112
  },);
38148
- }, [isValidLink, linkData, onAuxClick, onClick, onKeyDown, shouldReplaceLink, parentLink,],);
38113
+ }, [isValidLink, nodeId, onAuxClick, onClick, onKeyDown, shouldReplaceLink, parentLink,],);
38149
38114
  const refCallback = useCallback((node) => {
38150
38115
  if (isOnFramerCanvas || !shouldReplaceLink || !isValidLink) return;
38151
38116
  node.dataset.hydrated = 'true';
@@ -40854,6 +40819,7 @@ var Builder = class {
40854
40819
  fromScope.setNode(node,);
40855
40820
  }
40856
40821
  const orderProjections = [];
40822
+ const orderFields = new Fields();
40857
40823
  let ordering;
40858
40824
  if (select.orderBy) {
40859
40825
  ordering = new Ordering();
@@ -40861,6 +40827,7 @@ var Builder = class {
40861
40827
  if (order.type === 'Identifier') {
40862
40828
  const scopeField = fromScope.resolveField(order.name, order.collection,);
40863
40829
  if (isUndefined(scopeField,)) continue;
40830
+ orderFields.add(scopeField.field,);
40864
40831
  const orderingField = new OrderingField(scopeField.field, order.direction,);
40865
40832
  ordering.push(orderingField,);
40866
40833
  } else {
@@ -40877,7 +40844,7 @@ var Builder = class {
40877
40844
  } else {
40878
40845
  ordering = defaultOrdering;
40879
40846
  }
40880
- const projectionScope = this.buildSelectList(fromScope, select.select, orderProjections,);
40847
+ const projectionScope = this.buildSelectList(fromScope, select.select, orderFields, orderProjections,);
40881
40848
  projectionScope.setOrdering(ordering,);
40882
40849
  if (select.offset) {
40883
40850
  const input = projectionScope.takeNode();
@@ -40893,9 +40860,9 @@ var Builder = class {
40893
40860
  }
40894
40861
  return projectionScope;
40895
40862
  }
40896
- buildSelectList(inScope, selects, orderProjections,) {
40863
+ buildSelectList(inScope, selects, orderFields, orderProjections,) {
40897
40864
  const outScope = inScope.push();
40898
- const passthrough = new Fields();
40865
+ const passthrough = new Fields(orderFields,);
40899
40866
  const projections = [...orderProjections,];
40900
40867
  for (const select of selects) {
40901
40868
  if (select.type === 'Identifier') {