@namahapdf/react 0.1.0 → 0.2.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/dist/index.d.cts CHANGED
@@ -1,11 +1,68 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
 
4
+ /**
5
+ * Brand theming for <NamahaEditor>.
6
+ *
7
+ * The editor's colors are applied through Tailwind utilities (`bg-crimson-600`,
8
+ * `text-ink`, `bg-paper-card`, …) that resolve to channel-based CSS variables
9
+ * (`rgb(var(--namaha-*) / <alpha-value>)`) — see `tailwind.config.js` and
10
+ * `styles.css`. This module turns a small semantic `theme` object into the matching
11
+ * `--namaha-*` overrides, which `<NamahaEditor>` sets as inline style on the
12
+ * `.namahapdf-root` wrapper so they cascade to every scoped utility.
13
+ *
14
+ * It is **purely client-side** — no network call. Out of the box (no `theme`) the
15
+ * defaults in `styles.css` reproduce the stock "warm paper" look exactly.
16
+ *
17
+ * The consumer supplies one or more of `primary` / `surface` / `text` (hex). We
18
+ * derive the full tonal scale + surface/text shades from each so a single brand
19
+ * color themes everything consistently. Channel variables (space-separated `R G B`)
20
+ * are required so Tailwind opacity modifiers (`bg-primary/10`, `ring-primary/50`)
21
+ * keep working.
22
+ */
23
+ interface NamahaTheme {
24
+ /** Brand accent (hex). Drives buttons, active states, the brand mark and focus rings. */
25
+ primary?: string;
26
+ /** Surface/background color (hex). Drives the editor canvas, panels and cards. */
27
+ surface?: string;
28
+ /** Body text color (hex). Drives primary/secondary/muted text and hairlines. */
29
+ text?: string;
30
+ }
31
+ /**
32
+ * Build the `--namaha-*` CSS-variable overrides for a theme. Only the keys the
33
+ * consumer provides emit variables; everything else falls back to the defaults in
34
+ * `styles.css`. Returns a plain object suitable for spreading into a React `style`.
35
+ */
36
+ declare function buildThemeVars(theme?: NamahaTheme | null): Record<string, string>;
37
+
4
38
  interface NamahaEditorProps {
5
39
  /** Your NamahaPDF SDK license key. Without it the editor runs in watermarked mode. */
6
40
  licenseKey?: string;
7
41
  /** Override the activation endpoint (defaults to a same-origin /api/license/activate). */
8
42
  activationUrl?: string;
43
+ /**
44
+ * Endpoint used to decrypt password-protected PDFs. Unencrypted PDFs open fully
45
+ * in the browser with no network call; only encrypted ones use this. Defaults to
46
+ * a same-origin `/api/decrypt-pdf`. Point it at NamahaPDF's hosted API (or your
47
+ * own backend) to support opening encrypted PDFs inside your app.
48
+ */
49
+ decryptUrl?: string;
50
+ /**
51
+ * Endpoint for the secure "Sign & certify" flow, which embeds a cryptographic
52
+ * (PAdES) signature so the file is tamper-evident and verifiable in any PDF reader.
53
+ * This is server-dependent — it defaults to a same-origin `/api/sign`. Point it at
54
+ * NamahaPDF's hosted API (or your own backend) to enable cryptographic signing in
55
+ * your app. Quick (visual) sign always works fully in the browser with no backend.
56
+ */
57
+ signUrl?: string;
58
+ /**
59
+ * Match the editor to your brand. Pass one or more semantic colors (hex) and the
60
+ * full tonal scale is derived for you — e.g. `theme={{ primary: '#2563EB' }}`
61
+ * recolors buttons, active states, the brand mark and focus rings. `surface`
62
+ * recolors panels/canvas, `text` recolors body text + hairlines. Applied purely
63
+ * client-side (no network call); omit it to keep the stock "warm paper" look.
64
+ */
65
+ theme?: NamahaTheme;
9
66
  /** Extra class on the scoping wrapper. */
10
67
  className?: string;
11
68
  style?: React.CSSProperties;
@@ -17,7 +74,7 @@ interface NamahaEditorProps {
17
74
  *
18
75
  * Import the stylesheet once in your app: `import '@namahapdf/react/styles.css'`.
19
76
  */
20
- declare function NamahaEditor({ licenseKey, activationUrl, className, style }: NamahaEditorProps): react_jsx_runtime.JSX.Element;
77
+ declare function NamahaEditor({ licenseKey, activationUrl, decryptUrl, signUrl, theme, className, style, }: NamahaEditorProps): react_jsx_runtime.JSX.Element;
21
78
 
22
79
  /** Shared license/activation contracts used by both the engine gate and the server. */
23
80
  /** Capabilities a license can unlock. `view`/`annotate` are the always-available base. */
@@ -92,4 +149,4 @@ declare function shouldWatermark(): boolean;
92
149
  /** Subscribe to state changes (activation success/failure). Returns an unsubscribe. */
93
150
  declare function onLicenseChange(cb: Listener): () => void;
94
151
 
95
- export { type LicenseConfig, type LicenseEdition, type LicenseFeature, type LicenseState, type LicenseStatus, NamahaEditor, type NamahaEditorProps, configureLicense, NamahaEditor as default, getLicenseState, isFeatureEnabled, onLicenseChange, shouldWatermark };
152
+ export { type LicenseConfig, type LicenseEdition, type LicenseFeature, type LicenseState, type LicenseStatus, NamahaEditor, type NamahaEditorProps, type NamahaTheme, buildThemeVars, configureLicense, NamahaEditor as default, getLicenseState, isFeatureEnabled, onLicenseChange, shouldWatermark };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,68 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import * as React from 'react';
3
3
 
4
+ /**
5
+ * Brand theming for <NamahaEditor>.
6
+ *
7
+ * The editor's colors are applied through Tailwind utilities (`bg-crimson-600`,
8
+ * `text-ink`, `bg-paper-card`, …) that resolve to channel-based CSS variables
9
+ * (`rgb(var(--namaha-*) / <alpha-value>)`) — see `tailwind.config.js` and
10
+ * `styles.css`. This module turns a small semantic `theme` object into the matching
11
+ * `--namaha-*` overrides, which `<NamahaEditor>` sets as inline style on the
12
+ * `.namahapdf-root` wrapper so they cascade to every scoped utility.
13
+ *
14
+ * It is **purely client-side** — no network call. Out of the box (no `theme`) the
15
+ * defaults in `styles.css` reproduce the stock "warm paper" look exactly.
16
+ *
17
+ * The consumer supplies one or more of `primary` / `surface` / `text` (hex). We
18
+ * derive the full tonal scale + surface/text shades from each so a single brand
19
+ * color themes everything consistently. Channel variables (space-separated `R G B`)
20
+ * are required so Tailwind opacity modifiers (`bg-primary/10`, `ring-primary/50`)
21
+ * keep working.
22
+ */
23
+ interface NamahaTheme {
24
+ /** Brand accent (hex). Drives buttons, active states, the brand mark and focus rings. */
25
+ primary?: string;
26
+ /** Surface/background color (hex). Drives the editor canvas, panels and cards. */
27
+ surface?: string;
28
+ /** Body text color (hex). Drives primary/secondary/muted text and hairlines. */
29
+ text?: string;
30
+ }
31
+ /**
32
+ * Build the `--namaha-*` CSS-variable overrides for a theme. Only the keys the
33
+ * consumer provides emit variables; everything else falls back to the defaults in
34
+ * `styles.css`. Returns a plain object suitable for spreading into a React `style`.
35
+ */
36
+ declare function buildThemeVars(theme?: NamahaTheme | null): Record<string, string>;
37
+
4
38
  interface NamahaEditorProps {
5
39
  /** Your NamahaPDF SDK license key. Without it the editor runs in watermarked mode. */
6
40
  licenseKey?: string;
7
41
  /** Override the activation endpoint (defaults to a same-origin /api/license/activate). */
8
42
  activationUrl?: string;
43
+ /**
44
+ * Endpoint used to decrypt password-protected PDFs. Unencrypted PDFs open fully
45
+ * in the browser with no network call; only encrypted ones use this. Defaults to
46
+ * a same-origin `/api/decrypt-pdf`. Point it at NamahaPDF's hosted API (or your
47
+ * own backend) to support opening encrypted PDFs inside your app.
48
+ */
49
+ decryptUrl?: string;
50
+ /**
51
+ * Endpoint for the secure "Sign & certify" flow, which embeds a cryptographic
52
+ * (PAdES) signature so the file is tamper-evident and verifiable in any PDF reader.
53
+ * This is server-dependent — it defaults to a same-origin `/api/sign`. Point it at
54
+ * NamahaPDF's hosted API (or your own backend) to enable cryptographic signing in
55
+ * your app. Quick (visual) sign always works fully in the browser with no backend.
56
+ */
57
+ signUrl?: string;
58
+ /**
59
+ * Match the editor to your brand. Pass one or more semantic colors (hex) and the
60
+ * full tonal scale is derived for you — e.g. `theme={{ primary: '#2563EB' }}`
61
+ * recolors buttons, active states, the brand mark and focus rings. `surface`
62
+ * recolors panels/canvas, `text` recolors body text + hairlines. Applied purely
63
+ * client-side (no network call); omit it to keep the stock "warm paper" look.
64
+ */
65
+ theme?: NamahaTheme;
9
66
  /** Extra class on the scoping wrapper. */
10
67
  className?: string;
11
68
  style?: React.CSSProperties;
@@ -17,7 +74,7 @@ interface NamahaEditorProps {
17
74
  *
18
75
  * Import the stylesheet once in your app: `import '@namahapdf/react/styles.css'`.
19
76
  */
20
- declare function NamahaEditor({ licenseKey, activationUrl, className, style }: NamahaEditorProps): react_jsx_runtime.JSX.Element;
77
+ declare function NamahaEditor({ licenseKey, activationUrl, decryptUrl, signUrl, theme, className, style, }: NamahaEditorProps): react_jsx_runtime.JSX.Element;
21
78
 
22
79
  /** Shared license/activation contracts used by both the engine gate and the server. */
23
80
  /** Capabilities a license can unlock. `view`/`annotate` are the always-available base. */
@@ -92,4 +149,4 @@ declare function shouldWatermark(): boolean;
92
149
  /** Subscribe to state changes (activation success/failure). Returns an unsubscribe. */
93
150
  declare function onLicenseChange(cb: Listener): () => void;
94
151
 
95
- export { type LicenseConfig, type LicenseEdition, type LicenseFeature, type LicenseState, type LicenseStatus, NamahaEditor, type NamahaEditorProps, configureLicense, NamahaEditor as default, getLicenseState, isFeatureEnabled, onLicenseChange, shouldWatermark };
152
+ export { type LicenseConfig, type LicenseEdition, type LicenseFeature, type LicenseState, type LicenseStatus, NamahaEditor, type NamahaEditorProps, type NamahaTheme, buildThemeVars, configureLicense, NamahaEditor as default, getLicenseState, isFeatureEnabled, onLicenseChange, shouldWatermark };