mirror of
https://github.com/sern-handler/website
synced 2026-06-27 18:22:22 +00:00
feat: migrate to starlight
This commit is contained in:
20
node_modules/hastscript/lib/automatic-runtime-html.d.ts
generated
vendored
Normal file
20
node_modules/hastscript/lib/automatic-runtime-html.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export * from "./jsx-automatic.js";
|
||||
export const Fragment: null;
|
||||
export const jsx: {
|
||||
(type: null, props: {
|
||||
children?: import("./create-h.js").Child;
|
||||
}, key?: string | undefined): import("hast").Root;
|
||||
(type: string, props: import("./create-automatic-runtime.js").JSXProps, key?: string | undefined): import("hast").Element;
|
||||
};
|
||||
export const jsxDEV: {
|
||||
(type: null, props: {
|
||||
children?: import("./create-h.js").Child;
|
||||
}, key?: string | undefined): import("hast").Root;
|
||||
(type: string, props: import("./create-automatic-runtime.js").JSXProps, key?: string | undefined): import("hast").Element;
|
||||
};
|
||||
export const jsxs: {
|
||||
(type: null, props: {
|
||||
children?: import("./create-h.js").Child;
|
||||
}, key?: string | undefined): import("hast").Root;
|
||||
(type: string, props: import("./create-automatic-runtime.js").JSXProps, key?: string | undefined): import("hast").Element;
|
||||
};
|
||||
7
node_modules/hastscript/lib/automatic-runtime-html.js
generated
vendored
Normal file
7
node_modules/hastscript/lib/automatic-runtime-html.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import {createAutomaticRuntime} from './create-automatic-runtime.js'
|
||||
import {h} from './index.js'
|
||||
|
||||
// Export `JSX` as a global for TypeScript.
|
||||
export * from './jsx-automatic.js'
|
||||
|
||||
export const {Fragment, jsx, jsxDEV, jsxs} = createAutomaticRuntime(h)
|
||||
20
node_modules/hastscript/lib/automatic-runtime-svg.d.ts
generated
vendored
Normal file
20
node_modules/hastscript/lib/automatic-runtime-svg.d.ts
generated
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
export * from "./jsx-automatic.js";
|
||||
export const Fragment: null;
|
||||
export const jsx: {
|
||||
(type: null, props: {
|
||||
children?: import("./create-h.js").Child;
|
||||
}, key?: string | undefined): import("hast").Root;
|
||||
(type: string, props: import("./create-automatic-runtime.js").JSXProps, key?: string | undefined): import("hast").Element;
|
||||
};
|
||||
export const jsxDEV: {
|
||||
(type: null, props: {
|
||||
children?: import("./create-h.js").Child;
|
||||
}, key?: string | undefined): import("hast").Root;
|
||||
(type: string, props: import("./create-automatic-runtime.js").JSXProps, key?: string | undefined): import("hast").Element;
|
||||
};
|
||||
export const jsxs: {
|
||||
(type: null, props: {
|
||||
children?: import("./create-h.js").Child;
|
||||
}, key?: string | undefined): import("hast").Root;
|
||||
(type: string, props: import("./create-automatic-runtime.js").JSXProps, key?: string | undefined): import("hast").Element;
|
||||
};
|
||||
7
node_modules/hastscript/lib/automatic-runtime-svg.js
generated
vendored
Normal file
7
node_modules/hastscript/lib/automatic-runtime-svg.js
generated
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import {createAutomaticRuntime} from './create-automatic-runtime.js'
|
||||
import {s} from './index.js'
|
||||
|
||||
// Export `JSX` as a global for TypeScript.
|
||||
export * from './jsx-automatic.js'
|
||||
|
||||
export const {Fragment, jsx, jsxDEV, jsxs} = createAutomaticRuntime(s)
|
||||
38
node_modules/hastscript/lib/create-automatic-runtime.d.ts
generated
vendored
Normal file
38
node_modules/hastscript/lib/create-automatic-runtime.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
/**
|
||||
* Create an automatic runtime.
|
||||
*
|
||||
* @param {ReturnType<CreateH>} f
|
||||
* `h` function.
|
||||
* @returns
|
||||
* Automatic JSX runtime.
|
||||
*/
|
||||
export function createAutomaticRuntime(f: ReturnType<CreateH>): {
|
||||
Fragment: null;
|
||||
jsx: {
|
||||
(type: null, props: {
|
||||
children?: Child;
|
||||
}, key?: string | undefined): Root;
|
||||
(type: string, props: JSXProps, key?: string | undefined): Element;
|
||||
};
|
||||
jsxDEV: {
|
||||
(type: null, props: {
|
||||
children?: Child;
|
||||
}, key?: string | undefined): Root;
|
||||
(type: string, props: JSXProps, key?: string | undefined): Element;
|
||||
};
|
||||
jsxs: {
|
||||
(type: null, props: {
|
||||
children?: Child;
|
||||
}, key?: string | undefined): Root;
|
||||
(type: string, props: JSXProps, key?: string | undefined): Element;
|
||||
};
|
||||
};
|
||||
export type Element = import('hast').Element;
|
||||
export type Root = import('hast').Root;
|
||||
export type Child = import('./create-h.js').Child;
|
||||
export type Properties = import('./create-h.js').Properties;
|
||||
export type PropertyValue = import('./create-h.js').PropertyValue;
|
||||
export type Result = import('./create-h.js').Result;
|
||||
export type Style = import('./create-h.js').Style;
|
||||
export type CreateH = typeof import("./create-h.js").createH;
|
||||
export type JSXProps = Record<string, Child | PropertyValue | Style>;
|
||||
57
node_modules/hastscript/lib/create-automatic-runtime.js
generated
vendored
Normal file
57
node_modules/hastscript/lib/create-automatic-runtime.js
generated
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
/**
|
||||
* @typedef {import('hast').Element} Element
|
||||
* @typedef {import('hast').Root} Root
|
||||
*
|
||||
* @typedef {import('./create-h.js').Child} Child
|
||||
* @typedef {import('./create-h.js').Properties} Properties
|
||||
* @typedef {import('./create-h.js').PropertyValue} PropertyValue
|
||||
* @typedef {import('./create-h.js').Result} Result
|
||||
* @typedef {import('./create-h.js').Style} Style
|
||||
* @typedef {import('./create-h.js').createH} CreateH
|
||||
*
|
||||
* @typedef {Record<string, Child | PropertyValue | Style>} JSXProps
|
||||
*/
|
||||
|
||||
// Make VS code see references to above symbols.
|
||||
''
|
||||
|
||||
/**
|
||||
* Create an automatic runtime.
|
||||
*
|
||||
* @param {ReturnType<CreateH>} f
|
||||
* `h` function.
|
||||
* @returns
|
||||
* Automatic JSX runtime.
|
||||
*/
|
||||
export function createAutomaticRuntime(f) {
|
||||
/**
|
||||
* @overload
|
||||
* @param {null} type
|
||||
* @param {{children?: Child}} props
|
||||
* @param {string} [key]
|
||||
* @returns {Root}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} type
|
||||
* @param {JSXProps} props
|
||||
* @param {string} [key]
|
||||
* @returns {Element}
|
||||
*
|
||||
* @param {string | null} type
|
||||
* Element name or `null` to get a root.
|
||||
* @param {Properties & {children?: Child}} props
|
||||
* Properties.
|
||||
* @returns {Result}
|
||||
* Result.
|
||||
*/
|
||||
function jsx(type, props) {
|
||||
const {children, ...properties} = props
|
||||
const result =
|
||||
// @ts-ignore: `children` is fine: TS has a recursion problem which
|
||||
// sometimes generates broken types.
|
||||
type === null ? f(null, children) : f(type, properties, children)
|
||||
return result
|
||||
}
|
||||
|
||||
return {Fragment: null, jsx, jsxDEV: jsx, jsxs: jsx}
|
||||
}
|
||||
67
node_modules/hastscript/lib/create-h.d.ts
generated
vendored
Normal file
67
node_modules/hastscript/lib/create-h.d.ts
generated
vendored
Normal file
@@ -0,0 +1,67 @@
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* Schema to use.
|
||||
* @param {string} defaultTagName
|
||||
* Default tag name.
|
||||
* @param {Array<string> | undefined} [caseSensitive]
|
||||
* Case-sensitive tag names (default: `undefined`).
|
||||
* @returns
|
||||
* `h`.
|
||||
*/
|
||||
export function createH(schema: Schema, defaultTagName: string, caseSensitive?: Array<string> | undefined): {
|
||||
(selector?: null | undefined, ...children: Child[]): Root;
|
||||
(selector: string, properties: Properties, ...children: Child[]): Element;
|
||||
(selector: string, ...children: Child[]): Element;
|
||||
};
|
||||
export type Element = import('hast').Element;
|
||||
export type Nodes = import('hast').Nodes;
|
||||
export type Root = import('hast').Root;
|
||||
export type RootContent = import('hast').RootContent;
|
||||
export type Info = import('property-information').Info;
|
||||
export type Schema = import('property-information').Schema;
|
||||
/**
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
export type Result = Element | Root;
|
||||
/**
|
||||
* Value for a CSS style field.
|
||||
*/
|
||||
export type StyleValue = number | string;
|
||||
/**
|
||||
* Supported value of a `style` prop.
|
||||
*/
|
||||
export type Style = Record<string, StyleValue>;
|
||||
/**
|
||||
* Primitive property value.
|
||||
*/
|
||||
export type PrimitiveValue = boolean | number | string | null | undefined;
|
||||
/**
|
||||
* List of property values for space- or comma separated values (such as `className`).
|
||||
*/
|
||||
export type ArrayValue = Array<number | string>;
|
||||
/**
|
||||
* Primitive value or list value.
|
||||
*/
|
||||
export type PropertyValue = (string | number)[] | PrimitiveValue;
|
||||
/**
|
||||
* Acceptable value for element properties.
|
||||
*/
|
||||
export type Properties = {
|
||||
[property: string]: Style | PropertyValue;
|
||||
};
|
||||
/**
|
||||
* Primitive children, either ignored (nullish), or turned into text nodes.
|
||||
*/
|
||||
export type PrimitiveChild = number | string | null | undefined;
|
||||
/**
|
||||
* List of children.
|
||||
*/
|
||||
export type ArrayChild = Array<(import("hast").Nodes | PrimitiveChild)[] | Nodes | PrimitiveChild>;
|
||||
/**
|
||||
* List of children (deep).
|
||||
*/
|
||||
export type ArrayChildNested = Array<Nodes | PrimitiveChild>;
|
||||
/**
|
||||
* Acceptable child value.
|
||||
*/
|
||||
export type Child = (import("hast").Nodes | PrimitiveChild | ArrayChildNested)[] | Nodes | PrimitiveChild;
|
||||
345
node_modules/hastscript/lib/create-h.js
generated
vendored
Normal file
345
node_modules/hastscript/lib/create-h.js
generated
vendored
Normal file
@@ -0,0 +1,345 @@
|
||||
/**
|
||||
* @typedef {import('hast').Element} Element
|
||||
* @typedef {import('hast').Nodes} Nodes
|
||||
* @typedef {import('hast').Root} Root
|
||||
* @typedef {import('hast').RootContent} RootContent
|
||||
*
|
||||
* @typedef {import('property-information').Info} Info
|
||||
* @typedef {import('property-information').Schema} Schema
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Element | Root} Result
|
||||
* Result from a `h` (or `s`) call.
|
||||
*
|
||||
* @typedef {number | string} StyleValue
|
||||
* Value for a CSS style field.
|
||||
* @typedef {Record<string, StyleValue>} Style
|
||||
* Supported value of a `style` prop.
|
||||
* @typedef {boolean | number | string | null | undefined} PrimitiveValue
|
||||
* Primitive property value.
|
||||
* @typedef {Array<number | string>} ArrayValue
|
||||
* List of property values for space- or comma separated values (such as `className`).
|
||||
* @typedef {ArrayValue | PrimitiveValue} PropertyValue
|
||||
* Primitive value or list value.
|
||||
* @typedef {{[property: string]: PropertyValue | Style}} Properties
|
||||
* Acceptable value for element properties.
|
||||
*
|
||||
* @typedef {number | string | null | undefined} PrimitiveChild
|
||||
* Primitive children, either ignored (nullish), or turned into text nodes.
|
||||
* @typedef {Array<ArrayChildNested | Nodes | PrimitiveChild>} ArrayChild
|
||||
* List of children.
|
||||
* @typedef {Array<Nodes | PrimitiveChild>} ArrayChildNested
|
||||
* List of children (deep).
|
||||
* @typedef {ArrayChild | Nodes | PrimitiveChild} Child
|
||||
* Acceptable child value.
|
||||
*/
|
||||
|
||||
import {parse as commas} from 'comma-separated-tokens'
|
||||
import {parseSelector} from 'hast-util-parse-selector'
|
||||
import {find, normalize} from 'property-information'
|
||||
import {parse as spaces} from 'space-separated-tokens'
|
||||
|
||||
const buttonTypes = new Set(['button', 'menu', 'reset', 'submit'])
|
||||
|
||||
const own = {}.hasOwnProperty
|
||||
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* Schema to use.
|
||||
* @param {string} defaultTagName
|
||||
* Default tag name.
|
||||
* @param {Array<string> | undefined} [caseSensitive]
|
||||
* Case-sensitive tag names (default: `undefined`).
|
||||
* @returns
|
||||
* `h`.
|
||||
*/
|
||||
export function createH(schema, defaultTagName, caseSensitive) {
|
||||
const adjust = caseSensitive && createAdjustMap(caseSensitive)
|
||||
|
||||
/**
|
||||
* Hyperscript compatible DSL for creating virtual hast trees.
|
||||
*
|
||||
* @overload
|
||||
* @param {null | undefined} [selector]
|
||||
* @param {...Child} children
|
||||
* @returns {Root}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} selector
|
||||
* @param {Properties} properties
|
||||
* @param {...Child} children
|
||||
* @returns {Element}
|
||||
*
|
||||
* @overload
|
||||
* @param {string} selector
|
||||
* @param {...Child} children
|
||||
* @returns {Element}
|
||||
*
|
||||
* @param {string | null | undefined} [selector]
|
||||
* Selector.
|
||||
* @param {Child | Properties | null | undefined} [properties]
|
||||
* Properties (or first child) (default: `undefined`).
|
||||
* @param {...Child} children
|
||||
* Children.
|
||||
* @returns {Result}
|
||||
* Result.
|
||||
*/
|
||||
function h(selector, properties, ...children) {
|
||||
let index = -1
|
||||
/** @type {Result} */
|
||||
let node
|
||||
|
||||
if (selector === undefined || selector === null) {
|
||||
node = {type: 'root', children: []}
|
||||
// Properties are not supported for roots.
|
||||
const child = /** @type {Child} */ (properties)
|
||||
children.unshift(child)
|
||||
} else {
|
||||
node = parseSelector(selector, defaultTagName)
|
||||
// Normalize the name.
|
||||
node.tagName = node.tagName.toLowerCase()
|
||||
if (adjust && own.call(adjust, node.tagName)) {
|
||||
node.tagName = adjust[node.tagName]
|
||||
}
|
||||
|
||||
// Handle props.
|
||||
if (isProperties(properties, node.tagName)) {
|
||||
/** @type {string} */
|
||||
let key
|
||||
|
||||
for (key in properties) {
|
||||
if (own.call(properties, key)) {
|
||||
addProperty(schema, node.properties, key, properties[key])
|
||||
}
|
||||
}
|
||||
} else {
|
||||
children.unshift(properties)
|
||||
}
|
||||
}
|
||||
|
||||
// Handle children.
|
||||
while (++index < children.length) {
|
||||
addChild(node.children, children[index])
|
||||
}
|
||||
|
||||
if (node.type === 'element' && node.tagName === 'template') {
|
||||
node.content = {type: 'root', children: node.children}
|
||||
node.children = []
|
||||
}
|
||||
|
||||
return node
|
||||
}
|
||||
|
||||
return h
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if something is properties or a child.
|
||||
*
|
||||
* @param {Child | Properties} value
|
||||
* Value to check.
|
||||
* @param {string} name
|
||||
* Tag name.
|
||||
* @returns {value is Properties}
|
||||
* Whether `value` is a properties object.
|
||||
*/
|
||||
function isProperties(value, name) {
|
||||
if (
|
||||
value === null ||
|
||||
value === undefined ||
|
||||
typeof value !== 'object' ||
|
||||
Array.isArray(value)
|
||||
) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (name === 'input' || !value.type || typeof value.type !== 'string') {
|
||||
return true
|
||||
}
|
||||
|
||||
if ('children' in value && Array.isArray(value.children)) {
|
||||
return false
|
||||
}
|
||||
|
||||
if (name === 'button') {
|
||||
return buttonTypes.has(value.type.toLowerCase())
|
||||
}
|
||||
|
||||
return !('value' in value)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* Schema.
|
||||
* @param {Properties} properties
|
||||
* Properties object.
|
||||
* @param {string} key
|
||||
* Property name.
|
||||
* @param {PropertyValue | Style} value
|
||||
* Property value.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
function addProperty(schema, properties, key, value) {
|
||||
const info = find(schema, key)
|
||||
let index = -1
|
||||
/** @type {PropertyValue} */
|
||||
let result
|
||||
|
||||
// Ignore nullish and NaN values.
|
||||
if (value === undefined || value === null) return
|
||||
|
||||
if (typeof value === 'number') {
|
||||
// Ignore NaN.
|
||||
if (Number.isNaN(value)) return
|
||||
|
||||
result = value
|
||||
}
|
||||
// Booleans.
|
||||
else if (typeof value === 'boolean') {
|
||||
result = value
|
||||
}
|
||||
// Handle list values.
|
||||
else if (typeof value === 'string') {
|
||||
if (info.spaceSeparated) {
|
||||
result = spaces(value)
|
||||
} else if (info.commaSeparated) {
|
||||
result = commas(value)
|
||||
} else if (info.commaOrSpaceSeparated) {
|
||||
result = spaces(commas(value).join(' '))
|
||||
} else {
|
||||
result = parsePrimitive(info, info.property, value)
|
||||
}
|
||||
} else if (Array.isArray(value)) {
|
||||
result = value.concat()
|
||||
} else {
|
||||
result = info.property === 'style' ? style(value) : String(value)
|
||||
}
|
||||
|
||||
if (Array.isArray(result)) {
|
||||
/** @type {Array<number | string>} */
|
||||
const finalResult = []
|
||||
|
||||
while (++index < result.length) {
|
||||
// Assume no booleans in array.
|
||||
const value = /** @type {number | string} */ (
|
||||
parsePrimitive(info, info.property, result[index])
|
||||
)
|
||||
finalResult[index] = value
|
||||
}
|
||||
|
||||
result = finalResult
|
||||
}
|
||||
|
||||
// Class names (which can be added both on the `selector` and here).
|
||||
if (info.property === 'className' && Array.isArray(properties.className)) {
|
||||
// Assume no booleans in `className`.
|
||||
const value = /** @type {number | string} */ (result)
|
||||
result = properties.className.concat(value)
|
||||
}
|
||||
|
||||
properties[info.property] = result
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<RootContent>} nodes
|
||||
* Children.
|
||||
* @param {Child} value
|
||||
* Child.
|
||||
* @returns {undefined}
|
||||
* Nothing.
|
||||
*/
|
||||
function addChild(nodes, value) {
|
||||
let index = -1
|
||||
|
||||
if (value === undefined || value === null) {
|
||||
// Empty.
|
||||
} else if (typeof value === 'string' || typeof value === 'number') {
|
||||
nodes.push({type: 'text', value: String(value)})
|
||||
} else if (Array.isArray(value)) {
|
||||
while (++index < value.length) {
|
||||
addChild(nodes, value[index])
|
||||
}
|
||||
} else if (typeof value === 'object' && 'type' in value) {
|
||||
if (value.type === 'root') {
|
||||
addChild(nodes, value.children)
|
||||
} else {
|
||||
nodes.push(value)
|
||||
}
|
||||
} else {
|
||||
throw new Error('Expected node, nodes, or string, got `' + value + '`')
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse a single primitives.
|
||||
*
|
||||
* @param {Info} info
|
||||
* Property information.
|
||||
* @param {string} name
|
||||
* Property name.
|
||||
* @param {PrimitiveValue} value
|
||||
* Property value.
|
||||
* @returns {PrimitiveValue}
|
||||
* Property value.
|
||||
*/
|
||||
function parsePrimitive(info, name, value) {
|
||||
if (typeof value === 'string') {
|
||||
if (info.number && value && !Number.isNaN(Number(value))) {
|
||||
return Number(value)
|
||||
}
|
||||
|
||||
if (
|
||||
(info.boolean || info.overloadedBoolean) &&
|
||||
(value === '' || normalize(value) === normalize(name))
|
||||
) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return value
|
||||
}
|
||||
|
||||
/**
|
||||
* Serialize a `style` object as a string.
|
||||
*
|
||||
* @param {Style} value
|
||||
* Style object.
|
||||
* @returns {string}
|
||||
* CSS string.
|
||||
*/
|
||||
function style(value) {
|
||||
/** @type {Array<string>} */
|
||||
const result = []
|
||||
/** @type {string} */
|
||||
let key
|
||||
|
||||
for (key in value) {
|
||||
if (own.call(value, key)) {
|
||||
result.push([key, value[key]].join(': '))
|
||||
}
|
||||
}
|
||||
|
||||
return result.join('; ')
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a map to adjust casing.
|
||||
*
|
||||
* @param {Array<string>} values
|
||||
* List of properly cased keys.
|
||||
* @returns {Record<string, string>}
|
||||
* Map of lowercase keys to uppercase keys.
|
||||
*/
|
||||
function createAdjustMap(values) {
|
||||
/** @type {Record<string, string>} */
|
||||
const result = {}
|
||||
let index = -1
|
||||
|
||||
while (++index < values.length) {
|
||||
result[values[index].toLowerCase()] = values[index]
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
33
node_modules/hastscript/lib/index.d.ts
generated
vendored
Normal file
33
node_modules/hastscript/lib/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
/** @type {ReturnType<createH>} */
|
||||
export const h: ReturnType<typeof createH>;
|
||||
export namespace h {
|
||||
namespace JSX {
|
||||
type Element = import('./jsx-classic.js').Element;
|
||||
type ElementChildrenAttribute = import('./jsx-classic.js').ElementChildrenAttribute;
|
||||
type IntrinsicAttributes = import('./jsx-classic.js').IntrinsicAttributes;
|
||||
type IntrinsicElements = import('./jsx-classic.js').IntrinsicElements;
|
||||
}
|
||||
}
|
||||
/** @type {ReturnType<createH>} */
|
||||
export const s: ReturnType<typeof createH>;
|
||||
export namespace s {
|
||||
namespace JSX {
|
||||
type Element = import('./jsx-classic.js').Element;
|
||||
type ElementChildrenAttribute = import('./jsx-classic.js').ElementChildrenAttribute;
|
||||
type IntrinsicAttributes = import('./jsx-classic.js').IntrinsicAttributes;
|
||||
type IntrinsicElements = import('./jsx-classic.js').IntrinsicElements;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Acceptable child value.
|
||||
*/
|
||||
export type Child = import('./create-h.js').Child;
|
||||
/**
|
||||
* Acceptable value for element properties.
|
||||
*/
|
||||
export type Properties = import('./create-h.js').Properties;
|
||||
/**
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
export type Result = import('./create-h.js').Result;
|
||||
import { createH } from './create-h.js';
|
||||
36
node_modules/hastscript/lib/index.js
generated
vendored
Normal file
36
node_modules/hastscript/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,36 @@
|
||||
/**
|
||||
* @typedef {import('./create-h.js').Child} Child
|
||||
* Acceptable child value.
|
||||
* @typedef {import('./create-h.js').Properties} Properties
|
||||
* Acceptable value for element properties.
|
||||
* @typedef {import('./create-h.js').Result} Result
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
|
||||
// Register the JSX namespace on `h`.
|
||||
/**
|
||||
* @typedef {import('./jsx-classic.js').Element} h.JSX.Element
|
||||
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements
|
||||
*/
|
||||
|
||||
// Register the JSX namespace on `s`.
|
||||
/**
|
||||
* @typedef {import('./jsx-classic.js').Element} s.JSX.Element
|
||||
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements
|
||||
*/
|
||||
|
||||
import {html, svg} from 'property-information'
|
||||
import {createH} from './create-h.js'
|
||||
import {svgCaseSensitiveTagNames} from './svg-case-sensitive-tag-names.js'
|
||||
|
||||
// Note: this explicit type is needed, otherwise TS creates broken types.
|
||||
/** @type {ReturnType<createH>} */
|
||||
export const h = createH(html, 'div')
|
||||
|
||||
// Note: this explicit type is needed, otherwise TS creates broken types.
|
||||
/** @type {ReturnType<createH>} */
|
||||
export const s = createH(svg, 'g', svgCaseSensitiveTagNames)
|
||||
43
node_modules/hastscript/lib/jsx-automatic.d.ts
generated
vendored
Normal file
43
node_modules/hastscript/lib/jsx-automatic.d.ts
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
import type {Child, Properties, Result} from './create-h.js'
|
||||
|
||||
export namespace JSX {
|
||||
/**
|
||||
* Define the return value of JSX syntax.
|
||||
*/
|
||||
type Element = Result
|
||||
|
||||
/**
|
||||
* Key of this interface defines as what prop children are passed.
|
||||
*/
|
||||
interface ElementChildrenAttribute {
|
||||
/**
|
||||
* Only the key matters, not the value.
|
||||
*/
|
||||
children?: never
|
||||
}
|
||||
|
||||
/**
|
||||
* Disallow the use of functional components.
|
||||
*/
|
||||
type IntrinsicAttributes = never
|
||||
|
||||
/**
|
||||
* Define the prop types for known elements.
|
||||
*
|
||||
* For `hastscript` this defines any string may be used in combination with
|
||||
* `hast` `Properties`.
|
||||
*
|
||||
* This **must** be an interface.
|
||||
*/
|
||||
interface IntrinsicElements {
|
||||
[name: string]:
|
||||
| Properties
|
||||
| {
|
||||
/**
|
||||
* The prop that matches `ElementChildrenAttribute` key defines the
|
||||
* type of JSX children, defines the children type.
|
||||
*/
|
||||
children?: Child
|
||||
}
|
||||
}
|
||||
}
|
||||
2
node_modules/hastscript/lib/jsx-automatic.js
generated
vendored
Normal file
2
node_modules/hastscript/lib/jsx-automatic.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// Empty (only used for TypeScript).
|
||||
export {}
|
||||
47
node_modules/hastscript/lib/jsx-classic.d.ts
generated
vendored
Normal file
47
node_modules/hastscript/lib/jsx-classic.d.ts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import type {Child, Properties, Result} from './create-h.js'
|
||||
|
||||
/**
|
||||
* This unique symbol is declared to specify the key on which JSX children are
|
||||
* passed, without conflicting with the `Attributes` type.
|
||||
*/
|
||||
declare const children: unique symbol
|
||||
|
||||
/**
|
||||
* Define the return value of JSX syntax.
|
||||
*/
|
||||
export type Element = Result
|
||||
|
||||
/**
|
||||
* Key of this interface defines as what prop children are passed.
|
||||
*/
|
||||
export interface ElementChildrenAttribute {
|
||||
/**
|
||||
* Only the key matters, not the value.
|
||||
*/
|
||||
[children]?: never
|
||||
}
|
||||
|
||||
/**
|
||||
* Disallow the use of functional components.
|
||||
*/
|
||||
export type IntrinsicAttributes = never
|
||||
|
||||
/**
|
||||
* Define the prop types for known elements.
|
||||
*
|
||||
* For `hastscript` this defines any string may be used in combination with
|
||||
* `hast` `Properties`.
|
||||
*
|
||||
* This **must** be an interface.
|
||||
*/
|
||||
export interface IntrinsicElements {
|
||||
[name: string]:
|
||||
| Properties
|
||||
| {
|
||||
/**
|
||||
* The prop that matches `ElementChildrenAttribute` key defines the
|
||||
* type of JSX children, defines the children type.
|
||||
*/
|
||||
[children]?: Child
|
||||
}
|
||||
}
|
||||
2
node_modules/hastscript/lib/jsx-classic.js
generated
vendored
Normal file
2
node_modules/hastscript/lib/jsx-classic.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
// Empty (only used for TypeScript).
|
||||
export {}
|
||||
1
node_modules/hastscript/lib/svg-case-sensitive-tag-names.d.ts
generated
vendored
Normal file
1
node_modules/hastscript/lib/svg-case-sensitive-tag-names.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export const svgCaseSensitiveTagNames: string[];
|
||||
41
node_modules/hastscript/lib/svg-case-sensitive-tag-names.js
generated
vendored
Normal file
41
node_modules/hastscript/lib/svg-case-sensitive-tag-names.js
generated
vendored
Normal file
@@ -0,0 +1,41 @@
|
||||
export const svgCaseSensitiveTagNames = [
|
||||
'altGlyph',
|
||||
'altGlyphDef',
|
||||
'altGlyphItem',
|
||||
'animateColor',
|
||||
'animateMotion',
|
||||
'animateTransform',
|
||||
'clipPath',
|
||||
'feBlend',
|
||||
'feColorMatrix',
|
||||
'feComponentTransfer',
|
||||
'feComposite',
|
||||
'feConvolveMatrix',
|
||||
'feDiffuseLighting',
|
||||
'feDisplacementMap',
|
||||
'feDistantLight',
|
||||
'feDropShadow',
|
||||
'feFlood',
|
||||
'feFuncA',
|
||||
'feFuncB',
|
||||
'feFuncG',
|
||||
'feFuncR',
|
||||
'feGaussianBlur',
|
||||
'feImage',
|
||||
'feMerge',
|
||||
'feMergeNode',
|
||||
'feMorphology',
|
||||
'feOffset',
|
||||
'fePointLight',
|
||||
'feSpecularLighting',
|
||||
'feSpotLight',
|
||||
'feTile',
|
||||
'feTurbulence',
|
||||
'foreignObject',
|
||||
'glyphRef',
|
||||
'linearGradient',
|
||||
'radialGradient',
|
||||
'solidColor',
|
||||
'textArea',
|
||||
'textPath'
|
||||
]
|
||||
Reference in New Issue
Block a user