resuxjs 0.4.0-beta.2 → 0.4.0-beta.4
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/bin.d.ts +1 -1
- package/dist/bin.js +3 -2
- package/dist/bin.js.map +1 -1
- package/dist/build/index.d.ts +9 -8
- package/dist/build/index.js +2 -2
- package/dist/build/index.js.map +1 -1
- package/dist/cli.d.ts +5 -4
- package/dist/cli.js +115 -127
- package/dist/cli.js.map +1 -1
- package/dist/compiler/adapter.d.ts +6 -5
- package/dist/compiler/adapter.js +2 -1
- package/dist/compiler/adapter.js.map +1 -1
- package/dist/compiler/dev-warnings.d.ts +6 -5
- package/dist/compiler/dev-warnings.js +7 -6
- package/dist/compiler/dev-warnings.js.map +1 -1
- package/dist/compiler/directives.d.ts +4 -3
- package/dist/compiler/directives.js +2 -1
- package/dist/compiler/directives.js.map +1 -1
- package/dist/compiler/implementation.d.ts +21 -19
- package/dist/compiler/implementation.js +124 -133
- package/dist/compiler/index.d.ts +6 -5
- package/dist/compiler/index.js +2 -1
- package/dist/compiler/index.js.map +1 -1
- package/dist/core/config.d.ts +7 -5
- package/dist/core/config.js +1 -1
- package/dist/core/config.js.map +1 -1
- package/dist/core/hooks.d.ts +7 -6
- package/dist/core/hooks.js +1 -1
- package/dist/core/hooks.js.map +1 -1
- package/dist/core/index.js +2 -1
- package/dist/core/module-container.d.ts +22 -20
- package/dist/core/module-container.js +3 -3
- package/dist/core/module-container.js.map +1 -1
- package/dist/core/resux.d.ts +5 -3
- package/dist/core/resux.js +2 -1
- package/dist/core/resux.js.map +1 -1
- package/dist/create-bin.d.ts +1 -1
- package/dist/create-bin.js +3 -2
- package/dist/create-bin.js.map +1 -1
- package/dist/create.d.ts +3 -2
- package/dist/create.js +7 -10
- package/dist/create.js.map +1 -1
- package/dist/deploy/cloudflare.d.ts +3 -1
- package/dist/deploy/cloudflare.js +2 -1
- package/dist/deploy/cloudflare.js.map +1 -1
- package/dist/deploy/common.d.ts +13 -11
- package/dist/deploy/common.js +2 -1
- package/dist/deploy/common.js.map +1 -1
- package/dist/deploy/framework-runtime.d.ts +2 -1
- package/dist/deploy/framework-runtime.js +5 -1
- package/dist/deploy/framework-runtime.js.map +1 -1
- package/dist/deploy/index.d.ts +4 -2
- package/dist/deploy/index.js +4 -6
- package/dist/deploy/index.js.map +1 -1
- package/dist/deploy/netlify.d.ts +3 -1
- package/dist/deploy/netlify.js +3 -2
- package/dist/deploy/netlify.js.map +1 -1
- package/dist/deploy/node.d.ts +3 -1
- package/dist/deploy/node.js +3 -3
- package/dist/deploy/node.js.map +1 -1
- package/dist/deploy/production-report.d.ts +2 -1
- package/dist/deploy/production-report.js +2 -1
- package/dist/deploy/production-report.js.map +1 -1
- package/dist/deploy/runtime-dependencies.d.ts +5 -4
- package/dist/deploy/runtime-dependencies.js +3 -3
- package/dist/deploy/runtime-dependencies.js.map +1 -1
- package/dist/deploy/static.d.ts +3 -1
- package/dist/deploy/static.js +2 -1
- package/dist/deploy/static.js.map +1 -1
- package/dist/deploy/types.d.ts +8 -7
- package/dist/deploy/types.js +1 -1
- package/dist/deploy/vercel.d.ts +4 -2
- package/dist/deploy/vercel.js +3 -2
- package/dist/deploy/vercel.js.map +1 -1
- package/dist/fonts/index.d.ts +5 -4
- package/dist/fonts/index.js +3 -2
- package/dist/fonts/index.js.map +1 -1
- package/dist/globals.d.ts +2 -2
- package/dist/globals.js +1 -1
- package/dist/halal-core/ai/classifyProject.d.ts +5 -3
- package/dist/halal-core/ai/classifyProject.js +2 -1
- package/dist/halal-core/ai/classifyProject.js.map +1 -1
- package/dist/halal-core/ai/classifyRuntimeContent.d.ts +3 -1
- package/dist/halal-core/ai/classifyRuntimeContent.js +2 -1
- package/dist/halal-core/ai/classifyRuntimeContent.js.map +1 -1
- package/dist/halal-core/ai/createProjectSummary.d.ts +2 -1
- package/dist/halal-core/ai/createProjectSummary.js +2 -1
- package/dist/halal-core/ai/createProjectSummary.js.map +1 -1
- package/dist/halal-core/ai/halalClassifierPrompt.d.ts +2 -1
- package/dist/halal-core/ai/halalClassifierPrompt.js +1 -1
- package/dist/halal-core/ai/redactSensitiveData.d.ts +2 -1
- package/dist/halal-core/ai/redactSensitiveData.js +1 -1
- package/dist/halal-core/ai/redactSensitiveData.js.map +1 -1
- package/dist/halal-core/ai/validateAiResponse.d.ts +3 -1
- package/dist/halal-core/ai/validateAiResponse.js +3 -3
- package/dist/halal-core/ai/validateAiResponse.js.map +1 -1
- package/dist/halal-core/cli/check.d.ts +2 -1
- package/dist/halal-core/cli/check.js +3 -3
- package/dist/halal-core/cli/check.js.map +1 -1
- package/dist/halal-core/cli/explain.d.ts +2 -1
- package/dist/halal-core/cli/explain.js +3 -3
- package/dist/halal-core/cli/explain.js.map +1 -1
- package/dist/halal-core/cli/report.d.ts +2 -1
- package/dist/halal-core/cli/report.js +3 -3
- package/dist/halal-core/cli/report.js.map +1 -1
- package/dist/halal-core/cli/submitReview.d.ts +2 -1
- package/dist/halal-core/cli/submitReview.js +3 -3
- package/dist/halal-core/cli/submitReview.js.map +1 -1
- package/dist/halal-core/cli/verifyReview.d.ts +2 -1
- package/dist/halal-core/cli/verifyReview.js +3 -4
- package/dist/halal-core/cli/verifyReview.js.map +1 -1
- package/dist/halal-core/config.d.ts +9 -8
- package/dist/halal-core/config.js +2 -1
- package/dist/halal-core/config.js.map +1 -1
- package/dist/halal-core/crypto/integrity.d.ts +6 -5
- package/dist/halal-core/crypto/integrity.js +2 -1
- package/dist/halal-core/crypto/integrity.js.map +1 -1
- package/dist/halal-core/enforce.d.ts +6 -5
- package/dist/halal-core/enforce.js +13 -15
- package/dist/halal-core/enforce.js.map +1 -1
- package/dist/halal-core/index.js +2 -1
- package/dist/halal-core/lifecycle.d.ts +2 -1
- package/dist/halal-core/lifecycle.js +2 -1
- package/dist/halal-core/lifecycle.js.map +1 -1
- package/dist/halal-core/policy.d.ts +3 -1
- package/dist/halal-core/policy.js +2 -1
- package/dist/halal-core/policy.js.map +1 -1
- package/dist/halal-core/report/formatBrowserOverlay.d.ts +3 -1
- package/dist/halal-core/report/formatBrowserOverlay.js +1 -1
- package/dist/halal-core/report/formatBrowserOverlay.js.map +1 -1
- package/dist/halal-core/report/formatTerminalReport.d.ts +3 -1
- package/dist/halal-core/report/formatTerminalReport.js +1 -1
- package/dist/halal-core/report/formatTerminalReport.js.map +1 -1
- package/dist/halal-core/report/generateHalalReport.d.ts +4 -2
- package/dist/halal-core/report/generateHalalReport.js +5 -7
- package/dist/halal-core/report/generateHalalReport.js.map +1 -1
- package/dist/halal-core/report/signReport.d.ts +4 -2
- package/dist/halal-core/report/signReport.js +2 -1
- package/dist/halal-core/report/signReport.js.map +1 -1
- package/dist/halal-core/report/verifyReport.d.ts +5 -3
- package/dist/halal-core/report/verifyReport.js +4 -3
- package/dist/halal-core/report/verifyReport.js.map +1 -1
- package/dist/halal-core/review/createReviewRequest.d.ts +3 -1
- package/dist/halal-core/review/createReviewRequest.js +3 -3
- package/dist/halal-core/review/createReviewRequest.js.map +1 -1
- package/dist/halal-core/review/reviewPolicy.d.ts +4 -3
- package/dist/halal-core/review/reviewPolicy.js +1 -1
- package/dist/halal-core/review/reviewPolicy.js.map +1 -1
- package/dist/halal-core/review/signedReviewFile.d.ts +6 -4
- package/dist/halal-core/review/signedReviewFile.js +2 -1
- package/dist/halal-core/review/signedReviewFile.js.map +1 -1
- package/dist/halal-core/review/verifyReviewApproval.d.ts +3 -2
- package/dist/halal-core/review/verifyReviewApproval.js +2 -1
- package/dist/halal-core/review/verifyReviewApproval.js.map +1 -1
- package/dist/halal-core/rules/adultContentRules.d.ts +3 -2
- package/dist/halal-core/rules/adultContentRules.js +1 -1
- package/dist/halal-core/rules/adultContentRules.js.map +1 -1
- package/dist/halal-core/rules/alcoholDrugVapeRules.d.ts +3 -2
- package/dist/halal-core/rules/alcoholDrugVapeRules.js +1 -1
- package/dist/halal-core/rules/alcoholDrugVapeRules.js.map +1 -1
- package/dist/halal-core/rules/childSafetyRules.d.ts +3 -2
- package/dist/halal-core/rules/childSafetyRules.js +1 -1
- package/dist/halal-core/rules/childSafetyRules.js.map +1 -1
- package/dist/halal-core/rules/coreCategories.d.ts +3 -2
- package/dist/halal-core/rules/coreCategories.js +1 -1
- package/dist/halal-core/rules/coreCategories.js.map +1 -1
- package/dist/halal-core/rules/cyberAbuseRules.d.ts +3 -2
- package/dist/halal-core/rules/cyberAbuseRules.js +1 -1
- package/dist/halal-core/rules/cyberAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/defaultBlockedRules.d.ts +3 -1
- package/dist/halal-core/rules/defaultBlockedRules.js +9 -11
- package/dist/halal-core/rules/defaultBlockedRules.js.map +1 -1
- package/dist/halal-core/rules/dependencyRules.d.ts +3 -2
- package/dist/halal-core/rules/dependencyRules.js +1 -1
- package/dist/halal-core/rules/dependencyRules.js.map +1 -1
- package/dist/halal-core/rules/endpointRules.d.ts +3 -2
- package/dist/halal-core/rules/endpointRules.js +1 -1
- package/dist/halal-core/rules/endpointRules.js.map +1 -1
- package/dist/halal-core/rules/environmentalHarmRules.d.ts +3 -2
- package/dist/halal-core/rules/environmentalHarmRules.js +1 -1
- package/dist/halal-core/rules/environmentalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/financeRibaRules.d.ts +3 -2
- package/dist/halal-core/rules/financeRibaRules.js +1 -1
- package/dist/halal-core/rules/financeRibaRules.js.map +1 -1
- package/dist/halal-core/rules/gamblingRules.d.ts +3 -2
- package/dist/halal-core/rules/gamblingRules.js +1 -1
- package/dist/halal-core/rules/gamblingRules.js.map +1 -1
- package/dist/halal-core/rules/generalHarmRules.d.ts +3 -2
- package/dist/halal-core/rules/generalHarmRules.js +1 -1
- package/dist/halal-core/rules/generalHarmRules.js.map +1 -1
- package/dist/halal-core/rules/healthHarmRules.d.ts +3 -2
- package/dist/halal-core/rules/healthHarmRules.js +1 -1
- package/dist/halal-core/rules/healthHarmRules.js.map +1 -1
- package/dist/halal-core/rules/keywordRules.d.ts +2 -1
- package/dist/halal-core/rules/keywordRules.js +1 -1
- package/dist/halal-core/rules/keywordRules.js.map +1 -1
- package/dist/halal-core/rules/privacyAbuseRules.d.ts +3 -2
- package/dist/halal-core/rules/privacyAbuseRules.js +1 -1
- package/dist/halal-core/rules/privacyAbuseRules.js.map +1 -1
- package/dist/halal-core/rules/scamFraudRules.d.ts +3 -2
- package/dist/halal-core/rules/scamFraudRules.js +1 -1
- package/dist/halal-core/rules/scamFraudRules.js.map +1 -1
- package/dist/halal-core/rules/selfHarmRules.d.ts +3 -2
- package/dist/halal-core/rules/selfHarmRules.js +1 -1
- package/dist/halal-core/rules/selfHarmRules.js.map +1 -1
- package/dist/halal-core/rules/violenceExtremismRules.d.ts +3 -2
- package/dist/halal-core/rules/violenceExtremismRules.js +1 -1
- package/dist/halal-core/rules/violenceExtremismRules.js.map +1 -1
- package/dist/halal-core/runtime/guard.d.ts +5 -3
- package/dist/halal-core/runtime/guard.js +2 -1
- package/dist/halal-core/runtime/guard.js.map +1 -1
- package/dist/halal-core/runtime/index.js +2 -1
- package/dist/halal-core/runtime/reviewedMemory.d.ts +6 -4
- package/dist/halal-core/runtime/reviewedMemory.js +3 -2
- package/dist/halal-core/runtime/reviewedMemory.js.map +1 -1
- package/dist/halal-core/runtime/serializeRuntimeContent.d.ts +7 -5
- package/dist/halal-core/runtime/serializeRuntimeContent.js +4 -3
- package/dist/halal-core/runtime/serializeRuntimeContent.js.map +1 -1
- package/dist/halal-core/runtime/types.d.ts +11 -9
- package/dist/halal-core/runtime/types.js +1 -1
- package/dist/halal-core/scanner/scanApiRoutes.d.ts +2 -1
- package/dist/halal-core/scanner/scanApiRoutes.js +2 -1
- package/dist/halal-core/scanner/scanApiRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanComponents.d.ts +2 -1
- package/dist/halal-core/scanner/scanComponents.js +2 -1
- package/dist/halal-core/scanner/scanComponents.js.map +1 -1
- package/dist/halal-core/scanner/scanContent.d.ts +3 -2
- package/dist/halal-core/scanner/scanContent.js +4 -3
- package/dist/halal-core/scanner/scanContent.js.map +1 -1
- package/dist/halal-core/scanner/scanDependencies.d.ts +2 -1
- package/dist/halal-core/scanner/scanDependencies.js +2 -1
- package/dist/halal-core/scanner/scanDependencies.js.map +1 -1
- package/dist/halal-core/scanner/scanDomains.d.ts +2 -1
- package/dist/halal-core/scanner/scanDomains.js +1 -1
- package/dist/halal-core/scanner/scanDomains.js.map +1 -1
- package/dist/halal-core/scanner/scanEnvNames.d.ts +2 -1
- package/dist/halal-core/scanner/scanEnvNames.js +2 -1
- package/dist/halal-core/scanner/scanEnvNames.js.map +1 -1
- package/dist/halal-core/scanner/scanMetadata.d.ts +3 -2
- package/dist/halal-core/scanner/scanMetadata.js +2 -1
- package/dist/halal-core/scanner/scanMetadata.js.map +1 -1
- package/dist/halal-core/scanner/scanPages.d.ts +2 -1
- package/dist/halal-core/scanner/scanPages.js +2 -1
- package/dist/halal-core/scanner/scanPages.js.map +1 -1
- package/dist/halal-core/scanner/scanProject.d.ts +4 -2
- package/dist/halal-core/scanner/scanProject.js +2 -1
- package/dist/halal-core/scanner/scanProject.js.map +1 -1
- package/dist/halal-core/scanner/scanRoutes.d.ts +2 -1
- package/dist/halal-core/scanner/scanRoutes.js +2 -1
- package/dist/halal-core/scanner/scanRoutes.js.map +1 -1
- package/dist/halal-core/scanner/scanTranslations.d.ts +2 -1
- package/dist/halal-core/scanner/scanTranslations.js +2 -1
- package/dist/halal-core/scanner/scanTranslations.js.map +1 -1
- package/dist/halal-core/status.d.ts +3 -2
- package/dist/halal-core/status.js +1 -1
- package/dist/halal-core/tamper/verifyCoreIntegrity.d.ts +2 -1
- package/dist/halal-core/tamper/verifyCoreIntegrity.js +2 -1
- package/dist/halal-core/tamper/verifyCoreIntegrity.js.map +1 -1
- package/dist/halal-core/tamper/verifyLifecycleHooks.d.ts +2 -1
- package/dist/halal-core/tamper/verifyLifecycleHooks.js +1 -1
- package/dist/halal-core/tamper/verifyLifecycleHooks.js.map +1 -1
- package/dist/halal-core/tamper/verifyReportSignature.d.ts +3 -1
- package/dist/halal-core/tamper/verifyReportSignature.js +3 -3
- package/dist/halal-core/tamper/verifyReportSignature.js.map +1 -1
- package/dist/halal.js +2 -1
- package/dist/i18n/index.d.ts +12 -11
- package/dist/i18n/index.js +5 -6
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/shared.d.ts +15 -14
- package/dist/i18n/shared.js +4 -4
- package/dist/i18n/shared.js.map +1 -1
- package/dist/icons/index.d.ts +18 -16
- package/dist/icons/index.js +5 -4
- package/dist/icons/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -1
- package/dist/kit/index.d.ts +23 -21
- package/dist/kit/index.js +2 -1
- package/dist/kit/index.js.map +1 -1
- package/dist/nitro-server/index.d.ts +3 -2
- package/dist/nitro-server/index.js +1 -1
- package/dist/nitro-server/index.js.map +1 -1
- package/dist/node.d.ts +4 -2
- package/dist/node.js +7 -6
- package/dist/node.js.map +1 -1
- package/dist/reactivity/computed.d.ts +5 -3
- package/dist/reactivity/computed.js +3 -3
- package/dist/reactivity/computed.js.map +1 -1
- package/dist/reactivity/effect.d.ts +15 -13
- package/dist/reactivity/effect.js +9 -10
- package/dist/reactivity/effect.js.map +1 -1
- package/dist/reactivity/index.js +2 -1
- package/dist/reactivity/reactive.d.ts +6 -5
- package/dist/reactivity/reactive.js +5 -4
- package/dist/reactivity/reactive.js.map +1 -1
- package/dist/reactivity/readonly.js +2 -1
- package/dist/reactivity/ref.d.ts +9 -7
- package/dist/reactivity/ref.js +2 -4
- package/dist/reactivity/ref.js.map +1 -1
- package/dist/reactivity/scheduler.d.ts +5 -4
- package/dist/reactivity/scheduler.js +1 -1
- package/dist/reactivity/scheduler.js.map +1 -1
- package/dist/reactivity/types.d.ts +12 -11
- package/dist/reactivity/types.js +1 -1
- package/dist/reactivity/utils.d.ts +10 -9
- package/dist/reactivity/utils.js +1 -1
- package/dist/reactivity/utils.js.map +1 -1
- package/dist/reactivity/watch.d.ts +4 -2
- package/dist/reactivity/watch.js +4 -5
- package/dist/reactivity/watch.js.map +1 -1
- package/dist/runtime/core.d.ts +5 -4
- package/dist/runtime/core.js +9 -10
- package/dist/runtime/core.js.map +1 -1
- package/dist/runtime/index.d.ts +123 -122
- package/dist/runtime/index.js +45 -58
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/reactivity.js +2 -1
- package/dist/runtime/resume.d.ts +15 -14
- package/dist/runtime/resume.js +3 -3
- package/dist/runtime/resume.js.map +1 -1
- package/dist/runtime/router.d.ts +5 -4
- package/dist/runtime/router.js +1 -1
- package/dist/runtime/router.js.map +1 -1
- package/dist/runtime/streaming.d.ts +7 -6
- package/dist/runtime/streaming.js +3 -3
- package/dist/runtime/streaming.js.map +1 -1
- package/dist/security/media-fetch.d.ts +11 -10
- package/dist/security/media-fetch.js +5 -4
- package/dist/security/media-fetch.js.map +1 -1
- package/dist/security/path-boundary.d.ts +5 -4
- package/dist/security/path-boundary.js +2 -1
- package/dist/security/path-boundary.js.map +1 -1
- package/dist/ui/index.d.ts +195 -193
- package/dist/ui/index.js +7 -8
- package/dist/ui/index.js.map +1 -1
- package/dist/vite-builder/index.d.ts +3 -2
- package/dist/vite-builder/index.js +1 -1
- package/dist/vite-builder/index.js.map +1 -1
- package/package.json +2 -2
package/dist/i18n/shared.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","names":[],"sources":["../../src/i18n/shared.ts"],"sourcesContent":["export type ResuxI18nStrategy = \"prefix_except_default\" | \"prefix\" | \"no_prefix\";\n\nexport interface ResuxI18nLocale {\n code: string;\n name?: string;\n dir?: \"ltr\" | \"rtl\";\n}\n\nexport interface ResuxI18nRuntimeConfig {\n defaultLocale: string;\n fallbackLocale: string;\n strategy: ResuxI18nStrategy;\n locales: ResuxI18nLocale[];\n messages: Record<string, Record<string, unknown>>;\n}\n\nexport interface ResuxI18nResolvedRoute {\n locale: ResuxI18nLocale;\n basePath: string;\n localizedPath: string;\n}\n\nexport interface ResuxI18nTranslationParams {\n [key: string]: string | number | boolean | null | undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n\nfunction normalizeLocaleCode(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim().toLowerCase();\n if (!/^[a-z0-9-]+$/.test(normalized)) {\n return null;\n }\n return normalized;\n}\n\nfunction normalizePathname(pathname: string): string {\n const source = String(pathname || \"\").trim();\n if (!source) {\n return \"/\";\n }\n const withSlash = source.startsWith(\"/\") ? source : `/${source}`;\n if (withSlash !== \"/\" && withSlash.endsWith(\"/\")) {\n return withSlash.replace(/\\/+$/g, \"\");\n }\n return withSlash;\n}\n\nfunction splitPathSuffix(input: string): { pathname: string; suffix: string } {\n const source = String(input || \"\");\n const hashIndex = source.indexOf(\"#\");\n const queryIndex = source.indexOf(\"?\");\n const splitIndex = [hashIndex, queryIndex]\n .filter((index) => index >= 0)\n .sort((left, right) => left - right)[0];\n if (splitIndex === undefined) {\n return { pathname: source, suffix: \"\" };\n }\n return {\n pathname: source.slice(0, splitIndex),\n suffix: source.slice(splitIndex)\n };\n}\n\nfunction joinLocalePath(localeCode: string, basePath: string): string {\n const normalizedBase = normalizePathname(basePath);\n return normalizedBase === \"/\" ? `/${localeCode}` : `/${localeCode}${normalizedBase}`;\n}\n\nfunction isLocalePrefixedForStrategy(strategy: ResuxI18nStrategy, localeCode: string, defaultLocale: string): boolean {\n if (strategy === \"prefix\") {\n return true;\n }\n if (strategy === \"prefix_except_default\") {\n return localeCode !== defaultLocale;\n }\n return false;\n}\n\nfunction resolveLocaleByCode(locales: ResuxI18nLocale[], code: string): ResuxI18nLocale | null {\n return locales.find((locale) => locale.code === code) ?? null;\n}\n\nconst FORBIDDEN_MESSAGE_KEYS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\nfunction readNestedValue(source: Record<string, unknown>, key: string): unknown {\n if (!key) {\n return source;\n }\n const parts = key.split(\".\");\n let cursor: unknown = source;\n for (const part of parts) {\n if (\n FORBIDDEN_MESSAGE_KEYS.has(part)\n || !isRecord(cursor)\n || !Object.hasOwn(cursor, part)\n ) {\n return undefined;\n }\n cursor = cursor[part];\n }\n return cursor;\n}\n\nfunction interpolateMessage(template: string, params: ResuxI18nTranslationParams): string {\n return template.replace(/\\{([A-Za-z0-9_]+)\\}/g, (match, key: string) => {\n const value = params[key];\n if (value === undefined || value === null) {\n return match;\n }\n return String(value);\n });\n}\n\nexport function normalizeI18nStrategy(value: unknown): ResuxI18nStrategy {\n if (value === \"prefix\" || value === \"no_prefix\" || value === \"prefix_except_default\") {\n return value;\n }\n return \"prefix_except_default\";\n}\n\nexport function normalizeI18nRuntimeConfig(value: unknown): ResuxI18nRuntimeConfig | null {\n if (!isRecord(value)) {\n return null;\n }\n\n const localeEntries = Array.isArray(value.locales) ? value.locales : [];\n const locales: ResuxI18nLocale[] = [];\n for (const entry of localeEntries) {\n if (!isRecord(entry)) {\n continue;\n }\n const code = normalizeLocaleCode(entry.code);\n if (!code) {\n continue;\n }\n locales.push({\n code,\n ...(typeof entry.name === \"string\" ? { name: entry.name } : {}),\n dir: entry.dir === \"rtl\" ? \"rtl\" : \"ltr\"\n });\n }\n\n if (!locales.length) {\n return null;\n }\n\n const uniqueLocales: ResuxI18nLocale[] = [];\n const localeCodes = new Set<string>();\n for (const locale of locales) {\n if (localeCodes.has(locale.code)) {\n continue;\n }\n localeCodes.add(locale.code);\n uniqueLocales.push(locale);\n }\n\n const firstLocale = uniqueLocales[0];\n const defaultLocale = normalizeLocaleCode(value.defaultLocale) ?? firstLocale.code;\n const fallbackLocale = normalizeLocaleCode(value.fallbackLocale) ?? defaultLocale;\n const strategy = normalizeI18nStrategy(value.strategy);\n const messagesInput = isRecord(value.messages) ? value.messages : {};\n const messages: Record<string, Record<string, unknown>> = {};\n\n for (const locale of uniqueLocales) {\n const entry = messagesInput[locale.code];\n messages[locale.code] = isRecord(entry) ? entry : {};\n }\n\n const normalizedDefault = resolveLocaleByCode(uniqueLocales, defaultLocale)?.code ?? firstLocale.code;\n const normalizedFallback = resolveLocaleByCode(uniqueLocales, fallbackLocale)?.code ?? normalizedDefault;\n\n return {\n defaultLocale: normalizedDefault,\n fallbackLocale: normalizedFallback,\n strategy,\n locales: uniqueLocales,\n messages\n };\n}\n\nexport function resolveI18nRoute(pathname: string, config: ResuxI18nRuntimeConfig): ResuxI18nResolvedRoute {\n // Route identity is pathname-only. Query strings and hashes belong to\n // navigation state and must not be mistaken for a route segment or leak into\n // canonical/hreflang URLs.\n const { pathname: rawPathname } = splitPathSuffix(pathname);\n const normalizedPath = normalizePathname(rawPathname);\n const segments = normalizedPath === \"/\" ? [] : normalizedPath.slice(1).split(\"/\");\n const first = segments[0];\n const candidate = first ? resolveLocaleByCode(config.locales, first) : null;\n\n // For prefixed strategies, always consume a recognized locale segment. In\n // prefix_except_default the default-locale prefix is non-canonical, but it\n // still needs to be stripped so locale switching never produces paths such\n // as /fr/en/about.\n if (candidate && config.strategy !== \"no_prefix\") {\n const remainder = segments.slice(1);\n const basePath = remainder.length ? `/${remainder.join(\"/\")}` : \"/\";\n const localizedPath = isLocalePrefixedForStrategy(\n config.strategy,\n candidate.code,\n config.defaultLocale,\n )\n ? normalizedPath\n : basePath;\n return {\n locale: candidate,\n basePath,\n localizedPath\n };\n }\n\n const fallbackLocale = config.locales[0];\n if (!fallbackLocale) {\n return {\n locale: { code: \"en\", dir: \"ltr\" },\n basePath: normalizedPath,\n localizedPath: normalizedPath\n };\n }\n const defaultLocale = resolveLocaleByCode(config.locales, config.defaultLocale) ?? fallbackLocale;\n const defaultLocalizedPath = isLocalePrefixedForStrategy(config.strategy, defaultLocale.code, config.defaultLocale)\n ? joinLocalePath(defaultLocale.code, normalizedPath)\n : normalizedPath;\n return {\n locale: defaultLocale,\n basePath: normalizedPath,\n localizedPath: defaultLocalizedPath\n };\n}\n\nexport function buildLocalePath(path: string, localeCode: string, config: ResuxI18nRuntimeConfig): string {\n const fallbackLocale = config.locales[0];\n if (!fallbackLocale) {\n const { pathname, suffix } = splitPathSuffix(path);\n return `${normalizePathname(pathname)}${suffix}`;\n }\n const targetLocale = resolveLocaleByCode(config.locales, normalizeLocaleCode(localeCode) ?? config.defaultLocale)\n ?? resolveLocaleByCode(config.locales, config.defaultLocale)\n ?? fallbackLocale;\n const { pathname, suffix } = splitPathSuffix(path);\n const current = resolveI18nRoute(pathname, config);\n const basePath = normalizePathname(current.basePath);\n\n if (!isLocalePrefixedForStrategy(config.strategy, targetLocale.code, config.defaultLocale)) {\n return `${basePath}${suffix}`;\n }\n\n return `${joinLocalePath(targetLocale.code, basePath)}${suffix}`;\n}\n\nexport function resolveLocaleDirection(config: ResuxI18nRuntimeConfig, localeCode: string): \"ltr\" | \"rtl\" {\n return resolveLocaleByCode(config.locales, localeCode)?.dir === \"rtl\" ? \"rtl\" : \"ltr\";\n}\n\nexport function resolveLocalizedValue(\n value: unknown,\n localeCode: string,\n fallbackLocale: string\n): string | null {\n if (typeof value === \"string\") {\n return value;\n }\n if (!isRecord(value)) {\n return null;\n }\n const primary = value[localeCode];\n if (typeof primary === \"string\") {\n return primary;\n }\n const fallback = value[fallbackLocale];\n if (typeof fallback === \"string\") {\n return fallback;\n }\n return null;\n}\n\nexport function translateRaw(\n config: ResuxI18nRuntimeConfig,\n localeCode: string,\n key: string\n): unknown {\n const localeMessages = config.messages[localeCode];\n if (localeMessages) {\n const direct = readNestedValue(localeMessages, key);\n if (direct !== undefined) {\n return direct;\n }\n }\n\n const fallbackMessages = config.messages[config.fallbackLocale];\n if (fallbackMessages) {\n const fallback = readNestedValue(fallbackMessages, key);\n if (fallback !== undefined) {\n return fallback;\n }\n }\n\n return undefined;\n}\n\nexport function translateText(\n config: ResuxI18nRuntimeConfig,\n localeCode: string,\n key: string,\n params: ResuxI18nTranslationParams = {}\n): string {\n const raw = translateRaw(config, localeCode, key);\n if (typeof raw === \"string\") {\n return interpolateMessage(raw, params);\n }\n if (typeof raw === \"number\" || typeof raw === \"boolean\") {\n return String(raw);\n }\n return key;\n}\n\nexport function createI18nHead(\n routePath: string,\n routeOrigin: string | undefined,\n config: ResuxI18nRuntimeConfig,\n options: { includeHreflang?: boolean } = {}\n): { htmlAttrs: Record<string, string>; link: Array<Record<string, string>> } {\n const resolved = resolveI18nRoute(routePath, config);\n const includeHreflang = options.includeHreflang !== false;\n const htmlAttrs: Record<string, string> = {\n lang: resolved.locale.code,\n dir: resolveLocaleDirection(config, resolved.locale.code)\n };\n const link: Array<Record<string, string>> = [];\n\n const canonicalPath = buildLocalePath(resolved.basePath, resolved.locale.code, config);\n const canonicalHref = routeOrigin ? new URL(canonicalPath, routeOrigin).toString() : canonicalPath;\n link.push({\n rel: \"canonical\",\n href: canonicalHref\n });\n\n if (includeHreflang) {\n for (const locale of config.locales) {\n const hrefPath = buildLocalePath(resolved.basePath, locale.code, config);\n const href = routeOrigin ? new URL(hrefPath, routeOrigin).toString() : hrefPath;\n link.push({\n rel: \"alternate\",\n hreflang: locale.code,\n href\n });\n }\n\n const defaultHrefPath = buildLocalePath(resolved.basePath, config.defaultLocale, config);\n const defaultHref = routeOrigin ? new URL(defaultHrefPath, routeOrigin).toString() : defaultHrefPath;\n link.push({\n rel: \"alternate\",\n hreflang: \"x-default\",\n href: defaultHref\n });\n }\n\n return {\n htmlAttrs,\n link\n };\n}"],"mappings":";AA0BA,SAAS,SAAS,OAAkD;CAClE,OAAO,QAAQ,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,KAAK,CAAC;AAC5E;AAEA,SAAS,oBAAoB,OAA+B;CAC1D,IAAI,OAAO,UAAU,UACnB,OAAO;CAET,MAAM,aAAa,MAAM,KAAK,CAAC,CAAC,YAAY;CAC5C,IAAI,CAAC,eAAe,KAAK,UAAU,GACjC,OAAO;CAET,OAAO;AACT;AAEA,SAAS,kBAAkB,UAA0B;CACnD,MAAM,SAAS,OAAO,YAAY,EAAE,CAAC,CAAC,KAAK;CA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ACA,SAAqC,CAAC,GAC9B;CACR,MAAM,MAAM,aAAa,QAAQ,YAAY,GAAG;CAChD,IAAI,OAAO,QAAQ,UACjB,OAAO,mBAAmB,KAAK,MAAM;CAEvC,IAAI,OAAO,QAAQ,YAAY,OAAO,QAAQ,WAC5C,OAAO,OAAO,GAAG;CAEnB,OAAO;AACT;AAEA,SAAgB,eACd,WACA,aACA,QACA,UAAyC,CAAC,GACkC;CAC5E,MAAM,WAAW,iBAAiB,WAAW,MAAM;CACnD,MAAM,kBAAkB,QAAQ,oBAAoB;CACpD,MAAM,YAAoC;EACxC,MAAM,SAAS,OAAO;EACtB,KAAK,uBAAuB,QAAQ,SAAS,OAAO,IAAI;CAC1D;CACA,MAAM,OAAsC,CAAC;CAE7C,MAAM,gBAAgB,gBAAgB,SAAS,UAAU,SAAS,OAAO,MAAM,MAAM;CACrF,MAAM,gBAAgB,cAAc,IAAI,IAAI,eAAe,WAAW,CAAC,CAAC,SAAS,IAAI;CACrF,KAAK,KAAK;EACR,KAAK;EACL,MAAM;CACR,CAAC;CAED,IAAI,iBAAiB;EACnB,KAAK,MAAM,UAAU,OAAO,SAAS;GACnC,MAAM,WAAW,gBAAgB,SAAS,UAAU,OAAO,MAAM,MAAM;GACvE,MAAM,OAAO,cAAc,IAAI,IAAI,UAAU,WAAW,CAAC,CAAC,SAAS,IAAI;GACvE,KAAK,KAAK;IACR,KAAK;IACL,UAAU,OAAO;IACjB;GACF,CAAC;EACH;EAEA,MAAM,kBAAkB,gBAAgB,SAAS,UAAU,OAAO,eAAe,MAAM;EACvF,MAAM,cAAc,cAAc,IAAI,IAAI,iBAAiB,WAAW,CAAC,CAAC,SAAS,IAAI;EACrF,KAAK,KAAK;GACR,KAAK;GACL,UAAU;GACV,MAAM;EACR,CAAC;CACH;CAEA,OAAO;EACL;EACA;CACF;AACF"}
|
|
1
|
+
{"version":3,"file":"shared.js","names":["pathname","suffix"],"sources":["../../src/i18n/shared.ts"],"sourcesContent":["export type ResuxI18nStrategy = \"prefix_except_default\" | \"prefix\" | \"no_prefix\";\n\nexport interface ResuxI18nLocale {\n code: string;\n name?: string;\n dir?: \"ltr\" | \"rtl\";\n}\n\nexport interface ResuxI18nRuntimeConfig {\n defaultLocale: string;\n fallbackLocale: string;\n strategy: ResuxI18nStrategy;\n locales: ResuxI18nLocale[];\n messages: Record<string, Record<string, unknown>>;\n}\n\nexport interface ResuxI18nResolvedRoute {\n locale: ResuxI18nLocale;\n basePath: string;\n localizedPath: string;\n}\n\nexport interface ResuxI18nTranslationParams {\n [key: string]: string | number | boolean | null | undefined;\n}\n\nfunction isRecord(value: unknown): value is Record<string, unknown> {\n return Boolean(value && typeof value === \"object\" && !Array.isArray(value));\n}\n\nfunction normalizeLocaleCode(value: unknown): string | null {\n if (typeof value !== \"string\") {\n return null;\n }\n const normalized = value.trim().toLowerCase();\n if (!/^[a-z0-9-]+$/.test(normalized)) {\n return null;\n }\n return normalized;\n}\n\nfunction normalizePathname(pathname: string): string {\n const source = String(pathname || \"\").trim();\n if (!source) {\n return \"/\";\n }\n const withSlash = source.startsWith(\"/\") ? source : `/${source}`;\n if (withSlash !== \"/\" && withSlash.endsWith(\"/\")) {\n return withSlash.replace(/\\/+$/g, \"\");\n }\n return withSlash;\n}\n\nfunction splitPathSuffix(input: string): { pathname: string; suffix: string } {\n const source = String(input || \"\");\n const hashIndex = source.indexOf(\"#\");\n const queryIndex = source.indexOf(\"?\");\n const splitIndex = [hashIndex, queryIndex]\n .filter((index) => index >= 0)\n .sort((left, right) => left - right)[0];\n if (splitIndex === undefined) {\n return { pathname: source, suffix: \"\" };\n }\n return {\n pathname: source.slice(0, splitIndex),\n suffix: source.slice(splitIndex)\n };\n}\n\nfunction joinLocalePath(localeCode: string, basePath: string): string {\n const normalizedBase = normalizePathname(basePath);\n return normalizedBase === \"/\" ? `/${localeCode}` : `/${localeCode}${normalizedBase}`;\n}\n\nfunction isLocalePrefixedForStrategy(strategy: ResuxI18nStrategy, localeCode: string, defaultLocale: string): boolean {\n if (strategy === \"prefix\") {\n return true;\n }\n if (strategy === \"prefix_except_default\") {\n return localeCode !== defaultLocale;\n }\n return false;\n}\n\nfunction resolveLocaleByCode(locales: ResuxI18nLocale[], code: string): ResuxI18nLocale | null {\n return locales.find((locale) => locale.code === code) ?? null;\n}\n\nconst FORBIDDEN_MESSAGE_KEYS = new Set([\"__proto__\", \"prototype\", \"constructor\"]);\n\nfunction readNestedValue(source: Record<string, unknown>, key: string): unknown {\n if (!key) {\n return source;\n }\n const parts = key.split(\".\");\n let cursor: unknown = source;\n for (const part of parts) {\n if (\n FORBIDDEN_MESSAGE_KEYS.has(part)\n || !isRecord(cursor)\n || !Object.hasOwn(cursor, part)\n ) {\n return undefined;\n }\n cursor = cursor[part];\n }\n return cursor;\n}\n\nfunction interpolateMessage(template: string, params: ResuxI18nTranslationParams): string {\n return template.replace(/\\{([A-Za-z0-9_]+)\\}/g, (match, key: string) => {\n const value = params[key];\n if (value === undefined || value === null) {\n return match;\n }\n return String(value);\n });\n}\n\nexport function normalizeI18nStrategy(value: unknown): ResuxI18nStrategy {\n if (value === \"prefix\" || value === \"no_prefix\" || value === \"prefix_except_default\") {\n return value;\n }\n return \"prefix_except_default\";\n}\n\nexport function normalizeI18nRuntimeConfig(value: unknown): ResuxI18nRuntimeConfig | null {\n if (!isRecord(value)) {\n return null;\n }\n\n const localeEntries = Array.isArray(value.locales) ? value.locales : [];\n const locales: ResuxI18nLocale[] = [];\n for (const entry of localeEntries) {\n if (!isRecord(entry)) {\n continue;\n }\n const code = normalizeLocaleCode(entry.code);\n if (!code) {\n continue;\n }\n locales.push({\n code,\n ...(typeof entry.name === \"string\" ? { name: entry.name } : {}),\n dir: entry.dir === \"rtl\" ? \"rtl\" : \"ltr\"\n });\n }\n\n if (!locales.length) {\n return null;\n }\n\n const uniqueLocales: ResuxI18nLocale[] = [];\n const localeCodes = new Set<string>();\n for (const locale of locales) {\n if (localeCodes.has(locale.code)) {\n continue;\n }\n localeCodes.add(locale.code);\n uniqueLocales.push(locale);\n }\n\n const firstLocale = uniqueLocales[0];\n const defaultLocale = normalizeLocaleCode(value.defaultLocale) ?? firstLocale.code;\n const fallbackLocale = normalizeLocaleCode(value.fallbackLocale) ?? defaultLocale;\n const strategy = normalizeI18nStrategy(value.strategy);\n const messagesInput = isRecord(value.messages) ? value.messages : {};\n const messages: Record<string, Record<string, unknown>> = {};\n\n for (const locale of uniqueLocales) {\n const entry = messagesInput[locale.code];\n messages[locale.code] = isRecord(entry) ? entry : {};\n }\n\n const normalizedDefault = resolveLocaleByCode(uniqueLocales, defaultLocale)?.code ?? firstLocale.code;\n const normalizedFallback = resolveLocaleByCode(uniqueLocales, fallbackLocale)?.code ?? normalizedDefault;\n\n return {\n defaultLocale: normalizedDefault,\n fallbackLocale: normalizedFallback,\n strategy,\n locales: uniqueLocales,\n messages\n };\n}\n\nexport function resolveI18nRoute(pathname: string, config: ResuxI18nRuntimeConfig): ResuxI18nResolvedRoute {\n // Route identity is pathname-only. Query strings and hashes belong to\n // navigation state and must not be mistaken for a route segment or leak into\n // canonical/hreflang URLs.\n const { pathname: rawPathname } = splitPathSuffix(pathname);\n const normalizedPath = normalizePathname(rawPathname);\n const segments = normalizedPath === \"/\" ? [] : normalizedPath.slice(1).split(\"/\");\n const first = segments[0];\n const candidate = first ? resolveLocaleByCode(config.locales, first) : null;\n\n // For prefixed strategies, always consume a recognized locale segment. In\n // prefix_except_default the default-locale prefix is non-canonical, but it\n // still needs to be stripped so locale switching never produces paths such\n // as /fr/en/about.\n if (candidate && config.strategy !== \"no_prefix\") {\n const remainder = segments.slice(1);\n const basePath = remainder.length ? `/${remainder.join(\"/\")}` : \"/\";\n const localizedPath = isLocalePrefixedForStrategy(\n config.strategy,\n candidate.code,\n config.defaultLocale,\n )\n ? normalizedPath\n : basePath;\n return {\n locale: candidate,\n basePath,\n localizedPath\n };\n }\n\n const fallbackLocale = config.locales[0];\n if (!fallbackLocale) {\n return {\n locale: { code: \"en\", dir: \"ltr\" },\n basePath: normalizedPath,\n localizedPath: normalizedPath\n };\n }\n const defaultLocale = resolveLocaleByCode(config.locales, config.defaultLocale) ?? fallbackLocale;\n const defaultLocalizedPath = isLocalePrefixedForStrategy(config.strategy, defaultLocale.code, config.defaultLocale)\n ? joinLocalePath(defaultLocale.code, normalizedPath)\n : normalizedPath;\n return {\n locale: defaultLocale,\n basePath: normalizedPath,\n localizedPath: defaultLocalizedPath\n };\n}\n\nexport function buildLocalePath(path: string, localeCode: string, config: ResuxI18nRuntimeConfig): string {\n const fallbackLocale = config.locales[0];\n if (!fallbackLocale) {\n const { pathname, suffix } = splitPathSuffix(path);\n return `${normalizePathname(pathname)}${suffix}`;\n }\n const targetLocale = resolveLocaleByCode(config.locales, normalizeLocaleCode(localeCode) ?? config.defaultLocale)\n ?? resolveLocaleByCode(config.locales, config.defaultLocale)\n ?? fallbackLocale;\n const { pathname, suffix } = splitPathSuffix(path);\n const current = resolveI18nRoute(pathname, config);\n const basePath = normalizePathname(current.basePath);\n\n if (!isLocalePrefixedForStrategy(config.strategy, targetLocale.code, config.defaultLocale)) {\n return `${basePath}${suffix}`;\n }\n\n return `${joinLocalePath(targetLocale.code, basePath)}${suffix}`;\n}\n\nexport function resolveLocaleDirection(config: ResuxI18nRuntimeConfig, localeCode: string): \"ltr\" | \"rtl\" {\n return resolveLocaleByCode(config.locales, localeCode)?.dir === \"rtl\" ? \"rtl\" : \"ltr\";\n}\n\nexport function resolveLocalizedValue(\n value: unknown,\n localeCode: string,\n fallbackLocale: string\n): string | null {\n if (typeof value === \"string\") {\n return value;\n }\n if (!isRecord(value)) {\n return null;\n }\n const primary = value[localeCode];\n if (typeof primary === \"string\") {\n return primary;\n }\n const fallback = value[fallbackLocale];\n if (typeof fallback === \"string\") {\n return fallback;\n }\n return null;\n}\n\nexport function translateRaw(\n config: ResuxI18nRuntimeConfig,\n localeCode: string,\n key: string\n): unknown {\n const localeMessages = config.messages[localeCode];\n if (localeMessages) {\n const direct = readNestedValue(localeMessages, key);\n if (direct !== undefined) {\n return direct;\n }\n }\n\n const fallbackMessages = config.messages[config.fallbackLocale];\n if (fallbackMessages) {\n const fallback = readNestedValue(fallbackMessages, key);\n if (fallback !== undefined) {\n return fallback;\n }\n }\n\n return undefined;\n}\n\nexport function translateText(\n config: ResuxI18nRuntimeConfig,\n localeCode: string,\n key: string,\n params: ResuxI18nTranslationParams = {}\n): string {\n const raw = translateRaw(config, localeCode, key);\n if (typeof raw === \"string\") {\n return interpolateMessage(raw, params);\n }\n if (typeof raw === \"number\" || typeof raw === \"boolean\") {\n return String(raw);\n }\n return key;\n}\n\nexport function createI18nHead(\n routePath: string,\n routeOrigin: string | undefined,\n config: ResuxI18nRuntimeConfig,\n options: { includeHreflang?: boolean } = {}\n): { htmlAttrs: Record<string, string>; link: Array<Record<string, string>> } {\n const resolved = resolveI18nRoute(routePath, config);\n const includeHreflang = options.includeHreflang !== false;\n const htmlAttrs: Record<string, string> = {\n lang: resolved.locale.code,\n dir: resolveLocaleDirection(config, resolved.locale.code)\n };\n const link: Array<Record<string, string>> = [];\n\n const canonicalPath = buildLocalePath(resolved.basePath, resolved.locale.code, config);\n const canonicalHref = routeOrigin ? new URL(canonicalPath, routeOrigin).toString() : canonicalPath;\n link.push({\n rel: \"canonical\",\n href: canonicalHref\n });\n\n if (includeHreflang) {\n for (const locale of config.locales) {\n const hrefPath = buildLocalePath(resolved.basePath, locale.code, config);\n const href = routeOrigin ? new URL(hrefPath, routeOrigin).toString() : hrefPath;\n link.push({\n rel: \"alternate\",\n hreflang: locale.code,\n href\n });\n }\n\n const defaultHrefPath = buildLocalePath(resolved.basePath, config.defaultLocale, config);\n const defaultHref = routeOrigin ? new URL(defaultHrefPath, routeOrigin).toString() : defaultHrefPath;\n link.push({\n rel: \"alternate\",\n hreflang: \"x-default\",\n href: defaultHref\n });\n }\n\n return {\n htmlAttrs,\n link\n };\n}"],"mappings":";AA0BA,SAAS,SAAS,OAAkD;AAClE,QAAO,QAAQ,SAAS,OAAO,UAAU,YAAY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index.d.ts
CHANGED
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
import { ResuxModuleDefinition } from "../kit/index.js";
|
|
2
|
+
import * as vue0 from "vue";
|
|
3
|
+
|
|
2
4
|
//#region src/icons/index.d.ts
|
|
3
|
-
|
|
5
|
+
interface ResuxIconsModuleOptions {
|
|
4
6
|
collections?: string[];
|
|
5
7
|
component?: string;
|
|
6
8
|
mode?: "css" | "svg";
|
|
7
9
|
apiProvider?: string;
|
|
8
10
|
lazy?: boolean;
|
|
9
11
|
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
+
declare function defineIconCollections(collections: string[]): ResuxIconsModuleOptions;
|
|
13
|
+
interface IconPathData {
|
|
12
14
|
d: string;
|
|
13
15
|
opacity?: string;
|
|
14
16
|
}
|
|
15
|
-
|
|
17
|
+
interface IconData {
|
|
16
18
|
path?: string;
|
|
17
19
|
paths?: IconPathData[];
|
|
18
20
|
opacity?: string;
|
|
19
21
|
viewBox?: string;
|
|
20
22
|
}
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
declare const iconRegistry: Record<string, IconData>;
|
|
24
|
+
declare function normalizeIconApiProvider(value: unknown): string;
|
|
25
|
+
declare function fetchIconifyIcon(name: string, apiProvider?: string): Promise<IconData | null>;
|
|
26
|
+
declare const Icon: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
25
27
|
name: {
|
|
26
28
|
type: StringConstructor;
|
|
27
29
|
required: true;
|
|
@@ -50,9 +52,9 @@ export declare const Icon: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
50
52
|
type: StringConstructor;
|
|
51
53
|
default: string;
|
|
52
54
|
};
|
|
53
|
-
}>, () =>
|
|
55
|
+
}>, () => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
|
|
54
56
|
[key: string]: any;
|
|
55
|
-
}>, {}, {}, {},
|
|
57
|
+
}>, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<vue0.ExtractPropTypes<{
|
|
56
58
|
name: {
|
|
57
59
|
type: StringConstructor;
|
|
58
60
|
required: true;
|
|
@@ -88,8 +90,8 @@ export declare const Icon: import("vue").DefineComponent<import("vue").ExtractPr
|
|
|
88
90
|
loading: string;
|
|
89
91
|
apiProvider: string;
|
|
90
92
|
class: string;
|
|
91
|
-
}, {}, {}, {}, string,
|
|
92
|
-
|
|
93
|
+
}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
94
|
+
declare const ResuxIcon: vue0.DefineComponent<vue0.ExtractPropTypes<{
|
|
93
95
|
name: {
|
|
94
96
|
type: StringConstructor;
|
|
95
97
|
required: true;
|
|
@@ -118,9 +120,9 @@ export declare const ResuxIcon: import("vue").DefineComponent<import("vue").Extr
|
|
|
118
120
|
type: StringConstructor;
|
|
119
121
|
default: string;
|
|
120
122
|
};
|
|
121
|
-
}>, () =>
|
|
123
|
+
}>, () => vue0.VNode<vue0.RendererNode, vue0.RendererElement, {
|
|
122
124
|
[key: string]: any;
|
|
123
|
-
}>, {}, {}, {},
|
|
125
|
+
}>, {}, {}, {}, vue0.ComponentOptionsMixin, vue0.ComponentOptionsMixin, {}, string, vue0.PublicProps, Readonly<vue0.ExtractPropTypes<{
|
|
124
126
|
name: {
|
|
125
127
|
type: StringConstructor;
|
|
126
128
|
required: true;
|
|
@@ -156,8 +158,8 @@ export declare const ResuxIcon: import("vue").DefineComponent<import("vue").Extr
|
|
|
156
158
|
loading: string;
|
|
157
159
|
apiProvider: string;
|
|
158
160
|
class: string;
|
|
159
|
-
}, {}, {}, {}, string,
|
|
161
|
+
}, {}, {}, {}, string, vue0.ComponentProvideOptions, true, {}, any>;
|
|
160
162
|
declare const _default: ResuxModuleDefinition<ResuxIconsModuleOptions>;
|
|
161
163
|
//#endregion
|
|
162
|
-
export { _default as default };
|
|
164
|
+
export { Icon, IconData, IconPathData, ResuxIcon, ResuxIconsModuleOptions, _default as default, defineIconCollections, fetchIconifyIcon, iconRegistry, normalizeIconApiProvider };
|
|
163
165
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/icons/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { useRuntimeConfig } from "../runtime/index.js";
|
|
2
2
|
import { defineResuxModule } from "../kit/index.js";
|
|
3
3
|
import { computed, defineComponent, h, onMounted, onUnmounted, ref, watch } from "vue";
|
|
4
|
+
|
|
4
5
|
//#region src/icons/index.ts
|
|
5
6
|
function defineIconCollections(collections) {
|
|
6
7
|
return { collections };
|
|
@@ -57,7 +58,7 @@ const iconRegistry = {
|
|
|
57
58
|
if (typeof globalThis !== "undefined") globalThis.__RESUX_ICON_REGISTRY__ = iconRegistry;
|
|
58
59
|
const DEFAULT_ICON_API_PROVIDER = "https://api.iconify.design";
|
|
59
60
|
const ICON_FETCH_TIMEOUT_MS = 1e4;
|
|
60
|
-
const ICON_FETCH_MAX_BYTES =
|
|
61
|
+
const ICON_FETCH_MAX_BYTES = 256 * 1024;
|
|
61
62
|
const ICON_FETCH_CACHE_MAX_ENTRIES = 256;
|
|
62
63
|
const ICON_FETCH_MAX_IN_FLIGHT = 32;
|
|
63
64
|
const ICON_FETCH_QUEUE_MAX_ENTRIES = 512;
|
|
@@ -88,8 +89,8 @@ async function readBoundedIconSvg(response) {
|
|
|
88
89
|
if (Number.isFinite(contentLength) && contentLength > ICON_FETCH_MAX_BYTES) return null;
|
|
89
90
|
}
|
|
90
91
|
if (!response.body?.getReader) {
|
|
91
|
-
const text = await response.text();
|
|
92
|
-
return new TextEncoder().encode(text).byteLength <= ICON_FETCH_MAX_BYTES ? text : null;
|
|
92
|
+
const text$1 = await response.text();
|
|
93
|
+
return new TextEncoder().encode(text$1).byteLength <= ICON_FETCH_MAX_BYTES ? text$1 : null;
|
|
93
94
|
}
|
|
94
95
|
const reader = response.body.getReader();
|
|
95
96
|
const decoder = new TextDecoder();
|
|
@@ -329,7 +330,7 @@ var icons_default = defineResuxModule({
|
|
|
329
330
|
} } });
|
|
330
331
|
}
|
|
331
332
|
});
|
|
333
|
+
|
|
332
334
|
//#endregion
|
|
333
335
|
export { Icon, ResuxIcon, icons_default as default, defineIconCollections, fetchIconifyIcon, iconRegistry, normalizeIconApiProvider };
|
|
334
|
-
|
|
335
336
|
//# sourceMappingURL=index.js.map
|
package/dist/icons/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/icons/index.ts"],"sourcesContent":["import { defineComponent, h, computed, ref, onMounted, onUnmounted, watch } from \"vue\";\nimport { defineResuxModule } from \"../kit/index.js\";\nimport { useRuntimeConfig } from \"../runtime/index.js\";\n\nexport interface ResuxIconsModuleOptions {\n collections?: string[];\n component?: string;\n mode?: \"css\" | \"svg\";\n apiProvider?: string;\n lazy?: boolean;\n}\n\nexport function defineIconCollections(collections: string[]): ResuxIconsModuleOptions {\n return { collections };\n}\n\nexport interface IconPathData {\n d: string;\n opacity?: string;\n}\n\nexport interface IconData {\n path?: string;\n paths?: IconPathData[];\n opacity?: string;\n viewBox?: string;\n}\n\nexport const iconRegistry: Record<string, IconData> = {\n \"material-symbols:call\": { path: \"M6.62 10.79a15.15 15.15 0 0 0 6.59 6.59l2.2-2.2a1 1 0 0 1 1.11-.27c1.12.37 2.33.57 3.57.57a1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.26 1.02l-2.2 2.2z\" },\n \"call\": { path: \"M6.62 10.79a15.15 15.15 0 0 0 6.59 6.59l2.2-2.2a1 1 0 0 1 1.11-.27c1.12.37 2.33.57 3.57.57a1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.26 1.02l-2.2 2.2z\" },\n \"material-symbols:mail\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"material-symbols-light:mail-outline-sharp\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"material-symbols:mail-outline\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"mail\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"material-symbols:location-on-outline-rounded\": { path: \"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5z\" },\n \"location\": { path: \"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5z\" },\n \"material-symbols:warning\": { path: \"M1 21h22L12 2L1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\" },\n \"warning\": { path: \"M1 21h22L12 2L1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\" },\n \"material-symbols:error\": { path: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\" },\n \"error\": { path: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\" },\n \"material-symbols:close\": { path: \"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\" },\n \"close\": { path: \"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\" },\n \"material-symbols:add\": { path: \"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\" },\n \"add\": { path: \"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\" },\n \"material-symbols:keyboard-arrow-down\": { path: \"m12 15.4l-6-6L7.4 8l4.6 4.6L16.6 8L18 9.4z\" },\n \"arrow-down\": { path: \"m12 15.4l-6-6L7.4 8l4.6 4.6L16.6 8L18 9.4z\" },\n \"mdi:facebook\": { path: \"M12 2.04C6.5 2.04 2 6.53 2 12.06C2 17.06 5.66 21.21 10.44 21.96V14.96H7.9V12.06H10.44V9.85C10.44 7.34 11.93 5.96 14.22 5.96C15.31 5.96 16.45 6.15 16.45 6.15V8.62H15.19C13.95 8.62 13.56 9.39 13.56 10.18V12.06H16.34L15.89 14.96H13.56V21.96A10 10 0 0 0 22 12.06C22 6.53 17.5 2.04 12 2.04Z\" },\n \"mdi:facebook-box\": { path: \"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3h-1.8v-2.2h1.8V9.3c0-1.8 1.1-2.8 2.7-2.8c.8 0 1.5.1 1.7.1v2h-1.2c-.9 0-1 .4-1 1v1.3h2.2l-.3 2.2h-1.9v5.3h-2.2z\" },\n \"facebook\": { path: \"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3h-1.8v-2.2h1.8V9.3c0-1.8 1.1-2.8 2.7-2.8c.8 0 1.5.1 1.7.1v2h-1.2c-.9 0-1 .4-1 1v1.3h2.2l-.3 2.2h-1.9v5.3h-2.2z\" },\n \"mingcute:instagram-fill\": { path: \"M16 3a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5H8a5 5 0 0 1-5-5V8a5 5 0 0 1 5-5zm-4 5a4 4 0 1 0 0 8a4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4a2 2 0 0 1 0-4m4.5-3.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2\" },\n \"instagram\": { path: \"M16 3a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5H8a5 5 0 0 1-5-5V8a5 5 0 0 1 5-5zm-4 5a4 4 0 1 0 0 8a4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4a2 2 0 0 1 0-4m4.5-3.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2\" },\n \"cib:linkedin\": { path: \"M27.26 27.271h-4.733v-7.427c0-1.771-.037-4.047-2.475-4.047c-2.468 0-2.844 1.921-2.844 3.916v7.557h-4.739V11.999h4.552v2.083h.061c.636-1.203 2.183-2.468 4.491-2.468c4.801 0 5.692 3.161 5.692 7.271v8.385zM7.115 9.912a2.75 2.75 0 0 1-2.751-2.756a2.753 2.753 0 1 1 2.751 2.756m2.374 17.359H4.74V12h4.749zM29.636 0H2.36C1.057 0 0 1.031 0 2.307v27.387c0 1.276 1.057 2.307 2.36 2.307h27.271c1.301 0 2.369-1.031 2.369-2.307V2.307C32 1.031 30.932 0 29.636 0z\" },\n \"lineicons:linkedin\": { path: \"M27.26 27.271h-4.733v-7.427c0-1.771-.037-4.047-2.475-4.047c-2.468 0-2.844 1.921-2.844 3.916v7.557h-4.739V11.999h4.552v2.083h.061c.636-1.203 2.183-2.468 4.491-2.468c4.801 0 5.692 3.161 5.692 7.271v8.385zM7.115 9.912a2.75 2.75 0 0 1-2.751-2.756a2.753 2.753 0 1 1 2.751 2.756m2.374 17.359H4.74V12h4.749zM29.636 0H2.36C1.057 0 0 1.031 0 2.307v27.387c0 1.276 1.057 2.307 2.36 2.307h27.271c1.301 0 2.369-1.031 2.369-2.307V2.307C32 1.031 30.932 0 29.636 0z\" },\n \"linkedin\": { path: \"M27.26 27.271h-4.733v-7.427c0-1.771-.037-4.047-2.475-4.047c-2.468 0-2.844 1.921-2.844 3.916v7.557h-4.739V11.999h4.552v2.083h.061c.636-1.203 2.183-2.468 4.491-2.468c4.801 0 5.692 3.161 5.692 7.271v8.385zM7.115 9.912a2.75 2.75 0 0 1-2.751-2.756a2.753 2.753 0 1 1 2.751 2.756m2.374 17.359H4.74V12h4.749zM29.636 0H2.36C1.057 0 0 1.031 0 2.307v27.387c0 1.276 1.057 2.307 2.36 2.307h27.271c1.301 0 2.369-1.031 2.369-2.307V2.307C32 1.031 30.932 0 29.636 0z\" },\n \"uil:youtube\": { path: \"M23 9.71a8.5 8.5 0 0 0-.91-4.13a2.92 2.92 0 0 0-1.72-1A78 78 0 0 0 12 4.27a79 79 0 0 0-8.34.3a2.87 2.87 0 0 0-1.46.74c-.9.83-1 2.25-1.1 3.45a48 48 0 0 0 0 6.48a9.6 9.6 0 0 0 .3 2a3.14 3.14 0 0 0 .71 1.36a2.86 2.86 0 0 0 1.49.78a45 45 0 0 0 6.5.33c3.5.05 6.57 0 10.2-.28a2.9 2.9 0 0 0 1.53-.78a2.5 2.5 0 0 0 .61-1a10.6 10.6 0 0 0 .52-3.4c.04-.56.04-3.94.04-4.54M9.74 14.85V8.66l5.92 3.11c-1.66.92-3.85 1.96-5.92 3.08\" },\n \"youtube\": { path: \"M23 9.71a8.5 8.5 0 0 0-.91-4.13a2.92 2.92 0 0 0-1.72-1A78 78 0 0 0 12 4.27a79 79 0 0 0-8.34.3a2.87 2.87 0 0 0-1.46.74c-.9.83-1 2.25-1.1 3.45a48 48 0 0 0 0 6.48a9.6 9.6 0 0 0 .3 2a3.14 3.14 0 0 0 .71 1.36a2.86 2.86 0 0 0 1.49.78a45 45 0 0 0 6.5.33c3.5.05 6.57 0 10.2-.28a2.9 2.9 0 0 0 1.53-.78a2.5 2.5 0 0 0 .61-1a10.6 10.6 0 0 0 .52-3.4c.04-.56.04-3.94.04-4.54M9.74 14.85V8.66l5.92 3.11c-1.66.92-3.85 1.96-5.92 3.08\" },\n \"line-md:twitter-x\": { path: \"M18.244 2.25h3.308l-7.227 8.26l8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\" },\n \"twitter\": { path: \"M18.244 2.25h3.308l-7.227 8.26l8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\" },\n \"ic:baseline-whatsapp\": { path: \"M12.04 2c-5.46 0-9.91 4.45-9.91 9.91c0 1.75.46 3.45 1.32 4.95L2.05 22l5.25-1.38c1.45.79 3.08 1.21 4.74 1.21c5.46 0 9.91-4.45 9.91-9.91c0-2.65-1.03-5.14-2.9-7.01A9.816 9.816 0 0 0 12.04 2zm.01 1.67c4.55 0 8.25 3.7 8.25 8.25c0 4.55-3.7 8.25-8.25 8.25c-1.47 0-2.88-.39-4.12-1.12l-.3-.18l-3.07.81l.82-2.99l-.19-.31A8.204 8.204 0 0 1 3.8 11.92c0-4.55 3.7-8.25 8.25-8.25z\" },\n \"streamline:interface-validation-check-circle-checkmark-addition-circle-success-check-validation-add-form\": { path: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\" },\n \"ph:check-circle-thin\": { path: \"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2zm0 19a9 9 0 1 1 9-9a9.01 9.01 0 0 1-9 9zm4.53-11.47a.5.5 0 0 1 0 .71l-5 5a.5.5 0 0 1-.71 0l-2.5-2.5a.5.5 0 1 1 .71-.71L11.17 14.4l4.65-4.65a.5.5 0 0 1 .71 0z\" },\n \"solar:check-circle-linear\": { path: \"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2zm0 19a9 9 0 1 1 9-9a9.01 9.01 0 0 1-9 9zm4.53-11.47a.5.5 0 0 1 0 .71l-5 5a.5.5 0 0 1-.71 0l-2.5-2.5a.5.5 0 1 1 .71-.71L11.17 14.4l4.65-4.65a.5.5 0 0 1 .71 0z\" },\n \"lucide-lab:flower-lotus\": { path: \"M12 21c-4.418 0-8-3.582-8-8c0-3.5 3.5-7 8-11c4.5 4 8 7.5 8 11c0 4.418-3.582 8-8 8z\" },\n \"solar:leaf-outline\": { path: \"M12 21c-4.418 0-8-3.582-8-8c0-3.5 3.5-7 8-11c4.5 4 8 7.5 8 11c0 4.418-3.582 8-8 8z\" },\n \"solar:command-linear\": { path: \"M8.5 5A3.5 3.5 0 0 0 5 8.5v.5A3.5 3.5 0 0 0 8.5 12.5H9v-1h-.5A2.5 2.5 0 0 1 6 9v-.5A2.5 2.5 0 0 1 8.5 6H9V5h-.5zm7 0H15v1h.5a2.5 2.5 0 0 1 2.5 2.5v.5a2.5 2.5 0 0 1-2.5 2.5H15v1h.5a3.5 3.5 0 0 0 3.5-3.5v-.5A3.5 3.5 0 0 0 15.5 5z\" },\n \"gg:mouse\": { path: \"M12 5a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1M4 8a8 8 0 1 1 16 0v8a8 8 0 1 1-16 0zm14 0v8a6 6 0 0 1-12 0V8a6 6 0 1 1 12 0\" },\n \"mouse\": { path: \"M12 5a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1M4 8a8 8 0 1 1 16 0v8a8 8 0 1 1-16 0zm14 0v8a6 6 0 0 1-12 0V8a6 6 0 1 1 12 0\" },\n \"iconoir:flash\": { path: \"M13 10V3L5 14h6v7l8-11z\" },\n \"flash\": { path: \"M13 10V3L5 14h6v7l8-11z\" },\n \"hugeicons:search-01\": { path: \"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5A6.5 6.5 0 1 0 9.5 16a6.471 6.471 0 0 0 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14z\" },\n \"search\": { path: \"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5A6.5 6.5 0 1 0 9.5 16a6.471 6.471 0 0 0 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14z\" },\n \"solar:info-circle-outline\": { path: \"M12 17.75a.75.75 0 0 0 .75-.75v-6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75M12 7a1 1 0 1 1 0 2a1 1 0 0 1 0-2M1.25 12C1.25 6.063 6.063 1.25 12 1.25S22.75 6.063 22.75 12S17.937 22.75 12 22.75S1.25 17.937 1.25 12M12 2.75a9.25 9.25 0 1 0 0 18.5a9.25 9.25 0 0 0 0-18.5\" },\n \"ic:sharp-tag-faces\": { path: \"M12.01 2C6.49 2 2.02 6.48 2.02 12s4.47 10 9.99 10c5.53 0 10.01-4.48 10.01-10S17.54 2 12.01 2m.01 18c-4.42 0-8-3.58-8-8s3.58-8 8-8s8 3.58 8 8s-3.58 8-8 8m3.5-9c.83 0 1.5-.67 1.5-1.5S16.35 8 15.52 8s-1.5.67-1.5 1.5s.67 1.5 1.5 1.5m-7 0c.83 0 1.5-.67 1.5-1.5S9.35 8 8.52 8s-1.5.67-1.5 1.5s.67 1.5 1.5 1.5m3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.91c.8 2.04 2.78 3.5 5.11 3.5\" },\n \"hamburger\": { path: \"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z\" },\n \"svg-spinners:ring-resize\": { path: \"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm0 18a8 8 0 1 1 8-8 8 8 0 0 1-8 8z\" }\n};\n\nif (typeof globalThis !== \"undefined\") {\n (globalThis as any).__RESUX_ICON_REGISTRY__ = iconRegistry;\n}\n\nconst DEFAULT_ICON_API_PROVIDER = \"https://api.iconify.design\";\nconst ICON_FETCH_TIMEOUT_MS = 10_000;\nconst ICON_FETCH_MAX_BYTES = 256 * 1024;\nconst ICON_FETCH_CACHE_MAX_ENTRIES = 256;\nconst ICON_FETCH_MAX_IN_FLIGHT = 32;\nconst ICON_FETCH_QUEUE_MAX_ENTRIES = 512;\nconst pendingFetches = new Map<string, Promise<IconData | null>>();\nconst fetchedIconCache = new Map<string, IconData>();\nconst iconFetchQueue: Array<() => void> = [];\nlet activeIconFetches = 0;\n\nfunction stripTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) {\n end -= 1;\n }\n return value.slice(0, end);\n}\n\nexport function normalizeIconApiProvider(value: unknown): string {\n const raw = typeof value === \"string\" ? stripTrailingSlashes(value.trim()) : \"\";\n if (!raw) {\n return DEFAULT_ICON_API_PROVIDER;\n }\n if (raw.startsWith(\"//\")) {\n return DEFAULT_ICON_API_PROVIDER;\n }\n if (raw.startsWith(\"/\")) {\n return raw;\n }\n try {\n const url = new URL(raw);\n if (url.protocol === \"https:\" || url.protocol === \"http:\") {\n return stripTrailingSlashes(url.toString());\n }\n } catch {\n // Fall back to the public provider for malformed values.\n }\n return DEFAULT_ICON_API_PROVIDER;\n}\n\nasync function readBoundedIconSvg(response: Response): Promise<string | null> {\n const rawLength = response.headers?.get?.(\"content-length\");\n if (rawLength) {\n const contentLength = Number(rawLength);\n if (Number.isFinite(contentLength) && contentLength > ICON_FETCH_MAX_BYTES) {\n return null;\n }\n }\n\n if (!response.body?.getReader) {\n const text = await response.text();\n return new TextEncoder().encode(text).byteLength <= ICON_FETCH_MAX_BYTES ? text : null;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let totalBytes = 0;\n let text = \"\";\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n totalBytes += value.byteLength;\n if (totalBytes > ICON_FETCH_MAX_BYTES) {\n await reader.cancel().catch(() => undefined);\n return null;\n }\n text += decoder.decode(value, { stream: true });\n }\n text += decoder.decode();\n return text;\n } finally {\n reader.releaseLock();\n }\n}\n\nfunction readFetchedIcon(cacheKey: string): IconData | undefined {\n const cached = fetchedIconCache.get(cacheKey);\n if (!cached) return undefined;\n fetchedIconCache.delete(cacheKey);\n fetchedIconCache.set(cacheKey, cached);\n return cached;\n}\n\nfunction rememberFetchedIcon(cacheKey: string, data: IconData): void {\n fetchedIconCache.delete(cacheKey);\n fetchedIconCache.set(cacheKey, data);\n while (fetchedIconCache.size > ICON_FETCH_CACHE_MAX_ENTRIES) {\n const oldestKey = fetchedIconCache.keys().next().value;\n if (oldestKey === undefined) break;\n fetchedIconCache.delete(oldestKey);\n }\n}\n\nfunction runWithIconFetchSlot(\n task: () => Promise<IconData | null>,\n): Promise<IconData | null> {\n if (activeIconFetches >= ICON_FETCH_MAX_IN_FLIGHT\n && iconFetchQueue.length >= ICON_FETCH_QUEUE_MAX_ENTRIES) {\n return Promise.resolve(null);\n }\n\n return new Promise((resolve) => {\n const run = () => {\n activeIconFetches += 1;\n void task()\n .then(resolve, () => resolve(null))\n .finally(() => {\n activeIconFetches = Math.max(0, activeIconFetches - 1);\n iconFetchQueue.shift()?.();\n });\n };\n if (activeIconFetches < ICON_FETCH_MAX_IN_FLIGHT) {\n run();\n } else {\n iconFetchQueue.push(run);\n }\n });\n}\n\nexport function fetchIconifyIcon(\n name: string,\n apiProvider: string = DEFAULT_ICON_API_PROVIDER,\n): Promise<IconData | null> {\n const normalized = String(name || \"\").trim().toLowerCase();\n if (!normalized || normalized.length > 256) return Promise.resolve(null);\n if (iconRegistry[normalized]) {\n return Promise.resolve(iconRegistry[normalized]);\n }\n\n const parts = normalized.split(\":\");\n if (parts.length !== 2 || !parts[0] || !parts[1]) {\n return Promise.resolve(null);\n }\n\n const provider = normalizeIconApiProvider(apiProvider);\n const cacheKey = provider + \"::\" + normalized;\n const cached = readFetchedIcon(cacheKey);\n if (cached) {\n return Promise.resolve(cached);\n }\n const pending = pendingFetches.get(cacheKey);\n if (pending) {\n return pending;\n }\n const prefix = parts[0];\n const iconName = parts[1];\n const url = provider + \"/\" + encodeURIComponent(prefix) + \"/\" + encodeURIComponent(iconName) + \".svg\";\n\n const fetchPromise = runWithIconFetchSlot(async () => {\n const controller = typeof AbortController === \"function\" ? new AbortController() : null;\n const timeout = setTimeout(() => controller?.abort(), ICON_FETCH_TIMEOUT_MS);\n try {\n const response = await fetch(url, controller ? { signal: controller.signal } : undefined);\n if (!response.ok) return null;\n const svgText = await readBoundedIconSvg(response);\n if (!svgText) return null;\n const viewBox = readSvgAttribute(svgText, \"viewBox\") || \"0 0 24 24\";\n const paths = [...svgText.matchAll(/<path\\b[^>]*>/gi)]\n .slice(0, 128)\n .map((match) => ({\n d: readSvgAttribute(match[0], \"d\").slice(0, 65_536),\n opacity: readSvgAttribute(match[0], \"opacity\") || undefined,\n }))\n .filter((entry) => Boolean(entry.d));\n if (!paths.length) {\n return null;\n }\n const data: IconData = {\n path: paths[0].d,\n paths,\n viewBox,\n };\n rememberFetchedIcon(cacheKey, data);\n return data;\n } catch {\n return null;\n } finally {\n clearTimeout(timeout);\n }\n }).finally(() => {\n pendingFetches.delete(cacheKey);\n });\n\n pendingFetches.set(cacheKey, fetchPromise);\n return fetchPromise;\n}\n\nfunction readSvgAttribute(source: string, name: string): string {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`);\n const match = new RegExp(\n String.raw`\\b${escapedName}\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')`,\n \"i\",\n ).exec(source);\n return (match?.[1] ?? match?.[2] ?? \"\").trim();\n}\n\nexport const Icon = defineComponent({\n name: \"ResuxIcon\",\n props: {\n name: { type: String, required: true },\n size: { type: [String, Number], default: \"1.25rem\" },\n mode: { type: String, default: \"svg\" },\n lazy: { type: Boolean, default: false },\n loading: { type: String, default: \"eager\" },\n apiProvider: { type: String, default: \"\" },\n class: { type: String, default: \"\" }\n },\n setup(props, { attrs }) {\n const iconRef = ref<HTMLElement | null>(null);\n const isVisible = ref(false);\n const iconName = computed(() => String(props.name || \"\").trim().toLowerCase());\n const runtimeConfig = useRuntimeConfig();\n const configuredProvider = (runtimeConfig.public?.icons as { apiProvider?: unknown } | undefined)?.apiProvider;\n const apiProvider = computed(() => normalizeIconApiProvider(props.apiProvider || configuredProvider));\n const dynamicData = ref<IconData | null>(null);\n\n const isLazy = computed(() => props.lazy || props.loading === \"lazy\");\n\n const iconData = computed<IconData>(() => {\n if (iconRegistry[iconName.value]) {\n return iconRegistry[iconName.value];\n }\n if (dynamicData.value) {\n return dynamicData.value;\n }\n return {\n path: \"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10zm0-2a8 8 0 1 1 0-16 8 8 0 0 1 0 16z\",\n opacity: \".35\",\n viewBox: \"0 0 24 24\"\n };\n });\n\n let requestRevision = 0;\n const loadDynamicIcon = () => {\n const requestedName = iconName.value;\n const requestedProvider = apiProvider.value;\n const revision = ++requestRevision;\n if (iconRegistry[requestedName]) {\n return;\n }\n fetchIconifyIcon(requestedName, requestedProvider).then((result) => {\n if (\n result\n && revision === requestRevision\n && requestedName === iconName.value\n && requestedProvider === apiProvider.value\n ) {\n dynamicData.value = result;\n }\n });\n };\n\n let observer: IntersectionObserver | null = null;\n\n onMounted(() => {\n if (isLazy.value && typeof window !== \"undefined\" && \"IntersectionObserver\" in window) {\n observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n isVisible.value = true;\n loadDynamicIcon();\n if (observer && iconRef.value) {\n observer.unobserve(iconRef.value);\n }\n }\n },\n { rootMargin: \"100px\" }\n );\n if (iconRef.value) {\n observer.observe(iconRef.value);\n }\n } else {\n isVisible.value = true;\n loadDynamicIcon();\n }\n });\n\n onUnmounted(() => {\n requestRevision += 1;\n if (observer) {\n observer.disconnect();\n }\n });\n\n watch([iconName, apiProvider], () => {\n dynamicData.value = null;\n if (!isLazy.value || isVisible.value) {\n loadDynamicIcon();\n }\n });\n\n const sizeValue = computed(() =>\n typeof props.size === \"number\" ? `${props.size}px` : (String(props.size || \"\").trim() || \"1.25rem\")\n );\n\n return () => {\n const data = iconData.value;\n return h(\n \"svg\",\n {\n ref: iconRef,\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: data.viewBox || \"0 0 24 24\",\n width: sizeValue.value,\n height: sizeValue.value,\n fill: \"currentColor\",\n class: [\"inline-block shrink-0 align-middle\", props.class].filter(Boolean).join(\" \"),\n style: { width: sizeValue.value, height: sizeValue.value },\n \"aria-hidden\": \"true\",\n \"data-icon-name\": props.name,\n \"data-icon-lazy\": isLazy.value ? \"true\" : \"false\",\n ...attrs\n },\n (data.paths?.length ? data.paths : [{ d: data.path || \"\", opacity: data.opacity }])\n .map((entry, index) => h(\"path\", {\n key: index,\n d: entry.d,\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n opacity: entry.opacity || \"1\"\n }))\n );\n };\n }\n});\n\nexport const ResuxIcon = Icon;\n\nexport default defineResuxModule<ResuxIconsModuleOptions>({\n defaults: {\n collections: [],\n component: \"Icon\",\n mode: \"svg\",\n apiProvider: DEFAULT_ICON_API_PROVIDER,\n lazy: false\n },\n setup(options, resux) {\n const collections = Array.isArray(options.collections)\n ? [...new Set(options.collections.map((entry) => String(entry).trim()).filter(Boolean))]\n : [];\n resux.extendRuntimeConfig({\n public: {\n icons: {\n component: typeof options.component === \"string\" ? options.component : \"Icon\",\n collections,\n mode: options.mode || \"svg\",\n apiProvider: normalizeIconApiProv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K,OAAO,UAAU,EAAE,QAAQ;IAC/B,KAAK;IACL,GAAG,MAAM;IACT,UAAU;IACV,UAAU;IACV,SAAS,MAAM,WAAW;GAC5B,CAAC,CAAC,CACN;EACF;CACF;AACF,CAAC;AAED,MAAa,YAAY;AAEzB,IAAA,gBAAe,kBAA2C;CACxD,UAAU;EACR,aAAa,CAAC;EACd,WAAW;EACX,MAAM;EACN,aAAa;EACb,MAAM;CACR;CACA,MAAM,SAAS,OAAO;EACpB,MAAM,cAAc,MAAM,QAAQ,QAAQ,WAAW,IACjD,CAAC,GAAG,IAAI,IAAI,QAAQ,YAAY,KAAK,UAAU,OAAO,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,OAAO,CAAC,CAAC,IACrF,CAAC;EACL,MAAM,oBAAoB,EACxB,QAAQ,EACN,OAAO;GACL,WAAW,OAAO,QAAQ,cAAc,WAAW,QAAQ,YAAY;GACvE;GACA,MAAM,QAAQ,QAAQ;GACtB,aAAa,yBAAyB,QAAQ,WAAW;GACzD,MAAM,QAAQ,SAAS;EACzB,EACF,EACF,CAAC;CACH;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["text"],"sources":["../../src/icons/index.ts"],"sourcesContent":["import { defineComponent, h, computed, ref, onMounted, onUnmounted, watch } from \"vue\";\nimport { defineResuxModule } from \"../kit/index.js\";\nimport { useRuntimeConfig } from \"../runtime/index.js\";\n\nexport interface ResuxIconsModuleOptions {\n collections?: string[];\n component?: string;\n mode?: \"css\" | \"svg\";\n apiProvider?: string;\n lazy?: boolean;\n}\n\nexport function defineIconCollections(collections: string[]): ResuxIconsModuleOptions {\n return { collections };\n}\n\nexport interface IconPathData {\n d: string;\n opacity?: string;\n}\n\nexport interface IconData {\n path?: string;\n paths?: IconPathData[];\n opacity?: string;\n viewBox?: string;\n}\n\nexport const iconRegistry: Record<string, IconData> = {\n \"material-symbols:call\": { path: \"M6.62 10.79a15.15 15.15 0 0 0 6.59 6.59l2.2-2.2a1 1 0 0 1 1.11-.27c1.12.37 2.33.57 3.57.57a1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.26 1.02l-2.2 2.2z\" },\n \"call\": { path: \"M6.62 10.79a15.15 15.15 0 0 0 6.59 6.59l2.2-2.2a1 1 0 0 1 1.11-.27c1.12.37 2.33.57 3.57.57a1 1 0 0 1 1 1V20a1 1 0 0 1-1 1A17 17 0 0 1 3 4a1 1 0 0 1 1-1h3.5a1 1 0 0 1 1 1c0 1.25.2 2.45.57 3.57a1 1 0 0 1-.26 1.02l-2.2 2.2z\" },\n \"material-symbols:mail\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"material-symbols-light:mail-outline-sharp\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"material-symbols:mail-outline\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"mail\": { path: \"M20 4H4c-1.1 0-1.99.9-1.99 2L2 18c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V6c0-1.1-.9-2-2-2zm0 4l-8 5l-8-5V6l8 5l8-5v2z\" },\n \"material-symbols:location-on-outline-rounded\": { path: \"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5z\" },\n \"location\": { path: \"M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5s2.5 1.12 2.5 2.5s-1.12 2.5-2.5 2.5z\" },\n \"material-symbols:warning\": { path: \"M1 21h22L12 2L1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\" },\n \"warning\": { path: \"M1 21h22L12 2L1 21zm12-3h-2v-2h2v2zm0-4h-2v-4h2v4z\" },\n \"material-symbols:error\": { path: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\" },\n \"error\": { path: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z\" },\n \"material-symbols:close\": { path: \"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\" },\n \"close\": { path: \"M19 6.41L17.59 5L12 10.59L6.41 5L5 6.41L10.59 12L5 17.59L6.41 19L12 13.41L17.59 19L19 17.59L13.41 12z\" },\n \"material-symbols:add\": { path: \"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\" },\n \"add\": { path: \"M19 13h-6v6h-2v-6H5v-2h6V5h2v6h6v2z\" },\n \"material-symbols:keyboard-arrow-down\": { path: \"m12 15.4l-6-6L7.4 8l4.6 4.6L16.6 8L18 9.4z\" },\n \"arrow-down\": { path: \"m12 15.4l-6-6L7.4 8l4.6 4.6L16.6 8L18 9.4z\" },\n \"mdi:facebook\": { path: \"M12 2.04C6.5 2.04 2 6.53 2 12.06C2 17.06 5.66 21.21 10.44 21.96V14.96H7.9V12.06H10.44V9.85C10.44 7.34 11.93 5.96 14.22 5.96C15.31 5.96 16.45 6.15 16.45 6.15V8.62H15.19C13.95 8.62 13.56 9.39 13.56 10.18V12.06H16.34L15.89 14.96H13.56V21.96A10 10 0 0 0 22 12.06C22 6.53 17.5 2.04 12 2.04Z\" },\n \"mdi:facebook-box\": { path: \"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3h-1.8v-2.2h1.8V9.3c0-1.8 1.1-2.8 2.7-2.8c.8 0 1.5.1 1.7.1v2h-1.2c-.9 0-1 .4-1 1v1.3h2.2l-.3 2.2h-1.9v5.3h-2.2z\" },\n \"facebook\": { path: \"M19 3a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14m-.5 15.5v-5.3h-1.8v-2.2h1.8V9.3c0-1.8 1.1-2.8 2.7-2.8c.8 0 1.5.1 1.7.1v2h-1.2c-.9 0-1 .4-1 1v1.3h2.2l-.3 2.2h-1.9v5.3h-2.2z\" },\n \"mingcute:instagram-fill\": { path: \"M16 3a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5H8a5 5 0 0 1-5-5V8a5 5 0 0 1 5-5zm-4 5a4 4 0 1 0 0 8a4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4a2 2 0 0 1 0-4m4.5-3.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2\" },\n \"instagram\": { path: \"M16 3a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5H8a5 5 0 0 1-5-5V8a5 5 0 0 1 5-5zm-4 5a4 4 0 1 0 0 8a4 4 0 0 0 0-8m0 2a2 2 0 1 1 0 4a2 2 0 0 1 0-4m4.5-3.5a1 1 0 1 0 0 2a1 1 0 0 0 0-2\" },\n \"cib:linkedin\": { path: \"M27.26 27.271h-4.733v-7.427c0-1.771-.037-4.047-2.475-4.047c-2.468 0-2.844 1.921-2.844 3.916v7.557h-4.739V11.999h4.552v2.083h.061c.636-1.203 2.183-2.468 4.491-2.468c4.801 0 5.692 3.161 5.692 7.271v8.385zM7.115 9.912a2.75 2.75 0 0 1-2.751-2.756a2.753 2.753 0 1 1 2.751 2.756m2.374 17.359H4.74V12h4.749zM29.636 0H2.36C1.057 0 0 1.031 0 2.307v27.387c0 1.276 1.057 2.307 2.36 2.307h27.271c1.301 0 2.369-1.031 2.369-2.307V2.307C32 1.031 30.932 0 29.636 0z\" },\n \"lineicons:linkedin\": { path: \"M27.26 27.271h-4.733v-7.427c0-1.771-.037-4.047-2.475-4.047c-2.468 0-2.844 1.921-2.844 3.916v7.557h-4.739V11.999h4.552v2.083h.061c.636-1.203 2.183-2.468 4.491-2.468c4.801 0 5.692 3.161 5.692 7.271v8.385zM7.115 9.912a2.75 2.75 0 0 1-2.751-2.756a2.753 2.753 0 1 1 2.751 2.756m2.374 17.359H4.74V12h4.749zM29.636 0H2.36C1.057 0 0 1.031 0 2.307v27.387c0 1.276 1.057 2.307 2.36 2.307h27.271c1.301 0 2.369-1.031 2.369-2.307V2.307C32 1.031 30.932 0 29.636 0z\" },\n \"linkedin\": { path: \"M27.26 27.271h-4.733v-7.427c0-1.771-.037-4.047-2.475-4.047c-2.468 0-2.844 1.921-2.844 3.916v7.557h-4.739V11.999h4.552v2.083h.061c.636-1.203 2.183-2.468 4.491-2.468c4.801 0 5.692 3.161 5.692 7.271v8.385zM7.115 9.912a2.75 2.75 0 0 1-2.751-2.756a2.753 2.753 0 1 1 2.751 2.756m2.374 17.359H4.74V12h4.749zM29.636 0H2.36C1.057 0 0 1.031 0 2.307v27.387c0 1.276 1.057 2.307 2.36 2.307h27.271c1.301 0 2.369-1.031 2.369-2.307V2.307C32 1.031 30.932 0 29.636 0z\" },\n \"uil:youtube\": { path: \"M23 9.71a8.5 8.5 0 0 0-.91-4.13a2.92 2.92 0 0 0-1.72-1A78 78 0 0 0 12 4.27a79 79 0 0 0-8.34.3a2.87 2.87 0 0 0-1.46.74c-.9.83-1 2.25-1.1 3.45a48 48 0 0 0 0 6.48a9.6 9.6 0 0 0 .3 2a3.14 3.14 0 0 0 .71 1.36a2.86 2.86 0 0 0 1.49.78a45 45 0 0 0 6.5.33c3.5.05 6.57 0 10.2-.28a2.9 2.9 0 0 0 1.53-.78a2.5 2.5 0 0 0 .61-1a10.6 10.6 0 0 0 .52-3.4c.04-.56.04-3.94.04-4.54M9.74 14.85V8.66l5.92 3.11c-1.66.92-3.85 1.96-5.92 3.08\" },\n \"youtube\": { path: \"M23 9.71a8.5 8.5 0 0 0-.91-4.13a2.92 2.92 0 0 0-1.72-1A78 78 0 0 0 12 4.27a79 79 0 0 0-8.34.3a2.87 2.87 0 0 0-1.46.74c-.9.83-1 2.25-1.1 3.45a48 48 0 0 0 0 6.48a9.6 9.6 0 0 0 .3 2a3.14 3.14 0 0 0 .71 1.36a2.86 2.86 0 0 0 1.49.78a45 45 0 0 0 6.5.33c3.5.05 6.57 0 10.2-.28a2.9 2.9 0 0 0 1.53-.78a2.5 2.5 0 0 0 .61-1a10.6 10.6 0 0 0 .52-3.4c.04-.56.04-3.94.04-4.54M9.74 14.85V8.66l5.92 3.11c-1.66.92-3.85 1.96-5.92 3.08\" },\n \"line-md:twitter-x\": { path: \"M18.244 2.25h3.308l-7.227 8.26l8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\" },\n \"twitter\": { path: \"M18.244 2.25h3.308l-7.227 8.26l8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z\" },\n \"ic:baseline-whatsapp\": { path: \"M12.04 2c-5.46 0-9.91 4.45-9.91 9.91c0 1.75.46 3.45 1.32 4.95L2.05 22l5.25-1.38c1.45.79 3.08 1.21 4.74 1.21c5.46 0 9.91-4.45 9.91-9.91c0-2.65-1.03-5.14-2.9-7.01A9.816 9.816 0 0 0 12.04 2zm.01 1.67c4.55 0 8.25 3.7 8.25 8.25c0 4.55-3.7 8.25-8.25 8.25c-1.47 0-2.88-.39-4.12-1.12l-.3-.18l-3.07.81l.82-2.99l-.19-.31A8.204 8.204 0 0 1 3.8 11.92c0-4.55 3.7-8.25 8.25-8.25z\" },\n \"streamline:interface-validation-check-circle-checkmark-addition-circle-success-check-validation-add-form\": { path: \"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10s10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5l1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z\" },\n \"ph:check-circle-thin\": { path: \"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2zm0 19a9 9 0 1 1 9-9a9.01 9.01 0 0 1-9 9zm4.53-11.47a.5.5 0 0 1 0 .71l-5 5a.5.5 0 0 1-.71 0l-2.5-2.5a.5.5 0 1 1 .71-.71L11.17 14.4l4.65-4.65a.5.5 0 0 1 .71 0z\" },\n \"solar:check-circle-linear\": { path: \"M12 2a10 10 0 1 0 10 10A10.011 10.011 0 0 0 12 2zm0 19a9 9 0 1 1 9-9a9.01 9.01 0 0 1-9 9zm4.53-11.47a.5.5 0 0 1 0 .71l-5 5a.5.5 0 0 1-.71 0l-2.5-2.5a.5.5 0 1 1 .71-.71L11.17 14.4l4.65-4.65a.5.5 0 0 1 .71 0z\" },\n \"lucide-lab:flower-lotus\": { path: \"M12 21c-4.418 0-8-3.582-8-8c0-3.5 3.5-7 8-11c4.5 4 8 7.5 8 11c0 4.418-3.582 8-8 8z\" },\n \"solar:leaf-outline\": { path: \"M12 21c-4.418 0-8-3.582-8-8c0-3.5 3.5-7 8-11c4.5 4 8 7.5 8 11c0 4.418-3.582 8-8 8z\" },\n \"solar:command-linear\": { path: \"M8.5 5A3.5 3.5 0 0 0 5 8.5v.5A3.5 3.5 0 0 0 8.5 12.5H9v-1h-.5A2.5 2.5 0 0 1 6 9v-.5A2.5 2.5 0 0 1 8.5 6H9V5h-.5zm7 0H15v1h.5a2.5 2.5 0 0 1 2.5 2.5v.5a2.5 2.5 0 0 1-2.5 2.5H15v1h.5a3.5 3.5 0 0 0 3.5-3.5v-.5A3.5 3.5 0 0 0 15.5 5z\" },\n \"gg:mouse\": { path: \"M12 5a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1M4 8a8 8 0 1 1 16 0v8a8 8 0 1 1-16 0zm14 0v8a6 6 0 0 1-12 0V8a6 6 0 1 1 12 0\" },\n \"mouse\": { path: \"M12 5a1 1 0 0 0-1 1v4a1 1 0 1 0 2 0V6a1 1 0 0 0-1-1M4 8a8 8 0 1 1 16 0v8a8 8 0 1 1-16 0zm14 0v8a6 6 0 0 1-12 0V8a6 6 0 1 1 12 0\" },\n \"iconoir:flash\": { path: \"M13 10V3L5 14h6v7l8-11z\" },\n \"flash\": { path: \"M13 10V3L5 14h6v7l8-11z\" },\n \"hugeicons:search-01\": { path: \"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5A6.5 6.5 0 1 0 9.5 16a6.471 6.471 0 0 0 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14z\" },\n \"search\": { path: \"M15.5 14h-.79l-.28-.27A6.471 6.471 0 0 0 16 9.5A6.5 6.5 0 1 0 9.5 16a6.471 6.471 0 0 0 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5S14 7.01 14 9.5S11.99 14 9.5 14z\" },\n \"solar:info-circle-outline\": { path: \"M12 17.75a.75.75 0 0 0 .75-.75v-6a.75.75 0 0 0-1.5 0v6c0 .414.336.75.75.75M12 7a1 1 0 1 1 0 2a1 1 0 0 1 0-2M1.25 12C1.25 6.063 6.063 1.25 12 1.25S22.75 6.063 22.75 12S17.937 22.75 12 22.75S1.25 17.937 1.25 12M12 2.75a9.25 9.25 0 1 0 0 18.5a9.25 9.25 0 0 0 0-18.5\" },\n \"ic:sharp-tag-faces\": { path: \"M12.01 2C6.49 2 2.02 6.48 2.02 12s4.47 10 9.99 10c5.53 0 10.01-4.48 10.01-10S17.54 2 12.01 2m.01 18c-4.42 0-8-3.58-8-8s3.58-8 8-8s8 3.58 8 8s-3.58 8-8 8m3.5-9c.83 0 1.5-.67 1.5-1.5S16.35 8 15.52 8s-1.5.67-1.5 1.5s.67 1.5 1.5 1.5m-7 0c.83 0 1.5-.67 1.5-1.5S9.35 8 8.52 8s-1.5.67-1.5 1.5s.67 1.5 1.5 1.5m3.5 6.5c2.33 0 4.31-1.46 5.11-3.5H6.91c.8 2.04 2.78 3.5 5.11 3.5\" },\n \"hamburger\": { path: \"M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z\" },\n \"svg-spinners:ring-resize\": { path: \"M12 2a10 10 0 1 0 10 10A10 10 0 0 0 12 2zm0 18a8 8 0 1 1 8-8 8 8 0 0 1-8 8z\" }\n};\n\nif (typeof globalThis !== \"undefined\") {\n (globalThis as any).__RESUX_ICON_REGISTRY__ = iconRegistry;\n}\n\nconst DEFAULT_ICON_API_PROVIDER = \"https://api.iconify.design\";\nconst ICON_FETCH_TIMEOUT_MS = 10_000;\nconst ICON_FETCH_MAX_BYTES = 256 * 1024;\nconst ICON_FETCH_CACHE_MAX_ENTRIES = 256;\nconst ICON_FETCH_MAX_IN_FLIGHT = 32;\nconst ICON_FETCH_QUEUE_MAX_ENTRIES = 512;\nconst pendingFetches = new Map<string, Promise<IconData | null>>();\nconst fetchedIconCache = new Map<string, IconData>();\nconst iconFetchQueue: Array<() => void> = [];\nlet activeIconFetches = 0;\n\nfunction stripTrailingSlashes(value: string): string {\n let end = value.length;\n while (end > 0 && value.charCodeAt(end - 1) === 47) {\n end -= 1;\n }\n return value.slice(0, end);\n}\n\nexport function normalizeIconApiProvider(value: unknown): string {\n const raw = typeof value === \"string\" ? stripTrailingSlashes(value.trim()) : \"\";\n if (!raw) {\n return DEFAULT_ICON_API_PROVIDER;\n }\n if (raw.startsWith(\"//\")) {\n return DEFAULT_ICON_API_PROVIDER;\n }\n if (raw.startsWith(\"/\")) {\n return raw;\n }\n try {\n const url = new URL(raw);\n if (url.protocol === \"https:\" || url.protocol === \"http:\") {\n return stripTrailingSlashes(url.toString());\n }\n } catch {\n // Fall back to the public provider for malformed values.\n }\n return DEFAULT_ICON_API_PROVIDER;\n}\n\nasync function readBoundedIconSvg(response: Response): Promise<string | null> {\n const rawLength = response.headers?.get?.(\"content-length\");\n if (rawLength) {\n const contentLength = Number(rawLength);\n if (Number.isFinite(contentLength) && contentLength > ICON_FETCH_MAX_BYTES) {\n return null;\n }\n }\n\n if (!response.body?.getReader) {\n const text = await response.text();\n return new TextEncoder().encode(text).byteLength <= ICON_FETCH_MAX_BYTES ? text : null;\n }\n\n const reader = response.body.getReader();\n const decoder = new TextDecoder();\n let totalBytes = 0;\n let text = \"\";\n try {\n while (true) {\n const { done, value } = await reader.read();\n if (done) break;\n totalBytes += value.byteLength;\n if (totalBytes > ICON_FETCH_MAX_BYTES) {\n await reader.cancel().catch(() => undefined);\n return null;\n }\n text += decoder.decode(value, { stream: true });\n }\n text += decoder.decode();\n return text;\n } finally {\n reader.releaseLock();\n }\n}\n\nfunction readFetchedIcon(cacheKey: string): IconData | undefined {\n const cached = fetchedIconCache.get(cacheKey);\n if (!cached) return undefined;\n fetchedIconCache.delete(cacheKey);\n fetchedIconCache.set(cacheKey, cached);\n return cached;\n}\n\nfunction rememberFetchedIcon(cacheKey: string, data: IconData): void {\n fetchedIconCache.delete(cacheKey);\n fetchedIconCache.set(cacheKey, data);\n while (fetchedIconCache.size > ICON_FETCH_CACHE_MAX_ENTRIES) {\n const oldestKey = fetchedIconCache.keys().next().value;\n if (oldestKey === undefined) break;\n fetchedIconCache.delete(oldestKey);\n }\n}\n\nfunction runWithIconFetchSlot(\n task: () => Promise<IconData | null>,\n): Promise<IconData | null> {\n if (activeIconFetches >= ICON_FETCH_MAX_IN_FLIGHT\n && iconFetchQueue.length >= ICON_FETCH_QUEUE_MAX_ENTRIES) {\n return Promise.resolve(null);\n }\n\n return new Promise((resolve) => {\n const run = () => {\n activeIconFetches += 1;\n void task()\n .then(resolve, () => resolve(null))\n .finally(() => {\n activeIconFetches = Math.max(0, activeIconFetches - 1);\n iconFetchQueue.shift()?.();\n });\n };\n if (activeIconFetches < ICON_FETCH_MAX_IN_FLIGHT) {\n run();\n } else {\n iconFetchQueue.push(run);\n }\n });\n}\n\nexport function fetchIconifyIcon(\n name: string,\n apiProvider: string = DEFAULT_ICON_API_PROVIDER,\n): Promise<IconData | null> {\n const normalized = String(name || \"\").trim().toLowerCase();\n if (!normalized || normalized.length > 256) return Promise.resolve(null);\n if (iconRegistry[normalized]) {\n return Promise.resolve(iconRegistry[normalized]);\n }\n\n const parts = normalized.split(\":\");\n if (parts.length !== 2 || !parts[0] || !parts[1]) {\n return Promise.resolve(null);\n }\n\n const provider = normalizeIconApiProvider(apiProvider);\n const cacheKey = provider + \"::\" + normalized;\n const cached = readFetchedIcon(cacheKey);\n if (cached) {\n return Promise.resolve(cached);\n }\n const pending = pendingFetches.get(cacheKey);\n if (pending) {\n return pending;\n }\n const prefix = parts[0];\n const iconName = parts[1];\n const url = provider + \"/\" + encodeURIComponent(prefix) + \"/\" + encodeURIComponent(iconName) + \".svg\";\n\n const fetchPromise = runWithIconFetchSlot(async () => {\n const controller = typeof AbortController === \"function\" ? new AbortController() : null;\n const timeout = setTimeout(() => controller?.abort(), ICON_FETCH_TIMEOUT_MS);\n try {\n const response = await fetch(url, controller ? { signal: controller.signal } : undefined);\n if (!response.ok) return null;\n const svgText = await readBoundedIconSvg(response);\n if (!svgText) return null;\n const viewBox = readSvgAttribute(svgText, \"viewBox\") || \"0 0 24 24\";\n const paths = [...svgText.matchAll(/<path\\b[^>]*>/gi)]\n .slice(0, 128)\n .map((match) => ({\n d: readSvgAttribute(match[0], \"d\").slice(0, 65_536),\n opacity: readSvgAttribute(match[0], \"opacity\") || undefined,\n }))\n .filter((entry) => Boolean(entry.d));\n if (!paths.length) {\n return null;\n }\n const data: IconData = {\n path: paths[0].d,\n paths,\n viewBox,\n };\n rememberFetchedIcon(cacheKey, data);\n return data;\n } catch {\n return null;\n } finally {\n clearTimeout(timeout);\n }\n }).finally(() => {\n pendingFetches.delete(cacheKey);\n });\n\n pendingFetches.set(cacheKey, fetchPromise);\n return fetchPromise;\n}\n\nfunction readSvgAttribute(source: string, name: string): string {\n const escapedName = name.replace(/[.*+?^${}()|[\\]\\\\]/g, String.raw`\\$&`);\n const match = new RegExp(\n String.raw`\\b${escapedName}\\s*=\\s*(?:\"([^\"]*)\"|'([^']*)')`,\n \"i\",\n ).exec(source);\n return (match?.[1] ?? match?.[2] ?? \"\").trim();\n}\n\nexport const Icon = defineComponent({\n name: \"ResuxIcon\",\n props: {\n name: { type: String, required: true },\n size: { type: [String, Number], default: \"1.25rem\" },\n mode: { type: String, default: \"svg\" },\n lazy: { type: Boolean, default: false },\n loading: { type: String, default: \"eager\" },\n apiProvider: { type: String, default: \"\" },\n class: { type: String, default: \"\" }\n },\n setup(props, { attrs }) {\n const iconRef = ref<HTMLElement | null>(null);\n const isVisible = ref(false);\n const iconName = computed(() => String(props.name || \"\").trim().toLowerCase());\n const runtimeConfig = useRuntimeConfig();\n const configuredProvider = (runtimeConfig.public?.icons as { apiProvider?: unknown } | undefined)?.apiProvider;\n const apiProvider = computed(() => normalizeIconApiProvider(props.apiProvider || configuredProvider));\n const dynamicData = ref<IconData | null>(null);\n\n const isLazy = computed(() => props.lazy || props.loading === \"lazy\");\n\n const iconData = computed<IconData>(() => {\n if (iconRegistry[iconName.value]) {\n return iconRegistry[iconName.value];\n }\n if (dynamicData.value) {\n return dynamicData.value;\n }\n return {\n path: \"M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2S2 6.477 2 12s4.477 10 10 10zm0-2a8 8 0 1 1 0-16 8 8 0 0 1 0 16z\",\n opacity: \".35\",\n viewBox: \"0 0 24 24\"\n };\n });\n\n let requestRevision = 0;\n const loadDynamicIcon = () => {\n const requestedName = iconName.value;\n const requestedProvider = apiProvider.value;\n const revision = ++requestRevision;\n if (iconRegistry[requestedName]) {\n return;\n }\n fetchIconifyIcon(requestedName, requestedProvider).then((result) => {\n if (\n result\n && revision === requestRevision\n && requestedName === iconName.value\n && requestedProvider === apiProvider.value\n ) {\n dynamicData.value = result;\n }\n });\n };\n\n let observer: IntersectionObserver | null = null;\n\n onMounted(() => {\n if (isLazy.value && typeof window !== \"undefined\" && \"IntersectionObserver\" in window) {\n observer = new IntersectionObserver(\n (entries) => {\n if (entries.some((entry) => entry.isIntersecting)) {\n isVisible.value = true;\n loadDynamicIcon();\n if (observer && iconRef.value) {\n observer.unobserve(iconRef.value);\n }\n }\n },\n { rootMargin: \"100px\" }\n );\n if (iconRef.value) {\n observer.observe(iconRef.value);\n }\n } else {\n isVisible.value = true;\n loadDynamicIcon();\n }\n });\n\n onUnmounted(() => {\n requestRevision += 1;\n if (observer) {\n observer.disconnect();\n }\n });\n\n watch([iconName, apiProvider], () => {\n dynamicData.value = null;\n if (!isLazy.value || isVisible.value) {\n loadDynamicIcon();\n }\n });\n\n const sizeValue = computed(() =>\n typeof props.size === \"number\" ? `${props.size}px` : (String(props.size || \"\").trim() || \"1.25rem\")\n );\n\n return () => {\n const data = iconData.value;\n return h(\n \"svg\",\n {\n ref: iconRef,\n xmlns: \"http://www.w3.org/2000/svg\",\n viewBox: data.viewBox || \"0 0 24 24\",\n width: sizeValue.value,\n height: sizeValue.value,\n fill: \"currentColor\",\n class: [\"inline-block shrink-0 align-middle\", props.class].filter(Boolean).join(\" \"),\n style: { width: sizeValue.value, height: sizeValue.value },\n \"aria-hidden\": \"true\",\n \"data-icon-name\": props.name,\n \"data-icon-lazy\": isLazy.value ? \"true\" : \"false\",\n ...attrs\n },\n (data.paths?.length ? data.paths : [{ d: data.path || \"\", opacity: data.opacity }])\n .map((entry, index) => h(\"path\", {\n key: index,\n d: entry.d,\n fillRule: \"evenodd\",\n clipRule: \"evenodd\",\n opacity: entry.opacity || \"1\"\n }))\n );\n };\n }\n});\n\nexport const ResuxIcon = Icon;\n\nexport default defineResuxModule<ResuxIconsModuleOptions>({\n defaults: {\n collections: [],\n component: \"Icon\",\n mode: \"svg\",\n apiProvider: DEFAULT_ICON_API_PROVIDER,\n lazy: false\n },\n setup(options, resux) {\n const collections = Array.isArray(options.collections)\n ? [...new Set(options.collections.map((entry) => String(entry).trim()).filter(Boolean))]\n : [];\n resux.extendRuntimeConfig({\n public: {\n icons: {\n component: typeof options.component === \"string\" ? options.component : \"Icon\",\n collections,\n mode: options.mode || \"svg\",\n apiProvider: normalizeIconApiProvider(options.apiProvider),\n lazy: options.lazy === true\n }\n }\n });\n }\n});\n"],"mappings":";;;;;AAYA,SAAgB,sBAAsB,aAAgD;AACpF,QAAO,EAAE,aAAa;;AAexB,MAAa,eAAyC;CACpD,yBAAyB,EAAE,MAAM,gOAAgO;CACjQ,QAAQ,EAAE,MAAM,gOAAgO;CAChP,yBAAyB,EAAE,MAAM,kHAAkH;CACnJ,6CAA6C,EAAE,MAAM,kHAAkH;CACvK,iCAAiC,EAAE,MAAM,kHAAkH;CAC3J,QAAQ,EAAE,MAAM,kHAAkH;CAClI,gDAAgD,EAAE,MAAM,+JAA+J;CACvN,YAAY,EAAE,MAAM,+JAA+J;CACnL,4BAA4B,EAAE,MAAM,sDAAsD;CAC1F,WAAW,EAAE,MAAM,sDAAsD;CACzE,0BAA0B,EAAE,MAAM,oGAAoG;CACtI,SAAS,EAAE,MAAM,oGAAoG;CACrH,0BAA0B,EAAE,MAAM,yGAAyG;CAC3I,SAAS,EAAE,MAAM,yGAAyG;CAC1H,wBAAwB,EAAE,MAAM,uCAAuC;CACvE,OAAO,EAAE,MAAM,uCAAuC;CACtD,wCAAwC,EAAE,MAAM,8CAA8C;CAC9F,cAAc,EAAE,MAAM,8CAA8C;CACpE,gBAAgB,EAA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AAS;IAC1C,GAAG;IACJ,GACA,KAAK,OAAO,SAAS,KAAK,QAAQ,CAAC;IAAE,GAAG,KAAK,QAAQ;IAAI,SAAS,KAAK;IAAS,CAAC,EAC/E,KAAK,OAAO,UAAU,EAAE,QAAQ;IAC/B,KAAK;IACL,GAAG,MAAM;IACT,UAAU;IACV,UAAU;IACV,SAAS,MAAM,WAAW;IAC3B,CAAC,CAAC,CACN;;;CAGN,CAAC;AAEF,MAAa,YAAY;AAEzB,oBAAe,kBAA2C;CACxD,UAAU;EACR,aAAa,EAAE;EACf,WAAW;EACX,MAAM;EACN,aAAa;EACb,MAAM;EACP;CACD,MAAM,SAAS,OAAO;EACpB,MAAM,cAAc,MAAM,QAAQ,QAAQ,YAAY,GAClD,CAAC,GAAG,IAAI,IAAI,QAAQ,YAAY,KAAK,UAAU,OAAO,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,QAAQ,CAAC,CAAC,GACtF,EAAE;AACN,QAAM,oBAAoB,EACxB,QAAQ,EACN,OAAO;GACL,WAAW,OAAO,QAAQ,cAAc,WAAW,QAAQ,YAAY;GACvE;GACA,MAAM,QAAQ,QAAQ;GACtB,aAAa,yBAAyB,QAAQ,YAAY;GAC1D,MAAM,QAAQ,SAAS;GACxB,EACF,EACF,CAAC;;CAEL,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ import { computed } from "./reactivity/computed.js";
|
|
|
5
5
|
import { watch, watchEffect } from "./reactivity/watch.js";
|
|
6
6
|
import { nextTick } from "./reactivity/scheduler.js";
|
|
7
7
|
import { AsyncDataError, AsyncDataHandlerContext, AsyncDataResource, AsyncResuxRenderer, AwaitedAsyncDataResource, ClientEnhancementContext, ClientEnhancementSetup, ClientEnhancementTrigger, ClientPluginManifestRecord, ClientRouteMiddlewareManifestRecord, ClientRuntimeSourceOptions, ComponentDefinition, ComponentStyle, DeviceInfo, ElementTemplateNode, EventHandler, EventHandlerEvent, ForDirective, HeadEntry, HtmlDirective, IfDirective, InterpolationTemplateNode, JsonValue, PackageAdapterContext, PackageAdapterDefinition, PageMeta, RenderAppOptions, RenderDocumentOptions, RenderResult, ResuxAppInjections, ResuxAppLike, ResuxAppProvides, ResuxClientBootMode, ResuxClientBootPlan, ResuxClientPackageImportRegistry, ResuxConfigInput, ResuxDeployOptions, ResuxDeployTarget, ResuxError, ResuxImageBuilder, ResuxImageCacheInput, ResuxImageConfig, ResuxImageFit, ResuxImageModifiers, ResuxImageProviderConfig, ResuxLazyPackageLoader, ResuxLazyPackageOptions, ResuxModule, ResuxModuleContext, ResuxPackageCssMap, ResuxPackageMode, ResuxPackageModeMap, ResuxPackagesConfig, ResuxPayload, ResuxPlugin, ResuxRouteMiddleware, ResuxRouter, ResuxSupportMode, RouteContext, RouteMiddlewareResult, RouteRecord, RuntimeConfig, SeoMetaInput, SeoMetaValue, SerializedAsyncData, SerializedScope, ServerMiddleware, ServerMiddlewareResult, SetupContext, TemplateAttribute, TemplateEvent, TemplateNode, TextTemplateNode, UseClientEnhancementOptions, UseResuxImageOptions, abortNavigation, clearError, createError, createServerSetupContext, defineClientEnhancement, defineClientOnlyPackage, defineComponent, defineEventHandler, defineLazyPackage, definePackageAdapter, defineResuxConfig, defineResuxModule, defineResuxPlugin, defineResuxRouteMiddleware, defineServerMiddleware, disposeClientEnhancements, evaluateExpression, eventHandler, getClientEnhancement, getClientRuntimeBootPlan, getClientRuntimeSource, getQuery, hasClientEnhancement, navigateTo, parseUserAgent, readBody, renderApp, renderAppAsync, renderClientPatches, renderDocument, renderTemplateNodesAsync, scanClientEnhancements, setHeader, shouldLoadClientRuntime, showError, useClientEnhancement, useClientPackage, useDevice, useError, useLazyPackage, usePackageReady, useResuxApp, useResuxImage, useRoute, useRouter, useRuntimeConfig } from "./runtime/index.js";
|
|
8
|
-
export { AsyncDataError, AsyncDataHandlerContext, AsyncDataResource, AsyncResuxRenderer, AwaitedAsyncDataResource, ClientEnhancementContext, ClientEnhancementSetup, ClientEnhancementTrigger, ClientPluginManifestRecord, ClientRouteMiddlewareManifestRecord, ClientRuntimeSourceOptions, ComponentDefinition, ComponentStyle,
|
|
8
|
+
export { AsyncDataError, AsyncDataHandlerContext, AsyncDataResource, AsyncResuxRenderer, AwaitedAsyncDataResource, ClientEnhancementContext, ClientEnhancementSetup, ClientEnhancementTrigger, ClientPluginManifestRecord, ClientRouteMiddlewareManifestRecord, ClientRuntimeSourceOptions, ComponentDefinition, ComponentStyle, ComputedRef, DeviceInfo, ElementTemplateNode, EventHandler, EventHandlerEvent, ForDirective, HeadEntry, HtmlDirective, IfDirective, InterpolationTemplateNode, JsonValue, MaybeRef, MaybeRefOrGetter, PackageAdapterContext, PackageAdapterDefinition, PageMeta, ReactiveEffectOptions, ReactiveEffectRunner, Ref, RenderAppOptions, RenderDocumentOptions, RenderResult, ResuxAppInjections, ResuxAppLike, ResuxAppProvides, ResuxClientBootMode, ResuxClientBootPlan, ResuxClientPackageImportRegistry, ResuxConfigInput, ResuxDeployOptions, ResuxDeployTarget, ResuxError, ResuxImageBuilder, ResuxImageCacheInput, ResuxImageConfig, ResuxImageFit, ResuxImageModifiers, ResuxImageProviderConfig, ResuxLazyPackageLoader, ResuxLazyPackageOptions, ResuxModule, ResuxModuleContext, ResuxPackageCssMap, ResuxPackageMode, ResuxPackageModeMap, ResuxPackagesConfig, ResuxPayload, ResuxPlugin, ResuxRouteMiddleware, ResuxRouter, ResuxSupportMode, RouteContext, RouteMiddlewareResult, RouteRecord, RuntimeConfig, SeoMetaInput, SeoMetaValue, SerializedAsyncData, SerializedScope, ServerMiddleware, ServerMiddlewareResult, SetupContext, TemplateAttribute, TemplateEvent, TemplateNode, TextTemplateNode, UseClientEnhancementOptions, UseResuxImageOptions, WatchCallback, WatchOptions, WatchSource, WatchStopHandle, abortNavigation, clearError, computed, createError, createServerSetupContext, defineClientEnhancement, defineClientOnlyPackage, defineComponent, defineEventHandler, defineLazyPackage, definePackageAdapter, defineResuxConfig, defineResuxModule, defineResuxPlugin, defineResuxRouteMiddleware, defineServerMiddleware, disposeClientEnhancements, evaluateExpression, eventHandler, getClientEnhancement, getClientRuntimeBootPlan, getClientRuntimeSource, getQuery, hasClientEnhancement, isReactive, isReadonly, isRef, navigateTo, nextTick, parseUserAgent, reactive, readBody, readonly, ref, renderApp, renderAppAsync, renderClientPatches, renderDocument, renderTemplateNodesAsync, scanClientEnhancements, setHeader, shouldLoadClientRuntime, showError, toRef, toRefs, unref, useClientEnhancement, useClientPackage, useDevice, useError, useLazyPackage, usePackageReady, useResuxApp, useResuxImage, useRoute, useRouter, useRuntimeConfig, watch, watchEffect };
|
package/dist/index.js
CHANGED
|
@@ -4,4 +4,5 @@ import { computed } from "./reactivity/computed.js";
|
|
|
4
4
|
import { nextTick } from "./reactivity/scheduler.js";
|
|
5
5
|
import { watch, watchEffect } from "./reactivity/watch.js";
|
|
6
6
|
import { AsyncResuxRenderer, abortNavigation, clearError, createError, createServerSetupContext, defineClientEnhancement, defineClientOnlyPackage, defineComponent, defineEventHandler, defineLazyPackage, definePackageAdapter, defineResuxConfig, defineResuxModule, defineResuxPlugin, defineResuxRouteMiddleware, defineServerMiddleware, disposeClientEnhancements, evaluateExpression, eventHandler, getClientEnhancement, getClientRuntimeBootPlan, getClientRuntimeSource, getQuery, hasClientEnhancement, navigateTo, parseUserAgent, readBody, renderApp, renderAppAsync, renderClientPatches, renderDocument, renderTemplateNodesAsync, scanClientEnhancements, setHeader, shouldLoadClientRuntime, showError, useClientEnhancement, useClientPackage, useDevice, useError, useLazyPackage, usePackageReady, useResuxApp, useResuxImage, useRoute, useRouter, useRuntimeConfig } from "./runtime/index.js";
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
export { AsyncResuxRenderer, abortNavigation, clearError, computed, createError, createServerSetupContext, defineClientEnhancement, defineClientOnlyPackage, defineComponent, defineEventHandler, defineLazyPackage, definePackageAdapter, defineResuxConfig, defineResuxModule, defineResuxPlugin, defineResuxRouteMiddleware, defineServerMiddleware, disposeClientEnhancements, evaluateExpression, eventHandler, getClientEnhancement, getClientRuntimeBootPlan, getClientRuntimeSource, getQuery, hasClientEnhancement, isReactive, isReadonly, isRef, navigateTo, nextTick, parseUserAgent, reactive, readBody, readonly, ref, renderApp, renderAppAsync, renderClientPatches, renderDocument, renderTemplateNodesAsync, scanClientEnhancements, setHeader, shouldLoadClientRuntime, showError, toRef, toRefs, unref, useClientEnhancement, useClientPackage, useDevice, useError, useLazyPackage, usePackageReady, useResuxApp, useResuxImage, useRoute, useRouter, useRuntimeConfig, watch, watchEffect };
|
package/dist/kit/index.d.ts
CHANGED
|
@@ -1,32 +1,34 @@
|
|
|
1
1
|
import { NitroConfigExtender, PagesExtender, ResuxComponentInput, ResuxComponentsDirInput, ResuxImportInput, ResuxModuleContext, ResuxPluginInput, ResuxRouteMiddlewareInput, ResuxServerHandlerInput, ResuxTemplateInput, ResuxTypeTemplateInput, ViteConfigExtender } from "../core/module-container.js";
|
|
2
|
+
|
|
2
3
|
//#region src/kit/index.d.ts
|
|
3
|
-
|
|
4
|
+
interface ResuxModuleMeta {
|
|
4
5
|
name?: string;
|
|
5
6
|
configKey?: string;
|
|
6
7
|
}
|
|
7
|
-
|
|
8
|
+
interface ResuxModuleDefinition<TOptions = Record<string, unknown>> {
|
|
8
9
|
meta?: ResuxModuleMeta;
|
|
9
10
|
defaults?: TOptions;
|
|
10
11
|
setup: (options: TOptions, resux: ResuxModuleContext) => void | Promise<void>;
|
|
11
12
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
13
|
+
declare function withResuxKitContext<T>(context: ResuxModuleContext, run: () => Promise<T> | T): Promise<T> | T;
|
|
14
|
+
declare function defineResuxModule<TOptions = Record<string, unknown>>(module: ResuxModuleDefinition<TOptions>): ResuxModuleDefinition<TOptions>;
|
|
15
|
+
declare function addComponent(component: ResuxComponentInput | string): void;
|
|
16
|
+
declare function addComponentsDir(dir: ResuxComponentsDirInput | string): void;
|
|
17
|
+
declare function addImports(imports: ResuxImportInput | ResuxImportInput[]): void;
|
|
18
|
+
declare function addImportsDir(dir: string): void;
|
|
19
|
+
declare function addPlugin(plugin: ResuxPluginInput | string): void;
|
|
20
|
+
declare function addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void;
|
|
21
|
+
declare function addServerHandler(handler: ResuxServerHandlerInput): void;
|
|
22
|
+
declare function addServerPlugin(plugin: string): void;
|
|
23
|
+
declare function addTemplate(template: ResuxTemplateInput): void;
|
|
24
|
+
declare function addTypeTemplate(template: ResuxTypeTemplateInput): void;
|
|
25
|
+
declare function extendPages(extender: PagesExtender): void;
|
|
26
|
+
declare function extendRuntimeConfig(config: Record<string, unknown>): void;
|
|
27
|
+
declare function extendViteConfig(extender: ViteConfigExtender): void;
|
|
28
|
+
declare function extendNitroConfig(extender: NitroConfigExtender): void;
|
|
29
|
+
declare function addVitePlugin(plugin: unknown): void;
|
|
30
|
+
declare function addRouteRule(path: string, rule: Record<string, unknown>): void;
|
|
31
|
+
declare function addPrerenderRoutes(route: string | string[]): void;
|
|
31
32
|
//#endregion
|
|
33
|
+
export { ResuxModuleDefinition, ResuxModuleMeta, addComponent, addComponentsDir, addImports, addImportsDir, addPlugin, addPrerenderRoutes, addRouteMiddleware, addRouteRule, addServerHandler, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, defineResuxModule, extendNitroConfig, extendPages, extendRuntimeConfig, extendViteConfig, withResuxKitContext };
|
|
32
34
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/kit/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
|
|
2
3
|
//#region src/kit/index.ts
|
|
3
4
|
const kitContextStorage = new AsyncLocalStorage();
|
|
4
5
|
function withResuxKitContext(context, run) {
|
|
@@ -63,7 +64,7 @@ function useContext(api) {
|
|
|
63
64
|
if (!context) throw new Error(`Resux Kit "${api}" was called outside of a module setup context.`);
|
|
64
65
|
return context;
|
|
65
66
|
}
|
|
67
|
+
|
|
66
68
|
//#endregion
|
|
67
69
|
export { addComponent, addComponentsDir, addImports, addImportsDir, addPlugin, addPrerenderRoutes, addRouteMiddleware, addRouteRule, addServerHandler, addServerPlugin, addTemplate, addTypeTemplate, addVitePlugin, defineResuxModule, extendNitroConfig, extendPages, extendRuntimeConfig, extendViteConfig, withResuxKitContext };
|
|
68
|
-
|
|
69
70
|
//# sourceMappingURL=index.js.map
|
package/dist/kit/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/kit/index.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type {\n PagesExtender,\n ResuxComponentInput,\n ResuxComponentsDirInput,\n ResuxImportInput,\n ResuxModuleContext,\n ResuxPluginInput,\n ResuxRouteMiddlewareInput,\n ResuxServerHandlerInput,\n ResuxTemplateInput,\n ResuxTypeTemplateInput,\n ViteConfigExtender,\n NitroConfigExtender\n} from \"../core/module-container.js\";\n\nexport interface ResuxModuleMeta {\n name?: string;\n configKey?: string;\n}\n\nexport interface ResuxModuleDefinition<TOptions = Record<string, unknown>> {\n meta?: ResuxModuleMeta;\n defaults?: TOptions;\n setup: (options: TOptions, resux: ResuxModuleContext) => void | Promise<void>;\n}\n\nconst kitContextStorage = new AsyncLocalStorage<ResuxModuleContext>();\n\nexport function withResuxKitContext<T>(context: ResuxModuleContext, run: () => Promise<T> | T): Promise<T> | T {\n return kitContextStorage.run(context, run);\n}\n\nexport function defineResuxModule<TOptions = Record<string, unknown>>(module: ResuxModuleDefinition<TOptions>): ResuxModuleDefinition<TOptions> {\n return module;\n}\n\nexport function addComponent(component: ResuxComponentInput | string): void {\n useContext(\"addComponent\").addComponent(component);\n}\n\nexport function addComponentsDir(dir: ResuxComponentsDirInput | string): void {\n useContext(\"addComponentsDir\").addComponentsDir(dir);\n}\n\nexport function addImports(imports: ResuxImportInput | ResuxImportInput[]): void {\n useContext(\"addImports\").addImports(imports);\n}\n\nexport function addImportsDir(dir: string): void {\n useContext(\"addImportsDir\").addImportsDir(dir);\n}\n\nexport function addPlugin(plugin: ResuxPluginInput | string): void {\n useContext(\"addPlugin\").addPlugin(plugin);\n}\n\nexport function addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void {\n useContext(\"addRouteMiddleware\").addRouteMiddleware(middleware);\n}\n\nexport function addServerHandler(handler: ResuxServerHandlerInput): void {\n useContext(\"addServerHandler\").addServerHandler(handler);\n}\n\nexport function addServerPlugin(plugin: string): void {\n useContext(\"addServerPlugin\").addServerPlugin(plugin);\n}\n\nexport function addTemplate(template: ResuxTemplateInput): void {\n useContext(\"addTemplate\").addTemplate(template);\n}\n\nexport function addTypeTemplate(template: ResuxTypeTemplateInput): void {\n useContext(\"addTypeTemplate\").addTypeTemplate(template);\n}\n\nexport function extendPages(extender: PagesExtender): void {\n useContext(\"extendPages\").extendPages(extender);\n}\n\nexport function extendRuntimeConfig(config: Record<string, unknown>): void {\n useContext(\"extendRuntimeConfig\").extendRuntimeConfig(config);\n}\n\nexport function extendViteConfig(extender: ViteConfigExtender): void {\n useContext(\"extendViteConfig\").extendViteConfig(extender);\n}\n\nexport function extendNitroConfig(extender: NitroConfigExtender): void {\n useContext(\"extendNitroConfig\").extendNitroConfig(extender);\n}\n\nexport function addVitePlugin(plugin: unknown): void {\n useContext(\"addVitePlugin\").addVitePlugin(plugin);\n}\n\nexport function addRouteRule(path: string, rule: Record<string, unknown>): void {\n useContext(\"addRouteRule\").addRouteRule(path, rule);\n}\n\nexport function addPrerenderRoutes(route: string | string[]): void {\n useContext(\"addPrerenderRoutes\").addPrerenderRoutes(route);\n}\n\nfunction useContext(api: string): ResuxModuleContext {\n const context = kitContextStorage.getStore();\n if (!context) {\n throw new Error(`Resux Kit \"${api}\" was called outside of a module setup context.`);\n }\n return context;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/kit/index.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\nimport type {\n PagesExtender,\n ResuxComponentInput,\n ResuxComponentsDirInput,\n ResuxImportInput,\n ResuxModuleContext,\n ResuxPluginInput,\n ResuxRouteMiddlewareInput,\n ResuxServerHandlerInput,\n ResuxTemplateInput,\n ResuxTypeTemplateInput,\n ViteConfigExtender,\n NitroConfigExtender\n} from \"../core/module-container.js\";\n\nexport interface ResuxModuleMeta {\n name?: string;\n configKey?: string;\n}\n\nexport interface ResuxModuleDefinition<TOptions = Record<string, unknown>> {\n meta?: ResuxModuleMeta;\n defaults?: TOptions;\n setup: (options: TOptions, resux: ResuxModuleContext) => void | Promise<void>;\n}\n\nconst kitContextStorage = new AsyncLocalStorage<ResuxModuleContext>();\n\nexport function withResuxKitContext<T>(context: ResuxModuleContext, run: () => Promise<T> | T): Promise<T> | T {\n return kitContextStorage.run(context, run);\n}\n\nexport function defineResuxModule<TOptions = Record<string, unknown>>(module: ResuxModuleDefinition<TOptions>): ResuxModuleDefinition<TOptions> {\n return module;\n}\n\nexport function addComponent(component: ResuxComponentInput | string): void {\n useContext(\"addComponent\").addComponent(component);\n}\n\nexport function addComponentsDir(dir: ResuxComponentsDirInput | string): void {\n useContext(\"addComponentsDir\").addComponentsDir(dir);\n}\n\nexport function addImports(imports: ResuxImportInput | ResuxImportInput[]): void {\n useContext(\"addImports\").addImports(imports);\n}\n\nexport function addImportsDir(dir: string): void {\n useContext(\"addImportsDir\").addImportsDir(dir);\n}\n\nexport function addPlugin(plugin: ResuxPluginInput | string): void {\n useContext(\"addPlugin\").addPlugin(plugin);\n}\n\nexport function addRouteMiddleware(middleware: ResuxRouteMiddlewareInput): void {\n useContext(\"addRouteMiddleware\").addRouteMiddleware(middleware);\n}\n\nexport function addServerHandler(handler: ResuxServerHandlerInput): void {\n useContext(\"addServerHandler\").addServerHandler(handler);\n}\n\nexport function addServerPlugin(plugin: string): void {\n useContext(\"addServerPlugin\").addServerPlugin(plugin);\n}\n\nexport function addTemplate(template: ResuxTemplateInput): void {\n useContext(\"addTemplate\").addTemplate(template);\n}\n\nexport function addTypeTemplate(template: ResuxTypeTemplateInput): void {\n useContext(\"addTypeTemplate\").addTypeTemplate(template);\n}\n\nexport function extendPages(extender: PagesExtender): void {\n useContext(\"extendPages\").extendPages(extender);\n}\n\nexport function extendRuntimeConfig(config: Record<string, unknown>): void {\n useContext(\"extendRuntimeConfig\").extendRuntimeConfig(config);\n}\n\nexport function extendViteConfig(extender: ViteConfigExtender): void {\n useContext(\"extendViteConfig\").extendViteConfig(extender);\n}\n\nexport function extendNitroConfig(extender: NitroConfigExtender): void {\n useContext(\"extendNitroConfig\").extendNitroConfig(extender);\n}\n\nexport function addVitePlugin(plugin: unknown): void {\n useContext(\"addVitePlugin\").addVitePlugin(plugin);\n}\n\nexport function addRouteRule(path: string, rule: Record<string, unknown>): void {\n useContext(\"addRouteRule\").addRouteRule(path, rule);\n}\n\nexport function addPrerenderRoutes(route: string | string[]): void {\n useContext(\"addPrerenderRoutes\").addPrerenderRoutes(route);\n}\n\nfunction useContext(api: string): ResuxModuleContext {\n const context = kitContextStorage.getStore();\n if (!context) {\n throw new Error(`Resux Kit \"${api}\" was called outside of a module setup context.`);\n }\n return context;\n}\n"],"mappings":";;;AA2BA,MAAM,oBAAoB,IAAI,mBAAuC;AAErE,SAAgB,oBAAuB,SAA6B,KAA2C;AAC7G,QAAO,kBAAkB,IAAI,SAAS,IAAI;;AAG5C,SAAgB,kBAAsD,QAA0E;AAC9I,QAAO;;AAGT,SAAgB,aAAa,WAA+C;AAC1E,YAAW,eAAe,CAAC,aAAa,UAAU;;AAGpD,SAAgB,iBAAiB,KAA6C;AAC5E,YAAW,mBAAmB,CAAC,iBAAiB,IAAI;;AAGtD,SAAg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/index.d.ts
|
|
2
|
-
|
|
2
|
+
interface ResuxNitroServerOptions {
|
|
3
3
|
appRoot: string;
|
|
4
4
|
outDir: string;
|
|
5
5
|
preset?: string;
|
|
6
6
|
compatibilityDate?: string;
|
|
7
7
|
}
|
|
8
|
-
|
|
8
|
+
declare function createNitroServerOptions(options: ResuxNitroServerOptions): ResuxNitroServerOptions;
|
|
9
9
|
//#endregion
|
|
10
|
+
export { ResuxNitroServerOptions, createNitroServerOptions };
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/nitro-server/index.ts"],"sourcesContent":["export interface ResuxNitroServerOptions {\n appRoot: string;\n outDir: string;\n preset?: string;\n compatibilityDate?: string;\n}\n\nexport function createNitroServerOptions(options: ResuxNitroServerOptions): ResuxNitroServerOptions {\n return options;\n}\n"],"mappings":";AAOA,SAAgB,yBAAyB,SAA2D;
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/nitro-server/index.ts"],"sourcesContent":["export interface ResuxNitroServerOptions {\n appRoot: string;\n outDir: string;\n preset?: string;\n compatibilityDate?: string;\n}\n\nexport function createNitroServerOptions(options: ResuxNitroServerOptions): ResuxNitroServerOptions {\n return options;\n}\n"],"mappings":";AAOA,SAAgB,yBAAyB,SAA2D;AAClG,QAAO"}
|
package/dist/node.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { ResuxNodeHandlerOptions } from "./cli.js";
|
|
2
2
|
import { ServerResponse } from "node:http";
|
|
3
|
+
import * as http0 from "http";
|
|
4
|
+
|
|
3
5
|
//#region src/node.d.ts
|
|
4
|
-
|
|
6
|
+
declare function createResuxNodeHandler(options?: ResuxNodeHandlerOptions): (request: http0.IncomingMessage, response: ServerResponse) => void;
|
|
5
7
|
//#endregion
|
|
6
|
-
export type
|
|
8
|
+
export { type ResuxNodeHandlerOptions, createResuxNodeHandler };
|
|
7
9
|
//# sourceMappingURL=node.d.ts.map
|
package/dist/node.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { createResuxNodeHandler as createResuxNodeHandler$1 } from "./cli.js";
|
|
2
|
+
|
|
2
3
|
//#region src/node.ts
|
|
3
4
|
const GENERATED_IMAGE_PREFIX = "/_resux/generated/images/";
|
|
4
5
|
const GENERATED_VIDEO_PREFIX = "/_resux/generated/videos/";
|
|
5
6
|
const STATELESS_IMAGE_PATH = "/__resux/image";
|
|
6
7
|
const STATELESS_VIDEO_PATH = "/__resux/video";
|
|
7
|
-
const CACHE_BOOLEAN_TRUE =
|
|
8
|
+
const CACHE_BOOLEAN_TRUE = new Set([
|
|
8
9
|
"true",
|
|
9
10
|
"1",
|
|
10
11
|
"yes",
|
|
11
12
|
"on"
|
|
12
13
|
]);
|
|
13
|
-
const CACHE_BOOLEAN_FALSE =
|
|
14
|
+
const CACHE_BOOLEAN_FALSE = new Set([
|
|
14
15
|
"false",
|
|
15
16
|
"0",
|
|
16
17
|
"off",
|
|
@@ -20,8 +21,8 @@ const CACHE_UNIT_SECONDS = {
|
|
|
20
21
|
s: 1,
|
|
21
22
|
m: 60,
|
|
22
23
|
h: 3600,
|
|
23
|
-
d:
|
|
24
|
-
w:
|
|
24
|
+
d: 1440 * 60,
|
|
25
|
+
w: 10080 * 60
|
|
25
26
|
};
|
|
26
27
|
function positiveRoundedSeconds(value) {
|
|
27
28
|
return Number.isFinite(value) && value > 0 ? Math.max(1, Math.round(value)) : void 0;
|
|
@@ -29,7 +30,7 @@ function positiveRoundedSeconds(value) {
|
|
|
29
30
|
function parseCacheMaxAgeSeconds(value) {
|
|
30
31
|
const normalized = value?.trim().toLowerCase();
|
|
31
32
|
if (!normalized || CACHE_BOOLEAN_FALSE.has(normalized)) return;
|
|
32
|
-
if (CACHE_BOOLEAN_TRUE.has(normalized)) return
|
|
33
|
+
if (CACHE_BOOLEAN_TRUE.has(normalized)) return 1440 * 60;
|
|
33
34
|
const numericSeconds = positiveRoundedSeconds(Number(normalized));
|
|
34
35
|
if (numericSeconds) return numericSeconds;
|
|
35
36
|
const duration = /^(\d+)\s*([smhdw])$/.exec(normalized);
|
|
@@ -100,7 +101,7 @@ function createResuxNodeHandler(options = {}) {
|
|
|
100
101
|
handler(request, response);
|
|
101
102
|
};
|
|
102
103
|
}
|
|
104
|
+
|
|
103
105
|
//#endregion
|
|
104
106
|
export { createResuxNodeHandler };
|
|
105
|
-
|
|
106
107
|
//# sourceMappingURL=node.js.map
|