@moonbase.sh/storefront 3.0.1 → 3.1.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.
package/README.md CHANGED
@@ -140,6 +140,48 @@ A redirected buyer is always brought back to your page once they've paid, so
140
140
  The hosted checkout stays anonymous for the trip — it prefills from the order rather
141
141
  than signing the buyer into a Moonbase account, matching the overlay's behavior.
142
142
 
143
+ ### Fonts
144
+
145
+ `theme.fonts.heading` and `theme.fonts.body` each take one of:
146
+
147
+ | Value | What gets loaded |
148
+ | --- | --- |
149
+ | A built-in name, e.g. `'Montserrat'` | The widget loads that family from `assets.moonbase.sh`. |
150
+ | `'inherit'` | Nothing. The widget renders in whatever font your page already uses. |
151
+ | `'system'` | Nothing. The widget uses its own system stack. |
152
+ | `{ family }` | Nothing. Names any family your page already loads. |
153
+ | `{ family, stylesheet }` | The stylesheet you name, from wherever you host it. |
154
+
155
+ The built-in families are `Inter`, `Roboto`, `EB Garamond`, `Merriweather`, `Poppins`,
156
+ `PT Serif`, `Montserrat` and `Aleo`. Either slot accepts any of them.
157
+
158
+ They are served from Moonbase's own asset host — the same origin that serves the widget
159
+ itself, and the same payload the hosted checkout uses, so the two share a cache entry.
160
+ Nothing is requested from Google Fonts, which matters if you sell into mainland China
161
+ (where `fonts.googleapis.com` is unreachable) or want to keep visitor IPs away from
162
+ Google.
163
+
164
+ The distinction that catches people out: `'Inter'` means "load Inter for me";
165
+ `{ family: 'Inter' }` means "the family is Inter, I already load it".
166
+
167
+ ```ts
168
+ // Inherit your page's fonts. Loads nothing, requests nothing.
169
+ Moonbase.configure({ theme: { fonts: { heading: 'inherit', body: 'inherit' } } })
170
+
171
+ // Self-hosted faces — the widget injects the stylesheet.
172
+ Moonbase.configure({
173
+ theme: {
174
+ fonts: {
175
+ heading: { family: '"Noto Serif SC", serif', stylesheet: '/assets/fonts/noto-serif-sc.css' },
176
+ body: { family: '"Noto Sans SC", sans-serif', stylesheet: '/assets/fonts/noto-sans-sc.css' },
177
+ },
178
+ },
179
+ })
180
+
181
+ // A family your page already loads — the widget just names it.
182
+ Moonbase.configure({ theme: { fonts: { body: { family: '"Inter var", sans-serif' } } } })
183
+ ```
184
+
143
185
  `pricing.trailingZeros` controls how whole prices render. The default `'auto'`
144
186
  drops the decimals — a $10.00 product shows as `$10`. Set it to `'always'` to keep
145
187
  the currency's own fraction digits instead (`$10.00`, and still `¥1000` for
@@ -62,6 +62,22 @@ export declare interface MetaPixelConfig {
62
62
  declare const Moonbase_2: MoonbaseImpl;
63
63
  export default Moonbase_2;
64
64
 
65
+ /** Families the widget ships with, served from Moonbase's own asset host. */
66
+ export declare type MoonbaseBuiltInFont = 'Inter' | 'Roboto' | 'EB Garamond' | 'Merriweather' | 'Poppins' | 'PT Serif' | 'Montserrat' | 'Aleo';
67
+
68
+ export declare interface MoonbaseCustomFont {
69
+ /**
70
+ * Any CSS `font-family` list — `'PingFang SC'`, `'"Noto Sans SC", sans-serif'`. Used verbatim,
71
+ * with the widget's system stack appended as a last resort.
72
+ */
73
+ family: string;
74
+ /**
75
+ * Stylesheet providing the face, injected as `<link rel="stylesheet">`. Absolute or
76
+ * page-relative. Omit it when the host page already loads the family.
77
+ */
78
+ stylesheet?: string;
79
+ }
80
+
65
81
  export declare enum MoonbaseEvent {
66
82
  SignedIn = "signed-in",
67
83
  SignedUp = "signed-up",
@@ -151,6 +167,12 @@ export declare interface MoonbaseEventArgs {
151
167
 
152
168
  declare type MoonbaseEventEmitter = <TEvent extends MoonbaseEvent>(eventType: TEvent, event: MoonbaseEventArgs[TEvent]) => void;
153
169
 
170
+ /**
171
+ * A font slot takes a built-in name, `'inherit'` (whatever the host page renders at that spot),
172
+ * `'system'` (the widget's own system stack, no network), or a family of your own.
173
+ */
174
+ export declare type MoonbaseFont = MoonbaseBuiltInFont | 'inherit' | 'system' | MoonbaseCustomFont;
175
+
154
176
  declare class MoonbaseImpl implements MoonbaseInstance {
155
177
  private initialized;
156
178
  private pinia;
@@ -452,8 +474,21 @@ export declare interface MoonbaseOptions {
452
474
  background: 'white' | 'gray';
453
475
  };
454
476
  fonts: {
455
- heading: 'Poppins' | 'PT Serif' | 'Montserrat' | 'Aleo';
456
- body: 'Inter' | 'Roboto' | 'EB Garamond' | 'Merriweather';
477
+ /**
478
+ * Font for headings and display text. Either a built-in family, which the widget loads from
479
+ * Moonbase's own asset host, or one of:
480
+ *
481
+ * - `'inherit'` — render in whatever font the host page uses at that spot. Loads nothing.
482
+ * - `'system'` — the widget's own system stack. Loads nothing.
483
+ * - `{ family }` — name any family the page already loads.
484
+ * - `{ family, stylesheet }` — name any family and the URL to load the face from.
485
+ *
486
+ * The distinction that catches people out: `'Inter'` means "load Inter for me",
487
+ * `{ family: 'Inter' }` means "the family is Inter, I already load it".
488
+ */
489
+ heading: MoonbaseFont;
490
+ /** As `heading`, for body copy. Either slot accepts any of the built-in families. */
491
+ body: MoonbaseFont;
457
492
  };
458
493
  corners: 'sharp' | 'soft' | 'round';
459
494
  buttons: 'outlined' | 'light';