UNPKG

vlibras-player-webjs

Version:

Biblioteca JavaScript moderna para integração do VLibras Player com React, Vue, Angular e vanilla JS

44 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.withNoSSR = withNoSSR; exports.withVLibrasNoSSR = withVLibrasNoSSR; const jsx_runtime_1 = require("react/jsx-runtime"); const NoSSR_1 = require("./NoSSR"); /** * HOC que envolve um componente para renderização apenas no cliente * @param Component - Componente a ser envolvido * @param options - Opções de configuração * @returns Componente envolvido com NoSSR */ function withNoSSR(Component, options = {}) { const { fallback, delay, displayName } = options; const WrappedComponent = (props) => ((0, jsx_runtime_1.jsx)(NoSSR_1.NoSSR, { fallback: fallback, delay: delay, children: (0, jsx_runtime_1.jsx)(Component, { ...props }) })); WrappedComponent.displayName = displayName || `withNoSSR(${Component.displayName || Component.name})`; return WrappedComponent; } /** * HOC específico para componentes VLibras * Inclui fallback padrão e configurações otimizadas */ function withVLibrasNoSSR(Component, customFallback) { const defaultFallback = ((0, jsx_runtime_1.jsx)("div", { className: "vlibras-ssr-placeholder", style: { display: 'inline-block', width: '50px', height: '50px', backgroundColor: '#1976d2', borderRadius: '50%', opacity: 0.7, animation: 'vlibras-pulse 1.5s ease-in-out infinite alternate' }, "aria-label": "Carregando VLibras...", children: (0, jsx_runtime_1.jsx)("style", { children: ` @keyframes vlibras-pulse { from { opacity: 0.7; } to { opacity: 0.3; } } ` }) })); return withNoSSR(Component, { fallback: customFallback || defaultFallback, delay: 100, // Pequeno delay para melhor experiência displayName: `withVLibrasNoSSR(${Component.displayName || Component.name})` }); } //# sourceMappingURL=withNoSSR.js.map