完成世界书、骰子、apiconfig页面处理

This commit is contained in:
2026-04-30 01:35:10 +08:00
parent a3e3711b2b
commit ba9b925c32
4602 changed files with 785225 additions and 23 deletions

View File

@@ -0,0 +1 @@
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["footer.js"],"names":[],"mappings":"AAmEA;;;;;;;;;;GAUG;AACH,8CARW,MAAM,oBAGN,MAAM,GAEJ,KAAK,CAAC,cAAc,CAAC,CAiBjC;AAED;;;;;;;;;;GAUG;AACH,yDARW,MAAM,oBAGN,MAAM,GAEJ,MAAM,CASlB;AAED;;;;;;;GAOG;AAEH,8BANW,KAAK,GAEH,OAAO,GAAG,SAAS,CAmI/B;;;;;;;;;;;;;;;;;;;;;;2DA/NU,MAAM,oBAGN,MAAM,KAEJ,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc,GAAG,MAAM;;;;;;;;;;;;;;;;;;;;;;yDAwBjD,MAAM,oBAGN,MAAM,KAEJ,MAAM;oCA3DuB,MAAM;2BACxB,YAAY;6BADM,MAAM"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"blockquote.d.ts","sourceRoot":"","sources":["blockquote.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,kCAPW,KAAK,QAEL,UAAU,GAER,OAAO,CAanB;2BAvBuB,aAAa;gCADR,OAAO;6BADV,MAAM"}

View File

@@ -0,0 +1 @@
{"version":3,"file":"break.d.ts","sourceRoot":"","sources":["break.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,iCAPW,KAAK,QAEL,KAAK,GAEH,KAAK,CAAC,OAAO,GAAG,IAAI,CAAC,CAQjC;2BAlBuB,aAAa;2BADb,OAAO;6BADC,MAAM;0BAAN,MAAM"}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element, Properties} from 'hast'
* @import {Code} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `code` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Code} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function code(state: State, node: Code): Element;
import type { State } from '../state.js';
import type { Code } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=code.d.ts.map

View File

@@ -0,0 +1,49 @@
/**
* @import {Element, Properties} from 'hast'
* @import {Code} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `code` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Code} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function code(state, node) {
const value = node.value ? node.value + '\n' : ''
/** @type {Properties} */
const properties = {}
// Someone can write `js python	ruby`.
const language = node.lang ? node.lang.split(/\s+/) : []
// GH/CM still drop the non-first languages.
if (language.length > 0) {
properties.className = ['language-' + language[0]]
}
// Create `<code>`.
/** @type {Element} */
let result = {
type: 'element',
tagName: 'code',
properties,
children: [{type: 'text', value}]
}
if (node.meta) {
result.data = {meta: node.meta}
}
state.patch(node, result)
result = state.applyData(node, result)
// Create `<pre>`.
result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}
state.patch(node, result)
return result
}

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Delete} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `delete` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Delete} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function strikethrough(state: State, node: Delete): Element;
import type { State } from '../state.js';
import type { Delete } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=delete.d.ts.map

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Emphasis} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `emphasis` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Emphasis} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function emphasis(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'em',
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Heading} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `heading` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Heading} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function heading(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'h' + node.depth,
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,15 @@
/**
* Turn an mdast `imageReference` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ImageReference} node
* mdast node.
* @returns {Array<ElementContent> | ElementContent}
* hast node.
*/
export function imageReference(state: State, node: ImageReference): Array<ElementContent> | ElementContent;
import type { State } from '../state.js';
import type { ImageReference } from 'mdast';
import type { ElementContent } from 'hast';
//# sourceMappingURL=image-reference.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"image-reference.d.ts","sourceRoot":"","sources":["image-reference.js"],"names":[],"mappings":"AASA;;;;;;;;;GASG;AACH,sCAPW,KAAK,QAEL,cAAc,GAEZ,KAAK,CAAC,cAAc,CAAC,GAAG,cAAc,CAsBlD;2BAnCuB,aAAa;oCADJ,OAAO;oCADc,MAAM"}

View File

@@ -0,0 +1,55 @@
export namespace handlers {
export { blockquote };
export { hardBreak as break };
export { code };
export { strikethrough as delete };
export { emphasis };
export { footnoteReference };
export { heading };
export { html };
export { imageReference };
export { image };
export { inlineCode };
export { linkReference };
export { link };
export { listItem };
export { list };
export { paragraph };
export { root };
export { strong };
export { table };
export { tableCell };
export { tableRow };
export { text };
export { thematicBreak };
export { ignore as toml };
export { ignore as yaml };
export { ignore as definition };
export { ignore as footnoteDefinition };
}
import { blockquote } from './blockquote.js';
import { hardBreak } from './break.js';
import { code } from './code.js';
import { strikethrough } from './delete.js';
import { emphasis } from './emphasis.js';
import { footnoteReference } from './footnote-reference.js';
import { heading } from './heading.js';
import { html } from './html.js';
import { imageReference } from './image-reference.js';
import { image } from './image.js';
import { inlineCode } from './inline-code.js';
import { linkReference } from './link-reference.js';
import { link } from './link.js';
import { listItem } from './list-item.js';
import { list } from './list.js';
import { paragraph } from './paragraph.js';
import { root } from './root.js';
import { strong } from './strong.js';
import { table } from './table.js';
import { tableCell } from './table-cell.js';
import { tableRow } from './table-row.js';
import { text } from './text.js';
import { thematicBreak } from './thematic-break.js';
declare function ignore(): undefined;
export {};
//# sourceMappingURL=index.d.ts.map

View File

@@ -0,0 +1,23 @@
/**
* @import {ElementContent, Element, Properties} from 'hast'
* @import {ListItem, Parents} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `listItem` node into hast.
*
* @param {State} state
* Info passed around.
* @param {ListItem} node
* mdast node.
* @param {Parents | undefined} parent
* Parent of `node`.
* @returns {Element}
* hast node.
*/
export function listItem(state: State, node: ListItem, parent: Parents | undefined): Element;
import type { State } from '../state.js';
import type { ListItem } from 'mdast';
import type { Parents } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=list-item.d.ts.map

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Paragraph} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `paragraph` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Paragraph} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function paragraph(state: State, node: Paragraph): Element;
import type { State } from '../state.js';
import type { Paragraph } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=paragraph.d.ts.map

View File

@@ -0,0 +1,20 @@
/**
* @import {Element} from 'hast'
* @import {Strong} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `strong` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Strong} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function strong(state: State, node: Strong): Element;
import type { State } from '../state.js';
import type { Strong } from 'mdast';
import type { Element } from 'hast';
//# sourceMappingURL=strong.d.ts.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"strong.d.ts","sourceRoot":"","sources":["strong.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,8BAPW,KAAK,QAEL,MAAM,GAEJ,OAAO,CAanB;2BAvBuB,aAAa;4BADZ,OAAO;6BADN,MAAM"}

View File

@@ -0,0 +1,27 @@
/**
* @import {Element} from 'hast'
* @import {Strong} from 'mdast'
* @import {State} from '../state.js'
*/
/**
* Turn an mdast `strong` node into hast.
*
* @param {State} state
* Info passed around.
* @param {Strong} node
* mdast node.
* @returns {Element}
* hast node.
*/
export function strong(state, node) {
/** @type {Element} */
const result = {
type: 'element',
tagName: 'strong',
properties: {},
children: state.all(node)
}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1,24 @@
/**
* @import {Element as HastElement, Text as HastText} from 'hast'
* @import {Text as MdastText} from 'mdast'
* @import {State} from '../state.js'
*/
import {trimLines} from 'trim-lines'
/**
* Turn an mdast `text` node into hast.
*
* @param {State} state
* Info passed around.
* @param {MdastText} node
* mdast node.
* @returns {HastElement | HastText}
* hast node.
*/
export function text(state, node) {
/** @type {HastText} */
const result = {type: 'text', value: trimLines(String(node.value))}
state.patch(node, result)
return state.applyData(node, result)
}

View File

@@ -0,0 +1 @@
{"version":3,"file":"thematic-break.d.ts","sourceRoot":"","sources":["thematic-break.js"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;GASG;AACH,qCAPW,KAAK,QAEL,aAAa,GAEX,OAAO,CAanB;2BAvBuB,aAAa;mCADL,OAAO;6BADb,MAAM"}

View File

@@ -0,0 +1,82 @@
/**
* Transform mdast to hast.
*
* ##### Notes
*
* ###### HTML
*
* Raw HTML is available in mdast as `html` nodes and can be embedded in hast
* as semistandard `raw` nodes.
* Most utilities ignore `raw` nodes but two notable ones dont:
*
* * `hast-util-to-html` also has an option `allowDangerousHtml` which will
* output the raw HTML.
* This is typically discouraged as noted by the option name but is useful
* if you completely trust authors
* * `hast-util-raw` can handle the raw embedded HTML strings by parsing them
* into standard hast nodes (`element`, `text`, etc).
* This is a heavy task as it needs a full HTML parser, but it is the only
* way to support untrusted content
*
* ###### Footnotes
*
* Many options supported here relate to footnotes.
* Footnotes are not specified by CommonMark, which we follow by default.
* They are supported by GitHub, so footnotes can be enabled in markdown with
* `mdast-util-gfm`.
*
* The options `footnoteBackLabel` and `footnoteLabel` define natural language
* that explains footnotes, which is hidden for sighted users but shown to
* assistive technology.
* When your page is not in English, you must define translated values.
*
* Back references use ARIA attributes, but the section label itself uses a
* heading that is hidden with an `sr-only` class.
* To show it to sighted users, define different attributes in
* `footnoteLabelProperties`.
*
* ###### Clobbering
*
* Footnotes introduces a problem, as it links footnote calls to footnote
* definitions on the page through `id` attributes generated from user content,
* which results in DOM clobbering.
*
* DOM clobbering is this:
*
* ```html
* <p id=x></p>
* <script>alert(x) // `x` now refers to the DOM `p#x` element</script>
* ```
*
* Elements by their ID are made available by browsers on the `window` object,
* which is a security risk.
* Using a prefix solves this problem.
*
* More information on how to handle clobbering and the prefix is explained in
* Example: headings (DOM clobbering) in `rehype-sanitize`.
*
* ###### Unknown nodes
*
* Unknown nodes are nodes with a type that isnt in `handlers` or `passThrough`.
* The default behavior for unknown nodes is:
*
* * when the node has a `value` (and doesnt have `data.hName`,
* `data.hProperties`, or `data.hChildren`, see later), create a hast `text`
* node
* * otherwise, create a `<div>` element (which could be changed with
* `data.hName`), with its children mapped from mdast to hast as well
*
* This behavior can be changed by passing an `unknownHandler`.
*
* @param {MdastNodes} tree
* mdast tree.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {HastNodes}
* hast tree.
*/
export function toHast(tree: MdastNodes, options?: Options | null | undefined): HastNodes;
import type { Nodes as MdastNodes } from 'mdast';
import type { Options } from './state.js';
import type { Nodes as HastNodes } from 'hast';
//# sourceMappingURL=index.d.ts.map

49
frontend/node_modules/mdast-util-to-hast/lib/revert.js generated vendored Normal file
View File

@@ -0,0 +1,49 @@
/**
* @import {ElementContent} from 'hast'
* @import {Reference, Nodes} from 'mdast'
* @import {State} from './state.js'
*/
/**
* Return the content of a reference without definition as plain text.
*
* @param {State} state
* Info passed around.
* @param {Extract<Nodes, Reference>} node
* Reference node (image, link).
* @returns {Array<ElementContent>}
* hast content.
*/
export function revert(state, node) {
const subtype = node.referenceType
let suffix = ']'
if (subtype === 'collapsed') {
suffix += '[]'
} else if (subtype === 'full') {
suffix += '[' + (node.label || node.identifier) + ']'
}
if (node.type === 'imageReference') {
return [{type: 'text', value: '![' + node.alt + suffix}]
}
const contents = state.all(node)
const head = contents[0]
if (head && head.type === 'text') {
head.value = '[' + head.value
} else {
contents.unshift({type: 'text', value: '['})
}
const tail = contents[contents.length - 1]
if (tail && tail.type === 'text') {
tail.value += suffix
} else {
contents.push({type: 'text', value: suffix})
}
return contents
}

233
frontend/node_modules/mdast-util-to-hast/lib/state.d.ts generated vendored Normal file
View File

@@ -0,0 +1,233 @@
/**
* Create `state` from an mdast tree.
*
* @param {MdastNodes} tree
* mdast node to transform.
* @param {Options | null | undefined} [options]
* Configuration (optional).
* @returns {State}
* `state` function.
*/
export function createState(tree: MdastNodes, options?: Options | null | undefined): State;
/**
* Wrap `nodes` with line endings between each node.
*
* @template {HastRootContent} Type
* Node type.
* @param {Array<Type>} nodes
* List of nodes to wrap.
* @param {boolean | undefined} [loose=false]
* Whether to add line endings at start and end (default: `false`).
* @returns {Array<HastText | Type>}
* Wrapped nodes.
*/
export function wrap<Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined): Array<HastText | Type>;
/**
* Handle a node.
*/
export type Handler = (state: State, node: any, parent: MdastParents | undefined) => Array<HastElementContent> | HastElementContent | undefined;
/**
* Handle nodes.
*/
export type Handlers = Partial<Record<MdastNodes["type"], Handler>>;
/**
* Configuration (optional).
*/
export type Options = {
/**
* Whether to persist raw HTML in markdown in the hast tree (default:
* `false`).
*/
allowDangerousHtml?: boolean | null | undefined;
/**
* Prefix to use before the `id` property on footnotes to prevent them from
* *clobbering* (default: `'user-content-'`).
*
* Pass `''` for trusted markdown and when you are careful with
* polyfilling.
* You could pass a different prefix.
*
* DOM clobbering is this:
*
* ```html
* <p id="x"></p>
* <script>alert(x) // `x` now refers to the `p#x` DOM element</script>
* ```
*
* The above example shows that elements are made available by browsers, by
* their ID, on the `window` object.
* This is a security risk because you might be expecting some other variable
* at that place.
* It can also break polyfills.
* Using a prefix solves these problems.
*/
clobberPrefix?: string | null | undefined;
/**
* Corresponding virtual file representing the input document (optional).
*/
file?: VFile | null | undefined;
/**
* Content of the backreference back to references (default: `defaultFootnoteBackContent`).
*
* The default value is:
*
* ```js
* function defaultFootnoteBackContent(_, rereferenceIndex) {
* const result = [{type: 'text', value: '↩'}]
*
* if (rereferenceIndex > 1) {
* result.push({
* type: 'element',
* tagName: 'sup',
* properties: {},
* children: [{type: 'text', value: String(rereferenceIndex)}]
* })
* }
*
* return result
* }
* ```
*
* This content is used in the `a` element of each backreference (the `↩`
* links).
*/
footnoteBackContent?: FootnoteBackContentTemplate | string | null | undefined;
/**
* Label to describe the backreference back to references (default:
* `defaultFootnoteBackLabel`).
*
* The default value is:
*
* ```js
* function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {
* return (
* 'Back to reference ' +
* (referenceIndex + 1) +
* (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')
* )
* }
* ```
*
* Change it when the markdown is not in English.
*
* This label is used in the `ariaLabel` property on each backreference
* (the `↩` links).
* It affects users of assistive technology.
*/
footnoteBackLabel?: FootnoteBackLabelTemplate | string | null | undefined;
/**
* Textual label to use for the footnotes section (default: `'Footnotes'`).
*
* Change it when the markdown is not in English.
*
* This label is typically hidden visually (assuming a `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass different properties with the `footnoteLabelProperties` option.
*/
footnoteLabel?: string | null | undefined;
/**
* Properties to use on the footnote label (default: `{className:
* ['sr-only']}`).
*
* Change it to show the label and add other properties.
*
* This label is typically hidden visually (assuming an `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass an empty string.
* You can also add different properties.
*
* > **Note**: `id: 'footnote-label'` is always added, because footnote
* > calls use it with `aria-describedby` to provide an accessible label.
*/
footnoteLabelProperties?: HastProperties | null | undefined;
/**
* HTML tag name to use for the footnote label element (default: `'h2'`).
*
* Change it to match your document structure.
*
* This label is typically hidden visually (assuming a `sr-only` CSS class
* is defined that does that) and so affects screen readers only.
* If you do have such a class, but want to show this section to everyone,
* pass different properties with the `footnoteLabelProperties` option.
*/
footnoteLabelTagName?: string | null | undefined;
/**
* Extra handlers for nodes (optional).
*/
handlers?: Handlers | null | undefined;
/**
* List of custom mdast node types to pass through (keep) in hast (note that
* the node itself is passed, but eventual children are transformed)
* (optional).
*/
passThrough?: Array<MdastNodes["type"]> | null | undefined;
/**
* Handler for all unknown nodes (optional).
*/
unknownHandler?: Handler | null | undefined;
};
/**
* Info passed around.
*/
export type State = {
/**
* Transform the children of an mdast parent to hast.
*/
all: (node: MdastNodes) => Array<HastElementContent>;
/**
* Honor the `data` of `from`, and generate an element instead of `node`.
*/
applyData: <Type extends HastNodes>(from: MdastNodes, to: Type) => HastElement | Type;
/**
* Definitions by their identifier.
*/
definitionById: Map<string, MdastDefinition>;
/**
* Footnote definitions by their identifier.
*/
footnoteById: Map<string, MdastFootnoteDefinition>;
/**
* Counts for how often the same footnote was called.
*/
footnoteCounts: Map<string, number>;
/**
* Identifiers of order when footnote calls first appear in tree order.
*/
footnoteOrder: Array<string>;
/**
* Applied handlers.
*/
handlers: Handlers;
/**
* Transform an mdast node to hast.
*/
one: (node: MdastNodes, parent: MdastParents | undefined) => Array<HastElementContent> | HastElementContent | undefined;
/**
* Configuration.
*/
options: Options;
/**
* Copy a nodes positional info.
*/
patch: (from: MdastNodes, node: HastNodes) => undefined;
/**
* Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.
*/
wrap: <Type extends HastRootContent>(nodes: Array<Type>, loose?: boolean | undefined) => Array<HastText | Type>;
};
import type { Nodes as MdastNodes } from 'mdast';
import type { RootContent as HastRootContent } from 'hast';
import type { Text as HastText } from 'hast';
import type { Parents as MdastParents } from 'mdast';
import type { ElementContent as HastElementContent } from 'hast';
import type { VFile } from 'vfile';
import type { FootnoteBackContentTemplate } from './footer.js';
import type { FootnoteBackLabelTemplate } from './footer.js';
import type { Properties as HastProperties } from 'hast';
import type { Nodes as HastNodes } from 'hast';
import type { Element as HastElement } from 'hast';
import type { Definition as MdastDefinition } from 'mdast';
import type { FootnoteDefinition as MdastFootnoteDefinition } from 'mdast';
//# sourceMappingURL=state.d.ts.map