@clepit/core 0.2.0-beta.323 → 0.3.0-beta.324

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/CHANGELOG.md CHANGED
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.3.0] — 2026-08-11
11
+
12
+ ### Added
13
+ - `tokensToLightDarkBlock` is exported: turns a light/dark `ThemeTokens` pair into a `light-dark()` CSS variable block for a selector, so a host can emit theme overrides for statically rendered content (`renderBlocks`) without a live `StyleManager`.
14
+ - `activateBlocks(container, blocks)` is exported: wires the behaviors statically rendered markup deliberately leaves out (code tab switching, language sync and the clipboard; openapi response tabs and embedded samples; table CSV download) into markup `renderBlocks` produced earlier, and returns a disposer that removes every listener it added.
15
+
16
+ - `drawBlock` stamps `data-block-type` and, when the block carries an id, `data-clepit-block-id` on each drawn root element, so statically rendered markup is addressable per block.
17
+ - Public pages are anchor-navigable: `renderPage` sets the new `DrawContext.anchorTargets` flag so identified block roots carry a real DOM `id`, and the stylesheet highlights the `:target` block. A copied block anchor link (`…/slug#blockId`) scrolls and highlights with no script.
18
+
19
+ ### Fixed
20
+ - Code samples embedded in an openapi reference are now live in every path: their copy buttons and language tabs were drawn but never wired, on the client render path included. `CodeOutput.activateFromMarkup` reads the wiring inputs back out of the drawn markup (pane text as code, tab text as label, the sync key from a stamped attribute).
21
+ - `Editor.destroy` now releases id-keyed state (theme registry, body theme attribute, pending toolbar timers) even when the container element has already left the DOM. React hosts remove the element before effect cleanup fires, so the previous early return leaked the theme registration on every unmount and left `body[data-clepit-theme]` stuck.
22
+
10
23
  ## [0.2.0] — 2026-04-21
11
24
 
12
25
  ### Added
@@ -13,6 +13,10 @@ export declare class Editor {
13
13
  */
14
14
  private static localizeData;
15
15
  private static render;
16
+ /** Runs even after the container has left the DOM (a React host removes the
17
+ * element before effect cleanup fires): every helper guards its own DOM
18
+ * access, and the id-keyed state — theme registry, body theme attribute,
19
+ * pending toolbar timers — must be released either way. */
16
20
  static destroy(containerId: string): void;
17
21
  }
18
22
  //# sourceMappingURL=index.d.ts.map
@@ -43,6 +43,11 @@ export type ClepitElement = {
43
43
  export type DrawContext = {
44
44
  /** A toc derives from its siblings, which no block-local data carries. */
45
45
  documentBlocks?: readonly Block[];
46
+ /** Stamp each identified block root with a DOM `id` so a URL fragment can
47
+ * land on it. Set by `renderPage` for public pages; off elsewhere, because
48
+ * the docs pipeline injects its own slug ids onto headings and one element
49
+ * must not carry two. */
50
+ anchorTargets?: boolean;
46
51
  /** Which variant a code block opens on. */
47
52
  activeVariant?: number;
48
53
  /** Google Maps embeds need a key to build a provider URL. */
@@ -0,0 +1,14 @@
1
+ import { Block } from '../../types';
2
+ /**
3
+ * Wire the behaviors `renderBlocks` markup deliberately leaves out: code tab
4
+ * switching, language sync and the clipboard; openapi response tabs; the
5
+ * table CSV download.
6
+ *
7
+ * The markup carries `data-clepit-block-id` from `drawBlock`, so each block's
8
+ * element is found exactly rather than by position, including inside columns
9
+ * and collapsibles. An element already activated is skipped, and the returned
10
+ * disposer removes every listener that was added: a React host can activate
11
+ * on mount and release on unmount as often as it likes.
12
+ */
13
+ export declare const activateBlocks: (container: HTMLElement, blocks: readonly Block[]) => (() => void);
14
+ //# sourceMappingURL=activate.d.ts.map
package/dist/index.d.ts CHANGED
@@ -2,9 +2,10 @@ export { Editor } from './core/editor';
2
2
  export { type Backing, type ClepitElement, type DrawContext, domBacking, renderToString, stringBacking, toDomElement } from './core/element';
3
3
  export { StyleManager } from './core/managers/style';
4
4
  export { Renderer } from './core/renderer';
5
+ export { activateBlocks } from './core/renderer/activate';
5
6
  export { drawBlock } from './core/renderer/draw';
6
7
  export { type PublicPage, pageStylesheet, renderBlocks, renderPage } from './core/renderer/page';
7
- export type { ThemeTokens } from './core/theme';
8
+ export { type ThemeTokens, tokensToLightDarkBlock } from './core/theme';
8
9
  export type { OpenApiGroup, OpenApiModel, OpenApiOperation, OpenApiServer } from './tools/block/openapi/spec';
9
10
  export { parseOpenApi } from './tools/block/openapi/spec';
10
11
  export type { ALERT_VARIANTS, AlertData, AlertVariant, AudioData, Block, BlockClassNames, BlockMargins, BlockStyles, BlockTune, CodeData, CodeVariant, CSSProperties, CSSValue, DelimiterData, DelimiterVariant, EditorAPI, EditorClassNames, EditorConfig, EditorData, EditorStyles, GlanceData, GlanceRow, HeaderData, HeaderLevel, ImageData, InlineToolType as InlineTool, InputClassNames, InputConfig, InputStyles, ListData, ListType, OpenApiData, OpenApiFilter, OutputComponent, OutputConfig, ParagraphData, QuoteData, RendererConfig, TableData, ToolType as BlockType, UploadFunction, VideoData, } from './types';