fontdue-js 3.0.0-alpha3 → 3.0.0-alpha5
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/README.md +463 -94
- package/dist/__generated__/ServerConfigProviderQuery.graphql.js +8 -1
- package/dist/__generated__/TestModeBannerQuery.graphql.js +8 -1
- package/dist/__generated__/ThemeConfigQuery.graphql.js +8 -1
- package/dist/__tests__/licenseExclusions.test.js +161 -0
- package/dist/components/BuyButton/index.d.ts +2 -2
- package/dist/components/BuyButton/index.js +3 -3
- package/dist/components/BuyButton/index.server.d.ts +2 -0
- package/dist/components/BuyButton/index.server.js +5 -0
- package/dist/components/BuyingOptions/index.d.ts +9 -0
- package/dist/components/CartButton/index.d.ts +1 -11
- package/dist/components/CartButton/index.js +9 -29
- package/dist/components/CartButton/index.server.d.ts +1 -1
- package/dist/components/CartButton/index.server.js +14 -12
- package/dist/components/CharacterViewer/index.d.ts +2 -2
- package/dist/components/CharacterViewer/index.js +3 -3
- package/dist/components/CharacterViewer/index.server.d.ts +2 -0
- package/dist/components/CharacterViewer/index.server.js +5 -0
- package/dist/components/CookieNotification/index.d.ts +13 -0
- package/dist/components/CookieNotification/index.js +4 -4
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.d.ts +4 -6
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.js +39 -48
- package/dist/components/FontdueProvider/index.d.ts +1 -0
- package/dist/components/FontdueProvider/index.js +1 -0
- package/dist/components/FontdueProvider/index.server.d.ts +2 -0
- package/dist/components/FontdueProvider/index.server.js +12 -4
- package/dist/components/NewsletterSignup/index.d.ts +2 -2
- package/dist/components/NewsletterSignup/index.js +2 -2
- package/dist/components/NewsletterSignup/index.server.d.ts +2 -0
- package/dist/components/NewsletterSignup/index.server.js +5 -0
- package/dist/components/TestFontsForm/index.d.ts +2 -2
- package/dist/components/TestFontsForm/index.js +2 -2
- package/dist/components/TestFontsForm/index.server.d.ts +2 -0
- package/dist/components/TestFontsForm/index.server.js +5 -0
- package/dist/components/ThemeConfig/index.server.js +14 -7
- package/dist/components/TypeTester/TypeTesterStandalone.d.ts +2 -2
- package/dist/components/TypeTester/TypeTesterStandalone.js +2 -2
- package/dist/components/TypeTester/TypeTesterStandalone.server.d.ts +2 -0
- package/dist/components/TypeTester/TypeTesterStandalone.server.js +5 -0
- package/dist/components/TypeTesters/index.d.ts +2 -2
- package/dist/components/TypeTesters/index.js +3 -3
- package/dist/components/TypeTesters/index.server.d.ts +2 -0
- package/dist/components/TypeTesters/index.server.js +5 -0
- package/dist/fontdue.css +12 -12
- package/dist/loadFontdueProviderQuery.d.ts +1 -2
- package/dist/loadFontdueProviderQuery.js +2 -2
- package/dist/relay/environment.js +1 -1
- package/dist/relay/loadSerializableQuery.d.ts +1 -5
- package/dist/relay/loadSerializableQuery.js +2 -2
- package/dist/vite.js +42 -2
- package/package.json +3 -8
|
@@ -1,69 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
'use client';
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return ref.current;
|
|
26
|
-
}
|
|
27
|
-
if (clientStore == null) clientStore = createDefaultStore(config);
|
|
28
|
-
return clientStore;
|
|
29
|
-
}
|
|
30
|
-
const ConsentBanner = /*#__PURE__*/lazy(() => retryImport(() => import('../ConsentBanner/index.js')));
|
|
31
|
-
const Tracking = /*#__PURE__*/lazy(() => retryImport(() => import('../Tracking/index.js')));
|
|
32
|
-
const ServerConfigProvider = /*#__PURE__*/lazy(() => retryImport(() => import('../ServerConfigProvider/index.js')));
|
|
33
|
-
export default function FontdueProviderClientComponent(_ref) {
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = FontdueProviderClientComponent;
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _reactErrorBoundary = require("react-error-boundary");
|
|
10
|
+
var _reactRedux = require("react-redux");
|
|
11
|
+
var _reactRelay = require("react-relay");
|
|
12
|
+
var _environment = require("../../relay/environment");
|
|
13
|
+
var _ConfigContext = _interopRequireWildcard(require("../ConfigContext"));
|
|
14
|
+
var _reducer = require("../../reducer");
|
|
15
|
+
var _ComponentsContext = _interopRequireDefault(require("../ComponentsContext"));
|
|
16
|
+
var _UrlContext = _interopRequireDefault(require("../UrlContext"));
|
|
17
|
+
var _retryImport = _interopRequireDefault(require("../../retryImport"));
|
|
18
|
+
var _corsError = require("../../corsError");
|
|
19
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
const ConsentBanner = /*#__PURE__*/(0, _react.lazy)(() => (0, _retryImport.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require('../ConsentBanner')))));
|
|
23
|
+
const Tracking = /*#__PURE__*/(0, _react.lazy)(() => (0, _retryImport.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require('../Tracking')))));
|
|
24
|
+
const ServerConfigProvider = /*#__PURE__*/(0, _react.lazy)(() => (0, _retryImport.default)(() => Promise.resolve().then(() => _interopRequireWildcard(require('../ServerConfigProvider')))));
|
|
25
|
+
function FontdueProviderClientComponent(_ref) {
|
|
34
26
|
let {
|
|
35
27
|
children,
|
|
36
28
|
url,
|
|
37
29
|
stripeIntegration,
|
|
38
30
|
config,
|
|
39
31
|
components,
|
|
40
|
-
store
|
|
41
|
-
renderAuxUI
|
|
32
|
+
store
|
|
42
33
|
} = _ref;
|
|
43
|
-
const environment = useCurrentEnvironment({
|
|
34
|
+
const environment = (0, _environment.useCurrentEnvironment)({
|
|
44
35
|
url,
|
|
45
36
|
stripeIntegration
|
|
46
37
|
});
|
|
47
|
-
const configValue = makeConfig(config);
|
|
48
|
-
setCorsModalEnabled(configValue.corsErrorModal);
|
|
49
|
-
const
|
|
50
|
-
return /*#__PURE__*/
|
|
38
|
+
const configValue = (0, _ConfigContext.makeConfig)(config);
|
|
39
|
+
(0, _corsError.setCorsModalEnabled)(configValue.corsErrorModal);
|
|
40
|
+
const storeRef = (0, _react.useRef)(store ?? (0, _reducer.createDefaultStore)(config));
|
|
41
|
+
return /*#__PURE__*/_react.default.createElement(_reactRelay.RelayEnvironmentProvider, {
|
|
51
42
|
environment: environment
|
|
52
|
-
}, /*#__PURE__*/
|
|
53
|
-
store:
|
|
54
|
-
}, /*#__PURE__*/
|
|
43
|
+
}, /*#__PURE__*/_react.default.createElement(_reactRedux.Provider, {
|
|
44
|
+
store: storeRef.current
|
|
45
|
+
}, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
55
46
|
fallback: null
|
|
56
|
-
}, /*#__PURE__*/
|
|
47
|
+
}, /*#__PURE__*/_react.default.createElement(_ConfigContext.default.Provider, {
|
|
57
48
|
value: configValue
|
|
58
|
-
}, /*#__PURE__*/
|
|
49
|
+
}, /*#__PURE__*/_react.default.createElement(_UrlContext.default.Provider, {
|
|
59
50
|
value: url ?? (typeof process !== 'undefined' ? process.env.NEXT_PUBLIC_FONTDUE_URL : undefined) ?? ''
|
|
60
|
-
}, /*#__PURE__*/
|
|
51
|
+
}, /*#__PURE__*/_react.default.createElement(_ComponentsContext.default.Provider, {
|
|
61
52
|
value: components ?? {}
|
|
62
|
-
}, children,
|
|
53
|
+
}, children, /*#__PURE__*/_react.default.createElement(_reactErrorBoundary.ErrorBoundary, {
|
|
63
54
|
fallback: null
|
|
64
|
-
}, /*#__PURE__*/
|
|
55
|
+
}, /*#__PURE__*/_react.default.createElement(_react.Suspense, {
|
|
65
56
|
fallback: null
|
|
66
|
-
}, /*#__PURE__*/
|
|
57
|
+
}, /*#__PURE__*/_react.default.createElement(ServerConfigProvider, {
|
|
67
58
|
codeConfig: config
|
|
68
|
-
}, /*#__PURE__*/
|
|
59
|
+
}, /*#__PURE__*/_react.default.createElement(ConsentBanner, null), /*#__PURE__*/_react.default.createElement(Tracking, null))))))))));
|
|
69
60
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export { default as loadFontdueProviderQuery } from '../../loadFontdueProviderQuery.js';
|
|
2
3
|
import type { FontdueContextProvider_props } from '../FontdueContextProvider/index.js';
|
|
3
4
|
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
4
5
|
import { FontdueProviderQuery } from '../../__generated__/FontdueProviderQuery.graphql.js';
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _FontdueProviderQuery from "../../__generated__/FontdueProviderQuery.graphql.js";
|
|
4
4
|
import React, { Suspense, lazy } from 'react';
|
|
5
|
+
export { default as loadFontdueProviderQuery } from '../../loadFontdueProviderQuery.js';
|
|
5
6
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
6
7
|
import { graphql, useLazyLoadQuery, usePreloadedQuery } from 'react-relay';
|
|
7
8
|
import TestModeBanner from '../TestModeBanner/index.js';
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { FontdueProvider_props } from './index.js';
|
|
3
3
|
export type { FontdueProvider_props } from './index.js';
|
|
4
|
+
export type { FontdueProviderPreloadedQuery } from '../../loadFontdueProviderQuery.js';
|
|
5
|
+
export declare function loadFontdueProviderQuery(): never;
|
|
4
6
|
export default function FontdueProviderServer({ preloadedQuery, ...rest }: FontdueProvider_props): Promise<React.JSX.Element>;
|
|
@@ -1,7 +1,17 @@
|
|
|
1
1
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import FontdueProvider from './index.js';
|
|
4
|
-
import
|
|
4
|
+
import loadFontdueProviderQueryImpl from '../../loadFontdueProviderQuery.js';
|
|
5
|
+
// Stub for the RSC export condition. The default `<FontdueProvider>` server
|
|
6
|
+
// entrypoint (this file) awaits the query for consumers, so RSC users should
|
|
7
|
+
// never call it manually. Re-exporting a throwing stub makes the mistake
|
|
8
|
+
// obvious — without it, importing `loadFontdueProviderQuery` from
|
|
9
|
+
// `'fontdue-js/FontdueProvider'` in a server component would fail at build
|
|
10
|
+
// time with the unhelpful `Named export 'loadFontdueProviderQuery' not found`.
|
|
11
|
+
export function loadFontdueProviderQuery() {
|
|
12
|
+
throw new Error("loadFontdueProviderQuery isn't needed in React Server Components — " + 'the <FontdueProvider> server entrypoint awaits its query automatically. ' + 'Drop the manual call.');
|
|
13
|
+
}
|
|
14
|
+
|
|
5
15
|
// RSC entry. When no preloadedQuery is passed, fetch one server-side so the
|
|
6
16
|
// Next.js App Router path stays "drop the provider in your layout, done."
|
|
7
17
|
export default async function FontdueProviderServer(_ref) {
|
|
@@ -9,9 +19,7 @@ export default async function FontdueProviderServer(_ref) {
|
|
|
9
19
|
preloadedQuery,
|
|
10
20
|
...rest
|
|
11
21
|
} = _ref;
|
|
12
|
-
const resolved = preloadedQuery ?? (await
|
|
13
|
-
url: rest.url
|
|
14
|
-
}));
|
|
22
|
+
const resolved = preloadedQuery ?? (await loadFontdueProviderQueryImpl());
|
|
15
23
|
return /*#__PURE__*/React.createElement(FontdueProvider, _extends({}, rest, {
|
|
16
24
|
preloadedQuery: resolved
|
|
17
25
|
}));
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
3
3
|
import { NewsletterSignupQuery } from '../../__generated__/NewsletterSignupQuery.graphql.js';
|
|
4
4
|
export type NewsletterSignupPreloadedQuery = SerializablePreloadedQuery<NewsletterSignupQuery>;
|
|
5
|
-
export declare function loadNewsletterSignupQuery(
|
|
5
|
+
export declare function loadNewsletterSignupQuery(): Promise<NewsletterSignupPreloadedQuery>;
|
|
6
6
|
export interface NewsletterSignup_props {
|
|
7
7
|
optInLabel?: string;
|
|
8
8
|
successLabel?: string;
|
|
@@ -13,8 +13,8 @@ import useSerializablePreloadedQuery from '../../relay/useSerializablePreloadedQ
|
|
|
13
13
|
import NewsletterSignupQueryNode from '../../__generated__/NewsletterSignupQuery.graphql.js';
|
|
14
14
|
import { EnsureFontdueContext } from '../FontdueContextProvider/index.js';
|
|
15
15
|
const updateCustomerMutation = (_NewsletterSignupUpdateCustomerMutation.hash && _NewsletterSignupUpdateCustomerMutation.hash !== "769087891b6f263122bbb630b3f2ca6c" && console.error("The definition of 'NewsletterSignupUpdateCustomerMutation' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _NewsletterSignupUpdateCustomerMutation);
|
|
16
|
-
export async function loadNewsletterSignupQuery(
|
|
17
|
-
return loadSerializableQuery(NewsletterSignupQueryNode, {}
|
|
16
|
+
export async function loadNewsletterSignupQuery() {
|
|
17
|
+
return loadSerializableQuery(NewsletterSignupQueryNode, {});
|
|
18
18
|
}
|
|
19
19
|
const query = (_NewsletterSignupQuery.hash && _NewsletterSignupQuery.hash !== "24b303198a6038318723fc0124548862" && console.error("The definition of 'NewsletterSignupQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _NewsletterSignupQuery);
|
|
20
20
|
function NewsletterSignupComponent(_ref) {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { NewsletterSignup_props } from './index.js';
|
|
3
|
+
export type { NewsletterSignupPreloadedQuery } from './index.js';
|
|
4
|
+
export declare function loadNewsletterSignupQuery(): never;
|
|
3
5
|
export default function NewsletterSignup(props: NewsletterSignup_props): Promise<React.JSX.Element>;
|
|
@@ -3,6 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
4
4
|
import { NewsletterSignupPreloadedQueryRenderer } from './index.js';
|
|
5
5
|
import NewsletterSignupQueryNode from '../../__generated__/NewsletterSignupQuery.graphql.js';
|
|
6
|
+
// Stub for the RSC export condition. See FontdueProvider/index.server.tsx
|
|
7
|
+
// for the rationale.
|
|
8
|
+
export function loadNewsletterSignupQuery() {
|
|
9
|
+
throw new Error("loadNewsletterSignupQuery isn't needed in React Server Components — " + 'the <NewsletterSignup> server entrypoint awaits its query automatically. ' + 'Drop the manual call.');
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
// Next RSC variant: awaits the query on the server and hands the response to
|
|
8
13
|
// the client `NewsletterSignupPreloadedQueryRenderer`. Lets pages just write
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TestFontsForm_Query } from '../../__generated__/TestFontsForm_Query.graphql.js';
|
|
3
|
-
import {
|
|
3
|
+
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
4
4
|
export interface TestFontsForm_props {
|
|
5
5
|
agreementLabel?: string;
|
|
6
6
|
downloadLabel?: string;
|
|
7
7
|
newsletterCheckboxChecked?: boolean;
|
|
8
8
|
}
|
|
9
9
|
export type TestFontsFormPreloadedQuery = SerializablePreloadedQuery<TestFontsForm_Query>;
|
|
10
|
-
export declare function loadTestFontsFormQuery(
|
|
10
|
+
export declare function loadTestFontsFormQuery(): Promise<TestFontsFormPreloadedQuery>;
|
|
11
11
|
export declare function TestFontsFormPreloadedQueryRenderer({ preloadedQuery, ...rest }: TestFontsForm_props & {
|
|
12
12
|
preloadedQuery: TestFontsFormPreloadedQuery;
|
|
13
13
|
}): React.JSX.Element;
|
|
@@ -194,8 +194,8 @@ const TestFontsFormComponent = _ref2 => {
|
|
|
194
194
|
}));
|
|
195
195
|
};
|
|
196
196
|
const query = (_TestFontsForm_Query.hash && _TestFontsForm_Query.hash !== "cd43f0cacc4dcf01cf94fb1ff97197ca" && console.error("The definition of 'TestFontsForm_Query' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TestFontsForm_Query);
|
|
197
|
-
export async function loadTestFontsFormQuery(
|
|
198
|
-
return loadSerializableQuery(TestFontsFormQueryNode, {}
|
|
197
|
+
export async function loadTestFontsFormQuery() {
|
|
198
|
+
return loadSerializableQuery(TestFontsFormQueryNode, {});
|
|
199
199
|
}
|
|
200
200
|
export function TestFontsFormPreloadedQueryRenderer(_ref4) {
|
|
201
201
|
let {
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TestFontsForm_props } from './index.js';
|
|
3
|
+
export type { TestFontsFormPreloadedQuery } from './index.js';
|
|
4
|
+
export declare function loadTestFontsFormQuery(): never;
|
|
3
5
|
export default function TestFontsForm(props: TestFontsForm_props): Promise<React.JSX.Element>;
|
|
@@ -3,6 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
4
4
|
import { TestFontsFormPreloadedQueryRenderer } from './index.js';
|
|
5
5
|
import TestFontsFormQueryNode from '../../__generated__/TestFontsForm_Query.graphql.js';
|
|
6
|
+
// Stub for the RSC export condition. See FontdueProvider/index.server.tsx
|
|
7
|
+
// for the rationale.
|
|
8
|
+
export function loadTestFontsFormQuery() {
|
|
9
|
+
throw new Error("loadTestFontsFormQuery isn't needed in React Server Components — " + 'the <TestFontsForm> server entrypoint awaits its query automatically. ' + 'Drop the manual call.');
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
// Next RSC variant: awaits the query on the server and hands the response to
|
|
8
13
|
// the client `TestFontsFormPreloadedQueryRenderer`. Lets pages just write
|
|
@@ -1,10 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = ThemeConfig;
|
|
7
|
+
var _react = _interopRequireDefault(require("react"));
|
|
8
|
+
var _loadSerializableQuery = _interopRequireDefault(require("../../relay/loadSerializableQuery"));
|
|
9
|
+
var _index = require("./index");
|
|
10
|
+
var _ThemeConfigQuery = _interopRequireDefault(require("../../__generated__/ThemeConfigQuery.graphql"));
|
|
11
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
|
+
async function ThemeConfig() {
|
|
13
|
+
const preloadedQuery = await (0, _loadSerializableQuery.default)(_ThemeConfigQuery.default, {});
|
|
14
|
+
return /*#__PURE__*/_react.default.createElement(_index.ThemeConfigPreloadedQueryRenderer, {
|
|
8
15
|
preloadedQuery: preloadedQuery
|
|
9
16
|
});
|
|
10
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { Alignment, Direction, FeaturesProp } from './types.js';
|
|
3
|
-
import {
|
|
3
|
+
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
4
4
|
import { TypeTesterStandaloneQuery } from '../../__generated__/TypeTesterStandaloneQuery.graphql.js';
|
|
5
5
|
interface TypeTesterStandaloneComponent_props {
|
|
6
6
|
lineHeight?: number | null;
|
|
@@ -30,7 +30,7 @@ export interface LoadTypeTesterQueryVariables {
|
|
|
30
30
|
styleName: string;
|
|
31
31
|
selectable?: boolean;
|
|
32
32
|
}
|
|
33
|
-
export declare function loadTypeTesterQuery(variables: LoadTypeTesterQueryVariables
|
|
33
|
+
export declare function loadTypeTesterQuery(variables: LoadTypeTesterQueryVariables): Promise<TypeTesterPreloadedQuery>;
|
|
34
34
|
export declare function TypeTesterStandalonePreloadedQueryRenderer({ preloadedQuery, ...rest }: TypeTesterStandaloneComponent_props & {
|
|
35
35
|
preloadedQuery: TypeTesterPreloadedQuery;
|
|
36
36
|
}): React.JSX.Element;
|
|
@@ -101,12 +101,12 @@ function TypeTesterStandaloneComponent(_ref) {
|
|
|
101
101
|
}));
|
|
102
102
|
}
|
|
103
103
|
const query = (_TypeTesterStandaloneQuery.hash && _TypeTesterStandaloneQuery.hash !== "57916b8e26a166271a80c5df1b3f68ec" && console.error("The definition of 'TypeTesterStandaloneQuery' appears to have changed. Run `relay-compiler` to update the generated files to receive the expected data."), _TypeTesterStandaloneQuery);
|
|
104
|
-
export async function loadTypeTesterQuery(variables
|
|
104
|
+
export async function loadTypeTesterQuery(variables) {
|
|
105
105
|
return loadSerializableQuery(TypeTesterStandaloneQueryNode, {
|
|
106
106
|
familyName: variables.familyName,
|
|
107
107
|
styleName: variables.styleName,
|
|
108
108
|
selectable: variables.selectable ?? true
|
|
109
|
-
}
|
|
109
|
+
});
|
|
110
110
|
}
|
|
111
111
|
export function TypeTesterStandalonePreloadedQueryRenderer(_ref3) {
|
|
112
112
|
let {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { TypeTesterStandalone_props } from './TypeTesterStandalone.js';
|
|
3
|
+
export type { TypeTesterPreloadedQuery } from './TypeTesterStandalone.js';
|
|
4
|
+
export declare function loadTypeTesterQuery(): never;
|
|
3
5
|
export default function TypeTesterStandalone(props: Extract<TypeTesterStandalone_props, {
|
|
4
6
|
familyName: string;
|
|
5
7
|
}>): Promise<React.JSX.Element>;
|
|
@@ -3,6 +3,11 @@ import React from 'react';
|
|
|
3
3
|
import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
4
4
|
import { TypeTesterStandalonePreloadedQueryRenderer } from './TypeTesterStandalone.js';
|
|
5
5
|
import TypeTesterStandaloneQueryNode from '../../__generated__/TypeTesterStandaloneQuery.graphql.js';
|
|
6
|
+
// Stub for the RSC export condition. See FontdueProvider/index.server.tsx
|
|
7
|
+
// for the rationale.
|
|
8
|
+
export function loadTypeTesterQuery() {
|
|
9
|
+
throw new Error("loadTypeTesterQuery isn't needed in React Server Components — " + 'the <TypeTester> server entrypoint awaits its query automatically. ' + 'Drop the manual call.');
|
|
10
|
+
}
|
|
6
11
|
|
|
7
12
|
// Next RSC variant: awaits the query on the server and hands the response to
|
|
8
13
|
// the client `TypeTesterStandalonePreloadedQueryRenderer`. Lets pages just
|
|
@@ -2,7 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { TypeTestersIDQuery } from '../../__generated__/TypeTestersIDQuery.graphql.js';
|
|
3
3
|
import { TypeTestersSlugQuery } from '../../__generated__/TypeTestersSlugQuery.graphql.js';
|
|
4
4
|
import { FeaturesProp } from '../TypeTester/types.js';
|
|
5
|
-
import {
|
|
5
|
+
import { SerializablePreloadedQuery } from '../../relay/loadSerializableQuery.js';
|
|
6
6
|
export interface TypeTesters_props {
|
|
7
7
|
collectionId?: string;
|
|
8
8
|
collectionSlug?: string;
|
|
@@ -33,7 +33,7 @@ export type LoadTypeTestersQueryVariables = ({
|
|
|
33
33
|
excludeTags?: string[] | null;
|
|
34
34
|
selectable?: boolean;
|
|
35
35
|
};
|
|
36
|
-
export declare function loadTypeTestersQuery(variables: LoadTypeTestersQueryVariables
|
|
36
|
+
export declare function loadTypeTestersQuery(variables: LoadTypeTestersQueryVariables): Promise<TypeTestersPreloadedQuery>;
|
|
37
37
|
export type TypeTesters_unifiedProps = TypeTesters_props & {
|
|
38
38
|
preloadedQuery?: TypeTestersPreloadedQuery;
|
|
39
39
|
};
|
|
@@ -259,7 +259,7 @@ function TypeTestersSlugQueryRenderer(_ref6) {
|
|
|
259
259
|
excludeTags: excludeTags
|
|
260
260
|
}));
|
|
261
261
|
}
|
|
262
|
-
export async function loadTypeTestersQuery(variables
|
|
262
|
+
export async function loadTypeTestersQuery(variables) {
|
|
263
263
|
const tags = variables.tags ?? null;
|
|
264
264
|
const excludeTags = variables.excludeTags ?? null;
|
|
265
265
|
const selectable = variables.selectable ?? true;
|
|
@@ -269,7 +269,7 @@ export async function loadTypeTestersQuery(variables, options) {
|
|
|
269
269
|
tags,
|
|
270
270
|
excludeTags,
|
|
271
271
|
selectable
|
|
272
|
-
}
|
|
272
|
+
});
|
|
273
273
|
}
|
|
274
274
|
if (variables.collectionSlug) {
|
|
275
275
|
return loadSerializableQuery(TypeTestersSlugQueryNode, {
|
|
@@ -277,7 +277,7 @@ export async function loadTypeTestersQuery(variables, options) {
|
|
|
277
277
|
tags,
|
|
278
278
|
excludeTags,
|
|
279
279
|
selectable
|
|
280
|
-
}
|
|
280
|
+
});
|
|
281
281
|
}
|
|
282
282
|
throw new Error('loadTypeTestersQuery expected either collectionId or collectionSlug');
|
|
283
283
|
}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { TypeTesters_props } from './index.js';
|
|
3
|
+
export type { TypeTestersPreloadedQuery } from './index.js';
|
|
4
|
+
export declare function loadTypeTestersQuery(): never;
|
|
3
5
|
export default function TypeTesters({ collectionId, collectionSlug, tags, excludeTags, ...rest }: TypeTesters_props): Promise<React.JSX.Element | null>;
|
|
@@ -4,6 +4,11 @@ import loadSerializableQuery from '../../relay/loadSerializableQuery.js';
|
|
|
4
4
|
import { TypeTestersPreloadedIDQueryRenderer, TypeTestersPreloadedSlugQueryRenderer } from './index.js';
|
|
5
5
|
import TypeTestersIDQueryNode from '../../__generated__/TypeTestersIDQuery.graphql.js';
|
|
6
6
|
import TypeTestersSlugQueryNode from '../../__generated__/TypeTestersSlugQuery.graphql.js';
|
|
7
|
+
// Stub for the RSC export condition. See FontdueProvider/index.server.tsx
|
|
8
|
+
// for the rationale.
|
|
9
|
+
export function loadTypeTestersQuery() {
|
|
10
|
+
throw new Error("loadTypeTestersQuery isn't needed in React Server Components — " + 'the <TypeTesters> server entrypoint awaits its query automatically. ' + 'Drop the manual call.');
|
|
11
|
+
}
|
|
7
12
|
|
|
8
13
|
// Next RSC variant: awaits the query on the server and hands the response to
|
|
9
14
|
// the client `*PreloadedQueryRenderer`. Lets pages just write
|
package/dist/fontdue.css
CHANGED
|
@@ -941,14 +941,6 @@ div[data-component=TypeTesters] {
|
|
|
941
941
|
border-color: var(--button_hover_border_color, transparent);
|
|
942
942
|
}
|
|
943
943
|
|
|
944
|
-
:root {
|
|
945
|
-
--section_spacing: 60px;
|
|
946
|
-
}
|
|
947
|
-
|
|
948
|
-
.price {
|
|
949
|
-
font-variant-numeric: tabular-nums;
|
|
950
|
-
}
|
|
951
|
-
|
|
952
944
|
.character-viewer {
|
|
953
945
|
--size: calc(var(--monitor-width) * 1 / 2);
|
|
954
946
|
--half-gap: calc(var(--line-gap) / 2);
|
|
@@ -1209,10 +1201,6 @@ input:checked + .checkbox__icon {
|
|
|
1209
1201
|
margin-left: 0;
|
|
1210
1202
|
}
|
|
1211
1203
|
|
|
1212
|
-
body[data-fontdue-store-modal=open] {
|
|
1213
|
-
overflow: hidden;
|
|
1214
|
-
}
|
|
1215
|
-
|
|
1216
1204
|
.button {
|
|
1217
1205
|
background: none;
|
|
1218
1206
|
color: inherit;
|
|
@@ -2304,6 +2292,10 @@ body[data-fontdue-store-modal=open] {
|
|
|
2304
2292
|
font-size: 20px;
|
|
2305
2293
|
}
|
|
2306
2294
|
|
|
2295
|
+
body[data-fontdue-store-modal=open] {
|
|
2296
|
+
overflow: hidden;
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2307
2299
|
.empty-cart__message {
|
|
2308
2300
|
font-size: 20px;
|
|
2309
2301
|
margin-bottom: 60px;
|
|
@@ -3205,6 +3197,14 @@ textarea.text-field__input {
|
|
|
3205
3197
|
display: block;
|
|
3206
3198
|
}
|
|
3207
3199
|
|
|
3200
|
+
:root {
|
|
3201
|
+
--section_spacing: 60px;
|
|
3202
|
+
}
|
|
3203
|
+
|
|
3204
|
+
.price {
|
|
3205
|
+
font-variant-numeric: tabular-nums;
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3208
3208
|
fontdue-test-fonts-form,
|
|
3209
3209
|
fontdue-newsletter-signup,
|
|
3210
3210
|
fontdue-customer-login-form {
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { LoadSerializableQueryOptions } from './relay/loadSerializableQuery.js';
|
|
2
1
|
import type { FontdueProviderPreloadedQuery } from './components/FontdueProvider/index.js';
|
|
3
2
|
export type { FontdueProviderPreloadedQuery };
|
|
4
|
-
export default function loadFontdueProviderQuery(
|
|
3
|
+
export default function loadFontdueProviderQuery(): Promise<FontdueProviderPreloadedQuery>;
|
|
@@ -5,6 +5,6 @@ import FontdueProviderQueryNode from './__generated__/FontdueProviderQuery.graph
|
|
|
5
5
|
// `<FontdueProvider preloadedQuery={…}>` in your layout. Without it, aux UI
|
|
6
6
|
// falls back to lazy-fetching on first client render — which causes a visible
|
|
7
7
|
// theming flash because `ThemeConfig` injects CSS variables.
|
|
8
|
-
export default async function loadFontdueProviderQuery(
|
|
9
|
-
return loadSerializableQuery(FontdueProviderQueryNode, {}
|
|
8
|
+
export default async function loadFontdueProviderQuery() {
|
|
9
|
+
return loadSerializableQuery(FontdueProviderQueryNode, {});
|
|
10
10
|
}
|
|
@@ -3,7 +3,7 @@ import { handlePossibleCorsError } from '../corsError.js';
|
|
|
3
3
|
|
|
4
4
|
// `__FONTDUE_JS_VERSION__` is replaced by an inline babel plugin
|
|
5
5
|
// (defineVersionPlugin in .babelrc.cjs) with the literal package.json#version.
|
|
6
|
-
const version = "3.0.0-
|
|
6
|
+
const version = "3.0.0-alpha5";
|
|
7
7
|
const IS_SERVER = typeof window === typeof undefined;
|
|
8
8
|
|
|
9
9
|
// Read env from either process.env (Node/Next.js) or import.meta.env (Vite/Astro).
|
|
@@ -43,9 +43,5 @@ export interface SerializablePreloadedQuery<TQuery extends OperationType> {
|
|
|
43
43
|
type RequireAllWithNull<T> = {
|
|
44
44
|
[K in keyof T]-?: T[K] | null;
|
|
45
45
|
};
|
|
46
|
-
export
|
|
47
|
-
url?: string;
|
|
48
|
-
stripeIntegration?: 'card-element' | 'dynamic';
|
|
49
|
-
}
|
|
50
|
-
export default function loadSerializableQuery<TQuery extends OperationType>(query: GraphQLTaggedNode, variables: RequireAllWithNull<VariablesOf<TQuery>>, options?: LoadSerializableQueryOptions): Promise<SerializablePreloadedQuery<TQuery>>;
|
|
46
|
+
export default function loadSerializableQuery<TQuery extends OperationType>(query: GraphQLTaggedNode, variables: RequireAllWithNull<VariablesOf<TQuery>>): Promise<SerializablePreloadedQuery<TQuery>>;
|
|
51
47
|
export {};
|
|
@@ -40,9 +40,9 @@ import { createNetworkFetch } from './environment.js';
|
|
|
40
40
|
// Call into raw network fetch to get serializable GraphQL query response
|
|
41
41
|
// This response will be sent to the client to "warm" the QueryResponseCache
|
|
42
42
|
// to avoid the client fetches.
|
|
43
|
-
export default async function loadSerializableQuery(query, variables
|
|
43
|
+
export default async function loadSerializableQuery(query, variables) {
|
|
44
44
|
if (!('params' in query)) throw new Error('Params not found in query, is it a fragment instead of a query?');
|
|
45
|
-
const fetcher = createNetworkFetch(
|
|
45
|
+
const fetcher = createNetworkFetch();
|
|
46
46
|
const response = await fetcher(query.params, variables);
|
|
47
47
|
return {
|
|
48
48
|
params: query.params,
|
package/dist/vite.js
CHANGED
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
// @ts-ignore — vite-plugin-cjs-interop has no bundled types but exports
|
|
24
24
|
// cjsInterop at runtime.
|
|
25
25
|
import { cjsInterop } from 'vite-plugin-cjs-interop';
|
|
26
|
+
import { createRequire } from 'node:module';
|
|
27
|
+
|
|
26
28
|
// Packages whose imports cjsInterop should rewrite to default-import +
|
|
27
29
|
// destructure shape. Limit this to packages that genuinely ship as CJS-only
|
|
28
30
|
// with `module.exports = require('./lib')` shapes that defeat named-import
|
|
@@ -43,9 +45,47 @@ const CJS_DEPS = ['react-relay', 'relay-runtime', 'draft-js', 'fbjs'];
|
|
|
43
45
|
// the optimizer's auto-generated wrapper omits a `default` export. Including
|
|
44
46
|
// the consumers + setting `needsInterop` on `prop-types` forces Vite to
|
|
45
47
|
// synthesize a default export so `import PropTypes from 'prop-types'` resolves.
|
|
46
|
-
const CLIENT_OPTIMIZE = [...CJS_DEPS, 'react-redux', 'react-google-recaptcha', '@stripe/react-stripe-js', 'prop-types'
|
|
48
|
+
const CLIENT_OPTIMIZE = [...CJS_DEPS, 'react-redux', 'react-google-recaptcha', '@stripe/react-stripe-js', 'prop-types',
|
|
49
|
+
// Transitive deps that Vite would otherwise discover late, after fontdue-js
|
|
50
|
+
// subpaths are first imported. Each late discovery triggers a re-optimize
|
|
51
|
+
// and a new browserHash for `react`, which produces the dual-React bug
|
|
52
|
+
// described above `getFontdueJsSubpaths`. Pinning them here keeps the
|
|
53
|
+
// initial scan complete.
|
|
54
|
+
'@sentry/react', '@stripe/stripe-js', 'react-error-boundary', 'redux'];
|
|
47
55
|
const NEEDS_INTEROP = ['prop-types'];
|
|
56
|
+
|
|
57
|
+
// Every public `fontdue-js/*` entry from package.json `exports`. Pre-including
|
|
58
|
+
// them in `optimizeDeps` forces Vite to scan them on the first dev startup
|
|
59
|
+
// instead of discovering them later when a route lazy-loads.
|
|
60
|
+
//
|
|
61
|
+
// Why this matters: when Vite finds a new dep mid-session it re-runs the
|
|
62
|
+
// optimizer, which mints a new `?v=` browserHash for every dep chunk. Chunks
|
|
63
|
+
// already loaded in the page keep their old `?v=` baked into their imports,
|
|
64
|
+
// so a freshly-fetched chunk that imports `react?v=NEW` ends up coexisting
|
|
65
|
+
// with the previously-loaded `react?v=OLD`. Two physical React modules in
|
|
66
|
+
// the same page → two `ReactCurrentDispatcher`s → `useContext` returns null
|
|
67
|
+
// → "Invalid hook call" on first navigation to an uncached route.
|
|
68
|
+
//
|
|
69
|
+
// Frameworks that lazy-load modules (RR7's route splitter, Astro's per-island
|
|
70
|
+
// hydration) make this near-certain unless the optimizer sees the full set
|
|
71
|
+
// up front. Vite's glob form (`fontdue-js/*`) walks the filesystem and gets
|
|
72
|
+
// confused by our `exports`-mapped layout (the dist files don't sit at the
|
|
73
|
+
// subpath names), so we read `exports` directly — that's the authoritative
|
|
74
|
+
// list.
|
|
75
|
+
function getFontdueJsSubpaths() {
|
|
76
|
+
const require = createRequire(import.meta.url);
|
|
77
|
+
const pkg = require('../package.json');
|
|
78
|
+
const out = [];
|
|
79
|
+
for (const key of Object.keys(pkg.exports ?? {})) {
|
|
80
|
+
if (!key.startsWith('./')) continue;
|
|
81
|
+
if (key.endsWith('.css')) continue;
|
|
82
|
+
if (key === './vite') continue;
|
|
83
|
+
out.push(`fontdue-js/${key.slice(2)}`);
|
|
84
|
+
}
|
|
85
|
+
return out;
|
|
86
|
+
}
|
|
48
87
|
export default function fontdueJs() {
|
|
88
|
+
const fontdueSubpaths = getFontdueJsSubpaths();
|
|
49
89
|
return [cjsInterop({
|
|
50
90
|
dependencies: CJS_DEPS
|
|
51
91
|
}), {
|
|
@@ -58,7 +98,7 @@ export default function fontdueJs() {
|
|
|
58
98
|
// its `module.exports = require('./lib/index.js')` shape can't
|
|
59
99
|
// be statically analyzed for named exports.
|
|
60
100
|
optimizeDeps: {
|
|
61
|
-
include: [...CLIENT_OPTIMIZE],
|
|
101
|
+
include: [...fontdueSubpaths, ...CLIENT_OPTIMIZE],
|
|
62
102
|
needsInterop: [...NEEDS_INTEROP]
|
|
63
103
|
},
|
|
64
104
|
// fbjs (transitive via draft-js) references Node's `global` at
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "fontdue-js",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-alpha5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"build": "npm run relay && run-p build-js build-css build-ts",
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
"react": "^19.0.0",
|
|
62
62
|
"react-dom": "^19.0.0",
|
|
63
63
|
"relay-compiler": "^18.0.0",
|
|
64
|
-
"sass": "^1.
|
|
64
|
+
"sass": "^1.99.0",
|
|
65
65
|
"typescript": "^5.9",
|
|
66
66
|
"vite": "^8.0.10",
|
|
67
67
|
"vitest": "^4.1.1"
|
|
@@ -81,16 +81,12 @@
|
|
|
81
81
|
"@types/react": "19.0.0"
|
|
82
82
|
},
|
|
83
83
|
"exports": {
|
|
84
|
-
".": "./dist/index.js",
|
|
85
84
|
"./fontdue.css": "./dist/fontdue.css",
|
|
86
85
|
"./BuyButton": {
|
|
87
86
|
"react-server": "./dist/components/BuyButton/index.server.js",
|
|
88
87
|
"default": "./dist/components/BuyButton/index.js"
|
|
89
88
|
},
|
|
90
|
-
"./CartButton":
|
|
91
|
-
"react-server": "./dist/components/CartButton/index.server.js",
|
|
92
|
-
"default": "./dist/components/CartButton/index.js"
|
|
93
|
-
},
|
|
89
|
+
"./CartButton": "./dist/components/CartButton/index.js",
|
|
94
90
|
"./CharacterViewer": {
|
|
95
91
|
"react-server": "./dist/components/CharacterViewer/index.server.js",
|
|
96
92
|
"default": "./dist/components/CharacterViewer/index.js"
|
|
@@ -100,7 +96,6 @@
|
|
|
100
96
|
"react-server": "./dist/components/FontdueProvider/index.server.js",
|
|
101
97
|
"default": "./dist/components/FontdueProvider/index.js"
|
|
102
98
|
},
|
|
103
|
-
"./loadFontdueProviderQuery": "./dist/loadFontdueProviderQuery.js",
|
|
104
99
|
"./NewsletterSignup": {
|
|
105
100
|
"react-server": "./dist/components/NewsletterSignup/index.server.js",
|
|
106
101
|
"default": "./dist/components/NewsletterSignup/index.js"
|