@mpen/jsxhtml 0.1.14 → 0.1.16
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/{types/custom-components.d.ts → custom-components.d.ts} +1 -1
- package/index.cjs +1 -1
- package/index.mjs +2 -2
- package/jsx-dev-runtime.cjs +1 -1
- package/jsx-dev-runtime.mjs +2 -2
- package/{jsx-runtime-xIDZYHgS.js → jsx-runtime-_xtqfR_9.js} +13 -56
- package/{jsx-runtime-NqHz6WEo.js → jsx-runtime-fpN2EWm-.js} +14 -57
- package/jsx-runtime.cjs +1 -1
- package/jsx-runtime.mjs +1 -1
- package/{types/jsx.d.ts → jsx.d.ts} +1 -0
- package/package.json +8 -2
- package/{types/styleObjectToString.d.ts → styleObjectToString.d.ts} +1 -1
- package/types.d.ts +35 -0
- /package/{types/dev.d.ts → dev.d.ts} +0 -0
- /package/{types/elysia-plugin.d.ts → elysia-plugin.d.ts} +0 -0
- /package/{types/entityMap.d.ts → entityMap.d.ts} +0 -0
- /package/{types/escape.d.ts → escape.d.ts} +0 -0
- /package/{types/htmlspec → htmlspec}/IntrinsicElements.d.ts +0 -0
- /package/{types/index.d.ts → index.d.ts} +0 -0
- /package/{types/jsx-dev-runtime.d.ts → jsx-dev-runtime.d.ts} +0 -0
- /package/{types/jsx-elements.d.ts → jsx-elements.d.ts} +0 -0
- /package/{types/jsx-node.d.ts → jsx-node.d.ts} +0 -0
- /package/{types/jsx-runtime.d.ts → jsx-runtime.d.ts} +0 -0
- /package/{types/render.d.ts → render.d.ts} +0 -0
- /package/{types/util.d.ts → util.d.ts} +0 -0
|
@@ -15,7 +15,7 @@ export declare function DocType(props: DocTypeProps): JsxDocType;
|
|
|
15
15
|
/**
|
|
16
16
|
* `<!DOCTYPE html><html ...>{children}</html>`
|
|
17
17
|
*/
|
|
18
|
-
export declare function HtmlDocument({ children, ...htmlAttrs }: CommonProps):
|
|
18
|
+
export declare function HtmlDocument({ children, ...htmlAttrs }: CommonProps): import("./jsx-node").JsxNode;
|
|
19
19
|
/**
|
|
20
20
|
* No output.
|
|
21
21
|
*/
|
package/index.cjs
CHANGED
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
var jsxRuntime = require("./jsx-runtime-
|
|
7
|
+
var jsxRuntime = require("./jsx-runtime-fpN2EWm-.js");
|
|
8
8
|
|
|
9
9
|
function RawHtml({children}) {
|
|
10
10
|
return new jsxRuntime.JsxRawHtml(jsxRuntime.flattenString(children));
|
package/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { J as JsxRawHtml, f as flattenString, a as JsxComment, b as JsxDocType, j as jsxs, c as jsx, F as Fragment, E as EMPTY, i as isJsxNode } from "./jsx-runtime-
|
|
1
|
+
import { J as JsxRawHtml, f as flattenString, a as JsxComment, b as JsxDocType, j as jsxs, c as jsx, F as Fragment, E as EMPTY, i as isJsxNode } from "./jsx-runtime-_xtqfR_9.js";
|
|
2
2
|
|
|
3
|
-
export { d as JsxElement, e as JsxEmpty, g as JsxFragment } from "./jsx-runtime-
|
|
3
|
+
export { d as JsxElement, e as JsxEmpty, g as JsxFragment } from "./jsx-runtime-_xtqfR_9.js";
|
|
4
4
|
|
|
5
5
|
function RawHtml({children}) {
|
|
6
6
|
return new JsxRawHtml(flattenString(children));
|
package/jsx-dev-runtime.cjs
CHANGED
package/jsx-dev-runtime.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { c as jsx, h as isJsxComponent, a as JsxComment, g as JsxFragment } from "./jsx-runtime-
|
|
1
|
+
import { c as jsx, h as isJsxComponent, a as JsxComment, g as JsxFragment } from "./jsx-runtime-_xtqfR_9.js";
|
|
2
2
|
|
|
3
|
-
export { F as Fragment } from "./jsx-runtime-
|
|
3
|
+
export { F as Fragment } from "./jsx-runtime-_xtqfR_9.js";
|
|
4
4
|
|
|
5
5
|
function jsxDEV(tag, props, key, isStaticChildren, source, self) {
|
|
6
6
|
let node = jsx(...arguments);
|
|
@@ -1415,68 +1415,29 @@ var isPlainObject_1 = isPlainObject;
|
|
|
1415
1415
|
|
|
1416
1416
|
var isString_1 = isString;
|
|
1417
1417
|
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
function hyphenate(string) {
|
|
1421
|
-
return string.replace(_uppercasePattern, "-$1").toLowerCase();
|
|
1422
|
-
}
|
|
1418
|
+
const uppercasePattern = /([A-Z])/g;
|
|
1423
1419
|
|
|
1424
1420
|
const msPattern = /^ms-/;
|
|
1425
1421
|
|
|
1426
|
-
function hyphenateStyleName(
|
|
1427
|
-
return
|
|
1422
|
+
function hyphenateStyleName(name) {
|
|
1423
|
+
return name.replace(uppercasePattern, "-$1").toLowerCase().replace(msPattern, "-ms-");
|
|
1428
1424
|
}
|
|
1429
1425
|
|
|
1430
1426
|
function memoizeStringOnly(callback) {
|
|
1431
|
-
|
|
1427
|
+
const cache = new Map;
|
|
1432
1428
|
return function(string) {
|
|
1433
|
-
|
|
1434
|
-
|
|
1429
|
+
let value = cache.get(string);
|
|
1430
|
+
if (value === undefined) {
|
|
1431
|
+
value = callback.call(this, string);
|
|
1432
|
+
cache.set(string, value);
|
|
1435
1433
|
}
|
|
1436
|
-
return
|
|
1434
|
+
return value;
|
|
1437
1435
|
};
|
|
1438
1436
|
}
|
|
1439
1437
|
|
|
1440
|
-
const makeStyleName = memoizeStringOnly(
|
|
1441
|
-
return hyphenateStyleName(styleName);
|
|
1442
|
-
}));
|
|
1438
|
+
const makeStyleName = memoizeStringOnly(hyphenateStyleName);
|
|
1443
1439
|
|
|
1444
|
-
const
|
|
1445
|
-
animationIterationCount: true,
|
|
1446
|
-
borderImageOutset: true,
|
|
1447
|
-
borderImageSlice: true,
|
|
1448
|
-
borderImageWidth: true,
|
|
1449
|
-
boxFlex: true,
|
|
1450
|
-
boxFlexGroup: true,
|
|
1451
|
-
boxOrdinalGroup: true,
|
|
1452
|
-
columnCount: true,
|
|
1453
|
-
flex: true,
|
|
1454
|
-
flexGrow: true,
|
|
1455
|
-
flexPositive: true,
|
|
1456
|
-
flexShrink: true,
|
|
1457
|
-
flexNegative: true,
|
|
1458
|
-
flexOrder: true,
|
|
1459
|
-
gridRow: true,
|
|
1460
|
-
gridColumn: true,
|
|
1461
|
-
fontWeight: true,
|
|
1462
|
-
lineClamp: true,
|
|
1463
|
-
lineHeight: true,
|
|
1464
|
-
opacity: true,
|
|
1465
|
-
order: true,
|
|
1466
|
-
orphans: true,
|
|
1467
|
-
tabSize: true,
|
|
1468
|
-
widows: true,
|
|
1469
|
-
zIndex: true,
|
|
1470
|
-
zoom: true,
|
|
1471
|
-
fillOpacity: true,
|
|
1472
|
-
floodOpacity: true,
|
|
1473
|
-
stopOpacity: true,
|
|
1474
|
-
strokeDasharray: true,
|
|
1475
|
-
strokeDashoffset: true,
|
|
1476
|
-
strokeMiterlimit: true,
|
|
1477
|
-
strokeOpacity: true,
|
|
1478
|
-
strokeWidth: true
|
|
1479
|
-
};
|
|
1440
|
+
const unitlessNumbers = new Set([ "animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexPositive", "flexShrink", "flexNegative", "flexOrder", "gridArea", "gridRow", "gridRowEnd", "gridRowSpan", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnSpan", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "fillOpacity", "floodOpacity", "stopOpacity", "strokeDasharray", "strokeDashoffset", "strokeMiterlimit", "strokeOpacity", "strokeWidth", "MozAnimationIterationCount", "MozBoxFlex", "MozBoxFlexGroup", "MozLineClamp", "msAnimationIterationCount", "msFlex", "msZoom", "msFlexGrow", "msFlexNegative", "msFlexOrder", "msFlexPositive", "msFlexShrink", "msGridColumn", "msGridColumnSpan", "msGridRow", "msGridRowSpan", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebKitBoxFlexGroup", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexPositive", "WebkitFlexShrink", "WebkitLineClamp" ]);
|
|
1480
1441
|
|
|
1481
1442
|
function makeStyleValue(name, value) {
|
|
1482
1443
|
let isEmpty = value == null || typeof value === "boolean" || value === "";
|
|
@@ -1484,7 +1445,7 @@ function makeStyleValue(name, value) {
|
|
|
1484
1445
|
return "";
|
|
1485
1446
|
}
|
|
1486
1447
|
let isNonNumeric = isNaN(value);
|
|
1487
|
-
if (isNonNumeric || value === 0 ||
|
|
1448
|
+
if (isNonNumeric || value === 0 || unitlessNumbers.has(name)) {
|
|
1488
1449
|
return "" + value;
|
|
1489
1450
|
}
|
|
1490
1451
|
if (typeof value === "string") {
|
|
@@ -1495,11 +1456,7 @@ function makeStyleValue(name, value) {
|
|
|
1495
1456
|
|
|
1496
1457
|
function styleObjectToString(styles) {
|
|
1497
1458
|
let serialized = "";
|
|
1498
|
-
for (
|
|
1499
|
-
if (!Object.hasOwn(styles, styleName)) {
|
|
1500
|
-
continue;
|
|
1501
|
-
}
|
|
1502
|
-
let styleValue = styles[styleName];
|
|
1459
|
+
for (const [styleName, styleValue] of Object.entries(styles)) {
|
|
1503
1460
|
if (styleValue != null) {
|
|
1504
1461
|
serialized += makeStyleName(styleName) + ":";
|
|
1505
1462
|
serialized += makeStyleValue(styleName, styleValue) + ";";
|
|
@@ -1417,68 +1417,29 @@ var isPlainObject_1 = isPlainObject;
|
|
|
1417
1417
|
|
|
1418
1418
|
var isString_1 = isString;
|
|
1419
1419
|
|
|
1420
|
-
const
|
|
1421
|
-
|
|
1422
|
-
function hyphenate(string) {
|
|
1423
|
-
return string.replace(_uppercasePattern, "-$1").toLowerCase();
|
|
1424
|
-
}
|
|
1420
|
+
const uppercasePattern = /([A-Z])/g;
|
|
1425
1421
|
|
|
1426
1422
|
const msPattern = /^ms-/;
|
|
1427
1423
|
|
|
1428
|
-
function hyphenateStyleName(
|
|
1429
|
-
return
|
|
1424
|
+
function hyphenateStyleName(name) {
|
|
1425
|
+
return name.replace(uppercasePattern, "-$1").toLowerCase().replace(msPattern, "-ms-");
|
|
1430
1426
|
}
|
|
1431
1427
|
|
|
1432
1428
|
function memoizeStringOnly(callback) {
|
|
1433
|
-
|
|
1429
|
+
const cache = new Map;
|
|
1434
1430
|
return function(string) {
|
|
1435
|
-
|
|
1436
|
-
|
|
1431
|
+
let value = cache.get(string);
|
|
1432
|
+
if (value === undefined) {
|
|
1433
|
+
value = callback.call(this, string);
|
|
1434
|
+
cache.set(string, value);
|
|
1437
1435
|
}
|
|
1438
|
-
return
|
|
1436
|
+
return value;
|
|
1439
1437
|
};
|
|
1440
1438
|
}
|
|
1441
1439
|
|
|
1442
|
-
const makeStyleName = memoizeStringOnly(
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
const isUnitlessNumber = {
|
|
1447
|
-
animationIterationCount: true,
|
|
1448
|
-
borderImageOutset: true,
|
|
1449
|
-
borderImageSlice: true,
|
|
1450
|
-
borderImageWidth: true,
|
|
1451
|
-
boxFlex: true,
|
|
1452
|
-
boxFlexGroup: true,
|
|
1453
|
-
boxOrdinalGroup: true,
|
|
1454
|
-
columnCount: true,
|
|
1455
|
-
flex: true,
|
|
1456
|
-
flexGrow: true,
|
|
1457
|
-
flexPositive: true,
|
|
1458
|
-
flexShrink: true,
|
|
1459
|
-
flexNegative: true,
|
|
1460
|
-
flexOrder: true,
|
|
1461
|
-
gridRow: true,
|
|
1462
|
-
gridColumn: true,
|
|
1463
|
-
fontWeight: true,
|
|
1464
|
-
lineClamp: true,
|
|
1465
|
-
lineHeight: true,
|
|
1466
|
-
opacity: true,
|
|
1467
|
-
order: true,
|
|
1468
|
-
orphans: true,
|
|
1469
|
-
tabSize: true,
|
|
1470
|
-
widows: true,
|
|
1471
|
-
zIndex: true,
|
|
1472
|
-
zoom: true,
|
|
1473
|
-
fillOpacity: true,
|
|
1474
|
-
floodOpacity: true,
|
|
1475
|
-
stopOpacity: true,
|
|
1476
|
-
strokeDasharray: true,
|
|
1477
|
-
strokeDashoffset: true,
|
|
1478
|
-
strokeMiterlimit: true,
|
|
1479
|
-
strokeOpacity: true,
|
|
1480
|
-
strokeWidth: true
|
|
1481
|
-
};
|
|
1440
|
+
const makeStyleName = memoizeStringOnly(hyphenateStyleName);
|
|
1441
|
+
|
|
1442
|
+
const unitlessNumbers = new Set([ "animationIterationCount", "aspectRatio", "borderImageOutset", "borderImageSlice", "borderImageWidth", "boxFlex", "boxFlexGroup", "boxOrdinalGroup", "columnCount", "columns", "flex", "flexGrow", "flexPositive", "flexShrink", "flexNegative", "flexOrder", "gridArea", "gridRow", "gridRowEnd", "gridRowSpan", "gridRowStart", "gridColumn", "gridColumnEnd", "gridColumnSpan", "gridColumnStart", "fontWeight", "lineClamp", "lineHeight", "opacity", "order", "orphans", "scale", "tabSize", "widows", "zIndex", "zoom", "fillOpacity", "floodOpacity", "stopOpacity", "strokeDasharray", "strokeDashoffset", "strokeMiterlimit", "strokeOpacity", "strokeWidth", "MozAnimationIterationCount", "MozBoxFlex", "MozBoxFlexGroup", "MozLineClamp", "msAnimationIterationCount", "msFlex", "msZoom", "msFlexGrow", "msFlexNegative", "msFlexOrder", "msFlexPositive", "msFlexShrink", "msGridColumn", "msGridColumnSpan", "msGridRow", "msGridRowSpan", "WebkitAnimationIterationCount", "WebkitBoxFlex", "WebKitBoxFlexGroup", "WebkitBoxOrdinalGroup", "WebkitColumnCount", "WebkitColumns", "WebkitFlex", "WebkitFlexGrow", "WebkitFlexPositive", "WebkitFlexShrink", "WebkitLineClamp" ]);
|
|
1482
1443
|
|
|
1483
1444
|
function makeStyleValue(name, value) {
|
|
1484
1445
|
let isEmpty = value == null || typeof value === "boolean" || value === "";
|
|
@@ -1486,7 +1447,7 @@ function makeStyleValue(name, value) {
|
|
|
1486
1447
|
return "";
|
|
1487
1448
|
}
|
|
1488
1449
|
let isNonNumeric = isNaN(value);
|
|
1489
|
-
if (isNonNumeric || value === 0 ||
|
|
1450
|
+
if (isNonNumeric || value === 0 || unitlessNumbers.has(name)) {
|
|
1490
1451
|
return "" + value;
|
|
1491
1452
|
}
|
|
1492
1453
|
if (typeof value === "string") {
|
|
@@ -1497,11 +1458,7 @@ function makeStyleValue(name, value) {
|
|
|
1497
1458
|
|
|
1498
1459
|
function styleObjectToString(styles) {
|
|
1499
1460
|
let serialized = "";
|
|
1500
|
-
for (
|
|
1501
|
-
if (!Object.hasOwn(styles, styleName)) {
|
|
1502
|
-
continue;
|
|
1503
|
-
}
|
|
1504
|
-
let styleValue = styles[styleName];
|
|
1461
|
+
for (const [styleName, styleValue] of Object.entries(styles)) {
|
|
1505
1462
|
if (styleValue != null) {
|
|
1506
1463
|
serialized += makeStyleName(styleName) + ":";
|
|
1507
1464
|
serialized += makeStyleValue(styleName, styleValue) + ";";
|
package/jsx-runtime.cjs
CHANGED
package/jsx-runtime.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { F as Fragment, c as jsx, j as jsxs } from "./jsx-runtime-
|
|
1
|
+
export { F as Fragment, c as jsx, j as jsxs } from "./jsx-runtime-_xtqfR_9.js";
|
package/package.json
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpen/jsxhtml",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"packageManager": "bun@1.0.7",
|
|
5
5
|
"exports": "./index.cjs",
|
|
6
6
|
"module": "./index.mjs",
|
|
7
|
-
"types": "./
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"sideEffects": false,
|
|
9
|
+
"author": {
|
|
10
|
+
"name": "Mark Penner",
|
|
11
|
+
"email": "npm@mpen.ca",
|
|
12
|
+
"url": "https://github.com/mnpenner"
|
|
13
|
+
},
|
|
8
14
|
"keywords": [
|
|
9
15
|
"jsx",
|
|
10
16
|
"html",
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { StyleObject } from './types';
|
|
1
2
|
/**
|
|
2
3
|
* Serializes a mapping of style properties for use as inline styles:
|
|
3
4
|
*
|
|
@@ -11,4 +12,3 @@
|
|
|
11
12
|
* @return {?string}
|
|
12
13
|
*/
|
|
13
14
|
export default function styleObjectToString(styles: StyleObject): string;
|
|
14
|
-
export type StyleObject = Record<string, any>;
|
package/types.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { JsxNode } from './jsx-node';
|
|
2
|
+
export interface Stringable {
|
|
3
|
+
toString(): string;
|
|
4
|
+
}
|
|
5
|
+
export type PlainObject = Record<PropertyKey, unknown>;
|
|
6
|
+
export type ClassNames = import('classnames').Argument;
|
|
7
|
+
export type StyleObject = import('csstype').Properties | import('csstype').PropertiesHyphen;
|
|
8
|
+
export type AttributeValue = Stringable | StyleObject | ClassNames;
|
|
9
|
+
export type AttrKvPair = [name: string, value: AttributeValue];
|
|
10
|
+
export type AttrArr = AttrKvPair[];
|
|
11
|
+
export type AttrObj = Record<string, AttributeValue>;
|
|
12
|
+
export type Attributes = AttrObj | AttrArr;
|
|
13
|
+
export type UnkFn = (...args: unknown[]) => unknown;
|
|
14
|
+
export type AnyFn = (...args: any[]) => any;
|
|
15
|
+
export type HtmlSafe = {
|
|
16
|
+
__html: string;
|
|
17
|
+
};
|
|
18
|
+
export type JsxRenderable = any;
|
|
19
|
+
export type JsxChildren = JsxRenderable | Iterable<JsxRenderable>;
|
|
20
|
+
export type CommonProps = Omit<AttrObj, 'children' | 'style' | 'class'> & {
|
|
21
|
+
children?: JsxChildren;
|
|
22
|
+
style?: StyleObject | string;
|
|
23
|
+
class?: ClassNames;
|
|
24
|
+
};
|
|
25
|
+
export type JsxComponent<P = CommonProps> = ((props: P) => JsxNode) & {
|
|
26
|
+
displayName?: string;
|
|
27
|
+
name?: string;
|
|
28
|
+
};
|
|
29
|
+
export type FlatString = string | Iterable<string>;
|
|
30
|
+
export interface StringChildren {
|
|
31
|
+
children: FlatString;
|
|
32
|
+
}
|
|
33
|
+
export interface ChildrenOnly {
|
|
34
|
+
children: JsxChildren;
|
|
35
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|