resuxjs 0.2.43 → 0.3.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 +991 -666
- package/dist/cli.js +1990 -355
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapter.d.ts +17 -0
- package/dist/compiler/adapter.js +106 -0
- package/dist/compiler/adapter.js.map +1 -0
- package/dist/compiler/dev-warnings.d.ts +11 -0
- package/dist/compiler/dev-warnings.js +360 -0
- package/dist/compiler/dev-warnings.js.map +1 -0
- package/dist/compiler/directives.d.ts +13 -0
- package/dist/compiler/directives.js +167 -0
- package/dist/compiler/directives.js.map +1 -0
- package/dist/compiler/implementation.d.ts +129 -0
- package/dist/compiler/implementation.js +3745 -0
- package/dist/compiler/implementation.js.map +1 -0
- package/dist/compiler/index.d.ts +9 -103
- package/dist/compiler/index.js +74 -1971
- package/dist/compiler/index.js.map +1 -1
- package/dist/core/config.d.ts +8 -0
- package/dist/core/config.js +21 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/hooks.d.ts +133 -0
- package/dist/core/hooks.js +54 -0
- package/dist/core/hooks.js.map +1 -0
- package/dist/core/index.d.ts +4 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/module-container.d.ts +100 -0
- package/dist/core/module-container.js +171 -0
- package/dist/core/module-container.js.map +1 -0
- package/dist/core/resux.d.ts +18 -0
- package/dist/core/resux.js +18 -0
- package/dist/core/resux.js.map +1 -0
- package/dist/create.d.ts +1 -0
- package/dist/create.js +878 -22
- package/dist/create.js.map +1 -1
- package/dist/deploy/cloudflare.js +17 -3
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/deploy/common.js +4 -3
- package/dist/deploy/common.js.map +1 -1
- package/dist/fonts/index.d.ts +16 -0
- package/dist/fonts/index.js +154 -0
- package/dist/fonts/index.js.map +1 -0
- package/dist/globals.d.ts +27 -2
- package/dist/halal-core/ai/classifyProject.d.ts +4 -0
- package/dist/halal-core/ai/classifyProject.js +104 -0
- package/dist/halal-core/ai/classifyProject.js.map +1 -0
- package/dist/halal-core/ai/createProjectSummary.d.ts +39 -0
- package/dist/halal-core/ai/createProjectSummary.js +42 -0
- package/dist/halal-core/ai/createProjectSummary.js.map +1 -0
- package/dist/halal-core/ai/halalClassifierPrompt.d.ts +1 -0
- package/dist/halal-core/ai/halalClassifierPrompt.js +20 -0
- package/dist/halal-core/ai/halalClassifierPrompt.js.map +1 -0
- package/dist/halal-core/ai/redactSensitiveData.d.ts +1 -0
- package/dist/halal-core/ai/redactSensitiveData.js +139 -0
- package/dist/halal-core/ai/redactSensitiveData.js.map +1 -0
- package/dist/halal-core/ai/validateAiResponse.d.ts +2 -0
- package/dist/halal-core/ai/validateAiResponse.js +97 -0
- package/dist/halal-core/ai/validateAiResponse.js.map +1 -0
- package/dist/halal-core/cli/check.d.ts +1 -0
- package/dist/halal-core/cli/check.js +36 -0
- package/dist/halal-core/cli/check.js.map +1 -0
- package/dist/halal-core/cli/explain.d.ts +1 -0
- package/dist/halal-core/cli/explain.js +35 -0
- package/dist/halal-core/cli/explain.js.map +1 -0
- package/dist/halal-core/cli/report.d.ts +1 -0
- package/dist/halal-core/cli/report.js +15 -0
- package/dist/halal-core/cli/report.js.map +1 -0
- package/dist/halal-core/cli/submitReview.d.ts +1 -0
- package/dist/halal-core/cli/submitReview.js +12 -0
- package/dist/halal-core/cli/submitReview.js.map +1 -0
- package/dist/halal-core/cli/verifyReview.d.ts +1 -0
- package/dist/halal-core/cli/verifyReview.js +19 -0
- package/dist/halal-core/cli/verifyReview.js.map +1 -0
- package/dist/halal-core/config.d.ts +40 -0
- package/dist/halal-core/config.js +128 -0
- package/dist/halal-core/config.js.map +1 -0
- package/dist/halal-core/crypto/integrity.d.ts +9 -0
- package/dist/halal-core/crypto/integrity.js +101 -0
- package/dist/halal-core/crypto/integrity.js.map +1 -0
- package/dist/halal-core/enforce.d.ts +5 -0
- package/dist/halal-core/enforce.js +119 -0
- package/dist/halal-core/enforce.js.map +1 -0
- package/dist/halal-core/index.d.ts +14 -0
- package/dist/halal-core/index.js +17 -0
- package/dist/halal-core/index.js.map +1 -0
- package/dist/halal-core/lifecycle.d.ts +1 -0
- package/dist/halal-core/lifecycle.js +15 -0
- package/dist/halal-core/lifecycle.js.map +1 -0
- package/dist/halal-core/policy.d.ts +2 -0
- package/dist/halal-core/policy.js +5 -0
- package/dist/halal-core/policy.js.map +1 -0
- package/dist/halal-core/report/formatBrowserOverlay.d.ts +2 -0
- package/dist/halal-core/report/formatBrowserOverlay.js +41 -0
- package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -0
- package/dist/halal-core/report/formatTerminalReport.d.ts +2 -0
- package/dist/halal-core/report/formatTerminalReport.js +39 -0
- package/dist/halal-core/report/formatTerminalReport.js.map +1 -0
- package/dist/halal-core/report/generateHalalReport.d.ts +7 -0
- package/dist/halal-core/report/generateHalalReport.js +46 -0
- package/dist/halal-core/report/generateHalalReport.js.map +1 -0
- package/dist/halal-core/report/signReport.d.ts +3 -0
- package/dist/halal-core/report/signReport.js +17 -0
- package/dist/halal-core/report/signReport.js.map +1 -0
- package/dist/halal-core/report/verifyReport.d.ts +11 -0
- package/dist/halal-core/report/verifyReport.js +45 -0
- package/dist/halal-core/report/verifyReport.js.map +1 -0
- package/dist/halal-core/review/createReviewRequest.d.ts +2 -0
- package/dist/halal-core/review/createReviewRequest.js +21 -0
- package/dist/halal-core/review/createReviewRequest.js.map +1 -0
- package/dist/halal-core/review/reviewPolicy.d.ts +3 -0
- package/dist/halal-core/review/reviewPolicy.js +21 -0
- package/dist/halal-core/review/reviewPolicy.js.map +1 -0
- package/dist/halal-core/review/signedReviewFile.d.ts +13 -0
- package/dist/halal-core/review/signedReviewFile.js +28 -0
- package/dist/halal-core/review/signedReviewFile.js.map +1 -0
- package/dist/halal-core/review/verifyReviewApproval.d.ts +10 -0
- package/dist/halal-core/review/verifyReviewApproval.js +68 -0
- package/dist/halal-core/review/verifyReviewApproval.js.map +1 -0
- package/dist/halal-core/rules/adultContentRules.d.ts +2 -0
- package/dist/halal-core/rules/adultContentRules.js +26 -0
- package/dist/halal-core/rules/adultContentRules.js.map +1 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +2 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.js +25 -0
- package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -0
- package/dist/halal-core/rules/childSafetyRules.d.ts +2 -0
- package/dist/halal-core/rules/childSafetyRules.js +22 -0
- package/dist/halal-core/rules/childSafetyRules.js.map +1 -0
- package/dist/halal-core/rules/coreCategories.d.ts +7 -0
- package/dist/halal-core/rules/coreCategories.js +112 -0
- package/dist/halal-core/rules/coreCategories.js.map +1 -0
- package/dist/halal-core/rules/cyberAbuseRules.d.ts +2 -0
- package/dist/halal-core/rules/cyberAbuseRules.js +30 -0
- package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -0
- package/dist/halal-core/rules/defaultBlockedRules.d.ts +20 -0
- package/dist/halal-core/rules/defaultBlockedRules.js +216 -0
- package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -0
- package/dist/halal-core/rules/dependencyRules.d.ts +9 -0
- package/dist/halal-core/rules/dependencyRules.js +59 -0
- package/dist/halal-core/rules/dependencyRules.js.map +1 -0
- package/dist/halal-core/rules/endpointRules.d.ts +6 -0
- package/dist/halal-core/rules/endpointRules.js +26 -0
- package/dist/halal-core/rules/endpointRules.js.map +1 -0
- package/dist/halal-core/rules/environmentalHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/environmentalHarmRules.js +20 -0
- package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -0
- package/dist/halal-core/rules/financeRibaRules.d.ts +2 -0
- package/dist/halal-core/rules/financeRibaRules.js +23 -0
- package/dist/halal-core/rules/financeRibaRules.js.map +1 -0
- package/dist/halal-core/rules/gamblingRules.d.ts +2 -0
- package/dist/halal-core/rules/gamblingRules.js +25 -0
- package/dist/halal-core/rules/gamblingRules.js.map +1 -0
- package/dist/halal-core/rules/generalHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/generalHarmRules.js +18 -0
- package/dist/halal-core/rules/generalHarmRules.js.map +1 -0
- package/dist/halal-core/rules/healthHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/healthHarmRules.js +22 -0
- package/dist/halal-core/rules/healthHarmRules.js.map +1 -0
- package/dist/halal-core/rules/keywordRules.d.ts +10 -0
- package/dist/halal-core/rules/keywordRules.js +41 -0
- package/dist/halal-core/rules/keywordRules.js.map +1 -0
- package/dist/halal-core/rules/privacyAbuseRules.d.ts +2 -0
- package/dist/halal-core/rules/privacyAbuseRules.js +24 -0
- package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -0
- package/dist/halal-core/rules/scamFraudRules.d.ts +2 -0
- package/dist/halal-core/rules/scamFraudRules.js +32 -0
- package/dist/halal-core/rules/scamFraudRules.js.map +1 -0
- package/dist/halal-core/rules/selfHarmRules.d.ts +2 -0
- package/dist/halal-core/rules/selfHarmRules.js +20 -0
- package/dist/halal-core/rules/selfHarmRules.js.map +1 -0
- package/dist/halal-core/rules/violenceExtremismRules.d.ts +2 -0
- package/dist/halal-core/rules/violenceExtremismRules.js +33 -0
- package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -0
- package/dist/halal-core/scanner/scanApiRoutes.d.ts +1 -0
- package/dist/halal-core/scanner/scanApiRoutes.js +40 -0
- package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -0
- package/dist/halal-core/scanner/scanComponents.d.ts +1 -0
- package/dist/halal-core/scanner/scanComponents.js +17 -0
- package/dist/halal-core/scanner/scanComponents.js.map +1 -0
- package/dist/halal-core/scanner/scanContent.d.ts +5 -0
- package/dist/halal-core/scanner/scanContent.js +302 -0
- package/dist/halal-core/scanner/scanContent.js.map +1 -0
- package/dist/halal-core/scanner/scanDependencies.d.ts +1 -0
- package/dist/halal-core/scanner/scanDependencies.js +19 -0
- package/dist/halal-core/scanner/scanDependencies.js.map +1 -0
- package/dist/halal-core/scanner/scanDomains.d.ts +4 -0
- package/dist/halal-core/scanner/scanDomains.js +14 -0
- package/dist/halal-core/scanner/scanDomains.js.map +1 -0
- package/dist/halal-core/scanner/scanEnvNames.d.ts +1 -0
- package/dist/halal-core/scanner/scanEnvNames.js +30 -0
- package/dist/halal-core/scanner/scanEnvNames.js.map +1 -0
- package/dist/halal-core/scanner/scanMetadata.d.ts +6 -0
- package/dist/halal-core/scanner/scanMetadata.js +33 -0
- package/dist/halal-core/scanner/scanMetadata.js.map +1 -0
- package/dist/halal-core/scanner/scanPages.d.ts +1 -0
- package/dist/halal-core/scanner/scanPages.js +19 -0
- package/dist/halal-core/scanner/scanPages.js.map +1 -0
- package/dist/halal-core/scanner/scanProject.d.ts +13 -0
- package/dist/halal-core/scanner/scanProject.js +62 -0
- package/dist/halal-core/scanner/scanProject.js.map +1 -0
- package/dist/halal-core/scanner/scanRoutes.d.ts +1 -0
- package/dist/halal-core/scanner/scanRoutes.js +43 -0
- package/dist/halal-core/scanner/scanRoutes.js.map +1 -0
- package/dist/halal-core/scanner/scanTranslations.d.ts +1 -0
- package/dist/halal-core/scanner/scanTranslations.js +32 -0
- package/dist/halal-core/scanner/scanTranslations.js.map +1 -0
- package/dist/halal-core/status.d.ts +14 -0
- package/dist/halal-core/status.js +2 -0
- package/dist/halal-core/status.js.map +1 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +1 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.js +28 -0
- package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +1 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.js +14 -0
- package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -0
- package/dist/halal-core/tamper/verifyReportSignature.d.ts +5 -0
- package/dist/halal-core/tamper/verifyReportSignature.js +18 -0
- package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -0
- package/dist/i18n/index.d.ts +45 -0
- package/dist/i18n/index.js +284 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/shared.d.ts +35 -0
- package/dist/i18n/shared.js +270 -0
- package/dist/i18n/shared.js.map +1 -0
- package/dist/icons/index.d.ts +159 -0
- package/dist/icons/index.js +286 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/kit/index.d.ts +29 -0
- package/dist/kit/index.js +72 -0
- package/dist/kit/index.js.map +1 -0
- package/dist/nitro-server/index.d.ts +7 -0
- package/dist/nitro-server/index.js +4 -0
- package/dist/nitro-server/index.js.map +1 -0
- package/dist/reactivity/computed.js +9 -4
- package/dist/reactivity/computed.js.map +1 -1
- package/dist/reactivity/effect.d.ts +3 -1
- package/dist/reactivity/effect.js +56 -6
- package/dist/reactivity/effect.js.map +1 -1
- package/dist/reactivity/reactive.js +64 -15
- package/dist/reactivity/reactive.js.map +1 -1
- package/dist/reactivity/ref.d.ts +1 -0
- package/dist/reactivity/ref.js +13 -6
- package/dist/reactivity/ref.js.map +1 -1
- package/dist/reactivity/scheduler.js +36 -4
- package/dist/reactivity/scheduler.js.map +1 -1
- package/dist/reactivity/watch.js +27 -5
- package/dist/reactivity/watch.js.map +1 -1
- package/dist/runtime/index.d.ts +226 -3
- package/dist/runtime/index.js +13344 -6395
- package/dist/runtime/index.js.map +1 -1
- package/dist/ui/index.d.ts +1828 -0
- package/dist/ui/index.js +938 -0
- package/dist/ui/index.js.map +1 -0
- package/dist/vite-builder/index.d.ts +6 -0
- package/dist/vite-builder/index.js +4 -0
- package/dist/vite-builder/index.js.map +1 -0
- package/package.json +145 -105
- package/templates/default/.env.example +1 -0
- package/templates/default/README.md +18 -14
- package/templates/default/_gitignore +8 -5
- package/templates/default/assets/css/main.css +4 -0
- package/templates/default/nitro.config.ts +9 -5
- package/templates/default/pages/index.vue +102 -87
- package/templates/default/public/favicon.svg +4 -0
- package/templates/default/types/app.d.ts +3 -0
- package/templates/default/.resux-nitro/handler.ts +0 -21
package/dist/ui/index.js
ADDED
|
@@ -0,0 +1,938 @@
|
|
|
1
|
+
import { defineComponent, h, onMounted, ref } from "vue";
|
|
2
|
+
import { defineResuxModule } from "../kit/index.js";
|
|
3
|
+
export function defineUiTokens(tokens) {
|
|
4
|
+
return tokens;
|
|
5
|
+
}
|
|
6
|
+
export function isReducedMotion() {
|
|
7
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function")
|
|
8
|
+
return false;
|
|
9
|
+
return window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
10
|
+
}
|
|
11
|
+
export function useAnimate(target, options = {}) {
|
|
12
|
+
const element = target && "value" in target ? target.value : target;
|
|
13
|
+
if (!element || typeof window === "undefined")
|
|
14
|
+
return null;
|
|
15
|
+
if (isReducedMotion())
|
|
16
|
+
return null;
|
|
17
|
+
const type = options.type || "fade-up";
|
|
18
|
+
const duration = options.duration ?? 400;
|
|
19
|
+
const delay = options.delay ?? 0;
|
|
20
|
+
const easing = options.easing || "cubic-bezier(0.16, 1, 0.3, 1)";
|
|
21
|
+
let keyframes = [];
|
|
22
|
+
switch (type) {
|
|
23
|
+
case "fade-up":
|
|
24
|
+
keyframes = [
|
|
25
|
+
{ opacity: 0, transform: "translate3d(0, 30px, 0)" },
|
|
26
|
+
{ opacity: 1, transform: "translate3d(0, 0, 0)" }
|
|
27
|
+
];
|
|
28
|
+
break;
|
|
29
|
+
case "fade-down":
|
|
30
|
+
keyframes = [
|
|
31
|
+
{ opacity: 0, transform: "translate3d(0, -30px, 0)" },
|
|
32
|
+
{ opacity: 1, transform: "translate3d(0, 0, 0)" }
|
|
33
|
+
];
|
|
34
|
+
break;
|
|
35
|
+
case "scale-in":
|
|
36
|
+
keyframes = [
|
|
37
|
+
{ opacity: 0, transform: "scale3d(0.92, 0.92, 1)" },
|
|
38
|
+
{ opacity: 1, transform: "scale3d(1, 1, 1)" }
|
|
39
|
+
];
|
|
40
|
+
break;
|
|
41
|
+
case "slide-in-left":
|
|
42
|
+
keyframes = [
|
|
43
|
+
{ opacity: 0, transform: "translate3d(-40px, 0, 0)" },
|
|
44
|
+
{ opacity: 1, transform: "translate3d(0, 0, 0)" }
|
|
45
|
+
];
|
|
46
|
+
break;
|
|
47
|
+
case "slide-in-right":
|
|
48
|
+
keyframes = [
|
|
49
|
+
{ opacity: 0, transform: "translate3d(40px, 0, 0)" },
|
|
50
|
+
{ opacity: 1, transform: "translate3d(0, 0, 0)" }
|
|
51
|
+
];
|
|
52
|
+
break;
|
|
53
|
+
case "pulse-glow":
|
|
54
|
+
keyframes = [
|
|
55
|
+
{ transform: "scale(1)", boxShadow: "0 0 0 0 rgba(3, 200, 191, 0.4)" },
|
|
56
|
+
{ transform: "scale(1.03)", boxShadow: "0 0 20px 10px rgba(3, 200, 191, 0)" },
|
|
57
|
+
{ transform: "scale(1)", boxShadow: "0 0 0 0 rgba(3, 200, 191, 0)" }
|
|
58
|
+
];
|
|
59
|
+
break;
|
|
60
|
+
case "bounce-in":
|
|
61
|
+
keyframes = [
|
|
62
|
+
{ opacity: 0, transform: "scale3d(0.3, 0.3, 0.3)" },
|
|
63
|
+
{ opacity: 0.9, transform: "scale3d(1.05, 1.05, 1.05)" },
|
|
64
|
+
{ opacity: 1, transform: "scale3d(1, 1, 1)" }
|
|
65
|
+
];
|
|
66
|
+
break;
|
|
67
|
+
default:
|
|
68
|
+
keyframes = [
|
|
69
|
+
{ opacity: 0, transform: "translate3d(0, 20px, 0)" },
|
|
70
|
+
{ opacity: 1, transform: "translate3d(0, 0, 0)" }
|
|
71
|
+
];
|
|
72
|
+
}
|
|
73
|
+
if ("animate" in element && typeof element.animate === "function") {
|
|
74
|
+
return element.animate(keyframes, {
|
|
75
|
+
duration,
|
|
76
|
+
delay,
|
|
77
|
+
easing,
|
|
78
|
+
fill: options.fill || "forwards"
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return null;
|
|
82
|
+
}
|
|
83
|
+
export const vAnime = {
|
|
84
|
+
mounted(el, binding) {
|
|
85
|
+
if (typeof window === "undefined" || isReducedMotion())
|
|
86
|
+
return;
|
|
87
|
+
const config = typeof binding.value === "string"
|
|
88
|
+
? { type: binding.value }
|
|
89
|
+
: binding.value || { type: "fade-up" };
|
|
90
|
+
el.style.opacity = "0";
|
|
91
|
+
const triggerAnimation = () => {
|
|
92
|
+
useAnimate(el, config);
|
|
93
|
+
};
|
|
94
|
+
if ("IntersectionObserver" in window) {
|
|
95
|
+
const observer = new IntersectionObserver((entries) => {
|
|
96
|
+
if (entries.some((entry) => entry.isIntersecting)) {
|
|
97
|
+
triggerAnimation();
|
|
98
|
+
observer.unobserve(el);
|
|
99
|
+
}
|
|
100
|
+
}, { rootMargin: "50px" });
|
|
101
|
+
observer.observe(el);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
triggerAnimation();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
export const vAnimate = vAnime;
|
|
109
|
+
// --- UI & Motion Primitive Components ---
|
|
110
|
+
export const RxMotion = defineComponent({
|
|
111
|
+
name: "RxMotion",
|
|
112
|
+
props: {
|
|
113
|
+
tag: { type: String, default: "div" },
|
|
114
|
+
preset: { type: String, default: "fade-up" },
|
|
115
|
+
duration: { type: Number, default: 400 },
|
|
116
|
+
delay: { type: Number, default: 0 },
|
|
117
|
+
easing: { type: String, default: "cubic-bezier(0.16, 1, 0.3, 1)" },
|
|
118
|
+
unstyled: { type: Boolean, default: false }
|
|
119
|
+
},
|
|
120
|
+
setup(props, { slots, attrs }) {
|
|
121
|
+
const elRef = ref(null);
|
|
122
|
+
onMounted(() => {
|
|
123
|
+
if (elRef.value && !props.unstyled && !isReducedMotion()) {
|
|
124
|
+
useAnimate(elRef.value, {
|
|
125
|
+
type: props.preset,
|
|
126
|
+
duration: props.duration,
|
|
127
|
+
delay: props.delay,
|
|
128
|
+
easing: props.easing
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
return () => h(props.tag, { ref: elRef, ...attrs }, slots.default ? slots.default() : []);
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
export const RxReveal = defineComponent({
|
|
136
|
+
name: "RxReveal",
|
|
137
|
+
props: {
|
|
138
|
+
preset: { type: String, default: "fade-up" },
|
|
139
|
+
duration: { type: Number, default: 400 },
|
|
140
|
+
unstyled: { type: Boolean, default: false }
|
|
141
|
+
},
|
|
142
|
+
setup(props, { slots, attrs }) {
|
|
143
|
+
const elRef = ref(null);
|
|
144
|
+
onMounted(() => {
|
|
145
|
+
if (elRef.value && !props.unstyled && !isReducedMotion()) {
|
|
146
|
+
useAnimate(elRef.value, { type: props.preset, duration: props.duration });
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
return () => h("div", { ref: elRef, ...attrs }, slots.default ? slots.default() : []);
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
export const RxAutoAnimate = defineComponent({
|
|
153
|
+
name: "RxAutoAnimate",
|
|
154
|
+
props: {
|
|
155
|
+
duration: { type: Number, default: 300 },
|
|
156
|
+
unstyled: { type: Boolean, default: false }
|
|
157
|
+
},
|
|
158
|
+
setup(props, { slots, attrs }) {
|
|
159
|
+
const elRef = ref(null);
|
|
160
|
+
onMounted(() => {
|
|
161
|
+
if (elRef.value && !props.unstyled && !isReducedMotion()) {
|
|
162
|
+
useAnimate(elRef.value, { type: "scale-in", duration: props.duration });
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
return () => h("div", { ref: elRef, ...attrs }, slots.default ? slots.default() : []);
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
export const RxButton = defineComponent({
|
|
169
|
+
name: "RxButton",
|
|
170
|
+
props: {
|
|
171
|
+
variant: { type: String, default: "primary" },
|
|
172
|
+
size: { type: String, default: "md" },
|
|
173
|
+
type: { type: String, default: "button" },
|
|
174
|
+
disabled: { type: Boolean, default: false },
|
|
175
|
+
unstyled: { type: Boolean, default: false }
|
|
176
|
+
},
|
|
177
|
+
setup(props, { slots, attrs }) {
|
|
178
|
+
return () => {
|
|
179
|
+
const classes = props.unstyled
|
|
180
|
+
? (attrs.class || "")
|
|
181
|
+
: ["rx-btn", `rx-btn-${props.variant}`, `rx-btn-${props.size}`, attrs.class].filter(Boolean).join(" ");
|
|
182
|
+
return h("button", { ...attrs, type: props.type, disabled: props.disabled, class: classes }, slots.default ? slots.default() : []);
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
});
|
|
186
|
+
export const RxCard = defineComponent({
|
|
187
|
+
name: "RxCard",
|
|
188
|
+
props: {
|
|
189
|
+
variant: { type: String, default: "default" },
|
|
190
|
+
unstyled: { type: Boolean, default: false }
|
|
191
|
+
},
|
|
192
|
+
setup(props, { slots, attrs }) {
|
|
193
|
+
return () => {
|
|
194
|
+
const classes = props.unstyled
|
|
195
|
+
? (attrs.class || "")
|
|
196
|
+
: ["rx-card", props.variant !== "default" ? `rx-card-${props.variant}` : "", attrs.class].filter(Boolean).join(" ");
|
|
197
|
+
return h("div", { ...attrs, class: classes }, slots.default ? slots.default() : []);
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
export const RxBadge = defineComponent({
|
|
202
|
+
name: "RxBadge",
|
|
203
|
+
props: {
|
|
204
|
+
variant: { type: String, default: "default" },
|
|
205
|
+
unstyled: { type: Boolean, default: false }
|
|
206
|
+
},
|
|
207
|
+
setup(props, { slots, attrs }) {
|
|
208
|
+
return () => {
|
|
209
|
+
const classes = props.unstyled
|
|
210
|
+
? (attrs.class || "")
|
|
211
|
+
: ["rx-badge", `rx-badge-${props.variant}`, attrs.class].filter(Boolean).join(" ");
|
|
212
|
+
return h("span", { ...attrs, class: classes }, slots.default ? slots.default() : []);
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
export const RxInput = defineComponent({
|
|
217
|
+
name: "RxInput",
|
|
218
|
+
props: {
|
|
219
|
+
modelValue: { type: [String, Number], default: "" },
|
|
220
|
+
type: { type: String, default: "text" },
|
|
221
|
+
placeholder: { type: String, default: "" },
|
|
222
|
+
disabled: { type: Boolean, default: false },
|
|
223
|
+
unstyled: { type: Boolean, default: false }
|
|
224
|
+
},
|
|
225
|
+
emits: ["update:modelValue"],
|
|
226
|
+
setup(props, { emit, attrs }) {
|
|
227
|
+
return () => {
|
|
228
|
+
const classes = props.unstyled
|
|
229
|
+
? (attrs.class || "")
|
|
230
|
+
: ["rx-input", attrs.class].filter(Boolean).join(" ");
|
|
231
|
+
return h("input", {
|
|
232
|
+
...attrs,
|
|
233
|
+
type: props.type,
|
|
234
|
+
value: props.modelValue,
|
|
235
|
+
placeholder: props.placeholder,
|
|
236
|
+
disabled: props.disabled,
|
|
237
|
+
class: classes,
|
|
238
|
+
onInput: (e) => emit("update:modelValue", e.target.value)
|
|
239
|
+
});
|
|
240
|
+
};
|
|
241
|
+
}
|
|
242
|
+
});
|
|
243
|
+
export const RxSelect = defineComponent({
|
|
244
|
+
name: "RxSelect",
|
|
245
|
+
props: {
|
|
246
|
+
modelValue: { type: [String, Number], default: "" },
|
|
247
|
+
options: { type: Array, default: () => [] },
|
|
248
|
+
placeholder: { type: String, default: "Select an option" },
|
|
249
|
+
disabled: { type: Boolean, default: false },
|
|
250
|
+
unstyled: { type: Boolean, default: false }
|
|
251
|
+
},
|
|
252
|
+
emits: ["update:modelValue"],
|
|
253
|
+
setup(props, { emit, attrs }) {
|
|
254
|
+
const isOpen = ref(false);
|
|
255
|
+
const toggle = () => {
|
|
256
|
+
if (!props.disabled)
|
|
257
|
+
isOpen.value = !isOpen.value;
|
|
258
|
+
};
|
|
259
|
+
const selectOption = (val) => {
|
|
260
|
+
emit("update:modelValue", val);
|
|
261
|
+
isOpen.value = false;
|
|
262
|
+
};
|
|
263
|
+
const handleKeyDown = (e) => {
|
|
264
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
265
|
+
e.preventDefault();
|
|
266
|
+
toggle();
|
|
267
|
+
}
|
|
268
|
+
else if (e.key === "Escape") {
|
|
269
|
+
isOpen.value = false;
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
return () => {
|
|
273
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-select", attrs.class].filter(Boolean).join(" ");
|
|
274
|
+
const normalizedOpts = props.options.map((opt) => typeof opt === "string" ? { label: opt, value: opt } : opt);
|
|
275
|
+
const selectedObj = normalizedOpts.find((o) => o.value === props.modelValue);
|
|
276
|
+
return h("div", { class: classes, tabindex: props.disabled ? -1 : 0, onKeydown: handleKeyDown }, [
|
|
277
|
+
h("div", { class: props.unstyled ? "" : "rx-select-trigger", onClick: toggle }, [
|
|
278
|
+
h("span", selectedObj ? selectedObj.label : props.placeholder),
|
|
279
|
+
h("span", { class: props.unstyled ? "" : "rx-select-arrow" }, "▾")
|
|
280
|
+
]),
|
|
281
|
+
isOpen.value
|
|
282
|
+
? h("ul", { class: props.unstyled ? "" : "rx-select-dropdown", role: "listbox" }, normalizedOpts.map((opt) => h("li", {
|
|
283
|
+
class: [props.unstyled ? "" : "rx-select-option", opt.value === props.modelValue ? "selected" : ""]
|
|
284
|
+
.filter(Boolean)
|
|
285
|
+
.join(" "),
|
|
286
|
+
role: "option",
|
|
287
|
+
onClick: () => selectOption(opt.value)
|
|
288
|
+
}, opt.label)))
|
|
289
|
+
: null
|
|
290
|
+
]);
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
});
|
|
294
|
+
export const RxDatePicker = defineComponent({
|
|
295
|
+
name: "RxDatePicker",
|
|
296
|
+
props: {
|
|
297
|
+
modelValue: { type: [String, Date], default: "" },
|
|
298
|
+
placeholder: { type: String, default: "Select date" },
|
|
299
|
+
unstyled: { type: Boolean, default: false }
|
|
300
|
+
},
|
|
301
|
+
emits: ["update:modelValue"],
|
|
302
|
+
setup(props, { emit, attrs }) {
|
|
303
|
+
const formattedValue = typeof props.modelValue === "object" && props.modelValue instanceof Date
|
|
304
|
+
? props.modelValue.toISOString().split("T")[0]
|
|
305
|
+
: String(props.modelValue || "");
|
|
306
|
+
return () => {
|
|
307
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-input", "rx-datepicker", attrs.class].filter(Boolean).join(" ");
|
|
308
|
+
return h("input", {
|
|
309
|
+
...attrs,
|
|
310
|
+
type: "date",
|
|
311
|
+
value: formattedValue,
|
|
312
|
+
placeholder: props.placeholder,
|
|
313
|
+
class: classes,
|
|
314
|
+
onInput: (e) => emit("update:modelValue", e.target.value)
|
|
315
|
+
});
|
|
316
|
+
};
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
export const RxPopover = defineComponent({
|
|
320
|
+
name: "RxPopover",
|
|
321
|
+
props: {
|
|
322
|
+
open: { type: Boolean, default: false },
|
|
323
|
+
unstyled: { type: Boolean, default: false }
|
|
324
|
+
},
|
|
325
|
+
emits: ["update:open"],
|
|
326
|
+
setup(props, { slots, emit, attrs }) {
|
|
327
|
+
const toggle = () => emit("update:open", !props.open);
|
|
328
|
+
return () => {
|
|
329
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-popover", attrs.class].filter(Boolean).join(" ");
|
|
330
|
+
return h("div", { class: classes }, [
|
|
331
|
+
h("div", { onClick: toggle }, slots.trigger ? slots.trigger() : [h("button", "Toggle")]),
|
|
332
|
+
props.open ? h("div", { class: props.unstyled ? "" : "rx-popover-content", ...attrs }, slots.default ? slots.default() : []) : null
|
|
333
|
+
]);
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
export const RxIcon = defineComponent({
|
|
338
|
+
name: "RxIcon",
|
|
339
|
+
props: {
|
|
340
|
+
name: { type: String, default: "check" },
|
|
341
|
+
size: { type: [String, Number], default: "1.25rem" },
|
|
342
|
+
color: { type: String, default: "currentColor" },
|
|
343
|
+
unstyled: { type: Boolean, default: false }
|
|
344
|
+
},
|
|
345
|
+
setup(props, { attrs }) {
|
|
346
|
+
return () => {
|
|
347
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-icon", attrs.class].filter(Boolean).join(" ");
|
|
348
|
+
return h("span", {
|
|
349
|
+
...attrs,
|
|
350
|
+
class: classes,
|
|
351
|
+
style: { fontSize: typeof props.size === "number" ? `${props.size}px` : props.size, color: props.color }
|
|
352
|
+
}, `[${props.name}]`);
|
|
353
|
+
};
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
export const RxAvatar = defineComponent({
|
|
357
|
+
name: "RxAvatar",
|
|
358
|
+
props: {
|
|
359
|
+
src: { type: String, default: "" },
|
|
360
|
+
alt: { type: String, default: "Avatar" },
|
|
361
|
+
size: { type: String, default: "md" },
|
|
362
|
+
status: { type: String, default: "" },
|
|
363
|
+
unstyled: { type: Boolean, default: false }
|
|
364
|
+
},
|
|
365
|
+
setup(props, { attrs }) {
|
|
366
|
+
return () => {
|
|
367
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-avatar", `rx-avatar-${props.size}`, attrs.class].filter(Boolean).join(" ");
|
|
368
|
+
const initials = props.alt ? props.alt.slice(0, 2).toUpperCase() : "RX";
|
|
369
|
+
return h("div", { ...attrs, class: classes }, [
|
|
370
|
+
props.src
|
|
371
|
+
? h("img", { src: props.src, alt: props.alt, class: props.unstyled ? "" : "rx-avatar-img" })
|
|
372
|
+
: h("span", { class: props.unstyled ? "" : "rx-avatar-fallback" }, initials),
|
|
373
|
+
props.status ? h("span", { class: props.unstyled ? "" : `rx-avatar-status rx-status-${props.status}` }) : null
|
|
374
|
+
]);
|
|
375
|
+
};
|
|
376
|
+
}
|
|
377
|
+
});
|
|
378
|
+
export const RxAlert = defineComponent({
|
|
379
|
+
name: "RxAlert",
|
|
380
|
+
props: {
|
|
381
|
+
variant: { type: String, default: "info" },
|
|
382
|
+
title: { type: String, default: "" },
|
|
383
|
+
dismissible: { type: Boolean, default: false },
|
|
384
|
+
unstyled: { type: Boolean, default: false }
|
|
385
|
+
},
|
|
386
|
+
emits: ["dismiss"],
|
|
387
|
+
setup(props, { slots, emit, attrs }) {
|
|
388
|
+
return () => {
|
|
389
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-alert", `rx-alert-${props.variant}`, attrs.class].filter(Boolean).join(" ");
|
|
390
|
+
return h("div", { ...attrs, class: classes, role: "alert" }, [
|
|
391
|
+
props.title ? h("div", { class: props.unstyled ? "" : "rx-alert-title" }, props.title) : null,
|
|
392
|
+
h("div", { class: props.unstyled ? "" : "rx-alert-content" }, slots.default ? slots.default() : []),
|
|
393
|
+
props.dismissible ? h("button", { class: props.unstyled ? "" : "rx-alert-close", onClick: () => emit("dismiss") }, "×") : null
|
|
394
|
+
]);
|
|
395
|
+
};
|
|
396
|
+
}
|
|
397
|
+
});
|
|
398
|
+
export const RxAccordion = defineComponent({
|
|
399
|
+
name: "RxAccordion",
|
|
400
|
+
props: {
|
|
401
|
+
title: { type: String, default: "Accordion Title" },
|
|
402
|
+
open: { type: Boolean, default: false },
|
|
403
|
+
unstyled: { type: Boolean, default: false }
|
|
404
|
+
},
|
|
405
|
+
setup(props, { slots, attrs }) {
|
|
406
|
+
const isOpen = ref(props.open);
|
|
407
|
+
const toggle = () => (isOpen.value = !isOpen.value);
|
|
408
|
+
return () => {
|
|
409
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-accordion", attrs.class].filter(Boolean).join(" ");
|
|
410
|
+
return h("div", { ...attrs, class: classes }, [
|
|
411
|
+
h("button", { class: props.unstyled ? "" : "rx-accordion-header", onClick: toggle }, [
|
|
412
|
+
h("span", props.title),
|
|
413
|
+
h("span", isOpen.value ? "−" : "+")
|
|
414
|
+
]),
|
|
415
|
+
isOpen.value ? h("div", { class: props.unstyled ? "" : "rx-accordion-body" }, slots.default ? slots.default() : []) : null
|
|
416
|
+
]);
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
});
|
|
420
|
+
export const RxTooltip = defineComponent({
|
|
421
|
+
name: "RxTooltip",
|
|
422
|
+
props: {
|
|
423
|
+
text: { type: String, default: "" },
|
|
424
|
+
placement: { type: String, default: "top" },
|
|
425
|
+
unstyled: { type: Boolean, default: false }
|
|
426
|
+
},
|
|
427
|
+
setup(props, { slots, attrs }) {
|
|
428
|
+
const visible = ref(false);
|
|
429
|
+
return () => {
|
|
430
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-tooltip-wrapper", attrs.class].filter(Boolean).join(" ");
|
|
431
|
+
return h("div", {
|
|
432
|
+
class: classes,
|
|
433
|
+
onMouseenter: () => (visible.value = true),
|
|
434
|
+
onMouseleave: () => (visible.value = false)
|
|
435
|
+
}, [
|
|
436
|
+
slots.default ? slots.default() : null,
|
|
437
|
+
visible.value && props.text
|
|
438
|
+
? h("div", { class: props.unstyled ? "" : `rx-tooltip rx-tooltip-${props.placement}`, ...attrs }, props.text)
|
|
439
|
+
: null
|
|
440
|
+
]);
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
});
|
|
444
|
+
export const RxDropdown = defineComponent({
|
|
445
|
+
name: "RxDropdown",
|
|
446
|
+
props: {
|
|
447
|
+
items: { type: Array, default: () => [] },
|
|
448
|
+
open: { type: Boolean, default: false },
|
|
449
|
+
unstyled: { type: Boolean, default: false }
|
|
450
|
+
},
|
|
451
|
+
emits: ["update:open"],
|
|
452
|
+
setup(props, { slots, emit, attrs }) {
|
|
453
|
+
const toggle = () => emit("update:open", !props.open);
|
|
454
|
+
return () => {
|
|
455
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-dropdown", attrs.class].filter(Boolean).join(" ");
|
|
456
|
+
return h("div", { class: classes }, [
|
|
457
|
+
h("div", { onClick: toggle }, slots.trigger ? slots.trigger() : [h("button", "Menu")]),
|
|
458
|
+
props.open
|
|
459
|
+
? h("ul", { class: props.unstyled ? "" : "rx-dropdown-menu", ...attrs }, props.items.map((item) => h("li", {
|
|
460
|
+
class: props.unstyled ? "" : "rx-dropdown-item",
|
|
461
|
+
onClick: () => {
|
|
462
|
+
if (item.action)
|
|
463
|
+
item.action();
|
|
464
|
+
emit("update:open", false);
|
|
465
|
+
}
|
|
466
|
+
}, item.label)))
|
|
467
|
+
: null
|
|
468
|
+
]);
|
|
469
|
+
};
|
|
470
|
+
}
|
|
471
|
+
});
|
|
472
|
+
export const RxTabs = defineComponent({
|
|
473
|
+
name: "RxTabs",
|
|
474
|
+
props: {
|
|
475
|
+
items: { type: Array, default: () => [] },
|
|
476
|
+
modelValue: { type: String, default: "" },
|
|
477
|
+
unstyled: { type: Boolean, default: false }
|
|
478
|
+
},
|
|
479
|
+
emits: ["update:modelValue"],
|
|
480
|
+
setup(props, { emit, attrs }) {
|
|
481
|
+
return () => {
|
|
482
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-tabs", attrs.class].filter(Boolean).join(" ");
|
|
483
|
+
return h("div", { ...attrs, class: classes }, [
|
|
484
|
+
h("div", { class: props.unstyled ? "" : "rx-tabs-header" }, props.items.map((item) => h("button", {
|
|
485
|
+
class: [props.unstyled ? "" : "rx-tab-btn", item.key === props.modelValue ? "active" : ""].filter(Boolean).join(" "),
|
|
486
|
+
onClick: () => emit("update:modelValue", item.key)
|
|
487
|
+
}, item.label)))
|
|
488
|
+
]);
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
});
|
|
492
|
+
export const RxTextarea = defineComponent({
|
|
493
|
+
name: "RxTextarea",
|
|
494
|
+
props: {
|
|
495
|
+
modelValue: { type: String, default: "" },
|
|
496
|
+
rows: { type: Number, default: 3 },
|
|
497
|
+
placeholder: { type: String, default: "" },
|
|
498
|
+
disabled: { type: Boolean, default: false },
|
|
499
|
+
unstyled: { type: Boolean, default: false }
|
|
500
|
+
},
|
|
501
|
+
emits: ["update:modelValue"],
|
|
502
|
+
setup(props, { emit, attrs }) {
|
|
503
|
+
return () => {
|
|
504
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-input", "rx-textarea", attrs.class].filter(Boolean).join(" ");
|
|
505
|
+
return h("textarea", {
|
|
506
|
+
...attrs,
|
|
507
|
+
rows: props.rows,
|
|
508
|
+
value: props.modelValue,
|
|
509
|
+
placeholder: props.placeholder,
|
|
510
|
+
disabled: props.disabled,
|
|
511
|
+
class: classes,
|
|
512
|
+
onInput: (e) => emit("update:modelValue", e.target.value)
|
|
513
|
+
});
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
export const RxSwitch = defineComponent({
|
|
518
|
+
name: "RxSwitch",
|
|
519
|
+
props: {
|
|
520
|
+
modelValue: { type: Boolean, default: false },
|
|
521
|
+
disabled: { type: Boolean, default: false },
|
|
522
|
+
unstyled: { type: Boolean, default: false }
|
|
523
|
+
},
|
|
524
|
+
emits: ["update:modelValue"],
|
|
525
|
+
setup(props, { emit, attrs }) {
|
|
526
|
+
const toggle = () => {
|
|
527
|
+
if (!props.disabled)
|
|
528
|
+
emit("update:modelValue", !props.modelValue);
|
|
529
|
+
};
|
|
530
|
+
return () => {
|
|
531
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-switch", props.modelValue ? "checked" : "", attrs.class].filter(Boolean).join(" ");
|
|
532
|
+
return h("button", {
|
|
533
|
+
...attrs,
|
|
534
|
+
type: "button",
|
|
535
|
+
role: "switch",
|
|
536
|
+
"aria-checked": props.modelValue,
|
|
537
|
+
disabled: props.disabled,
|
|
538
|
+
class: classes,
|
|
539
|
+
onClick: toggle
|
|
540
|
+
}, [
|
|
541
|
+
h("span", { class: props.unstyled ? "" : "rx-switch-thumb" })
|
|
542
|
+
]);
|
|
543
|
+
};
|
|
544
|
+
}
|
|
545
|
+
});
|
|
546
|
+
export const RxSkeleton = defineComponent({
|
|
547
|
+
name: "RxSkeleton",
|
|
548
|
+
props: {
|
|
549
|
+
width: { type: String, default: "100%" },
|
|
550
|
+
height: { type: String, default: "1rem" },
|
|
551
|
+
rounded: { type: String, default: "0.375rem" },
|
|
552
|
+
unstyled: { type: Boolean, default: false }
|
|
553
|
+
},
|
|
554
|
+
setup(props, { attrs }) {
|
|
555
|
+
return () => {
|
|
556
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-skeleton", attrs.class].filter(Boolean).join(" ");
|
|
557
|
+
return h("div", {
|
|
558
|
+
...attrs,
|
|
559
|
+
class: classes,
|
|
560
|
+
style: { width: props.width, height: props.height, borderRadius: props.rounded }
|
|
561
|
+
});
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
});
|
|
565
|
+
export const RxDivider = defineComponent({
|
|
566
|
+
name: "RxDivider",
|
|
567
|
+
props: {
|
|
568
|
+
label: { type: String, default: "" },
|
|
569
|
+
orientation: { type: String, default: "horizontal" },
|
|
570
|
+
unstyled: { type: Boolean, default: false }
|
|
571
|
+
},
|
|
572
|
+
setup(props, { attrs }) {
|
|
573
|
+
return () => {
|
|
574
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-divider", `rx-divider-${props.orientation}`, attrs.class].filter(Boolean).join(" ");
|
|
575
|
+
return h("div", { ...attrs, class: classes }, [
|
|
576
|
+
props.label ? h("span", { class: props.unstyled ? "" : "rx-divider-label" }, props.label) : null
|
|
577
|
+
]);
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
});
|
|
581
|
+
export const RxKbd = defineComponent({
|
|
582
|
+
name: "RxKbd",
|
|
583
|
+
props: {
|
|
584
|
+
unstyled: { type: Boolean, default: false }
|
|
585
|
+
},
|
|
586
|
+
setup(props, { slots, attrs }) {
|
|
587
|
+
return () => {
|
|
588
|
+
const classes = props.unstyled ? (attrs.class || "") : ["rx-kbd", attrs.class].filter(Boolean).join(" ");
|
|
589
|
+
return h("kbd", { ...attrs, class: classes }, slots.default ? slots.default() : []);
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
});
|
|
593
|
+
export const RxModal = defineComponent({
|
|
594
|
+
name: "RxModal",
|
|
595
|
+
props: {
|
|
596
|
+
open: { type: Boolean, default: false },
|
|
597
|
+
title: { type: String, default: "" },
|
|
598
|
+
unstyled: { type: Boolean, default: false }
|
|
599
|
+
},
|
|
600
|
+
emits: ["update:open", "close"],
|
|
601
|
+
setup(props, { slots, emit, attrs }) {
|
|
602
|
+
const close = () => {
|
|
603
|
+
emit("update:open", false);
|
|
604
|
+
emit("close");
|
|
605
|
+
};
|
|
606
|
+
return () => {
|
|
607
|
+
if (!props.open)
|
|
608
|
+
return null;
|
|
609
|
+
const backdropClasses = props.unstyled ? "" : "rx-modal-backdrop";
|
|
610
|
+
const contentClasses = props.unstyled ? "" : "rx-modal-content";
|
|
611
|
+
return h("div", { class: backdropClasses, onClick: close }, [
|
|
612
|
+
h("div", { class: contentClasses, onClick: (e) => e.stopPropagation(), ...attrs }, [
|
|
613
|
+
props.title ? h("h3", { style: { marginTop: 0 } }, props.title) : null,
|
|
614
|
+
slots.default ? slots.default() : null
|
|
615
|
+
])
|
|
616
|
+
]);
|
|
617
|
+
};
|
|
618
|
+
}
|
|
619
|
+
});
|
|
620
|
+
// --- Resux* Aliases ---
|
|
621
|
+
export const ResuxMotion = RxMotion;
|
|
622
|
+
export const ResuxReveal = RxReveal;
|
|
623
|
+
export const ResuxAutoAnimate = RxAutoAnimate;
|
|
624
|
+
export const ResuxButton = RxButton;
|
|
625
|
+
export const ResuxCard = RxCard;
|
|
626
|
+
export const ResuxBadge = RxBadge;
|
|
627
|
+
export const ResuxInput = RxInput;
|
|
628
|
+
export const ResuxSelect = RxSelect;
|
|
629
|
+
export const ResuxDatePicker = RxDatePicker;
|
|
630
|
+
export const ResuxPopover = RxPopover;
|
|
631
|
+
export const ResuxIcon = RxIcon;
|
|
632
|
+
export const ResuxAvatar = RxAvatar;
|
|
633
|
+
export const ResuxAlert = RxAlert;
|
|
634
|
+
export const ResuxAccordion = RxAccordion;
|
|
635
|
+
export const ResuxTooltip = RxTooltip;
|
|
636
|
+
export const ResuxDropdown = RxDropdown;
|
|
637
|
+
export const ResuxTabs = RxTabs;
|
|
638
|
+
export const ResuxTextarea = RxTextarea;
|
|
639
|
+
export const ResuxSwitch = RxSwitch;
|
|
640
|
+
export const ResuxSkeleton = RxSkeleton;
|
|
641
|
+
export const ResuxDivider = RxDivider;
|
|
642
|
+
export const ResuxKbd = RxKbd;
|
|
643
|
+
export const ResuxModal = RxModal;
|
|
644
|
+
const uiStyles = `
|
|
645
|
+
@keyframes rxFadeUp {
|
|
646
|
+
from { opacity: 0; transform: translate3d(0, 30px, 0); }
|
|
647
|
+
to { opacity: 1; transform: translate3d(0, 0, 0); }
|
|
648
|
+
}
|
|
649
|
+
@keyframes rxScaleIn {
|
|
650
|
+
from { opacity: 0; transform: scale3d(0.92, 0.92, 1); }
|
|
651
|
+
to { opacity: 1; transform: scale3d(1, 1, 1); }
|
|
652
|
+
}
|
|
653
|
+
@keyframes rxPulseGlow {
|
|
654
|
+
0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(3, 200, 191, 0.4); }
|
|
655
|
+
50% { transform: scale(1.03); box-shadow: 0 0 20px 10px rgba(3, 200, 191, 0); }
|
|
656
|
+
100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(3, 200, 191, 0); }
|
|
657
|
+
}
|
|
658
|
+
@keyframes rxShimmer {
|
|
659
|
+
0% { background-position: -200% 0; }
|
|
660
|
+
100% { background-position: 200% 0; }
|
|
661
|
+
}
|
|
662
|
+
.rx-animate-fade-up { animation: rxFadeUp 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
|
|
663
|
+
.rx-animate-scale-in { animation: rxScaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
|
|
664
|
+
.rx-animate-pulse { animation: rxPulseGlow 2s infinite; }
|
|
665
|
+
`;
|
|
666
|
+
const uiPrimitiveStyles = `
|
|
667
|
+
.rx-btn {
|
|
668
|
+
display: inline-flex;
|
|
669
|
+
align-items: center;
|
|
670
|
+
justify-content: center;
|
|
671
|
+
padding: 0.5rem 1rem;
|
|
672
|
+
font-size: 0.875rem;
|
|
673
|
+
font-weight: 500;
|
|
674
|
+
border-radius: 0.375rem;
|
|
675
|
+
cursor: pointer;
|
|
676
|
+
transition: all 0.2s ease-in-out;
|
|
677
|
+
border: 1px solid transparent;
|
|
678
|
+
}
|
|
679
|
+
.rx-btn-primary { background-color: #03c8bf; color: #0f172a; border-color: #03c8bf; }
|
|
680
|
+
.rx-btn-primary:hover { background-color: #02b3ab; }
|
|
681
|
+
.rx-btn-secondary { background-color: #334155; color: #f8fafc; border-color: #334155; }
|
|
682
|
+
.rx-btn-secondary:hover { background-color: #475569; }
|
|
683
|
+
.rx-btn-outline { background-color: transparent; color: #03c8bf; border-color: #03c8bf; }
|
|
684
|
+
.rx-btn-outline:hover { background-color: rgba(3, 200, 191, 0.1); }
|
|
685
|
+
.rx-btn-ghost { background-color: transparent; color: #cbd5e1; border-color: transparent; }
|
|
686
|
+
.rx-btn-ghost:hover { background-color: rgba(255, 255, 255, 0.08); }
|
|
687
|
+
.rx-btn-sm { padding: 0.25rem 0.625rem; font-size: 0.75rem; }
|
|
688
|
+
.rx-btn-md { padding: 0.5rem 1rem; font-size: 0.875rem; }
|
|
689
|
+
.rx-btn-lg { padding: 0.75rem 1.5rem; font-size: 1rem; }
|
|
690
|
+
|
|
691
|
+
.rx-card {
|
|
692
|
+
background-color: #1e293b;
|
|
693
|
+
border-radius: 0.5rem;
|
|
694
|
+
padding: 1.25rem;
|
|
695
|
+
border: 1px solid #334155;
|
|
696
|
+
color: #f8fafc;
|
|
697
|
+
}
|
|
698
|
+
.rx-card-glass {
|
|
699
|
+
background: rgba(30, 41, 59, 0.7);
|
|
700
|
+
backdrop-filter: blur(12px);
|
|
701
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
.rx-badge {
|
|
705
|
+
display: inline-flex;
|
|
706
|
+
align-items: center;
|
|
707
|
+
padding: 0.125rem 0.5rem;
|
|
708
|
+
border-radius: 9999px;
|
|
709
|
+
font-size: 0.75rem;
|
|
710
|
+
font-weight: 600;
|
|
711
|
+
}
|
|
712
|
+
.rx-badge-default { background-color: #334155; color: #e2e8f0; }
|
|
713
|
+
.rx-badge-success { background-color: rgba(16, 185, 129, 0.2); color: #34d399; }
|
|
714
|
+
.rx-badge-warning { background-color: rgba(245, 158, 11, 0.2); color: #fbbf24; }
|
|
715
|
+
.rx-badge-danger { background-color: rgba(239, 68, 68, 0.2); color: #f87171; }
|
|
716
|
+
.rx-badge-info { background-color: rgba(59, 130, 246, 0.2); color: #60a5fa; }
|
|
717
|
+
|
|
718
|
+
.rx-input {
|
|
719
|
+
width: 100%;
|
|
720
|
+
padding: 0.5rem 0.75rem;
|
|
721
|
+
border-radius: 0.375rem;
|
|
722
|
+
background-color: #0f172a;
|
|
723
|
+
border: 1px solid #334155;
|
|
724
|
+
color: #f8fafc;
|
|
725
|
+
font-size: 0.875rem;
|
|
726
|
+
outline: none;
|
|
727
|
+
transition: border-color 0.2s ease;
|
|
728
|
+
}
|
|
729
|
+
.rx-input:focus { border-color: #03c8bf; }
|
|
730
|
+
|
|
731
|
+
.rx-select {
|
|
732
|
+
position: relative;
|
|
733
|
+
width: 100%;
|
|
734
|
+
border-radius: 0.375rem;
|
|
735
|
+
background-color: #0f172a;
|
|
736
|
+
border: 1px solid #334155;
|
|
737
|
+
color: #f8fafc;
|
|
738
|
+
font-size: 0.875rem;
|
|
739
|
+
cursor: pointer;
|
|
740
|
+
outline: none;
|
|
741
|
+
}
|
|
742
|
+
.rx-select-trigger {
|
|
743
|
+
display: flex;
|
|
744
|
+
justify-content: space-between;
|
|
745
|
+
align-items: center;
|
|
746
|
+
padding: 0.5rem 0.75rem;
|
|
747
|
+
}
|
|
748
|
+
.rx-select-dropdown {
|
|
749
|
+
position: absolute;
|
|
750
|
+
top: 100%;
|
|
751
|
+
left: 0; right: 0;
|
|
752
|
+
margin-top: 0.25rem;
|
|
753
|
+
background-color: #1e293b;
|
|
754
|
+
border: 1px solid #334155;
|
|
755
|
+
border-radius: 0.375rem;
|
|
756
|
+
list-style: none;
|
|
757
|
+
padding: 0.25rem 0;
|
|
758
|
+
z-index: 100;
|
|
759
|
+
}
|
|
760
|
+
.rx-select-option {
|
|
761
|
+
padding: 0.5rem 0.75rem;
|
|
762
|
+
}
|
|
763
|
+
.rx-select-option:hover, .rx-select-option.selected {
|
|
764
|
+
background-color: rgba(3, 200, 191, 0.15);
|
|
765
|
+
color: #03c8bf;
|
|
766
|
+
}
|
|
767
|
+
|
|
768
|
+
.rx-avatar {
|
|
769
|
+
position: relative;
|
|
770
|
+
display: inline-flex;
|
|
771
|
+
align-items: center;
|
|
772
|
+
justify-content: center;
|
|
773
|
+
border-radius: 9999px;
|
|
774
|
+
background-color: #334155;
|
|
775
|
+
color: #f8fafc;
|
|
776
|
+
font-weight: 600;
|
|
777
|
+
overflow: hidden;
|
|
778
|
+
}
|
|
779
|
+
.rx-avatar-sm { width: 2rem; height: 2rem; font-size: 0.75rem; }
|
|
780
|
+
.rx-avatar-md { width: 2.5rem; height: 2.5rem; font-size: 0.875rem; }
|
|
781
|
+
.rx-avatar-lg { width: 3.5rem; height: 3.5rem; font-size: 1.125rem; }
|
|
782
|
+
.rx-avatar-img { width: 100%; height: 100%; object-fit: cover; }
|
|
783
|
+
.rx-avatar-status {
|
|
784
|
+
position: absolute;
|
|
785
|
+
bottom: 0; right: 0;
|
|
786
|
+
width: 0.625rem; height: 0.625rem;
|
|
787
|
+
border-radius: 9999px;
|
|
788
|
+
border: 2px solid #0f172a;
|
|
789
|
+
}
|
|
790
|
+
.rx-status-online { background-color: #10b981; }
|
|
791
|
+
.rx-status-offline { background-color: #64748b; }
|
|
792
|
+
|
|
793
|
+
.rx-alert {
|
|
794
|
+
padding: 0.875rem 1rem;
|
|
795
|
+
border-radius: 0.375rem;
|
|
796
|
+
display: flex;
|
|
797
|
+
flex-direction: column;
|
|
798
|
+
gap: 0.25rem;
|
|
799
|
+
position: relative;
|
|
800
|
+
}
|
|
801
|
+
.rx-alert-info { background-color: rgba(59, 130, 246, 0.15); border: 1px solid rgba(59, 130, 246, 0.3); color: #93c5fd; }
|
|
802
|
+
.rx-alert-success { background-color: rgba(16, 185, 129, 0.15); border: 1px solid rgba(16, 185, 129, 0.3); color: #6ee7b7; }
|
|
803
|
+
.rx-alert-warning { background-color: rgba(245, 158, 11, 0.15); border: 1px solid rgba(245, 158, 11, 0.3); color: #fde047; }
|
|
804
|
+
.rx-alert-danger { background-color: rgba(239, 68, 68, 0.15); border: 1px solid rgba(239, 68, 68, 0.3); color: #fca5a5; }
|
|
805
|
+
.rx-alert-title { font-weight: 600; font-size: 0.9375rem; }
|
|
806
|
+
|
|
807
|
+
.rx-accordion {
|
|
808
|
+
border: 1px solid #334155;
|
|
809
|
+
border-radius: 0.375rem;
|
|
810
|
+
overflow: hidden;
|
|
811
|
+
}
|
|
812
|
+
.rx-accordion-header {
|
|
813
|
+
width: 100%;
|
|
814
|
+
padding: 0.75rem 1rem;
|
|
815
|
+
background-color: #1e293b;
|
|
816
|
+
color: #f8fafc;
|
|
817
|
+
display: flex;
|
|
818
|
+
justify-content: space-between;
|
|
819
|
+
align-items: center;
|
|
820
|
+
border: none;
|
|
821
|
+
cursor: pointer;
|
|
822
|
+
}
|
|
823
|
+
.rx-accordion-body {
|
|
824
|
+
padding: 1rem;
|
|
825
|
+
background-color: #0f172a;
|
|
826
|
+
color: #cbd5e1;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
.rx-switch {
|
|
830
|
+
position: relative;
|
|
831
|
+
width: 2.75rem;
|
|
832
|
+
height: 1.5rem;
|
|
833
|
+
border-radius: 9999px;
|
|
834
|
+
background-color: #334155;
|
|
835
|
+
border: none;
|
|
836
|
+
cursor: pointer;
|
|
837
|
+
transition: background-color 0.2s ease;
|
|
838
|
+
padding: 0.125rem;
|
|
839
|
+
}
|
|
840
|
+
.rx-switch.checked { background-color: #03c8bf; }
|
|
841
|
+
.rx-switch-thumb {
|
|
842
|
+
display: block;
|
|
843
|
+
width: 1.25rem;
|
|
844
|
+
height: 1.25rem;
|
|
845
|
+
border-radius: 9999px;
|
|
846
|
+
background-color: #ffffff;
|
|
847
|
+
transition: transform 0.2s ease;
|
|
848
|
+
}
|
|
849
|
+
.rx-switch.checked .rx-switch-thumb { transform: translateX(1.25rem); }
|
|
850
|
+
|
|
851
|
+
.rx-skeleton {
|
|
852
|
+
background: linear-gradient(90deg, #1e293b 25%, #334155 50%, #1e293b 75%);
|
|
853
|
+
background-size: 200% 100%;
|
|
854
|
+
animation: rxShimmer 1.5s infinite;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
.rx-kbd {
|
|
858
|
+
display: inline-block;
|
|
859
|
+
padding: 0.125rem 0.375rem;
|
|
860
|
+
font-size: 0.75rem;
|
|
861
|
+
font-family: monospace;
|
|
862
|
+
background-color: #1e293b;
|
|
863
|
+
border: 1px solid #475569;
|
|
864
|
+
border-radius: 0.25rem;
|
|
865
|
+
color: #e2e8f0;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
.rx-divider {
|
|
869
|
+
display: flex;
|
|
870
|
+
align-items: center;
|
|
871
|
+
margin: 1rem 0;
|
|
872
|
+
}
|
|
873
|
+
.rx-divider-horizontal { border-bottom: 1px solid #334155; width: 100%; }
|
|
874
|
+
.rx-divider-label { padding: 0 0.5rem; color: #94a3b8; font-size: 0.75rem; }
|
|
875
|
+
|
|
876
|
+
.rx-modal-backdrop {
|
|
877
|
+
position: fixed;
|
|
878
|
+
top: 0; left: 0; right: 0; bottom: 0;
|
|
879
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
880
|
+
display: flex;
|
|
881
|
+
align-items: center;
|
|
882
|
+
justify-content: center;
|
|
883
|
+
z-index: 9999;
|
|
884
|
+
}
|
|
885
|
+
.rx-modal-content {
|
|
886
|
+
background-color: #1e293b;
|
|
887
|
+
border-radius: 0.5rem;
|
|
888
|
+
padding: 1.5rem;
|
|
889
|
+
max-width: 500px;
|
|
890
|
+
width: 90%;
|
|
891
|
+
border: 1px solid #334155;
|
|
892
|
+
color: #f8fafc;
|
|
893
|
+
}
|
|
894
|
+
`;
|
|
895
|
+
export default defineResuxModule({
|
|
896
|
+
defaults: {
|
|
897
|
+
css: [],
|
|
898
|
+
tokens: {},
|
|
899
|
+
defaultStyles: true,
|
|
900
|
+
animations: {
|
|
901
|
+
enabled: true,
|
|
902
|
+
defaultPreset: "fade-up"
|
|
903
|
+
}
|
|
904
|
+
},
|
|
905
|
+
setup(options, resux) {
|
|
906
|
+
const css = Array.isArray(options.css) ? options.css : [];
|
|
907
|
+
for (const href of css) {
|
|
908
|
+
if (typeof href === "string" && href.trim()) {
|
|
909
|
+
resux.addCss(href);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
const stylesToInject = [];
|
|
913
|
+
if (options.animations?.enabled !== false) {
|
|
914
|
+
stylesToInject.push(uiStyles);
|
|
915
|
+
}
|
|
916
|
+
if (options.defaultStyles !== false) {
|
|
917
|
+
stylesToInject.push(uiPrimitiveStyles);
|
|
918
|
+
}
|
|
919
|
+
if (stylesToInject.length > 0) {
|
|
920
|
+
resux.addHead({
|
|
921
|
+
style: stylesToInject.map((children) => ({ children }))
|
|
922
|
+
});
|
|
923
|
+
}
|
|
924
|
+
resux.extendRuntimeConfig({
|
|
925
|
+
public: {
|
|
926
|
+
ui: {
|
|
927
|
+
tokens: options.tokens && typeof options.tokens === "object" ? options.tokens : {},
|
|
928
|
+
defaultStyles: options.defaultStyles !== false,
|
|
929
|
+
animations: {
|
|
930
|
+
enabled: options.animations?.enabled !== false,
|
|
931
|
+
defaultPreset: options.animations?.defaultPreset || "fade-up"
|
|
932
|
+
}
|
|
933
|
+
}
|
|
934
|
+
}
|
|
935
|
+
});
|
|
936
|
+
}
|
|
937
|
+
});
|
|
938
|
+
//# sourceMappingURL=index.js.map
|