@molecule/app-legal-pages-solid 0.0.1-stage → 1.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.
Files changed (2) hide show
  1. package/README.md +530 -4
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,11 +1,537 @@
1
+ <!--
2
+ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
+ Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
+ Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
+ To change this document, edit the module-level JSDoc in src/index.ts.
6
+ Generated: 2026-11-21T12:46:40.120Z
7
+ -->
8
+
1
9
  # @molecule/app-legal-pages-solid
2
10
 
3
- Solid page scaffolds for Terms, Privacy, and PlanUpdated (i18n-driven, customizable keys)
11
+ Solid page scaffolds for Terms, Privacy, and PlanUpdated.
12
+
13
+ Exports:
14
+
15
+ - Drop-in pages: `<TermsPage>`, `<PrivacyPage>` (boilerplate bodies with
16
+ configurable i18n keys), `<PlanUpdatedPage>` (post-checkout confirmation).
17
+ - Bonded-content pages: `<LegalContentPage kind="privacy" | "terms">` — renders
18
+ the SAME legal HTML as the footer modals (`content.privacyPolicy` /
19
+ `content.termsOfService` from `@molecule/app-locales-legal-default`), inside
20
+ the branded `<ContentPageShell>`.
21
+ - In-place modals: `<LegalModalLinks>` + `useLegalModals()` — Privacy/Terms
22
+ triggers that open modals instead of navigating.
23
+ - Primitives: `<ContentPageShell>` (hero band + surface card),
24
+ `<LegalPageLayout>`, `<LegalPageSection>`.
25
+
26
+ This is the Solid counterpart of `@molecule/app-legal-pages-react`: the same
27
+ export names, the same props (React names), the same ClassMap tokens and the
28
+ same DOM for the same input. Switching framework is a change of package name
29
+ in the imports only.
30
+
31
+ > **Auto-generated, AI-first package reference** for the [molecule.dev](https://molecule.dev) ecosystem.
32
+ > It is written to be read by coding agents as much as by people, and is generated from this
33
+ > package's source — edit `src/index.ts` JSDoc, not this file.
34
+
35
+ ## Quick Start
36
+
37
+ ```tsx
38
+ import { ContentPageShell, LegalPageLayout, LegalPageSection, TermsPage } from '@molecule/app-legal-pages-solid'
39
+
40
+ // Drop-in Terms page (boilerplate body):
41
+ <TermsPage />
42
+
43
+ // Custom Terms page with structured sections:
44
+ <ContentPageShell eyebrow="Legal" title="Terms of Service" subtitle="Last updated June 2025">
45
+ <LegalPageLayout title="Terms of Service">
46
+ <LegalPageSection title="Acceptance">
47
+ <p>By using this service you agree to these terms.</p>
48
+ </LegalPageSection>
49
+ </LegalPageLayout>
50
+ </ContentPageShell>
51
+ ```
52
+
53
+ ## Type
54
+
55
+ `feature`
4
56
 
57
+ ## Installation
58
+
59
+ ```bash
60
+ npm install @molecule/app-legal-pages-solid @molecule/app-solid @molecule/app-ui @molecule/app-ui-solid solid-js
5
61
  ```
6
- npm install @molecule/app-legal-pages-solid
62
+
63
+ ## API
64
+
65
+ ### Interfaces
66
+
67
+ #### `ContentPageShellProps`
68
+
69
+ Props accepted by the {@link ContentPageShell} component.
70
+
71
+ ```typescript
72
+ interface ContentPageShellProps {
73
+ /** `data-mol-id` applied to the hero band for AI-agent selectors. */
74
+ dataMolId?: string
75
+ /** Small uppercase label above the title (e.g. "Legal", "Billing"). */
76
+ eyebrow?: JSX.Element
77
+ /**
78
+ * Page title, rendered in the app's headline font inside the hero band.
79
+ * Omit to skip the hero entirely (e.g. for content that renders its own
80
+ * heading, like a pricing tier grid).
81
+ */
82
+ title?: JSX.Element
83
+ /** Optional supporting line under the title (e.g. "Last updated …"). */
84
+ subtitle?: JSX.Element
85
+ /** App-specific top navigation, rendered above the hero. */
86
+ header?: JSX.Element
87
+ /** App-specific footer, rendered below the content. */
88
+ footer?: JSX.Element
89
+ /** Page body. Rendered inside a surface card unless `bare` is set. */
90
+ children?: JSX.Element
91
+ /**
92
+ * When true, the body is rendered without the surface card wrapper — for
93
+ * content that brings its own surfaces (e.g. a pricing tier grid).
94
+ */
95
+ bare?: boolean
96
+ /** Container width passed to ClassMap `container({ size })`. Defaults to `'md'`. */
97
+ containerSize?: 'sm' | 'md' | 'lg' | 'xl'
98
+ }
7
99
  ```
8
100
 
9
- Part of the [Molecule](https://www.molecule.dev) package fleet. This page carries the manifest summary; the full generated documentation ships with the package's first committed version.
101
+ #### `LegalContentPageProps`
102
+
103
+ Props accepted by the {@link LegalContentPage} component.
104
+
105
+ ```typescript
106
+ interface LegalContentPageProps {
107
+ /** Which legal document to render. */
108
+ kind: LegalKind
109
+ /** App name interpolated into the policy body (privacy uses `{{appName}}`). */
110
+ appName?: string
111
+ /**
112
+ * Lazy-loader for the legal HTML (pass `loadContent` from the app's
113
+ * `src/config.ts`, which re-exports it from
114
+ * `@molecule/app-locales-legal-default`). Called once on mount so the
115
+ * standalone page shows the **same** bonded content as the footer modal.
116
+ */
117
+ loadContent?: (key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void
118
+ /** App-specific top navigation, rendered above the hero. */
119
+ header?: JSX.Element
120
+ /** App-specific footer, rendered below the content. */
121
+ footer?: JSX.Element
122
+ /** i18n key for the small uppercase eyebrow. Defaults to `nav.legal`. */
123
+ eyebrowKey?: string
124
+ /** Default eyebrow text. Defaults to `Legal`. */
125
+ eyebrowDefault?: string
126
+ }
127
+ ```
128
+
129
+ #### `UseLegalModalsOptions`
130
+
131
+ Shared options for the legal-modal hook + component.
132
+
133
+ ```typescript
134
+ interface UseLegalModalsOptions {
135
+ /** App name interpolated into the privacy AND terms bodies (`{{appName}}`). */
136
+ appName?: string
137
+ /**
138
+ * Lazy-loader for the legal HTML — pass `loadContent` from the app's
139
+ * `src/config.ts`. Called right before a modal opens so the bonded
140
+ * content is present on first render.
141
+ */
142
+ loadContent?: (key: 'privacyPolicy' | 'termsOfService') => Promise<void> | void
143
+ }
144
+ ```
145
+
146
+ #### `LegalModalsApi`
147
+
148
+ Imperative API returned by {@link useLegalModals}.
149
+
150
+ ```typescript
151
+ interface LegalModalsApi {
152
+ /** Open the Privacy Policy modal (loads content first). */
153
+ openPrivacy: () => Promise<void>
154
+ /** Open the Terms of Service modal (loads content first). */
155
+ openTerms: () => Promise<void>
156
+ /**
157
+ * The two `<Modal>` elements — render `{modals}` once anywhere in the tree.
158
+ * Solid JSX props stay reactive, so the pair follows the open state.
159
+ */
160
+ modals: JSX.Element
161
+ }
162
+ ```
163
+
164
+ #### `LegalModalLinksProps`
165
+
166
+ Props accepted by the {@link LegalModalLinks} component.
167
+
168
+ ```typescript
169
+ interface LegalModalLinksProps extends UseLegalModalsOptions {
170
+ /** className applied to each trigger `<button>` (match the footer's link style). */
171
+ linkClassName?: string
172
+ /** Which links to render. Defaults to `'both'`. */
173
+ show?: 'both' | 'privacy' | 'terms'
174
+ /** Override the Privacy label (defaults to i18n `footer.privacyPolicy`). */
175
+ privacyLabel?: JSX.Element
176
+ /** Override the Terms label (defaults to i18n `footer.termsOfService`). */
177
+ termsLabel?: JSX.Element
178
+ }
179
+ ```
180
+
181
+ #### `LegalPageLayoutProps`
182
+
183
+ Props accepted by the {@link LegalPageLayout} component.
184
+
185
+ ```typescript
186
+ interface LegalPageLayoutProps {
187
+ /** `data-mol-id` for AI agent selectors. */
188
+ dataMolId?: string
189
+ /** Rendered heading text (usually `t('...')`). */
190
+ title: JSX.Element
191
+ /** Body content — paragraphs, `<LegalPageSection>`s, etc. */
192
+ children?: JSX.Element
193
+ /** ClassMap `container({size})` value. Defaults to `'md'`. */
194
+ containerSize?: 'sm' | 'md' | 'lg' | 'xl'
195
+ /** Stack gap between body children passed to ClassMap `stack()`. Defaults to 4. */
196
+ stackGap?: SpacingScale
197
+ /** Override the main wrapper's className (used by apps with custom chrome). */
198
+ mainClassName?: string
199
+ /** Override the body wrapper's className. */
200
+ bodyClassName?: string
201
+ }
202
+ ```
203
+
204
+ #### `LegalPageSectionProps`
205
+
206
+ Props accepted by the {@link LegalPageSection} component.
207
+
208
+ ```typescript
209
+ interface LegalPageSectionProps {
210
+ /** Rendered heading text. */
211
+ title: JSX.Element
212
+ /** Section body — one or more paragraphs. */
213
+ children?: JSX.Element
214
+ /** Stack gap between heading and body (ClassMap `stack()`). Defaults to 2. */
215
+ stackGap?: SpacingScale
216
+ }
217
+ ```
218
+
219
+ #### `PlanUpdatedPageProps`
220
+
221
+ Props accepted by the {@link PlanUpdatedPage} component.
222
+
223
+ ```typescript
224
+ interface PlanUpdatedPageProps {
225
+ /** i18n key for the primary message heading. */
226
+ messageKey?: string
227
+ /** Default message when the key is missing. */
228
+ messageDefault?: string
229
+ /** i18n key for the secondary heading. */
230
+ thankYouKey?: string
231
+ /** Default thank-you text when the key is missing. */
232
+ thankYouDefault?: string
233
+ /** i18n key for the action-button label. */
234
+ actionKey?: string
235
+ /** Default action label when the key is missing. */
236
+ actionDefault?: string
237
+ /** Href the action button navigates to. Defaults to `/`. */
238
+ actionHref?: string
239
+ /**
240
+ * Provider name to verify the purchase with when the return URL carries no
241
+ * `provider` parameter. Verification is skipped when neither names one.
242
+ */
243
+ provider?: string
244
+ /**
245
+ * Set `false` to render the confirmation without verifying the purchase —
246
+ * only for apps that grant the plan some other way.
247
+ */
248
+ verify?: boolean
249
+ }
250
+ ```
251
+
252
+ #### `PrivacyPageProps`
253
+
254
+ Props accepted by the {@link PrivacyPage} component.
255
+
256
+ ```typescript
257
+ interface PrivacyPageProps {
258
+ /** i18n key for the page heading. Defaults to `privacy.title`. */
259
+ titleKey?: string
260
+ /** Default for the heading when the key is missing. Defaults to `"Privacy"`. */
261
+ titleDefault?: string
262
+ /** i18n key for the single-paragraph intro (ignored when `children` is passed). */
263
+ introKey?: string
264
+ /** Default intro body when the key is missing. */
265
+ introDefault?: string
266
+ /** Optional override body — use when the page has real content. */
267
+ children?: JSX.Element
268
+ /** Stack gap between body children. */
269
+ stackGap?: SpacingScale
270
+ }
271
+ ```
272
+
273
+ #### `TermsPageProps`
274
+
275
+ Props accepted by the {@link TermsPage} component.
276
+
277
+ ```typescript
278
+ interface TermsPageProps {
279
+ /** i18n key for the page heading. Defaults to `terms.title`. */
280
+ titleKey?: string
281
+ /** Default for the heading when the i18n key is missing. Defaults to `"Terms"`. */
282
+ titleDefault?: string
283
+ /** i18n key for the single-paragraph intro (ignored when `children` is passed). */
284
+ introKey?: string
285
+ /** Default intro body when the key is missing. */
286
+ introDefault?: string
287
+ /** Optional override body — use when the page has real content, not boilerplate. */
288
+ children?: JSX.Element
289
+ /** Stack gap between body children. */
290
+ stackGap?: SpacingScale
291
+ }
292
+ ```
293
+
294
+ ### Types
295
+
296
+ #### `LegalKind`
297
+
298
+ Which legal document a `LegalContentPage` renders.
299
+
300
+ ```typescript
301
+ type LegalKind = 'privacy' | 'terms'
302
+ ```
303
+
304
+ ### Functions
305
+
306
+ #### `ContentPageShell(props)`
307
+
308
+ Branded shell for public content pages (Privacy, Terms, Pricing,
309
+ PlanUpdated, …).
310
+
311
+ Renders the app's own `header`/`footer` slots around a themed hero band
312
+ (eyebrow + title + subtitle) and a surface-card content area. Everything
313
+ is driven by theme tokens (`--mol-color-*`) and the app's font utility
314
+ classes (`font-display` for the title, `font-body`/`font-label` for the
315
+ rest), so each app's palette and typography are applied automatically
316
+ without per-app overrides.
317
+
318
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `ContentPageShell` —
319
+ the same props (React names), the same ClassMap tokens and the same DOM for
320
+ the same input.
321
+
322
+ ```typescript
323
+ function ContentPageShell(props: ContentPageShellProps): JSX.Element
324
+ ```
325
+
326
+ - `props` — Component props (see {@link ContentPageShellProps}).
327
+
328
+ **Returns:** The rendered content-page shell.
329
+
330
+ #### `LegalContentPage(props)`
331
+
332
+ Standalone Privacy / Terms page that renders the **same** bonded legal
333
+ HTML the footer modal shows (`content.privacyPolicy` /
334
+ `content.termsOfService` from `@molecule/app-locales-legal-default`),
335
+ wrapped in the branded `ContentPageShell`.
336
+
337
+ This keeps the in-place footer modal and the standalone `/privacy`,
338
+ `/terms` routes perfectly in sync — one source of legal copy, two
339
+ surfaces.
340
+
341
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `LegalContentPage` —
342
+ the same props (React names), the same DOM for the same input.
343
+
344
+ ```typescript
345
+ function LegalContentPage(props: LegalContentPageProps): JSX.Element
346
+ ```
347
+
348
+ - `props` — Component props (see {@link LegalContentPageProps}).
349
+
350
+ **Returns:** The rendered legal content page.
351
+
352
+ #### `useLegalModals(options)`
353
+
354
+ Headless hook powering in-place Privacy/Terms modals. Use it when the
355
+ triggers live in different parts of a bespoke footer (or a signup page);
356
+ render `{modals}` once and wire `openPrivacy`/`openTerms` to your own
357
+ links/buttons.
358
+
359
+ The modal body is the SAME bonded HTML the `LegalContentPage` standalone
360
+ routes render (`content.privacyPolicy` / `content.termsOfService`), so every
361
+ legal surface stays in sync.
362
+
363
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `useLegalModals` —
364
+ the same options; the element pair's props stay reactive, so it follows the
365
+ open state.
366
+
367
+ ```typescript
368
+ function useLegalModals(options?: UseLegalModalsOptions): LegalModalsApi
369
+ ```
370
+
371
+ - `options` — See {@link UseLegalModalsOptions}.
372
+
373
+ **Returns:** The imperative {@link LegalModalsApi}.
374
+
375
+ #### `LegalModalLinks(props)`
376
+
377
+ Drop-in Privacy/Terms links that open IN-PLACE modals instead of
378
+ navigating — for bespoke footers and signup pages.
379
+
380
+ Renders the trigger button(s) + the modals together, so it suits the
381
+ common case where the two legal links are adjacent. For separated
382
+ triggers, use `useLegalModals` directly.
383
+
384
+ ```typescript
385
+ function LegalModalLinks(props: LegalModalLinksProps): JSX.Element
386
+ ```
387
+
388
+ - `props` — Component props (see {@link LegalModalLinksProps}).
389
+
390
+ **Returns:** The trigger button(s) and their modals.
391
+
392
+ #### `LegalPageLayout(props)`
393
+
394
+ Canonical Terms / Privacy layout shell.
395
+
396
+ `<main data-mol-id={...} class="container py-12">
397
+ <h1>{title}</h1>
398
+ <div class="prose stack">{children}</div>
399
+ </main>`
400
+
401
+ Use this as the content shell for legal pages. Custom chrome (landing
402
+ top-nav, admin sidebar, etc.) should wrap the shell at the call site.
403
+
404
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `LegalPageLayout` —
405
+ the same props (React names), the same DOM for the same input.
406
+
407
+ ```typescript
408
+ function LegalPageLayout(props: LegalPageLayoutProps): JSX.Element
409
+ ```
410
+
411
+ - `props` — Component props (see {@link LegalPageLayoutProps}).
412
+
413
+ **Returns:** The rendered legal page layout.
414
+
415
+ #### `LegalPageSection(props)`
416
+
417
+ One sub-section of a legal page (`h2` + body) styled for use inside
418
+ `LegalPageLayout`.
419
+
420
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `LegalPageSection` —
421
+ the same props (React names), the same DOM for the same input.
422
+
423
+ ```typescript
424
+ function LegalPageSection(props: LegalPageSectionProps): JSX.Element
425
+ ```
426
+
427
+ - `props` — Component props (see {@link LegalPageSectionProps}).
428
+
429
+ **Returns:** The rendered legal page section.
430
+
431
+ #### `PlanUpdatedPage(props)`
432
+
433
+ "Plan updated" confirmation screen.
434
+
435
+ Waits for auth state to initialize, then shows a two-line confirmation
436
+ with a single return-home action. i18n keys are configurable so apps
437
+ can match their existing locale shape.
438
+
439
+ This is also where a hosted checkout's purchase is CONFIRMED: the provider
440
+ returns the buyer here with the payment id in the query, and
441
+ `useVerifyPaymentReturn` posts it to
442
+ `/users/:id/verify-payment/:provider` from the app origin, where the
443
+ session cookie applies. The page shows a spinner while that is in flight and
444
+ a retry if it fails, so a failed confirmation never reads as a thank-you.
445
+
446
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `PlanUpdatedPage` —
447
+ the same props (React names), the same DOM for the same input.
448
+
449
+ ```typescript
450
+ function PlanUpdatedPage(props: PlanUpdatedPageProps): JSX.Element
451
+ ```
452
+
453
+ - `props` — Component props (see {@link PlanUpdatedPageProps}).
454
+
455
+ **Returns:** The rendered plan-updated confirmation page.
456
+
457
+ #### `PrivacyPage(props)`
458
+
459
+ Default Privacy-policy page scaffold.
460
+
461
+ With no props, renders the canonical boilerplate Privacy page. Pass
462
+ `children` to render real content.
463
+
464
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `PrivacyPage` — the
465
+ same props (React names), the same DOM for the same input.
466
+
467
+ ```typescript
468
+ function PrivacyPage(props: PrivacyPageProps): JSX.Element
469
+ ```
470
+
471
+ - `props` — Component props (see {@link PrivacyPageProps}).
472
+
473
+ **Returns:** The rendered privacy page.
474
+
475
+ #### `TermsPage(props)`
476
+
477
+ Default Terms-of-service page scaffold.
478
+
479
+ With no props, renders the canonical boilerplate Terms
480
+ (`<main><h1>{t('terms.title')}</h1><p>{t('terms.intro')}</p></main>`).
481
+ Pass `children` to render real content (e.g. `LegalPageSection`s).
482
+
483
+ Solid counterpart of `@molecule/app-legal-pages-react`'s `TermsPage` — the
484
+ same props (React names), the same DOM for the same input.
485
+
486
+ ```typescript
487
+ function TermsPage(props: TermsPageProps): JSX.Element
488
+ ```
489
+
490
+ - `props` — Component props (see {@link TermsPageProps}).
491
+
492
+ **Returns:** The rendered terms page.
493
+
494
+ ## Injection Notes
495
+
496
+ ### Requirements
497
+
498
+ Peer dependencies:
499
+
500
+ - `@molecule/app-solid` ^3.6.0
501
+ - `@molecule/app-ui` ^1.3.11
502
+ - `@molecule/app-ui-solid` ^1.1.0
503
+ - `solid-js` ^1.8.0
504
+
505
+ ### Runtime Dependencies
506
+
507
+ - `@molecule/app-solid`
508
+ - `@molecule/app-ui`
509
+ - `@molecule/app-ui-solid`
510
+ - `solid-js`
10
511
 
11
- License: Apache-2.0
512
+ - **`appName` is HTML-escaped before interpolation.** The legal bodies are
513
+ rendered as HTML (`innerHTML`); an `appName` carrying markup is escaped to
514
+ inert entities first, so it can never execute inside the legal content.
515
+ - `LegalContentPage` / `useLegalModals` render bonded HTML that defaults to an
516
+ EMPTY string until the locale module is registered — pass your app's
517
+ `loadContent` (from `src/config.ts`, re-exporting
518
+ `@molecule/app-locales-legal-default`) or the page/modal body will be blank.
519
+ - `PlanUpdatedPage` requires BOTH the app's router (it renders `Link`) and
520
+ wired auth state from `@molecule/app-solid` — without an auth provider it
521
+ shows a spinner forever (`state.initialized` never flips). The rest of the
522
+ package is router-free.
523
+ - **Name collision:** `PlanUpdatedPage` is also exported by
524
+ `@molecule/app-pricing-page-react` (the pricing-page-flavored success page),
525
+ and a standalone `<PlanUpdated>` lives in
526
+ `@molecule/app-plan-updated-page-react`. THIS package's `<PlanUpdatedPage>`
527
+ is the legal-pages-kit confirmation page — import it from
528
+ `@molecule/app-legal-pages-solid` when you use this kit's other pages.
529
+ - `ContentPageShell`'s hero reads `var(--mol-color-primary)` and
530
+ `var(--mol-color-background)` with no fallback, and uses Tailwind theme
531
+ utilities (`font-display`, `bg-background`, `border-outline-variant`) — the
532
+ app theme must define the `--mol-color-` override tokens and font utilities
533
+ or the hero band renders unstyled.
534
+ - `TermsPage`/`PrivacyPage` default keys (`terms.title`, `terms.intro`,
535
+ `privacy.title`, `privacy.intro`) and the `nav.legal` eyebrow ship in no
536
+ locale bond — the English `defaultValue`s render unless your app defines
537
+ those keys (all keys are overridable via props).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-legal-pages-solid",
3
- "version": "0.0.1-stage",
3
+ "version": "1.1.0",
4
4
  "description": "Solid page scaffolds for Terms, Privacy, and PlanUpdated (i18n-driven, customizable keys)",
5
5
  "homepage": "https://www.molecule.dev/packages/app-legal-pages-solid",
6
6
  "type": "module",
@@ -52,9 +52,9 @@
52
52
  "@molecule/app-framework-conformance": "0.0.0",
53
53
  "@molecule/app-i18n": "1.2.2",
54
54
  "@molecule/app-icons": "1.0.4",
55
- "@molecule/app-solid": "3.7.2",
56
- "@molecule/app-ui": "1.4.0",
57
- "@molecule/app-ui-solid": "1.1.5",
55
+ "@molecule/app-solid": "3.9.0",
56
+ "@molecule/app-ui": "1.5.0",
57
+ "@molecule/app-ui-solid": "1.2.1",
58
58
  "@types/node": "26.6.5",
59
59
  "jsdom": "30.1.3",
60
60
  "solid-js": "1.9.17",