@newtonedev/components 0.1.7 → 0.1.8

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 (94) hide show
  1. package/dist/composites/actions/Button/Button.d.ts.map +1 -1
  2. package/dist/composites/form-controls/Select/Select.styles.d.ts.map +1 -1
  3. package/dist/composites/form-controls/TextInput/TextInput.styles.d.ts.map +1 -1
  4. package/dist/composites/form-controls/Toggle/Toggle.styles.d.ts.map +1 -1
  5. package/dist/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.d.ts.map +1 -1
  6. package/dist/composites/range-inputs/HueSlider/HueSlider.styles.d.ts.map +1 -1
  7. package/dist/composites/range-inputs/Slider/Slider.styles.d.ts.map +1 -1
  8. package/dist/fonts/GoogleFontLoader.d.ts +5 -4
  9. package/dist/fonts/GoogleFontLoader.d.ts.map +1 -1
  10. package/dist/fonts/SelfHostedFontLoader.d.ts +14 -0
  11. package/dist/fonts/SelfHostedFontLoader.d.ts.map +1 -0
  12. package/dist/fonts/buildGoogleFontsUrl.d.ts +1 -16
  13. package/dist/fonts/buildGoogleFontsUrl.d.ts.map +1 -1
  14. package/dist/fonts/measureFont.d.ts +18 -0
  15. package/dist/fonts/measureFont.d.ts.map +1 -0
  16. package/dist/fonts/reportQueue.d.ts +7 -0
  17. package/dist/fonts/reportQueue.d.ts.map +1 -0
  18. package/dist/fonts/useLocalCalibration.d.ts +19 -0
  19. package/dist/fonts/useLocalCalibration.d.ts.map +1 -0
  20. package/dist/fonts/useTypographyCalibrations.d.ts +11 -0
  21. package/dist/fonts/useTypographyCalibrations.d.ts.map +1 -0
  22. package/dist/index.cjs +628 -422
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.ts +7 -6
  25. package/dist/index.d.ts.map +1 -1
  26. package/dist/index.js +567 -376
  27. package/dist/index.js.map +1 -1
  28. package/dist/primitives/Icon/Icon.types.d.ts +1 -1
  29. package/dist/primitives/Icon/Icon.types.d.ts.map +1 -1
  30. package/dist/primitives/Text/Text.d.ts +33 -8
  31. package/dist/primitives/Text/Text.d.ts.map +1 -1
  32. package/dist/primitives/Text/Text.spans.d.ts +22 -0
  33. package/dist/primitives/Text/Text.spans.d.ts.map +1 -0
  34. package/dist/primitives/Text/Text.types.d.ts +75 -27
  35. package/dist/primitives/Text/Text.types.d.ts.map +1 -1
  36. package/dist/primitives/Text/index.d.ts +23 -2
  37. package/dist/primitives/Text/index.d.ts.map +1 -1
  38. package/dist/primitives/index.d.ts +1 -1
  39. package/dist/primitives/index.d.ts.map +1 -1
  40. package/dist/registry/codegen.d.ts.map +1 -1
  41. package/dist/registry/registry.d.ts.map +1 -1
  42. package/dist/registry/types.d.ts +2 -0
  43. package/dist/registry/types.d.ts.map +1 -1
  44. package/dist/theme/NewtoneProvider.d.ts +9 -1
  45. package/dist/theme/NewtoneProvider.d.ts.map +1 -1
  46. package/dist/theme/defaults.d.ts +1 -0
  47. package/dist/theme/defaults.d.ts.map +1 -1
  48. package/dist/theme/types.d.ts +48 -32
  49. package/dist/theme/types.d.ts.map +1 -1
  50. package/dist/theme/useBreakpoint.d.ts +9 -0
  51. package/dist/theme/useBreakpoint.d.ts.map +1 -0
  52. package/dist/tokens/computeTokens.d.ts +9 -22
  53. package/dist/tokens/computeTokens.d.ts.map +1 -1
  54. package/dist/tokens/types.d.ts +40 -22
  55. package/dist/tokens/types.d.ts.map +1 -1
  56. package/package.json +2 -1
  57. package/src/composites/actions/Button/Button.styles.ts +3 -3
  58. package/src/composites/actions/Button/Button.tsx +3 -2
  59. package/src/composites/form-controls/Select/Select.styles.ts +8 -8
  60. package/src/composites/form-controls/Select/Select.tsx +1 -1
  61. package/src/composites/form-controls/Select/SelectOption.tsx +3 -3
  62. package/src/composites/form-controls/TextInput/TextInput.styles.ts +5 -5
  63. package/src/composites/form-controls/Toggle/Toggle.styles.ts +3 -3
  64. package/src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts +6 -6
  65. package/src/composites/range-inputs/HueSlider/HueSlider.styles.ts +9 -9
  66. package/src/composites/range-inputs/Slider/Slider.styles.ts +9 -9
  67. package/src/fonts/GoogleFontLoader.tsx +25 -10
  68. package/src/fonts/SelfHostedFontLoader.tsx +44 -0
  69. package/src/fonts/buildGoogleFontsUrl.ts +2 -31
  70. package/src/fonts/measureFont.ts +42 -0
  71. package/src/fonts/reportQueue.ts +54 -0
  72. package/src/fonts/useLocalCalibration.ts +97 -0
  73. package/src/fonts/useTypographyCalibrations.ts +15 -0
  74. package/src/index.ts +16 -7
  75. package/src/primitives/Frame/Frame.tsx +3 -3
  76. package/src/primitives/Icon/Icon.tsx +1 -1
  77. package/src/primitives/Icon/Icon.types.ts +1 -1
  78. package/src/primitives/Text/Text.spans.ts +57 -0
  79. package/src/primitives/Text/Text.tsx +205 -53
  80. package/src/primitives/Text/Text.types.ts +80 -27
  81. package/src/primitives/Text/index.ts +27 -3
  82. package/src/primitives/index.ts +3 -2
  83. package/src/registry/codegen.ts +1 -0
  84. package/src/registry/registry.ts +55 -53
  85. package/src/registry/types.ts +2 -0
  86. package/src/theme/NewtoneProvider.tsx +18 -2
  87. package/src/theme/defaults.ts +8 -28
  88. package/src/theme/types.ts +63 -33
  89. package/src/theme/useBreakpoint.ts +14 -0
  90. package/src/tokens/computeTokens.ts +23 -19
  91. package/src/tokens/types.ts +10 -24
  92. package/dist/fonts/googleFonts.d.ts +0 -20
  93. package/dist/fonts/googleFonts.d.ts.map +0 -1
  94. package/src/fonts/googleFonts.ts +0 -87
@@ -1 +1 @@
1
- {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/composites/actions/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,IAAI,EACJ,YAAqB,EACrB,OAAmB,EACnB,QAAoB,EACpB,IAAW,EACX,QAAgB,EAChB,KAAK,EACL,SAAS,EACT,GAAG,cAAc,EAClB,EAAE,WAAW,qBAiEb"}
1
+ {"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../../../src/composites/actions/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAOlD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,wBAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,IAAI,EACJ,YAAqB,EACrB,OAAmB,EACnB,QAAoB,EACpB,IAAW,EACX,QAAgB,EAChB,KAAK,EACL,SAAS,EACT,GAAG,cAAc,EAClB,EAAE,WAAW,qBAkEb"}
@@ -1 +1 @@
1
- {"version":3,"file":"Select.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/form-controls/Select/Select.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,MAAM,EAAE,OAAO;;;;;;;;oBAiBsC,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAiCH,GAAG;;;;;;;;EASzD"}
1
+ {"version":3,"file":"Select.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/form-controls/Select/Select.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,QAAQ,EAAE,OAAO,EACjB,IAAI,EAAE,IAAI,GAAG,IAAI,EACjB,MAAM,EAAE,OAAO;;;;;;;;oBAiBgD,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAiCH,GAAG;;;;;;;;EASnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"TextInput.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/form-controls/TextInput/TextInput.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;oBAQrB,GAAG;;;;;;;;;;;;;;;EAkBzD"}
1
+ {"version":3,"file":"TextInput.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/form-controls/TextInput/TextInput.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;oBAQX,GAAG;;;;;;;;;;;;;;;EAkBnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Toggle.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/form-controls/Toggle/Toggle.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO5D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,OAAO;;;;;;;;;;oBAYoC,GAAG;;;;;;;;;;;;;;;;;;EAqBzD"}
1
+ {"version":3,"file":"Toggle.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/form-controls/Toggle/Toggle.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAO5D,wBAAgB,eAAe,CAC7B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,OAAO,EACd,QAAQ,EAAE,OAAO;;;;;;;;;;oBAY8C,GAAG;;;;;;;;;;;;;;;;;;EAqBnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"ColorScaleSlider.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,YAAY,KAAK,CAAC;AACxB,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;;;;;;;oBAc5B,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAgCL,GAAG;;;EAIvD;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"ColorScaleSlider.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/ColorScaleSlider/ColorScaleSlider.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,QAAA,MAAM,YAAY,KAAK,CAAC;AACxB,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;;;;;;;oBAclB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;oBAgCH,GAAG;;;EAInE;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"HueSlider.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/HueSlider/HueSlider.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,eAAO,MAAM,UAAU,KAAK,CAAC;AAG7B,0DAA0D;AAC1D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY5C;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAKnE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;;;;;;;oBAcrB,GAAG;;;;;;oBAML,GAAG;;;;;;;;;;;;;;oBAcH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BvD"}
1
+ {"version":3,"file":"HueSlider.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/HueSlider/HueSlider.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,eAAO,MAAM,UAAU,KAAK,CAAC;AAG7B,0DAA0D;AAC1D,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAY5C;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAKnE;AAED,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;;;;;;;oBAcX,GAAG;;;;;;oBAMH,GAAG;;;;;;;;;;;;;;oBAcH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BnE"}
@@ -1 +1 @@
1
- {"version":3,"file":"Slider.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/Slider/Slider.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;;;;;;;oBAclB,GAAG;;;;;;oBAML,GAAG;;;;;;;;;;;;;;oBAcH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BvD"}
1
+ {"version":3,"file":"Slider.styles.d.ts","sourceRoot":"","sources":["../../../../src/composites/range-inputs/Slider/Slider.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAG5D,eAAO,MAAM,UAAU,KAAK,CAAC;AAE7B,wBAAgB,eAAe,CAAC,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,OAAO;;;;;;;;;;;;;oBAcR,GAAG;;;;;;oBAMH,GAAG;;;;;;;;;;;;;;oBAcH,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA+BnE"}
@@ -1,9 +1,10 @@
1
- import type { FontConfig } from '../theme/types';
1
+ import type { FontSlot } from '../theme/types';
2
2
  interface GoogleFontLoaderProps {
3
3
  readonly fonts: {
4
- readonly mono: FontConfig;
5
- readonly display: FontConfig;
6
- readonly default: FontConfig;
4
+ readonly main: FontSlot;
5
+ readonly display: FontSlot;
6
+ readonly mono: FontSlot;
7
+ readonly currency: FontSlot;
7
8
  };
8
9
  }
9
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"GoogleFontLoader.d.ts","sourceRoot":"","sources":["../../src/fonts/GoogleFontLoader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;QAC1B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;QAC7B,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;KAC9B,CAAC;CACH;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,qBAAqB,QA4ChE"}
1
+ {"version":3,"file":"GoogleFontLoader.d.ts","sourceRoot":"","sources":["../../src/fonts/GoogleFontLoader.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG/C,UAAU,qBAAqB;IAC7B,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QACxB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;QAC3B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC;KAC7B,CAAC;CACH;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,KAAK,EAAE,EAAE,qBAAqB,QA0DhE"}
@@ -0,0 +1,14 @@
1
+ interface SelfHostedFontLoaderProps {
2
+ /** Raw @font-face CSS string from the theme API. */
3
+ readonly fontFaceCss: string;
4
+ }
5
+ /**
6
+ * Injects self-hosted @font-face CSS into <head> via a <style> tag.
7
+ * Used instead of GoogleFontLoader when self-hosted font CSS is available.
8
+ *
9
+ * Uses imperative DOM manipulation because react-native-web's View
10
+ * cannot render <style> elements.
11
+ */
12
+ export declare function SelfHostedFontLoader({ fontFaceCss }: SelfHostedFontLoaderProps): null;
13
+ export {};
14
+ //# sourceMappingURL=SelfHostedFontLoader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelfHostedFontLoader.d.ts","sourceRoot":"","sources":["../../src/fonts/SelfHostedFontLoader.tsx"],"names":[],"mappings":"AAEA,UAAU,yBAAyB;IACjC,oDAAoD;IACpD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,WAAW,EAAE,EAAE,yBAAyB,QA6B9E"}
@@ -1,17 +1,2 @@
1
- import type { FontConfig } from '../theme/types';
2
- /**
3
- * Build a Google Fonts CSS API v2 URL for all google-type fonts in the config.
4
- * Returns null if no Google fonts are present.
5
- *
6
- * @example
7
- * ```
8
- * buildGoogleFontsUrl(fonts)
9
- * // => "https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Fira+Code:wght@400;500;600;700&display=swap"
10
- * ```
11
- */
12
- export declare function buildGoogleFontsUrl(fonts: {
13
- readonly mono: FontConfig;
14
- readonly display: FontConfig;
15
- readonly default: FontConfig;
16
- }): string | null;
1
+ export { buildGoogleFontsUrl } from '@newtonedev/fonts';
17
2
  //# sourceMappingURL=buildGoogleFontsUrl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"buildGoogleFontsUrl.d.ts","sourceRoot":"","sources":["../../src/fonts/buildGoogleFontsUrl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAEjD;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE;IAAE,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,UAAU,CAAA;CAAE,GAC/F,MAAM,GAAG,IAAI,CAgBf"}
1
+ {"version":3,"file":"buildGoogleFontsUrl.d.ts","sourceRoot":"","sources":["../../src/fonts/buildGoogleFontsUrl.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC"}
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Measure the average character width ratio for a font using the Canvas API.
3
+ *
4
+ * Waits for the font to load via `document.fonts.load()` before measuring.
5
+ * Falls back to 0.55 if the browser context is unavailable, the font fails
6
+ * to load, or canvas is not supported.
7
+ *
8
+ * The returned ratio represents `avgCharWidth / fontSize`. Multiply by a
9
+ * desired fontSize to estimate character widths for that font.
10
+ *
11
+ * @param fontFamily - Font family name, e.g. "Inter" or "system-ui"
12
+ * @param fontWeight - CSS font-weight number, e.g. 400
13
+ * @param fallback - CSS fallback stack, e.g. "sans-serif"
14
+ * @param fontSize - Reference font size in px (default 16)
15
+ * @returns Average character width ratio, e.g. 0.52 for Inter
16
+ */
17
+ export declare function measureAvgCharWidth(fontFamily: string, fontWeight: number, fallback: string, fontSize?: number): Promise<number>;
18
+ //# sourceMappingURL=measureFont.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"measureFont.d.ts","sourceRoot":"","sources":["../../src/fonts/measureFont.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,mBAAmB,CACvC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,QAAQ,SAAK,GACZ,OAAO,CAAC,MAAM,CAAC,CAajB"}
@@ -0,0 +1,7 @@
1
+ import type { ObserverPayload } from '@newtonedev/fonts';
2
+ /**
3
+ * Enqueue a typography observation for batch reporting.
4
+ * Resets the 2s debounce timer on each call.
5
+ */
6
+ export declare function enqueueObservation(endpoint: string, payload: ObserverPayload): void;
7
+ //# sourceMappingURL=reportQueue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reportQueue.d.ts","sourceRoot":"","sources":["../../src/fonts/reportQueue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AA6CzD;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,IAAI,CAInF"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Returns the avgCharWidth ratio for a font, using a device-local measurement
3
+ * cached in localStorage (Layer 2 calibration).
4
+ *
5
+ * Resolution order:
6
+ * 1. localStorage cache (if fresh, < 7 days old)
7
+ * 2. `baseCalibration` (Layer 1 — editor-time canvas measurement from theme config)
8
+ * 3. 0.55 (fallback constant)
9
+ *
10
+ * On mount, measures the font if the cache is stale or absent, then updates
11
+ * localStorage and triggers a re-render with the device-accurate ratio.
12
+ *
13
+ * @param fontFamily - CSS font family name, e.g. "Inter"
14
+ * @param fontWeight - CSS font-weight number, e.g. 400
15
+ * @param fallback - CSS fallback stack, e.g. "sans-serif"
16
+ * @param baseCalibration - Layer 1 ratio from `themeConfig.typography.calibrations`
17
+ */
18
+ export declare function useLocalCalibration(fontFamily: string, fontWeight: number, fallback: string, baseCalibration?: number): number;
19
+ //# sourceMappingURL=useLocalCalibration.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useLocalCalibration.d.ts","sourceRoot":"","sources":["../../src/fonts/useLocalCalibration.ts"],"names":[],"mappings":"AAoCA;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,MAAM,GACvB,MAAM,CAsCR"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Returns the per-font avgCharWidth calibrations from the current theme config.
3
+ *
4
+ * These are Layer 1 (editor-time) calibrations — measured with canvas at publish
5
+ * time and stored in `themeConfig.typography.calibrations`. Use `useLocalCalibration`
6
+ * to overlay device-local (Layer 2) measurements on top.
7
+ *
8
+ * @returns Record of fontFamily → avgCharWidthRatio, or an empty object if absent.
9
+ */
10
+ export declare function useTypographyCalibrations(): Record<string, number>;
11
+ //# sourceMappingURL=useTypographyCalibrations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useTypographyCalibrations.d.ts","sourceRoot":"","sources":["../../src/fonts/useTypographyCalibrations.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,wBAAgB,yBAAyB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAGlE"}