@nanisoft/prism-ui 0.5.0 → 0.5.1
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 +21 -0
- package/README.md +81 -0
- package/THIRD-PARTY-NOTICES.md +48 -0
- package/dist/.tsbuildinfo +1 -0
- package/dist/blocks/app-shell-01/app-shell.d.ts +38 -0
- package/dist/blocks/app-shell-01/app-shell.d.ts.map +1 -0
- package/dist/blocks/app-shell-01/app-shell.js +27 -0
- package/dist/blocks/app-shell-01/index.d.ts +3 -0
- package/dist/blocks/app-shell-01/index.d.ts.map +1 -0
- package/dist/blocks/app-shell-01/index.js +1 -0
- package/dist/blocks/auth-form-01/auth-form.d.ts +52 -0
- package/dist/blocks/auth-form-01/auth-form.d.ts.map +1 -0
- package/dist/blocks/auth-form-01/auth-form.js +23 -0
- package/dist/blocks/auth-form-01/index.d.ts +3 -0
- package/dist/blocks/auth-form-01/index.d.ts.map +1 -0
- package/dist/blocks/auth-form-01/index.js +1 -0
- package/dist/blocks/cta-01/cta.d.ts +23 -0
- package/dist/blocks/cta-01/cta.d.ts.map +1 -0
- package/dist/blocks/cta-01/cta.js +24 -0
- package/dist/blocks/cta-01/index.d.ts +2 -0
- package/dist/blocks/cta-01/index.d.ts.map +1 -0
- package/dist/blocks/cta-01/index.js +1 -0
- package/dist/blocks/data-table-01/data-table.d.ts +102 -0
- package/dist/blocks/data-table-01/data-table.d.ts.map +1 -0
- package/dist/blocks/data-table-01/data-table.js +116 -0
- package/dist/blocks/data-table-01/index.d.ts +3 -0
- package/dist/blocks/data-table-01/index.d.ts.map +1 -0
- package/dist/blocks/data-table-01/index.js +1 -0
- package/dist/blocks/feature-grid-01/feature-grid.d.ts +27 -0
- package/dist/blocks/feature-grid-01/feature-grid.d.ts.map +1 -0
- package/dist/blocks/feature-grid-01/feature-grid.js +14 -0
- package/dist/blocks/feature-grid-01/index.d.ts +2 -0
- package/dist/blocks/feature-grid-01/index.d.ts.map +1 -0
- package/dist/blocks/feature-grid-01/index.js +1 -0
- package/dist/blocks/hero-01/hero.d.ts +30 -0
- package/dist/blocks/hero-01/hero.d.ts.map +1 -0
- package/dist/blocks/hero-01/hero.js +12 -0
- package/dist/blocks/hero-01/index.d.ts +2 -0
- package/dist/blocks/hero-01/index.d.ts.map +1 -0
- package/dist/blocks/hero-01/index.js +1 -0
- package/dist/blocks/index.d.ts +18 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +17 -0
- package/dist/blocks/page-header-01/index.d.ts +3 -0
- package/dist/blocks/page-header-01/index.d.ts.map +1 -0
- package/dist/blocks/page-header-01/index.js +1 -0
- package/dist/blocks/page-header-01/page-header.d.ts +48 -0
- package/dist/blocks/page-header-01/page-header.d.ts.map +1 -0
- package/dist/blocks/page-header-01/page-header.js +27 -0
- package/dist/blocks/pricing-01/index.d.ts +2 -0
- package/dist/blocks/pricing-01/index.d.ts.map +1 -0
- package/dist/blocks/pricing-01/index.js +1 -0
- package/dist/blocks/pricing-01/pricing.d.ts +35 -0
- package/dist/blocks/pricing-01/pricing.d.ts.map +1 -0
- package/dist/blocks/pricing-01/pricing.js +20 -0
- package/dist/blocks/settings-panel-01/index.d.ts +3 -0
- package/dist/blocks/settings-panel-01/index.d.ts.map +1 -0
- package/dist/blocks/settings-panel-01/index.js +1 -0
- package/dist/blocks/settings-panel-01/settings-panel.d.ts +71 -0
- package/dist/blocks/settings-panel-01/settings-panel.d.ts.map +1 -0
- package/dist/blocks/settings-panel-01/settings-panel.js +38 -0
- package/dist/blocks/stats-01/index.d.ts +2 -0
- package/dist/blocks/stats-01/index.d.ts.map +1 -0
- package/dist/blocks/stats-01/index.js +1 -0
- package/dist/blocks/stats-01/stats.d.ts +28 -0
- package/dist/blocks/stats-01/stats.d.ts.map +1 -0
- package/dist/blocks/stats-01/stats.js +27 -0
- package/dist/catalog.d.ts +28 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +502 -0
- package/dist/components/index.d.ts +53 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +37 -0
- package/dist/components/ui/accordion.d.ts +65 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +30 -0
- package/dist/components/ui/alert.d.ts +19 -0
- package/dist/components/ui/alert.d.ts.map +1 -0
- package/dist/components/ui/alert.js +31 -0
- package/dist/components/ui/avatar.d.ts +47 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +30 -0
- package/dist/components/ui/badge.d.ts +14 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +26 -0
- package/dist/components/ui/breadcrumb.d.ts +35 -0
- package/dist/components/ui/breadcrumb.d.ts.map +1 -0
- package/dist/components/ui/breadcrumb.js +48 -0
- package/dist/components/ui/button.d.ts +16 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +63 -0
- package/dist/components/ui/card.d.ts +16 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +28 -0
- package/dist/components/ui/checkbox.d.ts +43 -0
- package/dist/components/ui/checkbox.d.ts.map +1 -0
- package/dist/components/ui/checkbox.js +18 -0
- package/dist/components/ui/dialog.d.ts +81 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +60 -0
- package/dist/components/ui/dropdown-menu.d.ts +189 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +67 -0
- package/dist/components/ui/field.d.ts +36 -0
- package/dist/components/ui/field.d.ts.map +1 -0
- package/dist/components/ui/field.js +46 -0
- package/dist/components/ui/input.d.ts +12 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +14 -0
- package/dist/components/ui/kbd.d.ts +10 -0
- package/dist/components/ui/kbd.d.ts.map +1 -0
- package/dist/components/ui/kbd.js +12 -0
- package/dist/components/ui/pagination.d.ts +40 -0
- package/dist/components/ui/pagination.d.ts.map +1 -0
- package/dist/components/ui/pagination.js +49 -0
- package/dist/components/ui/popover.d.ts +56 -0
- package/dist/components/ui/popover.d.ts.map +1 -0
- package/dist/components/ui/popover.js +25 -0
- package/dist/components/ui/progress.d.ts +38 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +17 -0
- package/dist/components/ui/radio-group.d.ts +66 -0
- package/dist/components/ui/radio-group.d.ts.map +1 -0
- package/dist/components/ui/radio-group.js +30 -0
- package/dist/components/ui/section.d.ts +37 -0
- package/dist/components/ui/section.d.ts.map +1 -0
- package/dist/components/ui/section.js +12 -0
- package/dist/components/ui/select.d.ts +124 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +47 -0
- package/dist/components/ui/separator.d.ts +16 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +15 -0
- package/dist/components/ui/skeleton.d.ts +12 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +14 -0
- package/dist/components/ui/slider.d.ts +43 -0
- package/dist/components/ui/slider.d.ts.map +1 -0
- package/dist/components/ui/slider.js +17 -0
- package/dist/components/ui/switch.d.ts +42 -0
- package/dist/components/ui/switch.d.ts.map +1 -0
- package/dist/components/ui/switch.js +16 -0
- package/dist/components/ui/table.d.ts +27 -0
- package/dist/components/ui/table.d.ts.map +1 -0
- package/dist/components/ui/table.js +43 -0
- package/dist/components/ui/tabs.d.ts +66 -0
- package/dist/components/ui/tabs.d.ts.map +1 -0
- package/dist/components/ui/tabs.js +29 -0
- package/dist/components/ui/textarea.d.ts +11 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +13 -0
- package/dist/components/ui/tooltip.d.ts +63 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +25 -0
- package/dist/components/ui/typography.d.ts +32 -0
- package/dist/components/ui/typography.d.ts.map +1 -0
- package/dist/components/ui/typography.js +51 -0
- package/dist/index.d.ts +55 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +51 -0
- package/dist/lib/utils.d.ts +3 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +5 -0
- package/dist/pages/auth-page/index.d.ts +36 -0
- package/dist/pages/auth-page/index.d.ts.map +1 -0
- package/dist/pages/auth-page/index.js +23 -0
- package/dist/pages/dashboard-page/index.d.ts +36 -0
- package/dist/pages/dashboard-page/index.d.ts.map +1 -0
- package/dist/pages/dashboard-page/index.js +24 -0
- package/dist/pages/index.d.ts +17 -0
- package/dist/pages/index.d.ts.map +1 -0
- package/dist/pages/index.js +12 -0
- package/dist/pages/marketing-page/index.d.ts +43 -0
- package/dist/pages/marketing-page/index.d.ts.map +1 -0
- package/dist/pages/marketing-page/index.js +25 -0
- package/dist/pages/settings-page/index.d.ts +47 -0
- package/dist/pages/settings-page/index.d.ts.map +1 -0
- package/dist/pages/settings-page/index.js +24 -0
- package/dist/provider/index.d.ts +12 -0
- package/dist/provider/index.d.ts.map +1 -0
- package/dist/provider/index.js +9 -0
- package/dist/provider/provider.d.ts +37 -0
- package/dist/provider/provider.d.ts.map +1 -0
- package/dist/provider/provider.js +87 -0
- package/dist/provider/theme-script.d.ts +17 -0
- package/dist/provider/theme-script.d.ts.map +1 -0
- package/dist/provider/theme-script.js +28 -0
- package/dist/styles.css +2413 -0
- package/dist/theming/index.d.ts +43 -0
- package/dist/theming/index.d.ts.map +1 -0
- package/dist/theming/index.js +60 -0
- package/package.json +79 -18
- package/components.json +0 -21
- package/public/r/badge.json +0 -26
- package/public/r/button.json +0 -26
- package/public/r/card.json +0 -25
- package/public/r/cta-01.json +0 -44
- package/public/r/feature-grid-01.json +0 -44
- package/public/r/hero-01.json +0 -44
- package/public/r/pricing-01.json +0 -46
- package/public/r/registry.json +0 -294
- package/public/r/section.json +0 -25
- package/public/r/stats-01.json +0 -44
- package/registry.json +0 -294
- package/src/components/ds/blocks/cta-01/block.json +0 -8
- package/src/components/ds/blocks/cta-01/cta.tsx +0 -62
- package/src/components/ds/blocks/cta-01/index.tsx +0 -1
- package/src/components/ds/blocks/feature-grid-01/block.json +0 -8
- package/src/components/ds/blocks/feature-grid-01/feature-grid.tsx +0 -69
- package/src/components/ds/blocks/feature-grid-01/index.tsx +0 -1
- package/src/components/ds/blocks/hero-01/block.json +0 -8
- package/src/components/ds/blocks/hero-01/hero.tsx +0 -85
- package/src/components/ds/blocks/hero-01/index.tsx +0 -1
- package/src/components/ds/blocks/pricing-01/block.json +0 -8
- package/src/components/ds/blocks/pricing-01/index.tsx +0 -1
- package/src/components/ds/blocks/pricing-01/pricing.tsx +0 -122
- package/src/components/ds/blocks/section.meta.json +0 -6
- package/src/components/ds/blocks/section.tsx +0 -86
- package/src/components/ds/blocks/stats-01/block.json +0 -8
- package/src/components/ds/blocks/stats-01/index.tsx +0 -1
- package/src/components/ds/blocks/stats-01/stats.tsx +0 -92
- package/src/components/ui/badge.tsx +0 -37
- package/src/components/ui/button.tsx +0 -77
- package/src/components/ui/card.tsx +0 -65
- package/src/lib/utils.ts +0 -6
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { AppShell01 } from '../../blocks/app-shell-01';
|
|
3
|
+
import { DataTable01 } from '../../blocks/data-table-01';
|
|
4
|
+
import { PageHeader01 } from '../../blocks/page-header-01';
|
|
5
|
+
import { Stats01 } from '../../blocks/stats-01';
|
|
6
|
+
export type DashboardPageProps = {
|
|
7
|
+
/**
|
|
8
|
+
* The frame: the navigation rail, the top bar and the mobile navigation
|
|
9
|
+
* sheet. Navigation, actions and the rail slots are passed as nodes, so the
|
|
10
|
+
* page never imports a router.
|
|
11
|
+
*/
|
|
12
|
+
shell: Omit<ComponentProps<typeof AppShell01>, 'children'>;
|
|
13
|
+
/** The page title band. */
|
|
14
|
+
header: ComponentProps<typeof PageHeader01>;
|
|
15
|
+
/** The key-figure row above the table. */
|
|
16
|
+
stats: ComponentProps<typeof Stats01>;
|
|
17
|
+
/** The main table, with its rows, columns, labels and callbacks. */
|
|
18
|
+
table: ComponentProps<typeof DataTable01>;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* A complete dashboard screen.
|
|
22
|
+
*
|
|
23
|
+
* It composes `AppShell01`, `PageHeader01`, `Stats01` and `DataTable01`: the
|
|
24
|
+
* shell provides the frame, the header names the screen, the stats summarise it
|
|
25
|
+
* and the table carries the working set. The page owns the sequence and the
|
|
26
|
+
* spacing only. Every row, column, label and handler is a prop, and the page
|
|
27
|
+
* fetches nothing.
|
|
28
|
+
*
|
|
29
|
+
* The page is a client component because the blocks it composes are stateful.
|
|
30
|
+
* That is a property of this composition, not of the data: the consumer still
|
|
31
|
+
* owns the rows and the callbacks, and can drive the table from a server render
|
|
32
|
+
* or a client cache by the same props.
|
|
33
|
+
*/
|
|
34
|
+
export declare function DashboardPage({ shell, header, stats, table }: DashboardPageProps): import("react").JSX.Element;
|
|
35
|
+
export default DashboardPage;
|
|
36
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/dashboard-page/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAE/C,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;OAIG;IACH,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EAAE,UAAU,CAAC,CAAA;IAC1D,2BAA2B;IAC3B,MAAM,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,CAAA;IAC3C,0CAA0C;IAC1C,KAAK,EAAE,cAAc,CAAC,OAAO,OAAO,CAAC,CAAA;IACrC,oEAAoE;IACpE,KAAK,EAAE,cAAc,CAAC,OAAO,WAAW,CAAC,CAAA;CAC1C,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,kBAAkB,+BAUhF;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AppShell01 } from '../../blocks/app-shell-01';
|
|
4
|
+
import { DataTable01 } from '../../blocks/data-table-01';
|
|
5
|
+
import { PageHeader01 } from '../../blocks/page-header-01';
|
|
6
|
+
import { Stats01 } from '../../blocks/stats-01';
|
|
7
|
+
/**
|
|
8
|
+
* A complete dashboard screen.
|
|
9
|
+
*
|
|
10
|
+
* It composes `AppShell01`, `PageHeader01`, `Stats01` and `DataTable01`: the
|
|
11
|
+
* shell provides the frame, the header names the screen, the stats summarise it
|
|
12
|
+
* and the table carries the working set. The page owns the sequence and the
|
|
13
|
+
* spacing only. Every row, column, label and handler is a prop, and the page
|
|
14
|
+
* fetches nothing.
|
|
15
|
+
*
|
|
16
|
+
* The page is a client component because the blocks it composes are stateful.
|
|
17
|
+
* That is a property of this composition, not of the data: the consumer still
|
|
18
|
+
* owns the rows and the callbacks, and can drive the table from a server render
|
|
19
|
+
* or a client cache by the same props.
|
|
20
|
+
*/
|
|
21
|
+
export function DashboardPage({ shell, header, stats, table }) {
|
|
22
|
+
return (_jsx(AppShell01, { ...shell, children: _jsxs("div", { className: "mx-auto flex w-full max-w-page flex-col gap-8", children: [_jsx(PageHeader01, { ...header, headingLevel: header.headingLevel ?? 'h1' }), _jsx(Stats01, { ...stats }), _jsx(DataTable01, { ...table })] }) }));
|
|
23
|
+
}
|
|
24
|
+
export default DashboardPage;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every Prism Page.
|
|
3
|
+
*
|
|
4
|
+
* A Page is a shipped, installable screen model composed of Blocks and
|
|
5
|
+
* Components that receives application-owned navigation, content and data
|
|
6
|
+
* (ticket 07). The v1 roster ships four Pages. Each is also importable on its
|
|
7
|
+
* own subpath, `@nanisoft/prism-ui/pages/<slug>`.
|
|
8
|
+
*/
|
|
9
|
+
export { MarketingPage } from './marketing-page';
|
|
10
|
+
export type { MarketingPageProps } from './marketing-page';
|
|
11
|
+
export { DashboardPage } from './dashboard-page';
|
|
12
|
+
export type { DashboardPageProps } from './dashboard-page';
|
|
13
|
+
export { SettingsPage } from './settings-page';
|
|
14
|
+
export type { SettingsPageProps, SettingsPageTab } from './settings-page';
|
|
15
|
+
export { AuthPage } from './auth-page';
|
|
16
|
+
export type { AuthPageProps, AuthPageAside } from './auth-page';
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/pages/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,YAAY,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAC1D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9C,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAA;AACzE,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AACtC,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every Prism Page.
|
|
3
|
+
*
|
|
4
|
+
* A Page is a shipped, installable screen model composed of Blocks and
|
|
5
|
+
* Components that receives application-owned navigation, content and data
|
|
6
|
+
* (ticket 07). The v1 roster ships four Pages. Each is also importable on its
|
|
7
|
+
* own subpath, `@nanisoft/prism-ui/pages/<slug>`.
|
|
8
|
+
*/
|
|
9
|
+
export { MarketingPage } from './marketing-page';
|
|
10
|
+
export { DashboardPage } from './dashboard-page';
|
|
11
|
+
export { SettingsPage } from './settings-page';
|
|
12
|
+
export { AuthPage } from './auth-page';
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { ComponentProps } from 'react';
|
|
2
|
+
import { Cta01 } from '../../blocks/cta-01';
|
|
3
|
+
import { FeatureGrid01 } from '../../blocks/feature-grid-01';
|
|
4
|
+
import { Hero01 } from '../../blocks/hero-01';
|
|
5
|
+
import { Pricing01 } from '../../blocks/pricing-01';
|
|
6
|
+
import { Stats01 } from '../../blocks/stats-01';
|
|
7
|
+
import type { HeadingLevel } from '../../components/ui/section';
|
|
8
|
+
export type MarketingPageProps = {
|
|
9
|
+
/** The opening band: an optional eyebrow, the headline and one or two actions. */
|
|
10
|
+
hero: ComponentProps<typeof Hero01>;
|
|
11
|
+
/** The capability grid below the hero. */
|
|
12
|
+
features: ComponentProps<typeof FeatureGrid01>;
|
|
13
|
+
/** The key-figure row. */
|
|
14
|
+
stats: ComponentProps<typeof Stats01>;
|
|
15
|
+
/** The plan comparison. */
|
|
16
|
+
pricing: ComponentProps<typeof Pricing01>;
|
|
17
|
+
/** The closing call to action. */
|
|
18
|
+
cta: ComponentProps<typeof Cta01>;
|
|
19
|
+
/**
|
|
20
|
+
* The heading level for the hero. Defaults to `h1`, because a page owns the
|
|
21
|
+
* top of the document outline. A consumer that embeds the page under a
|
|
22
|
+
* heading it already owns passes one level deeper.
|
|
23
|
+
*/
|
|
24
|
+
headingLevel?: HeadingLevel;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A complete marketing page.
|
|
28
|
+
*
|
|
29
|
+
* It composes `Hero01`, `FeatureGrid01`, `Stats01`, `Pricing01` and `Cta01` in
|
|
30
|
+
* reading order and passes each block its own props unchanged, so the page adds
|
|
31
|
+
* the sequence and nothing else. Every string, number and action is a prop, and
|
|
32
|
+
* the page ships no sample copy and fetches nothing. It is a product-agnostic
|
|
33
|
+
* screen model, not this site's own landing route: a consumer installs it,
|
|
34
|
+
* passes their own content and owns the links.
|
|
35
|
+
*
|
|
36
|
+
* The hero is the page's primary heading, so it defaults to `h1`; set
|
|
37
|
+
* `headingLevel` when the page is embedded rather than rendered as a screen.
|
|
38
|
+
* The composed blocks keep their own `h2` defaults, so the outline stays one
|
|
39
|
+
* heading per section below the hero.
|
|
40
|
+
*/
|
|
41
|
+
export declare function MarketingPage({ hero, features, stats, pricing, cta, headingLevel, }: MarketingPageProps): import("react").JSX.Element;
|
|
42
|
+
export default MarketingPage;
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/marketing-page/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AAE3C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAA;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAA;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAE/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,kFAAkF;IAClF,IAAI,EAAE,cAAc,CAAC,OAAO,MAAM,CAAC,CAAA;IACnC,0CAA0C;IAC1C,QAAQ,EAAE,cAAc,CAAC,OAAO,aAAa,CAAC,CAAA;IAC9C,0BAA0B;IAC1B,KAAK,EAAE,cAAc,CAAC,OAAO,OAAO,CAAC,CAAA;IACrC,2BAA2B;IAC3B,OAAO,EAAE,cAAc,CAAC,OAAO,SAAS,CAAC,CAAA;IACzC,kCAAkC;IAClC,GAAG,EAAE,cAAc,CAAC,OAAO,KAAK,CAAC,CAAA;IACjC;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAA;CAC5B,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,EAC5B,IAAI,EACJ,QAAQ,EACR,KAAK,EACL,OAAO,EACP,GAAG,EACH,YAAmB,GACpB,EAAE,kBAAkB,+BAUpB;AAED,eAAe,aAAa,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Cta01 } from '../../blocks/cta-01';
|
|
3
|
+
import { FeatureGrid01 } from '../../blocks/feature-grid-01';
|
|
4
|
+
import { Hero01 } from '../../blocks/hero-01';
|
|
5
|
+
import { Pricing01 } from '../../blocks/pricing-01';
|
|
6
|
+
import { Stats01 } from '../../blocks/stats-01';
|
|
7
|
+
/**
|
|
8
|
+
* A complete marketing page.
|
|
9
|
+
*
|
|
10
|
+
* It composes `Hero01`, `FeatureGrid01`, `Stats01`, `Pricing01` and `Cta01` in
|
|
11
|
+
* reading order and passes each block its own props unchanged, so the page adds
|
|
12
|
+
* the sequence and nothing else. Every string, number and action is a prop, and
|
|
13
|
+
* the page ships no sample copy and fetches nothing. It is a product-agnostic
|
|
14
|
+
* screen model, not this site's own landing route: a consumer installs it,
|
|
15
|
+
* passes their own content and owns the links.
|
|
16
|
+
*
|
|
17
|
+
* The hero is the page's primary heading, so it defaults to `h1`; set
|
|
18
|
+
* `headingLevel` when the page is embedded rather than rendered as a screen.
|
|
19
|
+
* The composed blocks keep their own `h2` defaults, so the outline stays one
|
|
20
|
+
* heading per section below the hero.
|
|
21
|
+
*/
|
|
22
|
+
export function MarketingPage({ hero, features, stats, pricing, cta, headingLevel = 'h1', }) {
|
|
23
|
+
return (_jsxs("div", { className: "bg-background text-foreground", children: [_jsx(Hero01, { ...hero, headingLevel: headingLevel }), _jsx(FeatureGrid01, { ...features }), _jsx(Stats01, { ...stats }), _jsx(Pricing01, { ...pricing }), _jsx(Cta01, { ...cta })] }));
|
|
24
|
+
}
|
|
25
|
+
export default MarketingPage;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import { AppShell01 } from '../../blocks/app-shell-01';
|
|
3
|
+
import { PageHeader01 } from '../../blocks/page-header-01';
|
|
4
|
+
import { SettingsPanel01 } from '../../blocks/settings-panel-01';
|
|
5
|
+
export type SettingsPageTab = {
|
|
6
|
+
/** The value shared by the trigger and its panel. */
|
|
7
|
+
value: string;
|
|
8
|
+
/** The trigger label. */
|
|
9
|
+
label: string;
|
|
10
|
+
/**
|
|
11
|
+
* A saved settings form for this tab. Rendered through `SettingsPanel01`, so
|
|
12
|
+
* the tab inherits the grouped sections, the field kinds and the save footer.
|
|
13
|
+
*/
|
|
14
|
+
panel?: ComponentProps<typeof SettingsPanel01>;
|
|
15
|
+
/** Content for a tab that is not a saved form, such as a read-only summary. */
|
|
16
|
+
content?: ReactNode;
|
|
17
|
+
};
|
|
18
|
+
export type SettingsPageProps = {
|
|
19
|
+
/** The frame: rail, top bar and mobile navigation sheet. */
|
|
20
|
+
shell: Omit<ComponentProps<typeof AppShell01>, 'children'>;
|
|
21
|
+
/** The page title band. */
|
|
22
|
+
header: ComponentProps<typeof PageHeader01>;
|
|
23
|
+
/** The tabs, in order. At least one is required. */
|
|
24
|
+
tabs: SettingsPageTab[];
|
|
25
|
+
/** The tab shown first, for uncontrolled tabs. Defaults to the first tab. */
|
|
26
|
+
defaultValue?: string;
|
|
27
|
+
/** The controlled active tab. */
|
|
28
|
+
value?: string;
|
|
29
|
+
onValueChange?: (value: string) => void;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* A complete settings screen.
|
|
33
|
+
*
|
|
34
|
+
* It composes `AppShell01`, `PageHeader01`, `Tabs` and `SettingsPanel01`: the
|
|
35
|
+
* shell provides the frame, the header names the screen, and each tab is a
|
|
36
|
+
* saved settings form or a read-only panel. The page owns the sequence and the
|
|
37
|
+
* tab wiring only. Every section, field, option and label is a prop, and the
|
|
38
|
+
* page fetches nothing.
|
|
39
|
+
*
|
|
40
|
+
* A tab that carries a `panel` renders `SettingsPanel01`, so a settings screen
|
|
41
|
+
* is a set of grouped forms rather than one long page. A tab that carries
|
|
42
|
+
* `content` instead renders the node as-is. Both are optional, so a caller can
|
|
43
|
+
* mix forms and read-only views in one screen.
|
|
44
|
+
*/
|
|
45
|
+
export declare function SettingsPage({ shell, header, tabs, defaultValue, value, onValueChange, }: SettingsPageProps): import("react").JSX.Element;
|
|
46
|
+
export default SettingsPage;
|
|
47
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/pages/settings-page/index.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAA;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,gCAAgC,CAAA;AAGhE,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAA;IACb,yBAAyB;IACzB,KAAK,EAAE,MAAM,CAAA;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,OAAO,eAAe,CAAC,CAAA;IAC9C,+EAA+E;IAC/E,OAAO,CAAC,EAAE,SAAS,CAAA;CACpB,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAC9B,4DAA4D;IAC5D,KAAK,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,UAAU,CAAC,EAAE,UAAU,CAAC,CAAA;IAC1D,2BAA2B;IAC3B,MAAM,EAAE,cAAc,CAAC,OAAO,YAAY,CAAC,CAAA;IAC3C,oDAAoD;IACpD,IAAI,EAAE,eAAe,EAAE,CAAA;IACvB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,iCAAiC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,aAAa,GACd,EAAE,iBAAiB,+BA4BnB;AAED,eAAe,YAAY,CAAA"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { AppShell01 } from '../../blocks/app-shell-01';
|
|
4
|
+
import { PageHeader01 } from '../../blocks/page-header-01';
|
|
5
|
+
import { SettingsPanel01 } from '../../blocks/settings-panel-01';
|
|
6
|
+
import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../components/ui/tabs';
|
|
7
|
+
/**
|
|
8
|
+
* A complete settings screen.
|
|
9
|
+
*
|
|
10
|
+
* It composes `AppShell01`, `PageHeader01`, `Tabs` and `SettingsPanel01`: the
|
|
11
|
+
* shell provides the frame, the header names the screen, and each tab is a
|
|
12
|
+
* saved settings form or a read-only panel. The page owns the sequence and the
|
|
13
|
+
* tab wiring only. Every section, field, option and label is a prop, and the
|
|
14
|
+
* page fetches nothing.
|
|
15
|
+
*
|
|
16
|
+
* A tab that carries a `panel` renders `SettingsPanel01`, so a settings screen
|
|
17
|
+
* is a set of grouped forms rather than one long page. A tab that carries
|
|
18
|
+
* `content` instead renders the node as-is. Both are optional, so a caller can
|
|
19
|
+
* mix forms and read-only views in one screen.
|
|
20
|
+
*/
|
|
21
|
+
export function SettingsPage({ shell, header, tabs, defaultValue, value, onValueChange, }) {
|
|
22
|
+
return (_jsx(AppShell01, { ...shell, children: _jsxs("div", { className: "mx-auto flex w-full max-w-page flex-col gap-8", children: [_jsx(PageHeader01, { ...header, headingLevel: header.headingLevel ?? 'h1' }), _jsxs(Tabs, { defaultValue: defaultValue ?? tabs[0]?.value, value: value, onValueChange: onValueChange, children: [_jsx(TabsList, { children: tabs.map((tab) => (_jsx(TabsTrigger, { value: tab.value, children: tab.label }, tab.value))) }), tabs.map((tab) => (_jsx(TabsContent, { value: tab.value, children: tab.panel ? _jsx(SettingsPanel01, { ...tab.panel }) : tab.content }, tab.value)))] })] }) }));
|
|
23
|
+
}
|
|
24
|
+
export default SettingsPage;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Prism provider entry.
|
|
3
|
+
*
|
|
4
|
+
* `PrismProvider` and `usePrismTheme` are the optional programmatic path;
|
|
5
|
+
* `PrismThemeScript` is the optional pre-hydration script. The declarative
|
|
6
|
+
* `data-pack` and `.dark` attributes are the default and need none of this.
|
|
7
|
+
*/
|
|
8
|
+
export { PrismProvider, usePrismTheme } from './provider';
|
|
9
|
+
export type { PrismProviderProps, PrismTheme } from './provider';
|
|
10
|
+
export { PrismThemeScript } from './theme-script';
|
|
11
|
+
export type { PrismThemeScriptProps } from './theme-script';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/provider/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AACzD,YAAY,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACjD,YAAY,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Prism provider entry.
|
|
3
|
+
*
|
|
4
|
+
* `PrismProvider` and `usePrismTheme` are the optional programmatic path;
|
|
5
|
+
* `PrismThemeScript` is the optional pre-hydration script. The declarative
|
|
6
|
+
* `data-pack` and `.dark` attributes are the default and need none of this.
|
|
7
|
+
*/
|
|
8
|
+
export { PrismProvider, usePrismTheme } from './provider';
|
|
9
|
+
export { PrismThemeScript } from './theme-script';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional client runtime for programmatic theme switching.
|
|
3
|
+
*
|
|
4
|
+
* The provider is strictly additive: a consumer who puts `data-pack` and
|
|
5
|
+
* `.dark` on `<html>` never needs it, and a consumer who wants no client
|
|
6
|
+
* JavaScript omits it. It carries the pack and mode through context and writes
|
|
7
|
+
* the same two markup attributes the declarative form uses. There is no
|
|
8
|
+
* override, merge, token, className or style prop: the provider's only outputs
|
|
9
|
+
* are the document-element attributes and context (ticket 07).
|
|
10
|
+
*/
|
|
11
|
+
import { type ReactNode } from 'react';
|
|
12
|
+
import { type Mode, type PackId } from '../theming';
|
|
13
|
+
export type PrismTheme = {
|
|
14
|
+
pack: PackId;
|
|
15
|
+
mode: Mode;
|
|
16
|
+
setPack: (pack: PackId) => void;
|
|
17
|
+
setMode: (mode: Mode) => void;
|
|
18
|
+
toggleMode: () => void;
|
|
19
|
+
};
|
|
20
|
+
export type PrismProviderProps = {
|
|
21
|
+
/** Pack used when nothing is stored and no pack attribute is present. */
|
|
22
|
+
defaultPack?: PackId;
|
|
23
|
+
/** Mode used in the same fallback. */
|
|
24
|
+
defaultMode?: Mode;
|
|
25
|
+
/** localStorage key for the persisted `{ pack, mode }` object. */
|
|
26
|
+
storageKey?: string;
|
|
27
|
+
children?: ReactNode;
|
|
28
|
+
};
|
|
29
|
+
export declare function PrismProvider({ defaultPack, defaultMode, storageKey, children, }: PrismProviderProps): import("react").JSX.Element;
|
|
30
|
+
/**
|
|
31
|
+
* Reads and mutates the active pack and mode.
|
|
32
|
+
*
|
|
33
|
+
* Throws outside a `PrismProvider`. The provider is optional, so a consumer
|
|
34
|
+
* that does not mount it simply does not call this hook.
|
|
35
|
+
*/
|
|
36
|
+
export declare function usePrismTheme(): PrismTheme;
|
|
37
|
+
//# sourceMappingURL=provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../src/provider/provider.tsx"],"names":[],"mappings":"AAEA;;;;;;;;;GASG;AACH,OAAO,EAOL,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAEd,OAAO,EAML,KAAK,IAAI,EACT,KAAK,MAAM,EACZ,MAAM,YAAY,CAAA;AAEnB,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,IAAI,CAAA;IACV,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,OAAO,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,IAAI,CAAA;IAC7B,UAAU,EAAE,MAAM,IAAI,CAAA;CACvB,CAAA;AAID,MAAM,MAAM,kBAAkB,GAAG;IAC/B,yEAAyE;IACzE,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,sCAAsC;IACtC,WAAW,CAAC,EAAE,IAAI,CAAA;IAClB,kEAAkE;IAClE,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB,CAAA;AAwBD,wBAAgB,aAAa,CAAC,EAC5B,WAAuB,EACvB,WAAqB,EACrB,UAAgC,EAChC,QAAQ,GACT,EAAE,kBAAkB,+BA8CpB;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,UAAU,CAM1C"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* The optional client runtime for programmatic theme switching.
|
|
5
|
+
*
|
|
6
|
+
* The provider is strictly additive: a consumer who puts `data-pack` and
|
|
7
|
+
* `.dark` on `<html>` never needs it, and a consumer who wants no client
|
|
8
|
+
* JavaScript omits it. It carries the pack and mode through context and writes
|
|
9
|
+
* the same two markup attributes the declarative form uses. There is no
|
|
10
|
+
* override, merge, token, className or style prop: the provider's only outputs
|
|
11
|
+
* are the document-element attributes and context (ticket 07).
|
|
12
|
+
*/
|
|
13
|
+
import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
|
|
14
|
+
import { DEFAULT_STORAGE_KEY, MODES, PACKS, parseStoredTheme, themeAttributes, } from '../theming';
|
|
15
|
+
const PrismThemeContext = createContext(null);
|
|
16
|
+
function applyDocumentAttributes(pack, mode) {
|
|
17
|
+
const root = document.documentElement;
|
|
18
|
+
const { 'data-pack': packAttribute, className } = themeAttributes({ pack, mode });
|
|
19
|
+
if (packAttribute)
|
|
20
|
+
root.setAttribute('data-pack', packAttribute);
|
|
21
|
+
else
|
|
22
|
+
root.removeAttribute('data-pack');
|
|
23
|
+
if (className)
|
|
24
|
+
root.classList.add('dark');
|
|
25
|
+
else
|
|
26
|
+
root.classList.remove('dark');
|
|
27
|
+
}
|
|
28
|
+
function packFromDocument(fallback) {
|
|
29
|
+
const attribute = document.documentElement.getAttribute('data-pack');
|
|
30
|
+
return attribute && PACKS.includes(attribute)
|
|
31
|
+
? attribute
|
|
32
|
+
: fallback;
|
|
33
|
+
}
|
|
34
|
+
function modeFromDocument(fallback) {
|
|
35
|
+
return document.documentElement.classList.contains('dark') ? 'dark' : fallback;
|
|
36
|
+
}
|
|
37
|
+
export function PrismProvider({ defaultPack = 'default', defaultMode = 'light', storageKey = DEFAULT_STORAGE_KEY, children, }) {
|
|
38
|
+
const [pack, setPackState] = useState(defaultPack);
|
|
39
|
+
const [mode, setModeState] = useState(defaultMode);
|
|
40
|
+
const [resolved, setResolved] = useState(false);
|
|
41
|
+
/*
|
|
42
|
+
* Resolution order on mount: stored value, then the server-rendered attribute,
|
|
43
|
+
* then the default. A server-rendered pack therefore survives hydration
|
|
44
|
+
* instead of flashing to the default.
|
|
45
|
+
*/
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
const stored = parseStoredTheme(localStorage.getItem(storageKey));
|
|
48
|
+
const next = stored ?? { pack: packFromDocument(defaultPack), mode: modeFromDocument(defaultMode) };
|
|
49
|
+
setPackState(next.pack);
|
|
50
|
+
setModeState(next.mode);
|
|
51
|
+
setResolved(true);
|
|
52
|
+
}, [storageKey, defaultPack, defaultMode]);
|
|
53
|
+
/*
|
|
54
|
+
* Persist and apply only after resolution, so the first client commit never
|
|
55
|
+
* writes the defaults over a stored or server-rendered choice.
|
|
56
|
+
*/
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!resolved)
|
|
59
|
+
return;
|
|
60
|
+
applyDocumentAttributes(pack, mode);
|
|
61
|
+
try {
|
|
62
|
+
localStorage.setItem(storageKey, JSON.stringify({ pack, mode }));
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// A blocked or full localStorage must not break theme switching. The
|
|
66
|
+
// attributes are already applied, so the visible behaviour is unchanged.
|
|
67
|
+
}
|
|
68
|
+
}, [resolved, pack, mode, storageKey]);
|
|
69
|
+
const setPack = useCallback((next) => setPackState(next), []);
|
|
70
|
+
const setMode = useCallback((next) => setModeState(next), []);
|
|
71
|
+
const toggleMode = useCallback(() => setModeState((current) => (current === 'dark' ? MODES[0] : MODES[1])), []);
|
|
72
|
+
const value = useMemo(() => ({ pack, mode, setPack, setMode, toggleMode }), [pack, mode, setPack, setMode, toggleMode]);
|
|
73
|
+
return _jsx(PrismThemeContext.Provider, { value: value, children: children });
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Reads and mutates the active pack and mode.
|
|
77
|
+
*
|
|
78
|
+
* Throws outside a `PrismProvider`. The provider is optional, so a consumer
|
|
79
|
+
* that does not mount it simply does not call this hook.
|
|
80
|
+
*/
|
|
81
|
+
export function usePrismTheme() {
|
|
82
|
+
const value = useContext(PrismThemeContext);
|
|
83
|
+
if (!value) {
|
|
84
|
+
throw new Error('usePrismTheme must be used within a PrismProvider');
|
|
85
|
+
}
|
|
86
|
+
return value;
|
|
87
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The optional pre-hydration theme script.
|
|
3
|
+
*
|
|
4
|
+
* A Server Component that renders one blocking script. Placed in `<head>`, it
|
|
5
|
+
* applies the stored pack and mode before React hydrates, so the first paint is
|
|
6
|
+
* already correct. Precedence matches `PrismProvider`: stored value, then the
|
|
7
|
+
* server-rendered attribute, then the defaults. It is safe to omit; a consumer
|
|
8
|
+
* who renders the attributes on `<html>` needs no client runtime at all.
|
|
9
|
+
*/
|
|
10
|
+
import { type Mode, type PackId } from '../theming';
|
|
11
|
+
export type PrismThemeScriptProps = {
|
|
12
|
+
storageKey?: string;
|
|
13
|
+
defaultPack?: PackId;
|
|
14
|
+
defaultMode?: Mode;
|
|
15
|
+
};
|
|
16
|
+
export declare function PrismThemeScript({ storageKey, defaultPack, defaultMode, }: PrismThemeScriptProps): import("react").JSX.Element;
|
|
17
|
+
//# sourceMappingURL=theme-script.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme-script.d.ts","sourceRoot":"","sources":["../../src/provider/theme-script.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAqC,KAAK,IAAI,EAAE,KAAK,MAAM,EAAE,MAAM,YAAY,CAAA;AAEtF,MAAM,MAAM,qBAAqB,GAAG;IAClC,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,CAAC,EAAE,IAAI,CAAA;CACnB,CAAA;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,UAAgC,EAChC,WAAuB,EACvB,WAAqB,GACtB,EAAE,qBAAqB,+BAkBvB"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* The optional pre-hydration theme script.
|
|
4
|
+
*
|
|
5
|
+
* A Server Component that renders one blocking script. Placed in `<head>`, it
|
|
6
|
+
* applies the stored pack and mode before React hydrates, so the first paint is
|
|
7
|
+
* already correct. Precedence matches `PrismProvider`: stored value, then the
|
|
8
|
+
* server-rendered attribute, then the defaults. It is safe to omit; a consumer
|
|
9
|
+
* who renders the attributes on `<html>` needs no client runtime at all.
|
|
10
|
+
*/
|
|
11
|
+
import { DEFAULT_STORAGE_KEY, MODES, PACKS } from '../theming';
|
|
12
|
+
export function PrismThemeScript({ storageKey = DEFAULT_STORAGE_KEY, defaultPack = 'default', defaultMode = 'light', }) {
|
|
13
|
+
const script = '(function(){try{' +
|
|
14
|
+
'var root=document.documentElement;' +
|
|
15
|
+
`var packs=${JSON.stringify(PACKS)};` +
|
|
16
|
+
`var modes=${JSON.stringify(MODES)};` +
|
|
17
|
+
'var stored=null;' +
|
|
18
|
+
`try{stored=JSON.parse(localStorage.getItem(${JSON.stringify(storageKey)})||"null");}catch(ignored){}` +
|
|
19
|
+
'var pack=stored&&packs.indexOf(stored.pack)>-1?stored.pack:(root.getAttribute("data-pack")||' +
|
|
20
|
+
`${JSON.stringify(defaultPack)});` +
|
|
21
|
+
'var mode=stored&&modes.indexOf(stored.mode)>-1?stored.mode:(root.classList.contains("dark")?"dark":' +
|
|
22
|
+
`${JSON.stringify(defaultMode)});` +
|
|
23
|
+
`if(packs.indexOf(pack)<0){pack=${JSON.stringify(defaultPack)};}` +
|
|
24
|
+
'if(pack&&pack!=="default"){root.setAttribute("data-pack",pack);}else{root.removeAttribute("data-pack");}' +
|
|
25
|
+
'root.classList.toggle("dark",mode==="dark");' +
|
|
26
|
+
'}catch(ignored){}})();';
|
|
27
|
+
return _jsx("script", { dangerouslySetInnerHTML: { __html: script } });
|
|
28
|
+
}
|