@toddledev/core
Advanced tools
Comparing version 0.0.2-alpha.13 to 0.0.2-alpha.14
import type { Component, ComponentData } from '../component/component.types'; | ||
import type { CustomFormulaHandler } from '../types'; | ||
import type { CustomFormulaHandler, FormulaLookup } from '../types'; | ||
type ShadowRoot = DocumentFragment; | ||
@@ -75,2 +75,3 @@ export type PathOperation = { | ||
toddle?: { | ||
getFormula: FormulaLookup; | ||
getCustomFormula: CustomFormulaHandler; | ||
@@ -77,0 +78,0 @@ }; |
@@ -53,3 +53,3 @@ "use strict"; | ||
globalThis.toddle)?.getCustomFormula(formula.name, packageName); | ||
const legacyFunc = globalThis.toddle.getFormula(formula.name); | ||
const legacyFunc = (ctx.toddle ?? globalThis.toddle).getFormula(formula.name); | ||
if ((0, util_1.isDefined)(newFunc)) { | ||
@@ -56,0 +56,0 @@ const args = formula.arguments.reduce((args, arg, i) => ({ |
@@ -38,2 +38,3 @@ import { Component, ComponentData } from './component/component.types'; | ||
export type CustomFormulaHandler = (name: string, packageName: string | undefined) => PluginFormula<FormulaHandlerV2> | undefined; | ||
export type FormulaLookup = (name: string) => FormulaHandler | undefined; | ||
export interface Toddle<LocationSignal, ShowSignal> { | ||
@@ -50,3 +51,3 @@ project: string; | ||
getAction: (name: string) => ActionHandler | undefined; | ||
getFormula: (name: string) => FormulaHandler | undefined; | ||
getFormula: FormulaLookup; | ||
getCustomFormula: CustomFormulaHandler; | ||
@@ -53,0 +54,0 @@ getCustomAction: (name: string, packageName: string | undefined) => PluginActionV2 | undefined; |
{ | ||
"name": "@toddledev/core", | ||
"version": "0.0.2-alpha.13", | ||
"version": "0.0.2-alpha.14", | ||
"license": "Apache-2.0", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/toddledev/toddle", |
import type { Component, ComponentData } from '../component/component.types' | ||
import type { CustomFormulaHandler, FormulaHandler, Toddle } from '../types' | ||
import type { | ||
CustomFormulaHandler, | ||
FormulaHandler, | ||
FormulaLookup, | ||
Toddle, | ||
} from '../types' | ||
import { isDefined, toBoolean } from '../utils/util' | ||
@@ -101,3 +106,6 @@ import { isToddleFormula } from './formulaTypes' | ||
package: string | undefined | ||
toddle?: { getCustomFormula: CustomFormulaHandler } | ||
toddle?: { | ||
getFormula: FormulaLookup | ||
getCustomFormula: CustomFormulaHandler | ||
} | ||
env: ToddleEnv | undefined | ||
@@ -188,3 +196,3 @@ } | ||
const legacyFunc: FormulaHandler | undefined = ( | ||
(globalThis as any).toddle as Toddle<unknown, unknown> | ||
ctx.toddle ?? ((globalThis as any).toddle as Toddle<unknown, unknown>) | ||
).getFormula(formula.name) | ||
@@ -191,0 +199,0 @@ if (isDefined(newFunc)) { |
@@ -72,2 +72,4 @@ import { Component, ComponentData } from './component/component.types' | ||
export type FormulaLookup = (name: string) => FormulaHandler | undefined | ||
export interface Toddle<LocationSignal, ShowSignal> { | ||
@@ -88,3 +90,3 @@ project: string | ||
getAction: (name: string) => ActionHandler | undefined | ||
getFormula: (name: string) => FormulaHandler | undefined | ||
getFormula: FormulaLookup | ||
getCustomFormula: CustomFormulaHandler | ||
@@ -91,0 +93,0 @@ getCustomAction: ( |
Sorry, the diff of this file is not supported yet
375125
8556