Actualizar sigworkPro.js
This commit is contained in:
@@ -60,7 +60,7 @@ const createEffect = (fn) => {
|
|||||||
children: new Set(),
|
children: new Set(),
|
||||||
depth: activeEffect ? activeEffect.depth + 1 : 0,
|
depth: activeEffect ? activeEffect.depth + 1 : 0,
|
||||||
disposed: false,
|
disposed: false,
|
||||||
owner: activeEffect // <-- CLAVE: Herencia de contexto
|
owner: activeEffect
|
||||||
};
|
};
|
||||||
effect.execute = () => {
|
effect.execute = () => {
|
||||||
if (effect.disposed) return;
|
if (effect.disposed) return;
|
||||||
@@ -88,7 +88,6 @@ const createEffect = (fn) => {
|
|||||||
|
|
||||||
export const Watch = createEffect;
|
export const Watch = createEffect;
|
||||||
|
|
||||||
// --- CONTEXTO ROBUSTO (6 líneas) ---
|
|
||||||
const getComponentContext = () => {
|
const getComponentContext = () => {
|
||||||
let eff = activeEffect;
|
let eff = activeEffect;
|
||||||
while (eff) {
|
while (eff) {
|
||||||
@@ -110,13 +109,11 @@ export const removeNode = node => {
|
|||||||
}
|
}
|
||||||
if (node._raf) cancelAnimationFrame(node._raf);
|
if (node._raf) cancelAnimationFrame(node._raf);
|
||||||
if (node.componentStop) node.componentStop();
|
if (node.componentStop) node.componentStop();
|
||||||
|
|
||||||
const ctx = node.componentContext;
|
const ctx = node.componentContext;
|
||||||
if (ctx) {
|
if (ctx) {
|
||||||
ctx.unmount.forEach(fn => fn());
|
ctx.unmount.forEach(fn => fn());
|
||||||
ctx.unmount = [];
|
ctx.unmount = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (node.leaveTransition) {
|
if (node.leaveTransition) {
|
||||||
node.leaveTransition(() => node.remove());
|
node.leaveTransition(() => node.remove());
|
||||||
} else {
|
} else {
|
||||||
@@ -312,7 +309,6 @@ export const Tag = (tag, props = {}, ...children) => {
|
|||||||
const ctx = { mount: [], unmount: [], provisions: {} };
|
const ctx = { mount: [], unmount: [], provisions: {} };
|
||||||
let rendered;
|
let rendered;
|
||||||
const stop = Watch(() => {
|
const stop = Watch(() => {
|
||||||
// Asignamos el contexto al efecto actual para que los hijos lo encuentren
|
|
||||||
if (activeEffect) activeEffect.componentContext = ctx;
|
if (activeEffect) activeEffect.componentContext = ctx;
|
||||||
rendered = tag(props, { children, emit: (ev, ...args) => {
|
rendered = tag(props, { children, emit: (ev, ...args) => {
|
||||||
const h = props[`on${ev[0].toUpperCase()}${ev.slice(1)}`];
|
const h = props[`on${ev[0].toUpperCase()}${ev.slice(1)}`];
|
||||||
|
|||||||
Reference in New Issue
Block a user