@blorkfield/overlay-core 0.3.0 → 0.4.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 (167) hide show
  1. package/README.md +55 -33
  2. package/dist/vite-plugin.cjs +78 -0
  3. package/dist/vite-plugin.cjs.map +1 -0
  4. package/dist/vite-plugin.d.cts +20 -0
  5. package/dist/vite-plugin.d.ts +20 -0
  6. package/dist/vite-plugin.js +42 -0
  7. package/dist/vite-plugin.js.map +1 -0
  8. package/fonts/Roboto/OFL.txt +93 -0
  9. package/fonts/Roboto/README.txt +118 -0
  10. package/fonts/Roboto/Roboto-Italic-VariableFont_wdth,wght.ttf +0 -0
  11. package/fonts/Roboto/Roboto-VariableFont_wdth,wght.ttf +0 -0
  12. package/fonts/Roboto/static/Roboto-Black.ttf +0 -0
  13. package/fonts/Roboto/static/Roboto-BlackItalic.ttf +0 -0
  14. package/fonts/Roboto/static/Roboto-Bold.ttf +0 -0
  15. package/fonts/Roboto/static/Roboto-BoldItalic.ttf +0 -0
  16. package/fonts/Roboto/static/Roboto-ExtraBold.ttf +0 -0
  17. package/fonts/Roboto/static/Roboto-ExtraBoldItalic.ttf +0 -0
  18. package/fonts/Roboto/static/Roboto-ExtraLight.ttf +0 -0
  19. package/fonts/Roboto/static/Roboto-ExtraLightItalic.ttf +0 -0
  20. package/fonts/Roboto/static/Roboto-Italic.ttf +0 -0
  21. package/fonts/Roboto/static/Roboto-Light.ttf +0 -0
  22. package/fonts/Roboto/static/Roboto-LightItalic.ttf +0 -0
  23. package/fonts/Roboto/static/Roboto-Medium.ttf +0 -0
  24. package/fonts/Roboto/static/Roboto-MediumItalic.ttf +0 -0
  25. package/fonts/Roboto/static/Roboto-Regular.ttf +0 -0
  26. package/fonts/Roboto/static/Roboto-SemiBold.ttf +0 -0
  27. package/fonts/Roboto/static/Roboto-SemiBoldItalic.ttf +0 -0
  28. package/fonts/Roboto/static/Roboto-Thin.ttf +0 -0
  29. package/fonts/Roboto/static/Roboto-ThinItalic.ttf +0 -0
  30. package/fonts/Roboto/static/Roboto_Condensed-Black.ttf +0 -0
  31. package/fonts/Roboto/static/Roboto_Condensed-BlackItalic.ttf +0 -0
  32. package/fonts/Roboto/static/Roboto_Condensed-Bold.ttf +0 -0
  33. package/fonts/Roboto/static/Roboto_Condensed-BoldItalic.ttf +0 -0
  34. package/fonts/Roboto/static/Roboto_Condensed-ExtraBold.ttf +0 -0
  35. package/fonts/Roboto/static/Roboto_Condensed-ExtraBoldItalic.ttf +0 -0
  36. package/fonts/Roboto/static/Roboto_Condensed-ExtraLight.ttf +0 -0
  37. package/fonts/Roboto/static/Roboto_Condensed-ExtraLightItalic.ttf +0 -0
  38. package/fonts/Roboto/static/Roboto_Condensed-Italic.ttf +0 -0
  39. package/fonts/Roboto/static/Roboto_Condensed-Light.ttf +0 -0
  40. package/fonts/Roboto/static/Roboto_Condensed-LightItalic.ttf +0 -0
  41. package/fonts/Roboto/static/Roboto_Condensed-Medium.ttf +0 -0
  42. package/fonts/Roboto/static/Roboto_Condensed-MediumItalic.ttf +0 -0
  43. package/fonts/Roboto/static/Roboto_Condensed-Regular.ttf +0 -0
  44. package/fonts/Roboto/static/Roboto_Condensed-SemiBold.ttf +0 -0
  45. package/fonts/Roboto/static/Roboto_Condensed-SemiBoldItalic.ttf +0 -0
  46. package/fonts/Roboto/static/Roboto_Condensed-Thin.ttf +0 -0
  47. package/fonts/Roboto/static/Roboto_Condensed-ThinItalic.ttf +0 -0
  48. package/fonts/Roboto/static/Roboto_SemiCondensed-Black.ttf +0 -0
  49. package/fonts/Roboto/static/Roboto_SemiCondensed-BlackItalic.ttf +0 -0
  50. package/fonts/Roboto/static/Roboto_SemiCondensed-Bold.ttf +0 -0
  51. package/fonts/Roboto/static/Roboto_SemiCondensed-BoldItalic.ttf +0 -0
  52. package/fonts/Roboto/static/Roboto_SemiCondensed-ExtraBold.ttf +0 -0
  53. package/fonts/Roboto/static/Roboto_SemiCondensed-ExtraBoldItalic.ttf +0 -0
  54. package/fonts/Roboto/static/Roboto_SemiCondensed-ExtraLight.ttf +0 -0
  55. package/fonts/Roboto/static/Roboto_SemiCondensed-ExtraLightItalic.ttf +0 -0
  56. package/fonts/Roboto/static/Roboto_SemiCondensed-Italic.ttf +0 -0
  57. package/fonts/Roboto/static/Roboto_SemiCondensed-Light.ttf +0 -0
  58. package/fonts/Roboto/static/Roboto_SemiCondensed-LightItalic.ttf +0 -0
  59. package/fonts/Roboto/static/Roboto_SemiCondensed-Medium.ttf +0 -0
  60. package/fonts/Roboto/static/Roboto_SemiCondensed-MediumItalic.ttf +0 -0
  61. package/fonts/Roboto/static/Roboto_SemiCondensed-Regular.ttf +0 -0
  62. package/fonts/Roboto/static/Roboto_SemiCondensed-SemiBold.ttf +0 -0
  63. package/fonts/Roboto/static/Roboto_SemiCondensed-SemiBoldItalic.ttf +0 -0
  64. package/fonts/Roboto/static/Roboto_SemiCondensed-Thin.ttf +0 -0
  65. package/fonts/Roboto/static/Roboto_SemiCondensed-ThinItalic.ttf +0 -0
  66. package/fonts/block/0.png +0 -0
  67. package/fonts/block/1.png +0 -0
  68. package/fonts/block/2.png +0 -0
  69. package/fonts/block/3.png +0 -0
  70. package/fonts/block/4.png +0 -0
  71. package/fonts/block/5.png +0 -0
  72. package/fonts/block/6.png +0 -0
  73. package/fonts/block/7.png +0 -0
  74. package/fonts/block/8.png +0 -0
  75. package/fonts/block/9.png +0 -0
  76. package/fonts/block/A.png +0 -0
  77. package/fonts/block/B.png +0 -0
  78. package/fonts/block/C.png +0 -0
  79. package/fonts/block/D.png +0 -0
  80. package/fonts/block/E.png +0 -0
  81. package/fonts/block/F.png +0 -0
  82. package/fonts/block/G.png +0 -0
  83. package/fonts/block/H.png +0 -0
  84. package/fonts/block/I.png +0 -0
  85. package/fonts/block/J.png +0 -0
  86. package/fonts/block/K.png +0 -0
  87. package/fonts/block/L.png +0 -0
  88. package/fonts/block/M.png +0 -0
  89. package/fonts/block/N.png +0 -0
  90. package/fonts/block/O.png +0 -0
  91. package/fonts/block/P.png +0 -0
  92. package/fonts/block/Q.png +0 -0
  93. package/fonts/block/R.png +0 -0
  94. package/fonts/block/S.png +0 -0
  95. package/fonts/block/T.png +0 -0
  96. package/fonts/block/U.png +0 -0
  97. package/fonts/block/V.png +0 -0
  98. package/fonts/block/W.png +0 -0
  99. package/fonts/block/X.png +0 -0
  100. package/fonts/block/Y.png +0 -0
  101. package/fonts/block/Z.png +0 -0
  102. package/fonts/block/a.png +0 -0
  103. package/fonts/block/b.png +0 -0
  104. package/fonts/block/blockletter_alpha-numeric.json +577 -0
  105. package/fonts/block/blockletter_alpha-numeric.png +0 -0
  106. package/fonts/block/c.png +0 -0
  107. package/fonts/block/d.png +0 -0
  108. package/fonts/block/e.png +0 -0
  109. package/fonts/block/f.png +0 -0
  110. package/fonts/block/g.png +0 -0
  111. package/fonts/block/h.png +0 -0
  112. package/fonts/block/i.png +0 -0
  113. package/fonts/block/j.png +0 -0
  114. package/fonts/block/k.png +0 -0
  115. package/fonts/block/l.png +0 -0
  116. package/fonts/block/m.png +0 -0
  117. package/fonts/block/n.png +0 -0
  118. package/fonts/block/o.png +0 -0
  119. package/fonts/block/p.png +0 -0
  120. package/fonts/block/q.png +0 -0
  121. package/fonts/block/r.png +0 -0
  122. package/fonts/block/s.png +0 -0
  123. package/fonts/block/t.png +0 -0
  124. package/fonts/block/u.png +0 -0
  125. package/fonts/block/v.png +0 -0
  126. package/fonts/block/w.png +0 -0
  127. package/fonts/block/x.png +0 -0
  128. package/fonts/block/y.png +0 -0
  129. package/fonts/block/z.png +0 -0
  130. package/fonts/fonts.json +20 -0
  131. package/fonts/handwritten/0.png +0 -0
  132. package/fonts/handwritten/1.png +0 -0
  133. package/fonts/handwritten/2.png +0 -0
  134. package/fonts/handwritten/3.png +0 -0
  135. package/fonts/handwritten/4.png +0 -0
  136. package/fonts/handwritten/5.png +0 -0
  137. package/fonts/handwritten/6.png +0 -0
  138. package/fonts/handwritten/7.png +0 -0
  139. package/fonts/handwritten/8.png +0 -0
  140. package/fonts/handwritten/9.png +0 -0
  141. package/fonts/handwritten/A.png +0 -0
  142. package/fonts/handwritten/B.png +0 -0
  143. package/fonts/handwritten/C.png +0 -0
  144. package/fonts/handwritten/D.png +0 -0
  145. package/fonts/handwritten/E.png +0 -0
  146. package/fonts/handwritten/F.png +0 -0
  147. package/fonts/handwritten/G.png +0 -0
  148. package/fonts/handwritten/H.png +0 -0
  149. package/fonts/handwritten/I.png +0 -0
  150. package/fonts/handwritten/J.png +0 -0
  151. package/fonts/handwritten/K.png +0 -0
  152. package/fonts/handwritten/L.png +0 -0
  153. package/fonts/handwritten/M.png +0 -0
  154. package/fonts/handwritten/N.png +0 -0
  155. package/fonts/handwritten/O.png +0 -0
  156. package/fonts/handwritten/P.png +0 -0
  157. package/fonts/handwritten/Q.png +0 -0
  158. package/fonts/handwritten/R.png +0 -0
  159. package/fonts/handwritten/S.png +0 -0
  160. package/fonts/handwritten/T.png +0 -0
  161. package/fonts/handwritten/U.png +0 -0
  162. package/fonts/handwritten/V.png +0 -0
  163. package/fonts/handwritten/W.png +0 -0
  164. package/fonts/handwritten/X.png +0 -0
  165. package/fonts/handwritten/Y.png +0 -0
  166. package/fonts/handwritten/Z.png +0 -0
  167. package/package.json +14 -4
package/README.md CHANGED
@@ -308,55 +308,77 @@ scene.onUpdate((data) => {
308
308
 
309
309
  ## Font Setup
310
310
 
311
- ### PNG Based Fonts
311
+ ### Bundled Fonts
312
312
 
313
- Create a directory structure under `/public/fonts/`:
313
+ The package includes three default fonts ready to use:
314
314
 
315
+ | Font | Type | Characters |
316
+ |------|------|------------|
317
+ | `block` | PNG | A-Z, a-z, 0-9 (pixel/block style) |
318
+ | `handwritten` | PNG | A-Z, 0-9 (handwritten style) |
319
+ | `Roboto` | TTF | All characters |
320
+
321
+ #### Vite Projects
322
+
323
+ Add the plugin to serve bundled fonts automatically:
324
+
325
+ ```typescript
326
+ // vite.config.ts
327
+ import { defineConfig } from 'vite';
328
+ import { overlayFontsPlugin } from '@blorkfield/overlay-core/vite';
329
+
330
+ export default defineConfig({
331
+ plugins: [overlayFontsPlugin()],
332
+ });
315
333
  ```
316
- public/
317
- fonts/
318
- fonts.json
319
- handwritten/
320
- A.png
321
- B.png
322
- ...
323
- block/
324
- A.png
325
- a.png
326
- ...
334
+
335
+ That's it. The fonts are now available at `/fonts/` in your app.
336
+
337
+ #### Other Build Tools
338
+
339
+ For non-Vite projects, the bundled fonts are located at:
327
340
  ```
341
+ node_modules/@blorkfield/overlay-core/fonts/
342
+ ```
343
+
344
+ Configure your build tool to serve this directory at `/fonts/`.
328
345
 
329
- The `fonts.json` manifest:
346
+ ### Adding Custom Fonts
347
+
348
+ Custom fonts can be added alongside the bundled fonts. Create a `fonts.json` manifest that includes both:
330
349
 
331
350
  ```json
332
351
  {
333
352
  "fonts": [
334
- {
335
- "name": "handwritten",
336
- "type": "png",
337
- "characters": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
338
- },
339
- {
340
- "name": "block",
341
- "type": "png",
342
- "characters": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
343
- }
353
+ { "name": "block", "type": "png", "characters": "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789" },
354
+ { "name": "handwritten", "type": "png", "characters": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" },
355
+ { "name": "Roboto", "type": "ttf", "characters": "*", "fontUrl": "/fonts/Roboto/static/Roboto-Regular.ttf" },
356
+ { "name": "my-custom-font", "type": "png", "characters": "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" }
344
357
  ]
345
358
  }
346
359
  ```
347
360
 
348
- ### TTF Fonts
361
+ #### PNG Fonts
362
+
363
+ Create a directory with individual character images:
364
+
365
+ ```
366
+ my-custom-font/
367
+ A.png
368
+ B.png
369
+ ...
370
+ ```
371
+
372
+ #### TTF Fonts
373
+
374
+ Add the font file and reference it in the manifest:
349
375
 
350
376
  ```json
351
377
  {
352
- "fonts": [
353
- {
354
- "name": "Roboto",
355
- "type": "ttf",
356
- "characters": "*",
357
- "fontUrl": "/fonts/Roboto/static/Roboto-Regular.ttf"
358
- }
359
- ]
378
+ "name": "MyFont",
379
+ "type": "ttf",
380
+ "characters": "*",
381
+ "fontUrl": "/fonts/MyFont/MyFont-Regular.ttf"
360
382
  }
361
383
  ```
362
384
 
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/vite-plugin.ts
31
+ var vite_plugin_exports = {};
32
+ __export(vite_plugin_exports, {
33
+ default: () => vite_plugin_default,
34
+ overlayFontsPlugin: () => overlayFontsPlugin
35
+ });
36
+ module.exports = __toCommonJS(vite_plugin_exports);
37
+ var import_node_url = require("url");
38
+ var import_node_path = require("path");
39
+ var import_meta = {};
40
+ function overlayFontsPlugin() {
41
+ let fontsDir;
42
+ return {
43
+ name: "overlay-core-fonts",
44
+ configResolved() {
45
+ try {
46
+ const currentFile = (0, import_node_url.fileURLToPath)(import_meta.url);
47
+ const currentDir = (0, import_node_path.dirname)(currentFile);
48
+ fontsDir = (0, import_node_path.resolve)(currentDir, "..", "fonts");
49
+ } catch {
50
+ if (typeof __dirname !== "undefined") {
51
+ fontsDir = (0, import_node_path.resolve)(__dirname, "..", "fonts");
52
+ } else {
53
+ throw new Error("Unable to determine fonts path");
54
+ }
55
+ }
56
+ },
57
+ configureServer(server) {
58
+ return async () => {
59
+ const sirv = (await import("sirv")).default;
60
+ const serve = sirv(fontsDir, { dev: true, etag: true });
61
+ server.middlewares.use("/fonts", serve);
62
+ };
63
+ },
64
+ configurePreviewServer(server) {
65
+ return async () => {
66
+ const sirv = (await import("sirv")).default;
67
+ const serve = sirv(fontsDir, { etag: true });
68
+ server.middlewares.use("/fonts", serve);
69
+ };
70
+ }
71
+ };
72
+ }
73
+ var vite_plugin_default = overlayFontsPlugin;
74
+ // Annotate the CommonJS export names for ESM import in node:
75
+ 0 && (module.exports = {
76
+ overlayFontsPlugin
77
+ });
78
+ //# sourceMappingURL=vite-plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-plugin.ts"],"sourcesContent":["import type { Plugin, ViteDevServer, PreviewServer } from 'vite';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, resolve } from 'node:path';\n\n/**\n * Vite plugin that serves bundled fonts from the package.\n * Add this to your vite.config.ts plugins array to automatically\n * serve the default fonts at /fonts/.\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { overlayFontsPlugin } from '@blorkfield/overlay-core/vite';\n *\n * export default defineConfig({\n * plugins: [overlayFontsPlugin()],\n * });\n * ```\n */\nexport function overlayFontsPlugin(): Plugin {\n let fontsDir: string;\n\n return {\n name: 'overlay-core-fonts',\n\n configResolved() {\n // Determine the fonts directory path\n try {\n const currentFile = fileURLToPath(import.meta.url);\n const currentDir = dirname(currentFile);\n // From dist/vite-plugin.js, fonts are at ../fonts\n fontsDir = resolve(currentDir, '..', 'fonts');\n } catch {\n // Fallback for CJS where __dirname is available\n if (typeof __dirname !== 'undefined') {\n fontsDir = resolve(__dirname, '..', 'fonts');\n } else {\n throw new Error('Unable to determine fonts path');\n }\n }\n },\n\n configureServer(server: ViteDevServer) {\n // Dynamically import sirv (it's a vite dependency)\n return async () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sirv = (await import('sirv' as any)).default as (dir: string, opts?: Record<string, unknown>) => any;\n const serve = sirv(fontsDir, { dev: true, etag: true });\n server.middlewares.use('/fonts', serve);\n };\n },\n\n configurePreviewServer(server: PreviewServer) {\n return async () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sirv = (await import('sirv' as any)).default as (dir: string, opts?: Record<string, unknown>) => any;\n const serve = sirv(fontsDir, { etag: true });\n server.middlewares.use('/fonts', serve);\n };\n },\n };\n}\n\nexport default overlayFontsPlugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAA8B;AAC9B,uBAAiC;AAFjC;AAmBO,SAAS,qBAA6B;AAC3C,MAAI;AAEJ,SAAO;AAAA,IACL,MAAM;AAAA,IAEN,iBAAiB;AAEf,UAAI;AACF,cAAM,kBAAc,+BAAc,YAAY,GAAG;AACjD,cAAM,iBAAa,0BAAQ,WAAW;AAEtC,uBAAW,0BAAQ,YAAY,MAAM,OAAO;AAAA,MAC9C,QAAQ;AAEN,YAAI,OAAO,cAAc,aAAa;AACpC,yBAAW,0BAAQ,WAAW,MAAM,OAAO;AAAA,QAC7C,OAAO;AACL,gBAAM,IAAI,MAAM,gCAAgC;AAAA,QAClD;AAAA,MACF;AAAA,IACF;AAAA,IAEA,gBAAgB,QAAuB;AAErC,aAAO,YAAY;AAEjB,cAAM,QAAQ,MAAM,OAAO,MAAa,GAAG;AAC3C,cAAM,QAAQ,KAAK,UAAU,EAAE,KAAK,MAAM,MAAM,KAAK,CAAC;AACtD,eAAO,YAAY,IAAI,UAAU,KAAK;AAAA,MACxC;AAAA,IACF;AAAA,IAEA,uBAAuB,QAAuB;AAC5C,aAAO,YAAY;AAEjB,cAAM,QAAQ,MAAM,OAAO,MAAa,GAAG;AAC3C,cAAM,QAAQ,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3C,eAAO,YAAY,IAAI,UAAU,KAAK;AAAA,MACxC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;","names":[]}
@@ -0,0 +1,20 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * Vite plugin that serves bundled fonts from the package.
5
+ * Add this to your vite.config.ts plugins array to automatically
6
+ * serve the default fonts at /fonts/.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // vite.config.ts
11
+ * import { overlayFontsPlugin } from '@blorkfield/overlay-core/vite';
12
+ *
13
+ * export default defineConfig({
14
+ * plugins: [overlayFontsPlugin()],
15
+ * });
16
+ * ```
17
+ */
18
+ declare function overlayFontsPlugin(): Plugin;
19
+
20
+ export { overlayFontsPlugin as default, overlayFontsPlugin };
@@ -0,0 +1,20 @@
1
+ import { Plugin } from 'vite';
2
+
3
+ /**
4
+ * Vite plugin that serves bundled fonts from the package.
5
+ * Add this to your vite.config.ts plugins array to automatically
6
+ * serve the default fonts at /fonts/.
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * // vite.config.ts
11
+ * import { overlayFontsPlugin } from '@blorkfield/overlay-core/vite';
12
+ *
13
+ * export default defineConfig({
14
+ * plugins: [overlayFontsPlugin()],
15
+ * });
16
+ * ```
17
+ */
18
+ declare function overlayFontsPlugin(): Plugin;
19
+
20
+ export { overlayFontsPlugin as default, overlayFontsPlugin };
@@ -0,0 +1,42 @@
1
+ // src/vite-plugin.ts
2
+ import { fileURLToPath } from "url";
3
+ import { dirname, resolve } from "path";
4
+ function overlayFontsPlugin() {
5
+ let fontsDir;
6
+ return {
7
+ name: "overlay-core-fonts",
8
+ configResolved() {
9
+ try {
10
+ const currentFile = fileURLToPath(import.meta.url);
11
+ const currentDir = dirname(currentFile);
12
+ fontsDir = resolve(currentDir, "..", "fonts");
13
+ } catch {
14
+ if (typeof __dirname !== "undefined") {
15
+ fontsDir = resolve(__dirname, "..", "fonts");
16
+ } else {
17
+ throw new Error("Unable to determine fonts path");
18
+ }
19
+ }
20
+ },
21
+ configureServer(server) {
22
+ return async () => {
23
+ const sirv = (await import("sirv")).default;
24
+ const serve = sirv(fontsDir, { dev: true, etag: true });
25
+ server.middlewares.use("/fonts", serve);
26
+ };
27
+ },
28
+ configurePreviewServer(server) {
29
+ return async () => {
30
+ const sirv = (await import("sirv")).default;
31
+ const serve = sirv(fontsDir, { etag: true });
32
+ server.middlewares.use("/fonts", serve);
33
+ };
34
+ }
35
+ };
36
+ }
37
+ var vite_plugin_default = overlayFontsPlugin;
38
+ export {
39
+ vite_plugin_default as default,
40
+ overlayFontsPlugin
41
+ };
42
+ //# sourceMappingURL=vite-plugin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/vite-plugin.ts"],"sourcesContent":["import type { Plugin, ViteDevServer, PreviewServer } from 'vite';\nimport { fileURLToPath } from 'node:url';\nimport { dirname, resolve } from 'node:path';\n\n/**\n * Vite plugin that serves bundled fonts from the package.\n * Add this to your vite.config.ts plugins array to automatically\n * serve the default fonts at /fonts/.\n *\n * @example\n * ```typescript\n * // vite.config.ts\n * import { overlayFontsPlugin } from '@blorkfield/overlay-core/vite';\n *\n * export default defineConfig({\n * plugins: [overlayFontsPlugin()],\n * });\n * ```\n */\nexport function overlayFontsPlugin(): Plugin {\n let fontsDir: string;\n\n return {\n name: 'overlay-core-fonts',\n\n configResolved() {\n // Determine the fonts directory path\n try {\n const currentFile = fileURLToPath(import.meta.url);\n const currentDir = dirname(currentFile);\n // From dist/vite-plugin.js, fonts are at ../fonts\n fontsDir = resolve(currentDir, '..', 'fonts');\n } catch {\n // Fallback for CJS where __dirname is available\n if (typeof __dirname !== 'undefined') {\n fontsDir = resolve(__dirname, '..', 'fonts');\n } else {\n throw new Error('Unable to determine fonts path');\n }\n }\n },\n\n configureServer(server: ViteDevServer) {\n // Dynamically import sirv (it's a vite dependency)\n return async () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sirv = (await import('sirv' as any)).default as (dir: string, opts?: Record<string, unknown>) => any;\n const serve = sirv(fontsDir, { dev: true, etag: true });\n server.middlewares.use('/fonts', serve);\n };\n },\n\n configurePreviewServer(server: PreviewServer) {\n return async () => {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const sirv = (await import('sirv' as any)).default as (dir: string, opts?: Record<string, unknown>) => any;\n const serve = sirv(fontsDir, { etag: true });\n server.middlewares.use('/fonts', serve);\n };\n },\n };\n}\n\nexport default overlayFontsPlugin;\n"],"mappings":";AACA,SAAS,qBAAqB;AAC9B,SAAS,SAAS,eAAe;AAiB1B,SAAS,qBAA6B;AAC3C,MAAI;AAEJ,SAAO;AAAA,IACL,MAAM;AAAA,IAEN,iBAAiB;AAEf,UAAI;AACF,cAAM,cAAc,cAAc,YAAY,GAAG;AACjD,cAAM,aAAa,QAAQ,WAAW;AAEtC,mBAAW,QAAQ,YAAY,MAAM,OAAO;AAAA,MAC9C,QAAQ;AAEN,YAAI,OAAO,cAAc,aAAa;AACpC,qBAAW,QAAQ,WAAW,MAAM,OAAO;AAAA,QAC7C,OAAO;AACL,gBAAM,IAAI,MAAM,gCAAgC;AAAA,QAClD;AAAA,MACF;AAAA,IACF;AAAA,IAEA,gBAAgB,QAAuB;AAErC,aAAO,YAAY;AAEjB,cAAM,QAAQ,MAAM,OAAO,MAAa,GAAG;AAC3C,cAAM,QAAQ,KAAK,UAAU,EAAE,KAAK,MAAM,MAAM,KAAK,CAAC;AACtD,eAAO,YAAY,IAAI,UAAU,KAAK;AAAA,MACxC;AAAA,IACF;AAAA,IAEA,uBAAuB,QAAuB;AAC5C,aAAO,YAAY;AAEjB,cAAM,QAAQ,MAAM,OAAO,MAAa,GAAG;AAC3C,cAAM,QAAQ,KAAK,UAAU,EAAE,MAAM,KAAK,CAAC;AAC3C,eAAO,YAAY,IAAI,UAAU,KAAK;AAAA,MACxC;AAAA,IACF;AAAA,EACF;AACF;AAEA,IAAO,sBAAQ;","names":[]}
@@ -0,0 +1,93 @@
1
+ Copyright 2011 The Roboto Project Authors (https://github.com/googlefonts/roboto-classic)
2
+
3
+ This Font Software is licensed under the SIL Open Font License, Version 1.1.
4
+ This license is copied below, and is also available with a FAQ at:
5
+ https://openfontlicense.org
6
+
7
+
8
+ -----------------------------------------------------------
9
+ SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
10
+ -----------------------------------------------------------
11
+
12
+ PREAMBLE
13
+ The goals of the Open Font License (OFL) are to stimulate worldwide
14
+ development of collaborative font projects, to support the font creation
15
+ efforts of academic and linguistic communities, and to provide a free and
16
+ open framework in which fonts may be shared and improved in partnership
17
+ with others.
18
+
19
+ The OFL allows the licensed fonts to be used, studied, modified and
20
+ redistributed freely as long as they are not sold by themselves. The
21
+ fonts, including any derivative works, can be bundled, embedded,
22
+ redistributed and/or sold with any software provided that any reserved
23
+ names are not used by derivative works. The fonts and derivatives,
24
+ however, cannot be released under any other type of license. The
25
+ requirement for fonts to remain under this license does not apply
26
+ to any document created using the fonts or their derivatives.
27
+
28
+ DEFINITIONS
29
+ "Font Software" refers to the set of files released by the Copyright
30
+ Holder(s) under this license and clearly marked as such. This may
31
+ include source files, build scripts and documentation.
32
+
33
+ "Reserved Font Name" refers to any names specified as such after the
34
+ copyright statement(s).
35
+
36
+ "Original Version" refers to the collection of Font Software components as
37
+ distributed by the Copyright Holder(s).
38
+
39
+ "Modified Version" refers to any derivative made by adding to, deleting,
40
+ or substituting -- in part or in whole -- any of the components of the
41
+ Original Version, by changing formats or by porting the Font Software to a
42
+ new environment.
43
+
44
+ "Author" refers to any designer, engineer, programmer, technical
45
+ writer or other person who contributed to the Font Software.
46
+
47
+ PERMISSION & CONDITIONS
48
+ Permission is hereby granted, free of charge, to any person obtaining
49
+ a copy of the Font Software, to use, study, copy, merge, embed, modify,
50
+ redistribute, and sell modified and unmodified copies of the Font
51
+ Software, subject to the following conditions:
52
+
53
+ 1) Neither the Font Software nor any of its individual components,
54
+ in Original or Modified Versions, may be sold by itself.
55
+
56
+ 2) Original or Modified Versions of the Font Software may be bundled,
57
+ redistributed and/or sold with any software, provided that each copy
58
+ contains the above copyright notice and this license. These can be
59
+ included either as stand-alone text files, human-readable headers or
60
+ in the appropriate machine-readable metadata fields within text or
61
+ binary files as long as those fields can be easily viewed by the user.
62
+
63
+ 3) No Modified Version of the Font Software may use the Reserved Font
64
+ Name(s) unless explicit written permission is granted by the corresponding
65
+ Copyright Holder. This restriction only applies to the primary font name as
66
+ presented to the users.
67
+
68
+ 4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
69
+ Software shall not be used to promote, endorse or advertise any
70
+ Modified Version, except to acknowledge the contribution(s) of the
71
+ Copyright Holder(s) and the Author(s) or with their explicit written
72
+ permission.
73
+
74
+ 5) The Font Software, modified or unmodified, in part or in whole,
75
+ must be distributed entirely under this license, and must not be
76
+ distributed under any other license. The requirement for fonts to
77
+ remain under this license does not apply to any document created
78
+ using the Font Software.
79
+
80
+ TERMINATION
81
+ This license becomes null and void if any of the above conditions are
82
+ not met.
83
+
84
+ DISCLAIMER
85
+ THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
86
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
88
+ OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
89
+ COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
90
+ INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
91
+ DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
92
+ FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
93
+ OTHER DEALINGS IN THE FONT SOFTWARE.
@@ -0,0 +1,118 @@
1
+ Roboto Variable Font
2
+ ====================
3
+
4
+ This download contains Roboto as both variable fonts and static fonts.
5
+
6
+ Roboto is a variable font with these axes:
7
+ wdth
8
+ wght
9
+
10
+ This means all the styles are contained in these files:
11
+ Roboto-VariableFont_wdth,wght.ttf
12
+ Roboto-Italic-VariableFont_wdth,wght.ttf
13
+
14
+ If your app fully supports variable fonts, you can now pick intermediate styles
15
+ that aren’t available as static fonts. Not all apps support variable fonts, and
16
+ in those cases you can use the static font files for Roboto:
17
+ static/Roboto_Condensed-Thin.ttf
18
+ static/Roboto_Condensed-ExtraLight.ttf
19
+ static/Roboto_Condensed-Light.ttf
20
+ static/Roboto_Condensed-Regular.ttf
21
+ static/Roboto_Condensed-Medium.ttf
22
+ static/Roboto_Condensed-SemiBold.ttf
23
+ static/Roboto_Condensed-Bold.ttf
24
+ static/Roboto_Condensed-ExtraBold.ttf
25
+ static/Roboto_Condensed-Black.ttf
26
+ static/Roboto_SemiCondensed-Thin.ttf
27
+ static/Roboto_SemiCondensed-ExtraLight.ttf
28
+ static/Roboto_SemiCondensed-Light.ttf
29
+ static/Roboto_SemiCondensed-Regular.ttf
30
+ static/Roboto_SemiCondensed-Medium.ttf
31
+ static/Roboto_SemiCondensed-SemiBold.ttf
32
+ static/Roboto_SemiCondensed-Bold.ttf
33
+ static/Roboto_SemiCondensed-ExtraBold.ttf
34
+ static/Roboto_SemiCondensed-Black.ttf
35
+ static/Roboto-Thin.ttf
36
+ static/Roboto-ExtraLight.ttf
37
+ static/Roboto-Light.ttf
38
+ static/Roboto-Regular.ttf
39
+ static/Roboto-Medium.ttf
40
+ static/Roboto-SemiBold.ttf
41
+ static/Roboto-Bold.ttf
42
+ static/Roboto-ExtraBold.ttf
43
+ static/Roboto-Black.ttf
44
+ static/Roboto_Condensed-ThinItalic.ttf
45
+ static/Roboto_Condensed-ExtraLightItalic.ttf
46
+ static/Roboto_Condensed-LightItalic.ttf
47
+ static/Roboto_Condensed-Italic.ttf
48
+ static/Roboto_Condensed-MediumItalic.ttf
49
+ static/Roboto_Condensed-SemiBoldItalic.ttf
50
+ static/Roboto_Condensed-BoldItalic.ttf
51
+ static/Roboto_Condensed-ExtraBoldItalic.ttf
52
+ static/Roboto_Condensed-BlackItalic.ttf
53
+ static/Roboto_SemiCondensed-ThinItalic.ttf
54
+ static/Roboto_SemiCondensed-ExtraLightItalic.ttf
55
+ static/Roboto_SemiCondensed-LightItalic.ttf
56
+ static/Roboto_SemiCondensed-Italic.ttf
57
+ static/Roboto_SemiCondensed-MediumItalic.ttf
58
+ static/Roboto_SemiCondensed-SemiBoldItalic.ttf
59
+ static/Roboto_SemiCondensed-BoldItalic.ttf
60
+ static/Roboto_SemiCondensed-ExtraBoldItalic.ttf
61
+ static/Roboto_SemiCondensed-BlackItalic.ttf
62
+ static/Roboto-ThinItalic.ttf
63
+ static/Roboto-ExtraLightItalic.ttf
64
+ static/Roboto-LightItalic.ttf
65
+ static/Roboto-Italic.ttf
66
+ static/Roboto-MediumItalic.ttf
67
+ static/Roboto-SemiBoldItalic.ttf
68
+ static/Roboto-BoldItalic.ttf
69
+ static/Roboto-ExtraBoldItalic.ttf
70
+ static/Roboto-BlackItalic.ttf
71
+
72
+ Get started
73
+ -----------
74
+
75
+ 1. Install the font files you want to use
76
+
77
+ 2. Use your app's font picker to view the font family and all the
78
+ available styles
79
+
80
+ Learn more about variable fonts
81
+ -------------------------------
82
+
83
+ https://developers.google.com/web/fundamentals/design-and-ux/typography/variable-fonts
84
+ https://variablefonts.typenetwork.com
85
+ https://medium.com/variable-fonts
86
+
87
+ In desktop apps
88
+
89
+ https://theblog.adobe.com/can-variable-fonts-illustrator-cc
90
+ https://helpx.adobe.com/nz/photoshop/using/fonts.html#variable_fonts
91
+
92
+ Online
93
+
94
+ https://developers.google.com/fonts/docs/getting_started
95
+ https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Fonts/Variable_Fonts_Guide
96
+ https://developer.microsoft.com/en-us/microsoft-edge/testdrive/demos/variable-fonts
97
+
98
+ Installing fonts
99
+
100
+ MacOS: https://support.apple.com/en-us/HT201749
101
+ Linux: https://www.google.com/search?q=how+to+install+a+font+on+gnu%2Blinux
102
+ Windows: https://support.microsoft.com/en-us/help/314960/how-to-install-or-remove-a-font-in-windows
103
+
104
+ Android Apps
105
+
106
+ https://developers.google.com/fonts/docs/android
107
+ https://developer.android.com/guide/topics/ui/look-and-feel/downloadable-fonts
108
+
109
+ License
110
+ -------
111
+ Please read the full license text (OFL.txt) to understand the permissions,
112
+ restrictions and requirements for usage, redistribution, and modification.
113
+
114
+ You can use them in your products & projects – print or digital,
115
+ commercial or otherwise.
116
+
117
+ This isn't legal advice, please consider consulting a lawyer and see the full
118
+ license for all details.
Binary file