0.0.3: Exotic Type Gymnastics #3

Merged
Astrian merged 40 commits from dev into main 2025-05-22 01:17:51 +00:00
2 changed files with 7 additions and 8 deletions
Showing only changes of commit c2b5300756 - Show all commits

View File

@ -54,7 +54,8 @@ export default (options: ComponentOptions) => {
stateToElementsMap: this._stateToElementsMap, stateToElementsMap: this._stateToElementsMap,
textBindings: this._textBindings, textBindings: this._textBindings,
attributeBindings: this._attributeBindings, attributeBindings: this._attributeBindings,
updateTextNode: (node: Text, value: string) => this._updateTextNode(node, value, value), updateTextNode: (node: Text, value: string) =>
this._updateTextNode(node, value, value),
getNestedState: (keyPath: string) => this._getNestedState(keyPath), getNestedState: (keyPath: string) => this._getNestedState(keyPath),
scheduleUpdate: this._scheduleUpdate.bind(this), scheduleUpdate: this._scheduleUpdate.bind(this),
statesListenersSelf: this._statesListeners, statesListenersSelf: this._statesListeners,
@ -62,7 +63,7 @@ export default (options: ComponentOptions) => {
evaluateIfCondition: this._evaluateIfCondition.bind(this), evaluateIfCondition: this._evaluateIfCondition.bind(this),
}, },
options.states, options.states,
options.statesListeners options.statesListeners,
) )
// initialize shadow dom // initialize shadow dom

View File

@ -1,4 +1,4 @@
import triggerDomUpdates from "./triggerDomUpdates" import triggerDomUpdates from './triggerDomUpdates'
export default function initState( export default function initState(
ops: { ops: {
@ -30,7 +30,7 @@ export default function initState(
statesListenersSelf: Record<string, (...args: unknown[]) => void> statesListenersSelf: Record<string, (...args: unknown[]) => void>
}, },
states?: Record<string, unknown>, states?: Record<string, unknown>,
statesListeners?: { [key: string]: (value: unknown) => void; } | undefined statesListeners?: { [key: string]: (value: unknown) => void } | undefined,
) { ) {
console.log(states) console.log(states)
// copy state from options // copy state from options
@ -82,9 +82,7 @@ export default function initState(
if (ops.currentRenderingElement) { if (ops.currentRenderingElement) {
if (!ops.stateToElementsMap[keyPath]) if (!ops.stateToElementsMap[keyPath])
ops.stateToElementsMap[keyPath] = new Set() ops.stateToElementsMap[keyPath] = new Set()
ops.stateToElementsMap[keyPath].add( ops.stateToElementsMap[keyPath].add(ops.currentRenderingElement)
ops.currentRenderingElement,
)
} }
const valueRoute = keyPath.split('.') const valueRoute = keyPath.split('.')
@ -101,4 +99,4 @@ export default function initState(
}, },
}, },
) )
} }