@urbicon-ui/blocks 6.34.0 → 6.35.0
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/README.md +11 -1
- package/dist/components/Calendar/CalendarHeader.svelte +32 -26
- package/dist/components/Calendar/CalendarMiniMonth.svelte +10 -10
- package/dist/components/Calendar/calendar.variants.js +19 -5
- package/dist/components/FileUpload/FileUpload.svelte +17 -2
- package/dist/components/Planner/PlannerHeader.svelte +16 -13
- package/dist/components/Planner/planner.variants.js +14 -3
- package/dist/i18n/index.d.ts +268 -382
- package/dist/i18n/index.js +83 -9
- package/dist/internal/core/CoreIconButton.svelte +66 -0
- package/dist/internal/core/CoreIconButton.svelte.d.ts +13 -0
- package/dist/internal/core/CoreSpinner.svelte +49 -0
- package/dist/internal/core/CoreSpinner.svelte.d.ts +8 -0
- package/dist/internal/core/spinner-geometry.d.ts +6 -0
- package/dist/internal/core/spinner-geometry.js +6 -0
- package/dist/mint/registry.d.ts +20 -2
- package/dist/mint/registry.js +20 -2
- package/dist/primitives/Badge/Badge.svelte +5 -5
- package/dist/primitives/Badge/badge.variants.js +17 -1
- package/dist/primitives/Button/Button.svelte +4 -2
- package/dist/primitives/Dialog/Dialog.svelte +7 -5
- package/dist/primitives/Dialog/dialog.variants.d.ts +7 -0
- package/dist/primitives/Dialog/dialog.variants.js +17 -0
- package/dist/primitives/Drawer/Drawer.svelte +7 -5
- package/dist/primitives/Drawer/drawer.variants.d.ts +8 -0
- package/dist/primitives/Drawer/drawer.variants.js +17 -0
- package/dist/primitives/Spinner/Spinner.svelte +3 -1
- package/dist/primitives/Toast/Toaster.svelte +17 -2
- package/dist/utils/variants.js +44 -10
- package/package.json +4 -6
package/dist/utils/variants.js
CHANGED
|
@@ -623,6 +623,20 @@ function resolveClassValue(value) {
|
|
|
623
623
|
* time layer (ValidSlotVariants, VariantPropsMap) catches the same class of
|
|
624
624
|
* mistakes for literal configs; this covers JS consumers and values built
|
|
625
625
|
* from imported constants.
|
|
626
|
+
*
|
|
627
|
+
* Error codes (prod builds throw the bare code to keep message bytes out of
|
|
628
|
+
* consumer bundles; reproduce in dev for the full message. Codes are stable —
|
|
629
|
+
* never renumber, append only):
|
|
630
|
+
* - tv:E1 — `base` and `slots` are mutually exclusive
|
|
631
|
+
* - tv:E2 — plain class value routes to 'base', but no 'base' slot is declared
|
|
632
|
+
* - tv:E3 — class leaf is not a string / nested array of strings
|
|
633
|
+
* - tv:E4 — slot map given, but this tv() declares no slots
|
|
634
|
+
* - tv:E5 — value targets an undeclared slot name
|
|
635
|
+
* - tv:E6 — value is neither class string, array nor slot map
|
|
636
|
+
* - tv:E7 — compoundVariants references an unknown variant axis
|
|
637
|
+
* - tv:E8 — compoundVariants matches a value the axis does not declare
|
|
638
|
+
* - tv:E9 — defaultVariants references an unknown variant axis
|
|
639
|
+
* - tv:E10 — defaultVariants value is not declared on its axis
|
|
626
640
|
*/
|
|
627
641
|
function validateTvConfig(config) {
|
|
628
642
|
const { base, slots, variants = {}, compoundVariants = [], defaultVariants = {} } = config;
|
|
@@ -630,11 +644,15 @@ function validateTvConfig(config) {
|
|
|
630
644
|
if (slotNames && base != null) {
|
|
631
645
|
// Fail loud instead of the historical silent drop (base only ever
|
|
632
646
|
// reached a slot literally named 'base').
|
|
633
|
-
throw new Error(
|
|
647
|
+
throw new Error(import.meta.env?.DEV
|
|
648
|
+
? 'tv(): `base` and `slots` are mutually exclusive — declare the primary slot as `slots.base` instead.'
|
|
649
|
+
: 'tv:E1');
|
|
634
650
|
}
|
|
635
651
|
const requireBaseSlot = (context) => {
|
|
636
652
|
if (slotNames && !slotNames.includes('base')) {
|
|
637
|
-
throw new Error(
|
|
653
|
+
throw new Error(import.meta.env?.DEV
|
|
654
|
+
? `tv(): ${context} is a plain class value, which routes to the 'base' slot — but no slot named 'base' is declared.`
|
|
655
|
+
: 'tv:E2');
|
|
638
656
|
}
|
|
639
657
|
};
|
|
640
658
|
// Leaf values must bottom out in class strings (nested arrays allowed,
|
|
@@ -652,7 +670,9 @@ function validateTvConfig(config) {
|
|
|
652
670
|
}
|
|
653
671
|
return;
|
|
654
672
|
}
|
|
655
|
-
throw new Error(
|
|
673
|
+
throw new Error(import.meta.env?.DEV
|
|
674
|
+
? `tv(): ${context} must be a class string (or nested array of strings), got ${typeof value}.`
|
|
675
|
+
: 'tv:E3');
|
|
656
676
|
};
|
|
657
677
|
const checkSlotKeys = (value, context) => {
|
|
658
678
|
if (value == null)
|
|
@@ -665,17 +685,23 @@ function validateTvConfig(config) {
|
|
|
665
685
|
}
|
|
666
686
|
if (typeof value === 'object') {
|
|
667
687
|
if (!slotNames) {
|
|
668
|
-
throw new Error(
|
|
688
|
+
throw new Error(import.meta.env?.DEV
|
|
689
|
+
? `tv(): ${context} is a slot map, but this tv() declares no slots — use a plain class string/array.`
|
|
690
|
+
: 'tv:E4');
|
|
669
691
|
}
|
|
670
692
|
for (const key of Object.keys(value)) {
|
|
671
693
|
if (!slotNames.includes(key)) {
|
|
672
|
-
throw new Error(
|
|
694
|
+
throw new Error(import.meta.env?.DEV
|
|
695
|
+
? `tv(): ${context} targets unknown slot '${key}' (declared slots: ${slotNames.join(', ')}).`
|
|
696
|
+
: 'tv:E5');
|
|
673
697
|
}
|
|
674
698
|
checkClassLeaf(value[key], `${context}.${key}`);
|
|
675
699
|
}
|
|
676
700
|
return;
|
|
677
701
|
}
|
|
678
|
-
throw new Error(
|
|
702
|
+
throw new Error(import.meta.env?.DEV
|
|
703
|
+
? `tv(): ${context} must be a class string, array or slot map, got ${typeof value}.`
|
|
704
|
+
: 'tv:E6');
|
|
679
705
|
};
|
|
680
706
|
for (const [axis, values] of Object.entries(variants)) {
|
|
681
707
|
for (const [valueName, value] of Object.entries(values)) {
|
|
@@ -688,7 +714,9 @@ function validateTvConfig(config) {
|
|
|
688
714
|
continue;
|
|
689
715
|
const axis = variants[key];
|
|
690
716
|
if (axis == null) {
|
|
691
|
-
throw new Error(
|
|
717
|
+
throw new Error(import.meta.env?.DEV
|
|
718
|
+
? `tv(): compoundVariants[${i}] references unknown variant axis '${key}'.`
|
|
719
|
+
: 'tv:E7');
|
|
692
720
|
}
|
|
693
721
|
const constraint = cv[key];
|
|
694
722
|
const values = Array.isArray(constraint) ? constraint : [constraint];
|
|
@@ -703,7 +731,9 @@ function validateTvConfig(config) {
|
|
|
703
731
|
if ((normalized === 'true' || normalized === 'false') && booleanAxis)
|
|
704
732
|
continue;
|
|
705
733
|
if (normalized == null || !(normalized in axis)) {
|
|
706
|
-
throw new Error(
|
|
734
|
+
throw new Error(import.meta.env?.DEV
|
|
735
|
+
? `tv(): compoundVariants[${i}] matches '${key}: ${String(v)}', but axis '${key}' declares no such value (values: ${Object.keys(axis).join(', ')}).`
|
|
736
|
+
: 'tv:E8');
|
|
707
737
|
}
|
|
708
738
|
}
|
|
709
739
|
}
|
|
@@ -712,14 +742,18 @@ function validateTvConfig(config) {
|
|
|
712
742
|
for (const [key, value] of Object.entries(defaultVariants)) {
|
|
713
743
|
const axis = variants[key];
|
|
714
744
|
if (axis == null) {
|
|
715
|
-
throw new Error(
|
|
745
|
+
throw new Error(import.meta.env?.DEV
|
|
746
|
+
? `tv(): defaultVariants references unknown variant axis '${key}'.`
|
|
747
|
+
: 'tv:E9');
|
|
716
748
|
}
|
|
717
749
|
const normalized = falsyToString(value);
|
|
718
750
|
const booleanAxis = 'true' in axis || 'false' in axis;
|
|
719
751
|
if ((normalized === 'true' || normalized === 'false') && booleanAxis)
|
|
720
752
|
continue;
|
|
721
753
|
if (normalized == null || !(normalized in axis)) {
|
|
722
|
-
throw new Error(
|
|
754
|
+
throw new Error(import.meta.env?.DEV
|
|
755
|
+
? `tv(): defaultVariants.${key} = '${String(value)}' is not a declared value of axis '${key}' (values: ${Object.keys(axis).join(', ')}).`
|
|
756
|
+
: 'tv:E10');
|
|
723
757
|
}
|
|
724
758
|
}
|
|
725
759
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@urbicon-ui/blocks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.35.0",
|
|
4
4
|
"description": "Svelte 5 UI component library with Tailwind CSS 4, OKLCH design tokens and zero runtime dependencies",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -79,9 +79,7 @@
|
|
|
79
79
|
},
|
|
80
80
|
"sideEffects": [
|
|
81
81
|
"./src/**/*.css",
|
|
82
|
-
"./dist/**/*.css"
|
|
83
|
-
"./dist/i18n/index.js",
|
|
84
|
-
"./dist/i18n/index.d.ts"
|
|
82
|
+
"./dist/**/*.css"
|
|
85
83
|
],
|
|
86
84
|
"peerDependencies": {
|
|
87
85
|
"svelte": "^5.56.4",
|
|
@@ -95,8 +93,8 @@
|
|
|
95
93
|
"@sveltejs/package": "^2.5.8",
|
|
96
94
|
"@sveltejs/vite-plugin-svelte": "^7.0.0",
|
|
97
95
|
"@tailwindcss/vite": "^4.3.1",
|
|
98
|
-
"@urbicon-ui/i18n": "6.
|
|
99
|
-
"@urbicon-ui/shared-types": "6.
|
|
96
|
+
"@urbicon-ui/i18n": "6.35.0",
|
|
97
|
+
"@urbicon-ui/shared-types": "6.35.0",
|
|
100
98
|
"prettier": "^3.8.4",
|
|
101
99
|
"prettier-plugin-svelte": "^4.1.1",
|
|
102
100
|
"prettier-plugin-tailwindcss": "^0.8.0",
|