lynkow 1.31.12 → 1.31.14
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 +40 -0
- package/dist/index.d.mts +79 -12
- package/dist/index.d.ts +79 -12
- package/dist/index.js +79 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +79 -68
- package/dist/index.mjs.map +1 -1
- package/dist/visual-editor/index.js +4 -4
- package/dist/visual-editor/index.js.map +1 -1
- package/dist/visual-editor/index.mjs +4 -4
- package/dist/visual-editor/index.mjs.map +1 -1
- package/dist/visual-editor/react/index.js +4 -4
- package/dist/visual-editor/react/index.js.map +1 -1
- package/dist/visual-editor/react/index.mjs +4 -4
- package/dist/visual-editor/react/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -609,6 +609,12 @@ const lynkow = createClient({ siteId: 'your-site-id' })
|
|
|
609
609
|
// Manually re-initialize after loading dynamic content
|
|
610
610
|
lynkow.enhancements.init()
|
|
611
611
|
|
|
612
|
+
// Skip code-block CSS + copy button (use when you already render code blocks
|
|
613
|
+
// with your own highlighter, e.g. Shiki / Prism / a custom design system).
|
|
614
|
+
// Generic enhancements (text-align preservation, script activation, widget
|
|
615
|
+
// resize) remain active.
|
|
616
|
+
lynkow.enhancements.init({ codeBlocks: false })
|
|
617
|
+
|
|
612
618
|
// Check if initialized
|
|
613
619
|
lynkow.enhancements.isInitialized()
|
|
614
620
|
|
|
@@ -699,6 +705,40 @@ The SDK automatically:
|
|
|
699
705
|
- Binds click handlers to copy buttons
|
|
700
706
|
- Shows visual feedback when code is copied
|
|
701
707
|
|
|
708
|
+
#### Theming
|
|
709
|
+
|
|
710
|
+
Code-block styles are driven by CSS custom properties. Override any of them in your own stylesheet (no `!important` required):
|
|
711
|
+
|
|
712
|
+
| Variable | Default (dark) | Default (light) | Purpose |
|
|
713
|
+
|---|---|---|---|
|
|
714
|
+
| `--lynkow-code-bg` | `#1e1e1e` | `#f5f5f5` | Background of `.code-block`, header, `<pre>` |
|
|
715
|
+
| `--lynkow-code-fg` | `#e4e4e4` | `#1a1a1a` | Code text color |
|
|
716
|
+
| `--lynkow-code-border` | `#333` | `#e0e0e0` | Header bottom border |
|
|
717
|
+
| `--lynkow-code-muted-fg` | `#888` | `#666` | Language label + idle copy button |
|
|
718
|
+
| `--lynkow-code-copy-fg-hover` | `#fff` | `#1a1a1a` | Copy button hover color |
|
|
719
|
+
| `--lynkow-code-copy-bg-hover` | `rgba(255, 255, 255, 0.1)` | `rgba(0, 0, 0, 0.05)` | Copy button hover background |
|
|
720
|
+
|
|
721
|
+
The light variant is triggered by any of these conventions on `<html>`, `<body>`, or the `.code-block` element:
|
|
722
|
+
- Class: `.light`
|
|
723
|
+
- Attribute: `data-theme="light"`, `data-mode="light"`, `data-color-scheme="light"`
|
|
724
|
+
|
|
725
|
+
`prefers-color-scheme: light` is kept as an OS-level fallback that only applies when no explicit dark signal (`.dark`, `data-theme="dark"`, `data-mode="dark"`, `data-color-scheme="dark"`) is set on `<html>`.
|
|
726
|
+
|
|
727
|
+
Override example:
|
|
728
|
+
|
|
729
|
+
```css
|
|
730
|
+
:root.dark {
|
|
731
|
+
--lynkow-code-bg: #0a0a0a;
|
|
732
|
+
--lynkow-code-fg: #fafafa;
|
|
733
|
+
}
|
|
734
|
+
```
|
|
735
|
+
|
|
736
|
+
If you render code blocks with your own highlighter and want to skip the SDK styling and copy button entirely, opt out at init time:
|
|
737
|
+
|
|
738
|
+
```typescript
|
|
739
|
+
lynkow.enhancements.init({ codeBlocks: false })
|
|
740
|
+
```
|
|
741
|
+
|
|
702
742
|
## Events
|
|
703
743
|
|
|
704
744
|
Subscribe to SDK events for reactive updates.
|
package/dist/index.d.mts
CHANGED
|
@@ -2250,9 +2250,12 @@ interface JsonLdNode {
|
|
|
2250
2250
|
/**
|
|
2251
2251
|
* Stable `@id` for this node. Server-generated (pattern `own-<8hex>`) when
|
|
2252
2252
|
* the caller omits it on create. Safe to treat as an opaque string; the
|
|
2253
|
-
* public API rewrites it to an absolute URL
|
|
2254
|
-
*
|
|
2255
|
-
*
|
|
2253
|
+
* public API rewrites it to an absolute URL in the resolved graph,
|
|
2254
|
+
* with the prefix determined by the node's effective {@link scope}
|
|
2255
|
+
* (`<site-url>#<id>` for site-scoped entries like `Organization`,
|
|
2256
|
+
* `<page-url>#<id>` for page-scoped entries like `Article`).
|
|
2257
|
+
* Never starts with the reserved `auto:` prefix, which is reserved
|
|
2258
|
+
* for nodes Lynkow injects automatically.
|
|
2256
2259
|
*/
|
|
2257
2260
|
id: string;
|
|
2258
2261
|
/**
|
|
@@ -2276,6 +2279,19 @@ interface JsonLdNode {
|
|
|
2276
2279
|
data: Record<string, unknown>;
|
|
2277
2280
|
/** Whether the node was created from a Lynkow typed preset or from raw JSON-LD. */
|
|
2278
2281
|
source: JsonLdNodeSource;
|
|
2282
|
+
/**
|
|
2283
|
+
* Optional `@id` scope override. When omitted, the cascade infers
|
|
2284
|
+
* the default from the level the entry was declared at:
|
|
2285
|
+
* - `site` for entries at site or category level (Organization,
|
|
2286
|
+
* LocalBusiness for a section, Publisher).
|
|
2287
|
+
* - `page` for entries at page or content level (Article, Product,
|
|
2288
|
+
* custom Person).
|
|
2289
|
+
* Set explicitly to opt out of the default - e.g. `scope: 'site'`
|
|
2290
|
+
* on a content-level Organization that should still be stable
|
|
2291
|
+
* across pages. The resolved `@id` becomes `<site-url>#<id>` for
|
|
2292
|
+
* `site` scope and `<page-url>#<id>` for `page` scope.
|
|
2293
|
+
*/
|
|
2294
|
+
scope?: 'site' | 'page';
|
|
2279
2295
|
}
|
|
2280
2296
|
/**
|
|
2281
2297
|
* Cascade configuration stored at any level (site, category, page, content).
|
|
@@ -5815,10 +5831,27 @@ declare class BrandingService extends BaseService {
|
|
|
5815
5831
|
* - Copy button for code blocks
|
|
5816
5832
|
* - (Future: lightbox for images, table of contents, etc.)
|
|
5817
5833
|
*/
|
|
5834
|
+
/**
|
|
5835
|
+
* Options accepted by {@link EnhancementsService.init}.
|
|
5836
|
+
*/
|
|
5837
|
+
interface EnhancementsInitOptions {
|
|
5838
|
+
/**
|
|
5839
|
+
* Disable the code-block CSS injection AND the copy-to-clipboard button binding
|
|
5840
|
+
* (initial scan + MutationObserver re-binds). Use when you have your own code-block
|
|
5841
|
+
* rendering pipeline (server-side Shiki, client-side Prism, custom design system)
|
|
5842
|
+
* and the SDK styling would conflict.
|
|
5843
|
+
*
|
|
5844
|
+
* The generic enhancements (text-align preservation, script activation, widget
|
|
5845
|
+
* iframe resize) remain active regardless of this flag.
|
|
5846
|
+
*
|
|
5847
|
+
* Default: `true` (code-block styles + copy button are injected).
|
|
5848
|
+
*/
|
|
5849
|
+
codeBlocks?: boolean;
|
|
5850
|
+
}
|
|
5818
5851
|
/**
|
|
5819
5852
|
* Service for adding interactive features to content rendered from the Lynkow API.
|
|
5820
5853
|
*
|
|
5821
|
-
* Accessible via `lynkow.enhancements`. This is a **browser-only** service
|
|
5854
|
+
* Accessible via `lynkow.enhancements`. This is a **browser-only** service: all
|
|
5822
5855
|
* methods are no-ops on the server. Currently provides:
|
|
5823
5856
|
* - **Copy button** for code blocks (elements with `[data-copy-code]` attribute)
|
|
5824
5857
|
* - **Script activation** for inline scripts injected via `dangerouslySetInnerHTML`
|
|
@@ -5829,13 +5862,31 @@ declare class BrandingService extends BaseService {
|
|
|
5829
5862
|
* applies enhancements, making it compatible with SPA frameworks like React/Next.js.
|
|
5830
5863
|
* Script clones are appended to `<head>` (not inline) to avoid React DOM reconciliation issues.
|
|
5831
5864
|
*
|
|
5865
|
+
* ## Code-block theming
|
|
5866
|
+
*
|
|
5867
|
+
* Code-block CSS is driven by CSS custom properties (`--lynkow-code-bg`,
|
|
5868
|
+
* `--lynkow-code-fg`, `--lynkow-code-border`, `--lynkow-code-muted-fg`,
|
|
5869
|
+
* `--lynkow-code-copy-fg-hover`, `--lynkow-code-copy-bg-hover`). The light
|
|
5870
|
+
* variant is triggered by any of the common theming conventions on `<html>`,
|
|
5871
|
+
* `<body>` or the `.code-block` element itself: `.light` class,
|
|
5872
|
+
* `data-theme~="light"`, `data-mode~="light"`, `data-color-scheme~="light"`.
|
|
5873
|
+
* `prefers-color-scheme: light` is kept as an OS-level fallback that only
|
|
5874
|
+
* applies when no explicit dark signal is present on `<html>`. Override any
|
|
5875
|
+
* variable in your own stylesheet to customise without `!important`.
|
|
5876
|
+
*
|
|
5877
|
+
* Pass `init({ codeBlocks: false })` if you handle code-block rendering
|
|
5878
|
+
* yourself; the SDK will skip code-block CSS injection and copy-button binding.
|
|
5879
|
+
*
|
|
5832
5880
|
* @example
|
|
5833
5881
|
* ```typescript
|
|
5834
5882
|
* const lynkow = createClient({ siteId: 'your-site-id' })
|
|
5835
5883
|
*
|
|
5836
|
-
* // Enhancements are automatically initialized by the client
|
|
5837
|
-
* //
|
|
5884
|
+
* // Enhancements are automatically initialized by the client.
|
|
5885
|
+
* // Manually reinitialize after loading dynamic content:
|
|
5838
5886
|
* lynkow.enhancements.init()
|
|
5887
|
+
*
|
|
5888
|
+
* // Skip code-block styling when rendering with your own highlighter:
|
|
5889
|
+
* lynkow.enhancements.init({ codeBlocks: false })
|
|
5839
5890
|
* ```
|
|
5840
5891
|
*/
|
|
5841
5892
|
declare class EnhancementsService {
|
|
@@ -5844,9 +5895,15 @@ declare class EnhancementsService {
|
|
|
5844
5895
|
private pendingFrame;
|
|
5845
5896
|
private handleWidgetResize;
|
|
5846
5897
|
/**
|
|
5847
|
-
* Inject styles
|
|
5898
|
+
* Inject the generic enhancement styles (text-align preservation, etc.)
|
|
5899
|
+
* into document head. Idempotent.
|
|
5900
|
+
*/
|
|
5901
|
+
private injectGenericStyles;
|
|
5902
|
+
/**
|
|
5903
|
+
* Inject the code-block styles (variable-based theming + copy button styling)
|
|
5904
|
+
* into document head. Idempotent.
|
|
5848
5905
|
*/
|
|
5849
|
-
private
|
|
5906
|
+
private injectCodeBlockStyles;
|
|
5850
5907
|
/**
|
|
5851
5908
|
* Handle copy button click
|
|
5852
5909
|
*/
|
|
@@ -5871,21 +5928,31 @@ declare class EnhancementsService {
|
|
|
5871
5928
|
* Initializes content enhancements: injects CSS styles, binds copy-to-clipboard
|
|
5872
5929
|
* handlers on code blocks, activates inline scripts, starts the widget iframe
|
|
5873
5930
|
* resize listener, and sets up a `MutationObserver` to automatically enhance
|
|
5874
|
-
* newly added DOM content. Idempotent
|
|
5931
|
+
* newly added DOM content. Idempotent: calling multiple times has no effect
|
|
5875
5932
|
* after the first initialization. No-op on server.
|
|
5876
5933
|
*
|
|
5877
5934
|
* Call this manually if you need to re-initialize after the client is created
|
|
5878
5935
|
* (e.g. after dynamically loading content outside the initial render).
|
|
5879
5936
|
*
|
|
5937
|
+
* @param options - Optional behavior toggles. See {@link EnhancementsInitOptions}.
|
|
5938
|
+
* Pass `{ codeBlocks: false }` to skip code-block CSS injection and the copy
|
|
5939
|
+
* button binding (useful when your renderer already handles code blocks).
|
|
5940
|
+
*
|
|
5880
5941
|
* @example
|
|
5881
5942
|
* ```typescript
|
|
5882
|
-
* //
|
|
5943
|
+
* // Default: inject everything.
|
|
5944
|
+
* lynkow.enhancements.init()
|
|
5945
|
+
*
|
|
5946
|
+
* // Reinitialize enhancements after dynamically loading new content.
|
|
5883
5947
|
* const html = await fetchArticleContent()
|
|
5884
5948
|
* document.getElementById('article').innerHTML = html
|
|
5885
5949
|
* lynkow.enhancements.init()
|
|
5950
|
+
*
|
|
5951
|
+
* // Opt out of code-block styling when using your own highlighter (Shiki, Prism, ...).
|
|
5952
|
+
* lynkow.enhancements.init({ codeBlocks: false })
|
|
5886
5953
|
* ```
|
|
5887
5954
|
*/
|
|
5888
|
-
init(): void;
|
|
5955
|
+
init(options?: EnhancementsInitOptions): void;
|
|
5889
5956
|
/**
|
|
5890
5957
|
* Check whether the enhancements service has been initialized for the
|
|
5891
5958
|
* current page. Returns `false` on the server and after a call to
|
|
@@ -6603,4 +6670,4 @@ declare function renderJsonLdGraph(nodes: object[] | null | undefined): string;
|
|
|
6603
6670
|
*/
|
|
6604
6671
|
declare function mergeIntoGraph(server: object[] | null | undefined, custom: object[] | null | undefined): object[];
|
|
6605
6672
|
|
|
6606
|
-
export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
|
|
6673
|
+
export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, type EnhancementsInitOptions, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
|
package/dist/index.d.ts
CHANGED
|
@@ -2250,9 +2250,12 @@ interface JsonLdNode {
|
|
|
2250
2250
|
/**
|
|
2251
2251
|
* Stable `@id` for this node. Server-generated (pattern `own-<8hex>`) when
|
|
2252
2252
|
* the caller omits it on create. Safe to treat as an opaque string; the
|
|
2253
|
-
* public API rewrites it to an absolute URL
|
|
2254
|
-
*
|
|
2255
|
-
*
|
|
2253
|
+
* public API rewrites it to an absolute URL in the resolved graph,
|
|
2254
|
+
* with the prefix determined by the node's effective {@link scope}
|
|
2255
|
+
* (`<site-url>#<id>` for site-scoped entries like `Organization`,
|
|
2256
|
+
* `<page-url>#<id>` for page-scoped entries like `Article`).
|
|
2257
|
+
* Never starts with the reserved `auto:` prefix, which is reserved
|
|
2258
|
+
* for nodes Lynkow injects automatically.
|
|
2256
2259
|
*/
|
|
2257
2260
|
id: string;
|
|
2258
2261
|
/**
|
|
@@ -2276,6 +2279,19 @@ interface JsonLdNode {
|
|
|
2276
2279
|
data: Record<string, unknown>;
|
|
2277
2280
|
/** Whether the node was created from a Lynkow typed preset or from raw JSON-LD. */
|
|
2278
2281
|
source: JsonLdNodeSource;
|
|
2282
|
+
/**
|
|
2283
|
+
* Optional `@id` scope override. When omitted, the cascade infers
|
|
2284
|
+
* the default from the level the entry was declared at:
|
|
2285
|
+
* - `site` for entries at site or category level (Organization,
|
|
2286
|
+
* LocalBusiness for a section, Publisher).
|
|
2287
|
+
* - `page` for entries at page or content level (Article, Product,
|
|
2288
|
+
* custom Person).
|
|
2289
|
+
* Set explicitly to opt out of the default - e.g. `scope: 'site'`
|
|
2290
|
+
* on a content-level Organization that should still be stable
|
|
2291
|
+
* across pages. The resolved `@id` becomes `<site-url>#<id>` for
|
|
2292
|
+
* `site` scope and `<page-url>#<id>` for `page` scope.
|
|
2293
|
+
*/
|
|
2294
|
+
scope?: 'site' | 'page';
|
|
2279
2295
|
}
|
|
2280
2296
|
/**
|
|
2281
2297
|
* Cascade configuration stored at any level (site, category, page, content).
|
|
@@ -5815,10 +5831,27 @@ declare class BrandingService extends BaseService {
|
|
|
5815
5831
|
* - Copy button for code blocks
|
|
5816
5832
|
* - (Future: lightbox for images, table of contents, etc.)
|
|
5817
5833
|
*/
|
|
5834
|
+
/**
|
|
5835
|
+
* Options accepted by {@link EnhancementsService.init}.
|
|
5836
|
+
*/
|
|
5837
|
+
interface EnhancementsInitOptions {
|
|
5838
|
+
/**
|
|
5839
|
+
* Disable the code-block CSS injection AND the copy-to-clipboard button binding
|
|
5840
|
+
* (initial scan + MutationObserver re-binds). Use when you have your own code-block
|
|
5841
|
+
* rendering pipeline (server-side Shiki, client-side Prism, custom design system)
|
|
5842
|
+
* and the SDK styling would conflict.
|
|
5843
|
+
*
|
|
5844
|
+
* The generic enhancements (text-align preservation, script activation, widget
|
|
5845
|
+
* iframe resize) remain active regardless of this flag.
|
|
5846
|
+
*
|
|
5847
|
+
* Default: `true` (code-block styles + copy button are injected).
|
|
5848
|
+
*/
|
|
5849
|
+
codeBlocks?: boolean;
|
|
5850
|
+
}
|
|
5818
5851
|
/**
|
|
5819
5852
|
* Service for adding interactive features to content rendered from the Lynkow API.
|
|
5820
5853
|
*
|
|
5821
|
-
* Accessible via `lynkow.enhancements`. This is a **browser-only** service
|
|
5854
|
+
* Accessible via `lynkow.enhancements`. This is a **browser-only** service: all
|
|
5822
5855
|
* methods are no-ops on the server. Currently provides:
|
|
5823
5856
|
* - **Copy button** for code blocks (elements with `[data-copy-code]` attribute)
|
|
5824
5857
|
* - **Script activation** for inline scripts injected via `dangerouslySetInnerHTML`
|
|
@@ -5829,13 +5862,31 @@ declare class BrandingService extends BaseService {
|
|
|
5829
5862
|
* applies enhancements, making it compatible with SPA frameworks like React/Next.js.
|
|
5830
5863
|
* Script clones are appended to `<head>` (not inline) to avoid React DOM reconciliation issues.
|
|
5831
5864
|
*
|
|
5865
|
+
* ## Code-block theming
|
|
5866
|
+
*
|
|
5867
|
+
* Code-block CSS is driven by CSS custom properties (`--lynkow-code-bg`,
|
|
5868
|
+
* `--lynkow-code-fg`, `--lynkow-code-border`, `--lynkow-code-muted-fg`,
|
|
5869
|
+
* `--lynkow-code-copy-fg-hover`, `--lynkow-code-copy-bg-hover`). The light
|
|
5870
|
+
* variant is triggered by any of the common theming conventions on `<html>`,
|
|
5871
|
+
* `<body>` or the `.code-block` element itself: `.light` class,
|
|
5872
|
+
* `data-theme~="light"`, `data-mode~="light"`, `data-color-scheme~="light"`.
|
|
5873
|
+
* `prefers-color-scheme: light` is kept as an OS-level fallback that only
|
|
5874
|
+
* applies when no explicit dark signal is present on `<html>`. Override any
|
|
5875
|
+
* variable in your own stylesheet to customise without `!important`.
|
|
5876
|
+
*
|
|
5877
|
+
* Pass `init({ codeBlocks: false })` if you handle code-block rendering
|
|
5878
|
+
* yourself; the SDK will skip code-block CSS injection and copy-button binding.
|
|
5879
|
+
*
|
|
5832
5880
|
* @example
|
|
5833
5881
|
* ```typescript
|
|
5834
5882
|
* const lynkow = createClient({ siteId: 'your-site-id' })
|
|
5835
5883
|
*
|
|
5836
|
-
* // Enhancements are automatically initialized by the client
|
|
5837
|
-
* //
|
|
5884
|
+
* // Enhancements are automatically initialized by the client.
|
|
5885
|
+
* // Manually reinitialize after loading dynamic content:
|
|
5838
5886
|
* lynkow.enhancements.init()
|
|
5887
|
+
*
|
|
5888
|
+
* // Skip code-block styling when rendering with your own highlighter:
|
|
5889
|
+
* lynkow.enhancements.init({ codeBlocks: false })
|
|
5839
5890
|
* ```
|
|
5840
5891
|
*/
|
|
5841
5892
|
declare class EnhancementsService {
|
|
@@ -5844,9 +5895,15 @@ declare class EnhancementsService {
|
|
|
5844
5895
|
private pendingFrame;
|
|
5845
5896
|
private handleWidgetResize;
|
|
5846
5897
|
/**
|
|
5847
|
-
* Inject styles
|
|
5898
|
+
* Inject the generic enhancement styles (text-align preservation, etc.)
|
|
5899
|
+
* into document head. Idempotent.
|
|
5900
|
+
*/
|
|
5901
|
+
private injectGenericStyles;
|
|
5902
|
+
/**
|
|
5903
|
+
* Inject the code-block styles (variable-based theming + copy button styling)
|
|
5904
|
+
* into document head. Idempotent.
|
|
5848
5905
|
*/
|
|
5849
|
-
private
|
|
5906
|
+
private injectCodeBlockStyles;
|
|
5850
5907
|
/**
|
|
5851
5908
|
* Handle copy button click
|
|
5852
5909
|
*/
|
|
@@ -5871,21 +5928,31 @@ declare class EnhancementsService {
|
|
|
5871
5928
|
* Initializes content enhancements: injects CSS styles, binds copy-to-clipboard
|
|
5872
5929
|
* handlers on code blocks, activates inline scripts, starts the widget iframe
|
|
5873
5930
|
* resize listener, and sets up a `MutationObserver` to automatically enhance
|
|
5874
|
-
* newly added DOM content. Idempotent
|
|
5931
|
+
* newly added DOM content. Idempotent: calling multiple times has no effect
|
|
5875
5932
|
* after the first initialization. No-op on server.
|
|
5876
5933
|
*
|
|
5877
5934
|
* Call this manually if you need to re-initialize after the client is created
|
|
5878
5935
|
* (e.g. after dynamically loading content outside the initial render).
|
|
5879
5936
|
*
|
|
5937
|
+
* @param options - Optional behavior toggles. See {@link EnhancementsInitOptions}.
|
|
5938
|
+
* Pass `{ codeBlocks: false }` to skip code-block CSS injection and the copy
|
|
5939
|
+
* button binding (useful when your renderer already handles code blocks).
|
|
5940
|
+
*
|
|
5880
5941
|
* @example
|
|
5881
5942
|
* ```typescript
|
|
5882
|
-
* //
|
|
5943
|
+
* // Default: inject everything.
|
|
5944
|
+
* lynkow.enhancements.init()
|
|
5945
|
+
*
|
|
5946
|
+
* // Reinitialize enhancements after dynamically loading new content.
|
|
5883
5947
|
* const html = await fetchArticleContent()
|
|
5884
5948
|
* document.getElementById('article').innerHTML = html
|
|
5885
5949
|
* lynkow.enhancements.init()
|
|
5950
|
+
*
|
|
5951
|
+
* // Opt out of code-block styling when using your own highlighter (Shiki, Prism, ...).
|
|
5952
|
+
* lynkow.enhancements.init({ codeBlocks: false })
|
|
5886
5953
|
* ```
|
|
5887
5954
|
*/
|
|
5888
|
-
init(): void;
|
|
5955
|
+
init(options?: EnhancementsInitOptions): void;
|
|
5889
5956
|
/**
|
|
5890
5957
|
* Check whether the enhancements service has been initialized for the
|
|
5891
5958
|
* current page. Returns `false` on the server and after a call to
|
|
@@ -6603,4 +6670,4 @@ declare function renderJsonLdGraph(nodes: object[] | null | undefined): string;
|
|
|
6603
6670
|
*/
|
|
6604
6671
|
declare function mergeIntoGraph(server: object[] | null | undefined, custom: object[] | null | undefined): object[];
|
|
6605
6672
|
|
|
6606
|
-
export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
|
|
6673
|
+
export { type Alternate, AnalyticsService, type ApiErrorDetail, type Author, type BaseRequestOptions, BlocksService, BrandingService, type CategoriesListResponse, CategoriesService, type Category, type CategoryDetail, type CategoryDetailResponse, type CategoryOptions, type CategoryResolveResponse, type CategoryTreeNode, type CategoryTreeResponse, type CategoryWithCount, type Client, type ClientConfig, type ConsentCategories, type ConsentLogResponse, ConsentService, type Content, type ContentBody, type ContentResolveResponse, type ContentSchema, type ContentSummary, type ContentsFilters, type ContentsListResponse, ContentsService, type CookieCategory, type CookieConfig, type CookiePreferences, type CookieTexts, CookiesService, type EnhancementsInitOptions, EnhancementsService, type ErrorCode, type EventData, type EventName, type Form, type FormField, type FormFieldOption, type FormFieldType, type FormFieldValidation, type FormSettings, type FormSubmitData, type FormSubmitResponse, FormsService, type GlobalBlock, type GlobalBlockResponse, type ImageVariants, type JsonLdGraphConfig, type JsonLdNode, type JsonLdNodeSource, type LegalDocument, LegalService, type LynkowClient, type LynkowConfig, LynkowError, type LynkowEvents, MediaHelperService, type Page, type PageSeo, type PageSummary, type PagesListResponse, PagesService, type PageviewData, type PaginatedResponse, type PaginationMeta, type PaginationOptions, type Path, type PathsListResponse, PathsService, type Redirect, type ResolveResponse, type Review, type ReviewResponse, type ReviewSettings, type ReviewSubmitData, type ReviewSubmitResponse, type ReviewsFilters, type ReviewsListResponse, ReviewsService, type SchemaField, type SchemaFieldOption, type SchemaFieldType, type SchemaFieldValidation, type SearchConfig, type SearchHit, type SearchOptions, type SearchProfilePublic, type SearchResponse, SearchService, SeoService, type SiteConfig, type SiteConfigResponse, SiteService, type SortOptions, type SrcsetOptions, type SubmitOptions, type Tag, type TagsListResponse, TagsService, type TipTapMark, type TipTapNode, type TransformOptions, browserOnly, browserOnlyAsync, createClient, createLynkowClient, detectSiteTheme, isBrowser, isCategoryResolve, isContentResolve, isLynkowError, isServer, mergeIntoGraph, onSiteThemeChange, renderJsonLdGraph };
|