diff --git a/index.html b/index.html
index 791eb81..5a262a6 100644
--- a/index.html
+++ b/index.html
@@ -557,6 +557,7 @@
+
@@ -612,11 +613,9 @@
-
-
-
-
-
+
+
+
diff --git a/public/app.js b/public/app.js
index f2c49f9..5b69aca 100644
--- a/public/app.js
+++ b/public/app.js
@@ -6,17 +6,7 @@
// Logger disponível globalmente (carregado antes em logger.js)
// Usar window.Logger.info('mensagem') para logs controlados
-// Import state from modules (userPreferences only - appState is still global for legacy)
-import { userPreferences, loadPreferences, savePreferences, adminConfig } from './js/core/state.js';
-
-// Make available globally for legacy code
-window.userPreferences = userPreferences;
-window.loadPreferences = loadPreferences;
-window.savePreferences = savePreferences;
-window.adminConfig = adminConfig;
-
-// In-memory data storage (legacy - still global for compatibility)
-const appState = {
+// State e config disponíveis globalmente via script state.js (carregado antes)
// ========================================
// CSV MAPPING AND LOADING FUNCTIONS v6.6
diff --git a/public/js/core/state.js b/public/js/core/state.js
index 5abb320..f53ee89 100644
--- a/public/js/core/state.js
+++ b/public/js/core/state.js
@@ -1,135 +1,152 @@
-/**
- * Application State Management
- * Central state for the entire application
- */
-
-// Main application state
-export const appState = {
- history: [],
- favorites: [],
- budgetItems: [],
- currentSection: 'cev',
- currentTheme: 'dark',
- expertMode: false,
- currentSidebarTab: 0
-};
-
-// User preferences (persisted to localStorage)
-export let userPreferences = {
- theme: 'dark',
- colorScheme: 'default',
- fontSize: 'medium',
- fontFamily: 'default'
-};
-
-// Load preferences from localStorage
-export function loadPreferences() {
- try {
- const saved = localStorage.getItem('acoCalcPreferences');
- if (saved) {
- userPreferences = { ...userPreferences, ...JSON.parse(saved) };
- }
- } catch (e) {
- console.warn('Não foi possível carregar preferências:', e);
- }
-}
-
-// Save preferences to localStorage
-export function savePreferences() {
- try {
- localStorage.setItem('acoCalcPreferences', JSON.stringify(userPreferences));
- } catch (e) {
- console.warn('Não foi possível salvar preferências:', e);
- }
-}
-
-// Admin configuration
-export const adminConfig = {
- appName: 'SteelBase',
- appSubtitle: 'Plataforma Técnica com Base de Dados de Materiais Brasileiros',
- footerText: '© 2025 SteelBase v7.5 PROFESSIONAL EDITION - Plataforma Técnica com Base de Dados de Materiais Brasileiros',
- themeDefault: 'escuro',
- modeDefault: 'simples',
- toolsVisibility: {
- 'cev': true,
- 'seletor': true,
- 'equivalencias': false,
- 'comparativo': false,
- 'parafusos': true,
- 'layout': true,
- 'parafuso-vs-solda': false,
- 'preaquecimento': true,
- 'dureza': true,
- 'charpy': true,
- 'certificado': false,
- 'ultrassom': false,
- 'area-pintura': true,
- 'consumo-tinta': true,
- 'galvanizacao': false,
- 'custo-pintura': true,
- 'secagem': false,
- 'inspecao-pintura': false,
- 'orcamento': true,
- 'peso-rigging': false,
- 'referencia': false
- }
-};
-
-/**
- * Update app state
- * @param {string} key - State key
- * @param {any} value - New value
- */
-export function updateState(key, value) {
- appState[key] = value;
-}
-
-/**
- * Get state value
- * @param {string} key - State key
- * @returns {any} State value
- */
-export function getState(key) {
- return appState[key];
-}
-
-/**
- * Update user preferences
- * @param {string} key - Preference key
- * @param {any} value - New value
- */
-export function updatePreference(key, value) {
- userPreferences[key] = value;
-}
-
-/**
- * Get preference value
- * @param {string} key - Preference key
- * @returns {any} Preference value
- */
-export function getPreference(key) {
- return userPreferences[key];
-}
-
-/**
- * Check if localStorage is available and has space
- * @returns {object} Storage status
- */
-export function checkStorage() {
- try {
- const testKey = '__storage_test__';
- localStorage.setItem(testKey, testKey);
- localStorage.removeItem(testKey);
-
- let totalSize = 0;
- for (let key in localStorage) {
- if (localStorage.hasOwnProperty(key)) {
- totalSize += localStorage[key].length * 2;
- }
- }
-
- return { available: true, usedBytes: totalSize };
- } catch (error) {
- return { available: false, error: error.message };
- }
-}
+/**
+ * Application State Management
+ * Central state for the entire application
+ */
+
+// Main application state
+var appState = {
+ history: [],
+ favorites: [],
+ budgetItems: [],
+ currentSection: 'cev',
+ currentTheme: 'dark',
+ expertMode: false,
+ currentSidebarTab: 0
+};
+
+// User preferences (persisted to localStorage)
+var userPreferences = {
+ theme: 'dark',
+ colorScheme: 'default',
+ fontSize: 'medium',
+ fontFamily: 'default'
+};
+
+// Load preferences from localStorage
+function loadPreferences() {
+ try {
+ var saved = localStorage.getItem('acoCalcPreferences');
+ if (saved) {
+ var parsed = JSON.parse(saved);
+ for (var key in parsed) {
+ if (parsed.hasOwnProperty(key)) {
+ userPreferences[key] = parsed[key];
+ }
+ }
+ }
+ } catch (e) {
+ console.warn('Nao foi possivel carregar preferencias:', e);
+ }
+}
+
+// Save preferences to localStorage
+function savePreferences() {
+ try {
+ localStorage.setItem('acoCalcPreferences', JSON.stringify(userPreferences));
+ } catch (e) {
+ console.warn('Nao foi possivel salvar preferencias:', e);
+ }
+}
+
+// Admin configuration
+var adminConfig = {
+ appName: 'SteelBase',
+ appSubtitle: 'Plataforma Tecnica com Base de Dados de Materiais Brasileiros',
+ footerText: '© 2025 SteelBase v7.5 PROFESSIONAL EDITION - Plataforma Tecnica com Base de Dados de Materiais Brasileiros',
+ themeDefault: 'escuro',
+ modeDefault: 'simples',
+ toolsVisibility: {
+ 'cev': true,
+ 'seletor': true,
+ 'equivalencias': false,
+ 'comparativo': false,
+ 'parafusos': true,
+ 'layout': true,
+ 'parafuso-vs-solda': false,
+ 'preaquecimento': true,
+ 'dureza': true,
+ 'charpy': true,
+ 'certificado': false,
+ 'ultrassom': false,
+ 'area-pintura': true,
+ 'consumo-tinta': true,
+ 'galvanizacao': false,
+ 'custo-pintura': true,
+ 'secagem': false,
+ 'inspecao-pintura': false,
+ 'orcamento': true,
+ 'peso-rigging': false,
+ 'referencia': false
+ }
+};
+
+/**
+ * Update app state
+ * @param {string} key - State key
+ * @param {any} value - New value
+ */
+function updateState(key, value) {
+ appState[key] = value;
+}
+
+/**
+ * Get state value
+ * @param {string} key - State key
+ * @returns {any} State value
+ */
+function getState(key) {
+ return appState[key];
+}
+
+/**
+ * Update user preferences
+ * @param {string} key - Preference key
+ * @param {any} value - New value
+ */
+function updatePreference(key, value) {
+ userPreferences[key] = value;
+}
+
+/**
+ * Get preference value
+ * @param {string} key - Preference key
+ * @returns {any} Preference value
+ */
+function getPreference(key) {
+ return userPreferences[key];
+}
+
+/**
+ * Check if localStorage is available and has space
+ * @returns {object} Storage status
+ */
+function checkStorage() {
+ try {
+ var testKey = '__storage_test__';
+ localStorage.setItem(testKey, testKey);
+ localStorage.removeItem(testKey);
+
+ var totalSize = 0;
+ for (var key in localStorage) {
+ if (localStorage.hasOwnProperty(key)) {
+ totalSize += localStorage[key].length * 2;
+ }
+ }
+
+ return { available: true, usedBytes: totalSize };
+ } catch (error) {
+ return { available: false, error: error.message };
+ }
+}
+
+// Make available globally
+window.appState = appState;
+window.userPreferences = userPreferences;
+window.loadPreferences = loadPreferences;
+window.savePreferences = savePreferences;
+window.adminConfig = adminConfig;
+window.updateState = updateState;
+window.getState = getState;
+window.updatePreference = updatePreference;
+window.getPreference = getPreference;
+window.checkStorage = checkStorage;
\ No newline at end of file
diff --git a/public/js/utils/logger.js b/public/js/utils/logger.js
index 4a91f71..f6732a8 100644
--- a/public/js/utils/logger.js
+++ b/public/js/utils/logger.js
@@ -2,15 +2,15 @@
* Logger com níveis de debug
* Substitui console.log dispersos pelo código
*/
-const Logger = (function() {
- const LEVELS = {
+var Logger = (function() {
+ var LEVELS = {
debug: 0,
info: 1,
warn: 2,
error: 3
};
- let currentLevel = LEVELS.info;
+ var currentLevel = LEVELS.info;
function setLevel(level) {
if (LEVELS[level] !== undefined) {
@@ -22,26 +22,26 @@ const Logger = (function() {
return LEVELS[level] >= currentLevel;
}
- function formatMessage(level, ...args) {
- const timestamp = new Date().toISOString().slice(11, 19);
- return `[${timestamp}] [${level.toUpperCase()}]`;
+ function formatMessage(level) {
+ var timestamp = new Date().toISOString().slice(11, 19);
+ return '[' + timestamp + '] [' + level.toUpperCase() + ']';
}
return {
- debug: function(...args) {
- if (shouldLog('debug')) console.debug(formatMessage('debug', ...args), ...args);
+ debug: function() {
+ if (shouldLog('debug')) console.debug(formatMessage('debug'), arguments);
},
- info: function(...args) {
- if (shouldLog('info')) console.info(formatMessage('info', ...args), ...args);
+ info: function() {
+ if (shouldLog('info')) console.info(formatMessage('info'), arguments);
},
- warn: function(...args) {
- if (shouldLog('warn')) console.warn(formatMessage('warn', ...args), ...args);
+ warn: function() {
+ if (shouldLog('warn')) console.warn(formatMessage('warn'), arguments);
},
- error: function(...args) {
- if (shouldLog('error')) console.error(formatMessage('error', ...args), ...args);
+ error: function() {
+ if (shouldLog('error')) console.error(formatMessage('error'), arguments);
},
setLevel: setLevel,
@@ -56,5 +56,4 @@ const Logger = (function() {
};
})();
-window.Logger = Logger;
-export default Logger;
\ No newline at end of file
+window.Logger = Logger;
\ No newline at end of file