snice 2.1.3 → 2.1.5
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/index.cjs +19 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.cjs.min.map +1 -1
- package/dist/index.esm.js +19 -21
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +3 -3
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.iife.js +19 -21
- package/dist/index.iife.js.map +1 -1
- package/dist/index.iife.min.js +3 -3
- package/dist/index.iife.min.js.map +1 -1
- package/dist/symbols.esm.js +1 -1
- package/dist/transitions.esm.js +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* snice v2.1.
|
|
2
|
+
* snice v2.1.4
|
|
3
3
|
* Imperative TypeScript framework for building vanilla web components with decorators, routing, and controllers. No virtual DOM, no build complexity.
|
|
4
4
|
* (c) 2024
|
|
5
5
|
* Released under the MIT License.
|
|
@@ -117,7 +117,9 @@ function setupEventHandlers(instance, element) {
|
|
|
117
117
|
instance[CLEANUP] = { events: [], channels: [] };
|
|
118
118
|
}
|
|
119
119
|
for (const handler of handlers) {
|
|
120
|
-
|
|
120
|
+
// Get the current method from the instance (preserves decorator stacking)
|
|
121
|
+
const currentMethod = instance[handler.method.name];
|
|
122
|
+
const originalMethod = currentMethod ? currentMethod.bind(instance) : handler.method.bind(instance);
|
|
121
123
|
const handlerOptions = handler.options || {};
|
|
122
124
|
// Parse event name for key modifiers
|
|
123
125
|
const [baseEventName, keyModifier] = handler.eventName.split(':');
|
|
@@ -1452,14 +1454,6 @@ function applyElementFunctionality(constructor) {
|
|
|
1452
1454
|
}
|
|
1453
1455
|
}
|
|
1454
1456
|
}
|
|
1455
|
-
// NOW call the original user-defined connectedCallback after shadow DOM is set up
|
|
1456
|
-
if (originalConnectedCallback) {
|
|
1457
|
-
originalConnectedCallback.call(this);
|
|
1458
|
-
}
|
|
1459
|
-
const controllerName = this.getAttribute('controller');
|
|
1460
|
-
if (controllerName) {
|
|
1461
|
-
this.controller = controllerName;
|
|
1462
|
-
}
|
|
1463
1457
|
// Setup @on event handlers - use element for host events, shadow root for delegated events
|
|
1464
1458
|
setupEventHandlers(this, this);
|
|
1465
1459
|
// Setup @respond handlers for elements
|
|
@@ -1471,17 +1465,9 @@ function applyElementFunctionality(constructor) {
|
|
|
1471
1465
|
catch (error) {
|
|
1472
1466
|
console.error(`Error setting up observers for ${this.tagName}:`, error);
|
|
1473
1467
|
}
|
|
1474
|
-
//
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
for (const handler of readyHandlers) {
|
|
1478
|
-
try {
|
|
1479
|
-
await handler.method.call(this);
|
|
1480
|
-
}
|
|
1481
|
-
catch (error) {
|
|
1482
|
-
console.error(`Error in @ready handler ${handler.methodName}:`, error);
|
|
1483
|
-
}
|
|
1484
|
-
}
|
|
1468
|
+
// NOW call the original user-defined connectedCallback after shadow DOM is set up
|
|
1469
|
+
if (originalConnectedCallback) {
|
|
1470
|
+
originalConnectedCallback.call(this);
|
|
1485
1471
|
}
|
|
1486
1472
|
}
|
|
1487
1473
|
finally {
|
|
@@ -1491,6 +1477,18 @@ function applyElementFunctionality(constructor) {
|
|
|
1491
1477
|
this[READY_RESOLVE] = null; // Clear the resolver
|
|
1492
1478
|
}
|
|
1493
1479
|
}
|
|
1480
|
+
// Call @ready handlers after everything is set up and ready promise is resolved
|
|
1481
|
+
const readyHandlers = constructor[READY_HANDLERS];
|
|
1482
|
+
if (readyHandlers) {
|
|
1483
|
+
for (const handler of readyHandlers) {
|
|
1484
|
+
try {
|
|
1485
|
+
await handler.method.call(this);
|
|
1486
|
+
}
|
|
1487
|
+
catch (error) {
|
|
1488
|
+
console.error(`Error in @ready handler ${handler.methodName}:`, error);
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1494
1492
|
};
|
|
1495
1493
|
constructor.prototype.disconnectedCallback = async function () {
|
|
1496
1494
|
// Call @dispose handlers
|