@plasmicpkgs/antd5 0.0.37 → 0.0.39
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/.tsbuildinfo +1 -1
- package/dist/antd.esm.js +47 -89
- package/dist/antd.esm.js.map +1 -1
- package/dist/index.js +47 -89
- package/dist/registerConfigProvider.d.ts +0 -2
- package/package.json +3 -3
- package/skinny/registerConfigProvider.d.ts +0 -2
- package/skinny/registerConfigProvider.js +41 -86
- package/skinny/registerConfigProvider.js.map +1 -1
- package/skinny/registerForm.js +6 -3
- package/skinny/registerForm.js.map +1 -1
package/dist/antd.esm.js
CHANGED
|
@@ -357,10 +357,9 @@ function themeToAntdConfig(opts) {
|
|
|
357
357
|
controlHeight,
|
|
358
358
|
sizeUnit,
|
|
359
359
|
sizeStep,
|
|
360
|
-
wireframe
|
|
361
|
-
spacing
|
|
360
|
+
wireframe
|
|
362
361
|
} = opts;
|
|
363
|
-
return
|
|
362
|
+
return {
|
|
364
363
|
theme: {
|
|
365
364
|
token: Object.fromEntries(Object.entries({
|
|
366
365
|
colorTextBase,
|
|
@@ -378,7 +377,7 @@ function themeToAntdConfig(opts) {
|
|
|
378
377
|
wireframe
|
|
379
378
|
}).filter(([_key, val]) => !!val))
|
|
380
379
|
}
|
|
381
|
-
}
|
|
380
|
+
};
|
|
382
381
|
}
|
|
383
382
|
function AntdConfigProvider(props) {
|
|
384
383
|
const _a = props, { children, themeStyles } = _a, rest = __objRest$6(_a, ["children", "themeStyles"]);
|
|
@@ -391,13 +390,22 @@ function AntdConfigProvider(props) {
|
|
|
391
390
|
colorTextBase: themeStyles.color
|
|
392
391
|
}))), /* @__PURE__ */ React.createElement(ForkedApp, null, /* @__PURE__ */ React.createElement(InnerConfigProvider, null, children)));
|
|
393
392
|
}
|
|
393
|
+
function normTokenValue(val) {
|
|
394
|
+
if (typeof val === "string") {
|
|
395
|
+
return val.trim();
|
|
396
|
+
} else if (typeof val === "number") {
|
|
397
|
+
return `${val}px`;
|
|
398
|
+
} else {
|
|
399
|
+
return val;
|
|
400
|
+
}
|
|
401
|
+
}
|
|
394
402
|
function InnerConfigProvider(props) {
|
|
395
403
|
const { children } = props;
|
|
396
404
|
const { token } = theme.useToken();
|
|
397
405
|
const makeVarName = (name) => `--antd-${name}`;
|
|
398
406
|
const cssStyles = React.useMemo(() => `
|
|
399
407
|
:root {
|
|
400
|
-
${Object.entries(token).map(([key, val]) => `${makeVarName(key)}:${
|
|
408
|
+
${Object.entries(token).map(([key, val]) => `${makeVarName(key)}:${normTokenValue(val)};`).join("\n")}
|
|
401
409
|
}
|
|
402
410
|
`, [token]);
|
|
403
411
|
const app = useAppContext();
|
|
@@ -414,7 +422,9 @@ function InnerConfigProvider(props) {
|
|
|
414
422
|
if (!GlobalActionsProvider) {
|
|
415
423
|
warnOutdatedDeps();
|
|
416
424
|
}
|
|
417
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style",
|
|
425
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", {
|
|
426
|
+
dangerouslySetInnerHTML: { __html: cssStyles }
|
|
427
|
+
}), GlobalActionsProvider ? /* @__PURE__ */ React.createElement(GlobalActionsProvider, {
|
|
418
428
|
contextName: "plasmic-antd5-config-provider",
|
|
419
429
|
actions
|
|
420
430
|
}, children) : children, /* @__PURE__ */ React.createElement(GlobalLoadingIndicator, null));
|
|
@@ -470,20 +480,27 @@ function ForkedApp(props) {
|
|
|
470
480
|
}
|
|
471
481
|
function registerTokens(loader) {
|
|
472
482
|
const regs = [];
|
|
473
|
-
const
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
value: `var(--antd-${name})`,
|
|
480
|
-
type: "color"
|
|
481
|
-
};
|
|
483
|
+
const withoutPrefix = (name, prefix) => {
|
|
484
|
+
if (!prefix) {
|
|
485
|
+
return name;
|
|
486
|
+
}
|
|
487
|
+
const index = name.indexOf(prefix);
|
|
488
|
+
return index === 0 ? name.substring(prefix.length) : name;
|
|
482
489
|
};
|
|
483
490
|
function makeNiceName(name) {
|
|
484
491
|
name = name[0].toUpperCase() + name.substring(1);
|
|
485
492
|
return name.replace(/([a-z])([A-Z])/g, "$1 $2");
|
|
486
493
|
}
|
|
494
|
+
const makeGenericToken = (name, type, removePrefix) => {
|
|
495
|
+
const tokenName = Array.isArray(name) ? name[0] : name;
|
|
496
|
+
const displayName = Array.isArray(name) ? name[1] : makeNiceName(withoutPrefix(name, removePrefix));
|
|
497
|
+
return {
|
|
498
|
+
name: tokenName,
|
|
499
|
+
displayName: `System: ${displayName}`,
|
|
500
|
+
value: `var(--antd-${tokenName})`,
|
|
501
|
+
type
|
|
502
|
+
};
|
|
503
|
+
};
|
|
487
504
|
const colorTokens = [
|
|
488
505
|
"colorPrimary",
|
|
489
506
|
"colorSuccess",
|
|
@@ -551,91 +568,32 @@ function registerTokens(loader) {
|
|
|
551
568
|
"colorErrorTextActive",
|
|
552
569
|
"colorWhite",
|
|
553
570
|
"colorBgMask",
|
|
554
|
-
"colorFillContentHover",
|
|
555
|
-
"colorFillAlter",
|
|
556
|
-
"colorFillContent",
|
|
557
|
-
"colorBgContainerDisabled",
|
|
558
|
-
"colorBgTextHover",
|
|
559
|
-
"colorBgTextActive",
|
|
560
|
-
"colorBorderBg",
|
|
561
|
-
"colorSplit",
|
|
562
|
-
"colorTextPlaceholder",
|
|
563
|
-
"colorTextDisabled",
|
|
564
|
-
"colorTextHeading",
|
|
565
|
-
"colorTextLabel",
|
|
566
|
-
"colorTextDescription",
|
|
567
|
-
"colorTextLightSolid",
|
|
568
571
|
"colorIcon",
|
|
569
572
|
"colorIconHover",
|
|
570
573
|
"colorLink",
|
|
571
|
-
"colorLinkHover"
|
|
572
|
-
"colorLinkActive",
|
|
573
|
-
"colorLinkHighlight",
|
|
574
|
-
"controlOutline",
|
|
575
|
-
"controlWarningOutline",
|
|
576
|
-
"controlErrorOutline",
|
|
577
|
-
"controlItemBgHover",
|
|
578
|
-
"controlItemBgActive",
|
|
579
|
-
"controlItemBgActiveHover",
|
|
580
|
-
"controlItemBgActiveDisabled"
|
|
574
|
+
"colorLinkHover"
|
|
581
575
|
];
|
|
582
|
-
colorTokens.forEach((name) => regs.push(
|
|
583
|
-
const makeGenericToken = (name, type) => {
|
|
584
|
-
return {
|
|
585
|
-
name: `Sys: ${makeNiceName(name)}`,
|
|
586
|
-
value: `var(--antd-${name})`,
|
|
587
|
-
type
|
|
588
|
-
};
|
|
589
|
-
};
|
|
576
|
+
colorTokens.forEach((name) => regs.push(makeGenericToken(name, "color", "color")));
|
|
590
577
|
const spacingTokens = [
|
|
591
|
-
"lineWidth",
|
|
592
|
-
"borderRadius",
|
|
593
|
-
"controlHeight",
|
|
594
|
-
"sizeXXL",
|
|
595
|
-
"sizeXL",
|
|
596
|
-
"sizeLG",
|
|
597
|
-
"sizeMD",
|
|
598
|
-
"sizeMS",
|
|
599
|
-
"size",
|
|
600
|
-
"sizeSM",
|
|
601
|
-
"sizeXS",
|
|
602
|
-
"sizeXXS",
|
|
603
|
-
"controlHeightXS",
|
|
604
|
-
"controlHeightSM",
|
|
605
|
-
"controlHeightLG",
|
|
606
|
-
"lineWidthBold",
|
|
607
|
-
"borderRadiusXS",
|
|
608
|
-
"borderRadiusSM",
|
|
609
|
-
"borderRadiusLG",
|
|
610
|
-
"borderRadiusOuter",
|
|
611
|
-
"controlOutlineWidth",
|
|
612
|
-
"controlInteractiveSize",
|
|
613
578
|
"paddingXXS",
|
|
614
579
|
"paddingXS",
|
|
615
580
|
"paddingSM",
|
|
616
|
-
"padding",
|
|
581
|
+
["padding", "Padding M"],
|
|
617
582
|
"paddingMD",
|
|
618
583
|
"paddingLG",
|
|
619
584
|
"paddingXL",
|
|
620
|
-
"paddingContentHorizontalLG",
|
|
621
|
-
"paddingContentHorizontal",
|
|
622
|
-
"paddingContentHorizontalSM",
|
|
623
|
-
"paddingContentVerticalLG",
|
|
624
|
-
"paddingContentVertical",
|
|
625
|
-
"paddingContentVerticalSM",
|
|
626
585
|
"marginXXS",
|
|
627
586
|
"marginXS",
|
|
628
587
|
"marginSM",
|
|
629
|
-
"margin",
|
|
588
|
+
["margin", "Margin M"],
|
|
630
589
|
"marginMD",
|
|
631
590
|
"marginLG",
|
|
632
591
|
"marginXL",
|
|
633
|
-
"marginXXL"
|
|
634
|
-
"controlPaddingHorizontal",
|
|
635
|
-
"controlPaddingHorizontalSM"
|
|
592
|
+
"marginXXL"
|
|
636
593
|
];
|
|
637
594
|
spacingTokens.forEach((token) => regs.push(makeGenericToken(token, "spacing")));
|
|
638
595
|
const fontSizeTokens = [
|
|
596
|
+
["fontSize", "M"],
|
|
639
597
|
"fontSizeSM",
|
|
640
598
|
"fontSizeLG",
|
|
641
599
|
"fontSizeXL",
|
|
@@ -645,8 +603,9 @@ function registerTokens(loader) {
|
|
|
645
603
|
"fontSizeHeading4",
|
|
646
604
|
"fontSizeHeading5"
|
|
647
605
|
];
|
|
648
|
-
fontSizeTokens.forEach((token) => regs.push(makeGenericToken(token, "font-size")));
|
|
606
|
+
fontSizeTokens.forEach((token) => regs.push(makeGenericToken(token, "font-size", "fontSize")));
|
|
649
607
|
const lineHeightTokens = [
|
|
608
|
+
["lineHeight", "M"],
|
|
650
609
|
"lineHeightLG",
|
|
651
610
|
"lineHeightSM",
|
|
652
611
|
"lineHeightHeading1",
|
|
@@ -655,7 +614,7 @@ function registerTokens(loader) {
|
|
|
655
614
|
"lineHeightHeading4",
|
|
656
615
|
"lineHeightHeading5"
|
|
657
616
|
];
|
|
658
|
-
lineHeightTokens.forEach((token) => regs.push(makeGenericToken(token, "line-height")));
|
|
617
|
+
lineHeightTokens.forEach((token) => regs.push(makeGenericToken(token, "line-height", "lineHeight")));
|
|
659
618
|
if (loader) {
|
|
660
619
|
regs.forEach((t) => loader.registerToken(t));
|
|
661
620
|
} else {
|
|
@@ -714,10 +673,6 @@ const registerConfigProvider = makeRegisterGlobalContext(AntdConfigProvider, __s
|
|
|
714
673
|
type: "boolean",
|
|
715
674
|
defaultValue: false
|
|
716
675
|
},
|
|
717
|
-
spacing: {
|
|
718
|
-
type: "choice",
|
|
719
|
-
options: ["small", "middle", "large"]
|
|
720
|
-
},
|
|
721
676
|
themeStyles: {
|
|
722
677
|
type: "themeStyles"
|
|
723
678
|
}
|
|
@@ -1401,9 +1356,6 @@ function registerFormItem(loader) {
|
|
|
1401
1356
|
initialValue: {
|
|
1402
1357
|
type: "string"
|
|
1403
1358
|
},
|
|
1404
|
-
required: {
|
|
1405
|
-
type: "boolean"
|
|
1406
|
-
},
|
|
1407
1359
|
rules: {
|
|
1408
1360
|
type: "formValidationRules"
|
|
1409
1361
|
},
|
|
@@ -1440,6 +1392,12 @@ function registerFormItem(loader) {
|
|
|
1440
1392
|
displayName: "Always re-render",
|
|
1441
1393
|
description: "Form items normally only re-render when the corresponding form value changes, for performance. This forces it to always re-render."
|
|
1442
1394
|
},
|
|
1395
|
+
dependencies: {
|
|
1396
|
+
type: "array",
|
|
1397
|
+
advanced: true,
|
|
1398
|
+
displayName: "Dependencies",
|
|
1399
|
+
description: "Form items can depend on other form items. This forces it to reevaluate the validation rules when the other form item changes."
|
|
1400
|
+
},
|
|
1443
1401
|
helpTextMode: {
|
|
1444
1402
|
type: "choice",
|
|
1445
1403
|
displayName: "Help text",
|