@volter/twin-googlefonts 0.0.0-stage → 1.0.2
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/LICENSE +202 -0
- package/README.md +15 -2
- package/api/spec/SOURCE.md +17 -0
- package/api/spec/discovery.json +306 -0
- package/api/spec/openapi.json +647 -0
- package/api/spec/sources.json +16 -0
- package/api/src/fetch.ts +16 -0
- package/api/src/generated/surface.gen.json +1 -0
- package/api/src/generated/ui.gen.json +1 -0
- package/api/src/index.ts +3 -0
- package/api/src/manifest.ts +31 -0
- package/api/src/semantics/doors.ts +135 -0
- package/api/src/semantics/index.ts +8 -0
- package/api/src/semantics/shared.ts +1 -0
- package/api/src/semantics/states.ts +6 -0
- package/api/src/semantics/webfonts.ts +32 -0
- package/assets/spec/SOURCE.md +11 -0
- package/assets/spec/openapi.json +162 -0
- package/assets/spec/sources.json +1 -0
- package/assets/src/fetch.ts +14 -0
- package/assets/src/generated/surface.gen.json +1 -0
- package/assets/src/generated/ui.gen.json +1 -0
- package/assets/src/index.ts +3 -0
- package/assets/src/manifest.ts +19 -0
- package/assets/src/semantics/index.ts +10 -0
- package/assets/src/semantics/l.ts +4 -0
- package/assets/src/semantics/s.ts +4 -0
- package/assets/src/semantics/shared.ts +13 -0
- package/css/spec/SOURCE.md +17 -0
- package/css/spec/openapi.json +142 -0
- package/css/spec/sources.json +1 -0
- package/css/src/fetch.ts +14 -0
- package/css/src/generated/surface.gen.json +1 -0
- package/css/src/generated/ui.gen.json +1 -0
- package/css/src/index.ts +3 -0
- package/css/src/manifest.ts +19 -0
- package/css/src/semantics/css.ts +19 -0
- package/css/src/semantics/css2.ts +20 -0
- package/css/src/semantics/index.ts +10 -0
- package/css/src/semantics/shared.ts +1 -0
- package/dist/api/spec/SOURCE.md +17 -0
- package/dist/api/spec/discovery.json +306 -0
- package/dist/api/spec/openapi.json +647 -0
- package/dist/api/spec/sources.json +16 -0
- package/dist/api/src/fetch.d.ts +2 -0
- package/dist/api/src/fetch.js +15 -0
- package/dist/api/src/generated/surface.gen.json +1 -0
- package/dist/api/src/generated/ui.gen.json +1 -0
- package/dist/api/src/index.d.ts +2 -0
- package/dist/api/src/index.js +3 -0
- package/dist/api/src/manifest.d.ts +2 -0
- package/dist/api/src/manifest.js +29 -0
- package/dist/api/src/semantics/doors.d.ts +3 -0
- package/dist/api/src/semantics/doors.js +142 -0
- package/dist/api/src/semantics/index.d.ts +2 -0
- package/dist/api/src/semantics/index.js +4 -0
- package/dist/api/src/semantics/shared.d.ts +1 -0
- package/dist/api/src/semantics/shared.js +1 -0
- package/dist/api/src/semantics/states.d.ts +8 -0
- package/dist/api/src/semantics/states.js +6 -0
- package/dist/api/src/semantics/webfonts.d.ts +2 -0
- package/dist/api/src/semantics/webfonts.js +34 -0
- package/dist/assets/spec/SOURCE.md +11 -0
- package/dist/assets/spec/openapi.json +162 -0
- package/dist/assets/spec/sources.json +1 -0
- package/dist/assets/src/fetch.d.ts +2 -0
- package/dist/assets/src/fetch.js +13 -0
- package/dist/assets/src/generated/surface.gen.json +1 -0
- package/dist/assets/src/generated/ui.gen.json +1 -0
- package/dist/assets/src/index.d.ts +2 -0
- package/dist/assets/src/index.js +3 -0
- package/dist/assets/src/manifest.d.ts +2 -0
- package/dist/assets/src/manifest.js +17 -0
- package/dist/assets/src/semantics/index.d.ts +2 -0
- package/dist/assets/src/semantics/index.js +6 -0
- package/dist/assets/src/semantics/l.d.ts +2 -0
- package/dist/assets/src/semantics/l.js +3 -0
- package/dist/assets/src/semantics/s.d.ts +2 -0
- package/dist/assets/src/semantics/s.js +3 -0
- package/dist/assets/src/semantics/shared.d.ts +2 -0
- package/dist/assets/src/semantics/shared.js +13 -0
- package/dist/css/spec/SOURCE.md +17 -0
- package/dist/css/spec/openapi.json +142 -0
- package/dist/css/spec/sources.json +1 -0
- package/dist/css/src/fetch.d.ts +2 -0
- package/dist/css/src/fetch.js +13 -0
- package/dist/css/src/generated/surface.gen.json +1 -0
- package/dist/css/src/generated/ui.gen.json +1 -0
- package/dist/css/src/index.d.ts +2 -0
- package/dist/css/src/index.js +3 -0
- package/dist/css/src/manifest.d.ts +2 -0
- package/dist/css/src/manifest.js +16 -0
- package/dist/css/src/semantics/css.d.ts +2 -0
- package/dist/css/src/semantics/css.js +19 -0
- package/dist/css/src/semantics/css2.d.ts +2 -0
- package/dist/css/src/semantics/css2.js +21 -0
- package/dist/css/src/semantics/index.d.ts +2 -0
- package/dist/css/src/semantics/index.js +6 -0
- package/dist/css/src/semantics/shared.d.ts +1 -0
- package/dist/css/src/semantics/shared.js +1 -0
- package/dist/generated/pack-facts.json +68 -0
- package/dist/journeys/customer-life.json +544 -0
- package/dist/journeys/decisions.json +64 -0
- package/dist/journeys/demand.json +101 -0
- package/dist/journeys/first-use.json +20 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/cli.js +22 -0
- package/dist/src/fetch.d.ts +2 -0
- package/dist/src/fetch.js +10 -0
- package/dist/src/index.d.ts +5 -0
- package/dist/src/index.js +15 -0
- package/dist/src/manifest.d.ts +2 -0
- package/dist/src/manifest.js +27 -0
- package/dist/src/semantics/seed.d.ts +2 -0
- package/dist/src/semantics/seed.js +181 -0
- package/dist/src/semantics/shared.d.ts +9 -0
- package/dist/src/semantics/shared.js +23 -0
- package/dist/src/server.d.ts +7 -0
- package/dist/src/server.js +7 -0
- package/generated/pack-facts.json +68 -0
- package/journeys/customer-life.json +544 -0
- package/journeys/decisions.json +64 -0
- package/journeys/demand.json +101 -0
- package/journeys/first-use.json +20 -0
- package/package.json +57 -4
- package/src/cli.ts +22 -0
- package/src/fetch.ts +11 -0
- package/src/index.ts +17 -0
- package/src/manifest.ts +29 -0
- package/src/semantics/seed.ts +183 -0
- package/src/semantics/shared.ts +25 -0
- package/src/server.ts +8 -0
- package/vendor/Inter-OFL.txt +93 -0
- package/vendor/OFL.txt +94 -0
- package/vendor/SOURCE.md +40 -0
- package/vendor/antic.json +93 -0
- package/vendor/inputs.json +460 -0
- package/vendor/inter-variable.json +52 -0
- package/vendor/inter.json +44 -0
- package/vendor/noto-sans-sc-text.json +24 -0
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
{
|
|
2
|
+
"openapi": "3.0.3",
|
|
3
|
+
"info": {
|
|
4
|
+
"title": "Google Fonts CSS API",
|
|
5
|
+
"version": "v1"
|
|
6
|
+
},
|
|
7
|
+
"servers": [
|
|
8
|
+
{
|
|
9
|
+
"url": "https://fonts.googleapis.com"
|
|
10
|
+
}
|
|
11
|
+
],
|
|
12
|
+
"paths": {
|
|
13
|
+
"/css": {
|
|
14
|
+
"get": {
|
|
15
|
+
"operationId": "getStylesheet",
|
|
16
|
+
"description": "The Google Fonts API provides the regular version of the requested fonts by default. To request other styles or weights, append a colon to the name of the font. The subset parameter specifies script subsets. The representation is selected for the requesting browser.",
|
|
17
|
+
"parameters": [
|
|
18
|
+
{
|
|
19
|
+
"name": "family",
|
|
20
|
+
"in": "query",
|
|
21
|
+
"required": true,
|
|
22
|
+
"schema": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
"name": "subset",
|
|
28
|
+
"in": "query",
|
|
29
|
+
"required": false,
|
|
30
|
+
"schema": {
|
|
31
|
+
"type": "string"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
"name": "User-Agent",
|
|
36
|
+
"in": "header",
|
|
37
|
+
"schema": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
],
|
|
42
|
+
"responses": {
|
|
43
|
+
"200": {
|
|
44
|
+
"description": "A stylesheet referring to font-file URLs",
|
|
45
|
+
"content": {
|
|
46
|
+
"text/css": {
|
|
47
|
+
"schema": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"400": {
|
|
54
|
+
"description": "Bad font request",
|
|
55
|
+
"content": {
|
|
56
|
+
"text/html": {
|
|
57
|
+
"schema": {
|
|
58
|
+
"type": "string"
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
"/css2": {
|
|
67
|
+
"get": {
|
|
68
|
+
"operationId": "getStylesheet2",
|
|
69
|
+
"description": "It all starts with a new base URL: https://fonts.googleapis.com/css2 The syntax for specifying styles within each family has changed to describe variable font ‘design spaces.’ To request multiple families, specify the family= param for each family. Please note that the 'text=' parameter can only be specified once. It applies to all families in the request. As a general note, the updated CSS API is more strict about what requests are accepted than the original CSS API. The representation is selected for the requesting browser.",
|
|
70
|
+
"parameters": [
|
|
71
|
+
{
|
|
72
|
+
"name": "family",
|
|
73
|
+
"in": "query",
|
|
74
|
+
"required": true,
|
|
75
|
+
"style": "form",
|
|
76
|
+
"explode": true,
|
|
77
|
+
"description": "<family_name>[:<axis_tag_list>@<axis_tuple_list>]",
|
|
78
|
+
"schema": {
|
|
79
|
+
"type": "array",
|
|
80
|
+
"items": {
|
|
81
|
+
"type": "string"
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "text",
|
|
87
|
+
"in": "query",
|
|
88
|
+
"required": false,
|
|
89
|
+
"description": "The text that will be displayed in the requested typeface",
|
|
90
|
+
"schema": {
|
|
91
|
+
"type": "string"
|
|
92
|
+
}
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"name": "display",
|
|
96
|
+
"in": "query",
|
|
97
|
+
"required": false,
|
|
98
|
+
"schema": {
|
|
99
|
+
"type": "string",
|
|
100
|
+
"enum": [
|
|
101
|
+
"auto",
|
|
102
|
+
"block",
|
|
103
|
+
"swap",
|
|
104
|
+
"fallback",
|
|
105
|
+
"optional"
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "User-Agent",
|
|
111
|
+
"in": "header",
|
|
112
|
+
"schema": {
|
|
113
|
+
"type": "string"
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"responses": {
|
|
118
|
+
"200": {
|
|
119
|
+
"description": "A stylesheet referring to font-file URLs",
|
|
120
|
+
"content": {
|
|
121
|
+
"text/css": {
|
|
122
|
+
"schema": {
|
|
123
|
+
"type": "string"
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
},
|
|
128
|
+
"400": {
|
|
129
|
+
"description": "Bad font request",
|
|
130
|
+
"content": {
|
|
131
|
+
"text/html": {
|
|
132
|
+
"schema": {
|
|
133
|
+
"type": "string"
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// GENERATED by scripts/create-pack.ts (--init, --index): a fixed file. The kernel serves the discovery door, the clock,
|
|
2
|
+
// the World's doors, the vendor's screens and the API from the pack's parts (architecture, "The pack contract").
|
|
3
|
+
import { createPackFetch } from '@volter/world-core';
|
|
4
|
+
import surface from './generated/surface.gen.json' with { type: 'json' };
|
|
5
|
+
import { manifest } from "./manifest.js";
|
|
6
|
+
import { cssSemantics } from "./semantics/index.js";
|
|
7
|
+
export function createCssLaneFetch(options = {}) {
|
|
8
|
+
return createPackFetch({
|
|
9
|
+
manifest,
|
|
10
|
+
surface: surface,
|
|
11
|
+
handlers: cssSemantics,
|
|
12
|
+
}, options);
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"generatedBy":"scripts/derive-pack.ts","spec":"openapi.json","format":"openapi","version":"v1","resources":[],"operations":[{"id":"getStylesheet","method":"get","path":"/css","pathParams":[],"query":[{"name":"family","type":"string","required":true},{"name":"subset","type":"string","required":false}],"body":[],"bodyEncoding":"none","successStatus":200,"class":"computed"},{"id":"getStylesheet2","method":"get","path":"/css2","pathParams":[],"query":[{"name":"display","type":"string","required":false},{"name":"family","type":"array","required":true},{"name":"text","type":"string","required":false}],"body":[],"bodyEncoding":"none","successStatus":200,"class":"computed"}]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"generatedBy":"scripts/derive-pack.ts","resources":{}}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const manifest = {
|
|
2
|
+
vendor: 'googlefonts', service: 'googlefonts', body: { json: 'always' },
|
|
3
|
+
ids: { template: '{uuid}' }, time: 'iso',
|
|
4
|
+
error: { error: { code: '{status}', message: '{message}', status: '{kind}' } },
|
|
5
|
+
readOnly: { status: 403, kind: 'PERMISSION_DENIED', message: 'Read-only World' },
|
|
6
|
+
notFound: { status: 404, kind: 'NOT_FOUND', message: 'Not Found' },
|
|
7
|
+
gap: { status: 404, kind: 'NOT_FOUND', message: 'Not Found' },
|
|
8
|
+
list: { style: 'envelope', envelope: { items: '{data}' }, limit: { param: 'limit', default: 100, max: 100 } },
|
|
9
|
+
deleted: {},
|
|
10
|
+
resources: {},
|
|
11
|
+
discovery: { twinOf: 'Google Fonts browser-selected CSS', stores: 'Published catalog and font representations in the shared googlefonts store' },
|
|
12
|
+
descriptor: { protocol: '3', transport: 'rest', archetype: 'crud', bin: 'world-googlefonts-css',
|
|
13
|
+
resources: [], specSource: 'css/spec/SOURCE.md', description: 'Google Fonts browser-selected CSS',
|
|
14
|
+
adoption: { sdks: [], envStems: [] }, hosts: [{ host: 'fonts.googleapis.com', pathPattern: '^/css2?$' }],
|
|
15
|
+
endpointEnvNone: 'The application hardcodes this vendor lane host.' },
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { CATALOG, CSS, cssKey, htmlError } from "./shared.js";
|
|
2
|
+
// source: spec:getStylesheet "The representation is selected for the requesting browser."
|
|
3
|
+
export async function getStylesheet(ctx) {
|
|
4
|
+
const query = new URL(ctx.call.request.url).searchParams;
|
|
5
|
+
const family = query.get('family'), subset = query.get('subset') ?? 'latin';
|
|
6
|
+
if (!family || [...query.keys()].some(k => !['family', 'subset'].includes(k)))
|
|
7
|
+
return htmlError(400, 'Bad font request');
|
|
8
|
+
const generation = ctx.row(CATALOG, 'published')?.fingerprint;
|
|
9
|
+
const key = cssKey(ctx, family, subset, ctx.call.request.headers.get('user-agent') ?? '');
|
|
10
|
+
const row = generation === undefined ? undefined : ctx.row(CSS, String(generation) + ':' + key);
|
|
11
|
+
// Where the documentation stops: no supplied representation is a named
|
|
12
|
+
// refusal, not an invented conversion or another browser's font format.
|
|
13
|
+
if (!row)
|
|
14
|
+
return htmlError(400, 'Font family or browser representation is not published');
|
|
15
|
+
const body = await ctx.blobs.get(String(row.blob));
|
|
16
|
+
if (!body)
|
|
17
|
+
return htmlError(404, 'Font stylesheet not found');
|
|
18
|
+
return new Response(Uint8Array.from(body).buffer, { headers: { 'content-type': 'text/css; charset=utf-8', 'content-length': String(body.length), 'vary': 'User-Agent' } });
|
|
19
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { CATALOG, CSS, css2Key, css2Query, htmlError } from "./shared.js";
|
|
2
|
+
// source: spec:getStylesheet2 "To request multiple families, specify the family= param for each family."
|
|
3
|
+
export async function getStylesheet2(ctx) {
|
|
4
|
+
const pairs = css2Query(new URL(ctx.call.request.url).searchParams);
|
|
5
|
+
if (!pairs)
|
|
6
|
+
return htmlError(400, 'Bad font request');
|
|
7
|
+
const generation = ctx.row(CATALOG, 'published')?.fingerprint;
|
|
8
|
+
const userAgent = ctx.call.request.headers.get('user-agent') ?? '';
|
|
9
|
+
const sheet = (agent) => generation === undefined ? undefined : ctx.row(CSS, String(generation) + ':' + css2Key(ctx, pairs, agent));
|
|
10
|
+
// Where the evidence stops: Google answered the same truetype stylesheet to no User-Agent, "node" and "undici"
|
|
11
|
+
// (vendor/inter.json). A request whose agent is not a browser's ("Mozilla/...") and has no representation of its
|
|
12
|
+
// own reads the one published for no agent; a browser without its own representation is refused, never sent
|
|
13
|
+
// another browser's format.
|
|
14
|
+
const row = sheet(userAgent) ?? (userAgent.startsWith('Mozilla/') ? undefined : sheet(''));
|
|
15
|
+
if (!row)
|
|
16
|
+
return htmlError(400, 'Font family or browser representation is not published');
|
|
17
|
+
const body = await ctx.blobs.get(String(row.blob));
|
|
18
|
+
if (!body)
|
|
19
|
+
return htmlError(404, 'Font stylesheet not found');
|
|
20
|
+
return new Response(Uint8Array.from(body).buffer, { headers: { 'content-type': 'text/css; charset=utf-8', 'content-length': String(body.length), 'access-control-allow-origin': '*' } });
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../../../src/semantics/shared.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "../../../src/semantics/shared.js";
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"//": "GENERATED by twin-standard facts from the pack descriptor; no prior-artifact entries are retained.",
|
|
3
|
+
"packs": {
|
|
4
|
+
"googlefonts": {
|
|
5
|
+
"adoption": {
|
|
6
|
+
"sdks": [],
|
|
7
|
+
"envStems": [
|
|
8
|
+
"GOOGLE_FONTS"
|
|
9
|
+
],
|
|
10
|
+
"modules": [
|
|
11
|
+
"next/font/google"
|
|
12
|
+
]
|
|
13
|
+
},
|
|
14
|
+
"hosts": [
|
|
15
|
+
{
|
|
16
|
+
"host": "www.googleapis.com",
|
|
17
|
+
"pathPattern": "^/webfonts/v1/webfonts$"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"host": "webfonts.googleapis.com",
|
|
21
|
+
"pathPattern": "^/v1/webfonts$"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"host": "fonts.googleapis.com",
|
|
25
|
+
"pathPattern": "^/css2?$"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"host": "fonts.gstatic.com",
|
|
29
|
+
"pathPattern": "^/(s/|l/font$)"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"archetype": "crud",
|
|
33
|
+
"protocol": {
|
|
34
|
+
"declared": "3",
|
|
35
|
+
"major": 3,
|
|
36
|
+
"standing": "current"
|
|
37
|
+
},
|
|
38
|
+
"transport": "rest",
|
|
39
|
+
"resources": [
|
|
40
|
+
"webfont",
|
|
41
|
+
"_api_key",
|
|
42
|
+
"_font_catalog",
|
|
43
|
+
"_stylesheet",
|
|
44
|
+
"_font_file"
|
|
45
|
+
],
|
|
46
|
+
"endpointEnvNone": "Pinned helper hardcodes the vendor API and CSS hosts, then downloads their returned gstatic URLs. Scoped host routing preserves these URLs.",
|
|
47
|
+
"credentialDoor": {
|
|
48
|
+
"path": "/_twin/app-credentials",
|
|
49
|
+
"body": {},
|
|
50
|
+
"account": {
|
|
51
|
+
"field": "account",
|
|
52
|
+
"tenancy": "Google Cloud project",
|
|
53
|
+
"source": "https://developers.google.com/fonts/docs/developer_api"
|
|
54
|
+
},
|
|
55
|
+
"deployment": {
|
|
56
|
+
"field": "deployment",
|
|
57
|
+
"object": "Project API key",
|
|
58
|
+
"source": "https://docs.cloud.google.com/docs/authentication/api-keys"
|
|
59
|
+
},
|
|
60
|
+
"fill": {
|
|
61
|
+
"GOOGLE_FONTS_API_KEY": "api_key"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"serveExport": "createGooglefontsTwinServer"
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
"undeclared": []
|
|
68
|
+
}
|