@endorphinjs/template-runtime
Advanced tools
Comparing version 0.1.23 to 0.1.24
@@ -1702,3 +1702,3 @@ 'use strict'; | ||
dispose && dispose(scope); | ||
safeCall(dispose, scope); | ||
@@ -2037,3 +2037,3 @@ for (const slotName in slots) { | ||
* @param {Injector} injector | ||
* @param {Object} partial | ||
* @param {PartialDefinition} partial | ||
* @param {Object} args | ||
@@ -2050,3 +2050,2 @@ * @return {PartialBlock} | ||
dispose: null, | ||
childScope: null, | ||
update: null, | ||
@@ -2064,3 +2063,3 @@ partial: null, | ||
* @param {PartialBlock} ctx | ||
* @param {Object} partial | ||
* @param {PartialDefinition} partial | ||
* @param {Object} args | ||
@@ -2070,6 +2069,10 @@ * @returns {number} Returns `1` if partial was updated, `0` otherwise | ||
function updatePartial(ctx, partial, args) { | ||
const { host, injector } = ctx; | ||
const host = partial.host || ctx.host; | ||
const { injector } = ctx; | ||
const prevHost = ctx.host; | ||
const prevScope = getScope(host); | ||
let updated = 0; | ||
ctx.host = host; | ||
if (ctx.partial !== partial) { | ||
@@ -2080,3 +2083,3 @@ // Unmount previously rendered partial | ||
// Mount new partial | ||
const scope = ctx.childScope = assign(obj(ctx.scope), partial.defaults, args); | ||
const scope = ctx.scope = assign(obj(prevScope), partial.defaults, args); | ||
setScope(host, scope); | ||
@@ -2089,3 +2092,3 @@ ctx.update = partial ? run(ctx, partial.body, scope) : null; | ||
// Update rendered partial | ||
const scope = setScope(host, assign(ctx.childScope, args)); | ||
const scope = setScope(host, assign(ctx.scope, args)); | ||
if (run(ctx, ctx.update, scope)) { | ||
@@ -2097,3 +2100,5 @@ updated = 1; | ||
ctx.host = prevHost; | ||
injector.ptr = ctx.end; | ||
return updated; | ||
@@ -2389,2 +2394,3 @@ } | ||
exports.addDisposeCallback = addDisposeCallback; | ||
exports.assign = assign; | ||
exports.mountBlock = mountBlock; | ||
@@ -2391,0 +2397,0 @@ exports.updateBlock = updateBlock; |
@@ -1698,3 +1698,3 @@ /** | ||
dispose && dispose(scope); | ||
safeCall(dispose, scope); | ||
@@ -2033,3 +2033,3 @@ for (const slotName in slots) { | ||
* @param {Injector} injector | ||
* @param {Object} partial | ||
* @param {PartialDefinition} partial | ||
* @param {Object} args | ||
@@ -2046,3 +2046,2 @@ * @return {PartialBlock} | ||
dispose: null, | ||
childScope: null, | ||
update: null, | ||
@@ -2060,3 +2059,3 @@ partial: null, | ||
* @param {PartialBlock} ctx | ||
* @param {Object} partial | ||
* @param {PartialDefinition} partial | ||
* @param {Object} args | ||
@@ -2066,6 +2065,10 @@ * @returns {number} Returns `1` if partial was updated, `0` otherwise | ||
function updatePartial(ctx, partial, args) { | ||
const { host, injector } = ctx; | ||
const host = partial.host || ctx.host; | ||
const { injector } = ctx; | ||
const prevHost = ctx.host; | ||
const prevScope = getScope(host); | ||
let updated = 0; | ||
ctx.host = host; | ||
if (ctx.partial !== partial) { | ||
@@ -2076,3 +2079,3 @@ // Unmount previously rendered partial | ||
// Mount new partial | ||
const scope = ctx.childScope = assign(obj(ctx.scope), partial.defaults, args); | ||
const scope = ctx.scope = assign(obj(prevScope), partial.defaults, args); | ||
setScope(host, scope); | ||
@@ -2085,3 +2088,3 @@ ctx.update = partial ? run(ctx, partial.body, scope) : null; | ||
// Update rendered partial | ||
const scope = setScope(host, assign(ctx.childScope, args)); | ||
const scope = setScope(host, assign(ctx.scope, args)); | ||
if (run(ctx, ctx.update, scope)) { | ||
@@ -2093,3 +2096,5 @@ updated = 1; | ||
ctx.host = prevHost; | ||
injector.ptr = ctx.end; | ||
return updated; | ||
@@ -2381,3 +2386,3 @@ } | ||
export { get, filter, call, addDisposeCallback, mountBlock, updateBlock, unmountBlock, mountIterator, updateIterator, unmountIterator, prepareScope, mountKeyIterator, updateKeyIterator, unmountKeyIterator, createInjector, insert, injectBlock, run, emptyBlockContent, move, disposeBlock, enterScope, exitScope, createScope, setScope, getScope, getProp, getState, getVar, setVar, setAttribute, setAttributeNS, updateAttribute, updateProps, addClass, finalizeAttributes, normalizeClassName, addEvent, addStaticEvent, finalizeEvents, getEventHandler, mountSlot, unmountSlot, updateSlots, markSlotUpdate, setRef, setStaticRef, finalizeRefs, createComponent, mountComponent, updateComponent, unmountComponent, subscribeStore, scheduleRender, renderComponent, mountInnerHTML, updateInnerHTML, unmountInnerHTML, elem, elemNS, elemWithText, elemNSWithText, text, updateText, domInsert, domRemove, mountPartial, updatePartial, unmountPartial, Store, animateIn, animateOut }; | ||
export { get, filter, call, addDisposeCallback, assign, mountBlock, updateBlock, unmountBlock, mountIterator, updateIterator, unmountIterator, prepareScope, mountKeyIterator, updateKeyIterator, unmountKeyIterator, createInjector, insert, injectBlock, run, emptyBlockContent, move, disposeBlock, enterScope, exitScope, createScope, setScope, getScope, getProp, getState, getVar, setVar, setAttribute, setAttributeNS, updateAttribute, updateProps, addClass, finalizeAttributes, normalizeClassName, addEvent, addStaticEvent, finalizeEvents, getEventHandler, mountSlot, unmountSlot, updateSlots, markSlotUpdate, setRef, setStaticRef, finalizeRefs, createComponent, mountComponent, updateComponent, unmountComponent, subscribeStore, scheduleRender, renderComponent, mountInnerHTML, updateInnerHTML, unmountInnerHTML, elem, elemNS, elemWithText, elemNSWithText, text, updateText, domInsert, domRemove, mountPartial, updatePartial, unmountPartial, Store, animateIn, animateOut }; | ||
//# sourceMappingURL=runtime.es.js.map |
{ | ||
"name": "@endorphinjs/template-runtime", | ||
"version": "0.1.23", | ||
"version": "0.1.24", | ||
"description": "EndorphinJS template runtime, embedded with template bundles", | ||
@@ -5,0 +5,0 @@ "main": "./dist/runtime.cjs.js", |
@@ -435,6 +435,11 @@ import { Store } from './lib/store'; | ||
interface PartialBlock extends BaseBlock<PartialBlock> { | ||
childScope: Object; | ||
update: Function | null; | ||
partial: Object | null; | ||
partial: PartialDefinition | null; | ||
} | ||
interface PartialDefinition { | ||
host: Component; | ||
body: Function; | ||
defaults: object; | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
352143
4622