@redis-ui/components 51.26.0 → 51.28.0
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.
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.cjs +17 -8
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.js +17 -8
- package/dist/Button/CopyToClipboardButton/CopyToClipboardButton.types.d.ts +5 -1
- package/dist/CodeBlock/CodeBlock.cjs +29 -14
- package/dist/CodeBlock/CodeBlock.js +29 -14
- package/dist/CodeBlock/CodeBlock.style.d.ts +4 -3
- package/dist/CodeBlock/CodeBlock.types.cjs +7 -0
- package/dist/CodeBlock/CodeBlock.types.d.ts +4 -0
- package/dist/CodeBlock/CodeBlock.types.js +7 -1
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.cjs +29 -0
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.constants.cjs +34 -0
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.constants.d.ts +25 -0
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.constants.js +32 -0
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.d.ts +6 -0
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.js +29 -0
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.types.d.ts +10 -0
- package/dist/CodeBlock/components/HighlightedCode/HighlightedCode.types.js +1 -0
- package/dist/Inputs/Input/Input.cjs +9 -2
- package/dist/Inputs/Input/Input.d.ts +4 -1
- package/dist/Inputs/Input/Input.js +9 -2
- package/dist/Inputs/Input/Input.types.d.ts +5 -1
- package/dist/Inputs/PasswordInput/components/Compose/Compose.types.d.ts +1 -1
- package/dist/Inputs/TextArea/TextArea.cjs +16 -6
- package/dist/Inputs/TextArea/TextArea.d.ts +3 -1
- package/dist/Inputs/TextArea/TextArea.js +16 -6
- package/dist/Inputs/TextArea/TextArea.types.d.ts +4 -1
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.cjs +7 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.d.ts +2 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.js +7 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.cjs +17 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.d.ts +1 -0
- package/dist/Inputs/TextArea/components/CopyButton/CopyButton.style.js +15 -0
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.cjs +3 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.js +4 -2
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.style.cjs +8 -1
- package/dist/Inputs/TextArea/components/TextAreaTag/TextAreaTag.style.js +8 -1
- package/dist/Inputs/components/Compose/CommonCompose.cjs +23 -18
- package/dist/Inputs/components/Compose/CommonCompose.d.ts +1 -1
- package/dist/Inputs/components/Compose/CommonCompose.js +24 -19
- package/dist/Inputs/components/Compose/CommonCompose.types.d.ts +2 -0
- package/dist/Inputs/components/Compose/Compose.style.cjs +7 -0
- package/dist/Inputs/components/Compose/Compose.style.js +7 -0
- package/dist/Inputs/components/Compose/NumericCompose.types.d.ts +1 -1
- package/dist/Inputs/components/CopyButton/CopyButton.cjs +15 -0
- package/dist/Inputs/components/CopyButton/CopyButton.d.ts +2 -0
- package/dist/Inputs/components/CopyButton/CopyButton.js +15 -0
- package/dist/Inputs/components/CopyButton/CopyButton.style.cjs +17 -0
- package/dist/Inputs/components/CopyButton/CopyButton.style.d.ts +1 -0
- package/dist/Inputs/components/CopyButton/CopyButton.style.js +15 -0
- package/dist/Inputs/components/CopyButton/CopyButton.types.d.ts +6 -0
- package/dist/Inputs/components/CopyButton/CopyButton.types.js +1 -0
- package/dist/Inputs/components/InputTag/InputTag.cjs +3 -1
- package/dist/Inputs/components/InputTag/InputTag.js +4 -2
- package/dist/Inputs/components/InputTag/InputTag.style.cjs +1 -1
- package/dist/Inputs/components/InputTag/InputTag.style.js +1 -1
- package/dist/index.cjs +1 -0
- package/dist/index.js +2 -2
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.cjs +8 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayLikeToArray.js +8 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.cjs +7 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/arrayWithoutHoles.js +7 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.cjs +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/defineProperty.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.cjs +17 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.cjs +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/iterableToArray.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.cjs +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/nonIterableSpread.js +6 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.cjs +13 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js +13 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.cjs +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +12 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.cjs +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toConsumableArray.js +10 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.cjs +14 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPrimitive.js +14 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.cjs +9 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/toPropertyKey.js +9 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/typeof.cjs +16 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/typeof.js +11 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.cjs +11 -0
- package/dist/node_modules/@babel/runtime/helpers/esm/unsupportedIterableToArray.js +11 -0
- package/dist/node_modules/character-entities-legacy/index.cjs +116 -0
- package/dist/node_modules/character-entities-legacy/index.js +116 -0
- package/dist/node_modules/character-reference-invalid/index.cjs +38 -0
- package/dist/node_modules/character-reference-invalid/index.js +38 -0
- package/dist/node_modules/comma-separated-tokens/index.cjs +43 -0
- package/dist/node_modules/comma-separated-tokens/index.js +43 -0
- package/dist/node_modules/decode-named-character-reference/index.dom.cjs +15 -0
- package/dist/node_modules/decode-named-character-reference/index.dom.js +15 -0
- package/dist/node_modules/hast-util-parse-selector/lib/index.cjs +76 -0
- package/dist/node_modules/hast-util-parse-selector/lib/index.js +76 -0
- package/dist/node_modules/hastscript/lib/create-h.cjs +262 -0
- package/dist/node_modules/hastscript/lib/create-h.js +262 -0
- package/dist/node_modules/hastscript/lib/index.cjs +21 -0
- package/dist/node_modules/hastscript/lib/index.js +21 -0
- package/dist/node_modules/hastscript/lib/svg-case-sensitive-tag-names.cjs +49 -0
- package/dist/node_modules/hastscript/lib/svg-case-sensitive-tag-names.js +49 -0
- package/dist/node_modules/is-alphabetical/index.cjs +14 -0
- package/dist/node_modules/is-alphabetical/index.js +14 -0
- package/dist/node_modules/is-alphanumerical/index.cjs +15 -0
- package/dist/node_modules/is-alphanumerical/index.js +15 -0
- package/dist/node_modules/is-decimal/index.cjs +14 -0
- package/dist/node_modules/is-decimal/index.js +14 -0
- package/dist/node_modules/is-hexadecimal/index.cjs +14 -0
- package/dist/node_modules/is-hexadecimal/index.js +14 -0
- package/dist/node_modules/parse-entities/lib/index.cjs +232 -0
- package/dist/node_modules/parse-entities/lib/index.js +232 -0
- package/dist/node_modules/property-information/index.cjs +27 -0
- package/dist/node_modules/property-information/index.js +26 -0
- package/dist/node_modules/property-information/lib/aria.cjs +60 -0
- package/dist/node_modules/property-information/lib/aria.js +61 -0
- package/dist/node_modules/property-information/lib/find.cjs +81 -0
- package/dist/node_modules/property-information/lib/find.js +81 -0
- package/dist/node_modules/property-information/lib/html.cjs +326 -0
- package/dist/node_modules/property-information/lib/html.js +326 -0
- package/dist/node_modules/property-information/lib/normalize.cjs +15 -0
- package/dist/node_modules/property-information/lib/normalize.js +15 -0
- package/dist/node_modules/property-information/lib/svg.cjs +564 -0
- package/dist/node_modules/property-information/lib/svg.js +564 -0
- package/dist/node_modules/property-information/lib/util/case-insensitive-transform.cjs +15 -0
- package/dist/node_modules/property-information/lib/util/case-insensitive-transform.js +15 -0
- package/dist/node_modules/property-information/lib/util/case-sensitive-transform.cjs +14 -0
- package/dist/node_modules/property-information/lib/util/case-sensitive-transform.js +14 -0
- package/dist/node_modules/property-information/lib/util/create.cjs +53 -0
- package/dist/node_modules/property-information/lib/util/create.js +53 -0
- package/dist/node_modules/property-information/lib/util/defined-info.cjs +49 -0
- package/dist/node_modules/property-information/lib/util/defined-info.js +49 -0
- package/dist/node_modules/property-information/lib/util/info.cjs +33 -0
- package/dist/node_modules/property-information/lib/util/info.js +33 -0
- package/dist/node_modules/property-information/lib/util/merge.cjs +26 -0
- package/dist/node_modules/property-information/lib/util/merge.js +26 -0
- package/dist/node_modules/property-information/lib/util/schema.cjs +27 -0
- package/dist/node_modules/property-information/lib/util/schema.js +27 -0
- package/dist/node_modules/property-information/lib/util/types.cjs +35 -0
- package/dist/node_modules/property-information/lib/util/types.js +24 -0
- package/dist/node_modules/property-information/lib/xlink.cjs +18 -0
- package/dist/node_modules/property-information/lib/xlink.js +19 -0
- package/dist/node_modules/property-information/lib/xml.cjs +14 -0
- package/dist/node_modules/property-information/lib/xml.js +15 -0
- package/dist/node_modules/property-information/lib/xmlns.cjs +14 -0
- package/dist/node_modules/property-information/lib/xmlns.js +14 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/checkForListedLanguage.cjs +6 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/checkForListedLanguage.js +6 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/create-element.cjs +183 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/create-element.js +181 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/highlight.cjs +308 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/highlight.js +306 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/bash.cjs +4 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/bash.js +5 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/json.cjs +4 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/json.js +5 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/python.cjs +4 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/python.js +5 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/typescript.cjs +4 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/languages/prism/typescript.js +5 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/prism-light.cjs +12 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/prism-light.js +12 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vs.cjs +121 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vs.js +121 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.cjs +147 -0
- package/dist/node_modules/react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus.js +147 -0
- package/dist/node_modules/refractor/lang/bash.cjs +190 -0
- package/dist/node_modules/refractor/lang/bash.js +190 -0
- package/dist/node_modules/refractor/lang/clike.cjs +37 -0
- package/dist/node_modules/refractor/lang/clike.js +37 -0
- package/dist/node_modules/refractor/lang/javascript.cjs +122 -0
- package/dist/node_modules/refractor/lang/javascript.js +122 -0
- package/dist/node_modules/refractor/lang/json.cjs +36 -0
- package/dist/node_modules/refractor/lang/json.js +36 -0
- package/dist/node_modules/refractor/lang/python.cjs +71 -0
- package/dist/node_modules/refractor/lang/python.js +71 -0
- package/dist/node_modules/refractor/lang/typescript.cjs +55 -0
- package/dist/node_modules/refractor/lang/typescript.js +55 -0
- package/dist/node_modules/refractor/lib/core.cjs +214 -0
- package/dist/node_modules/refractor/lib/core.js +214 -0
- package/dist/node_modules/refractor/lib/prism-core.cjs +595 -0
- package/dist/node_modules/refractor/lib/prism-core.js +595 -0
- package/dist/node_modules/space-separated-tokens/index.cjs +15 -0
- package/dist/node_modules/space-separated-tokens/index.js +15 -0
- package/package.json +4 -2
- package/skills/redis-ui-components/references/CodeBlock.md +23 -5
- package/skills/redis-ui-components/references/CopyToClipboardButton.md +23 -1
- package/skills/redis-ui-components/references/Input.md +39 -2
- package/skills/redis-ui-components/references/SearchInput.md +1 -1
- package/skills/redis-ui-components/references/TextArea.md +19 -1
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { normalize } from "../../property-information/lib/normalize.js";
|
|
2
|
+
import { find } from "../../property-information/lib/find.js";
|
|
3
|
+
import { parse } from "../../comma-separated-tokens/index.js";
|
|
4
|
+
import { parseSelector } from "../../hast-util-parse-selector/lib/index.js";
|
|
5
|
+
import { parse as parse$1 } from "../../space-separated-tokens/index.js";
|
|
6
|
+
//#region ../../node_modules/hastscript/lib/create-h.js
|
|
7
|
+
/**
|
|
8
|
+
* @import {Element, Nodes, RootContent, Root} from 'hast'
|
|
9
|
+
* @import {Info, Schema} from 'property-information'
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {Array<Nodes | PrimitiveChild>} ArrayChildNested
|
|
13
|
+
* List of children (deep).
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Array<ArrayChildNested | Nodes | PrimitiveChild>} ArrayChild
|
|
17
|
+
* List of children.
|
|
18
|
+
*/
|
|
19
|
+
/**
|
|
20
|
+
* @typedef {Array<number | string>} ArrayValue
|
|
21
|
+
* List of property values for space- or comma separated values (such as `className`).
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {ArrayChild | Nodes | PrimitiveChild} Child
|
|
25
|
+
* Acceptable child value.
|
|
26
|
+
*/
|
|
27
|
+
/**
|
|
28
|
+
* @typedef {number | string | null | undefined} PrimitiveChild
|
|
29
|
+
* Primitive children, either ignored (nullish), or turned into text nodes.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* @typedef {boolean | number | string | null | undefined} PrimitiveValue
|
|
33
|
+
* Primitive property value.
|
|
34
|
+
*/
|
|
35
|
+
/**
|
|
36
|
+
* @typedef {Record<string, PropertyValue | Style>} Properties
|
|
37
|
+
* Acceptable value for element properties.
|
|
38
|
+
*/
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {ArrayValue | PrimitiveValue} PropertyValue
|
|
41
|
+
* Primitive value or list value.
|
|
42
|
+
*/
|
|
43
|
+
/**
|
|
44
|
+
* @typedef {Element | Root} Result
|
|
45
|
+
* Result from a `h` (or `s`) call.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* @typedef {number | string} StyleValue
|
|
49
|
+
* Value for a CSS style field.
|
|
50
|
+
*/
|
|
51
|
+
/**
|
|
52
|
+
* @typedef {Record<string, StyleValue>} Style
|
|
53
|
+
* Supported value of a `style` prop.
|
|
54
|
+
*/
|
|
55
|
+
/**
|
|
56
|
+
* Create an `h` function.
|
|
57
|
+
*
|
|
58
|
+
* @param {Schema} schema
|
|
59
|
+
* Schema to use.
|
|
60
|
+
* @param {string} defaultTagName
|
|
61
|
+
* Default tag name.
|
|
62
|
+
* @param {ReadonlyArray<string> | undefined} [caseSensitive]
|
|
63
|
+
* Case-sensitive tag names (default: `undefined`).
|
|
64
|
+
* @returns
|
|
65
|
+
* `h`.
|
|
66
|
+
*/
|
|
67
|
+
function createH(schema, defaultTagName, caseSensitive) {
|
|
68
|
+
const adjust = caseSensitive ? createAdjustMap(caseSensitive) : void 0;
|
|
69
|
+
/**
|
|
70
|
+
* Hyperscript compatible DSL for creating virtual hast trees.
|
|
71
|
+
*
|
|
72
|
+
* @overload
|
|
73
|
+
* @param {null | undefined} [selector]
|
|
74
|
+
* Nothing to get a root.
|
|
75
|
+
* @param {...Child} children
|
|
76
|
+
* Children.
|
|
77
|
+
* @returns {Root}
|
|
78
|
+
* Root.
|
|
79
|
+
*
|
|
80
|
+
* @overload
|
|
81
|
+
* @param {string} selector
|
|
82
|
+
* Selector.
|
|
83
|
+
* @param {Child | Properties} [properties]
|
|
84
|
+
* Properties (or first child) (default: `undefined`).
|
|
85
|
+
* @param {...Child} children
|
|
86
|
+
* Children.
|
|
87
|
+
* @returns {Element}
|
|
88
|
+
* Element.
|
|
89
|
+
*
|
|
90
|
+
* @param {string | null | undefined} [selector]
|
|
91
|
+
* Selector.
|
|
92
|
+
* @param {Child | Properties} [properties]
|
|
93
|
+
* Properties (or first child) (default: `undefined`).
|
|
94
|
+
* @param {...Child} children
|
|
95
|
+
* Children.
|
|
96
|
+
* @returns {Result}
|
|
97
|
+
* Result.
|
|
98
|
+
*/
|
|
99
|
+
function h(selector, properties, ...children) {
|
|
100
|
+
/** @type {Result} */
|
|
101
|
+
let node;
|
|
102
|
+
if (selector === null || selector === void 0) {
|
|
103
|
+
node = {
|
|
104
|
+
type: "root",
|
|
105
|
+
children: []
|
|
106
|
+
};
|
|
107
|
+
const child = properties;
|
|
108
|
+
children.unshift(child);
|
|
109
|
+
} else {
|
|
110
|
+
node = parseSelector(selector, defaultTagName);
|
|
111
|
+
const lower = node.tagName.toLowerCase();
|
|
112
|
+
const adjusted = adjust ? adjust.get(lower) : void 0;
|
|
113
|
+
node.tagName = adjusted || lower;
|
|
114
|
+
if (isChild(properties)) children.unshift(properties);
|
|
115
|
+
else for (const [key, value] of Object.entries(properties)) addProperty(schema, node.properties, key, value);
|
|
116
|
+
}
|
|
117
|
+
for (const child of children) addChild(node.children, child);
|
|
118
|
+
if (node.type === "element" && node.tagName === "template" && schema.space === "html") {
|
|
119
|
+
node.content = {
|
|
120
|
+
type: "root",
|
|
121
|
+
children: node.children
|
|
122
|
+
};
|
|
123
|
+
node.children = [];
|
|
124
|
+
}
|
|
125
|
+
return node;
|
|
126
|
+
}
|
|
127
|
+
return h;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Check if something is properties or a child.
|
|
131
|
+
*
|
|
132
|
+
* @param {Child | Properties} value
|
|
133
|
+
* Value to check.
|
|
134
|
+
* @returns {value is Child}
|
|
135
|
+
* Whether `value` is definitely a child.
|
|
136
|
+
*/
|
|
137
|
+
function isChild(value) {
|
|
138
|
+
if (value === null || typeof value !== "object" || Array.isArray(value)) return true;
|
|
139
|
+
if (typeof value.type !== "string") return false;
|
|
140
|
+
const record = value;
|
|
141
|
+
const keys = Object.keys(value);
|
|
142
|
+
for (const key of keys) {
|
|
143
|
+
const value = record[key];
|
|
144
|
+
if (value && typeof value === "object") {
|
|
145
|
+
if (!Array.isArray(value)) return true;
|
|
146
|
+
const list = value;
|
|
147
|
+
for (const item of list) if (typeof item !== "number" && typeof item !== "string") return true;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if ("children" in value && Array.isArray(value.children)) return true;
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Add a property.
|
|
155
|
+
*
|
|
156
|
+
* @param {Schema} schema
|
|
157
|
+
* Schema.
|
|
158
|
+
* @param {Properties} properties
|
|
159
|
+
* Properties object.
|
|
160
|
+
* @param {string} key
|
|
161
|
+
* Property name.
|
|
162
|
+
* @param {PropertyValue | Style} value
|
|
163
|
+
* Property value.
|
|
164
|
+
* @returns {undefined}
|
|
165
|
+
* Nothing.
|
|
166
|
+
*/
|
|
167
|
+
function addProperty(schema, properties, key, value) {
|
|
168
|
+
if (value === null || value === void 0) return;
|
|
169
|
+
const info = find(schema, key);
|
|
170
|
+
/** @type {PropertyValue} */
|
|
171
|
+
let result;
|
|
172
|
+
if (typeof value === "number") {
|
|
173
|
+
if (Number.isNaN(value)) return;
|
|
174
|
+
result = value;
|
|
175
|
+
} else if (typeof value === "boolean") result = value;
|
|
176
|
+
else if (typeof value === "string") if (info.spaceSeparated) result = parse$1(value);
|
|
177
|
+
else if (info.commaSeparated) result = parse(value);
|
|
178
|
+
else if (info.commaOrSpaceSeparated) result = parse$1(parse(value).join(" "));
|
|
179
|
+
else result = parsePrimitive(info, info.property, value);
|
|
180
|
+
else if (Array.isArray(value)) result = [...value];
|
|
181
|
+
else result = info.property === "style" ? style(value) : String(value);
|
|
182
|
+
if (Array.isArray(result)) {
|
|
183
|
+
/** @type {Array<number | string>} */
|
|
184
|
+
const finalResult = [];
|
|
185
|
+
for (const item of result) finalResult.push(parsePrimitive(info, info.property, item));
|
|
186
|
+
result = finalResult;
|
|
187
|
+
}
|
|
188
|
+
if (info.property === "className" && Array.isArray(properties.className)) {
|
|
189
|
+
const add = result;
|
|
190
|
+
result = [...properties.className, ...Array.isArray(add) ? add : [add]];
|
|
191
|
+
}
|
|
192
|
+
properties[info.property] = result;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Add a child.
|
|
196
|
+
*
|
|
197
|
+
* @param {Array<RootContent>} nodes
|
|
198
|
+
* Children.
|
|
199
|
+
* @param {Child} value
|
|
200
|
+
* Child.
|
|
201
|
+
* @returns {undefined}
|
|
202
|
+
* Nothing.
|
|
203
|
+
*/
|
|
204
|
+
function addChild(nodes, value) {
|
|
205
|
+
if (value === null || value === void 0) {} else if (typeof value === "number" || typeof value === "string") nodes.push({
|
|
206
|
+
type: "text",
|
|
207
|
+
value: String(value)
|
|
208
|
+
});
|
|
209
|
+
else if (Array.isArray(value)) for (const child of value) addChild(nodes, child);
|
|
210
|
+
else if (typeof value === "object" && "type" in value) if (value.type === "root") addChild(nodes, value.children);
|
|
211
|
+
else nodes.push(value);
|
|
212
|
+
else throw new Error("Expected node, nodes, or string, got `" + value + "`");
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Parse a single primitives.
|
|
216
|
+
*
|
|
217
|
+
* @param {Info} info
|
|
218
|
+
* Property information.
|
|
219
|
+
* @param {string} name
|
|
220
|
+
* Property name.
|
|
221
|
+
* @param {PrimitiveValue} value
|
|
222
|
+
* Property value.
|
|
223
|
+
* @returns {PrimitiveValue}
|
|
224
|
+
* Property value.
|
|
225
|
+
*/
|
|
226
|
+
function parsePrimitive(info, name, value) {
|
|
227
|
+
if (typeof value === "string") {
|
|
228
|
+
if (info.number && value && !Number.isNaN(Number(value))) return Number(value);
|
|
229
|
+
if ((info.boolean || info.overloadedBoolean) && (value === "" || normalize(value) === normalize(name))) return true;
|
|
230
|
+
}
|
|
231
|
+
return value;
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Serialize a `style` object as a string.
|
|
235
|
+
*
|
|
236
|
+
* @param {Style} styles
|
|
237
|
+
* Style object.
|
|
238
|
+
* @returns {string}
|
|
239
|
+
* CSS string.
|
|
240
|
+
*/
|
|
241
|
+
function style(styles) {
|
|
242
|
+
/** @type {Array<string>} */
|
|
243
|
+
const result = [];
|
|
244
|
+
for (const [key, value] of Object.entries(styles)) result.push([key, value].join(": "));
|
|
245
|
+
return result.join("; ");
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Create a map to adjust casing.
|
|
249
|
+
*
|
|
250
|
+
* @param {ReadonlyArray<string>} values
|
|
251
|
+
* List of properly cased keys.
|
|
252
|
+
* @returns {Map<string, string>}
|
|
253
|
+
* Map of lowercase keys to uppercase keys.
|
|
254
|
+
*/
|
|
255
|
+
function createAdjustMap(values) {
|
|
256
|
+
/** @type {Map<string, string>} */
|
|
257
|
+
const result = /* @__PURE__ */ new Map();
|
|
258
|
+
for (const value of values) result.set(value.toLowerCase(), value);
|
|
259
|
+
return result;
|
|
260
|
+
}
|
|
261
|
+
//#endregion
|
|
262
|
+
export { createH };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_index = require("../../property-information/index.cjs");
|
|
2
|
+
const require_create_h = require("./create-h.cjs");
|
|
3
|
+
const require_svg_case_sensitive_tag_names = require("./svg-case-sensitive-tag-names.cjs");
|
|
4
|
+
//#region ../../node_modules/hastscript/lib/index.js
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('./jsx-classic.js').Element} h.JSX.Element
|
|
7
|
+
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute
|
|
8
|
+
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes
|
|
9
|
+
* @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {import('./jsx-classic.js').Element} s.JSX.Element
|
|
13
|
+
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute
|
|
14
|
+
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes
|
|
15
|
+
* @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements
|
|
16
|
+
*/
|
|
17
|
+
/** @type {ReturnType<createH>} */
|
|
18
|
+
var h = require_create_h.createH(require_index.html, "div");
|
|
19
|
+
require_create_h.createH(require_index.svg, "g", require_svg_case_sensitive_tag_names.svgCaseSensitiveTagNames);
|
|
20
|
+
//#endregion
|
|
21
|
+
exports.h = h;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { html, svg } from "../../property-information/index.js";
|
|
2
|
+
import { createH } from "./create-h.js";
|
|
3
|
+
import { svgCaseSensitiveTagNames } from "./svg-case-sensitive-tag-names.js";
|
|
4
|
+
//#region ../../node_modules/hastscript/lib/index.js
|
|
5
|
+
/**
|
|
6
|
+
* @typedef {import('./jsx-classic.js').Element} h.JSX.Element
|
|
7
|
+
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} h.JSX.ElementChildrenAttribute
|
|
8
|
+
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} h.JSX.IntrinsicAttributes
|
|
9
|
+
* @typedef {import('./jsx-classic.js').IntrinsicElements} h.JSX.IntrinsicElements
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* @typedef {import('./jsx-classic.js').Element} s.JSX.Element
|
|
13
|
+
* @typedef {import('./jsx-classic.js').ElementChildrenAttribute} s.JSX.ElementChildrenAttribute
|
|
14
|
+
* @typedef {import('./jsx-classic.js').IntrinsicAttributes} s.JSX.IntrinsicAttributes
|
|
15
|
+
* @typedef {import('./jsx-classic.js').IntrinsicElements} s.JSX.IntrinsicElements
|
|
16
|
+
*/
|
|
17
|
+
/** @type {ReturnType<createH>} */
|
|
18
|
+
var h = createH(html, "div");
|
|
19
|
+
createH(svg, "g", svgCaseSensitiveTagNames);
|
|
20
|
+
//#endregion
|
|
21
|
+
export { h };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region ../../node_modules/hastscript/lib/svg-case-sensitive-tag-names.js
|
|
2
|
+
/**
|
|
3
|
+
* List of case-sensitive SVG tag names.
|
|
4
|
+
*
|
|
5
|
+
* @type {ReadonlyArray<string>}
|
|
6
|
+
*/
|
|
7
|
+
var svgCaseSensitiveTagNames = [
|
|
8
|
+
"altGlyph",
|
|
9
|
+
"altGlyphDef",
|
|
10
|
+
"altGlyphItem",
|
|
11
|
+
"animateColor",
|
|
12
|
+
"animateMotion",
|
|
13
|
+
"animateTransform",
|
|
14
|
+
"clipPath",
|
|
15
|
+
"feBlend",
|
|
16
|
+
"feColorMatrix",
|
|
17
|
+
"feComponentTransfer",
|
|
18
|
+
"feComposite",
|
|
19
|
+
"feConvolveMatrix",
|
|
20
|
+
"feDiffuseLighting",
|
|
21
|
+
"feDisplacementMap",
|
|
22
|
+
"feDistantLight",
|
|
23
|
+
"feDropShadow",
|
|
24
|
+
"feFlood",
|
|
25
|
+
"feFuncA",
|
|
26
|
+
"feFuncB",
|
|
27
|
+
"feFuncG",
|
|
28
|
+
"feFuncR",
|
|
29
|
+
"feGaussianBlur",
|
|
30
|
+
"feImage",
|
|
31
|
+
"feMerge",
|
|
32
|
+
"feMergeNode",
|
|
33
|
+
"feMorphology",
|
|
34
|
+
"feOffset",
|
|
35
|
+
"fePointLight",
|
|
36
|
+
"feSpecularLighting",
|
|
37
|
+
"feSpotLight",
|
|
38
|
+
"feTile",
|
|
39
|
+
"feTurbulence",
|
|
40
|
+
"foreignObject",
|
|
41
|
+
"glyphRef",
|
|
42
|
+
"linearGradient",
|
|
43
|
+
"radialGradient",
|
|
44
|
+
"solidColor",
|
|
45
|
+
"textArea",
|
|
46
|
+
"textPath"
|
|
47
|
+
];
|
|
48
|
+
//#endregion
|
|
49
|
+
exports.svgCaseSensitiveTagNames = svgCaseSensitiveTagNames;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
//#region ../../node_modules/hastscript/lib/svg-case-sensitive-tag-names.js
|
|
2
|
+
/**
|
|
3
|
+
* List of case-sensitive SVG tag names.
|
|
4
|
+
*
|
|
5
|
+
* @type {ReadonlyArray<string>}
|
|
6
|
+
*/
|
|
7
|
+
var svgCaseSensitiveTagNames = [
|
|
8
|
+
"altGlyph",
|
|
9
|
+
"altGlyphDef",
|
|
10
|
+
"altGlyphItem",
|
|
11
|
+
"animateColor",
|
|
12
|
+
"animateMotion",
|
|
13
|
+
"animateTransform",
|
|
14
|
+
"clipPath",
|
|
15
|
+
"feBlend",
|
|
16
|
+
"feColorMatrix",
|
|
17
|
+
"feComponentTransfer",
|
|
18
|
+
"feComposite",
|
|
19
|
+
"feConvolveMatrix",
|
|
20
|
+
"feDiffuseLighting",
|
|
21
|
+
"feDisplacementMap",
|
|
22
|
+
"feDistantLight",
|
|
23
|
+
"feDropShadow",
|
|
24
|
+
"feFlood",
|
|
25
|
+
"feFuncA",
|
|
26
|
+
"feFuncB",
|
|
27
|
+
"feFuncG",
|
|
28
|
+
"feFuncR",
|
|
29
|
+
"feGaussianBlur",
|
|
30
|
+
"feImage",
|
|
31
|
+
"feMerge",
|
|
32
|
+
"feMergeNode",
|
|
33
|
+
"feMorphology",
|
|
34
|
+
"feOffset",
|
|
35
|
+
"fePointLight",
|
|
36
|
+
"feSpecularLighting",
|
|
37
|
+
"feSpotLight",
|
|
38
|
+
"feTile",
|
|
39
|
+
"feTurbulence",
|
|
40
|
+
"foreignObject",
|
|
41
|
+
"glyphRef",
|
|
42
|
+
"linearGradient",
|
|
43
|
+
"radialGradient",
|
|
44
|
+
"solidColor",
|
|
45
|
+
"textArea",
|
|
46
|
+
"textPath"
|
|
47
|
+
];
|
|
48
|
+
//#endregion
|
|
49
|
+
export { svgCaseSensitiveTagNames };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/is-alphabetical/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Check if the given character code, or the character code at the first
|
|
4
|
+
* character, is alphabetical.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|number} character
|
|
7
|
+
* @returns {boolean} Whether `character` is alphabetical.
|
|
8
|
+
*/
|
|
9
|
+
function isAlphabetical(character) {
|
|
10
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
11
|
+
return code >= 97 && code <= 122 || code >= 65 && code <= 90;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.isAlphabetical = isAlphabetical;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/is-alphabetical/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Check if the given character code, or the character code at the first
|
|
4
|
+
* character, is alphabetical.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|number} character
|
|
7
|
+
* @returns {boolean} Whether `character` is alphabetical.
|
|
8
|
+
*/
|
|
9
|
+
function isAlphabetical(character) {
|
|
10
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
11
|
+
return code >= 97 && code <= 122 || code >= 65 && code <= 90;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isAlphabetical };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const require_index = require("../is-decimal/index.cjs");
|
|
2
|
+
const require_index$1 = require("../is-alphabetical/index.cjs");
|
|
3
|
+
//#region ../../node_modules/is-alphanumerical/index.js
|
|
4
|
+
/**
|
|
5
|
+
* Check if the given character code, or the character code at the first
|
|
6
|
+
* character, is alphanumerical.
|
|
7
|
+
*
|
|
8
|
+
* @param {string|number} character
|
|
9
|
+
* @returns {boolean} Whether `character` is alphanumerical.
|
|
10
|
+
*/
|
|
11
|
+
function isAlphanumerical(character) {
|
|
12
|
+
return require_index$1.isAlphabetical(character) || require_index.isDecimal(character);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
exports.isAlphanumerical = isAlphanumerical;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { isDecimal } from "../is-decimal/index.js";
|
|
2
|
+
import { isAlphabetical } from "../is-alphabetical/index.js";
|
|
3
|
+
//#region ../../node_modules/is-alphanumerical/index.js
|
|
4
|
+
/**
|
|
5
|
+
* Check if the given character code, or the character code at the first
|
|
6
|
+
* character, is alphanumerical.
|
|
7
|
+
*
|
|
8
|
+
* @param {string|number} character
|
|
9
|
+
* @returns {boolean} Whether `character` is alphanumerical.
|
|
10
|
+
*/
|
|
11
|
+
function isAlphanumerical(character) {
|
|
12
|
+
return isAlphabetical(character) || isDecimal(character);
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { isAlphanumerical };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/is-decimal/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Check if the given character code, or the character code at the first
|
|
4
|
+
* character, is decimal.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|number} character
|
|
7
|
+
* @returns {boolean} Whether `character` is a decimal
|
|
8
|
+
*/
|
|
9
|
+
function isDecimal(character) {
|
|
10
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
11
|
+
return code >= 48 && code <= 57;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.isDecimal = isDecimal;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/is-decimal/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Check if the given character code, or the character code at the first
|
|
4
|
+
* character, is decimal.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|number} character
|
|
7
|
+
* @returns {boolean} Whether `character` is a decimal
|
|
8
|
+
*/
|
|
9
|
+
function isDecimal(character) {
|
|
10
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
11
|
+
return code >= 48 && code <= 57;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isDecimal };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/is-hexadecimal/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Check if the given character code, or the character code at the first
|
|
4
|
+
* character, is hexadecimal.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|number} character
|
|
7
|
+
* @returns {boolean} Whether `character` is hexadecimal
|
|
8
|
+
*/
|
|
9
|
+
function isHexadecimal(character) {
|
|
10
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
11
|
+
return code >= 97 && code <= 102 || code >= 65 && code <= 70 || code >= 48 && code <= 57;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
exports.isHexadecimal = isHexadecimal;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
//#region ../../node_modules/is-hexadecimal/index.js
|
|
2
|
+
/**
|
|
3
|
+
* Check if the given character code, or the character code at the first
|
|
4
|
+
* character, is hexadecimal.
|
|
5
|
+
*
|
|
6
|
+
* @param {string|number} character
|
|
7
|
+
* @returns {boolean} Whether `character` is hexadecimal
|
|
8
|
+
*/
|
|
9
|
+
function isHexadecimal(character) {
|
|
10
|
+
const code = typeof character === "string" ? character.charCodeAt(0) : character;
|
|
11
|
+
return code >= 97 && code <= 102 || code >= 65 && code <= 70 || code >= 48 && code <= 57;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { isHexadecimal };
|