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/web/index.js
CHANGED
|
@@ -9,7 +9,7 @@ function applyFilter(props, filterProps, variantKeys) {
|
|
|
9
9
|
return out;
|
|
10
10
|
}
|
|
11
11
|
|
|
12
|
-
// ../core/dist/chunk-
|
|
12
|
+
// ../core/dist/chunk-XFCAUPVZ.js
|
|
13
13
|
function makeResolveTag(defaultTag) {
|
|
14
14
|
return function tag(as) {
|
|
15
15
|
return as ?? defaultTag;
|
|
@@ -244,7 +244,11 @@ function createRuntimeObject(methods, resolved, pluginResult) {
|
|
|
244
244
|
return pluginResult ? { ...methods, options: resolved, hasStyling: true, classPlugin: pluginResult } : { ...methods, options: resolved };
|
|
245
245
|
}
|
|
246
246
|
function createPolymorphic(options = {}, capabilities) {
|
|
247
|
-
const
|
|
247
|
+
const baseResolved = resolveFactoryOptions(options);
|
|
248
|
+
const resolved = capabilities?.htmlPropNormalizersFn !== void 0 ? Object.freeze({
|
|
249
|
+
...baseResolved,
|
|
250
|
+
htmlPropNormalizersFn: capabilities.htmlPropNormalizersFn
|
|
251
|
+
}) : baseResolved;
|
|
248
252
|
if (process.env.NODE_ENV !== "production") validateFactoryOptions(resolved);
|
|
249
253
|
const { pluginResult, classPipeline } = resolveClassPipeline(
|
|
250
254
|
options,
|
|
@@ -252,9 +256,12 @@ function createPolymorphic(options = {}, capabilities) {
|
|
|
252
256
|
resolved.strict,
|
|
253
257
|
capabilities
|
|
254
258
|
);
|
|
259
|
+
const allAriaRules = [
|
|
260
|
+
.../* @__PURE__ */ new Set([...capabilities?.htmlAriaRules ?? [], ...resolved.ariaRules ?? []])
|
|
261
|
+
];
|
|
255
262
|
const engine = options.enforcement !== void 0 && capabilities?.AriaEngine ? new capabilities.AriaEngine(
|
|
256
263
|
resolved.strict,
|
|
257
|
-
|
|
264
|
+
allAriaRules.length ? { rules: allAriaRules } : void 0
|
|
258
265
|
) : null;
|
|
259
266
|
const methods = createRuntimeMethods(resolved, classPipeline, engine);
|
|
260
267
|
return createRuntimeObject(
|
|
@@ -570,184 +577,7 @@ function isStandaloneTag(tag) {
|
|
|
570
577
|
return STANDALONE_ROLES_SET.has(IMPLICIT_ROLE_RECORD[tag]);
|
|
571
578
|
}
|
|
572
579
|
|
|
573
|
-
// ../core/dist/chunk-
|
|
574
|
-
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
575
|
-
function resolveChildTag(child) {
|
|
576
|
-
if (!isObject(child) || !("type" in child)) return void 0;
|
|
577
|
-
const t = child.type;
|
|
578
|
-
if (isString(t)) return t;
|
|
579
|
-
if (isObject(t) && COMPONENT_DEFAULT_TAG in t) {
|
|
580
|
-
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
581
|
-
if (!isString(defaultTag)) return void 0;
|
|
582
|
-
const props = child.props;
|
|
583
|
-
const as = isObject(props) && "as" in props ? props.as : void 0;
|
|
584
|
-
return isString(as) ? as : defaultTag;
|
|
585
|
-
}
|
|
586
|
-
return void 0;
|
|
587
|
-
}
|
|
588
|
-
function isTag(...tags) {
|
|
589
|
-
const set = new Set(tags);
|
|
590
|
-
return (child) => {
|
|
591
|
-
const tag = resolveChildTag(child);
|
|
592
|
-
return tag !== void 0 && set.has(tag);
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
function isOpenContent(...blockedTags) {
|
|
596
|
-
const set = new Set(blockedTags);
|
|
597
|
-
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
598
|
-
}
|
|
599
|
-
var METADATA_TAGS = ["script", "template"];
|
|
600
|
-
var metadataMatch = isTag(...METADATA_TAGS);
|
|
601
|
-
function metadata(name = "metadata") {
|
|
602
|
-
return { name, match: metadataMatch };
|
|
603
|
-
}
|
|
604
|
-
function firstOptional(name, tag) {
|
|
605
|
-
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
606
|
-
}
|
|
607
|
-
function contract(children) {
|
|
608
|
-
return { strict: "warn", children };
|
|
609
|
-
}
|
|
610
|
-
function ariaContract(aria) {
|
|
611
|
-
return { strict: "warn", aria };
|
|
612
|
-
}
|
|
613
|
-
function firstChildContract(name, tag) {
|
|
614
|
-
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
615
|
-
}
|
|
616
|
-
var VOID_TAGS = [
|
|
617
|
-
"area",
|
|
618
|
-
"base",
|
|
619
|
-
"br",
|
|
620
|
-
"col",
|
|
621
|
-
"embed",
|
|
622
|
-
"hr",
|
|
623
|
-
"img",
|
|
624
|
-
"input",
|
|
625
|
-
"link",
|
|
626
|
-
"meta",
|
|
627
|
-
"param",
|
|
628
|
-
"source",
|
|
629
|
-
"track",
|
|
630
|
-
"wbr"
|
|
631
|
-
];
|
|
632
|
-
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
633
|
-
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
634
|
-
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
635
|
-
var tableContract = contract([
|
|
636
|
-
firstOptional("caption", "caption"),
|
|
637
|
-
{ name: "colgroup", match: isTag("colgroup") },
|
|
638
|
-
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
639
|
-
{ name: "tbody", match: isTag("tbody") },
|
|
640
|
-
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
641
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
642
|
-
]);
|
|
643
|
-
var tableBodyContract = contract([
|
|
644
|
-
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
645
|
-
]);
|
|
646
|
-
var tableRowContract = contract([
|
|
647
|
-
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
648
|
-
]);
|
|
649
|
-
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
650
|
-
var dlContract = contract([
|
|
651
|
-
{ name: "term", match: isTag("dt") },
|
|
652
|
-
{ name: "description", match: isTag("dd") },
|
|
653
|
-
{ name: "group", match: isTag("div") },
|
|
654
|
-
metadata()
|
|
655
|
-
]);
|
|
656
|
-
var selectContract = contract([
|
|
657
|
-
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
658
|
-
]);
|
|
659
|
-
var optgroupContract = contract([
|
|
660
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
661
|
-
]);
|
|
662
|
-
var datalistContract = contract([
|
|
663
|
-
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
664
|
-
]);
|
|
665
|
-
var pictureContract = contract([
|
|
666
|
-
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
667
|
-
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
668
|
-
]);
|
|
669
|
-
var figureContract = contract([
|
|
670
|
-
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
671
|
-
{ name: "content", match: isOpenContent("figcaption") }
|
|
672
|
-
]);
|
|
673
|
-
var detailsContract = firstChildContract("summary", "summary");
|
|
674
|
-
var fieldsetContract = firstChildContract("legend", "legend");
|
|
675
|
-
var mediaContract = contract([
|
|
676
|
-
{ name: "source", match: isTag("source") },
|
|
677
|
-
{ name: "track", match: isTag("track") },
|
|
678
|
-
metadata(),
|
|
679
|
-
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
680
|
-
]);
|
|
681
|
-
var headContract = contract([
|
|
682
|
-
{
|
|
683
|
-
name: "metadata",
|
|
684
|
-
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
685
|
-
}
|
|
686
|
-
]);
|
|
687
|
-
var htmlContract = contract([
|
|
688
|
-
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
689
|
-
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
690
|
-
]);
|
|
691
|
-
var voidContract = contract([]);
|
|
692
|
-
var textOnlyContract = contract([
|
|
693
|
-
{
|
|
694
|
-
name: "text",
|
|
695
|
-
match: (child) => isString(child) || isNumber(child)
|
|
696
|
-
}
|
|
697
|
-
]);
|
|
698
|
-
var LANDMARK_TAG_SET = new Set(LANDMARK_TAGS);
|
|
699
|
-
var removeLandmarkRoleOverride = {
|
|
700
|
-
kind: "removeRole",
|
|
701
|
-
apply: ({ props }) => {
|
|
702
|
-
if (!("role" in props)) return { applied: false, next: props };
|
|
703
|
-
const { role: _r, ...rest } = props;
|
|
704
|
-
return { applied: true, next: rest, previous: props };
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
708
|
-
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
709
|
-
const role = props.role;
|
|
710
|
-
if (!role || role === implicitRole) return [];
|
|
711
|
-
return [
|
|
712
|
-
{
|
|
713
|
-
valid: false,
|
|
714
|
-
fixable: true,
|
|
715
|
-
severity: "error",
|
|
716
|
-
fix: removeLandmarkRoleOverride,
|
|
717
|
-
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
718
|
-
}
|
|
719
|
-
];
|
|
720
|
-
}
|
|
721
|
-
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
722
|
-
var CONTRACT_GROUPS = [
|
|
723
|
-
[VOID_TAGS, voidContract],
|
|
724
|
-
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
725
|
-
[LANDMARK_TAGS, landmarkContract],
|
|
726
|
-
[["ul", "ol", "menu"], listContract],
|
|
727
|
-
[["audio", "video"], mediaContract],
|
|
728
|
-
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
729
|
-
];
|
|
730
|
-
function contractMap(groups) {
|
|
731
|
-
return Object.fromEntries(
|
|
732
|
-
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
733
|
-
);
|
|
734
|
-
}
|
|
735
|
-
var htmlContracts = {
|
|
736
|
-
...contractMap(CONTRACT_GROUPS),
|
|
737
|
-
table: tableContract,
|
|
738
|
-
tr: tableRowContract,
|
|
739
|
-
colgroup: colgroupContract,
|
|
740
|
-
dl: dlContract,
|
|
741
|
-
select: selectContract,
|
|
742
|
-
optgroup: optgroupContract,
|
|
743
|
-
datalist: datalistContract,
|
|
744
|
-
picture: pictureContract,
|
|
745
|
-
figure: figureContract,
|
|
746
|
-
details: detailsContract,
|
|
747
|
-
fieldset: fieldsetContract,
|
|
748
|
-
head: headContract,
|
|
749
|
-
html: htmlContract
|
|
750
|
-
};
|
|
580
|
+
// ../core/dist/chunk-VU44HAB7.js
|
|
751
581
|
var IMPLICIT_ROLE_RECORD2 = {
|
|
752
582
|
article: "article",
|
|
753
583
|
aside: "complementary",
|
|
@@ -776,6 +606,27 @@ function getImplicitRole(tag) {
|
|
|
776
606
|
if (tag in IMPLICIT_ROLE_RECORD2) return IMPLICIT_ROLE_RECORD2[tag];
|
|
777
607
|
return void 0;
|
|
778
608
|
}
|
|
609
|
+
var COMPONENT_DEFAULT_TAG = /* @__PURE__ */ Symbol("praxis.component-default-tag");
|
|
610
|
+
function resolveChildTag(child) {
|
|
611
|
+
if (!isObject(child) || !("type" in child)) return void 0;
|
|
612
|
+
const t = child.type;
|
|
613
|
+
if (isString(t)) return t;
|
|
614
|
+
if (isObject(t) && COMPONENT_DEFAULT_TAG in t) {
|
|
615
|
+
const defaultTag = t[COMPONENT_DEFAULT_TAG];
|
|
616
|
+
if (!isString(defaultTag)) return void 0;
|
|
617
|
+
const props = child.props;
|
|
618
|
+
const as = isObject(props) && "as" in props ? props.as : void 0;
|
|
619
|
+
return isString(as) ? as : defaultTag;
|
|
620
|
+
}
|
|
621
|
+
return void 0;
|
|
622
|
+
}
|
|
623
|
+
function isTag(...tags) {
|
|
624
|
+
const set = new Set(tags);
|
|
625
|
+
return (child) => {
|
|
626
|
+
const tag = resolveChildTag(child);
|
|
627
|
+
return tag !== void 0 && set.has(tag);
|
|
628
|
+
};
|
|
629
|
+
}
|
|
779
630
|
var pendingAsyncWarns2 = /* @__PURE__ */ new Set();
|
|
780
631
|
var asyncWarnScheduled2 = false;
|
|
781
632
|
function flushAsyncWarns2() {
|
|
@@ -1445,8 +1296,223 @@ var ChildrenEvaluator = class extends StrictBase {
|
|
|
1445
1296
|
this.invariant(errors.length === 0, this.#matchBuilder.toError(errors).message);
|
|
1446
1297
|
}
|
|
1447
1298
|
};
|
|
1299
|
+
var disabledProps = ({
|
|
1300
|
+
disabled,
|
|
1301
|
+
"aria-disabled": ariaDisabled,
|
|
1302
|
+
"data-disabled": dataDisabled
|
|
1303
|
+
}) => {
|
|
1304
|
+
if (!disabled) return {};
|
|
1305
|
+
return {
|
|
1306
|
+
...ariaDisabled === void 0 && { "aria-disabled": "true" },
|
|
1307
|
+
...dataDisabled === void 0 && { "data-disabled": "" }
|
|
1308
|
+
};
|
|
1309
|
+
};
|
|
1310
|
+
var invalidProps = ({
|
|
1311
|
+
invalid,
|
|
1312
|
+
"aria-invalid": ariaInvalid,
|
|
1313
|
+
"data-invalid": dataInvalid
|
|
1314
|
+
}) => {
|
|
1315
|
+
if (!invalid) return {};
|
|
1316
|
+
return {
|
|
1317
|
+
...ariaInvalid === void 0 && { "aria-invalid": "true" },
|
|
1318
|
+
...dataInvalid === void 0 && { "data-invalid": "" }
|
|
1319
|
+
};
|
|
1320
|
+
};
|
|
1321
|
+
var readonlyProps = ({
|
|
1322
|
+
readOnly,
|
|
1323
|
+
"aria-readonly": ariaReadonly,
|
|
1324
|
+
"data-readonly": dataReadonly
|
|
1325
|
+
}) => {
|
|
1326
|
+
if (!readOnly) return {};
|
|
1327
|
+
return {
|
|
1328
|
+
...ariaReadonly === void 0 && {
|
|
1329
|
+
"aria-readonly": "true"
|
|
1330
|
+
},
|
|
1331
|
+
...dataReadonly === void 0 && {
|
|
1332
|
+
"data-readonly": ""
|
|
1333
|
+
}
|
|
1334
|
+
};
|
|
1335
|
+
};
|
|
1336
|
+
var LANDMARK_TAG_SET = /* @__PURE__ */ new Set(["article", "aside", "footer", "header", "main", "nav"]);
|
|
1337
|
+
var removeLandmarkRoleOverride = {
|
|
1338
|
+
kind: "removeRole",
|
|
1339
|
+
apply: ({ props }) => {
|
|
1340
|
+
if (!("role" in props)) return { applied: false, next: props };
|
|
1341
|
+
const { role: _r, ...rest } = props;
|
|
1342
|
+
return { applied: true, next: rest, previous: props };
|
|
1343
|
+
}
|
|
1344
|
+
};
|
|
1345
|
+
function landmarkRoleRule({ tag, props, implicitRole }) {
|
|
1346
|
+
if (!LANDMARK_TAG_SET.has(tag) || !implicitRole) return [];
|
|
1347
|
+
const role = props.role;
|
|
1348
|
+
if (!role || role === implicitRole) return [];
|
|
1349
|
+
return [
|
|
1350
|
+
{
|
|
1351
|
+
valid: false,
|
|
1352
|
+
fixable: true,
|
|
1353
|
+
severity: "error",
|
|
1354
|
+
fix: removeLandmarkRoleOverride,
|
|
1355
|
+
message: `<${tag}> has a fixed landmark role="${implicitRole}". role="${role}" overrides it and confuses assistive technology. The override has been removed.`
|
|
1356
|
+
}
|
|
1357
|
+
];
|
|
1358
|
+
}
|
|
1359
|
+
var HTML_ARIA_RULES = [landmarkRoleRule];
|
|
1360
|
+
function isOpenContent(...blockedTags) {
|
|
1361
|
+
const set = new Set(blockedTags);
|
|
1362
|
+
return (child) => isObject(child) && "type" in child && (!isString(child.type) || !set.has(child.type));
|
|
1363
|
+
}
|
|
1364
|
+
var METADATA_TAGS = ["script", "template"];
|
|
1365
|
+
var metadataMatch = isTag(...METADATA_TAGS);
|
|
1366
|
+
function metadata(name = "metadata") {
|
|
1367
|
+
return { name, match: metadataMatch };
|
|
1368
|
+
}
|
|
1369
|
+
function firstOptional(name, tag) {
|
|
1370
|
+
return { name, match: isTag(tag), cardinality: { max: 1 }, position: "first" };
|
|
1371
|
+
}
|
|
1372
|
+
function contract(children) {
|
|
1373
|
+
return { strict: "warn", children };
|
|
1374
|
+
}
|
|
1375
|
+
function ariaContract(aria) {
|
|
1376
|
+
return { strict: "warn", aria };
|
|
1377
|
+
}
|
|
1378
|
+
function firstChildContract(name, tag) {
|
|
1379
|
+
return contract([firstOptional(name, tag), { name: "content", match: isOpenContent(tag) }]);
|
|
1380
|
+
}
|
|
1381
|
+
var VOID_TAGS = [
|
|
1382
|
+
"area",
|
|
1383
|
+
"base",
|
|
1384
|
+
"br",
|
|
1385
|
+
"col",
|
|
1386
|
+
"embed",
|
|
1387
|
+
"hr",
|
|
1388
|
+
"img",
|
|
1389
|
+
"input",
|
|
1390
|
+
"link",
|
|
1391
|
+
"meta",
|
|
1392
|
+
"param",
|
|
1393
|
+
"source",
|
|
1394
|
+
"track",
|
|
1395
|
+
"wbr"
|
|
1396
|
+
];
|
|
1397
|
+
var TEXT_ONLY_TAGS = ["option", "script", "style", "textarea", "title"];
|
|
1398
|
+
var LANDMARK_TAGS = ["article", "aside", "footer", "header", "main", "nav"];
|
|
1399
|
+
var listContract = contract([{ name: "list-item", match: isTag("li", ...METADATA_TAGS) }]);
|
|
1400
|
+
var tableContract = contract([
|
|
1401
|
+
firstOptional("caption", "caption"),
|
|
1402
|
+
{ name: "colgroup", match: isTag("colgroup") },
|
|
1403
|
+
{ name: "thead", match: isTag("thead"), cardinality: { max: 1 } },
|
|
1404
|
+
{ name: "tbody", match: isTag("tbody") },
|
|
1405
|
+
{ name: "tfoot", match: isTag("tfoot"), cardinality: { max: 1 } },
|
|
1406
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1407
|
+
]);
|
|
1408
|
+
var tableBodyContract = contract([
|
|
1409
|
+
{ name: "table-row", match: isTag("tr", ...METADATA_TAGS) }
|
|
1410
|
+
]);
|
|
1411
|
+
var tableRowContract = contract([
|
|
1412
|
+
{ name: "table-cell", match: isTag("td", "th", ...METADATA_TAGS) }
|
|
1413
|
+
]);
|
|
1414
|
+
var colgroupContract = contract([{ name: "column", match: isTag("col", "template") }]);
|
|
1415
|
+
var dlContract = contract([
|
|
1416
|
+
{ name: "term", match: isTag("dt") },
|
|
1417
|
+
{ name: "description", match: isTag("dd") },
|
|
1418
|
+
{ name: "group", match: isTag("div") },
|
|
1419
|
+
metadata()
|
|
1420
|
+
]);
|
|
1421
|
+
var selectContract = contract([
|
|
1422
|
+
{ name: "option", match: isTag("option", "optgroup", "hr", ...METADATA_TAGS) }
|
|
1423
|
+
]);
|
|
1424
|
+
var optgroupContract = contract([
|
|
1425
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1426
|
+
]);
|
|
1427
|
+
var datalistContract = contract([
|
|
1428
|
+
{ name: "option", match: isTag("option", ...METADATA_TAGS) }
|
|
1429
|
+
]);
|
|
1430
|
+
var pictureContract = contract([
|
|
1431
|
+
{ name: "source", match: isTag("source", ...METADATA_TAGS) },
|
|
1432
|
+
{ name: "image", match: isTag("img"), cardinality: { min: 1, max: 1 }, position: "last" }
|
|
1433
|
+
]);
|
|
1434
|
+
var figureContract = contract([
|
|
1435
|
+
{ name: "caption", match: isTag("figcaption"), cardinality: { max: 1 } },
|
|
1436
|
+
{ name: "content", match: isOpenContent("figcaption") }
|
|
1437
|
+
]);
|
|
1438
|
+
var detailsContract = firstChildContract("summary", "summary");
|
|
1439
|
+
var fieldsetContract = firstChildContract("legend", "legend");
|
|
1440
|
+
var mediaContract = contract([
|
|
1441
|
+
{ name: "source", match: isTag("source") },
|
|
1442
|
+
{ name: "track", match: isTag("track") },
|
|
1443
|
+
metadata(),
|
|
1444
|
+
{ name: "content", match: isOpenContent("source", "track", ...METADATA_TAGS) }
|
|
1445
|
+
]);
|
|
1446
|
+
var headContract = contract([
|
|
1447
|
+
{
|
|
1448
|
+
name: "metadata",
|
|
1449
|
+
match: isTag("base", "link", "meta", "noscript", "script", "style", "template", "title")
|
|
1450
|
+
}
|
|
1451
|
+
]);
|
|
1452
|
+
var htmlContract = contract([
|
|
1453
|
+
{ name: "head", match: isTag("head"), cardinality: { min: 1, max: 1 }, position: "first" },
|
|
1454
|
+
{ name: "body", match: isTag("body"), cardinality: { min: 1, max: 1 } }
|
|
1455
|
+
]);
|
|
1456
|
+
var voidContract = contract([]);
|
|
1457
|
+
var textOnlyContract = contract([
|
|
1458
|
+
{
|
|
1459
|
+
name: "text",
|
|
1460
|
+
match: (child) => isString(child) || isNumber(child)
|
|
1461
|
+
}
|
|
1462
|
+
]);
|
|
1463
|
+
var landmarkContract = ariaContract([landmarkRoleRule]);
|
|
1464
|
+
var CONTRACT_GROUPS = [
|
|
1465
|
+
[VOID_TAGS, voidContract],
|
|
1466
|
+
[TEXT_ONLY_TAGS, textOnlyContract],
|
|
1467
|
+
[LANDMARK_TAGS, landmarkContract],
|
|
1468
|
+
[["ul", "ol", "menu"], listContract],
|
|
1469
|
+
[["audio", "video"], mediaContract],
|
|
1470
|
+
[["thead", "tbody", "tfoot"], tableBodyContract]
|
|
1471
|
+
];
|
|
1472
|
+
function contractMap(groups) {
|
|
1473
|
+
return Object.fromEntries(
|
|
1474
|
+
groups.flatMap(([tags, enforcement]) => tags.map((tag) => [tag, enforcement]))
|
|
1475
|
+
);
|
|
1476
|
+
}
|
|
1477
|
+
var htmlContracts = {
|
|
1478
|
+
...contractMap(CONTRACT_GROUPS),
|
|
1479
|
+
table: tableContract,
|
|
1480
|
+
tr: tableRowContract,
|
|
1481
|
+
colgroup: colgroupContract,
|
|
1482
|
+
dl: dlContract,
|
|
1483
|
+
select: selectContract,
|
|
1484
|
+
optgroup: optgroupContract,
|
|
1485
|
+
datalist: datalistContract,
|
|
1486
|
+
picture: pictureContract,
|
|
1487
|
+
figure: figureContract,
|
|
1488
|
+
details: detailsContract,
|
|
1489
|
+
fieldset: fieldsetContract,
|
|
1490
|
+
head: headContract,
|
|
1491
|
+
html: htmlContract
|
|
1492
|
+
};
|
|
1493
|
+
function buildEvaluatorMap() {
|
|
1494
|
+
const map = /* @__PURE__ */ new Map();
|
|
1495
|
+
for (const [tag, { children }] of Object.entries(htmlContracts)) {
|
|
1496
|
+
if (children?.length) {
|
|
1497
|
+
map.set(tag, new ChildrenEvaluator(children, "warn", `<${tag}>`));
|
|
1498
|
+
}
|
|
1499
|
+
}
|
|
1500
|
+
return map;
|
|
1501
|
+
}
|
|
1502
|
+
var HTML_EVALUATORS = buildEvaluatorMap();
|
|
1503
|
+
var HTML_FORM_NORMALIZERS = /* @__PURE__ */ new Map([
|
|
1504
|
+
["button", [disabledProps]],
|
|
1505
|
+
["input", [disabledProps, readonlyProps, invalidProps]],
|
|
1506
|
+
["select", [disabledProps]],
|
|
1507
|
+
["textarea", [disabledProps, readonlyProps]],
|
|
1508
|
+
["fieldset", [disabledProps]],
|
|
1509
|
+
["optgroup", [disabledProps]]
|
|
1510
|
+
]);
|
|
1511
|
+
function getHtmlPropNormalizers(tag) {
|
|
1512
|
+
return typeof tag === "string" ? HTML_FORM_NORMALIZERS.get(tag) : void 0;
|
|
1513
|
+
}
|
|
1448
1514
|
|
|
1449
|
-
// ../core/dist/chunk-
|
|
1515
|
+
// ../core/dist/chunk-EHCOMLJ4.js
|
|
1450
1516
|
var falsyToString = (value) => typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
1451
1517
|
var cx = clsx;
|
|
1452
1518
|
var cva = (base, config) => (props) => {
|
|
@@ -1612,7 +1678,12 @@ function createClassPipeline(resolved) {
|
|
|
1612
1678
|
}
|
|
1613
1679
|
|
|
1614
1680
|
// ../core/dist/index.js
|
|
1615
|
-
var FULL_CAPABILITIES = {
|
|
1681
|
+
var FULL_CAPABILITIES = {
|
|
1682
|
+
createClassPipeline,
|
|
1683
|
+
AriaEngine: AriaPolicyEngine,
|
|
1684
|
+
htmlAriaRules: HTML_ARIA_RULES,
|
|
1685
|
+
htmlPropNormalizersFn: getHtmlPropNormalizers
|
|
1686
|
+
};
|
|
1616
1687
|
function createPolymorphic2(options = {}) {
|
|
1617
1688
|
return createPolymorphic(options, FULL_CAPABILITIES);
|
|
1618
1689
|
}
|
|
@@ -1746,13 +1817,16 @@ function resolveHostState(bundle, props) {
|
|
|
1746
1817
|
const { as, className, variantKey, ...rest } = props;
|
|
1747
1818
|
const tag = bundle.runtime.resolveTag(as);
|
|
1748
1819
|
const mergedProps = bundle.runtime.resolveProps(rest);
|
|
1820
|
+
const baseProps = bundle.runtime.options.normalizeFn ? bundle.runtime.options.normalizeFn(mergedProps) : mergedProps;
|
|
1821
|
+
const htmlNormalizers = bundle.runtime.options.htmlPropNormalizersFn?.(tag);
|
|
1822
|
+
const normalizedProps = htmlNormalizers?.length ? htmlNormalizers.reduce((acc, fn) => ({ ...acc, ...fn(acc) }), baseProps) : baseProps;
|
|
1749
1823
|
const resolvedClass = bundle.runtime.resolveClasses(
|
|
1750
1824
|
tag,
|
|
1751
|
-
|
|
1825
|
+
normalizedProps,
|
|
1752
1826
|
className,
|
|
1753
1827
|
variantKey
|
|
1754
1828
|
);
|
|
1755
|
-
const ariaResult = bundle.runtime.resolveAria(tag,
|
|
1829
|
+
const ariaResult = bundle.runtime.resolveAria(tag, normalizedProps);
|
|
1756
1830
|
const attributes = applyFilter(
|
|
1757
1831
|
ariaResult.props,
|
|
1758
1832
|
bundle.filterProps,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "praxis-kit",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./react": {
|
|
@@ -54,6 +54,10 @@
|
|
|
54
54
|
"./codemod": {
|
|
55
55
|
"types": "./dist/codemod/index.d.ts",
|
|
56
56
|
"import": "./dist/codemod/index.js"
|
|
57
|
+
},
|
|
58
|
+
"./contract": {
|
|
59
|
+
"types": "./dist/contract/index.d.ts",
|
|
60
|
+
"import": "./dist/contract/index.js"
|
|
57
61
|
}
|
|
58
62
|
},
|
|
59
63
|
"bin": {
|
|
@@ -126,8 +130,8 @@
|
|
|
126
130
|
"vite": "^8.0.16",
|
|
127
131
|
"vue": "^3.5.38",
|
|
128
132
|
"@praxis-kit/adapter-utils": "0.0.0",
|
|
129
|
-
"@praxis-kit/
|
|
130
|
-
"@praxis-kit/
|
|
133
|
+
"@praxis-kit/core": "0.8.0-beta.4",
|
|
134
|
+
"@praxis-kit/shared": "0.8.0-beta.4"
|
|
131
135
|
},
|
|
132
136
|
"publishConfig": {
|
|
133
137
|
"access": "public"
|