praxis-kit 1.1.1 → 2.0.1
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/{chunk-KDUNVQK2.js → chunk-ACAKUHH5.js} +531 -386
- package/dist/contract/index.d.ts +255 -0
- package/dist/contract/index.js +1370 -0
- package/dist/lit/index.d.ts +2 -1
- package/dist/lit/index.js +257 -184
- package/dist/{merge-refs-CfBqh1UO.d.ts → merge-refs-DxjWMq3U.d.ts} +2 -5
- package/dist/preact/index.d.ts +2 -5
- package/dist/preact/index.js +236 -187
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +1 -5
- package/dist/react/legacy.d.ts +2 -2
- package/dist/react/legacy.js +1 -5
- package/dist/solid/index.d.ts +2 -5
- package/dist/solid/index.js +238 -189
- package/dist/svelte/index.d.ts +3 -5
- package/dist/svelte/index.js +233 -186
- package/dist/vue/index.d.ts +2 -5
- package/dist/vue/index.js +236 -187
- package/dist/web/index.d.ts +2 -1
- package/dist/web/index.js +259 -185
- package/package.json +7 -3
package/dist/vue/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function applyFilter(props, filterProps, variantKeys) {
|
|
|
20
20
|
return out;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
// ../core/dist/chunk-
|
|
23
|
+
// ../core/dist/chunk-XFCAUPVZ.js
|
|
24
24
|
function makeResolveTag(defaultTag) {
|
|
25
25
|
return function tag(as) {
|
|
26
26
|
return as ?? defaultTag;
|
|
@@ -255,7 +255,11 @@ function createRuntimeObject(methods, resolved, pluginResult) {
|
|
|
255
255
|
return pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
256
256
|
}
|
|
257
257
|
function createPolymorphic(options = {}, capabilities) {
|
|
258
|
-
const
|
|
258
|
+
const baseResolved = resolveFactoryOptions(options);
|
|
259
|
+
const resolved = capabilities?.htmlPropNormalizersFn !== void 0 ? Object.freeze({
|
|
260
|
+
...baseResolved,
|
|
261
|
+
htmlPropNormalizersFn: capabilities.htmlPropNormalizersFn
|
|
262
|
+
}) : baseResolved;
|
|
259
263
|
if (process.env.NODE_ENV !== "production") validateFactoryOptions(resolved);
|
|
260
264
|
const { pluginResult, classPipeline } = resolveClassPipeline(
|
|
261
265
|
options,
|
|
@@ -263,9 +267,12 @@ function createPolymorphic(options = {}, capabilities) {
|
|
|
263
267
|
resolved.strict,
|
|
264
268
|
capabilities
|
|
265
269
|
);
|
|
270
|
+
const allAriaRules = [
|
|
271
|
+
.../* @__PURE__ */ new Set([...capabilities?.htmlAriaRules ?? [], ...resolved.ariaRules ?? []])
|
|
272
|
+
];
|
|
266
273
|
const engine = options.enforcement !== void 0 && capabilities?.AriaEngine ? new capabilities.AriaEngine(
|
|
267
274
|
resolved.strict,
|
|
268
|
-
|
|
275
|
+
allAriaRules.length ? { rules: allAriaRules } : void 0
|
|
269
276
|
) : null;
|
|
270
277
|
const methods = createRuntimeMethods(resolved, classPipeline, engine);
|
|
271
278
|
return createRuntimeObject(
|
|
@@ -584,184 +591,7 @@ function isKnownAriaRole(value) {
|
|
|
584
591
|
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
585
592
|
}
|
|
586
593
|
|
|
587
|
-
// ../core/dist/chunk-
|
|
588
|
-
var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
589
|
-
function resolveChildTag(child) {
|
|
590
|
-
if (!isObject(child) || !("type" in child)) return void 0;
|
|
591
|
-
const t = child.type;
|
|
592
|
-
if (isString(t)) return t;
|
|
593
|
-
if (isObject(t) && COMPONENT_DEFAULT_TAG2 in t) {
|
|
594
|
-
const defaultTag = t[COMPONENT_DEFAULT_TAG2];
|
|
595
|
-
if (!isString(defaultTag)) return void 0;
|
|
596
|
-
const props = child.props;
|
|
597
|
-
const as = isObject(props) && "as" in props ? props.as : void 0;
|
|
598
|
-
return isString(as) ? as : defaultTag;
|
|
599
|
-
}
|
|
600
|
-
return void 0;
|
|
601
|
-
}
|
|
602
|
-
function isTag(...tags) {
|
|
603
|
-
const set = new Set(tags);
|
|
604
|
-
return (child) => {
|
|
605
|
-
const tag = resolveChildTag(child);
|
|
606
|
-
return tag !== void 0 && set.has(tag);
|
|
607
|
-
};
|
|
608
|
-
}
|
|
609
|
-
function isOpenContent(...blockedTags) {
|
|
610
|
-
const set = new Set(blockedTags);
|
|
611
|
-
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
612
|
-
}
|
|
613
|
-
var METADATA_TAGS = ["script", "template"];
|
|
614
|
-
var metadataMatch = isTag(...METADATA_TAGS);
|
|
615
|
-
function metadata(name = "metadata") {
|
|
616
|
-
return { name, match: metadataMatch };
|
|
617
|
-
}
|
|
618
|
-
function firstOptional(name, tag) {
|
|
619
|
-
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
620
|
-
}
|
|
621
|
-
function contract(children) {
|
|
622
|
-
return { strict: "warn", children };
|
|
623
|
-
}
|
|
624
|
-
function ariaContract(aria) {
|
|
625
|
-
return { strict: "warn", aria };
|
|
626
|
-
}
|
|
627
|
-
function firstChildContract(name, tag) {
|
|
628
|
-
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
629
|
-
}
|
|
630
|
-
var VOID_TAGS = [
|
|
631
|
-
"area",
|
|
632
|
-
"base",
|
|
633
|
-
"br",
|
|
634
|
-
"col",
|
|
635
|
-
"embed",
|
|
636
|
-
"hr",
|
|
637
|
-
"img",
|
|
638
|
-
"input",
|
|
639
|
-
"link",
|
|
640
|
-
"meta",
|
|
641
|
-
"param",
|
|
642
|
-
"source",
|
|
643
|
-
"track",
|
|
644
|
-
"wbr"
|
|
645
|
-
];
|
|
646
|
-
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
647
|
-
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
648
|
-
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
649
|
-
var tableContract = contract([
|
|
650
|
-
firstOptional("caption", "caption"),
|
|
651
|
-
{ name: "colgroup", match: isTag("colgroup") },
|
|
652
|
-
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
653
|
-
{ name: "tbody", match: isTag("tbody") },
|
|
654
|
-
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
655
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
656
|
-
]);
|
|
657
|
-
var tableBodyContract = contract([
|
|
658
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
659
|
-
]);
|
|
660
|
-
var tableRowContract = contract([
|
|
661
|
-
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
662
|
-
]);
|
|
663
|
-
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
664
|
-
var dlContract = contract([
|
|
665
|
-
{ name: "term", match: isTag("dt") },
|
|
666
|
-
{ name: "description", match: isTag("dd") },
|
|
667
|
-
{ name: "group", match: isTag("div") },
|
|
668
|
-
metadata()
|
|
669
|
-
]);
|
|
670
|
-
var selectContract = contract([
|
|
671
|
-
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
672
|
-
]);
|
|
673
|
-
var optgroupContract = contract([
|
|
674
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
675
|
-
]);
|
|
676
|
-
var datalistContract = contract([
|
|
677
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
678
|
-
]);
|
|
679
|
-
var pictureContract = contract([
|
|
680
|
-
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
681
|
-
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
682
|
-
]);
|
|
683
|
-
var figureContract = contract([
|
|
684
|
-
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
685
|
-
{ name: "content", match: isOpenContent("figcaption") }
|
|
686
|
-
]);
|
|
687
|
-
var detailsContract = firstChildContract("summary", "summary");
|
|
688
|
-
var fieldsetContract = firstChildContract("legend", "legend");
|
|
689
|
-
var mediaContract = contract([
|
|
690
|
-
{ name: "source", match: isTag("source") },
|
|
691
|
-
{ name: "track", match: isTag("track") },
|
|
692
|
-
metadata(),
|
|
693
|
-
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
694
|
-
]);
|
|
695
|
-
var headContract = contract([
|
|
696
|
-
{
|
|
697
|
-
name: "metadata",
|
|
698
|
-
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
699
|
-
}
|
|
700
|
-
]);
|
|
701
|
-
var htmlContract = contract([
|
|
702
|
-
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
703
|
-
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
704
|
-
]);
|
|
705
|
-
var voidContract = contract([]);
|
|
706
|
-
var textOnlyContract = contract([
|
|
707
|
-
{
|
|
708
|
-
name: "text",
|
|
709
|
-
match: (child) => isString(child) || isNumber(child)
|
|
710
|
-
}
|
|
711
|
-
]);
|
|
712
|
-
var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
|
|
713
|
-
var removeLandmarkRoleOverride = {
|
|
714
|
-
kind: "removeRole",
|
|
715
|
-
apply: ({ props }) => {
|
|
716
|
-
if (!("role" in props)) return { applied: false, next: props };
|
|
717
|
-
const { role: _r, ...rest } = props;
|
|
718
|
-
return { applied: true, next: rest, previous: props };
|
|
719
|
-
}
|
|
720
|
-
};
|
|
721
|
-
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
722
|
-
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
723
|
-
const role = props.role;
|
|
724
|
-
if (!role || role === implicitRole) return [];
|
|
725
|
-
return [
|
|
726
|
-
{
|
|
727
|
-
valid: false,
|
|
728
|
-
fixable: true,
|
|
729
|
-
severity: "error",
|
|
730
|
-
fix: removeLandmarkRoleOverride,
|
|
731
|
-
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
732
|
-
}
|
|
733
|
-
];
|
|
734
|
-
}
|
|
735
|
-
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
736
|
-
var CONTRACT_GROUPS = [
|
|
737
|
-
[VOID_TAGS, voidContract],
|
|
738
|
-
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
739
|
-
[LANDMARK_TAGS, landmarkContract],
|
|
740
|
-
[["ul", "ol", "menu"], listContract],
|
|
741
|
-
[["audio", "video"], mediaContract],
|
|
742
|
-
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
743
|
-
];
|
|
744
|
-
function contractMap(groups) {
|
|
745
|
-
return Object.fromEntries(
|
|
746
|
-
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
747
|
-
);
|
|
748
|
-
}
|
|
749
|
-
var htmlContracts = {
|
|
750
|
-
...contractMap(CONTRACT_GROUPS),
|
|
751
|
-
table: tableContract,
|
|
752
|
-
tr: tableRowContract,
|
|
753
|
-
colgroup: colgroupContract,
|
|
754
|
-
dl: dlContract,
|
|
755
|
-
select: selectContract,
|
|
756
|
-
optgroup: optgroupContract,
|
|
757
|
-
datalist: datalistContract,
|
|
758
|
-
picture: pictureContract,
|
|
759
|
-
figure: figureContract,
|
|
760
|
-
details: detailsContract,
|
|
761
|
-
fieldset: fieldsetContract,
|
|
762
|
-
head: headContract,
|
|
763
|
-
html: htmlContract
|
|
764
|
-
};
|
|
594
|
+
// ../core/dist/chunk-VU44HAB7.js
|
|
765
595
|
var IMPLICIT_ROLE_RECORD2 = {
|
|
766
596
|
article: "article",
|
|
767
597
|
aside: "complementary",
|
|
@@ -790,6 +620,27 @@ function getImplicitRole(tag) {
|
|
|
790
620
|
if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
|
|
791
621
|
return void 0;
|
|
792
622
|
}
|
|
623
|
+
var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
624
|
+
function resolveChildTag(child) {
|
|
625
|
+
if (!isObject(child) || !("type" in child)) return void 0;
|
|
626
|
+
const t = child.type;
|
|
627
|
+
if (isString(t)) return t;
|
|
628
|
+
if (isObject(t) && COMPONENT_DEFAULT_TAG2 in t) {
|
|
629
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG2];
|
|
630
|
+
if (!isString(defaultTag)) return void 0;
|
|
631
|
+
const props = child.props;
|
|
632
|
+
const as = isObject(props) && "as" in props ? props.as : void 0;
|
|
633
|
+
return isString(as) ? as : defaultTag;
|
|
634
|
+
}
|
|
635
|
+
return void 0;
|
|
636
|
+
}
|
|
637
|
+
function isTag(...tags) {
|
|
638
|
+
const set = new Set(tags);
|
|
639
|
+
return (child) => {
|
|
640
|
+
const tag = resolveChildTag(child);
|
|
641
|
+
return tag !== void 0 && set.has(tag);
|
|
642
|
+
};
|
|
643
|
+
}
|
|
793
644
|
var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
|
|
794
645
|
var asyncWarnScheduled2 = false;
|
|
795
646
|
function flushAsyncWarns2() {
|
|
@@ -1481,8 +1332,201 @@ var invalidProps = ({
|
|
|
1481
1332
|
...dataInvalid === void 0 && { "data-invalid": "" }
|
|
1482
1333
|
};
|
|
1483
1334
|
};
|
|
1335
|
+
var readonlyProps = ({
|
|
1336
|
+
readOnly,
|
|
1337
|
+
"aria-readonly": ariaReadonly,
|
|
1338
|
+
"data-readonly": dataReadonly
|
|
1339
|
+
}) => {
|
|
1340
|
+
if (!readOnly) return {};
|
|
1341
|
+
return {
|
|
1342
|
+
...ariaReadonly === void 0 && {
|
|
1343
|
+
"aria-readonly": "true"
|
|
1344
|
+
},
|
|
1345
|
+
...dataReadonly === void 0 && {
|
|
1346
|
+
"data-readonly": ""
|
|
1347
|
+
}
|
|
1348
|
+
};
|
|
1349
|
+
};
|
|
1350
|
+
var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
|
|
1351
|
+
var removeLandmarkRoleOverride = {
|
|
1352
|
+
kind: "removeRole",
|
|
1353
|
+
apply: ({ props }) => {
|
|
1354
|
+
if (!("role" in props)) return { applied: false, next: props };
|
|
1355
|
+
const { role: _r, ...rest } = props;
|
|
1356
|
+
return { applied: true, next: rest, previous: props };
|
|
1357
|
+
}
|
|
1358
|
+
};
|
|
1359
|
+
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
1360
|
+
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
1361
|
+
const role = props.role;
|
|
1362
|
+
if (!role || role === implicitRole) return [];
|
|
1363
|
+
return [
|
|
1364
|
+
{
|
|
1365
|
+
valid: false,
|
|
1366
|
+
fixable: true,
|
|
1367
|
+
severity: "error",
|
|
1368
|
+
fix: removeLandmarkRoleOverride,
|
|
1369
|
+
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
1370
|
+
}
|
|
1371
|
+
];
|
|
1372
|
+
}
|
|
1373
|
+
var HTML_ARIA_RULES = [landmarkRoleRule];
|
|
1374
|
+
function isOpenContent(...blockedTags) {
|
|
1375
|
+
const set = new Set(blockedTags);
|
|
1376
|
+
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
1377
|
+
}
|
|
1378
|
+
var METADATA_TAGS = ["script", "template"];
|
|
1379
|
+
var metadataMatch = isTag(...METADATA_TAGS);
|
|
1380
|
+
function metadata(name = "metadata") {
|
|
1381
|
+
return { name, match: metadataMatch };
|
|
1382
|
+
}
|
|
1383
|
+
function firstOptional(name, tag) {
|
|
1384
|
+
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
1385
|
+
}
|
|
1386
|
+
function contract(children) {
|
|
1387
|
+
return { strict: "warn", children };
|
|
1388
|
+
}
|
|
1389
|
+
function ariaContract(aria) {
|
|
1390
|
+
return { strict: "warn", aria };
|
|
1391
|
+
}
|
|
1392
|
+
function firstChildContract(name, tag) {
|
|
1393
|
+
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
1394
|
+
}
|
|
1395
|
+
var VOID_TAGS = [
|
|
1396
|
+
"area",
|
|
1397
|
+
"base",
|
|
1398
|
+
"br",
|
|
1399
|
+
"col",
|
|
1400
|
+
"embed",
|
|
1401
|
+
"hr",
|
|
1402
|
+
"img",
|
|
1403
|
+
"input",
|
|
1404
|
+
"link",
|
|
1405
|
+
"meta",
|
|
1406
|
+
"param",
|
|
1407
|
+
"source",
|
|
1408
|
+
"track",
|
|
1409
|
+
"wbr"
|
|
1410
|
+
];
|
|
1411
|
+
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
1412
|
+
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
1413
|
+
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
1414
|
+
var tableContract = contract([
|
|
1415
|
+
firstOptional("caption", "caption"),
|
|
1416
|
+
{ name: "colgroup", match: isTag("colgroup") },
|
|
1417
|
+
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
1418
|
+
{ name: "tbody", match: isTag("tbody") },
|
|
1419
|
+
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
1420
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1421
|
+
]);
|
|
1422
|
+
var tableBodyContract = contract([
|
|
1423
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1424
|
+
]);
|
|
1425
|
+
var tableRowContract = contract([
|
|
1426
|
+
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
1427
|
+
]);
|
|
1428
|
+
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
1429
|
+
var dlContract = contract([
|
|
1430
|
+
{ name: "term", match: isTag("dt") },
|
|
1431
|
+
{ name: "description", match: isTag("dd") },
|
|
1432
|
+
{ name: "group", match: isTag("div") },
|
|
1433
|
+
metadata()
|
|
1434
|
+
]);
|
|
1435
|
+
var selectContract = contract([
|
|
1436
|
+
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
1437
|
+
]);
|
|
1438
|
+
var optgroupContract = contract([
|
|
1439
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1440
|
+
]);
|
|
1441
|
+
var datalistContract = contract([
|
|
1442
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1443
|
+
]);
|
|
1444
|
+
var pictureContract = contract([
|
|
1445
|
+
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
1446
|
+
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
1447
|
+
]);
|
|
1448
|
+
var figureContract = contract([
|
|
1449
|
+
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
1450
|
+
{ name: "content", match: isOpenContent("figcaption") }
|
|
1451
|
+
]);
|
|
1452
|
+
var detailsContract = firstChildContract("summary", "summary");
|
|
1453
|
+
var fieldsetContract = firstChildContract("legend", "legend");
|
|
1454
|
+
var mediaContract = contract([
|
|
1455
|
+
{ name: "source", match: isTag("source") },
|
|
1456
|
+
{ name: "track", match: isTag("track") },
|
|
1457
|
+
metadata(),
|
|
1458
|
+
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
1459
|
+
]);
|
|
1460
|
+
var headContract = contract([
|
|
1461
|
+
{
|
|
1462
|
+
name: "metadata",
|
|
1463
|
+
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
1464
|
+
}
|
|
1465
|
+
]);
|
|
1466
|
+
var htmlContract = contract([
|
|
1467
|
+
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
1468
|
+
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
1469
|
+
]);
|
|
1470
|
+
var voidContract = contract([]);
|
|
1471
|
+
var textOnlyContract = contract([
|
|
1472
|
+
{
|
|
1473
|
+
name: "text",
|
|
1474
|
+
match: (child) => isString(child) || isNumber(child)
|
|
1475
|
+
}
|
|
1476
|
+
]);
|
|
1477
|
+
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
1478
|
+
var CONTRACT_GROUPS = [
|
|
1479
|
+
[VOID_TAGS, voidContract],
|
|
1480
|
+
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
1481
|
+
[LANDMARK_TAGS, landmarkContract],
|
|
1482
|
+
[["ul", "ol", "menu"], listContract],
|
|
1483
|
+
[["audio", "video"], mediaContract],
|
|
1484
|
+
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
1485
|
+
];
|
|
1486
|
+
function contractMap(groups) {
|
|
1487
|
+
return Object.fromEntries(
|
|
1488
|
+
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
1489
|
+
);
|
|
1490
|
+
}
|
|
1491
|
+
var htmlContracts = {
|
|
1492
|
+
...contractMap(CONTRACT_GROUPS),
|
|
1493
|
+
table: tableContract,
|
|
1494
|
+
tr: tableRowContract,
|
|
1495
|
+
colgroup: colgroupContract,
|
|
1496
|
+
dl: dlContract,
|
|
1497
|
+
select: selectContract,
|
|
1498
|
+
optgroup: optgroupContract,
|
|
1499
|
+
datalist: datalistContract,
|
|
1500
|
+
picture: pictureContract,
|
|
1501
|
+
figure: figureContract,
|
|
1502
|
+
details: detailsContract,
|
|
1503
|
+
fieldset: fieldsetContract,
|
|
1504
|
+
head: headContract,
|
|
1505
|
+
html: htmlContract
|
|
1506
|
+
};
|
|
1507
|
+
function buildEvaluatorMap() {
|
|
1508
|
+
const map = /* @__PURE__ */ new Map();
|
|
1509
|
+
for (const [tag, { children }] of Object.entries(htmlContracts)) {
|
|
1510
|
+
if (children?.length) {
|
|
1511
|
+
map.set(tag, new ChildrenEvaluator(children, "warn", `<${tag}>`));
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
return map;
|
|
1515
|
+
}
|
|
1516
|
+
var HTML_EVALUATORS = buildEvaluatorMap();
|
|
1517
|
+
var HTML_FORM_NORMALIZERS = /* @__PURE__ */ new Map([
|
|
1518
|
+
["button", [disabledProps]],
|
|
1519
|
+
["input", [disabledProps, readonlyProps, invalidProps]],
|
|
1520
|
+
["select", [disabledProps]],
|
|
1521
|
+
["textarea", [disabledProps, readonlyProps]],
|
|
1522
|
+
["fieldset", [disabledProps]],
|
|
1523
|
+
["optgroup", [disabledProps]]
|
|
1524
|
+
]);
|
|
1525
|
+
function getHtmlPropNormalizers(tag) {
|
|
1526
|
+
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
1527
|
+
}
|
|
1484
1528
|
|
|
1485
|
-
// ../core/dist/chunk-
|
|
1529
|
+
// ../core/dist/chunk-EHCOMLJ4.js
|
|
1486
1530
|
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
1487
1531
|
var cx = clsx;
|
|
1488
1532
|
var cva = (base, config) => (props) => {
|
|
@@ -1648,7 +1692,12 @@ function createClassPipeline(resolved) {
|
|
|
1648
1692
|
}
|
|
1649
1693
|
|
|
1650
1694
|
// ../core/dist/index.js
|
|
1651
|
-
var FULL_CAPABILITIES = {
|
|
1695
|
+
var FULL_CAPABILITIES = {
|
|
1696
|
+
createClassPipeline,
|
|
1697
|
+
AriaEngine: AriaPolicyEngine,
|
|
1698
|
+
htmlAriaRules: HTML_ARIA_RULES,
|
|
1699
|
+
htmlPropNormalizersFn: getHtmlPropNormalizers
|
|
1700
|
+
};
|
|
1652
1701
|
function createPolymorphic2(options = {}) {
|
|
1653
1702
|
return createPolymorphic(options, FULL_CAPABILITIES);
|
|
1654
1703
|
}
|
|
@@ -1804,7 +1853,9 @@ function resolveRenderState(runtime, attrs, filterProps) {
|
|
|
1804
1853
|
const { as, asChild, class: className, variantKey, ...rest } = attrs;
|
|
1805
1854
|
const tag = runtime.resolveTag(as);
|
|
1806
1855
|
const mergedProps = runtime.resolveProps(rest);
|
|
1807
|
-
const
|
|
1856
|
+
const baseProps = runtime.options.normalizeFn ? runtime.options.normalizeFn(mergedProps) : mergedProps;
|
|
1857
|
+
const htmlNormalizers = runtime.options.htmlPropNormalizersFn?.(tag);
|
|
1858
|
+
const normalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), baseProps) : baseProps;
|
|
1808
1859
|
const resolvedClass = runtime.resolveClasses(
|
|
1809
1860
|
tag,
|
|
1810
1861
|
normalizedProps,
|
|
@@ -1916,7 +1967,5 @@ function defineContractComponent(options) {
|
|
|
1916
1967
|
export {
|
|
1917
1968
|
Slottable,
|
|
1918
1969
|
createContractComponent,
|
|
1919
|
-
defineContractComponent
|
|
1920
|
-
disabledProps,
|
|
1921
|
-
invalidProps
|
|
1970
|
+
defineContractComponent
|
|
1922
1971
|
};
|
package/dist/web/index.d.ts
CHANGED
|
@@ -215,6 +215,7 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
|
|
|
215
215
|
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
216
216
|
normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
|
|
217
217
|
}['normalize'];
|
|
218
|
+
type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, PresetMap<VariantMap>, AnyRecord>;
|
|
218
219
|
type FactoryOptions<TDefault extends ElementType = ElementType, Props extends AnyRecord = EmptyRecord, V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPreset extends PresetMap<V> = Readonly<EmptyRecord>, TPluginProps extends AnyRecord = EmptyRecord, TAllowed extends ElementType = ElementType> = {
|
|
219
220
|
readonly tag?: TDefault;
|
|
220
221
|
readonly name?: string;
|
|
@@ -299,4 +300,4 @@ declare function defineContractComponent<O extends FactoryOptions>(options: O):
|
|
|
299
300
|
*/
|
|
300
301
|
declare function renderToString(component: WebContractComponent, props?: UnknownProps, innerHTML?: string): string;
|
|
301
302
|
|
|
302
|
-
export { type WebContractComponent, type WebFactoryOptions, createContractComponent, defineContractComponent, renderToString };
|
|
303
|
+
export { type AnyFactoryOptions, type WebContractComponent, type WebFactoryOptions, createContractComponent, defineContractComponent, renderToString };
|