refactor: consolidate all Node.js development into lib package

- Move scripts/ to lib/scripts/ and convert to ESM modules
- Consolidate dependencies: add live-server to lib/package.json
- Remove root package.json and node_modules split
- Preserve CLI integration via existing rebuild-library.sh
- Add development quickstart guide for new unified workflow
- Clean up outdated file references and duplicate assets
This commit is contained in:
2025-09-04 21:40:45 +02:00
parent 6fef293df3
commit c777fc92dd
18 changed files with 2539 additions and 2769 deletions

View File

@@ -15,7 +15,7 @@ var Insertr = (function () {
// Find all enhanced elements on the page
findEnhancedElements() {
return document.querySelectorAll('[data-insertr-enhanced="true"]');
return document.querySelectorAll('.insertr');
}
// Get element metadata
@@ -608,7 +608,7 @@ var Insertr = (function () {
background-color: rgba(0, 124, 186, 0.05) !important;
}
[data-insertr-enhanced="true"]:hover::after {
.insertr:hover::after {
content: "✏️ " attr(data-content-type);
position: absolute;
top: -25px;
@@ -1142,16 +1142,16 @@ var Insertr = (function () {
}
/* Hide editing interface when not in edit mode */
body:not(.insertr-edit-mode) [data-insertr-enhanced]:hover::after {
body:not(.insertr-edit-mode) .insertr:hover::after {
display: none !important;
}
/* Only show editing features when in edit mode */
.insertr-authenticated.insertr-edit-mode [data-insertr-enhanced] {
.insertr-authenticated.insertr-edit-mode .insertr {
cursor: pointer;
}
.insertr-authenticated.insertr-edit-mode [data-insertr-enhanced]:hover {
.insertr-authenticated.insertr-edit-mode .insertr:hover {
outline: 2px dashed #007cba !important;
outline-offset: 2px !important;
background-color: rgba(0, 124, 186, 0.05) !important;
@@ -1203,25 +1203,25 @@ var Insertr = (function () {
core: null,
editor: null,
auth: null,
// Initialize the library
init(options = {}) {
console.log('🔧 Insertr v1.0.0 initializing... (Hot Reload Ready)');
this.core = new InsertrCore(options);
this.auth = new InsertrAuth(options);
this.editor = new InsertrEditor(this.core, this.auth, options);
// Auto-initialize if DOM is ready
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => this.start());
} else {
this.start();
}
return this;
},
// Start the system - only creates the minimal trigger
start() {
if (this.auth) {
@@ -1236,37 +1236,36 @@ var Insertr = (function () {
this.editor.start();
}
},
// Public API methods
login() {
return this.auth ? this.auth.toggleAuthentication() : null;
},
logout() {
if (this.auth && this.auth.isAuthenticated()) {
this.auth.toggleAuthentication();
}
},
toggleEditMode() {
return this.auth ? this.auth.toggleEditMode() : null;
},
isAuthenticated() {
return this.auth ? this.auth.isAuthenticated() : false;
},
isEditMode() {
return this.auth ? this.auth.isEditMode() : false;
},
// Version info
version: '1.0.0'
// TODO: Version info based on package.json?
};
// Auto-initialize in development mode with proper DOM ready handling
function autoInitialize() {
if (document.querySelector('[data-insertr-enhanced="true"]')) {
if (document.querySelector('.insertr')) {
window.Insertr.init();
}
}