🎉 initiate project *astro_rewrite*
This commit is contained in:
parent
ffd4d5e86c
commit
2ba37bfbe3
8658 changed files with 2268794 additions and 2538 deletions
71
node_modules/hastscript/lib/core.d.ts
generated
vendored
Normal file
71
node_modules/hastscript/lib/core.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {string} defaultTagName
|
||||
* @param {Array<string>} [caseSensitive]
|
||||
*/
|
||||
export function core(
|
||||
schema: Schema,
|
||||
defaultTagName: string,
|
||||
caseSensitive?: string[] | undefined
|
||||
): {
|
||||
(): Root
|
||||
(selector: null | undefined, ...children: Array<HChild>): Root
|
||||
(
|
||||
selector: string,
|
||||
properties?: HProperties,
|
||||
...children: Array<HChild>
|
||||
): Element
|
||||
(selector: string, ...children: Array<HChild>): Element
|
||||
}
|
||||
export type Root = import('hast').Root
|
||||
export type Content = import('hast').Content
|
||||
export type Element = import('hast').Element
|
||||
export type Properties = import('hast').Properties
|
||||
export type Info = import('property-information').Info
|
||||
export type Schema = import('property-information').Schema
|
||||
/**
|
||||
* Any concrete `hast` node.
|
||||
*/
|
||||
export type Node = Content | Root
|
||||
/**
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
export type HResult = Root | Element
|
||||
/**
|
||||
* Value for a CSS style field.
|
||||
*/
|
||||
export type HStyleValue = string | number
|
||||
/**
|
||||
* Supported value of a `style` prop.
|
||||
*/
|
||||
export type HStyle = Record<string, HStyleValue>
|
||||
/**
|
||||
* Primitive property value.
|
||||
*/
|
||||
export type HPrimitiveValue = string | number | boolean | null | undefined
|
||||
/**
|
||||
* List of property values for space- or comma separated values (such as `className`).
|
||||
*/
|
||||
export type HArrayValue = Array<string | number>
|
||||
/**
|
||||
* Primitive value or list value.
|
||||
*/
|
||||
export type HPropertyValue = HPrimitiveValue | (string | number)[]
|
||||
/**
|
||||
* Acceptable value for element properties.
|
||||
*/
|
||||
export type HProperties = {
|
||||
[property: string]: HStyle | HPropertyValue
|
||||
}
|
||||
/**
|
||||
* Primitive children, either ignored (nullish), or turned into text nodes.
|
||||
*/
|
||||
export type HPrimitiveChild = string | number | null | undefined
|
||||
/**
|
||||
* List of children.
|
||||
*/
|
||||
export type HArrayChild = Array<Node | HPrimitiveChild>
|
||||
/**
|
||||
* Acceptable child value.
|
||||
*/
|
||||
export type HChild = Node | HPrimitiveChild | (Node | HPrimitiveChild)[]
|
||||
309
node_modules/hastscript/lib/core.js
generated
vendored
Normal file
309
node_modules/hastscript/lib/core.js
generated
vendored
Normal file
|
|
@ -0,0 +1,309 @@
|
|||
/**
|
||||
* @typedef {import('hast').Root} Root
|
||||
* @typedef {import('hast').Content} Content
|
||||
* @typedef {import('hast').Element} Element
|
||||
* @typedef {import('hast').Properties} Properties
|
||||
* @typedef {import('property-information').Info} Info
|
||||
* @typedef {import('property-information').Schema} Schema
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {Content | Root} Node
|
||||
* Any concrete `hast` node.
|
||||
* @typedef {Root | Element} HResult
|
||||
* Result from a `h` (or `s`) call.
|
||||
*
|
||||
* @typedef {string | number} HStyleValue
|
||||
* Value for a CSS style field.
|
||||
* @typedef {Record<string, HStyleValue>} HStyle
|
||||
* Supported value of a `style` prop.
|
||||
* @typedef {string | number | boolean | null | undefined} HPrimitiveValue
|
||||
* Primitive property value.
|
||||
* @typedef {Array<string | number>} HArrayValue
|
||||
* List of property values for space- or comma separated values (such as `className`).
|
||||
* @typedef {HPrimitiveValue | HArrayValue} HPropertyValue
|
||||
* Primitive value or list value.
|
||||
* @typedef {{[property: string]: HPropertyValue | HStyle}} HProperties
|
||||
* Acceptable value for element properties.
|
||||
*
|
||||
* @typedef {string | number | null | undefined} HPrimitiveChild
|
||||
* Primitive children, either ignored (nullish), or turned into text nodes.
|
||||
* @typedef {Array<Node | HPrimitiveChild>} HArrayChild
|
||||
* List of children.
|
||||
* @typedef {Node | HPrimitiveChild | HArrayChild} HChild
|
||||
* Acceptable child value.
|
||||
*/
|
||||
|
||||
import {find, normalize} from 'property-information'
|
||||
import {parseSelector} from 'hast-util-parse-selector'
|
||||
import {parse as spaces} from 'space-separated-tokens'
|
||||
import {parse as commas} from 'comma-separated-tokens'
|
||||
|
||||
const buttonTypes = new Set(['menu', 'submit', 'reset', 'button'])
|
||||
|
||||
const own = {}.hasOwnProperty
|
||||
|
||||
/**
|
||||
* @param {Schema} schema
|
||||
* @param {string} defaultTagName
|
||||
* @param {Array<string>} [caseSensitive]
|
||||
*/
|
||||
export function core(schema, defaultTagName, caseSensitive) {
|
||||
const adjust = caseSensitive && createAdjustMap(caseSensitive)
|
||||
|
||||
const h =
|
||||
/**
|
||||
* @type {{
|
||||
* (): Root
|
||||
* (selector: null | undefined, ...children: Array<HChild>): Root
|
||||
* (selector: string, properties?: HProperties, ...children: Array<HChild>): Element
|
||||
* (selector: string, ...children: Array<HChild>): Element
|
||||
* }}
|
||||
*/
|
||||
(
|
||||
/**
|
||||
* Hyperscript compatible DSL for creating virtual hast trees.
|
||||
*
|
||||
* @param {string | null} [selector]
|
||||
* @param {HProperties | HChild} [properties]
|
||||
* @param {Array<HChild>} children
|
||||
* @returns {HResult}
|
||||
*/
|
||||
function (selector, properties, ...children) {
|
||||
let index = -1
|
||||
/** @type {HResult} */
|
||||
let node
|
||||
|
||||
if (selector === undefined || selector === null) {
|
||||
node = {type: 'root', children: []}
|
||||
// @ts-expect-error Properties are not supported for roots.
|
||||
children.unshift(properties)
|
||||
} 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)) {
|
||||
// @ts-expect-error `node.properties` is set.
|
||||
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
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {HProperties | HChild} value
|
||||
* @param {string} name
|
||||
* @returns {value is HProperties}
|
||||
*/
|
||||
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
|
||||
* @param {Properties} properties
|
||||
* @param {string} key
|
||||
* @param {HStyle | HPropertyValue} value
|
||||
* @returns {void}
|
||||
*/
|
||||
function addProperty(schema, properties, key, value) {
|
||||
const info = find(schema, key)
|
||||
let index = -1
|
||||
/** @type {HPropertyValue} */
|
||||
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<string | number>} */
|
||||
const finalResult = []
|
||||
|
||||
while (++index < result.length) {
|
||||
// @ts-expect-error Assume no booleans in array.
|
||||
finalResult[index] = parsePrimitive(info, info.property, result[index])
|
||||
}
|
||||
|
||||
result = finalResult
|
||||
}
|
||||
|
||||
// Class names (which can be added both on the `selector` and here).
|
||||
if (info.property === 'className' && Array.isArray(properties.className)) {
|
||||
// @ts-expect-error Assume no booleans in `className`.
|
||||
result = properties.className.concat(result)
|
||||
}
|
||||
|
||||
properties[info.property] = result
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {Array<Content>} nodes
|
||||
* @param {HChild} value
|
||||
* @returns {void}
|
||||
*/
|
||||
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
|
||||
* @param {string} name
|
||||
* @param {HPrimitiveValue} value
|
||||
* @returns {HPrimitiveValue}
|
||||
*/
|
||||
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 {HStyle} 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
|
||||
}
|
||||
37
node_modules/hastscript/lib/html.d.ts
generated
vendored
Normal file
37
node_modules/hastscript/lib/html.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
export const h: {
|
||||
(): import('hast').Root
|
||||
(
|
||||
selector: null | undefined,
|
||||
...children: import('./core.js').HChild[]
|
||||
): import('hast').Root
|
||||
(
|
||||
selector: string,
|
||||
properties?: import('./core.js').HProperties | undefined,
|
||||
...children: import('./core.js').HChild[]
|
||||
): import('hast').Element
|
||||
(
|
||||
selector: string,
|
||||
...children: import('./core.js').HChild[]
|
||||
): import('hast').Element
|
||||
}
|
||||
export namespace h {
|
||||
namespace JSX {
|
||||
type Element = import('./jsx-classic.js').Element
|
||||
type IntrinsicAttributes = import('./jsx-classic.js').IntrinsicAttributes
|
||||
type IntrinsicElements = import('./jsx-classic.js').IntrinsicElements
|
||||
type ElementChildrenAttribute =
|
||||
import('./jsx-classic.js').ElementChildrenAttribute
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Acceptable child value.
|
||||
*/
|
||||
export type Child = import('./core.js').HChild
|
||||
/**
|
||||
* Acceptable value for element properties.
|
||||
*/
|
||||
export type Properties = import('./core.js').HProperties
|
||||
/**
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
export type Result = import('./core.js').HResult
|
||||
18
node_modules/hastscript/lib/html.js
generated
vendored
Normal file
18
node_modules/hastscript/lib/html.js
generated
vendored
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
/**
|
||||
* @typedef {import('./core.js').HChild} Child
|
||||
* Acceptable child value.
|
||||
* @typedef {import('./core.js').HProperties} Properties
|
||||
* Acceptable value for element properties.
|
||||
* @typedef {import('./core.js').HResult} Result
|
||||
* Result from a `h` (or `s`) call.
|
||||
*
|
||||
* @typedef {import('./jsx-classic.js').Element} h.JSX.Element
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements
|
||||
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute
|
||||
*/
|
||||
|
||||
import {html} from 'property-information'
|
||||
import {core} from './core.js'
|
||||
|
||||
export const h = core(html, 'div')
|
||||
14
node_modules/hastscript/lib/index.d.ts
generated
vendored
Normal file
14
node_modules/hastscript/lib/index.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
export {h} from './html.js'
|
||||
export {s} from './svg.js'
|
||||
/**
|
||||
* Acceptable child value.
|
||||
*/
|
||||
export type Child = import('./core.js').HChild
|
||||
/**
|
||||
* Acceptable value for element properties.
|
||||
*/
|
||||
export type Properties = import('./core.js').HProperties
|
||||
/**
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
export type Result = import('./core.js').HResult
|
||||
11
node_modules/hastscript/lib/index.js
generated
vendored
Normal file
11
node_modules/hastscript/lib/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
/**
|
||||
* @typedef {import('./core.js').HChild} Child
|
||||
* Acceptable child value.
|
||||
* @typedef {import('./core.js').HProperties} Properties
|
||||
* Acceptable value for element properties.
|
||||
* @typedef {import('./core.js').HResult} Result
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
|
||||
export {h} from './html.js'
|
||||
export {s} from './svg.js'
|
||||
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 {HProperties, HChild, HResult} from './core.js'
|
||||
|
||||
export namespace JSX {
|
||||
/**
|
||||
* This defines the return value of JSX syntax.
|
||||
*/
|
||||
type Element = HResult
|
||||
|
||||
/**
|
||||
* This disallows the use of functional components.
|
||||
*/
|
||||
type IntrinsicAttributes = never
|
||||
|
||||
/**
|
||||
* This defines 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.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style, @typescript-eslint/consistent-type-definitions
|
||||
interface IntrinsicElements {
|
||||
[name: string]:
|
||||
| HProperties
|
||||
| {
|
||||
/**
|
||||
* The prop that matches `ElementChildrenAttribute` key defines the type of JSX children, defines the children type.
|
||||
*/
|
||||
children?: HChild
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The key of this interface defines as what prop children are passed.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
||||
interface ElementChildrenAttribute {
|
||||
/**
|
||||
* Only the key matters, not the value.
|
||||
*/
|
||||
children?: never
|
||||
}
|
||||
}
|
||||
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 {HProperties, HChild, HResult} from './core.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
|
||||
|
||||
/**
|
||||
* This defines the return value of JSX syntax.
|
||||
*/
|
||||
export type Element = HResult
|
||||
|
||||
/**
|
||||
* This disallows the use of functional components.
|
||||
*/
|
||||
export type IntrinsicAttributes = never
|
||||
|
||||
/**
|
||||
* This defines 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.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style, @typescript-eslint/consistent-type-definitions
|
||||
export interface IntrinsicElements {
|
||||
[name: string]:
|
||||
| HProperties
|
||||
| {
|
||||
/**
|
||||
* The prop that matches `ElementChildrenAttribute` key defines the type of JSX children, defines the children type.
|
||||
*/
|
||||
[children]?: HChild
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The key of this interface defines as what prop children are passed.
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
|
||||
export interface ElementChildrenAttribute {
|
||||
/**
|
||||
* Only the key matters, not the value.
|
||||
*/
|
||||
[children]?: never
|
||||
}
|
||||
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 {}
|
||||
89
node_modules/hastscript/lib/runtime-html.d.ts
generated
vendored
Normal file
89
node_modules/hastscript/lib/runtime-html.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
export * from './jsx-automatic.js'
|
||||
export const Fragment: null
|
||||
export const jsx: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: import('./core.js').HChild
|
||||
},
|
||||
key?: string | undefined
|
||||
): import('hast').Root
|
||||
(
|
||||
type: string,
|
||||
props: Record<
|
||||
string,
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| import('hast').Root
|
||||
| import('hast').Comment
|
||||
| import('hast').DocType
|
||||
| import('hast').Element
|
||||
| import('hast').Text
|
||||
| import('./core.js').HStyle
|
||||
| import('./core.js').HArrayValue
|
||||
| import('./core.js').HArrayChild
|
||||
| null
|
||||
| undefined
|
||||
>,
|
||||
key?: string | undefined
|
||||
): import('hast').Element
|
||||
}
|
||||
export const jsxs: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: import('./core.js').HChild
|
||||
},
|
||||
key?: string | undefined
|
||||
): import('hast').Root
|
||||
(
|
||||
type: string,
|
||||
props: Record<
|
||||
string,
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| import('hast').Root
|
||||
| import('hast').Comment
|
||||
| import('hast').DocType
|
||||
| import('hast').Element
|
||||
| import('hast').Text
|
||||
| import('./core.js').HStyle
|
||||
| import('./core.js').HArrayValue
|
||||
| import('./core.js').HArrayChild
|
||||
| null
|
||||
| undefined
|
||||
>,
|
||||
key?: string | undefined
|
||||
): import('hast').Element
|
||||
}
|
||||
export const jsxDEV: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: import('./core.js').HChild
|
||||
},
|
||||
key?: string | undefined
|
||||
): import('hast').Root
|
||||
(
|
||||
type: string,
|
||||
props: Record<
|
||||
string,
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| import('hast').Root
|
||||
| import('hast').Comment
|
||||
| import('hast').DocType
|
||||
| import('hast').Element
|
||||
| import('hast').Text
|
||||
| import('./core.js').HStyle
|
||||
| import('./core.js').HArrayValue
|
||||
| import('./core.js').HArrayChild
|
||||
| null
|
||||
| undefined
|
||||
>,
|
||||
key?: string | undefined
|
||||
): import('hast').Element
|
||||
}
|
||||
6
node_modules/hastscript/lib/runtime-html.js
generated
vendored
Normal file
6
node_modules/hastscript/lib/runtime-html.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Export `JSX` as a global for TypeScript.
|
||||
import {runtime} from './runtime.js'
|
||||
import {h} from './html.js'
|
||||
|
||||
export * from './jsx-automatic.js'
|
||||
export const {Fragment, jsx, jsxs, jsxDEV} = runtime(h)
|
||||
89
node_modules/hastscript/lib/runtime-svg.d.ts
generated
vendored
Normal file
89
node_modules/hastscript/lib/runtime-svg.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,89 @@
|
|||
export * from './jsx-automatic.js'
|
||||
export const Fragment: null
|
||||
export const jsx: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: import('./core.js').HChild
|
||||
},
|
||||
key?: string | undefined
|
||||
): import('hast').Root
|
||||
(
|
||||
type: string,
|
||||
props: Record<
|
||||
string,
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| import('hast').Root
|
||||
| import('hast').Comment
|
||||
| import('hast').DocType
|
||||
| import('hast').Element
|
||||
| import('hast').Text
|
||||
| import('./core.js').HStyle
|
||||
| import('./core.js').HArrayValue
|
||||
| import('./core.js').HArrayChild
|
||||
| null
|
||||
| undefined
|
||||
>,
|
||||
key?: string | undefined
|
||||
): import('hast').Element
|
||||
}
|
||||
export const jsxs: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: import('./core.js').HChild
|
||||
},
|
||||
key?: string | undefined
|
||||
): import('hast').Root
|
||||
(
|
||||
type: string,
|
||||
props: Record<
|
||||
string,
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| import('hast').Root
|
||||
| import('hast').Comment
|
||||
| import('hast').DocType
|
||||
| import('hast').Element
|
||||
| import('hast').Text
|
||||
| import('./core.js').HStyle
|
||||
| import('./core.js').HArrayValue
|
||||
| import('./core.js').HArrayChild
|
||||
| null
|
||||
| undefined
|
||||
>,
|
||||
key?: string | undefined
|
||||
): import('hast').Element
|
||||
}
|
||||
export const jsxDEV: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: import('./core.js').HChild
|
||||
},
|
||||
key?: string | undefined
|
||||
): import('hast').Root
|
||||
(
|
||||
type: string,
|
||||
props: Record<
|
||||
string,
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| import('hast').Root
|
||||
| import('hast').Comment
|
||||
| import('hast').DocType
|
||||
| import('hast').Element
|
||||
| import('hast').Text
|
||||
| import('./core.js').HStyle
|
||||
| import('./core.js').HArrayValue
|
||||
| import('./core.js').HArrayChild
|
||||
| null
|
||||
| undefined
|
||||
>,
|
||||
key?: string | undefined
|
||||
): import('hast').Element
|
||||
}
|
||||
6
node_modules/hastscript/lib/runtime-svg.js
generated
vendored
Normal file
6
node_modules/hastscript/lib/runtime-svg.js
generated
vendored
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
// Export `JSX` as a global for TypeScript.
|
||||
import {runtime} from './runtime.js'
|
||||
import {s} from './svg.js'
|
||||
|
||||
export * from './jsx-automatic.js'
|
||||
export const {Fragment, jsx, jsxs, jsxDEV} = runtime(s)
|
||||
59
node_modules/hastscript/lib/runtime.d.ts
generated
vendored
Normal file
59
node_modules/hastscript/lib/runtime.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
/**
|
||||
* @typedef {import('./core.js').Element} Element
|
||||
* @typedef {import('./core.js').Root} Root
|
||||
* @typedef {import('./core.js').HResult} HResult
|
||||
* @typedef {import('./core.js').HChild} HChild
|
||||
* @typedef {import('./core.js').HProperties} HProperties
|
||||
* @typedef {import('./core.js').HPropertyValue} HPropertyValue
|
||||
* @typedef {import('./core.js').HStyle} HStyle
|
||||
* @typedef {import('./core.js').core} Core
|
||||
*
|
||||
* @typedef {Record<string, HPropertyValue | HStyle | HChild>} JSXProps
|
||||
*/
|
||||
/**
|
||||
* Create an automatic runtime.
|
||||
*
|
||||
* @param {ReturnType<Core>} f
|
||||
*/
|
||||
export function runtime(f: ReturnType<Core>): {
|
||||
Fragment: null
|
||||
jsx: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: HChild
|
||||
},
|
||||
key?: string
|
||||
): Root
|
||||
(type: string, props: JSXProps, key?: string): Element
|
||||
}
|
||||
jsxs: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: HChild
|
||||
},
|
||||
key?: string
|
||||
): Root
|
||||
(type: string, props: JSXProps, key?: string): Element
|
||||
}
|
||||
jsxDEV: {
|
||||
(
|
||||
type: null | undefined,
|
||||
props: {
|
||||
children?: HChild
|
||||
},
|
||||
key?: string
|
||||
): Root
|
||||
(type: string, props: JSXProps, key?: string): Element
|
||||
}
|
||||
}
|
||||
export type Element = import('./core.js').Element
|
||||
export type Root = import('./core.js').Root
|
||||
export type HResult = import('./core.js').HResult
|
||||
export type HChild = import('./core.js').HChild
|
||||
export type HProperties = import('./core.js').HProperties
|
||||
export type HPropertyValue = import('./core.js').HPropertyValue
|
||||
export type HStyle = import('./core.js').HStyle
|
||||
export type Core = typeof import('./core.js').core
|
||||
export type JSXProps = Record<string, HPropertyValue | HStyle | HChild>
|
||||
40
node_modules/hastscript/lib/runtime.js
generated
vendored
Normal file
40
node_modules/hastscript/lib/runtime.js
generated
vendored
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
/**
|
||||
* @typedef {import('./core.js').Element} Element
|
||||
* @typedef {import('./core.js').Root} Root
|
||||
* @typedef {import('./core.js').HResult} HResult
|
||||
* @typedef {import('./core.js').HChild} HChild
|
||||
* @typedef {import('./core.js').HProperties} HProperties
|
||||
* @typedef {import('./core.js').HPropertyValue} HPropertyValue
|
||||
* @typedef {import('./core.js').HStyle} HStyle
|
||||
* @typedef {import('./core.js').core} Core
|
||||
*
|
||||
* @typedef {Record<string, HPropertyValue | HStyle | HChild>} JSXProps
|
||||
*/
|
||||
|
||||
/**
|
||||
* Create an automatic runtime.
|
||||
*
|
||||
* @param {ReturnType<Core>} f
|
||||
*/
|
||||
export function runtime(f) {
|
||||
const jsx =
|
||||
/**
|
||||
* @type {{
|
||||
* (type: null | undefined, props: {children?: HChild}, key?: string): Root
|
||||
* (type: string, props: JSXProps, key?: string): Element
|
||||
* }}
|
||||
*/
|
||||
(
|
||||
/**
|
||||
* @param {string | null} type
|
||||
* @param {HProperties & {children?: HChild}} props
|
||||
* @returns {HResult}
|
||||
*/
|
||||
function (type, props) {
|
||||
const {children, ...properties} = props
|
||||
return type === null ? f(type, children) : f(type, properties, children)
|
||||
}
|
||||
)
|
||||
|
||||
return {Fragment: null, jsx, jsxs: jsx, jsxDEV: jsx}
|
||||
}
|
||||
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'
|
||||
]
|
||||
37
node_modules/hastscript/lib/svg.d.ts
generated
vendored
Normal file
37
node_modules/hastscript/lib/svg.d.ts
generated
vendored
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
export const s: {
|
||||
(): import('hast').Root
|
||||
(
|
||||
selector: null | undefined,
|
||||
...children: import('./core.js').HChild[]
|
||||
): import('hast').Root
|
||||
(
|
||||
selector: string,
|
||||
properties?: import('./core.js').HProperties | undefined,
|
||||
...children: import('./core.js').HChild[]
|
||||
): import('hast').Element
|
||||
(
|
||||
selector: string,
|
||||
...children: import('./core.js').HChild[]
|
||||
): import('hast').Element
|
||||
}
|
||||
export namespace s {
|
||||
namespace JSX {
|
||||
type Element = import('./jsx-classic.js').Element
|
||||
type IntrinsicAttributes = import('./jsx-classic.js').IntrinsicAttributes
|
||||
type IntrinsicElements = import('./jsx-classic.js').IntrinsicElements
|
||||
type ElementChildrenAttribute =
|
||||
import('./jsx-classic.js').ElementChildrenAttribute
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Acceptable child value.
|
||||
*/
|
||||
export type Child = import('./core.js').HChild
|
||||
/**
|
||||
* Acceptable value for element properties.
|
||||
*/
|
||||
export type Properties = import('./core.js').HProperties
|
||||
/**
|
||||
* Result from a `h` (or `s`) call.
|
||||
*/
|
||||
export type Result = import('./core.js').HResult
|
||||
19
node_modules/hastscript/lib/svg.js
generated
vendored
Normal file
19
node_modules/hastscript/lib/svg.js
generated
vendored
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
/**
|
||||
* @typedef {import('./core.js').HChild} Child
|
||||
* Acceptable child value.
|
||||
* @typedef {import('./core.js').HProperties} Properties
|
||||
* Acceptable value for element properties.
|
||||
* @typedef {import('./core.js').HResult} Result
|
||||
* Result from a `h` (or `s`) call.
|
||||
*
|
||||
* @typedef {import('./jsx-classic.js').Element} s.JSX.Element
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes
|
||||
* @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements
|
||||
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute
|
||||
*/
|
||||
|
||||
import {svg} from 'property-information'
|
||||
import {core} from './core.js'
|
||||
import {svgCaseSensitiveTagNames} from './svg-case-sensitive-tag-names.js'
|
||||
|
||||
export const s = core(svg, 'g', svgCaseSensitiveTagNames)
|
||||
Loading…
Add table
Add a link
Reference in a new issue