@clepit/core 0.6.0 → 0.7.0-beta.439

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 (46) hide show
  1. package/CHANGELOG.md +27 -1
  2. package/dist/code.js +1 -1
  3. package/dist/code.mjs +1 -1
  4. package/dist/core/editor/index.d.ts +5 -0
  5. package/dist/core/editor/showing-locale.d.ts +8 -0
  6. package/dist/core/editor/views/json.d.ts +1 -0
  7. package/dist/core/element/index.d.ts +5 -4
  8. package/dist/core/errors.d.ts +6 -0
  9. package/dist/core/i18n/index.d.ts +5 -0
  10. package/dist/core/managers/block/css.d.ts +1 -1
  11. package/dist/core/renderer/page.d.ts +14 -0
  12. package/dist/core/upload-refusal.d.ts +6 -0
  13. package/dist/highlight-CJeA_s9m.mjs +2 -0
  14. package/dist/highlight-ZIUsGHah.js +2 -0
  15. package/dist/index.d.ts +5 -2
  16. package/dist/index.js +1 -1
  17. package/dist/index.mjs +1 -1
  18. package/dist/tools/block/code/css.d.ts +1 -1
  19. package/dist/tools/block/code/theme-css.d.ts +3 -1
  20. package/dist/tools/block/collection/css.d.ts +3 -3
  21. package/dist/tools/block/doc-card/css.d.ts +3 -3
  22. package/dist/tools/block/embed/css.d.ts +3 -3
  23. package/dist/tools/block/file/css.d.ts +3 -3
  24. package/dist/tools/block/glance/css.d.ts +1 -1
  25. package/dist/tools/block/image/input.d.ts +3 -0
  26. package/dist/tools/block/issues/css.d.ts +2 -2
  27. package/dist/tools/block/openapi/css.d.ts +2 -2
  28. package/dist/tools/block/quote/css.d.ts +1 -1
  29. package/dist/tools/block/sketch/css.d.ts +3 -3
  30. package/dist/tools/block/table/css.d.ts +1 -1
  31. package/dist/tools/block/typeset/css.d.ts +3 -3
  32. package/dist/tools/block/typeset/latex/model.d.ts +6 -9
  33. package/dist/tools/block/typeset/latex/parse.d.ts +7 -0
  34. package/dist/tools/block/typeset/latex/symbols.d.ts +2 -2
  35. package/dist/tools/block/typeset/mermaid/model.d.ts +8 -12
  36. package/dist/tools/block/updates/css.d.ts +3 -3
  37. package/dist/tools/inline/issue/css.d.ts +3 -3
  38. package/dist/tools/inline/mention/css.d.ts +1 -1
  39. package/dist/types.d.ts +12 -3
  40. package/dist/utils/detect-language.d.ts +8 -0
  41. package/dist/utils/platform.d.ts +0 -30
  42. package/dist/utils/safe-href.d.ts +8 -0
  43. package/dist/utils/url.d.ts +0 -33
  44. package/package.json +3 -3
  45. package/dist/highlight-C4NcTcIm.mjs +0 -2
  46. package/dist/highlight-eQD0I7eW.js +0 -2
package/CHANGELOG.md CHANGED
@@ -5,11 +5,37 @@ All notable changes to `@clepit/core` are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [Unreleased]
8
+ ## [0.7.0]
9
+
10
+ ### Changed
11
+ - The default accent is the current Bomdisoft brand: `primary` #5958fc and `primaryHover` #4746ce in the light scheme, #7881ff and #8896ff in the dark, with the brand tints, the code selection and the mention, issue and embed accents following it. The mention chip reads `--clepit-primary` where it painted a fixed colour. The editor owns its code colours: strings are blue in both schemes (#0a3069 light, #a5d6ff dark) and dark punctuation is #c9d1d9, so each code role keeps one hue across schemes. A test pins the accent to the platform's brand.
9
12
 
10
13
  ### Added
14
+ - `DrawContext.locale` and `DrawContext.defaultLocale`: `renderBlocks` draws each translated field in the language asked for, falling back to the page's own, and draws a translated document that names no language in the first of its languages, where it drew "[object Object]". A document with no translation draws exactly as before.
11
15
  - `EditorConfig.onClearRequest`: the toolbar's Clear awaits the host and empties the page only when it resolves `true`; a rejection leaves the page and is reported. Absent, Clear empties the page at once, as before. `@clepit/react`'s `ClepitEditor` forwards it through the same latest-props contract as `onChange`.
12
16
  - `EditorConfig.dialogLabels` and `DIALOG_LABELS`: the link, tooltip and status dialogs draw the host's words (titles, field labels, placeholders, the status variants, Cancel and Apply), in English when absent. Each dialog element carries a test id (`link-dialog-title`, `status-dialog-variant-success` and the rest).
17
+ - Six `blockToolbarLabels` keys for the image block's own words: `imageDropTitle`, `imageDropAction`, `imageDropFormats`, `imageUploading`, `imageUploadFailed` and `imageInvalidType`, in English when absent. The drop area's delete button takes the `delete` label as its tooltip and its `aria-label`. Each state carries a test id (`image-drop`, `image-drop-title`, `image-uploading`, `image-upload-failed`, `image-invalid-type` and the rest).
18
+ - `UploadRefusal` and `UploadNotice`: an image uploader that rejects with `new UploadRefusal({ title, body, action, remove })` turns the block into a framed notice in the host's words, in place of the drop area: the title, the reason, the action as a link opening in a new tab (http and https only; left out when absent) and a Remove that deletes the block. Any other rejection still shows the failed-upload line. Test ids `image-refusal`, `image-refusal-title`, `image-refusal-body`, `image-refusal-action` and `image-refusal-remove`.
19
+ - `PublicPage.alternates` and `PublicPage.notice`: `renderPage` writes one `<link rel="alternate">` per hreflang and address pair, and draws the notice (a title and a line, test id `public-page-notice`) below the page title with its own styles. A page passing neither renders exactly as before.
20
+ - `pageMetadata`, `renderNotice` and `noticeStylesheet`: a host that frames a public page in its own chrome writes the page's description, canonical, language and link-preview tags and draws its language notice exactly as `renderPage` does, which now draws both through them.
21
+ - `PublicPage.scheme`: `renderPage` draws the page in `light` or `dark` only, by setting `data-clepit-theme` on `<body>` (the attribute the theme's tokens resolve under) and a `color-scheme` meta so the browser's own canvas and text follow it. A page passing no scheme renders exactly as before.
22
+ - Eight `blockToolbarLabels` keys for the table block's row and column menus: `tableInsertAbove`, `tableInsertBelow`, `tableInsertLeft`, `tableInsertRight`, `tableMoveLeft`, `tableMoveRight`, `tableRowActions` and `tableColumnActions`, in English when absent. The menus' move up, move down and delete items take the existing `moveUp`, `moveDown` and `delete` labels, the two menu buttons take the last two keys as their `aria-label`, and each item carries a test id (`table-row-move-up`, `table-column-delete` and the rest).
23
+ - Test ids on the block menu's variant pickers, which had none: `heading-h1` to `heading-h6`, `list-unordered` and `list-ordered`, `alert-info` and the other alert variants, the `glance-*` variants, and `delimiter-line` and `delimiter-stars`. A host's tests can select these items without depending on their words.
24
+ - `ClepitError` and `ClepitErrorCode`: the package names its own failures by code. `Renderer.render` given a container id that matches no element throws a `ClepitError` with the code `CONTAINER_MISSING`, where it threw a plain `Error`; the message is unchanged, and it is still an `Error`.
25
+
26
+ ### Fixed
27
+ - The table's row and column menus drew their items in English only, and chose each item's icon, and the delete item's warning style, by matching that English, so translated words would have lost both. The words now come from the host, and each item states its own icon and style.
28
+ - An editor given `locale` kept only the language being edited: an edit replaced a field's map of languages with one string. The editor now keeps each block's stored data and writes an edit back into it with the rule both twins share, on every way a block leaves it (`onChange`, `data.extract()`, `blocks.get` and `blocks.getAll`), while `blocks.insert`, `blocks.update` and `data.set` take stored data and show it in the language being edited. A converted block keeps the languages of the fields both types share.
29
+ - An editor given no `locale` drew a translated field as "[object Object]". It now shows a translated document in the first of its languages, and keeps the others through an edit.
30
+ - The inline toolbar no longer leaves a hidden copy of the rewrite menu behind each time a new selection repaints it, so each rewrite action exists once in the page.
31
+ - The editor drew no glance or updates block. It offered both in its block menu, but choosing either inserted nothing, and a page holding one opened without it. Both now draw in the editor like every other block.
32
+ - A rewrite that the host's `onInlineRewrite` rejects is reported with `console.error`, and the passage stays as it was; it vanished silently before. A failure inside the inline or block toolbar now reaches the page's error reporting instead of being caught and dropped.
33
+
34
+ ### Security
35
+ - Every block sanitises its stored markup when it draws it, on the editing path and the reading path alike, and the DOM backing's `setHtml` sanitises like the string backing. A paragraph, header, quote, alert, list or checklist item, or an image, video or audio caption stored with an event handler (by a client writing the document directly, for instance) no longer runs it in the browser of whoever opens the page.
36
+ - `sanitizeHtml` parses into a document from `document.implementation.createHTMLDocument`, which has no browsing context, so markup is never handed to the live page while it is cleaned, and drops `javascript:`, `data:` and `vbscript:` link targets, as `sanitizeHtmlWithoutDom` already did. It still needs only `document`.
37
+ - `sanitizeHtmlWithoutDom` reads a tag as a browser does: a quote opens a value only after `=` and is an ordinary character in a name or an unquoted value, a tag the input ends inside is dropped, and comments and declarations are dropped. A `<` or `>` left in text is escaped. One stray quote in a tag (`<img src=x onerror=alert(1) a"b>`) used to carry the whole tag, handler included, into every page drawn with `renderBlocks` or `renderPage`.
38
+ - An issue chip, an issue card and a Linked issues row draw their link only for an http or https address, and a chip read back from a page or from markup keeps no other link or avatar address. A stored `javascript:` issue URL used to be redrawn as a live link.
13
39
 
14
40
  ## [0.6.0] - 2026-09-25
15
41
 
package/dist/code.js CHANGED
@@ -1 +1 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./highlight-eQD0I7eW.js");exports.CODE_THEME_TOKENS=e.CODE_THEME_TOKENS,exports.CODE_TOKEN_GROUPS=e.CODE_TOKEN_GROUPS,exports.tokenizeCode=e.tokenizeCode;
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./highlight-ZIUsGHah.js");exports.CODE_THEME_TOKENS=e.CODE_THEME_TOKENS,exports.CODE_TOKEN_GROUPS=e.CODE_TOKEN_GROUPS,exports.tokenizeCode=e.tokenizeCode;
package/dist/code.mjs CHANGED
@@ -1 +1 @@
1
- import{i,r,t as s}from"./highlight-C4NcTcIm.mjs";export{r as CODE_THEME_TOKENS,i as CODE_TOKEN_GROUPS,s as tokenizeCode};
1
+ import{i,r,t as s}from"./highlight-CJeA_s9m.mjs";export{r as CODE_THEME_TOKENS,i as CODE_TOKEN_GROUPS,s as tokenizeCode};
@@ -1,5 +1,6 @@
1
1
  import { EditorAPI, EditorConfig } from '../../types';
2
2
  export declare class Editor {
3
+ private static sources;
3
4
  static create(config: EditorConfig): EditorAPI;
4
5
  private static initialize;
5
6
  /**
@@ -12,6 +13,10 @@ export declare class Editor {
12
13
  * change when they switched.
13
14
  */
14
15
  private static localizeData;
16
+ private static localizeBlock;
17
+ private static localizeArriving;
18
+ private static delocalizeBlock;
19
+ private static delocalizeData;
15
20
  private static render;
16
21
  /** Releases the runtime a container holds and leaves its document in the
17
22
  * store. `create` runs this first so a second create in the same container
@@ -0,0 +1,8 @@
1
+ export declare class ShowingLocale {
2
+ private static shown;
3
+ static note(containerId: string, blockId: string, locale: string | null): void;
4
+ static apply(containerId: string, holder: HTMLElement): void;
5
+ static clear(containerId: string, holder: HTMLElement): void;
6
+ static forget(containerId: string): void;
7
+ }
8
+ //# sourceMappingURL=showing-locale.d.ts.map
@@ -4,6 +4,7 @@ export declare class JsonView {
4
4
  private static removeEventListeners;
5
5
  private static handleJsonInput;
6
6
  private static validateAndUpdateJson;
7
+ private static markInvalid;
7
8
  static destroy(containerId: string): void;
8
9
  }
9
10
  //# sourceMappingURL=json.d.ts.map
@@ -21,10 +21,9 @@ export type ClepitElement = {
21
21
  /**
22
22
  * Assign markup.
23
23
  *
24
- * The DOM backing hands this to the browser's parser. The string backing has
25
- * no parser, so it runs the value through the sanitiser it was constructed
26
- * with — without that, stored document content would emit arbitrary markup
27
- * into a server-rendered page.
24
+ * Both backings sanitise it, because stored document content is not trusted:
25
+ * the DOM backing with the editor's own sanitiser, the string backing (which
26
+ * has no parser) with the one it was constructed with.
28
27
  */
29
28
  setHtml(html: string): void;
30
29
  append(child: ClepitElement): void;
@@ -66,6 +65,8 @@ export type DrawContext = {
66
65
  issueChip?: IssueChipParts;
67
66
  /** Translated issue words; English fallbacks otherwise. */
68
67
  issueLabels?: Partial<Record<IssueLabel, string>>;
68
+ locale?: string;
69
+ defaultLocale?: string;
69
70
  };
70
71
  export type Backing = {
71
72
  create(tag: string): ClepitElement;
@@ -0,0 +1,6 @@
1
+ export type ClepitErrorCode = 'CONTAINER_MISSING';
2
+ export declare class ClepitError extends Error {
3
+ readonly code: ClepitErrorCode;
4
+ constructor(code: ClepitErrorCode, message: string);
5
+ }
6
+ //# sourceMappingURL=errors.d.ts.map
@@ -40,4 +40,9 @@ export declare const resolveLocalized: <T>(value: Localized<T> | undefined, requ
40
40
  * changes shape.
41
41
  */
42
42
  export declare const withLocale: <T>(value: Localized<T> | undefined, locale: string, next: T, documentDefault: string) => Localized<T>;
43
+ export declare const writeBlockData: (blockType: string, stored: Record<string, unknown> | undefined, edited: Record<string, unknown>, locale: string, documentDefault: string) => Record<string, unknown>;
44
+ export declare const firstLocaleOf: (blocks: {
45
+ data: unknown;
46
+ type: string;
47
+ }[]) => string | undefined;
43
48
  //# sourceMappingURL=index.d.ts.map
@@ -1,3 +1,3 @@
1
1
  export declare const stylesKey = "clepit-block-manager-styles";
2
- export declare const style = "\n/* Blocks */\n.clepit-block {\n position: relative;\n margin: var(--block-margin-top, 8px) 0 var(--block-margin-bottom, 16px) 0;\n padding: 8px 0;\n padding-left: 54px;\n border-radius: 4px;\n transition: background-color 0.2s ease;\n display: flex;\n align-items: flex-start;\n gap: 6px;\n}\n\n.clepit-block:hover {\n background-color: var(--clepit-block-highlight-bg);\n}\n\n.clepit-block--active {\n background-color: var(--clepit-block-highlight-bg);\n}\n\n.clepit-block-content {\n outline: none;\n min-height: 1.2em;\n flex: 1;\n min-width: 0; /* Allow content to shrink */\n}\n\n/* Remove focus outline from editable elements */\n.clepit-block-content [contenteditable=\"true\"] {\n outline: none;\n}\n\n/* Placeholder styles for all text elements */\n.clepit-block-content:empty::before {\n content: attr(data-placeholder);\n color: var(--clepit-text-subtle);\n pointer-events: none;\n font-style: italic;\n}\n\n/* Menu animation classes */\n.clepit-block-type-selector--visible {\n display: block;\n transform: translateY(0);\n}\n\n.clepit-block-type-selector--hidden {\n display: none;\n}\n\n/* Block Operations Menu */\n.clepit-block-operations-menu {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 1001;\n background: var(--clepit-bg);\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 8px;\n min-width: 200px;\n margin-top: 4px;\n display: none;\n transition: transform 0.2s ease;\n}\n\n.clepit-block-operations-menu--visible {\n display: block;\n transform: translateY(0);\n}\n\n.clepit-block-operations-menu--hidden {\n display: none;\n}\n\n/* Block Type Selector */\n.clepit-block-type-selector {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 1001;\n background: var(--clepit-bg);\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 8px;\n min-width: 150px;\n margin-top: 4px;\n display: none;\n transition: transform 0.2s ease;\n}\n\n.clepit-block-type-selector--visible {\n display: block;\n transform: translateY(0);\n}\n\n.clepit-block-type-selector--hidden {\n display: none;\n}\n\n/* Default menu item styles - package doesn't care about theme */\n.clepit-menu-item {\n padding: 8px 12px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.2s;\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.clepit-menu-item .clepit-menu-icon {\n width: 16px;\n height: 16px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n}\n\n.clepit-menu-item:hover {\n background-color: var(--clepit-selection-bg);\n}\n\n.clepit-menu-item.active {\n background-color: var(--clepit-primary-bg);\n color: var(--clepit-primary);\n font-weight: bold;\n}\n\n.clepit-menu-item--danger {\n color: var(--clepit-error);\n}\n\n/* Block type menu items - match font size with operations menu */\n.clepit-block-type-item {\n font-size: 14px;\n}\n\n/* Default menu divider styles */\n.clepit-menu-divider {\n height: 1px;\n background: linear-gradient(to right, transparent, var(--clepit-border), transparent);\n margin: 8px 0;\n}\n\n/* Default menu arrow styles */\n.clepit-menu-arrow {\n margin-left: auto;\n font-size: 12px;\n color: var(--clepit-text-muted);\n}\n\n/* Input styles for block type selector */\n.clepit-block-type-selector input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid var(--clepit-input-border, var(--clepit-border));\n border-radius: 4px;\n font-size: 14px;\n margin-bottom: 8px;\n outline: none;\n transition: border-color 0.2s;\n background-color: var(--input-bg, var(--clepit-bg));\n color: var(--input-color, var(--clepit-text));\n}\n\n.clepit-block-type-selector input:focus {\n border-color: var(--clepit-primary);\n box-shadow: 0 0 0 2px var(--clepit-primary-bg);\n}\n\n.clepit-block-type-selector input::placeholder {\n color: var(--placeholder-color, var(--clepit-text-subtle));\n}\n\n.clepit-block-type-selector-items {\n max-height: 200px;\n overflow-y: auto;\n}\n\n.clepit-menu-icon {\n font-size: 14px;\n min-width: 20px;\n text-align: center;\n font-weight: bold;\n}\n\n.clepit-menu-shortcut {\n margin-left: auto;\n font-size: 9px;\n color: var(--clepit-text-muted);\n opacity: 0.7;\n}\n\n.clepit-menu-positioned {\n position: absolute;\n z-index: 1001;\n top: var(--menu-top, 0);\n left: var(--menu-left, 0);\n}\n\n/* The block menus are popovers in the top layer. Anchor positioning puts them\n * under the block toolbar without JavaScript measuring anything.\n *\n * Guarded: anchor positioning is Baseline 2026 (Chrome 125+, Firefox 132+,\n * Safari 18.2+), roughly 91% of traffic. Browsers without it get the popover's\n * default centred placement rather than a second JS positioning path \u2014 the menu\n * stays usable, just not adjacent to its button. */\n.clepit-block-type-selector:popover-open,\n.clepit-block-operations-menu:popover-open {\n /* The base menu rules above still say display:none from the pre-popover\n * mechanism, and an author rule outranks the UA's popover reveal. Without\n * an explicit display here every menu opens into the top layer invisible. */\n display: block;\n margin: 0;\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n background: var(--clepit-bg);\n padding: 8px;\n overflow: visible;\n}\n\n.clepit-convert-submenu:popover-open {\n display: block;\n}\n\n@supports (anchor-name: --a) {\n .clepit-block-type-selector:popover-open,\n .clepit-block-operations-menu:popover-open {\n position-anchor: --clepit-block-toolbar;\n position-area: block-end span-inline-end;\n margin-block-start: 5px;\n inset: auto;\n }\n}\n\n@supports (position-try-fallbacks: flip-block) {\n .clepit-block-type-selector:popover-open,\n .clepit-block-operations-menu:popover-open {\n position-try-fallbacks: flip-block;\n }\n}\n\n/* Convert Submenu */\n@supports (anchor-name: --a) {\n .clepit-convert-submenu:popover-open {\n position: fixed;\n position-area: inline-end span-block-end;\n margin: 0 0 0 4px;\n inset: auto;\n }\n\n .clepit-convert-submenu:popover-open {\n position-try-fallbacks: flip-inline;\n }\n}\n\n.clepit-convert-submenu {\n position: absolute;\n top: var(--submenu-top, 0);\n left: var(--submenu-left, 100%);\n z-index: var(--submenu-z-index, 1002);\n background: var(--clepit-bg);\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 8px;\n min-width: 140px;\n margin-left: 4px;\n display: none;\n transition: transform 0.2s ease;\n}\n\n.clepit-convert-submenu--visible {\n display: block;\n opacity: 1;\n transform: translateX(0);\n}\n\n.clepit-convert-submenu--hidden {\n display: none;\n opacity: 0;\n transform: translateX(-10px);\n}\n\n/* Input styles for convert submenu */\n.clepit-convert-submenu input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--clepit-input-border, var(--clepit-border));\n border-radius: 4px;\n font-size: 12px;\n outline: none;\n background-color: var(--input-bg, var(--clepit-bg));\n color: var(--input-color, var(--clepit-text));\n}\n\n.clepit-convert-submenu input:focus {\n border-color: var(--clepit-input-focus-border, var(--clepit-primary));\n box-shadow: 0 0 0 2px var(--clepit-input-focus-shadow, var(--clepit-primary-bg));\n}\n\n.clepit-convert-submenu input::placeholder {\n color: var(--clepit-input-placeholder, var(--clepit-text-subtle));\n}\n\n.clepit-convert-submenu-items {\n max-height: 200px;\n overflow-y: auto;\n}\n\n.clepit-block-operation-item {\n padding: 8px 12px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.2s;\n font-size: 14px;\n}\n\n.clepit-block-operation-item:hover {\n background-color: var(--clepit-hover-bg, var(--clepit-selection-bg));\n}\n\n/* Input styles for operations menu */\n.clepit-block-operations-menu input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid var(--clepit-input-border, var(--clepit-border));\n border-radius: 4px;\n font-size: 14px;\n margin-bottom: 8px;\n outline: none;\n transition: border-color 0.2s;\n background-color: var(--input-bg, var(--clepit-bg));\n color: var(--input-color, var(--clepit-text));\n}\n\n.clepit-block-operations-menu input:focus {\n border-color: var(--clepit-primary);\n box-shadow: 0 0 0 2px var(--clepit-primary-bg);\n}\n\n.clepit-block-operations-menu input::placeholder {\n color: var(--placeholder-color, var(--clepit-text-subtle));\n}\n\n.clepit-block-operations-menu-items {\n max-height: 200px;\n overflow-y: auto;\n}\n\n.clepit-block-operation-item[data-operation=\"delete\"] {\n color: var(--clepit-error);\n}\n\n/* Convert submenu items */\n.clepit-convert-option-item {\n padding: 8px 12px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.2s;\n font-size: 14px;\n}\n\n.clepit-convert-option-item:hover {\n background-color: var(--clepit-hover-bg, var(--clepit-selection-bg));\n}\n\n/* Indentation */\n.clepit-block[data-indent=\"1\"] .clepit-block-content {\n margin-left: 20px;\n}\n\n.clepit-block[data-indent=\"2\"] .clepit-block-content {\n margin-left: 40px;\n}\n\n.clepit-block[data-indent=\"3\"] .clepit-block-content {\n margin-left: 60px;\n}\n\n/* Responsive */\n@media (max-width: 768px) {\n /* The 54px gutter exists to hold the block toolbar, which is only ever\n * displayed on the active block. On a phone that reserved a seventh of the\n * editor's width on every idle block at once, pushing the text into a narrow\n * column with empty space either side. Give the width back and let the\n * gutter open only under the block whose toolbar is actually showing. */\n /* No transition on padding-left. The block element is re-created as you\n * interact with it, so an animated gutter restarts from 0 every time and\n * never reaches its end value \u2014 the toolbar would sit on top of the text. */\n .clepit-block {\n padding-left: 0;\n }\n\n .clepit-block--active,\n .clepit-block:focus-within,\n .clepit-block:has(.clepit-block-toolbar--visible) {\n padding-left: 54px;\n }\n}\n";
2
+ export declare const style = "\n/* Blocks */\n.clepit-block {\n position: relative;\n margin: var(--block-margin-top, 8px) 0 var(--block-margin-bottom, 16px) 0;\n padding: 8px 0;\n padding-left: 54px;\n border-radius: 4px;\n transition: background-color 0.2s ease;\n display: flex;\n align-items: flex-start;\n gap: 6px;\n}\n\n.clepit-block:hover {\n background-color: var(--clepit-block-highlight-bg);\n}\n\n.clepit-block--active {\n background-color: var(--clepit-block-highlight-bg);\n}\n\n.clepit-block-content {\n outline: none;\n min-height: 1.2em;\n flex: 1;\n min-width: 0; /* Allow content to shrink */\n}\n\n.clepit-block[data-showing-locale] .clepit-block-content {\n color: color-mix(in oklab, var(--clepit-text) 60%, transparent);\n}\n\n.clepit-block-showing-locale {\n display: inline-flex;\n flex: none;\n align-items: center;\n align-self: flex-start;\n height: 18px;\n margin-top: 2px;\n padding: 0 6px;\n border-radius: 999px;\n background-color: var(--clepit-surface-2);\n color: var(--clepit-text-muted);\n font-size: 11px;\n font-weight: 500;\n letter-spacing: 0.02em;\n line-height: 1;\n user-select: none;\n}\n\n/* Remove focus outline from editable elements */\n.clepit-block-content [contenteditable=\"true\"] {\n outline: none;\n}\n\n/* Placeholder styles for all text elements */\n.clepit-block-content:empty::before {\n content: attr(data-placeholder);\n color: var(--clepit-text-subtle);\n pointer-events: none;\n font-style: italic;\n}\n\n/* Menu animation classes */\n.clepit-block-type-selector--visible {\n display: block;\n transform: translateY(0);\n}\n\n.clepit-block-type-selector--hidden {\n display: none;\n}\n\n/* Block Operations Menu */\n.clepit-block-operations-menu {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 1001;\n background: var(--clepit-bg);\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 8px;\n min-width: 200px;\n margin-top: 4px;\n display: none;\n transition: transform 0.2s ease;\n}\n\n.clepit-block-operations-menu--visible {\n display: block;\n transform: translateY(0);\n}\n\n.clepit-block-operations-menu--hidden {\n display: none;\n}\n\n/* Block Type Selector */\n.clepit-block-type-selector {\n position: absolute;\n top: 100%;\n left: 0;\n z-index: 1001;\n background: var(--clepit-bg);\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 8px;\n min-width: 150px;\n margin-top: 4px;\n display: none;\n transition: transform 0.2s ease;\n}\n\n.clepit-block-type-selector--visible {\n display: block;\n transform: translateY(0);\n}\n\n.clepit-block-type-selector--hidden {\n display: none;\n}\n\n/* Default menu item styles - package doesn't care about theme */\n.clepit-menu-item {\n padding: 8px 12px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.2s;\n display: flex;\n align-items: center;\n gap: 8px;\n}\n\n.clepit-menu-item .clepit-menu-icon {\n width: 16px;\n height: 16px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 14px;\n}\n\n.clepit-menu-item:hover {\n background-color: var(--clepit-selection-bg);\n}\n\n.clepit-menu-item.active {\n background-color: var(--clepit-primary-bg);\n color: var(--clepit-primary);\n font-weight: bold;\n}\n\n.clepit-menu-item--danger {\n color: var(--clepit-error);\n}\n\n/* Block type menu items - match font size with operations menu */\n.clepit-block-type-item {\n font-size: 14px;\n}\n\n/* Default menu divider styles */\n.clepit-menu-divider {\n height: 1px;\n background: linear-gradient(to right, transparent, var(--clepit-border), transparent);\n margin: 8px 0;\n}\n\n/* Default menu arrow styles */\n.clepit-menu-arrow {\n margin-left: auto;\n font-size: 12px;\n color: var(--clepit-text-muted);\n}\n\n/* Input styles for block type selector */\n.clepit-block-type-selector input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid var(--clepit-input-border, var(--clepit-border));\n border-radius: 4px;\n font-size: 14px;\n margin-bottom: 8px;\n outline: none;\n transition: border-color 0.2s;\n background-color: var(--input-bg, var(--clepit-bg));\n color: var(--input-color, var(--clepit-text));\n}\n\n.clepit-block-type-selector input:focus {\n border-color: var(--clepit-primary);\n box-shadow: 0 0 0 2px var(--clepit-primary-bg);\n}\n\n.clepit-block-type-selector input::placeholder {\n color: var(--placeholder-color, var(--clepit-text-subtle));\n}\n\n.clepit-block-type-selector-items {\n max-height: 200px;\n overflow-y: auto;\n}\n\n.clepit-menu-icon {\n font-size: 14px;\n min-width: 20px;\n text-align: center;\n font-weight: bold;\n}\n\n.clepit-menu-shortcut {\n margin-left: auto;\n font-size: 9px;\n color: var(--clepit-text-muted);\n opacity: 0.7;\n}\n\n.clepit-menu-positioned {\n position: absolute;\n z-index: 1001;\n top: var(--menu-top, 0);\n left: var(--menu-left, 0);\n}\n\n/* The block menus are popovers in the top layer. Anchor positioning puts them\n * under the block toolbar without JavaScript measuring anything.\n *\n * Guarded: anchor positioning is Baseline 2026 (Chrome 125+, Firefox 132+,\n * Safari 18.2+), roughly 91% of traffic. Browsers without it get the popover's\n * default centred placement rather than a second JS positioning path \u2014 the menu\n * stays usable, just not adjacent to its button. */\n.clepit-block-type-selector:popover-open,\n.clepit-block-operations-menu:popover-open {\n /* The base menu rules above still say display:none from the pre-popover\n * mechanism, and an author rule outranks the UA's popover reveal. Without\n * an explicit display here every menu opens into the top layer invisible. */\n display: block;\n margin: 0;\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n background: var(--clepit-bg);\n padding: 8px;\n overflow: visible;\n}\n\n.clepit-convert-submenu:popover-open {\n display: block;\n}\n\n@supports (anchor-name: --a) {\n .clepit-block-type-selector:popover-open,\n .clepit-block-operations-menu:popover-open {\n position-anchor: --clepit-block-toolbar;\n position-area: block-end span-inline-end;\n margin-block-start: 5px;\n inset: auto;\n }\n}\n\n@supports (position-try-fallbacks: flip-block) {\n .clepit-block-type-selector:popover-open,\n .clepit-block-operations-menu:popover-open {\n position-try-fallbacks: flip-block;\n }\n}\n\n/* Convert Submenu */\n@supports (anchor-name: --a) {\n .clepit-convert-submenu:popover-open {\n position: fixed;\n position-area: inline-end span-block-end;\n margin: 0 0 0 4px;\n inset: auto;\n }\n\n .clepit-convert-submenu:popover-open {\n position-try-fallbacks: flip-inline;\n }\n}\n\n.clepit-convert-submenu {\n position: absolute;\n top: var(--submenu-top, 0);\n left: var(--submenu-left, 100%);\n z-index: var(--submenu-z-index, 1002);\n background: var(--clepit-bg);\n border: 1px solid var(--clepit-border);\n border-radius: 6px;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);\n padding: 8px;\n min-width: 140px;\n margin-left: 4px;\n display: none;\n transition: transform 0.2s ease;\n}\n\n.clepit-convert-submenu--visible {\n display: block;\n opacity: 1;\n transform: translateX(0);\n}\n\n.clepit-convert-submenu--hidden {\n display: none;\n opacity: 0;\n transform: translateX(-10px);\n}\n\n/* Input styles for convert submenu */\n.clepit-convert-submenu input {\n width: 100%;\n padding: 6px 8px;\n border: 1px solid var(--clepit-input-border, var(--clepit-border));\n border-radius: 4px;\n font-size: 12px;\n outline: none;\n background-color: var(--input-bg, var(--clepit-bg));\n color: var(--input-color, var(--clepit-text));\n}\n\n.clepit-convert-submenu input:focus {\n border-color: var(--clepit-input-focus-border, var(--clepit-primary));\n box-shadow: 0 0 0 2px var(--clepit-input-focus-shadow, var(--clepit-primary-bg));\n}\n\n.clepit-convert-submenu input::placeholder {\n color: var(--clepit-input-placeholder, var(--clepit-text-subtle));\n}\n\n.clepit-convert-submenu-items {\n max-height: 200px;\n overflow-y: auto;\n}\n\n.clepit-block-operation-item {\n padding: 8px 12px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.2s;\n font-size: 14px;\n}\n\n.clepit-block-operation-item:hover {\n background-color: var(--clepit-hover-bg, var(--clepit-selection-bg));\n}\n\n/* Input styles for operations menu */\n.clepit-block-operations-menu input {\n width: 100%;\n padding: 8px 12px;\n border: 1px solid var(--clepit-input-border, var(--clepit-border));\n border-radius: 4px;\n font-size: 14px;\n margin-bottom: 8px;\n outline: none;\n transition: border-color 0.2s;\n background-color: var(--input-bg, var(--clepit-bg));\n color: var(--input-color, var(--clepit-text));\n}\n\n.clepit-block-operations-menu input:focus {\n border-color: var(--clepit-primary);\n box-shadow: 0 0 0 2px var(--clepit-primary-bg);\n}\n\n.clepit-block-operations-menu input::placeholder {\n color: var(--placeholder-color, var(--clepit-text-subtle));\n}\n\n.clepit-block-operations-menu-items {\n max-height: 200px;\n overflow-y: auto;\n}\n\n.clepit-block-operation-item[data-operation=\"delete\"] {\n color: var(--clepit-error);\n}\n\n/* Convert submenu items */\n.clepit-convert-option-item {\n padding: 8px 12px;\n cursor: pointer;\n border-radius: 4px;\n transition: background-color 0.2s;\n font-size: 14px;\n}\n\n.clepit-convert-option-item:hover {\n background-color: var(--clepit-hover-bg, var(--clepit-selection-bg));\n}\n\n/* Indentation */\n.clepit-block[data-indent=\"1\"] .clepit-block-content {\n margin-left: 20px;\n}\n\n.clepit-block[data-indent=\"2\"] .clepit-block-content {\n margin-left: 40px;\n}\n\n.clepit-block[data-indent=\"3\"] .clepit-block-content {\n margin-left: 60px;\n}\n\n/* Responsive */\n@media (max-width: 768px) {\n /* The 54px gutter exists to hold the block toolbar, which is only ever\n * displayed on the active block. On a phone that reserved a seventh of the\n * editor's width on every idle block at once, pushing the text into a narrow\n * column with empty space either side. Give the width back and let the\n * gutter open only under the block whose toolbar is actually showing. */\n /* No transition on padding-left. The block element is re-created as you\n * interact with it, so an animated gutter restarts from 0 every time and\n * never reaches its end value \u2014 the toolbar would sit on top of the text. */\n .clepit-block {\n padding-left: 0;\n }\n\n .clepit-block--active,\n .clepit-block:focus-within,\n .clepit-block:has(.clepit-block-toolbar--visible) {\n padding-left: 54px;\n }\n}\n";
3
3
  //# sourceMappingURL=css.d.ts.map
@@ -8,7 +8,21 @@ export type PublicPage = {
8
8
  locale?: string;
9
9
  description?: string;
10
10
  canonicalUrl?: string;
11
+ alternates?: PublicPageAlternate[];
12
+ notice?: PublicPageNotice;
13
+ scheme?: 'light' | 'dark';
11
14
  };
15
+ export type PublicPageAlternate = {
16
+ href: string;
17
+ hreflang: string;
18
+ };
19
+ export type PublicPageNotice = {
20
+ body: string;
21
+ title: string;
22
+ };
23
+ export declare const noticeStylesheet: () => string;
24
+ export declare const renderNotice: (notice: PublicPageNotice) => string;
25
+ export declare const pageMetadata: (page: Pick<PublicPage, "alternates" | "canonicalUrl" | "description" | "title">) => string;
12
26
  /**
13
27
  * Every stylesheet a drawn document needs, as text.
14
28
  *
@@ -0,0 +1,6 @@
1
+ import { UploadNotice } from '../types';
2
+ export declare class UploadRefusal extends Error {
3
+ readonly notice: UploadNotice;
4
+ constructor(notice: UploadNotice);
5
+ }
6
+ //# sourceMappingURL=upload-refusal.d.ts.map
@@ -0,0 +1,2 @@
1
+ var e=()=>({background:"var(--clepit-code-bg)",comment:"var(--clepit-code-comment)",function:"var(--clepit-code-function)",gutter:"var(--clepit-code-gutter)",keyword:"var(--clepit-code-keyword)",number:"var(--clepit-code-number)",punctuation:"var(--clepit-code-punctuation)",selection:"var(--clepit-code-selection-bg)",string:"var(--clepit-code-string)",text:"var(--clepit-code-text)",type:"var(--clepit-code-type)"}),t={dark:{background:"#1c2128",comment:"rgba(240, 246, 252, 0.42)",function:"#d2a8ff",gutter:"rgba(240, 246, 252, 0.42)",keyword:"#ff7b72",number:"#79c0ff",punctuation:"#c9d1d9",selection:"rgba(120, 129, 255, 0.24)",string:"#a5d6ff",text:"rgba(240, 246, 252, 0.92)",type:"#ffa657"},dracula:{background:"#282a36",comment:"#6272a4",function:"#50fa7b",gutter:"#6272a4",keyword:"#ff79c6",number:"#bd93f9",punctuation:"#f8f8f2",selection:"rgba(68, 71, 90, 0.8)",string:"#f1fa8c",text:"#f8f8f2",type:"#8be9fd"},github:{background:"#ffffff",comment:"#6e7781",function:"#8250df",gutter:"#8c959f",keyword:"#cf222e",number:"#0550ae",punctuation:"#24292f",selection:"rgba(84, 174, 255, 0.24)",string:"#0a3069",text:"#24292f",type:"#953800"},"github-dark":{background:"#0d1117",comment:"#8b949e",function:"#d2a8ff",gutter:"#6e7681",keyword:"#ff7b72",number:"#79c0ff",punctuation:"#c9d1d9",selection:"rgba(56, 139, 253, 0.24)",string:"#a5d6ff",text:"#c9d1d9",type:"#ffa657"},light:{background:"#fdfdfd",comment:"#868f9c",function:"#6f42c1",gutter:"#868f9c",keyword:"#cf222e",number:"#0550ae",punctuation:"#525866",selection:"rgba(89, 88, 252, 0.14)",string:"#0a3069",text:"#0a0a0a",type:"#953800"},monokai:{background:"#272822",comment:"#75715e",function:"#a6e22e",gutter:"#75715e",keyword:"#f92672",number:"#ae81ff",punctuation:"#f8f8f2",selection:"rgba(73, 72, 62, 0.9)",string:"#e6db74",text:"#f8f8f2",type:"#66d9ef"},solarized:{background:"#fdf6e3",comment:"#93a1a1",function:"#268bd2",gutter:"#93a1a1",keyword:"#859900",number:"#d33682",punctuation:"#657b83",selection:"rgba(238, 232, 213, 0.9)",string:"#2aa198",text:"#657b83",type:"#b58900"},"solarized-dark":{background:"#002b36",comment:"#586e75",function:"#268bd2",gutter:"#586e75",keyword:"#859900",number:"#d33682",punctuation:"#839496",selection:"rgba(7, 54, 66, 0.9)",string:"#2aa198",text:"#839496",type:"#b58900"},tomorrow:{background:"#fafafa",comment:"#8e908c",function:"#4271ae",gutter:"#8e908c",keyword:"#8959a8",number:"#f5871f",punctuation:"#4d4d4c",selection:"rgba(214, 214, 214, 0.9)",string:"#718c00",text:"#4d4d4c",type:"#c82829"}},n=["keyword","string","number","comment","function","type","punctuation","text"],i=Object.fromEntries(n.map(e=>[e,`clepit-code-${e}`])),s=e=>e>="0"&&e<="9",r=e=>" "===e||"\t"===e||"\n"===e||"\r"===e||"\f"===e||"\v"===e,o=e=>e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e||e.charCodeAt(0)>127,a=e=>(e.lineComments?.length??0)>0||(e.blockComments?.length??0)>0||(e.strings?.length??0)>0||(e.keywords?.length??0)>0||(e.types?.length??0)>0||(e.constants?.length??0)>0||(e.builtins?.length??0)>0,l=(e,t)=>new Set((e??[]).map(e=>t?e.toLowerCase():e)),c=(e,t)=>{let n=t;for(;n<e.length&&(" "===e[n]||"\t"===e[n]);)n++;return e[n]??""},u=(e,t,n)=>{const i=n.close??n.open;let s=t+n.open.length;for(;s<e.length;)if(n.escape&&e[s]===n.escape)s+=2;else{if(!n.multiline&&"\n"===e[s])return s;if(e.startsWith(i,s))return s+i.length;s++}return e.length},f=(e,t)=>{let n=t;if("0"===e[n]&&/[xXbBoO]/.test(e[n+1]??"")){for(n+=2;n<e.length&&/[0-9a-fA-F_]/.test(e[n]);)n++;return n}for(;n<e.length&&/[0-9_]/.test(e[n]);)n++;if("."===e[n]&&s(e[n+1]??""))for(n++;n<e.length&&/[0-9_]/.test(e[n]);)n++;if(/[eE]/.test(e[n]??"")&&(s(e[n+1]??"")||/[+-]/.test(e[n+1]??"")&&s(e[n+2]??"")))for(n+=2;n<e.length&&s(e[n]);)n++;for(;n<e.length&&o(e[n])&&!s(e[n])&&/[a-zA-Z]/.test(e[n])&&n-t<32&&/[nlLfFdDuUmM]/.test(e[n]);)n++;return n},d=[{escape:"\\",open:'"'},{escape:"\\",open:"'"}],p={blockComments:[["/*","*/"]],lineComments:["//"]},m=e=>({...p,functionCalls:!0,strings:d,...e}),g=e=>({functionCalls:!0,lineComments:["#"],strings:d,...e}),y=["as","async","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","from","function","get","if","import","in","instanceof","let","new","of","return","set","static","super","switch","this","throw","try","typeof","var","void","while","with","yield"],b=[...y,"abstract","declare","enum","implements","infer","interface","is","keyof","namespace","override","private","protected","public","readonly","satisfies","type"],h=m({constants:["false","null","true","undefined","NaN","Infinity"],identifierExtra:"$",keywords:y,strings:[...d,{escape:"\\",multiline:!0,open:"`"}],types:["Array","Boolean","Date","Error","Map","Number","Object","Promise","RegExp","Set","String","Symbol"]}),w={...h,keywords:b,types:[...h.types??[],"any","bigint","boolean","never","number","object","string","symbol","unknown","void"]},k=g({constants:["False","None","True"],keywords:["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"],strings:[{escape:"\\",multiline:!0,open:'"""'},{escape:"\\",multiline:!0,open:"'''"},...d],types:["bool","bytes","dict","float","frozenset","int","list","set","str","tuple"]}),v={blockComments:[["\x3c!--","--\x3e"]],strings:d,types:[]},x={assembly:{constants:[],keywords:["add","call","cmp","jmp","jne","je","lea","mov","pop","push","ret","sub","xor"],lineComments:[";","#"],strings:d,types:["byte","dword","qword","word"]},bash:g({builtins:["cd","echo","exit","export","printf","read","source"],constants:["false","true"],identifierExtra:"$",keywords:["case","do","done","elif","else","esac","fi","for","function","if","in","local","return","select","then","until","while"],strings:[{escape:"\\",multiline:!0,open:'"'},{multiline:!0,open:"'"}]}),clojure:{constants:["false","nil","true"],identifierExtra:"-*?!<>=/",keywords:["def","defmacro","defn","do","fn","if","let","loop","ns","quote","recur","require","var","when"],lineComments:[";"],strings:[{escape:"\\",multiline:!0,open:'"'}]},cobol:{caseInsensitive:!0,keywords:["accept","add","call","compute","display","division","else","end","goback","identification","if","move","perform","procedure","program-id","section","stop","to","until","working-storage"],lineComments:["*"],strings:d,types:["pic","picture"]},cpp:m({constants:["false","nullptr","true"],keywords:["auto","break","case","catch","class","const","constexpr","continue","default","delete","do","else","enum","explicit","export","extern","for","friend","goto","if","inline","mutable","namespace","new","noexcept","operator","private","protected","public","return","sizeof","static","struct","switch","template","this","throw","try","typedef","typename","union","using","virtual","volatile","while"],types:["bool","char","double","float","int","long","short","signed","size_t","unsigned","void","wchar_t"]}),csharp:m({constants:["false","null","true"],keywords:["abstract","as","async","await","base","break","case","catch","class","const","continue","default","delegate","do","else","enum","event","explicit","extern","finally","fixed","for","foreach","get","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","sealed","set","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unsafe","using","var","virtual","void","while","yield"],types:["bool","byte","char","decimal","double","float","int","long","object","sbyte","short","string","uint","ulong","ushort"]}),css:{blockComments:[["/*","*/"]],functionCalls:!0,keywords:["and","from","important","not","only","to"],strings:d,types:["@container","@import","@keyframes","@layer","@media","@property","@supports"]},dart:m({constants:["false","null","true"],keywords:["abstract","as","assert","async","await","break","case","catch","class","const","continue","covariant","default","deferred","do","else","enum","export","extends","extension","external","factory","final","finally","for","get","if","implements","import","in","is","late","library","mixin","new","on","operator","part","required","rethrow","return","sealed","set","show","static","super","switch","sync","this","throw","try","typedef","var","while","with","yield"],types:["bool","double","dynamic","int","List","Map","num","Object","Set","String","void"]}),diff:{lineComments:["diff ","index ","--- ","+++ "],strings:[]},dockerfile:g({caseInsensitive:!0,keywords:["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","run","shell","stopsignal","user","volume","workdir"]}),erlang:{constants:["false","true","undefined"],functionCalls:!0,keywords:["after","begin","case","catch","cond","end","fun","if","let","of","receive","try","when"],lineComments:["%"],strings:d},fortran:{caseInsensitive:!0,keywords:["allocate","call","contains","do","else","end","function","if","implicit","module","program","return","subroutine","then","use","while"],lineComments:["!"],strings:d,types:["character","complex","integer","logical","real"]},go:m({builtins:["append","cap","copy","delete","len","make","new","panic","recover"],constants:["false","iota","nil","true"],keywords:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],strings:[...d,{multiline:!0,open:"`"}],types:["bool","byte","complex128","complex64","error","float32","float64","int","int16","int32","int64","int8","rune","string","uint","uint16","uint32","uint64","uint8","uintptr"]}),graphql:g({keywords:["directive","enum","extend","fragment","implements","input","interface","mutation","on","query","scalar","schema","subscription","type","union"],types:["Boolean","Float","ID","Int","String"]}),groovy:m({constants:["false","null","true"],keywords:["abstract","as","assert","break","case","catch","class","const","continue","def","default","do","else","enum","extends","final","finally","for","if","implements","import","in","instanceof","interface","new","package","private","protected","public","return","static","super","switch","this","throw","throws","trait","try","while"],types:["BigDecimal","Boolean","Integer","List","Map","String","boolean","double","int","long","void"]}),haskell:{blockComments:[["{-","-}"]],constants:["False","Nothing","True"],functionCalls:!0,keywords:["case","class","data","deriving","do","else","if","import","in","infixl","infixr","instance","let","module","newtype","of","then","type","where"],lineComments:["--"],strings:[{escape:"\\",open:'"'}],types:["Bool","Char","Double","Either","Int","Integer","IO","Maybe","String"]},html:v,java:m({constants:["false","null","true"],keywords:["abstract","assert","break","case","catch","class","const","continue","default","do","else","enum","extends","final","finally","for","goto","if","implements","import","instanceof","interface","native","new","package","private","protected","public","record","return","sealed","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","var","volatile","while","yield"],types:["Boolean","Double","Integer","List","Long","Map","Object","String","boolean","byte","char","double","float","int","long","short","void"]}),javascript:h,json:{constants:["false","null","true"],strings:[{escape:"\\",open:'"'}]},jsx:h,julia:g({blockComments:[["#=","=#"]],constants:["false","nothing","true"],keywords:["abstract","baremodule","begin","break","catch","const","continue","do","else","elseif","end","export","finally","for","function","global","if","import","let","local","macro","module","mutable","primitive","quote","return","struct","try","using","while"],types:["Array","Bool","Char","Dict","Float64","Int","Int64","String"]}),kotlin:m({constants:["false","null","true"],keywords:["as","break","by","class","companion","const","constructor","continue","crossinline","data","do","else","enum","external","final","finally","for","fun","get","if","import","in","infix","init","inline","interface","internal","is","lateinit","object","open","operator","out","override","package","private","protected","public","reified","return","sealed","set","super","suspend","this","throw","try","typealias","val","var","vararg","when","while"],strings:[{escape:"\\",multiline:!0,open:'"""'},...d],types:["Any","Array","Boolean","Char","Double","Float","Int","List","Long","Map","Nothing","Set","String","Unit"]}),lua:{blockComments:[["--[[","]]"]],constants:["false","nil","true"],functionCalls:!0,keywords:["and","break","do","else","elseif","end","for","function","goto","if","in","local","not","or","repeat","return","then","until","while"],lineComments:["--"],strings:[{close:"]]",multiline:!0,open:"[["},...d]},markdown:{lineComments:[],strings:[{open:"`"}]},nginx:g({keywords:["access_log","error_log","events","http","include","index","listen","location","proxy_pass","return","root","server","server_name","ssl_certificate","upstream"]}),objectivec:m({constants:["NO","YES","nil"],identifierExtra:"@",keywords:["@class","@end","@implementation","@interface","@property","@protocol","@selector","@synthesize","break","case","const","continue","default","do","else","enum","extern","for","if","return","sizeof","static","struct","switch","typedef","union","void","while"],types:["BOOL","CGFloat","NSArray","NSDictionary","NSInteger","NSObject","NSString","char","double","float","id","int","long","short"]}),pascal:{blockComments:[["{","}"],["(*","*)"]],caseInsensitive:!0,constants:["false","nil","true"],functionCalls:!0,keywords:["and","array","begin","case","const","div","do","downto","else","end","for","function","goto","if","implementation","interface","mod","not","of","or","procedure","program","record","repeat","then","to","type","unit","until","uses","var","while","with"],lineComments:["//"],strings:[{open:"'"}],types:["boolean","byte","char","integer","real","string"]},perl:g({constants:["undef"],identifierExtra:"$@%",keywords:["do","else","elsif","foreach","for","if","last","local","my","next","our","package","return","sub","unless","until","use","while"]}),php:m({constants:["false","null","true"],identifierExtra:"$",keywords:["abstract","as","break","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enum","extends","final","finally","fn","for","foreach","function","global","if","implements","include","instanceof","interface","match","namespace","new","print","private","protected","public","readonly","require","return","static","switch","throw","trait","try","use","var","while","yield"],lineComments:["//","#"],types:["array","bool","callable","float","int","iterable","mixed","object","string","void"]}),plaintext:{},powershell:g({blockComments:[["<#","#>"]],caseInsensitive:!0,constants:["$false","$null","$true"],identifierExtra:"$-",keywords:["begin","break","catch","continue","do","else","elseif","end","finally","for","foreach","function","if","in","param","process","return","switch","throw","try","until","while"]}),protobuf:m({constants:["false","true"],keywords:["enum","extend","import","map","message","oneof","option","optional","package","repeated","required","reserved","returns","rpc","service","syntax"],types:["bool","bytes","double","fixed32","fixed64","float","int32","int64","sint32","sint64","string","uint32","uint64"]}),python:k,r:g({constants:["FALSE","Inf","NA","NULL","NaN","TRUE"],identifierExtra:".",keywords:["break","else","for","function","if","in","next","repeat","return","while"],types:["character","data.frame","factor","integer","list","logical","matrix","numeric","vector"]}),ruby:g({blockComments:[["=begin","=end"]],constants:["false","nil","true"],identifierExtra:"?!@$",keywords:["alias","and","begin","break","case","class","def","defined?","do","else","elsif","end","ensure","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","undef","unless","until","when","while","yield"],types:["Array","Float","Hash","Integer","String","Symbol"]}),rust:m({constants:["false","None","Some","true"],keywords:["as","async","await","break","const","continue","crate","dyn","else","enum","extern","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","static","struct","super","trait","type","unsafe","use","where","while"],types:["String","Vec","bool","char","f32","f64","i128","i16","i32","i64","i8","isize","str","u128","u16","u32","u64","u8","usize"]}),scala:m({constants:["false","null","true"],keywords:["abstract","case","catch","class","def","do","else","extends","final","finally","for","given","if","implicit","import","lazy","match","new","object","override","package","private","protected","return","sealed","super","this","throw","trait","try","type","val","var","while","with","yield"],types:["Any","Boolean","Double","Float","Int","List","Long","Map","Option","Seq","String","Unit"]}),scheme:{constants:["#f","#t"],identifierExtra:"-*?!<>=/",keywords:["begin","cond","define","do","else","if","lambda","let","let*","letrec","quote","set!"],lineComments:[";"],strings:[{escape:"\\",open:'"'}]},shell:g({builtins:["cd","echo","exit","export","printf","read","source"],identifierExtra:"$",keywords:["case","do","done","elif","else","esac","fi","for","function","if","in","return","then","until","while"],strings:[{escape:"\\",multiline:!0,open:'"'},{multiline:!0,open:"'"}]}),sql:{blockComments:[["/*","*/"]],caseInsensitive:!0,constants:["false","true"],functionCalls:!0,keywords:["add","all","alter","and","as","asc","begin","between","by","case","cast","column","commit","create","cross","delete","desc","distinct","drop","else","end","exists","from","full","group","having","in","index","inner","insert","into","is","join","left","like","limit","not","null","offset","on","or","order","outer","primary","references","returning","right","rollback","select","set","table","then","union","unique","update","values","view","when","where","with"],lineComments:["--"],strings:[{open:"'"},{open:'"'}],types:["bigint","boolean","bytea","date","decimal","integer","jsonb","numeric","serial","text","timestamp","uuid","varchar"]},swift:m({constants:["false","nil","true"],keywords:["actor","as","associatedtype","async","await","break","case","catch","class","continue","default","defer","deinit","do","else","enum","extension","fallthrough","fileprivate","final","for","func","guard","if","import","in","init","inout","internal","is","lazy","let","mutating","open","operator","private","protocol","public","repeat","return","self","static","struct","subscript","super","switch","throw","throws","try","typealias","var","where","while"],types:["Any","Array","Bool","Character","Dictionary","Double","Float","Int","Optional","Set","String","UInt","Void"]}),toml:g({constants:["false","true"],functionCalls:!1}),tsx:w,typescript:w,vb:{caseInsensitive:!0,constants:["False","Nothing","True"],functionCalls:!0,keywords:["as","byval","case","catch","class","dim","do","each","else","elseif","end","finally","for","function","if","imports","in","loop","module","namespace","new","next","private","public","return","select","set","sub","then","throw","try","while"],lineComments:["'"],strings:[{open:'"'}],types:["Boolean","Date","Double","Integer","Long","Object","String"]},verilog:m({keywords:["always","assign","begin","case","else","end","endcase","endmodule","for","if","initial","input","module","output","parameter","posedge","negedge"],types:["integer","logic","reg","wire"]}),vhdl:{caseInsensitive:!0,constants:["false","true"],functionCalls:!0,keywords:["architecture","begin","case","component","else","elsif","end","entity","for","function","if","is","library","loop","of","port","process","signal","then","use","when","while"],lineComments:["--"],strings:[{open:'"'}],types:["bit","boolean","integer","natural","std_logic","std_logic_vector"]},xml:v,yaml:g({constants:["false","no","null","true","yes"],functionCalls:!1})},C=(e,t)=>((e,t)=>{if(0===e.length)return[];if(!a(t))return[{classes:"",text:e}];const n=[],d=l(t.keywords,t.caseInsensitive),p=l(t.types,t.caseInsensitive),m=l(t.constants,t.caseInsensitive),g=l(t.builtins,t.caseInsensitive),y=e=>o(e)||s(e)||(t.identifierExtra?.includes(e)??!1);let b=0,h="";const w=()=>{0!==h.length&&(n.push({classes:"",text:h}),h="")},k=(e,t)=>{w(),n.push({classes:t,text:e})};for(;b<e.length;){const n=e.slice(b),a=e[b],l=(t.blockComments??[]).find(([e])=>n.startsWith(e));if(l){const[t,n]=l,s=e.indexOf(n,b+t.length),r=-1===s?e.length:s+n.length;k(e.slice(b,r),i.comment),b=r;continue}if(void 0!==(t.lineComments??[]).find(e=>n.startsWith(e))){const t=e.indexOf("\n",b),n=-1===t?e.length:t;k(e.slice(b,n),i.comment),b=n;continue}const w=(t.strings??[]).find(e=>n.startsWith(e.open));if(w){const t=u(e,b,w);k(e.slice(b,t),i.string),b=t;continue}if(s(a)&&!(b>0&&y(e[b-1]))){const t=f(e,b);k(e.slice(b,t),i.number),b=t;continue}if(o(a)||t.identifierExtra?.includes(a)){let n=b+1;for(;n<e.length&&y(e[n]);)n++;const s=e.slice(b,n),r=t.caseInsensitive?s.toLowerCase():s;d.has(r)?k(s,i.keyword):p.has(r)?k(s,i.type):m.has(r)?k(s,i.number):g.has(r)||t.functionCalls&&"("===c(e,n)?k(s,i.function):h+=s,b=n;continue}r(a)?(h+=a,b++):(k(a,i.punctuation),b++)}return w(),n})(e,x[t]??{});export{e as a,n as i,x as n,t as r,C as t};
2
+ //# sourceMappingURL=highlight-CJeA_s9m.mjs.map
@@ -0,0 +1,2 @@
1
+ var e=()=>({background:"var(--clepit-code-bg)",comment:"var(--clepit-code-comment)",function:"var(--clepit-code-function)",gutter:"var(--clepit-code-gutter)",keyword:"var(--clepit-code-keyword)",number:"var(--clepit-code-number)",punctuation:"var(--clepit-code-punctuation)",selection:"var(--clepit-code-selection-bg)",string:"var(--clepit-code-string)",text:"var(--clepit-code-text)",type:"var(--clepit-code-type)"}),t={dark:{background:"#1c2128",comment:"rgba(240, 246, 252, 0.42)",function:"#d2a8ff",gutter:"rgba(240, 246, 252, 0.42)",keyword:"#ff7b72",number:"#79c0ff",punctuation:"#c9d1d9",selection:"rgba(120, 129, 255, 0.24)",string:"#a5d6ff",text:"rgba(240, 246, 252, 0.92)",type:"#ffa657"},dracula:{background:"#282a36",comment:"#6272a4",function:"#50fa7b",gutter:"#6272a4",keyword:"#ff79c6",number:"#bd93f9",punctuation:"#f8f8f2",selection:"rgba(68, 71, 90, 0.8)",string:"#f1fa8c",text:"#f8f8f2",type:"#8be9fd"},github:{background:"#ffffff",comment:"#6e7781",function:"#8250df",gutter:"#8c959f",keyword:"#cf222e",number:"#0550ae",punctuation:"#24292f",selection:"rgba(84, 174, 255, 0.24)",string:"#0a3069",text:"#24292f",type:"#953800"},"github-dark":{background:"#0d1117",comment:"#8b949e",function:"#d2a8ff",gutter:"#6e7681",keyword:"#ff7b72",number:"#79c0ff",punctuation:"#c9d1d9",selection:"rgba(56, 139, 253, 0.24)",string:"#a5d6ff",text:"#c9d1d9",type:"#ffa657"},light:{background:"#fdfdfd",comment:"#868f9c",function:"#6f42c1",gutter:"#868f9c",keyword:"#cf222e",number:"#0550ae",punctuation:"#525866",selection:"rgba(89, 88, 252, 0.14)",string:"#0a3069",text:"#0a0a0a",type:"#953800"},monokai:{background:"#272822",comment:"#75715e",function:"#a6e22e",gutter:"#75715e",keyword:"#f92672",number:"#ae81ff",punctuation:"#f8f8f2",selection:"rgba(73, 72, 62, 0.9)",string:"#e6db74",text:"#f8f8f2",type:"#66d9ef"},solarized:{background:"#fdf6e3",comment:"#93a1a1",function:"#268bd2",gutter:"#93a1a1",keyword:"#859900",number:"#d33682",punctuation:"#657b83",selection:"rgba(238, 232, 213, 0.9)",string:"#2aa198",text:"#657b83",type:"#b58900"},"solarized-dark":{background:"#002b36",comment:"#586e75",function:"#268bd2",gutter:"#586e75",keyword:"#859900",number:"#d33682",punctuation:"#839496",selection:"rgba(7, 54, 66, 0.9)",string:"#2aa198",text:"#839496",type:"#b58900"},tomorrow:{background:"#fafafa",comment:"#8e908c",function:"#4271ae",gutter:"#8e908c",keyword:"#8959a8",number:"#f5871f",punctuation:"#4d4d4c",selection:"rgba(214, 214, 214, 0.9)",string:"#718c00",text:"#4d4d4c",type:"#c82829"}},n=["keyword","string","number","comment","function","type","punctuation","text"],i=Object.fromEntries(n.map(e=>[e,`clepit-code-${e}`])),r=e=>e>="0"&&e<="9",s=e=>" "===e||"\t"===e||"\n"===e||"\r"===e||"\f"===e||"\v"===e,o=e=>e>="a"&&e<="z"||e>="A"&&e<="Z"||"_"===e||e.charCodeAt(0)>127,a=e=>(e.lineComments?.length??0)>0||(e.blockComments?.length??0)>0||(e.strings?.length??0)>0||(e.keywords?.length??0)>0||(e.types?.length??0)>0||(e.constants?.length??0)>0||(e.builtins?.length??0)>0,l=(e,t)=>new Set((e??[]).map(e=>t?e.toLowerCase():e)),c=(e,t)=>{let n=t;for(;n<e.length&&(" "===e[n]||"\t"===e[n]);)n++;return e[n]??""},u=(e,t,n)=>{const i=n.close??n.open;let r=t+n.open.length;for(;r<e.length;)if(n.escape&&e[r]===n.escape)r+=2;else{if(!n.multiline&&"\n"===e[r])return r;if(e.startsWith(i,r))return r+i.length;r++}return e.length},f=(e,t)=>{let n=t;if("0"===e[n]&&/[xXbBoO]/.test(e[n+1]??"")){for(n+=2;n<e.length&&/[0-9a-fA-F_]/.test(e[n]);)n++;return n}for(;n<e.length&&/[0-9_]/.test(e[n]);)n++;if("."===e[n]&&r(e[n+1]??""))for(n++;n<e.length&&/[0-9_]/.test(e[n]);)n++;if(/[eE]/.test(e[n]??"")&&(r(e[n+1]??"")||/[+-]/.test(e[n+1]??"")&&r(e[n+2]??"")))for(n+=2;n<e.length&&r(e[n]);)n++;for(;n<e.length&&o(e[n])&&!r(e[n])&&/[a-zA-Z]/.test(e[n])&&n-t<32&&/[nlLfFdDuUmM]/.test(e[n]);)n++;return n},d=[{escape:"\\",open:'"'},{escape:"\\",open:"'"}],p={blockComments:[["/*","*/"]],lineComments:["//"]},m=e=>({...p,functionCalls:!0,strings:d,...e}),g=e=>({functionCalls:!0,lineComments:["#"],strings:d,...e}),y=["as","async","await","break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","from","function","get","if","import","in","instanceof","let","new","of","return","set","static","super","switch","this","throw","try","typeof","var","void","while","with","yield"],b=[...y,"abstract","declare","enum","implements","infer","interface","is","keyof","namespace","override","private","protected","public","readonly","satisfies","type"],h=m({constants:["false","null","true","undefined","NaN","Infinity"],identifierExtra:"$",keywords:y,strings:[...d,{escape:"\\",multiline:!0,open:"`"}],types:["Array","Boolean","Date","Error","Map","Number","Object","Promise","RegExp","Set","String","Symbol"]}),w={...h,keywords:b,types:[...h.types??[],"any","bigint","boolean","never","number","object","string","symbol","unknown","void"]},k=g({constants:["False","None","True"],keywords:["and","as","assert","async","await","break","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","nonlocal","not","or","pass","raise","return","try","while","with","yield"],strings:[{escape:"\\",multiline:!0,open:'"""'},{escape:"\\",multiline:!0,open:"'''"},...d],types:["bool","bytes","dict","float","frozenset","int","list","set","str","tuple"]}),v={blockComments:[["\x3c!--","--\x3e"]],strings:d,types:[]},x={assembly:{constants:[],keywords:["add","call","cmp","jmp","jne","je","lea","mov","pop","push","ret","sub","xor"],lineComments:[";","#"],strings:d,types:["byte","dword","qword","word"]},bash:g({builtins:["cd","echo","exit","export","printf","read","source"],constants:["false","true"],identifierExtra:"$",keywords:["case","do","done","elif","else","esac","fi","for","function","if","in","local","return","select","then","until","while"],strings:[{escape:"\\",multiline:!0,open:'"'},{multiline:!0,open:"'"}]}),clojure:{constants:["false","nil","true"],identifierExtra:"-*?!<>=/",keywords:["def","defmacro","defn","do","fn","if","let","loop","ns","quote","recur","require","var","when"],lineComments:[";"],strings:[{escape:"\\",multiline:!0,open:'"'}]},cobol:{caseInsensitive:!0,keywords:["accept","add","call","compute","display","division","else","end","goback","identification","if","move","perform","procedure","program-id","section","stop","to","until","working-storage"],lineComments:["*"],strings:d,types:["pic","picture"]},cpp:m({constants:["false","nullptr","true"],keywords:["auto","break","case","catch","class","const","constexpr","continue","default","delete","do","else","enum","explicit","export","extern","for","friend","goto","if","inline","mutable","namespace","new","noexcept","operator","private","protected","public","return","sizeof","static","struct","switch","template","this","throw","try","typedef","typename","union","using","virtual","volatile","while"],types:["bool","char","double","float","int","long","short","signed","size_t","unsigned","void","wchar_t"]}),csharp:m({constants:["false","null","true"],keywords:["abstract","as","async","await","base","break","case","catch","class","const","continue","default","delegate","do","else","enum","event","explicit","extern","finally","fixed","for","foreach","get","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","sealed","set","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unsafe","using","var","virtual","void","while","yield"],types:["bool","byte","char","decimal","double","float","int","long","object","sbyte","short","string","uint","ulong","ushort"]}),css:{blockComments:[["/*","*/"]],functionCalls:!0,keywords:["and","from","important","not","only","to"],strings:d,types:["@container","@import","@keyframes","@layer","@media","@property","@supports"]},dart:m({constants:["false","null","true"],keywords:["abstract","as","assert","async","await","break","case","catch","class","const","continue","covariant","default","deferred","do","else","enum","export","extends","extension","external","factory","final","finally","for","get","if","implements","import","in","is","late","library","mixin","new","on","operator","part","required","rethrow","return","sealed","set","show","static","super","switch","sync","this","throw","try","typedef","var","while","with","yield"],types:["bool","double","dynamic","int","List","Map","num","Object","Set","String","void"]}),diff:{lineComments:["diff ","index ","--- ","+++ "],strings:[]},dockerfile:g({caseInsensitive:!0,keywords:["add","arg","cmd","copy","entrypoint","env","expose","from","healthcheck","label","run","shell","stopsignal","user","volume","workdir"]}),erlang:{constants:["false","true","undefined"],functionCalls:!0,keywords:["after","begin","case","catch","cond","end","fun","if","let","of","receive","try","when"],lineComments:["%"],strings:d},fortran:{caseInsensitive:!0,keywords:["allocate","call","contains","do","else","end","function","if","implicit","module","program","return","subroutine","then","use","while"],lineComments:["!"],strings:d,types:["character","complex","integer","logical","real"]},go:m({builtins:["append","cap","copy","delete","len","make","new","panic","recover"],constants:["false","iota","nil","true"],keywords:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],strings:[...d,{multiline:!0,open:"`"}],types:["bool","byte","complex128","complex64","error","float32","float64","int","int16","int32","int64","int8","rune","string","uint","uint16","uint32","uint64","uint8","uintptr"]}),graphql:g({keywords:["directive","enum","extend","fragment","implements","input","interface","mutation","on","query","scalar","schema","subscription","type","union"],types:["Boolean","Float","ID","Int","String"]}),groovy:m({constants:["false","null","true"],keywords:["abstract","as","assert","break","case","catch","class","const","continue","def","default","do","else","enum","extends","final","finally","for","if","implements","import","in","instanceof","interface","new","package","private","protected","public","return","static","super","switch","this","throw","throws","trait","try","while"],types:["BigDecimal","Boolean","Integer","List","Map","String","boolean","double","int","long","void"]}),haskell:{blockComments:[["{-","-}"]],constants:["False","Nothing","True"],functionCalls:!0,keywords:["case","class","data","deriving","do","else","if","import","in","infixl","infixr","instance","let","module","newtype","of","then","type","where"],lineComments:["--"],strings:[{escape:"\\",open:'"'}],types:["Bool","Char","Double","Either","Int","Integer","IO","Maybe","String"]},html:v,java:m({constants:["false","null","true"],keywords:["abstract","assert","break","case","catch","class","const","continue","default","do","else","enum","extends","final","finally","for","goto","if","implements","import","instanceof","interface","native","new","package","private","protected","public","record","return","sealed","static","strictfp","super","switch","synchronized","this","throw","throws","transient","try","var","volatile","while","yield"],types:["Boolean","Double","Integer","List","Long","Map","Object","String","boolean","byte","char","double","float","int","long","short","void"]}),javascript:h,json:{constants:["false","null","true"],strings:[{escape:"\\",open:'"'}]},jsx:h,julia:g({blockComments:[["#=","=#"]],constants:["false","nothing","true"],keywords:["abstract","baremodule","begin","break","catch","const","continue","do","else","elseif","end","export","finally","for","function","global","if","import","let","local","macro","module","mutable","primitive","quote","return","struct","try","using","while"],types:["Array","Bool","Char","Dict","Float64","Int","Int64","String"]}),kotlin:m({constants:["false","null","true"],keywords:["as","break","by","class","companion","const","constructor","continue","crossinline","data","do","else","enum","external","final","finally","for","fun","get","if","import","in","infix","init","inline","interface","internal","is","lateinit","object","open","operator","out","override","package","private","protected","public","reified","return","sealed","set","super","suspend","this","throw","try","typealias","val","var","vararg","when","while"],strings:[{escape:"\\",multiline:!0,open:'"""'},...d],types:["Any","Array","Boolean","Char","Double","Float","Int","List","Long","Map","Nothing","Set","String","Unit"]}),lua:{blockComments:[["--[[","]]"]],constants:["false","nil","true"],functionCalls:!0,keywords:["and","break","do","else","elseif","end","for","function","goto","if","in","local","not","or","repeat","return","then","until","while"],lineComments:["--"],strings:[{close:"]]",multiline:!0,open:"[["},...d]},markdown:{lineComments:[],strings:[{open:"`"}]},nginx:g({keywords:["access_log","error_log","events","http","include","index","listen","location","proxy_pass","return","root","server","server_name","ssl_certificate","upstream"]}),objectivec:m({constants:["NO","YES","nil"],identifierExtra:"@",keywords:["@class","@end","@implementation","@interface","@property","@protocol","@selector","@synthesize","break","case","const","continue","default","do","else","enum","extern","for","if","return","sizeof","static","struct","switch","typedef","union","void","while"],types:["BOOL","CGFloat","NSArray","NSDictionary","NSInteger","NSObject","NSString","char","double","float","id","int","long","short"]}),pascal:{blockComments:[["{","}"],["(*","*)"]],caseInsensitive:!0,constants:["false","nil","true"],functionCalls:!0,keywords:["and","array","begin","case","const","div","do","downto","else","end","for","function","goto","if","implementation","interface","mod","not","of","or","procedure","program","record","repeat","then","to","type","unit","until","uses","var","while","with"],lineComments:["//"],strings:[{open:"'"}],types:["boolean","byte","char","integer","real","string"]},perl:g({constants:["undef"],identifierExtra:"$@%",keywords:["do","else","elsif","foreach","for","if","last","local","my","next","our","package","return","sub","unless","until","use","while"]}),php:m({constants:["false","null","true"],identifierExtra:"$",keywords:["abstract","as","break","case","catch","class","clone","const","continue","declare","default","do","echo","else","elseif","enum","extends","final","finally","fn","for","foreach","function","global","if","implements","include","instanceof","interface","match","namespace","new","print","private","protected","public","readonly","require","return","static","switch","throw","trait","try","use","var","while","yield"],lineComments:["//","#"],types:["array","bool","callable","float","int","iterable","mixed","object","string","void"]}),plaintext:{},powershell:g({blockComments:[["<#","#>"]],caseInsensitive:!0,constants:["$false","$null","$true"],identifierExtra:"$-",keywords:["begin","break","catch","continue","do","else","elseif","end","finally","for","foreach","function","if","in","param","process","return","switch","throw","try","until","while"]}),protobuf:m({constants:["false","true"],keywords:["enum","extend","import","map","message","oneof","option","optional","package","repeated","required","reserved","returns","rpc","service","syntax"],types:["bool","bytes","double","fixed32","fixed64","float","int32","int64","sint32","sint64","string","uint32","uint64"]}),python:k,r:g({constants:["FALSE","Inf","NA","NULL","NaN","TRUE"],identifierExtra:".",keywords:["break","else","for","function","if","in","next","repeat","return","while"],types:["character","data.frame","factor","integer","list","logical","matrix","numeric","vector"]}),ruby:g({blockComments:[["=begin","=end"]],constants:["false","nil","true"],identifierExtra:"?!@$",keywords:["alias","and","begin","break","case","class","def","defined?","do","else","elsif","end","ensure","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","undef","unless","until","when","while","yield"],types:["Array","Float","Hash","Integer","String","Symbol"]}),rust:m({constants:["false","None","Some","true"],keywords:["as","async","await","break","const","continue","crate","dyn","else","enum","extern","fn","for","if","impl","in","let","loop","match","mod","move","mut","pub","ref","return","self","static","struct","super","trait","type","unsafe","use","where","while"],types:["String","Vec","bool","char","f32","f64","i128","i16","i32","i64","i8","isize","str","u128","u16","u32","u64","u8","usize"]}),scala:m({constants:["false","null","true"],keywords:["abstract","case","catch","class","def","do","else","extends","final","finally","for","given","if","implicit","import","lazy","match","new","object","override","package","private","protected","return","sealed","super","this","throw","trait","try","type","val","var","while","with","yield"],types:["Any","Boolean","Double","Float","Int","List","Long","Map","Option","Seq","String","Unit"]}),scheme:{constants:["#f","#t"],identifierExtra:"-*?!<>=/",keywords:["begin","cond","define","do","else","if","lambda","let","let*","letrec","quote","set!"],lineComments:[";"],strings:[{escape:"\\",open:'"'}]},shell:g({builtins:["cd","echo","exit","export","printf","read","source"],identifierExtra:"$",keywords:["case","do","done","elif","else","esac","fi","for","function","if","in","return","then","until","while"],strings:[{escape:"\\",multiline:!0,open:'"'},{multiline:!0,open:"'"}]}),sql:{blockComments:[["/*","*/"]],caseInsensitive:!0,constants:["false","true"],functionCalls:!0,keywords:["add","all","alter","and","as","asc","begin","between","by","case","cast","column","commit","create","cross","delete","desc","distinct","drop","else","end","exists","from","full","group","having","in","index","inner","insert","into","is","join","left","like","limit","not","null","offset","on","or","order","outer","primary","references","returning","right","rollback","select","set","table","then","union","unique","update","values","view","when","where","with"],lineComments:["--"],strings:[{open:"'"},{open:'"'}],types:["bigint","boolean","bytea","date","decimal","integer","jsonb","numeric","serial","text","timestamp","uuid","varchar"]},swift:m({constants:["false","nil","true"],keywords:["actor","as","associatedtype","async","await","break","case","catch","class","continue","default","defer","deinit","do","else","enum","extension","fallthrough","fileprivate","final","for","func","guard","if","import","in","init","inout","internal","is","lazy","let","mutating","open","operator","private","protocol","public","repeat","return","self","static","struct","subscript","super","switch","throw","throws","try","typealias","var","where","while"],types:["Any","Array","Bool","Character","Dictionary","Double","Float","Int","Optional","Set","String","UInt","Void"]}),toml:g({constants:["false","true"],functionCalls:!1}),tsx:w,typescript:w,vb:{caseInsensitive:!0,constants:["False","Nothing","True"],functionCalls:!0,keywords:["as","byval","case","catch","class","dim","do","each","else","elseif","end","finally","for","function","if","imports","in","loop","module","namespace","new","next","private","public","return","select","set","sub","then","throw","try","while"],lineComments:["'"],strings:[{open:'"'}],types:["Boolean","Date","Double","Integer","Long","Object","String"]},verilog:m({keywords:["always","assign","begin","case","else","end","endcase","endmodule","for","if","initial","input","module","output","parameter","posedge","negedge"],types:["integer","logic","reg","wire"]}),vhdl:{caseInsensitive:!0,constants:["false","true"],functionCalls:!0,keywords:["architecture","begin","case","component","else","elsif","end","entity","for","function","if","is","library","loop","of","port","process","signal","then","use","when","while"],lineComments:["--"],strings:[{open:'"'}],types:["bit","boolean","integer","natural","std_logic","std_logic_vector"]},xml:v,yaml:g({constants:["false","no","null","true","yes"],functionCalls:!1})},C=(e,t)=>((e,t)=>{if(0===e.length)return[];if(!a(t))return[{classes:"",text:e}];const n=[],d=l(t.keywords,t.caseInsensitive),p=l(t.types,t.caseInsensitive),m=l(t.constants,t.caseInsensitive),g=l(t.builtins,t.caseInsensitive),y=e=>o(e)||r(e)||(t.identifierExtra?.includes(e)??!1);let b=0,h="";const w=()=>{0!==h.length&&(n.push({classes:"",text:h}),h="")},k=(e,t)=>{w(),n.push({classes:t,text:e})};for(;b<e.length;){const n=e.slice(b),a=e[b],l=(t.blockComments??[]).find(([e])=>n.startsWith(e));if(l){const[t,n]=l,r=e.indexOf(n,b+t.length),s=-1===r?e.length:r+n.length;k(e.slice(b,s),i.comment),b=s;continue}if(void 0!==(t.lineComments??[]).find(e=>n.startsWith(e))){const t=e.indexOf("\n",b),n=-1===t?e.length:t;k(e.slice(b,n),i.comment),b=n;continue}const w=(t.strings??[]).find(e=>n.startsWith(e.open));if(w){const t=u(e,b,w);k(e.slice(b,t),i.string),b=t;continue}if(r(a)&&!(b>0&&y(e[b-1]))){const t=f(e,b);k(e.slice(b,t),i.number),b=t;continue}if(o(a)||t.identifierExtra?.includes(a)){let n=b+1;for(;n<e.length&&y(e[n]);)n++;const r=e.slice(b,n),s=t.caseInsensitive?r.toLowerCase():r;d.has(s)?k(r,i.keyword):p.has(s)?k(r,i.type):m.has(s)?k(r,i.number):g.has(s)||t.functionCalls&&"("===c(e,n)?k(r,i.function):h+=r,b=n;continue}s(a)?(h+=a,b++):(k(a,i.punctuation),b++)}return w(),n})(e,x[t]??{});Object.defineProperty(exports,"CODE_THEME_TOKENS",{enumerable:!0,get:function(){return t}}),Object.defineProperty(exports,"CODE_TOKEN_GROUPS",{enumerable:!0,get:function(){return n}}),Object.defineProperty(exports,"GRAMMARS",{enumerable:!0,get:function(){return x}}),Object.defineProperty(exports,"resolveAutoTokens",{enumerable:!0,get:function(){return e}}),Object.defineProperty(exports,"tokenizeCode",{enumerable:!0,get:function(){return C}});
2
+ //# sourceMappingURL=highlight-ZIUsGHah.js.map
package/dist/index.d.ts CHANGED
@@ -1,11 +1,13 @@
1
1
  export { Editor } from './core/editor';
2
2
  export { type Backing, type ClepitElement, type DrawContext, domBacking, renderToString, stringBacking, toDomElement } from './core/element';
3
+ export { ClepitError, type ClepitErrorCode } from './core/errors';
3
4
  export { StyleManager } from './core/managers/style';
4
5
  export { Renderer } from './core/renderer';
5
6
  export { activateBlocks } from './core/renderer/activate';
6
7
  export { drawBlock } from './core/renderer/draw';
7
- export { type PublicPage, pageStylesheet, renderBlocks, renderPage } from './core/renderer/page';
8
+ export { noticeStylesheet, type PublicPage, type PublicPageAlternate, type PublicPageNotice, pageMetadata, pageStylesheet, renderBlocks, renderNotice, renderPage } from './core/renderer/page';
8
9
  export { type ThemeTokens, tokensToLightDarkBlock } from './core/theme';
10
+ export { UploadRefusal } from './core/upload-refusal';
9
11
  export { EMBED_ENGLISH, EMBED_TOOL_NAMES, embedLabel } from './tools/block/embed/output';
10
12
  export { EMBED_WIRE_KEYS, isEmbedProviderDisabled, resolveEmbed } from './tools/block/embed/providers';
11
13
  export type { OpenApiGroup, OpenApiModel, OpenApiOperation, OpenApiServer } from './tools/block/openapi/spec';
@@ -13,7 +15,8 @@ export { parseOpenApi } from './tools/block/openapi/spec';
13
15
  export { chipsInHtml, IssueChip, readChipMarkup, refreshChipsInHtml } from './tools/inline/issue';
14
16
  export { ISSUE_ENGLISH, ISSUE_TOOL_NAMES, issueLabel, issueToolName } from './tools/inline/issue/labels';
15
17
  export { classifyIssueUrl } from './tools/inline/issue/providers';
16
- export type { ALERT_VARIANTS, AlertData, AlertVariant, AudioData, Block, BlockClassNames, BlockMargins, BlockStyles, BlockTune, CodeData, CodeVariant, ControlLabel, CSSProperties, CSSValue, DelimiterData, DelimiterVariant, DialogLabel, EditorAPI, EditorClassNames, EditorConfig, EditorData, EditorStyles, EmbedAction, EmbedData, EmbedFile, EmbedGist, EmbedGistFile, EmbedLabel, EmbedProvider, EmbedReason, EmbedResolution, GlanceData, GlanceRow, HeaderData, HeaderLevel, ImageData, InlineRewriteAction, InlineToolType as InlineTool, InputClassNames, InputConfig, InputStyles, IssueAction, IssueCards, IssueCategory, IssueChipParts, IssueLabel, IssueReason, IssueSnapshot, IssuesData, IssueTarget, IssueTool, ListData, ListType, OpenApiData, OpenApiFilter, OutputComponent, OutputConfig, ParagraphData, PasteEmbeds, QuoteData, RendererConfig, TableData, ToolType as BlockType, UploadFunction, VideoData, } from './types';
18
+ export type { ALERT_VARIANTS, AlertData, AlertVariant, AudioData, Block, BlockClassNames, BlockMargins, BlockStyles, BlockTune, CodeData, CodeVariant, ControlLabel, CSSProperties, CSSValue, DelimiterData, DelimiterVariant, DialogLabel, EditorAPI, EditorClassNames, EditorConfig, EditorData, EditorStyles, EmbedAction, EmbedData, EmbedFile, EmbedGist, EmbedGistFile, EmbedLabel, EmbedProvider, EmbedReason, EmbedResolution, GlanceData, GlanceRow, HeaderData, HeaderLevel, ImageData, InlineRewriteAction, InlineToolType as InlineTool, InputClassNames, InputConfig, InputStyles, IssueAction, IssueCards, IssueCategory, IssueChipParts, IssueLabel, IssueReason, IssueSnapshot, IssuesData, IssueTarget, IssueTool, ListData, ListType, OpenApiData, OpenApiFilter, OutputComponent, OutputConfig, ParagraphData, PasteEmbeds, QuoteData, RendererConfig, TableData, ToolType as BlockType, UploadFunction, UploadNotice, VideoData, } from './types';
17
19
  export { BLOCK_TOOLS, CONTROL_LABELS, DIALOG_LABELS, EMBED_LABELS, INLINE_REWRITE_ACTIONS, INLINE_TOOLS, ISSUE_LABELS, ISSUE_TOOLS } from './types';
20
+ export { detectLanguage } from './utils/detect-language';
18
21
  export { sanitizeHtmlWithoutDom } from './utils/sanitize-html-nodom';
19
22
  //# sourceMappingURL=index.d.ts.map