Comparing version 0.1.4 to 0.1.5
53
hjsx.js
@@ -24,53 +24,4 @@ // util/normalize-attribute-name.ts | ||
var attributes = { | ||
html: ` | ||
accept acceptCharset accessKey action allowFullScreen alt async autoComplete | ||
autoFocus autoPlay capture cellPadding cellSpacing challenge charSet checked | ||
cite classID className colSpan cols content contentEditable contextMenu controls | ||
controlsList coords crossOrigin data dateTime default defer dir disabled | ||
download draggable encType form formAction formEncType formMethod formNoValidate | ||
formTarget frameBorder headers height hidden high href hrefLang htmlFor | ||
httpEquiv icon id inputMode integrity is keyParams keyType kind label lang list | ||
loop low manifest marginHeight marginWidth max maxLength media mediaGroup method | ||
min minLength multiple muted name noValidate nonce open optimum pattern | ||
placeholder poster preload profile radioGroup readOnly rel required reversed | ||
role rowSpan rows sandbox scope scoped scrolling seamless selected shape size | ||
sizes span spellCheck src srcDoc srcLang srcSet start step style summary | ||
tabIndex target title type useMap value width wmode wrap | ||
`, | ||
svg: ` | ||
accentHeight accumulate additive alignmentBaseline allowReorder alphabetic | ||
amplitude arabicForm ascent attributeName attributeType autoReverse azimuth | ||
baseFrequency baseProfile baselineShift bbox begin bias by calcMode capHeight | ||
clip clipPath clipPathUnits clipRule colorInterpolation | ||
colorInterpolationFilters colorProfile colorRendering contentScriptType | ||
contentStyleType cursor cx cy d decelerate descent diffuseConstant direction | ||
display divisor dominantBaseline dur dx dy edgeMode elevation enableBackground | ||
end exponent externalResourcesRequired fill fillOpacity fillRule filter | ||
filterRes filterUnits floodColor floodOpacity focusable fontFamily fontSize | ||
fontSizeAdjust fontStretch fontStyle fontVariant fontWeight format from fx fy | ||
g1 g2 glyphName glyphOrientationHorizontal glyphOrientationVertical glyphRef | ||
gradientTransform gradientUnits hanging horizAdvX horizOriginX ideographic | ||
imageRendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength | ||
kerning keyPoints keySplines keyTimes lengthAdjust letterSpacing lightingColor | ||
limitingConeAngle local markerEnd markerHeight markerMid markerStart | ||
markerUnits markerWidth mask maskContentUnits maskUnits mathematical mode | ||
numOctaves offset opacity operator order orient orientation origin overflow | ||
overlinePosition overlineThickness paintOrder panose1 pathLength | ||
patternContentUnits patternTransform patternUnits pointerEvents points | ||
pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits | ||
r radius refX refY renderingIntent repeatCount repeatDur requiredExtensions | ||
requiredFeatures restart result rotate rx ry scale seed shapeRendering slope | ||
spacing specularConstant specularExponent speed spreadMethod startOffset | ||
stdDeviation stemh stemv stitchTiles stopColor stopOpacity | ||
strikethroughPosition strikethroughThickness string stroke strokeDasharray | ||
strokeDashoffset strokeLinecap strokeLinejoin strokeMiterlimit strokeOpacity | ||
strokeWidth surfaceScale systemLanguage tableValues targetX targetY textAnchor | ||
textDecoration textLength textRendering to transform u1 u2 underlinePosition | ||
underlineThickness unicode unicodeBidi unicodeRange unitsPerEm vAlphabetic | ||
vHanging vIdeographic vMathematical values vectorEffect version vertAdvY | ||
vertOriginX vertOriginY viewBox viewTarget visibility widths wordSpacing | ||
writingMode x x1 x2 xChannelSelector xHeight xlinkActuate xlinkArcrole | ||
xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType xmlns xmlnsXlink xmlBase | ||
xmlLang xmlSpace y y1 y2 yChannelSelector z zoomAndPan | ||
` | ||
html: "accept acceptCharset accessKey action allowFullScreen alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge charSet checked cite classID className colSpan cols content contentEditable contextMenu controls controlsList coords crossOrigin data dateTime default defer dir disabled download draggable encType form formAction formEncType formMethod formNoValidate formTarget frameBorder headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media mediaGroup method min minLength multiple muted name noValidate nonce open optimum pattern placeholder poster preload profile radioGroup readOnly rel required reversed role rowSpan rows sandbox scope scoped scrolling seamless selected shape size sizes span spellCheck src srcDoc srcLang srcSet start step style summary tabIndex target title type useMap value width wmode wrap", | ||
svg: "accentHeight accumulate additive alignmentBaseline allowReorder alphabetic amplitude arabicForm ascent attributeName attributeType autoReverse azimuth baseFrequency baseProfile baselineShift bbox begin bias by calcMode capHeight clip clipPath clipPathUnits clipRule colorInterpolation colorInterpolationFilters colorProfile colorRendering contentScriptType contentStyleType cursor cx cy d decelerate descent diffuseConstant direction display divisor dominantBaseline dur dx dy edgeMode elevation enableBackground end exponent externalResourcesRequired fill fillOpacity fillRule filter filterRes filterUnits floodColor floodOpacity focusable fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight format from fx fy g1 g2 glyphName glyphOrientationHorizontal glyphOrientationVertical glyphRef gradientTransform gradientUnits hanging horizAdvX horizOriginX ideographic imageRendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength kerning keyPoints keySplines keyTimes lengthAdjust letterSpacing lightingColor limitingConeAngle local markerEnd markerHeight markerMid markerStart markerUnits markerWidth mask maskContentUnits maskUnits mathematical mode numOctaves offset opacity operator order orient orientation origin overflow overlinePosition overlineThickness paintOrder panose1 pathLength patternContentUnits patternTransform patternUnits pointerEvents points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY renderingIntent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry scale seed shapeRendering slope spacing specularConstant specularExponent speed spreadMethod startOffset stdDeviation stemh stemv stitchTiles stopColor stopOpacity strikethroughPosition strikethroughThickness string stroke strokeDasharray strokeDashoffset strokeLinecap strokeLinejoin strokeMiterlimit strokeOpacity strokeWidth surfaceScale systemLanguage tableValues targetX targetY textAnchor textDecoration textLength textRendering to transform u1 u2 underlinePosition underlineThickness unicode unicodeBidi unicodeRange unitsPerEm vAlphabetic vHanging vIdeographic vMathematical values vectorEffect version vertAdvY vertOriginX vertOriginY viewBox viewTarget visibility widths wordSpacing writingMode x x1 x2 xChannelSelector xHeight xlinkActuate xlinkArcrole xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType xmlns xmlnsXlink xmlBase xmlLang xmlSpace y y1 y2 yChannelSelector z zoomAndPan" | ||
}; | ||
@@ -77,0 +28,0 @@ var exceptions = { |
{ | ||
"name": "hjsx", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"module": "hjsx.ts", | ||
@@ -5,0 +5,0 @@ "main": "hjsx.js", |
@@ -10,12 +10,9 @@ # hjsx | ||
To install dependencies: | ||
It *is* currently available on [`npm`](https://www.npmjs.com/package/hjsx), but I wouldn't recommend using it yet. | ||
```bash | ||
bun install | ||
``` | ||
Check out the demo: | ||
```bash | ||
bun run serve.ts | ||
bun install | ||
bun run examples/serve.ts | ||
``` |
@@ -12,82 +12,32 @@ export function normalizeAttributeName(attribute: string) { | ||
const attributes = { | ||
html: ` | ||
accept acceptCharset accessKey action allowFullScreen alt async autoComplete | ||
autoFocus autoPlay capture cellPadding cellSpacing challenge charSet checked | ||
cite classID className colSpan cols content contentEditable contextMenu controls | ||
controlsList coords crossOrigin data dateTime default defer dir disabled | ||
download draggable encType form formAction formEncType formMethod formNoValidate | ||
formTarget frameBorder headers height hidden high href hrefLang htmlFor | ||
httpEquiv icon id inputMode integrity is keyParams keyType kind label lang list | ||
loop low manifest marginHeight marginWidth max maxLength media mediaGroup method | ||
min minLength multiple muted name noValidate nonce open optimum pattern | ||
placeholder poster preload profile radioGroup readOnly rel required reversed | ||
role rowSpan rows sandbox scope scoped scrolling seamless selected shape size | ||
sizes span spellCheck src srcDoc srcLang srcSet start step style summary | ||
tabIndex target title type useMap value width wmode wrap | ||
` as const, | ||
svg: ` | ||
accentHeight accumulate additive alignmentBaseline allowReorder alphabetic | ||
amplitude arabicForm ascent attributeName attributeType autoReverse azimuth | ||
baseFrequency baseProfile baselineShift bbox begin bias by calcMode capHeight | ||
clip clipPath clipPathUnits clipRule colorInterpolation | ||
colorInterpolationFilters colorProfile colorRendering contentScriptType | ||
contentStyleType cursor cx cy d decelerate descent diffuseConstant direction | ||
display divisor dominantBaseline dur dx dy edgeMode elevation enableBackground | ||
end exponent externalResourcesRequired fill fillOpacity fillRule filter | ||
filterRes filterUnits floodColor floodOpacity focusable fontFamily fontSize | ||
fontSizeAdjust fontStretch fontStyle fontVariant fontWeight format from fx fy | ||
g1 g2 glyphName glyphOrientationHorizontal glyphOrientationVertical glyphRef | ||
gradientTransform gradientUnits hanging horizAdvX horizOriginX ideographic | ||
imageRendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength | ||
kerning keyPoints keySplines keyTimes lengthAdjust letterSpacing lightingColor | ||
limitingConeAngle local markerEnd markerHeight markerMid markerStart | ||
markerUnits markerWidth mask maskContentUnits maskUnits mathematical mode | ||
numOctaves offset opacity operator order orient orientation origin overflow | ||
overlinePosition overlineThickness paintOrder panose1 pathLength | ||
patternContentUnits patternTransform patternUnits pointerEvents points | ||
pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits | ||
r radius refX refY renderingIntent repeatCount repeatDur requiredExtensions | ||
requiredFeatures restart result rotate rx ry scale seed shapeRendering slope | ||
spacing specularConstant specularExponent speed spreadMethod startOffset | ||
stdDeviation stemh stemv stitchTiles stopColor stopOpacity | ||
strikethroughPosition strikethroughThickness string stroke strokeDasharray | ||
strokeDashoffset strokeLinecap strokeLinejoin strokeMiterlimit strokeOpacity | ||
strokeWidth surfaceScale systemLanguage tableValues targetX targetY textAnchor | ||
textDecoration textLength textRendering to transform u1 u2 underlinePosition | ||
underlineThickness unicode unicodeBidi unicodeRange unitsPerEm vAlphabetic | ||
vHanging vIdeographic vMathematical values vectorEffect version vertAdvY | ||
vertOriginX vertOriginY viewBox viewTarget visibility widths wordSpacing | ||
writingMode x x1 x2 xChannelSelector xHeight xlinkActuate xlinkArcrole | ||
xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType xmlns xmlnsXlink xmlBase | ||
xmlLang xmlSpace y y1 y2 yChannelSelector z zoomAndPan | ||
`, | ||
html: "accept acceptCharset accessKey action allowFullScreen alt async autoComplete autoFocus autoPlay capture cellPadding cellSpacing challenge charSet checked cite classID className colSpan cols content contentEditable contextMenu controls controlsList coords crossOrigin data dateTime default defer dir disabled download draggable encType form formAction formEncType formMethod formNoValidate formTarget frameBorder headers height hidden high href hrefLang htmlFor httpEquiv icon id inputMode integrity is keyParams keyType kind label lang list loop low manifest marginHeight marginWidth max maxLength media mediaGroup method min minLength multiple muted name noValidate nonce open optimum pattern placeholder poster preload profile radioGroup readOnly rel required reversed role rowSpan rows sandbox scope scoped scrolling seamless selected shape size sizes span spellCheck src srcDoc srcLang srcSet start step style summary tabIndex target title type useMap value width wmode wrap" as const, | ||
svg: "accentHeight accumulate additive alignmentBaseline allowReorder alphabetic amplitude arabicForm ascent attributeName attributeType autoReverse azimuth baseFrequency baseProfile baselineShift bbox begin bias by calcMode capHeight clip clipPath clipPathUnits clipRule colorInterpolation colorInterpolationFilters colorProfile colorRendering contentScriptType contentStyleType cursor cx cy d decelerate descent diffuseConstant direction display divisor dominantBaseline dur dx dy edgeMode elevation enableBackground end exponent externalResourcesRequired fill fillOpacity fillRule filter filterRes filterUnits floodColor floodOpacity focusable fontFamily fontSize fontSizeAdjust fontStretch fontStyle fontVariant fontWeight format from fx fy g1 g2 glyphName glyphOrientationHorizontal glyphOrientationVertical glyphRef gradientTransform gradientUnits hanging horizAdvX horizOriginX ideographic imageRendering in in2 intercept k k1 k2 k3 k4 kernelMatrix kernelUnitLength kerning keyPoints keySplines keyTimes lengthAdjust letterSpacing lightingColor limitingConeAngle local markerEnd markerHeight markerMid markerStart markerUnits markerWidth mask maskContentUnits maskUnits mathematical mode numOctaves offset opacity operator order orient orientation origin overflow overlinePosition overlineThickness paintOrder panose1 pathLength patternContentUnits patternTransform patternUnits pointerEvents points pointsAtX pointsAtY pointsAtZ preserveAlpha preserveAspectRatio primitiveUnits r radius refX refY renderingIntent repeatCount repeatDur requiredExtensions requiredFeatures restart result rotate rx ry scale seed shapeRendering slope spacing specularConstant specularExponent speed spreadMethod startOffset stdDeviation stemh stemv stitchTiles stopColor stopOpacity strikethroughPosition strikethroughThickness string stroke strokeDasharray strokeDashoffset strokeLinecap strokeLinejoin strokeMiterlimit strokeOpacity strokeWidth surfaceScale systemLanguage tableValues targetX targetY textAnchor textDecoration textLength textRendering to transform u1 u2 underlinePosition underlineThickness unicode unicodeBidi unicodeRange unitsPerEm vAlphabetic vHanging vIdeographic vMathematical values vectorEffect version vertAdvY vertOriginX vertOriginY viewBox viewTarget visibility widths wordSpacing writingMode x x1 x2 xChannelSelector xHeight xlinkActuate xlinkArcrole xlinkHref xlinkRole xlinkShow xlinkTitle xlinkType xmlns xmlnsXlink xmlBase xmlLang xmlSpace y y1 y2 yChannelSelector z zoomAndPan" as const, | ||
}; | ||
const exceptions: { html: Record<string, string>, svg: Record<string, string> } = { | ||
const exceptions: { html: Record<string, string>; svg: Record<string, string> } = { | ||
html: { | ||
acceptCharset: 'accept-charset', | ||
className: 'class', | ||
htmlFor: 'for', | ||
httpEquiv: 'http-equiv', | ||
defaultChecked: 'checked', | ||
acceptCharset: "accept-charset", | ||
className: "class", | ||
htmlFor: "for", | ||
httpEquiv: "http-equiv", | ||
defaultChecked: "checked", | ||
}, | ||
svg: { | ||
panose1: 'panose-1', | ||
xlinkActuate: 'xlink:actuate', | ||
xlinkArcrole: 'xlink:arcrole', | ||
xlinkHref: 'xlink:href', | ||
xlinkRole: 'xlink:role', | ||
xlinkShow: 'xlink:show', | ||
xlinkTitle: 'xlink:title', | ||
xlinkType: 'xlink:type', | ||
xmlBase: 'xml:base', | ||
xmlLang: 'xml:lang', | ||
xmlSpace: 'xml:space', | ||
xmlnsXlink: 'xmlns:xlink', | ||
xmlns: 'xmlns', | ||
zoomAndPan: 'zoomAndPan', | ||
panose1: "panose-1", | ||
xlinkActuate: "xlink:actuate", | ||
xlinkArcrole: "xlink:arcrole", | ||
xlinkHref: "xlink:href", | ||
xlinkRole: "xlink:role", | ||
xlinkShow: "xlink:show", | ||
xlinkTitle: "xlink:title", | ||
xlinkType: "xlink:type", | ||
xmlBase: "xml:base", | ||
xmlLang: "xml:lang", | ||
xmlSpace: "xml:space", | ||
xmlnsXlink: "xmlns:xlink", | ||
xmlns: "xmlns", | ||
zoomAndPan: "zoomAndPan", | ||
}, | ||
}; | ||
function toHtmlAttribute(attribute: string) { | ||
@@ -94,0 +44,0 @@ if (exceptions.html[attribute]) { |
92171
1970
18