fontdue-js 3.0.0-alpha4 → 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/CartButton/index.d.ts +1 -11
- package/dist/components/CartButton/index.js +9 -29
- package/dist/components/CartButton/index.server.d.ts +1 -3
- package/dist/components/CartButton/index.server.js +14 -20
- package/dist/components/CharacterViewer/index.d.ts +2 -2
- package/dist/components/CharacterViewer/index.js +3 -3
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.d.ts +4 -6
- package/dist/components/FontdueProvider/FontdueProviderClientComponent.js +39 -48
- package/dist/components/FontdueProvider/index.server.js +1 -3
- package/dist/components/NewsletterSignup/index.d.ts +2 -2
- package/dist/components/NewsletterSignup/index.js +2 -2
- package/dist/components/TestFontsForm/index.d.ts +2 -2
- package/dist/components/TestFontsForm/index.js +2 -2
- 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/TypeTesters/index.d.ts +2 -2
- package/dist/components/TypeTesters/index.js +3 -3
- 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 -6
|
@@ -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 {
|
|
@@ -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
|
}
|
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"
|
|
@@ -86,10 +86,7 @@
|
|
|
86
86
|
"react-server": "./dist/components/BuyButton/index.server.js",
|
|
87
87
|
"default": "./dist/components/BuyButton/index.js"
|
|
88
88
|
},
|
|
89
|
-
"./CartButton":
|
|
90
|
-
"react-server": "./dist/components/CartButton/index.server.js",
|
|
91
|
-
"default": "./dist/components/CartButton/index.js"
|
|
92
|
-
},
|
|
89
|
+
"./CartButton": "./dist/components/CartButton/index.js",
|
|
93
90
|
"./CharacterViewer": {
|
|
94
91
|
"react-server": "./dist/components/CharacterViewer/index.server.js",
|
|
95
92
|
"default": "./dist/components/CharacterViewer/index.js"
|