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/svelte/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// ../core/dist/chunk-
|
|
1
|
+
// ../core/dist/chunk-XFCAUPVZ.js
|
|
2
2
|
function makeResolveTag(defaultTag) {
|
|
3
3
|
return function tag(as) {
|
|
4
4
|
return as ?? defaultTag;
|
|
@@ -233,7 +233,11 @@ function createRuntimeObject(methods, resolved, pluginResult) {
|
|
|
233
233
|
return pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
234
234
|
}
|
|
235
235
|
function createPolymorphic(options = {}, capabilities) {
|
|
236
|
-
const
|
|
236
|
+
const baseResolved = resolveFactoryOptions(options);
|
|
237
|
+
const resolved = capabilities?.htmlPropNormalizersFn !== void 0 ? Object.freeze({
|
|
238
|
+
...baseResolved,
|
|
239
|
+
htmlPropNormalizersFn: capabilities.htmlPropNormalizersFn
|
|
240
|
+
}) : baseResolved;
|
|
237
241
|
if (process.env.NODE_ENV !== "production") validateFactoryOptions(resolved);
|
|
238
242
|
const { pluginResult, classPipeline } = resolveClassPipeline(
|
|
239
243
|
options,
|
|
@@ -241,9 +245,12 @@ function createPolymorphic(options = {}, capabilities) {
|
|
|
241
245
|
resolved.strict,
|
|
242
246
|
capabilities
|
|
243
247
|
);
|
|
248
|
+
const allAriaRules = [
|
|
249
|
+
.../* @__PURE__ */ new Set([...capabilities?.htmlAriaRules ?? [], ...resolved.ariaRules ?? []])
|
|
250
|
+
];
|
|
244
251
|
const engine = options.enforcement !== void 0 && capabilities?.AriaEngine ? new capabilities.AriaEngine(
|
|
245
252
|
resolved.strict,
|
|
246
|
-
|
|
253
|
+
allAriaRules.length ? { rules: allAriaRules } : void 0
|
|
247
254
|
) : null;
|
|
248
255
|
const methods = createRuntimeMethods(resolved, classPipeline, engine);
|
|
249
256
|
return createRuntimeObject(
|
|
@@ -559,184 +566,7 @@ function isStandaloneTag(tag) {
|
|
|
559
566
|
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
560
567
|
}
|
|
561
568
|
|
|
562
|
-
// ../core/dist/chunk-
|
|
563
|
-
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
564
|
-
function resolveChildTag(child) {
|
|
565
|
-
if (!isObject(child) || !("type" in child)) return void 0;
|
|
566
|
-
const t = child.type;
|
|
567
|
-
if (isString(t)) return t;
|
|
568
|
-
if (isObject(t) && COMPONENT_DEFAULT_TAG in t) {
|
|
569
|
-
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
570
|
-
if (!isString(defaultTag)) return void 0;
|
|
571
|
-
const props = child.props;
|
|
572
|
-
const as = isObject(props) && "as" in props ? props.as : void 0;
|
|
573
|
-
return isString(as) ? as : defaultTag;
|
|
574
|
-
}
|
|
575
|
-
return void 0;
|
|
576
|
-
}
|
|
577
|
-
function isTag(...tags) {
|
|
578
|
-
const set = new Set(tags);
|
|
579
|
-
return (child) => {
|
|
580
|
-
const tag = resolveChildTag(child);
|
|
581
|
-
return tag !== void 0 && set.has(tag);
|
|
582
|
-
};
|
|
583
|
-
}
|
|
584
|
-
function isOpenContent(...blockedTags) {
|
|
585
|
-
const set = new Set(blockedTags);
|
|
586
|
-
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
587
|
-
}
|
|
588
|
-
var METADATA_TAGS = ["script", "template"];
|
|
589
|
-
var metadataMatch = isTag(...METADATA_TAGS);
|
|
590
|
-
function metadata(name = "metadata") {
|
|
591
|
-
return { name, match: metadataMatch };
|
|
592
|
-
}
|
|
593
|
-
function firstOptional(name, tag) {
|
|
594
|
-
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
595
|
-
}
|
|
596
|
-
function contract(children) {
|
|
597
|
-
return { strict: "warn", children };
|
|
598
|
-
}
|
|
599
|
-
function ariaContract(aria) {
|
|
600
|
-
return { strict: "warn", aria };
|
|
601
|
-
}
|
|
602
|
-
function firstChildContract(name, tag) {
|
|
603
|
-
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
604
|
-
}
|
|
605
|
-
var VOID_TAGS = [
|
|
606
|
-
"area",
|
|
607
|
-
"base",
|
|
608
|
-
"br",
|
|
609
|
-
"col",
|
|
610
|
-
"embed",
|
|
611
|
-
"hr",
|
|
612
|
-
"img",
|
|
613
|
-
"input",
|
|
614
|
-
"link",
|
|
615
|
-
"meta",
|
|
616
|
-
"param",
|
|
617
|
-
"source",
|
|
618
|
-
"track",
|
|
619
|
-
"wbr"
|
|
620
|
-
];
|
|
621
|
-
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
622
|
-
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
623
|
-
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
624
|
-
var tableContract = contract([
|
|
625
|
-
firstOptional("caption", "caption"),
|
|
626
|
-
{ name: "colgroup", match: isTag("colgroup") },
|
|
627
|
-
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
628
|
-
{ name: "tbody", match: isTag("tbody") },
|
|
629
|
-
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
630
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
631
|
-
]);
|
|
632
|
-
var tableBodyContract = contract([
|
|
633
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
634
|
-
]);
|
|
635
|
-
var tableRowContract = contract([
|
|
636
|
-
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
637
|
-
]);
|
|
638
|
-
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
639
|
-
var dlContract = contract([
|
|
640
|
-
{ name: "term", match: isTag("dt") },
|
|
641
|
-
{ name: "description", match: isTag("dd") },
|
|
642
|
-
{ name: "group", match: isTag("div") },
|
|
643
|
-
metadata()
|
|
644
|
-
]);
|
|
645
|
-
var selectContract = contract([
|
|
646
|
-
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
647
|
-
]);
|
|
648
|
-
var optgroupContract = contract([
|
|
649
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
650
|
-
]);
|
|
651
|
-
var datalistContract = contract([
|
|
652
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
653
|
-
]);
|
|
654
|
-
var pictureContract = contract([
|
|
655
|
-
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
656
|
-
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
657
|
-
]);
|
|
658
|
-
var figureContract = contract([
|
|
659
|
-
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
660
|
-
{ name: "content", match: isOpenContent("figcaption") }
|
|
661
|
-
]);
|
|
662
|
-
var detailsContract = firstChildContract("summary", "summary");
|
|
663
|
-
var fieldsetContract = firstChildContract("legend", "legend");
|
|
664
|
-
var mediaContract = contract([
|
|
665
|
-
{ name: "source", match: isTag("source") },
|
|
666
|
-
{ name: "track", match: isTag("track") },
|
|
667
|
-
metadata(),
|
|
668
|
-
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
669
|
-
]);
|
|
670
|
-
var headContract = contract([
|
|
671
|
-
{
|
|
672
|
-
name: "metadata",
|
|
673
|
-
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
674
|
-
}
|
|
675
|
-
]);
|
|
676
|
-
var htmlContract = contract([
|
|
677
|
-
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
678
|
-
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
679
|
-
]);
|
|
680
|
-
var voidContract = contract([]);
|
|
681
|
-
var textOnlyContract = contract([
|
|
682
|
-
{
|
|
683
|
-
name: "text",
|
|
684
|
-
match: (child) => isString(child) || isNumber(child)
|
|
685
|
-
}
|
|
686
|
-
]);
|
|
687
|
-
var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
|
|
688
|
-
var removeLandmarkRoleOverride = {
|
|
689
|
-
kind: "removeRole",
|
|
690
|
-
apply: ({ props }) => {
|
|
691
|
-
if (!("role" in props)) return { applied: false, next: props };
|
|
692
|
-
const { role: _r, ...rest } = props;
|
|
693
|
-
return { applied: true, next: rest, previous: props };
|
|
694
|
-
}
|
|
695
|
-
};
|
|
696
|
-
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
697
|
-
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
698
|
-
const role = props.role;
|
|
699
|
-
if (!role || role === implicitRole) return [];
|
|
700
|
-
return [
|
|
701
|
-
{
|
|
702
|
-
valid: false,
|
|
703
|
-
fixable: true,
|
|
704
|
-
severity: "error",
|
|
705
|
-
fix: removeLandmarkRoleOverride,
|
|
706
|
-
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
707
|
-
}
|
|
708
|
-
];
|
|
709
|
-
}
|
|
710
|
-
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
711
|
-
var CONTRACT_GROUPS = [
|
|
712
|
-
[VOID_TAGS, voidContract],
|
|
713
|
-
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
714
|
-
[LANDMARK_TAGS, landmarkContract],
|
|
715
|
-
[["ul", "ol", "menu"], listContract],
|
|
716
|
-
[["audio", "video"], mediaContract],
|
|
717
|
-
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
718
|
-
];
|
|
719
|
-
function contractMap(groups) {
|
|
720
|
-
return Object.fromEntries(
|
|
721
|
-
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
722
|
-
);
|
|
723
|
-
}
|
|
724
|
-
var htmlContracts = {
|
|
725
|
-
...contractMap(CONTRACT_GROUPS),
|
|
726
|
-
table: tableContract,
|
|
727
|
-
tr: tableRowContract,
|
|
728
|
-
colgroup: colgroupContract,
|
|
729
|
-
dl: dlContract,
|
|
730
|
-
select: selectContract,
|
|
731
|
-
optgroup: optgroupContract,
|
|
732
|
-
datalist: datalistContract,
|
|
733
|
-
picture: pictureContract,
|
|
734
|
-
figure: figureContract,
|
|
735
|
-
details: detailsContract,
|
|
736
|
-
fieldset: fieldsetContract,
|
|
737
|
-
head: headContract,
|
|
738
|
-
html: htmlContract
|
|
739
|
-
};
|
|
569
|
+
// ../core/dist/chunk-VU44HAB7.js
|
|
740
570
|
var IMPLICIT_ROLE_RECORD2 = {
|
|
741
571
|
article: "article",
|
|
742
572
|
aside: "complementary",
|
|
@@ -765,6 +595,27 @@ function getImplicitRole(tag) {
|
|
|
765
595
|
if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
|
|
766
596
|
return void 0;
|
|
767
597
|
}
|
|
598
|
+
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
599
|
+
function resolveChildTag(child) {
|
|
600
|
+
if (!isObject(child) || !("type" in child)) return void 0;
|
|
601
|
+
const t = child.type;
|
|
602
|
+
if (isString(t)) return t;
|
|
603
|
+
if (isObject(t) && COMPONENT_DEFAULT_TAG in t) {
|
|
604
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
605
|
+
if (!isString(defaultTag)) return void 0;
|
|
606
|
+
const props = child.props;
|
|
607
|
+
const as = isObject(props) && "as" in props ? props.as : void 0;
|
|
608
|
+
return isString(as) ? as : defaultTag;
|
|
609
|
+
}
|
|
610
|
+
return void 0;
|
|
611
|
+
}
|
|
612
|
+
function isTag(...tags) {
|
|
613
|
+
const set = new Set(tags);
|
|
614
|
+
return (child) => {
|
|
615
|
+
const tag = resolveChildTag(child);
|
|
616
|
+
return tag !== void 0 && set.has(tag);
|
|
617
|
+
};
|
|
618
|
+
}
|
|
768
619
|
var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
|
|
769
620
|
var asyncWarnScheduled2 = false;
|
|
770
621
|
function flushAsyncWarns2() {
|
|
@@ -1456,8 +1307,201 @@ var invalidProps = ({
|
|
|
1456
1307
|
...dataInvalid === void 0 && { "data-invalid": "" }
|
|
1457
1308
|
};
|
|
1458
1309
|
};
|
|
1310
|
+
var readonlyProps = ({
|
|
1311
|
+
readOnly,
|
|
1312
|
+
"aria-readonly": ariaReadonly,
|
|
1313
|
+
"data-readonly": dataReadonly
|
|
1314
|
+
}) => {
|
|
1315
|
+
if (!readOnly) return {};
|
|
1316
|
+
return {
|
|
1317
|
+
...ariaReadonly === void 0 && {
|
|
1318
|
+
"aria-readonly": "true"
|
|
1319
|
+
},
|
|
1320
|
+
...dataReadonly === void 0 && {
|
|
1321
|
+
"data-readonly": ""
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
};
|
|
1325
|
+
var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
|
|
1326
|
+
var removeLandmarkRoleOverride = {
|
|
1327
|
+
kind: "removeRole",
|
|
1328
|
+
apply: ({ props }) => {
|
|
1329
|
+
if (!("role" in props)) return { applied: false, next: props };
|
|
1330
|
+
const { role: _r, ...rest } = props;
|
|
1331
|
+
return { applied: true, next: rest, previous: props };
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
1335
|
+
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
1336
|
+
const role = props.role;
|
|
1337
|
+
if (!role || role === implicitRole) return [];
|
|
1338
|
+
return [
|
|
1339
|
+
{
|
|
1340
|
+
valid: false,
|
|
1341
|
+
fixable: true,
|
|
1342
|
+
severity: "error",
|
|
1343
|
+
fix: removeLandmarkRoleOverride,
|
|
1344
|
+
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
1345
|
+
}
|
|
1346
|
+
];
|
|
1347
|
+
}
|
|
1348
|
+
var HTML_ARIA_RULES = [landmarkRoleRule];
|
|
1349
|
+
function isOpenContent(...blockedTags) {
|
|
1350
|
+
const set = new Set(blockedTags);
|
|
1351
|
+
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
1352
|
+
}
|
|
1353
|
+
var METADATA_TAGS = ["script", "template"];
|
|
1354
|
+
var metadataMatch = isTag(...METADATA_TAGS);
|
|
1355
|
+
function metadata(name = "metadata") {
|
|
1356
|
+
return { name, match: metadataMatch };
|
|
1357
|
+
}
|
|
1358
|
+
function firstOptional(name, tag) {
|
|
1359
|
+
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
1360
|
+
}
|
|
1361
|
+
function contract(children) {
|
|
1362
|
+
return { strict: "warn", children };
|
|
1363
|
+
}
|
|
1364
|
+
function ariaContract(aria) {
|
|
1365
|
+
return { strict: "warn", aria };
|
|
1366
|
+
}
|
|
1367
|
+
function firstChildContract(name, tag) {
|
|
1368
|
+
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
1369
|
+
}
|
|
1370
|
+
var VOID_TAGS = [
|
|
1371
|
+
"area",
|
|
1372
|
+
"base",
|
|
1373
|
+
"br",
|
|
1374
|
+
"col",
|
|
1375
|
+
"embed",
|
|
1376
|
+
"hr",
|
|
1377
|
+
"img",
|
|
1378
|
+
"input",
|
|
1379
|
+
"link",
|
|
1380
|
+
"meta",
|
|
1381
|
+
"param",
|
|
1382
|
+
"source",
|
|
1383
|
+
"track",
|
|
1384
|
+
"wbr"
|
|
1385
|
+
];
|
|
1386
|
+
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
1387
|
+
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
1388
|
+
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
1389
|
+
var tableContract = contract([
|
|
1390
|
+
firstOptional("caption", "caption"),
|
|
1391
|
+
{ name: "colgroup", match: isTag("colgroup") },
|
|
1392
|
+
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
1393
|
+
{ name: "tbody", match: isTag("tbody") },
|
|
1394
|
+
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
1395
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1396
|
+
]);
|
|
1397
|
+
var tableBodyContract = contract([
|
|
1398
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1399
|
+
]);
|
|
1400
|
+
var tableRowContract = contract([
|
|
1401
|
+
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
1402
|
+
]);
|
|
1403
|
+
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
1404
|
+
var dlContract = contract([
|
|
1405
|
+
{ name: "term", match: isTag("dt") },
|
|
1406
|
+
{ name: "description", match: isTag("dd") },
|
|
1407
|
+
{ name: "group", match: isTag("div") },
|
|
1408
|
+
metadata()
|
|
1409
|
+
]);
|
|
1410
|
+
var selectContract = contract([
|
|
1411
|
+
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
1412
|
+
]);
|
|
1413
|
+
var optgroupContract = contract([
|
|
1414
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1415
|
+
]);
|
|
1416
|
+
var datalistContract = contract([
|
|
1417
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1418
|
+
]);
|
|
1419
|
+
var pictureContract = contract([
|
|
1420
|
+
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
1421
|
+
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
1422
|
+
]);
|
|
1423
|
+
var figureContract = contract([
|
|
1424
|
+
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
1425
|
+
{ name: "content", match: isOpenContent("figcaption") }
|
|
1426
|
+
]);
|
|
1427
|
+
var detailsContract = firstChildContract("summary", "summary");
|
|
1428
|
+
var fieldsetContract = firstChildContract("legend", "legend");
|
|
1429
|
+
var mediaContract = contract([
|
|
1430
|
+
{ name: "source", match: isTag("source") },
|
|
1431
|
+
{ name: "track", match: isTag("track") },
|
|
1432
|
+
metadata(),
|
|
1433
|
+
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
1434
|
+
]);
|
|
1435
|
+
var headContract = contract([
|
|
1436
|
+
{
|
|
1437
|
+
name: "metadata",
|
|
1438
|
+
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
1439
|
+
}
|
|
1440
|
+
]);
|
|
1441
|
+
var htmlContract = contract([
|
|
1442
|
+
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
1443
|
+
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
1444
|
+
]);
|
|
1445
|
+
var voidContract = contract([]);
|
|
1446
|
+
var textOnlyContract = contract([
|
|
1447
|
+
{
|
|
1448
|
+
name: "text",
|
|
1449
|
+
match: (child) => isString(child) || isNumber(child)
|
|
1450
|
+
}
|
|
1451
|
+
]);
|
|
1452
|
+
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
1453
|
+
var CONTRACT_GROUPS = [
|
|
1454
|
+
[VOID_TAGS, voidContract],
|
|
1455
|
+
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
1456
|
+
[LANDMARK_TAGS, landmarkContract],
|
|
1457
|
+
[["ul", "ol", "menu"], listContract],
|
|
1458
|
+
[["audio", "video"], mediaContract],
|
|
1459
|
+
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
1460
|
+
];
|
|
1461
|
+
function contractMap(groups) {
|
|
1462
|
+
return Object.fromEntries(
|
|
1463
|
+
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
1464
|
+
);
|
|
1465
|
+
}
|
|
1466
|
+
var htmlContracts = {
|
|
1467
|
+
...contractMap(CONTRACT_GROUPS),
|
|
1468
|
+
table: tableContract,
|
|
1469
|
+
tr: tableRowContract,
|
|
1470
|
+
colgroup: colgroupContract,
|
|
1471
|
+
dl: dlContract,
|
|
1472
|
+
select: selectContract,
|
|
1473
|
+
optgroup: optgroupContract,
|
|
1474
|
+
datalist: datalistContract,
|
|
1475
|
+
picture: pictureContract,
|
|
1476
|
+
figure: figureContract,
|
|
1477
|
+
details: detailsContract,
|
|
1478
|
+
fieldset: fieldsetContract,
|
|
1479
|
+
head: headContract,
|
|
1480
|
+
html: htmlContract
|
|
1481
|
+
};
|
|
1482
|
+
function buildEvaluatorMap() {
|
|
1483
|
+
const map = /* @__PURE__ */ new Map();
|
|
1484
|
+
for (const [tag, { children }] of Object.entries(htmlContracts)) {
|
|
1485
|
+
if (children?.length) {
|
|
1486
|
+
map.set(tag, new ChildrenEvaluator(children, "warn", `<${tag}>`));
|
|
1487
|
+
}
|
|
1488
|
+
}
|
|
1489
|
+
return map;
|
|
1490
|
+
}
|
|
1491
|
+
var HTML_EVALUATORS = buildEvaluatorMap();
|
|
1492
|
+
var HTML_FORM_NORMALIZERS = /* @__PURE__ */ new Map([
|
|
1493
|
+
["button", [disabledProps]],
|
|
1494
|
+
["input", [disabledProps, readonlyProps, invalidProps]],
|
|
1495
|
+
["select", [disabledProps]],
|
|
1496
|
+
["textarea", [disabledProps, readonlyProps]],
|
|
1497
|
+
["fieldset", [disabledProps]],
|
|
1498
|
+
["optgroup", [disabledProps]]
|
|
1499
|
+
]);
|
|
1500
|
+
function getHtmlPropNormalizers(tag) {
|
|
1501
|
+
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
1502
|
+
}
|
|
1459
1503
|
|
|
1460
|
-
// ../core/dist/chunk-
|
|
1504
|
+
// ../core/dist/chunk-EHCOMLJ4.js
|
|
1461
1505
|
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
1462
1506
|
var cx = clsx;
|
|
1463
1507
|
var cva = (base, config) => (props) => {
|
|
@@ -1623,7 +1667,12 @@ function createClassPipeline(resolved) {
|
|
|
1623
1667
|
}
|
|
1624
1668
|
|
|
1625
1669
|
// ../core/dist/index.js
|
|
1626
|
-
var FULL_CAPABILITIES = {
|
|
1670
|
+
var FULL_CAPABILITIES = {
|
|
1671
|
+
createClassPipeline,
|
|
1672
|
+
AriaEngine: AriaPolicyEngine,
|
|
1673
|
+
htmlAriaRules: HTML_ARIA_RULES,
|
|
1674
|
+
htmlPropNormalizersFn: getHtmlPropNormalizers
|
|
1675
|
+
};
|
|
1627
1676
|
function createPolymorphic2(options = {}) {
|
|
1628
1677
|
return createPolymorphic(options, FULL_CAPABILITIES);
|
|
1629
1678
|
}
|
|
@@ -1717,7 +1766,5 @@ function defineContractComponent(options) {
|
|
|
1717
1766
|
}
|
|
1718
1767
|
export {
|
|
1719
1768
|
createContractComponent,
|
|
1720
|
-
defineContractComponent
|
|
1721
|
-
disabledProps,
|
|
1722
|
-
invalidProps
|
|
1769
|
+
defineContractComponent
|
|
1723
1770
|
};
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -227,6 +227,7 @@ type StylingOptions<V extends Readonly<VariantMap> = Readonly<EmptyRecord>, TPre
|
|
|
227
227
|
type NormalizeFn<Props extends AnyRecord = AnyRecord> = {
|
|
228
228
|
normalize(props: Readonly<Props & IntrinsicProps>): Props & IntrinsicProps;
|
|
229
229
|
}['normalize'];
|
|
230
|
+
type AnyFactoryOptions = FactoryOptions<ElementType, AnyRecord, VariantMap, PresetMap<VariantMap>, AnyRecord>;
|
|
230
231
|
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> = {
|
|
231
232
|
readonly tag?: TDefault;
|
|
232
233
|
readonly name?: string;
|
|
@@ -236,10 +237,6 @@ type FactoryOptions<TDefault extends ElementType = ElementType, Props extends An
|
|
|
236
237
|
readonly enforcement?: EnforcementOptions<TAllowed>;
|
|
237
238
|
};
|
|
238
239
|
|
|
239
|
-
declare const disabledProps: PropNormalizer;
|
|
240
|
-
|
|
241
|
-
declare const invalidProps: PropNormalizer;
|
|
242
|
-
|
|
243
240
|
type DefaultOf<T extends PolymorphicGenerics> = T['default'];
|
|
244
241
|
type PropsOf<T extends PolymorphicGenerics> = T['props'];
|
|
245
242
|
|
|
@@ -306,4 +303,4 @@ declare function createContractComponent<TDefault extends ElementType, Props ext
|
|
|
306
303
|
|
|
307
304
|
declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
|
|
308
305
|
|
|
309
|
-
export { type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, Slottable, type SlottableProps, type VueFactoryOptions, createContractComponent, defineContractComponent
|
|
306
|
+
export { type AnyFactoryOptions, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, Slottable, type SlottableProps, type VueFactoryOptions, createContractComponent, defineContractComponent };
|