Repository navigation
Troubleshooting
Common issues and their solutions when using Blocky UI.
Problem: npm install blocky-ui-lite fails with errors
Solutions:
-
Clear NPM cache:
npm cache clean --force npm install blocky-ui-lite
-
Check Node.js version:
node --version # Should be >=14.0.0 -
Try with different registry:
npm install blocky-ui-lite --registry=https://registry.npmjs.org/
-
Use exact version:
npm install blocky-ui-lite@1.0.0
Problem: TypeScript or JavaScript cannot resolve blocky-ui
Solutions:
-
Verify installation:
npm list blocky-ui
-
Check package.json:
{ "dependencies": { "blocky-ui-lite": "^1.0.0" } } -
Reinstall package:
npm uninstall blocky-ui npm install blocky-ui-lite
-
Check import path:
// ✅ Correct import { BlockyUI } from 'blocky-ui-lite'; import 'blocky-ui-lite/styles'; // ❌ Wrong import { BlockyUI } from 'blocky-ui-lite/dist/index.esm.js';
Problem: CSS import fails
Solutions:
-
Check package.json exports:
{ "exports": { "./styles": "./dist/blocky-ui.css" } } -
Alternative import paths:
import 'blocky-ui-lite/styles'; // Preferred // or import 'blocky-ui-lite/dist/blocky-ui.css'; // Direct path
-
Bundler configuration (Webpack/Vite):
// Ensure CSS loader is configured module.exports = { module: { rules: [ { test: /\.css$/, use: ['style-loader', 'css-loader'] } ] } };
Problem: Components render but have no 3D effects or colors
Solutions:
-
Import CSS:
import 'blocky-ui-lite/styles'; // Must be imported!
-
Check CSS load order:
// ✅ Correct order import 'blocky-ui-lite/styles'; // First import './your-app-styles.css'; // Then your styles // ❌ Wrong - your styles might override blocky styles import './your-app-styles.css'; import 'blocky-ui-lite/styles';
-
Verify CSS in browser DevTools:
- Open DevTools → Elements tab
- Inspect a blocky component
- Check if
.blocky-*classes have styles applied - If not, CSS file didn't load
-
Check for CSS conflicts:
/* Bad - overwrites all buttons */ button { padding: 0 !important; } /* Good - scope your styles */ .my-app button { padding: 0; }
Problem: Components are flat, no depth
Solutions:
-
Check box-shadow support:
// Test in browser console const el = document.createElement('div'); el.style.boxShadow = '0 4px 0 rgba(0,0,0,0.3)'; console.log(el.style.boxShadow); // Should not be empty
-
Disable browser extensions that might override CSS
-
Check CSS Variables:
// In browser console getComputedStyle(document.documentElement) .getPropertyValue('--blocky-shadow-base'); // Should return: "0 4px 0 rgba(0, 0, 0, 0.3)"
Problem: Wrong colors or gradients
Solution:
-
Check variant spelling:
// ✅ Correct BlockyUI.createButton({ text: 'Test', variant: 'primary' }); // ❌ Wrong (typo) BlockyUI.createButton({ text: 'Test', variant: 'Primary' }); // Case-sensitive!
-
Verify CSS Variables:
:root { --blocky-primary: #55dfff; /* Should be this color */ }
Problem: Component props don't cause re-render
Solution:
Blocky UI components are vanilla DOM elements. You need to handle updates manually:
// ❌ Wrong - won't update when text changes
function BlockyButton({ text }: { text: string }) {
const button = BlockyUI.createButton({ text, variant: 'primary' });
return <div ref={el => el && el.appendChild(button)} />;
}
// ✅ Correct - recreates on text change
function BlockyButton({ text }: { text: string }) {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
if (ref.current) {
ref.current.innerHTML = '';
const button = BlockyUI.createButton({ text, variant: 'primary' });
ref.current.appendChild(button);
}
}, [text]);
return <div ref={ref} />;
}Problem: Components don't render in Vue templates
Solution:
Use onMounted or ref:
<script setup>
import { onMounted, ref } from 'vue';
import { BlockyUI } from 'blocky-ui-lite';
import 'blocky-ui-lite/styles';
const container = ref(null);
onMounted(() => {
if (container.value) {
const button = BlockyUI.createButton({
text: 'Click Me',
variant: 'primary'
});
container.value.appendChild(button);
}
});
</script>
<template>
<div ref="container"></div>
</template>Problem: Vite can't find blocky-ui when using npm link or local development
Solution:
Update vite.config.ts:
import { defineConfig } from 'vite';
export default defineConfig({
server: {
fs: {
allow: [
process.cwd(),
'/path/to/blocky-ui' // Add this
]
}
}
});Problem: TypeScript complains about method signatures
Solutions:
-
Import types explicitly:
import type { BlockyButtonOptions, BlockyModalOptions, BlockyModalInstance } from 'blocky-ui-lite';
-
Type assertion for edge cases:
const modal = BlockyUI.createModal({ title: 'Test', content: myHtmlElement as HTMLElement, buttons: [] });
-
Regenerate type definitions:
cd node_modules/blocky-ui npm run build
Problem: Could not find a declaration file for module 'blocky-ui-lite'
Solutions:
-
Verify dist/ contains index.d.ts:
ls node_modules/blocky-ui-lite/dist/ # Should show: index.d.ts -
Check package.json types field:
{ "types": "dist/index.d.ts" } -
Force reinstall:
rm -rf node_modules/blocky-ui npm install blocky-ui-lite
Problem: Clicking overlay or Escape doesn't close modal
Solutions:
-
Check z-index conflicts:
/* Your app might have higher z-index */ .my-app-header { z-index: 9999; /* Blocks modal overlay */ }
-
Verify modal instance:
const modal = BlockyUI.createModal({ /* ... */ }); modal.show(); // Don't forget to call show()!
-
Check event handlers:
// Make sure onClick doesn't prevent default buttons: [ { text: 'Close', variant: 'primary', onClick: () => { // Do your logic, modal closes automatically } } ]
Problem: Modal overlay is blocked by other elements
Solution:
Adjust z-index layers:
/* In your app CSS */
:root {
--blocky-z-overlay-modal: 9999; /* Increase if needed */
}Problem: Components take a long time to appear
Solutions:
-
Batch DOM operations:
// ❌ Slow - multiple reflows components.forEach(comp => { document.body.appendChild(comp); }); // ✅ Fast - single reflow const fragment = document.createDocumentFragment(); components.forEach(comp => fragment.appendChild(comp)); document.body.appendChild(fragment);
-
Use requestAnimationFrame for animations:
requestAnimationFrame(() => { modal.show(); });
Problem: Memory consumption grows over time
Solution:
Clean up event listeners:
// ✅ Correct - remove when done
const button = BlockyUI.createButton({
text: 'Click',
onClick: handleClick
});
// Later, when removing:
button.querySelector('.blocky-btn')?.removeEventListener('click', handleClick);
button.remove();Problem: Components don't work in Internet Explorer 11
Reason: Blocky UI uses modern CSS features not available in IE11:
- CSS Custom Properties (variables)
backdrop-filter- Modern flexbox/grid
Solution: Use modern browsers (Chrome, Firefox, Safari, Edge)
Problem: Backdrop blur doesn't work in older Safari versions
Solution:
Add vendor prefixes (already included in Blocky UI):
.blocky-modal-overlay {
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
}Problem: npm run build fails
Solutions:
-
Clear node_modules:
rm -rf node_modules package-lock.json npm install npm run build
-
Check TypeScript version:
npm list typescript # Should be ^5.0.0 -
Verify rollup config:
npm list rollup # Should be ^3.0.0
Problem: npm run dev doesn't rebuild on changes
Solution:
- Check file paths in rollup.config.js
-
Restart watch mode:
# Kill existing process pkill -f "rollup -c -w" # Restart npm run dev
If your issue isn't listed here:
- Check existing issues: GitHub Issues
-
Create new issue: Provide:
- Blocky UI version
- Framework and version (if applicable)
- Minimal reproduction code
- Browser and OS
- Error messages or screenshots
Still stuck? Open an issue and we'll help! 🎮