char-fork/llama.cpp

git clone https://git.t4t.associates/char-fork/llama.cpp

Aleksander Grygierui: Constants refactor (#26908)e21152dc9

char/aliceai-t5-moe
2.1 KiB57 linesraw
1/**
2 * Constants for rendering svg code blocks inline.
3 */
4export const SVG = {
5	// CSS classes applied to the inline svg block and its chrome.
6	BLOCK_CLASS: 'svg-block',
7	/**
8	 * Shadow root style for the zoom dialog svg. Lets the svg grow past its
9	 * intrinsic size so pan and zoom have room to work.
10	 */
11	DIALOG_SHADOW_STYLE:
12		':host{display:inline-block}svg{min-height:min(50vh,12rem);min-width:min(80vw,20rem);max-width:none;max-height:none;height:auto;width:auto;display:block}',
13	ID_ATTR: 'data-svg-id',
14
15	/**
16	 * Shadow root style for an inline svg block. Mirrors the centered, padded
17	 * sizing the light dom used before the svg moved behind a shadow boundary.
18	 */
19	INLINE_SHADOW_STYLE:
20		':host{display:block;width:100%;text-align:center}svg{display:block;margin:0 auto;width:auto;height:auto;max-width:100%;max-height:70vh;min-height:8rem;padding:3rem 1rem}',
21	// Languages that mark a code block as svg content.
22	LANGUAGE: 'svg',
23	/**
24	 * Hard size ceiling for a single inline svg block.
25	 * Above this the source is left as raw text instead of being rendered.
26	 */
27	MAX_BYTES: 256 * 1024,
28
29	RENDERED_ATTR: 'data-svg-rendered',
30	/**
31	 * DOMPurify config for untrusted svg coming from model output.
32	 *
33	 * foreignObject and script stay forbidden unconditionally, they are the only
34	 * inline svg vectors that execute arbitrary html or js. Everything else is
35	 * allowed for maximum rendering compatibility: href and xlink:href stay so
36	 * use, image, a and animateMotion work, and DOMPurify still neutralizes
37	 * javascript: and data: uri schemes natively. External resource refs are
38	 * allowed by design on a local first tool, the user browser fetches them.
39	 *
40	 * The sanitized svg is always mounted inside a shadow root (see svg-shadow),
41	 * so an author <style> stays scoped to that root and can not reach the page.
42	 */
43	SANITIZE_CONFIG: {
44		FORBID_TAGS: ['foreignObject', 'script'],
45		USE_PROFILES: { svg: true, svgFilters: true }
46	},
47	SCROLL_CONTAINER_CLASS: 'svg-scroll-container',
48
49	// data-attributes used to stash per-block svg state on the DOM node.
50	SOURCE_ATTR: 'data-svg-source',
51
52	TAG_PREFIX: '<svg',
53
54	WRAPPER_CLASS: 'svg-block-wrapper',
55
56	XML_LANGUAGE: 'xml'
57};