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/preact/index.js
CHANGED
|
@@ -49,7 +49,7 @@ function applyFilter(props, filterProps, variantKeys) {
|
|
|
49
49
|
return out;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
// ../core/dist/chunk-
|
|
52
|
+
// ../core/dist/chunk-XFCAUPVZ.js
|
|
53
53
|
function makeResolveTag(defaultTag) {
|
|
54
54
|
return function tag(as) {
|
|
55
55
|
return as ?? defaultTag;
|
|
@@ -284,7 +284,11 @@ function createRuntimeObject(methods, resolved, pluginResult) {
|
|
|
284
284
|
return pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
285
285
|
}
|
|
286
286
|
function createPolymorphic(options = {}, capabilities) {
|
|
287
|
-
const
|
|
287
|
+
const baseResolved = resolveFactoryOptions(options);
|
|
288
|
+
const resolved = capabilities?.htmlPropNormalizersFn !== void 0 ? Object.freeze({
|
|
289
|
+
...baseResolved,
|
|
290
|
+
htmlPropNormalizersFn: capabilities.htmlPropNormalizersFn
|
|
291
|
+
}) : baseResolved;
|
|
288
292
|
if (process.env.NODE_ENV !== "production") validateFactoryOptions(resolved);
|
|
289
293
|
const { pluginResult, classPipeline } = resolveClassPipeline(
|
|
290
294
|
options,
|
|
@@ -292,9 +296,12 @@ function createPolymorphic(options = {}, capabilities) {
|
|
|
292
296
|
resolved.strict,
|
|
293
297
|
capabilities
|
|
294
298
|
);
|
|
299
|
+
const allAriaRules = [
|
|
300
|
+
.../* @__PURE__ */ new Set([...capabilities?.htmlAriaRules ?? [], ...resolved.ariaRules ?? []])
|
|
301
|
+
];
|
|
295
302
|
const engine = options.enforcement !== void 0 && capabilities?.AriaEngine ? new capabilities.AriaEngine(
|
|
296
303
|
resolved.strict,
|
|
297
|
-
|
|
304
|
+
allAriaRules.length ? { rules: allAriaRules } : void 0
|
|
298
305
|
) : null;
|
|
299
306
|
const methods = createRuntimeMethods(resolved, classPipeline, engine);
|
|
300
307
|
return createRuntimeObject(
|
|
@@ -613,184 +620,7 @@ function isKnownAriaRole(value) {
|
|
|
613
620
|
return isString(value) && KNOWN_ARIA_ROLES_SET.has(value);
|
|
614
621
|
}
|
|
615
622
|
|
|
616
|
-
// ../core/dist/chunk-
|
|
617
|
-
var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
618
|
-
function resolveChildTag(child) {
|
|
619
|
-
if (!isObject2(child) || !("type" in child)) return void 0;
|
|
620
|
-
const t = child.type;
|
|
621
|
-
if (isString(t)) return t;
|
|
622
|
-
if (isObject2(t) && COMPONENT_DEFAULT_TAG2 in t) {
|
|
623
|
-
const defaultTag = t[COMPONENT_DEFAULT_TAG2];
|
|
624
|
-
if (!isString(defaultTag)) return void 0;
|
|
625
|
-
const props = child.props;
|
|
626
|
-
const as = isObject2(props) && "as" in props ? props.as : void 0;
|
|
627
|
-
return isString(as) ? as : defaultTag;
|
|
628
|
-
}
|
|
629
|
-
return void 0;
|
|
630
|
-
}
|
|
631
|
-
function isTag(...tags) {
|
|
632
|
-
const set = new Set(tags);
|
|
633
|
-
return (child) => {
|
|
634
|
-
const tag = resolveChildTag(child);
|
|
635
|
-
return tag !== void 0 && set.has(tag);
|
|
636
|
-
};
|
|
637
|
-
}
|
|
638
|
-
function isOpenContent(...blockedTags) {
|
|
639
|
-
const set = new Set(blockedTags);
|
|
640
|
-
return (child) => isObject2(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
641
|
-
}
|
|
642
|
-
var METADATA_TAGS = ["script", "template"];
|
|
643
|
-
var metadataMatch = isTag(...METADATA_TAGS);
|
|
644
|
-
function metadata(name = "metadata") {
|
|
645
|
-
return { name, match: metadataMatch };
|
|
646
|
-
}
|
|
647
|
-
function firstOptional(name, tag) {
|
|
648
|
-
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
649
|
-
}
|
|
650
|
-
function contract(children) {
|
|
651
|
-
return { strict: "warn", children };
|
|
652
|
-
}
|
|
653
|
-
function ariaContract(aria) {
|
|
654
|
-
return { strict: "warn", aria };
|
|
655
|
-
}
|
|
656
|
-
function firstChildContract(name, tag) {
|
|
657
|
-
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
658
|
-
}
|
|
659
|
-
var VOID_TAGS = [
|
|
660
|
-
"area",
|
|
661
|
-
"base",
|
|
662
|
-
"br",
|
|
663
|
-
"col",
|
|
664
|
-
"embed",
|
|
665
|
-
"hr",
|
|
666
|
-
"img",
|
|
667
|
-
"input",
|
|
668
|
-
"link",
|
|
669
|
-
"meta",
|
|
670
|
-
"param",
|
|
671
|
-
"source",
|
|
672
|
-
"track",
|
|
673
|
-
"wbr"
|
|
674
|
-
];
|
|
675
|
-
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
676
|
-
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
677
|
-
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
678
|
-
var tableContract = contract([
|
|
679
|
-
firstOptional("caption", "caption"),
|
|
680
|
-
{ name: "colgroup", match: isTag("colgroup") },
|
|
681
|
-
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
682
|
-
{ name: "tbody", match: isTag("tbody") },
|
|
683
|
-
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
684
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
685
|
-
]);
|
|
686
|
-
var tableBodyContract = contract([
|
|
687
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
688
|
-
]);
|
|
689
|
-
var tableRowContract = contract([
|
|
690
|
-
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
691
|
-
]);
|
|
692
|
-
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
693
|
-
var dlContract = contract([
|
|
694
|
-
{ name: "term", match: isTag("dt") },
|
|
695
|
-
{ name: "description", match: isTag("dd") },
|
|
696
|
-
{ name: "group", match: isTag("div") },
|
|
697
|
-
metadata()
|
|
698
|
-
]);
|
|
699
|
-
var selectContract = contract([
|
|
700
|
-
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
701
|
-
]);
|
|
702
|
-
var optgroupContract = contract([
|
|
703
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
704
|
-
]);
|
|
705
|
-
var datalistContract = contract([
|
|
706
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
707
|
-
]);
|
|
708
|
-
var pictureContract = contract([
|
|
709
|
-
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
710
|
-
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
711
|
-
]);
|
|
712
|
-
var figureContract = contract([
|
|
713
|
-
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
714
|
-
{ name: "content", match: isOpenContent("figcaption") }
|
|
715
|
-
]);
|
|
716
|
-
var detailsContract = firstChildContract("summary", "summary");
|
|
717
|
-
var fieldsetContract = firstChildContract("legend", "legend");
|
|
718
|
-
var mediaContract = contract([
|
|
719
|
-
{ name: "source", match: isTag("source") },
|
|
720
|
-
{ name: "track", match: isTag("track") },
|
|
721
|
-
metadata(),
|
|
722
|
-
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
723
|
-
]);
|
|
724
|
-
var headContract = contract([
|
|
725
|
-
{
|
|
726
|
-
name: "metadata",
|
|
727
|
-
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
728
|
-
}
|
|
729
|
-
]);
|
|
730
|
-
var htmlContract = contract([
|
|
731
|
-
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
732
|
-
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
733
|
-
]);
|
|
734
|
-
var voidContract = contract([]);
|
|
735
|
-
var textOnlyContract = contract([
|
|
736
|
-
{
|
|
737
|
-
name: "text",
|
|
738
|
-
match: (child) => isString(child) || isNumber(child)
|
|
739
|
-
}
|
|
740
|
-
]);
|
|
741
|
-
var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
|
|
742
|
-
var removeLandmarkRoleOverride = {
|
|
743
|
-
kind: "removeRole",
|
|
744
|
-
apply: ({ props }) => {
|
|
745
|
-
if (!("role" in props)) return { applied: false, next: props };
|
|
746
|
-
const { role: _r, ...rest } = props;
|
|
747
|
-
return { applied: true, next: rest, previous: props };
|
|
748
|
-
}
|
|
749
|
-
};
|
|
750
|
-
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
751
|
-
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
752
|
-
const role = props.role;
|
|
753
|
-
if (!role || role === implicitRole) return [];
|
|
754
|
-
return [
|
|
755
|
-
{
|
|
756
|
-
valid: false,
|
|
757
|
-
fixable: true,
|
|
758
|
-
severity: "error",
|
|
759
|
-
fix: removeLandmarkRoleOverride,
|
|
760
|
-
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
761
|
-
}
|
|
762
|
-
];
|
|
763
|
-
}
|
|
764
|
-
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
765
|
-
var CONTRACT_GROUPS = [
|
|
766
|
-
[VOID_TAGS, voidContract],
|
|
767
|
-
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
768
|
-
[LANDMARK_TAGS, landmarkContract],
|
|
769
|
-
[["ul", "ol", "menu"], listContract],
|
|
770
|
-
[["audio", "video"], mediaContract],
|
|
771
|
-
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
772
|
-
];
|
|
773
|
-
function contractMap(groups) {
|
|
774
|
-
return Object.fromEntries(
|
|
775
|
-
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
776
|
-
);
|
|
777
|
-
}
|
|
778
|
-
var htmlContracts = {
|
|
779
|
-
...contractMap(CONTRACT_GROUPS),
|
|
780
|
-
table: tableContract,
|
|
781
|
-
tr: tableRowContract,
|
|
782
|
-
colgroup: colgroupContract,
|
|
783
|
-
dl: dlContract,
|
|
784
|
-
select: selectContract,
|
|
785
|
-
optgroup: optgroupContract,
|
|
786
|
-
datalist: datalistContract,
|
|
787
|
-
picture: pictureContract,
|
|
788
|
-
figure: figureContract,
|
|
789
|
-
details: detailsContract,
|
|
790
|
-
fieldset: fieldsetContract,
|
|
791
|
-
head: headContract,
|
|
792
|
-
html: htmlContract
|
|
793
|
-
};
|
|
623
|
+
// ../core/dist/chunk-VU44HAB7.js
|
|
794
624
|
var IMPLICIT_ROLE_RECORD2 = {
|
|
795
625
|
article: "article",
|
|
796
626
|
aside: "complementary",
|
|
@@ -819,6 +649,27 @@ function getImplicitRole(tag) {
|
|
|
819
649
|
if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
|
|
820
650
|
return void 0;
|
|
821
651
|
}
|
|
652
|
+
var COMPONENT_DEFAULT_TAG2 = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
653
|
+
function resolveChildTag(child) {
|
|
654
|
+
if (!isObject2(child) || !("type" in child)) return void 0;
|
|
655
|
+
const t = child.type;
|
|
656
|
+
if (isString(t)) return t;
|
|
657
|
+
if (isObject2(t) && COMPONENT_DEFAULT_TAG2 in t) {
|
|
658
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG2];
|
|
659
|
+
if (!isString(defaultTag)) return void 0;
|
|
660
|
+
const props = child.props;
|
|
661
|
+
const as = isObject2(props) && "as" in props ? props.as : void 0;
|
|
662
|
+
return isString(as) ? as : defaultTag;
|
|
663
|
+
}
|
|
664
|
+
return void 0;
|
|
665
|
+
}
|
|
666
|
+
function isTag(...tags) {
|
|
667
|
+
const set = new Set(tags);
|
|
668
|
+
return (child) => {
|
|
669
|
+
const tag = resolveChildTag(child);
|
|
670
|
+
return tag !== void 0 && set.has(tag);
|
|
671
|
+
};
|
|
672
|
+
}
|
|
822
673
|
var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
|
|
823
674
|
var asyncWarnScheduled2 = false;
|
|
824
675
|
function flushAsyncWarns2() {
|
|
@@ -1510,8 +1361,201 @@ var invalidProps = ({
|
|
|
1510
1361
|
...dataInvalid === void 0 && { "data-invalid": "" }
|
|
1511
1362
|
};
|
|
1512
1363
|
};
|
|
1364
|
+
var readonlyProps = ({
|
|
1365
|
+
readOnly,
|
|
1366
|
+
"aria-readonly": ariaReadonly,
|
|
1367
|
+
"data-readonly": dataReadonly
|
|
1368
|
+
}) => {
|
|
1369
|
+
if (!readOnly) return {};
|
|
1370
|
+
return {
|
|
1371
|
+
...ariaReadonly === void 0 && {
|
|
1372
|
+
"aria-readonly": "true"
|
|
1373
|
+
},
|
|
1374
|
+
...dataReadonly === void 0 && {
|
|
1375
|
+
"data-readonly": ""
|
|
1376
|
+
}
|
|
1377
|
+
};
|
|
1378
|
+
};
|
|
1379
|
+
var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
|
|
1380
|
+
var removeLandmarkRoleOverride = {
|
|
1381
|
+
kind: "removeRole",
|
|
1382
|
+
apply: ({ props }) => {
|
|
1383
|
+
if (!("role" in props)) return { applied: false, next: props };
|
|
1384
|
+
const { role: _r, ...rest } = props;
|
|
1385
|
+
return { applied: true, next: rest, previous: props };
|
|
1386
|
+
}
|
|
1387
|
+
};
|
|
1388
|
+
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
1389
|
+
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
1390
|
+
const role = props.role;
|
|
1391
|
+
if (!role || role === implicitRole) return [];
|
|
1392
|
+
return [
|
|
1393
|
+
{
|
|
1394
|
+
valid: false,
|
|
1395
|
+
fixable: true,
|
|
1396
|
+
severity: "error",
|
|
1397
|
+
fix: removeLandmarkRoleOverride,
|
|
1398
|
+
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
1399
|
+
}
|
|
1400
|
+
];
|
|
1401
|
+
}
|
|
1402
|
+
var HTML_ARIA_RULES = [landmarkRoleRule];
|
|
1403
|
+
function isOpenContent(...blockedTags) {
|
|
1404
|
+
const set = new Set(blockedTags);
|
|
1405
|
+
return (child) => isObject2(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
1406
|
+
}
|
|
1407
|
+
var METADATA_TAGS = ["script", "template"];
|
|
1408
|
+
var metadataMatch = isTag(...METADATA_TAGS);
|
|
1409
|
+
function metadata(name = "metadata") {
|
|
1410
|
+
return { name, match: metadataMatch };
|
|
1411
|
+
}
|
|
1412
|
+
function firstOptional(name, tag) {
|
|
1413
|
+
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
1414
|
+
}
|
|
1415
|
+
function contract(children) {
|
|
1416
|
+
return { strict: "warn", children };
|
|
1417
|
+
}
|
|
1418
|
+
function ariaContract(aria) {
|
|
1419
|
+
return { strict: "warn", aria };
|
|
1420
|
+
}
|
|
1421
|
+
function firstChildContract(name, tag) {
|
|
1422
|
+
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
1423
|
+
}
|
|
1424
|
+
var VOID_TAGS = [
|
|
1425
|
+
"area",
|
|
1426
|
+
"base",
|
|
1427
|
+
"br",
|
|
1428
|
+
"col",
|
|
1429
|
+
"embed",
|
|
1430
|
+
"hr",
|
|
1431
|
+
"img",
|
|
1432
|
+
"input",
|
|
1433
|
+
"link",
|
|
1434
|
+
"meta",
|
|
1435
|
+
"param",
|
|
1436
|
+
"source",
|
|
1437
|
+
"track",
|
|
1438
|
+
"wbr"
|
|
1439
|
+
];
|
|
1440
|
+
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
1441
|
+
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
1442
|
+
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
1443
|
+
var tableContract = contract([
|
|
1444
|
+
firstOptional("caption", "caption"),
|
|
1445
|
+
{ name: "colgroup", match: isTag("colgroup") },
|
|
1446
|
+
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
1447
|
+
{ name: "tbody", match: isTag("tbody") },
|
|
1448
|
+
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
1449
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1450
|
+
]);
|
|
1451
|
+
var tableBodyContract = contract([
|
|
1452
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1453
|
+
]);
|
|
1454
|
+
var tableRowContract = contract([
|
|
1455
|
+
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
1456
|
+
]);
|
|
1457
|
+
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
1458
|
+
var dlContract = contract([
|
|
1459
|
+
{ name: "term", match: isTag("dt") },
|
|
1460
|
+
{ name: "description", match: isTag("dd") },
|
|
1461
|
+
{ name: "group", match: isTag("div") },
|
|
1462
|
+
metadata()
|
|
1463
|
+
]);
|
|
1464
|
+
var selectContract = contract([
|
|
1465
|
+
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
1466
|
+
]);
|
|
1467
|
+
var optgroupContract = contract([
|
|
1468
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1469
|
+
]);
|
|
1470
|
+
var datalistContract = contract([
|
|
1471
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1472
|
+
]);
|
|
1473
|
+
var pictureContract = contract([
|
|
1474
|
+
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
1475
|
+
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
1476
|
+
]);
|
|
1477
|
+
var figureContract = contract([
|
|
1478
|
+
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
1479
|
+
{ name: "content", match: isOpenContent("figcaption") }
|
|
1480
|
+
]);
|
|
1481
|
+
var detailsContract = firstChildContract("summary", "summary");
|
|
1482
|
+
var fieldsetContract = firstChildContract("legend", "legend");
|
|
1483
|
+
var mediaContract = contract([
|
|
1484
|
+
{ name: "source", match: isTag("source") },
|
|
1485
|
+
{ name: "track", match: isTag("track") },
|
|
1486
|
+
metadata(),
|
|
1487
|
+
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
1488
|
+
]);
|
|
1489
|
+
var headContract = contract([
|
|
1490
|
+
{
|
|
1491
|
+
name: "metadata",
|
|
1492
|
+
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
1493
|
+
}
|
|
1494
|
+
]);
|
|
1495
|
+
var htmlContract = contract([
|
|
1496
|
+
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
1497
|
+
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
1498
|
+
]);
|
|
1499
|
+
var voidContract = contract([]);
|
|
1500
|
+
var textOnlyContract = contract([
|
|
1501
|
+
{
|
|
1502
|
+
name: "text",
|
|
1503
|
+
match: (child) => isString(child) || isNumber(child)
|
|
1504
|
+
}
|
|
1505
|
+
]);
|
|
1506
|
+
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
1507
|
+
var CONTRACT_GROUPS = [
|
|
1508
|
+
[VOID_TAGS, voidContract],
|
|
1509
|
+
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
1510
|
+
[LANDMARK_TAGS, landmarkContract],
|
|
1511
|
+
[["ul", "ol", "menu"], listContract],
|
|
1512
|
+
[["audio", "video"], mediaContract],
|
|
1513
|
+
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
1514
|
+
];
|
|
1515
|
+
function contractMap(groups) {
|
|
1516
|
+
return Object.fromEntries(
|
|
1517
|
+
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
1518
|
+
);
|
|
1519
|
+
}
|
|
1520
|
+
var htmlContracts = {
|
|
1521
|
+
...contractMap(CONTRACT_GROUPS),
|
|
1522
|
+
table: tableContract,
|
|
1523
|
+
tr: tableRowContract,
|
|
1524
|
+
colgroup: colgroupContract,
|
|
1525
|
+
dl: dlContract,
|
|
1526
|
+
select: selectContract,
|
|
1527
|
+
optgroup: optgroupContract,
|
|
1528
|
+
datalist: datalistContract,
|
|
1529
|
+
picture: pictureContract,
|
|
1530
|
+
figure: figureContract,
|
|
1531
|
+
details: detailsContract,
|
|
1532
|
+
fieldset: fieldsetContract,
|
|
1533
|
+
head: headContract,
|
|
1534
|
+
html: htmlContract
|
|
1535
|
+
};
|
|
1536
|
+
function buildEvaluatorMap() {
|
|
1537
|
+
const map = /* @__PURE__ */ new Map();
|
|
1538
|
+
for (const [tag, { children }] of Object.entries(htmlContracts)) {
|
|
1539
|
+
if (children?.length) {
|
|
1540
|
+
map.set(tag, new ChildrenEvaluator(children, "warn", `<${tag}>`));
|
|
1541
|
+
}
|
|
1542
|
+
}
|
|
1543
|
+
return map;
|
|
1544
|
+
}
|
|
1545
|
+
var HTML_EVALUATORS = buildEvaluatorMap();
|
|
1546
|
+
var HTML_FORM_NORMALIZERS = /* @__PURE__ */ new Map([
|
|
1547
|
+
["button", [disabledProps]],
|
|
1548
|
+
["input", [disabledProps, readonlyProps, invalidProps]],
|
|
1549
|
+
["select", [disabledProps]],
|
|
1550
|
+
["textarea", [disabledProps, readonlyProps]],
|
|
1551
|
+
["fieldset", [disabledProps]],
|
|
1552
|
+
["optgroup", [disabledProps]]
|
|
1553
|
+
]);
|
|
1554
|
+
function getHtmlPropNormalizers(tag) {
|
|
1555
|
+
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
1556
|
+
}
|
|
1513
1557
|
|
|
1514
|
-
// ../core/dist/chunk-
|
|
1558
|
+
// ../core/dist/chunk-EHCOMLJ4.js
|
|
1515
1559
|
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
1516
1560
|
var cx = clsx;
|
|
1517
1561
|
var cva = (base, config) => (props) => {
|
|
@@ -1677,7 +1721,12 @@ function createClassPipeline(resolved) {
|
|
|
1677
1721
|
}
|
|
1678
1722
|
|
|
1679
1723
|
// ../core/dist/index.js
|
|
1680
|
-
var FULL_CAPABILITIES = {
|
|
1724
|
+
var FULL_CAPABILITIES = {
|
|
1725
|
+
createClassPipeline,
|
|
1726
|
+
AriaEngine: AriaPolicyEngine,
|
|
1727
|
+
htmlAriaRules: HTML_ARIA_RULES,
|
|
1728
|
+
htmlPropNormalizersFn: getHtmlPropNormalizers
|
|
1729
|
+
};
|
|
1681
1730
|
function createPolymorphic2(options = {}) {
|
|
1682
1731
|
return createPolymorphic(options, FULL_CAPABILITIES);
|
|
1683
1732
|
}
|
|
@@ -1946,7 +1995,9 @@ function resolveRenderState(runtime, props, filterProps) {
|
|
|
1946
1995
|
const { as, asChild, children, className, variantKey, ...rest } = props;
|
|
1947
1996
|
const tag = runtime.resolveTag(as);
|
|
1948
1997
|
const mergedProps = runtime.resolveProps(rest);
|
|
1949
|
-
const
|
|
1998
|
+
const baseProps = runtime.options.normalizeFn ? runtime.options.normalizeFn(mergedProps) : mergedProps;
|
|
1999
|
+
const htmlNormalizers = runtime.options.htmlPropNormalizersFn?.(tag);
|
|
2000
|
+
const normalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), baseProps) : baseProps;
|
|
1950
2001
|
const resolvedClass = runtime.resolveClasses(tag, normalizedProps, className, variantKey);
|
|
1951
2002
|
const filteredProps = applyFilter(normalizedProps, filterProps, runtime.options.variantKeys);
|
|
1952
2003
|
return buildRenderState(tag, buildDirectives(as, asChild), filteredProps, resolvedClass, children);
|
|
@@ -2056,7 +2107,5 @@ function defineContractComponent(options) {
|
|
|
2056
2107
|
export {
|
|
2057
2108
|
Slottable,
|
|
2058
2109
|
createContractComponent,
|
|
2059
|
-
defineContractComponent
|
|
2060
|
-
disabledProps,
|
|
2061
|
-
invalidProps
|
|
2110
|
+
defineContractComponent
|
|
2062
2111
|
};
|
package/dist/react/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ElementType, U as UnknownProps, V as VariantMap, P as PresetMap, a as EmptyRecord, A as AnyRecord, R as ReactFactoryOptions, b as PolymorphicComponent, c as PolymorphicGenerics, F as FactoryOptions } from '../merge-refs-
|
|
2
|
-
export { d as
|
|
1
|
+
import { E as ElementType, U as UnknownProps, V as VariantMap, P as PresetMap, a as EmptyRecord, A as AnyRecord, R as ReactFactoryOptions, b as PolymorphicComponent, c as PolymorphicGenerics, F as FactoryOptions } from '../merge-refs-DxjWMq3U.js';
|
|
2
|
+
export { d as AnyFactoryOptions, e as ElementRef, f as PolymorphicProps, g as PolymorphicWithAsChild, h as PolymorphicWithRender, i as RenderCallbackProps, S as Slottable, j as SlottableProps, m as mergeRefs } from '../merge-refs-DxjWMq3U.js';
|
|
3
3
|
import { Ref, ReactElement } from 'react';
|
|
4
4
|
import 'type-fest';
|
|
5
5
|
|
|
@@ -24,4 +24,4 @@ declare namespace Slot {
|
|
|
24
24
|
var displayName: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export { ElementType, EmptyRecord, PolymorphicComponent, PolymorphicGenerics, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent, defineContractComponent };
|
|
27
|
+
export { ElementType, EmptyRecord, FactoryOptions, PolymorphicComponent, PolymorphicGenerics, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent, defineContractComponent };
|
package/dist/react/index.js
CHANGED
|
@@ -11,14 +11,12 @@ import {
|
|
|
11
11
|
composeFilter,
|
|
12
12
|
createContractedPolymorphic,
|
|
13
13
|
createPolymorphic,
|
|
14
|
-
disabledProps,
|
|
15
|
-
invalidProps,
|
|
16
14
|
isFunction,
|
|
17
15
|
isPlainObject,
|
|
18
16
|
mergeRefs,
|
|
19
17
|
mergeSlotProps,
|
|
20
18
|
render
|
|
21
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-ACAKUHH5.js";
|
|
22
20
|
|
|
23
21
|
// ../../adapters/react/src/current/slot/cloneSlotChild.ts
|
|
24
22
|
import { Fragment } from "react";
|
|
@@ -191,7 +189,5 @@ export {
|
|
|
191
189
|
createContractedComponent,
|
|
192
190
|
createPolymorphicComponent,
|
|
193
191
|
defineContractComponent,
|
|
194
|
-
disabledProps,
|
|
195
|
-
invalidProps,
|
|
196
192
|
mergeRefs
|
|
197
193
|
};
|
package/dist/react/legacy.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as ElementType, U as UnknownProps, V as VariantMap, P as PresetMap, a as EmptyRecord, A as AnyRecord, R as ReactFactoryOptions, b as PolymorphicComponent, c as PolymorphicGenerics } from '../merge-refs-
|
|
2
|
-
export { d as
|
|
1
|
+
import { E as ElementType, U as UnknownProps, V as VariantMap, P as PresetMap, a as EmptyRecord, A as AnyRecord, R as ReactFactoryOptions, b as PolymorphicComponent, c as PolymorphicGenerics } from '../merge-refs-DxjWMq3U.js';
|
|
2
|
+
export { d as AnyFactoryOptions, e as ElementRef, F as FactoryOptions, f as PolymorphicProps, g as PolymorphicWithAsChild, h as PolymorphicWithRender, i as RenderCallbackProps, S as Slottable, j as SlottableProps, m as mergeRefs } from '../merge-refs-DxjWMq3U.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import 'type-fest';
|
|
5
5
|
|
package/dist/react/legacy.js
CHANGED
|
@@ -11,14 +11,12 @@ import {
|
|
|
11
11
|
composeFilter,
|
|
12
12
|
createContractedPolymorphic,
|
|
13
13
|
createPolymorphic,
|
|
14
|
-
disabledProps,
|
|
15
|
-
invalidProps,
|
|
16
14
|
isFunction,
|
|
17
15
|
isPlainObject,
|
|
18
16
|
mergeRefs,
|
|
19
17
|
mergeSlotProps,
|
|
20
18
|
render
|
|
21
|
-
} from "../chunk-
|
|
19
|
+
} from "../chunk-ACAKUHH5.js";
|
|
22
20
|
|
|
23
21
|
// ../../adapters/react/src/legacy/create-aria-enforced-component.ts
|
|
24
22
|
import { forwardRef as forwardRef2 } from "react";
|
|
@@ -203,7 +201,5 @@ export {
|
|
|
203
201
|
createContractComponent,
|
|
204
202
|
createContractedComponent,
|
|
205
203
|
createPolymorphicComponent,
|
|
206
|
-
disabledProps,
|
|
207
|
-
invalidProps,
|
|
208
204
|
mergeRefs
|
|
209
205
|
};
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -226,6 +226,7 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
|
|
|
226
226
|
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
227
227
|
normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
|
|
228
228
|
}['normalize'];
|
|
229
|
+
type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, PresetMap<VariantMap>, AnyRecord>;
|
|
229
230
|
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> = {
|
|
230
231
|
readonly tag?: TDefault;
|
|
231
232
|
readonly name?: string;
|
|
@@ -235,10 +236,6 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
|
|
|
235
236
|
readonly enforcement?: EnforcementOptions<TAllowed>;
|
|
236
237
|
};
|
|
237
238
|
|
|
238
|
-
declare const disabledProps: PropNormalizer;
|
|
239
|
-
|
|
240
|
-
declare const invalidProps: PropNormalizer;
|
|
241
|
-
|
|
242
239
|
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
243
240
|
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
244
241
|
|
|
@@ -284,4 +281,4 @@ declare function createContractComponent<TDefault extends ElementType, Props ext
|
|
|
284
281
|
|
|
285
282
|
declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
|
|
286
283
|
|
|
287
|
-
export { type ElementRef, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type SolidFactoryOptions, createContractComponent, defineContractComponent
|
|
284
|
+
export { type AnyFactoryOptions, type ElementRef, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type SolidFactoryOptions, createContractComponent, defineContractComponent };
|