@domyjs/domy 1.0.0
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/README.md +53 -0
- package/assets/domy-358x358.png +0 -0
- package/assets/domy-500x500.png +0 -0
- package/dist/index.d.ts +944 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/package.json +34 -0
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/utils/toKebabCase.ts","../src/utils/logs.ts","../src/utils/isSpecialAttribute.ts","../src/utils/callWithErrorHandling.ts","../src/utils/executeActionAfterAnimation.ts","../src/core/Block.ts","../src/core/DomyEvents.ts","../src/utils/getAndSet.ts","../src/utils/cspEvaluate.ts","../src/utils/evaluate.ts","../../reactive/src/core/data.ts","../../reactive/src/core/trackDeps.ts","../../reactive/src/core/globalWatch.ts","../../reactive/src/core/ReactiveVariable.ts","../../reactive/src/core/isReactive.ts","../../reactive/src/core/isSignal.ts","../../reactive/src/core/matchPath.ts","../../reactive/src/core/unReactive.ts","../../reactive/src/core/reactive.ts","../../reactive/src/core/signal.ts","../../reactive/src/core/watch.ts","../../reactive/src/core/skipReactivity.ts","../../reactive/src/core/watchEffect.ts","../../reactive/src/core/computed.ts","../../reactive/src/core/lockWatchers.ts","../../reactive/src/core/registerName.ts","../../reactive/src/core/unlockWatchers.ts","../src/utils/kebabToCamelCase.ts","../src/utils/domyAttrUtils.ts","../src/utils/getReactiveHandler.ts","../src/utils/handleClass.ts","../src/utils/handleStyle.ts","../src/utils/helpersUtils.ts","../src/utils/getElementVisibilityHandler.ts","../src/utils/getPreviousConditionsElements.ts","../src/utils/mergeToNegativeCondition.ts","../src/utils/getHelpers.ts","../src/utils/getContext.ts","../src/core/scheduler.ts","../src/utils/queuedWatchEffect.ts","../src/utils/directivesUtils.ts","../src/core/DomyHelper.ts","../src/directives/d-name.ts","../src/core/binding.ts","../src/utils/on.ts","../src/core/events.ts","../src/core/renderAttribute.ts","../src/core/renderText.ts","../src/core/getRender.ts","../src/utils/createCallbackRegistrer.ts","../src/helpers/$attrs.ts","../src/helpers/$props.ts","../src/helpers/$childrens.ts","../src/helpers/$config.ts","../src/helpers/$names.ts","../src/helpers/$refs.ts","../src/helpers/$nextTick.ts","../src/core/hooks.ts","../src/core/createHelperToHookRegistrer.ts","../src/core/AppState.ts","../src/core/initApp.ts","../src/core/deepRender.ts","../src/directives/d-else-if.ts","../src/directives/d-for.ts","../src/directives/d-html.ts","../src/directives/d-if.ts","../src/directives/d-ignore.ts","../src/directives/d-model.ts","../src/directives/d-once.ts","../src/directives/d-ref.ts","../src/directives/d-show.ts","../src/directives/d-text.ts","../src/directives/d-transition.ts","../src/helpers/$el.ts","../src/helpers/$root.ts","../src/directives/d-else.ts","../src/directives/d-scope.ts","../src/directives/d-setup.ts","../src/directives/d-teleport.ts","../src/directives/d-mounted.ts","../src/directives/d-unmount.ts","../src/directives/d-attrs.ts","../src/directives/d-key.ts","../src/directives/d-component.ts","../src/directives/d-insert.ts","../src/core/plugin.ts","../src/core/createApp.ts","../src/core/createComponent.ts","../src/index.ts"],"sourcesContent":["/**\r\n * Convert a string to kebab case\r\n * Example:\r\n * console.log(toKebabCase('HelloWorld')); // hello-world\r\n * console.log(toKebabCase('myVariableName')); // my-variable-name\r\n * console.log(toKebabCase('Hello World Today')); // hello-world-today\r\n * @param str\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function toKebabCase(str: string) {\r\n return str\r\n .replace(/([a-z])([A-Z])/g, '$1-$2') // Inserts a dash between lowercase and uppercase letters\r\n .replace(/\\s+/g, '-') // Replaces spaces with dashes\r\n .toLowerCase(); // Converts everything to lowercase\r\n}\r\n","/**\r\n * Warn log function for domy\r\n * @param msg\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function warn(msg: string) {\r\n console.warn('(Domy Warning)', msg);\r\n}\r\n\r\n/**\r\n * Error log function for domy\r\n * @param err\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function error(...errs: (Error | string)[]) {\r\n console.error('(Domy Error)', ...errs);\r\n}\r\n","import { Plugins } from '../core/plugin';\r\n\r\n/**\r\n * Check if the current attribute is a binding attribute\r\n * @param attr\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function isBindAttr(attr: string) {\r\n return attr.startsWith(':') || attr.startsWith('d-bind:');\r\n}\r\n\r\n/**\r\n * Check if the current attribute is an event attribute\r\n * @param attr\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function isEventAttr(attr: string) {\r\n return attr.startsWith('@') || attr.startsWith('d-on:');\r\n}\r\n\r\nexport function isDNameAttr(attr: string) {\r\n return attr.startsWith('#');\r\n}\r\n\r\n/**\r\n * Check if the current attribute is a domy attribute\r\n * It could be a prefix like d-on:click\r\n * Or it could be a simple attribute like d-for\r\n * @param attr\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function isDomyAttr(PLUGINS: Plugins, attr: string) {\r\n const [attrName] = attr.split(/[.:]/gi);\r\n\r\n if (!attrName.startsWith('d-')) return false;\r\n\r\n const attrNameWithoutDPrefix = attrName.slice(2);\r\n\r\n if (attrNameWithoutDPrefix in PLUGINS.directives || attrNameWithoutDPrefix in PLUGINS.prefixes) {\r\n return true;\r\n }\r\n\r\n return false;\r\n}\r\n\r\n/**\r\n * Check if the current attribute is a normal attribute\r\n * @param attr\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function isNormalAttr(PLUGINS: Plugins, attr: string) {\r\n return (\r\n !isBindAttr(attr) && !isDomyAttr(PLUGINS, attr) && !isEventAttr(attr) && !isDNameAttr(attr)\r\n );\r\n}\r\n","/**\r\n * Call a function with error handling\r\n * @param fn\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function callWithErrorHandling<T extends (...args: any[]) => any>(\r\n fn: T,\r\n onError?: (err: any) => void\r\n): { hasError: true; err: any } | { hasError: false; result: ReturnType<T> } {\r\n try {\r\n const result = fn();\r\n return { hasError: false, result };\r\n } catch (err: any) {\r\n if (onError) onError(err);\r\n return { hasError: true, err };\r\n }\r\n}\r\n","/**\r\n * Execute a function after the animation/transition on an element is finish\r\n * @param el\r\n * @param action\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function executeActionAfterAnimation(el: Element, action: () => void) {\r\n const computedStyle = window.getComputedStyle(el);\r\n const hasAnimation = computedStyle.animationName !== 'none';\r\n const hasTransition = computedStyle.transitionDuration !== '0s';\r\n\r\n if (hasAnimation || hasTransition) {\r\n el.addEventListener('animationend', action, { once: true });\r\n el.addEventListener('transitionend', action, { once: true });\r\n } else {\r\n action();\r\n }\r\n\r\n return () => {\r\n el.removeEventListener('animationend', action);\r\n el.removeEventListener('transitionend', action);\r\n action();\r\n };\r\n}\r\n","import { callWithErrorHandling } from '../utils/callWithErrorHandling';\r\nimport { executeActionAfterAnimation } from '../utils/executeActionAfterAnimation';\r\nimport { error } from '../utils/logs';\r\n\r\ntype Transition = {\r\n enterTransition: string;\r\n enterTransitionTo: string;\r\n outTransition: string;\r\n outTransitionTo: string;\r\n init: boolean;\r\n};\r\ntype TransitionType = 'enterTransition' | 'outTransition';\r\n\r\n/**\r\n * Utilitary class to handle properly an element\r\n */\r\nexport class Block {\r\n public name: string | null = null;\r\n public key: string | null = null;\r\n private pluginsData = new Map<string, any>();\r\n\r\n public transition: Transition | null = null;\r\n private cleanupTransition: (() => void) | null = null;\r\n\r\n private cleanups: (() => void)[] = [];\r\n private onElChangeCbList: ((newEl: Element) => void)[] = [];\r\n\r\n public parentBlock: Block | null = null;\r\n\r\n constructor(private element: Element | Block) {}\r\n\r\n getDataForPluginId(pluginId: string) {\r\n return this.pluginsData.get(pluginId);\r\n }\r\n\r\n setDataForPluginId(pluginId: string, data: any) {\r\n this.pluginsData.set(pluginId, data);\r\n }\r\n\r\n cleanTransition() {\r\n if (this.cleanupTransition) this.cleanupTransition();\r\n }\r\n\r\n private callCbForElementChange(newEl: Element) {\r\n for (const cb of this.onElChangeCbList) {\r\n cb(newEl);\r\n }\r\n }\r\n\r\n createNewElementBlock() {\r\n return new Block(this.getEl());\r\n }\r\n\r\n attachListener(\r\n type: string,\r\n listener: EventListenerOrEventListenerObject,\r\n options?: boolean | AddEventListenerOptions\r\n ) {\r\n let backEl = this.getEl();\r\n\r\n backEl.addEventListener(type, listener, options);\r\n\r\n this.onElementChange(newEl => {\r\n backEl.removeEventListener(type, listener, options);\r\n newEl.addEventListener(type, listener, options);\r\n backEl = newEl;\r\n });\r\n }\r\n\r\n onElementChange(cb: (newEl: Element) => void) {\r\n this.onElChangeCbList.push(cb);\r\n }\r\n\r\n setEl(newEl: Element | Block) {\r\n this.element = newEl;\r\n this.callCbForElementChange(this.getEl());\r\n }\r\n\r\n getEl(): Element {\r\n return this.element instanceof Block ? this.element.getEl() : this.element;\r\n }\r\n\r\n applyTransition(transitionType: TransitionType, action?: () => void) {\r\n if (this.cleanupTransition) this.cleanupTransition();\r\n if (!this.transition) return action && action();\r\n\r\n const currentEl = this.getEl();\r\n const transitionName = this.transition[transitionType];\r\n currentEl.classList.add(transitionName);\r\n\r\n requestAnimationFrame(() => {\r\n const transitionNameTo = this.transition![`${transitionType}To`];\r\n currentEl.classList.add(transitionNameTo);\r\n\r\n this.cleanupTransition = executeActionAfterAnimation(currentEl, () => {\r\n currentEl.classList.remove(transitionName);\r\n currentEl.classList.remove(transitionNameTo);\r\n if (action) action();\r\n this.cleanupTransition = null;\r\n });\r\n });\r\n }\r\n\r\n replaceWith(newEl: Element | Block) {\r\n const oldEl = this.getEl();\r\n this.setEl(newEl);\r\n oldEl.replaceWith(this.getEl());\r\n }\r\n\r\n remove() {\r\n const currentEl = this.getEl();\r\n this.applyTransition('outTransition', () => currentEl.remove());\r\n }\r\n\r\n isTemplate() {\r\n return this.getEl().tagName.toLowerCase() === 'template';\r\n }\r\n\r\n isTextNode() {\r\n return this.getEl().nodeType === Node.TEXT_NODE;\r\n }\r\n\r\n addCleanup(cleanup: () => void) {\r\n this.cleanups.push(cleanup);\r\n if (this.parentBlock) this.parentBlock.addCleanup(cleanup);\r\n }\r\n\r\n unmount() {\r\n for (const cleanup of this.cleanups) {\r\n callWithErrorHandling(cleanup, err => error(err));\r\n }\r\n\r\n this.cleanups.length = 0;\r\n\r\n if (this.element instanceof Block) this.element.unmount();\r\n }\r\n}\r\n","export const DOMY_EVENTS = {\r\n Element: {\r\n Mounted: 'domy:element:mounted'\r\n }\r\n};\r\n","function splitPath(path: string): string[] {\r\n return path.replace(/\\[(\\w+)\\]/g, '.$1').split('.');\r\n}\r\n\r\n/**\r\n * Get function (like get in lodash)\r\n * @param object\r\n * @param path\r\n * @param defaultValue\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function get<T = any>(\r\n object: Array<any> | Record<string, any>,\r\n path: string,\r\n defaultValue?: any\r\n): T | undefined {\r\n const keys = splitPath(path);\r\n let result: any = object;\r\n for (const key of keys) {\r\n result = result?.[key];\r\n if (result === undefined) {\r\n return defaultValue;\r\n }\r\n }\r\n return result;\r\n}\r\n\r\n/**\r\n * Set function (like set in lodash)\r\n * @param object\r\n * @param path\r\n * @param value\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function set<T>(object: T, path: string, value: any): T {\r\n const keys = splitPath(path);\r\n let temp: any = object;\r\n for (let i = 0; i < keys.length - 1; i++) {\r\n const key = keys[i];\r\n if (!temp[key] || typeof temp[key] !== 'object') {\r\n temp[key] = /^\\d+$/.test(keys[i + 1]) ? [] : {};\r\n }\r\n temp = temp[key];\r\n }\r\n temp[keys[keys.length - 1]] = value;\r\n return object;\r\n}\r\n","import { EvaluateProps } from './evaluate';\r\nimport { get } from './getAndSet';\r\n\r\n/**\r\n * An evalutor function like evaluate but which support CSP\r\n * @param evaluatorConf\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function cspEvaluate(evaluatorConf: EvaluateProps) {\r\n const pathFn = evaluatorConf.contextAsGlobal\r\n ? evaluatorConf.code\r\n : evaluatorConf.code.replace(/^this\\./g, '');\r\n const isFn = pathFn.endsWith('()');\r\n const path = pathFn.replace(/\\(\\)$/g, '');\r\n\r\n let value = get(evaluatorConf.context, path);\r\n\r\n if (isFn) value = value();\r\n if (evaluatorConf.returnResult) return value;\r\n}\r\n","export type EvaluateProps = {\r\n code: string;\r\n context: any;\r\n\r\n contextAsGlobal?: boolean;\r\n returnResult?: boolean;\r\n};\r\n\r\n/**\r\n * Allow to execute javascript code contained into a string with a context\r\n * @param props\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function evaluate(props: EvaluateProps) {\r\n let code = props.returnResult ? `return (${props.code});` : props.code;\r\n code = props.contextAsGlobal ? `with(this){ ${code} }` : code;\r\n\r\n const executedValue = Function(code).call(props.context);\r\n\r\n return executedValue;\r\n}\r\n","import type { Listener, ReactiveVariable } from './ReactiveVariable';\r\n\r\nexport const reactivesVariablesList = new Map<any, ReactiveVariable>();\r\nexport const globalListenersList = new Set<Listener>();\r\n","import { ReactiveVariable } from './ReactiveVariable';\r\n\r\ntype Dep =\r\n | {\r\n type: 'reactive_variable_creation';\r\n reactiveVariable: ReactiveVariable;\r\n clean: () => void;\r\n }\r\n | {\r\n type: 'watcher' | 'effect' | 'global_watcher';\r\n clean: () => void;\r\n };\r\n\r\nexport let trackCallback: ((dep: Dep) => void) | null = null;\r\n\r\n/**\r\n * Allow us to track inside a function:\r\n * - reactive variable (signal + reactive)\r\n * - watcher\r\n * - effects\r\n * - global watchers\r\n * @param fn\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function trackDeps(fn: () => any): Dep[] {\r\n const deps: Dep[] = [];\r\n\r\n trackCallback = (dep: Dep) => deps.push(dep);\r\n\r\n // we execute the function so track deps\r\n fn();\r\n\r\n trackCallback = null;\r\n\r\n return deps;\r\n}\r\n","import { globalListenersList } from './data';\r\nimport { Listener } from './ReactiveVariable';\r\nimport { trackCallback } from './trackDeps';\r\n\r\n/**\r\n * Remove a global listener\r\n * @param listener\r\n *\r\n * @author yoannchb-pro\r\n */\r\nfunction removeGlobalWatch(listener: Listener) {\r\n if (globalListenersList.has(listener)) globalListenersList.delete(listener);\r\n}\r\n\r\n/**\r\n * Attach a listener to all reactive variables\r\n * @param listener\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function globalWatch(listener: Listener, tracking = true) {\r\n globalListenersList.add(listener);\r\n const clean = () => removeGlobalWatch(listener);\r\n\r\n // Tracking global watch\r\n if (trackCallback && tracking) trackCallback({ type: 'global_watcher', clean });\r\n\r\n return clean;\r\n}\r\n","/* eslint @typescript-eslint/no-this-alias: \"off\" */\r\nexport type Listener = OnGetListener | OnSetListener;\r\nexport type OnGetListener = {\r\n type: 'onGet';\r\n fn: (props: { reactiveVariable: ReactiveVariable; path: string }) => void;\r\n};\r\nexport type OnSetListener = {\r\n type: 'onSet';\r\n fn: (props: {\r\n reactiveVariable: ReactiveVariable;\r\n path: string;\r\n prevValue: any;\r\n newValue: any;\r\n }) => void | Promise<void>;\r\n};\r\n\r\nexport const isProxySymbol = Symbol();\r\nexport const isSignalSymbol = Symbol();\r\nexport const skipReactivitySymbol = Symbol();\r\n\r\n/**\r\n * Allow to create a DeepProxy to listen to any change into an object\r\n * @author yoannchb-pro\r\n */\r\nexport class ReactiveVariable {\r\n public name = '';\r\n private proxy: any = null;\r\n\r\n private onSetListeners = new Set<OnSetListener['fn']>();\r\n private onGetListeners = new Set<OnGetListener['fn']>();\r\n\r\n public static IS_GLOBAL_LOCK = false;\r\n\r\n constructor(private target: any) {}\r\n\r\n public getProxy() {\r\n if (!this.proxy) this.proxy = this.createProxy(this.target);\r\n return this.proxy;\r\n }\r\n\r\n /**\r\n * Check if the current target is already a proxy\r\n * @param target\r\n * @returns\r\n */\r\n public static isReactive(target: any): boolean {\r\n return !!target?.[isProxySymbol];\r\n }\r\n\r\n /**\r\n * Check if the current target is a signal instead of a reactive\r\n * @param target\r\n * @returns\r\n */\r\n public static isSignal(target: any): boolean {\r\n return target?.[isSignalSymbol] && 'value' in target;\r\n }\r\n\r\n /**\r\n * Check we should skip the reactivity on the current element\r\n * @param target\r\n * @returns\r\n */\r\n public static shouldBeSkip(target: any): boolean {\r\n return target?.[skipReactivitySymbol];\r\n }\r\n\r\n public clearListeners() {\r\n this.onGetListeners.clear();\r\n this.onSetListeners.clear();\r\n }\r\n\r\n public attachListener(l: Listener) {\r\n const listeners = l.type === 'onGet' ? this.onGetListeners : this.onSetListeners;\r\n listeners.add(l.fn);\r\n return () => this.removeListener(l);\r\n }\r\n\r\n public removeListener(l: Listener) {\r\n const listeners = l.type === 'onGet' ? this.onGetListeners : this.onSetListeners;\r\n listeners.delete(l.fn);\r\n }\r\n\r\n private canAttachProxy(target: any) {\r\n return (\r\n target !== null &&\r\n typeof target === 'object' &&\r\n !ReactiveVariable.isReactive(target) &&\r\n !ReactiveVariable.shouldBeSkip(target)\r\n );\r\n }\r\n\r\n private isCollection(target: any) {\r\n return (\r\n target instanceof Set ||\r\n target instanceof WeakMap ||\r\n target instanceof WeakSet ||\r\n target instanceof Map\r\n );\r\n }\r\n\r\n private createCollectionHandler(path: string[]) {\r\n const ctx = this;\r\n const collectionHandler: ProxyHandler<any> = {\r\n get(target, property, receiver) {\r\n if (typeof property === 'symbol') {\r\n return Reflect.get(target, property, receiver);\r\n }\r\n\r\n const value = Reflect.get(target, property, receiver);\r\n const fullPath = [...path, property as string];\r\n\r\n if (typeof value === 'function') {\r\n return function (...args: any[]) {\r\n let prevValue, newValue;\r\n\r\n switch (property) {\r\n case 'add':\r\n if (target instanceof Set) {\r\n prevValue = new Set(target);\r\n newValue = new Set(target).add(args[0]);\r\n }\r\n break;\r\n case 'set':\r\n if (target instanceof Map) {\r\n prevValue = new Map(target);\r\n newValue = new Map(target).set(args[0], args[1]);\r\n }\r\n break;\r\n case 'delete':\r\n if (target instanceof Set) {\r\n prevValue = new Set(target);\r\n newValue = new Set(target);\r\n newValue.delete(args[0]);\r\n } else if (target instanceof Map) {\r\n prevValue = new Map(target);\r\n newValue = new Map(target);\r\n newValue.delete(args[0]);\r\n }\r\n break;\r\n case 'clear':\r\n if (target instanceof Set || target instanceof Map) {\r\n prevValue = target instanceof Set ? new Set(target) : new Map(target);\r\n newValue = target instanceof Set ? new Set() : new Map();\r\n }\r\n break;\r\n }\r\n\r\n // If the new value is not a proxy we declare a proxy for it\r\n const isNewObj = ['add', 'set'].includes(property as string);\r\n const obj = args[args.length - 1]; // In case of a set(key, obj) and add(obj)\r\n if (isNewObj && !ReactiveVariable.isReactive(obj)) {\r\n args[args.length - 1] = ctx.createProxy(obj, fullPath);\r\n }\r\n\r\n const result = value.apply(target, args);\r\n\r\n if (['add', 'set', 'delete', 'clear'].includes(property as string)) {\r\n ctx.callOnSetListeners(path, prevValue, newValue);\r\n }\r\n\r\n return result;\r\n };\r\n } else {\r\n ctx.callOnGetListeners(fullPath);\r\n return value;\r\n }\r\n }\r\n };\r\n return collectionHandler;\r\n }\r\n\r\n private createHandler(path: string[]) {\r\n const ctx = this;\r\n\r\n const handler: ProxyHandler<any> = {\r\n get(target, p, receiver) {\r\n if (typeof p === 'symbol') return Reflect.get(target, p, receiver);\r\n\r\n let value = Reflect.get(target, p, receiver);\r\n const fullPath = [...path, p as string];\r\n\r\n // Ensure the needed variable is reactive\r\n if (!ReactiveVariable.isReactive(value)) {\r\n value = ctx.createProxy(value, fullPath);\r\n Reflect.set(target, p, value);\r\n }\r\n\r\n ctx.callOnGetListeners(fullPath);\r\n return value;\r\n },\r\n\r\n set(target, p, newValue, receiver) {\r\n if (typeof p === 'symbol') return Reflect.set(target, p, newValue, receiver);\r\n\r\n const prevValue = Reflect.get(target, p, receiver);\r\n const fullPath = [...path, p as string];\r\n const result = Reflect.set(target, p, newValue, receiver);\r\n\r\n const isSameValue = prevValue === newValue;\r\n if (result && !isSameValue) ctx.callOnSetListeners(fullPath, prevValue, newValue);\r\n\r\n return result;\r\n },\r\n\r\n deleteProperty(target, p) {\r\n if (typeof p === 'symbol') return Reflect.deleteProperty(target, p);\r\n\r\n const prevValue = target[p];\r\n const fullPath = [...path, p as string];\r\n\r\n const result = Reflect.deleteProperty(target, p);\r\n if (result) ctx.callOnSetListeners(fullPath, prevValue, undefined);\r\n\r\n return result;\r\n },\r\n\r\n has(target, p) {\r\n const exists = Reflect.has(target, p);\r\n const fullPath = [...path, p as string];\r\n ctx.callOnGetListeners(fullPath);\r\n return exists;\r\n },\r\n\r\n ownKeys(target) {\r\n const keys = Reflect.ownKeys(target);\r\n ctx.callOnGetListeners([...path]);\r\n return keys;\r\n }\r\n };\r\n return handler;\r\n }\r\n\r\n private createProxy(target: any, path: string[] = []): any {\r\n if (!this.canAttachProxy(target)) return target;\r\n\r\n const isCollection = this.isCollection(target);\r\n\r\n Object.defineProperty(target, isProxySymbol, {\r\n enumerable: false,\r\n writable: true,\r\n value: true,\r\n configurable: true\r\n });\r\n\r\n return new Proxy(\r\n target,\r\n isCollection ? this.createCollectionHandler(path) : this.createHandler(path)\r\n );\r\n }\r\n\r\n private callOnGetListeners(path: string[]) {\r\n if (ReactiveVariable.IS_GLOBAL_LOCK) return;\r\n\r\n const params = {\r\n path: this.name + path.join('.'),\r\n reactiveVariable: this\r\n };\r\n\r\n for (const listener of [...this.onGetListeners]) {\r\n listener(params);\r\n }\r\n }\r\n\r\n private callOnSetListeners(path: string[], prevValue: any, newValue: any) {\r\n if (ReactiveVariable.IS_GLOBAL_LOCK) return;\r\n\r\n const params = {\r\n path: this.name + path.join('.'),\r\n prevValue,\r\n newValue,\r\n reactiveVariable: this\r\n };\r\n\r\n for (const listener of [...this.onSetListeners]) {\r\n listener(params);\r\n }\r\n }\r\n}\r\n","import { ReactiveVariable } from './ReactiveVariable';\r\n\r\n/**\r\n * Will return true if a obj is a signal/reactive\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function isReactive(obj: any) {\r\n return ReactiveVariable.isReactive(obj);\r\n}\r\n","import { ReactiveVariable } from './ReactiveVariable';\r\n\r\n/**\r\n * Will return true if the obj is a signal\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function isSignal(obj: any) {\r\n return ReactiveVariable.isSignal(obj);\r\n}\r\n","type MatchingResult = { isMatching: boolean; params: Record<string, string> };\r\n\r\n/**\r\n * Check if a path match a certain rule\r\n * Example:\r\n * path: todos.0.isComplete\r\n * reg: todos.*.isComplete or todos, todos.* or todos.*.*\r\n * Will give true\r\n * reg: todos.1.isComplete, todos.*.name, todos.*.*.id\r\n * Will give false\r\n * @param reg\r\n * @param path\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function matchPath(reg: string, path: string): MatchingResult {\r\n const defaultRes: MatchingResult = {\r\n isMatching: false,\r\n params: {}\r\n };\r\n\r\n const rules = reg.split('.');\r\n const paths = path.split('.');\r\n\r\n const isArrayLength = paths[paths.length - 1] === 'length';\r\n\r\n const params: Record<string, string> = {};\r\n\r\n for (let i = 0; i < rules.length; ++i) {\r\n if (!path[i]) return defaultRes;\r\n\r\n const isParam = rules[i].match(/\\{\\w+\\}/);\r\n if (rules[i] === '*' || isParam) {\r\n if (isParam) {\r\n const paramName = isParam[0];\r\n params[paramName.substring(1, paramName.length - 1)] = paths[i];\r\n }\r\n continue;\r\n }\r\n\r\n // We handle the case it's an array\r\n // For exemple we want value.0 to match value.length\r\n if (i === paths.length - 1 && isArrayLength && !isNaN(Number(rules[i]))) continue;\r\n\r\n if (paths[i] !== rules[i]) return defaultRes;\r\n }\r\n\r\n return { isMatching: true, params };\r\n}\r\n","import { reactivesVariablesList } from './data';\r\nimport { ReactiveVariable } from './ReactiveVariable';\r\n\r\n/**\r\n * Will delete the reactivity of a data\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function unReactive<T = any>(obj: T): T {\r\n if (!ReactiveVariable.isReactive(obj)) return obj;\r\n\r\n const reactiveInstance = reactivesVariablesList.get(obj);\r\n\r\n if (!reactiveInstance) return obj;\r\n\r\n reactiveInstance.clearListeners();\r\n reactivesVariablesList.delete(obj);\r\n\r\n return obj;\r\n}\r\n","import { globalListenersList, reactivesVariablesList } from './data';\r\nimport { Listener, OnGetListener, OnSetListener, ReactiveVariable } from './ReactiveVariable';\r\nimport { trackCallback } from './trackDeps';\r\nimport { unReactive } from './unReactive';\r\n\r\ntype GetListenerByType<T> = T extends 'onGet' ? OnGetListener : OnSetListener;\r\n\r\n/**\r\n * Transform an object into a reactive object to listen to any change\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function reactive<T>(obj: T): T {\r\n if (ReactiveVariable.isReactive(obj)) return obj;\r\n\r\n const reactiveVariable = new ReactiveVariable(obj);\r\n const proxy = reactiveVariable.getProxy();\r\n reactivesVariablesList.set(proxy, reactiveVariable);\r\n\r\n // We attach the global listener\r\n function createGlobalListener<T extends Listener['type']>(type: T): GetListenerByType<T>['fn'] {\r\n return (props: any) => {\r\n for (const globalListener of globalListenersList) {\r\n if (globalListener.type !== type) continue;\r\n\r\n try {\r\n globalListener.fn(props);\r\n } catch (err) {\r\n console.error(err);\r\n }\r\n }\r\n };\r\n }\r\n\r\n reactiveVariable.attachListener({\r\n type: 'onGet',\r\n fn: createGlobalListener('onGet')\r\n });\r\n reactiveVariable.attachListener({\r\n type: 'onSet',\r\n fn: createGlobalListener('onSet')\r\n });\r\n\r\n // Tracking the reactive creation\r\n if (trackCallback)\r\n trackCallback({\r\n type: 'reactive_variable_creation',\r\n reactiveVariable,\r\n clean: () => unReactive(reactiveVariable)\r\n });\r\n\r\n return proxy;\r\n}\r\n","import { reactive } from './reactive';\r\nimport { isSignalSymbol } from './ReactiveVariable';\r\n\r\n/**\r\n * Transform a primitive into a reactive object to listen to any change\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function signal<T>(obj: T): { value: T } {\r\n const sig = { value: obj };\r\n Object.defineProperty(sig, isSignalSymbol, {\r\n enumerable: false,\r\n writable: false,\r\n value: true,\r\n configurable: true\r\n });\r\n return reactive(sig);\r\n}\r\n","import { reactivesVariablesList } from './data';\r\nimport { globalWatch } from './globalWatch';\r\nimport { isReactive } from './isReactive';\r\nimport { matchPath } from './matchPath';\r\nimport { Listener, ReactiveVariable } from './ReactiveVariable';\r\nimport { trackCallback } from './trackDeps';\r\n\r\n/**\r\n * Attach a listener to some reactives variables\r\n * @param listener\r\n * @param effect\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function watch(listener: Listener, effect: () => any) {\r\n const removeWatcherLists: (() => void)[] = [];\r\n\r\n function registerListener(reactiveVariable: ReactiveVariable, path?: string) {\r\n const overideListener: Listener = {\r\n type: listener.type,\r\n fn: (props: Parameters<Listener['fn']>[0]) => {\r\n if (!path) return listener.fn(props as any);\r\n\r\n const matcher = matchPath(path, props.path);\r\n if (matcher.isMatching) {\r\n listener.fn(props as any);\r\n }\r\n }\r\n };\r\n\r\n const removeWatcher = reactiveVariable.attachListener(overideListener);\r\n removeWatcherLists.push(removeWatcher);\r\n }\r\n\r\n const removeEffect = globalWatch(\r\n {\r\n type: 'onGet',\r\n fn: ({ path, reactiveVariable }) => registerListener(reactiveVariable, path)\r\n },\r\n false\r\n );\r\n\r\n // We listen to deep property call\r\n // Example:\r\n // const todo = reactive({ title: \"Fork Domy On Github\", isCompleted: false })\r\n // watch(..., () => todo.title)\r\n const deps = effect();\r\n\r\n removeEffect();\r\n\r\n // In case we want to watch directly the signal or reactive without passing by the properties\r\n if (Array.isArray(deps) && !isReactive(deps)) {\r\n for (const dep of deps) {\r\n if (isReactive(dep)) {\r\n const reactiveVariable = reactivesVariablesList.get(dep);\r\n if (reactiveVariable) registerListener(reactiveVariable);\r\n }\r\n }\r\n } else if (isReactive(deps)) {\r\n const reactiveVariable = reactivesVariablesList.get(deps);\r\n if (reactiveVariable) registerListener(reactiveVariable);\r\n }\r\n\r\n const clean = () => {\r\n for (const removeWatcher of removeWatcherLists) {\r\n removeWatcher();\r\n }\r\n };\r\n\r\n // Tracking watcher creation\r\n if (trackCallback) trackCallback({ type: 'watcher', clean });\r\n\r\n return clean;\r\n}\r\n","import { skipReactivitySymbol } from './ReactiveVariable';\r\n\r\n/**\r\n * Skip the reactivity on an element we don't wanna listen to in a reactivity variable\r\n * Example:\r\n * const myElement = reactive({ el: skipReactive({ ... }), name: 'div' })\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function skipReactive<T = any>(obj: T): T {\r\n Object.defineProperty(obj, skipReactivitySymbol, {\r\n enumerable: false,\r\n writable: false,\r\n value: true,\r\n configurable: true\r\n });\r\n return obj;\r\n}\r\n","import { globalWatch } from './globalWatch';\r\nimport { matchPath } from './matchPath';\r\nimport { OnSetListener } from './ReactiveVariable';\r\nimport { trackCallback } from './trackDeps';\r\n\r\ntype Effect = () => any;\r\ntype UnEffect = () => void;\r\ntype WatchEffectOptions = {\r\n noSelfUpdate?: boolean; // Avoid the effect to launch the function again\r\n onDepChange?: (uneffect: UnEffect) => void;\r\n};\r\n\r\nlet watchEffectDepth = 0;\r\n\r\n/**\r\n * Act like a watcher but get his dependencies it self by running one time the instance\r\n * Example:\r\n * const todo = reactive({ title: \"Yoann\", isCompleted: false });\r\n * const uneffect = watchEffect(() => console.log(todo.title)); // Will display: \"Yoann\" when initialising\r\n * todo.isCompleted = true; // Don't call the effect\r\n * todo.title = \"Pierre\"; // Will call the effect and display \"Pierre\"\r\n * @param effectFn\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function watchEffect(effect: Effect, opts: WatchEffectOptions = {}): UnEffect {\r\n ++watchEffectDepth;\r\n\r\n const removeListenersSet = new Set<() => void>();\r\n\r\n function clean() {\r\n for (const removeListener of removeListenersSet) {\r\n removeListener();\r\n }\r\n removeListenersSet.clear();\r\n }\r\n\r\n function watchDeps() {\r\n clean(); // We remove the last dependencies to listen to the new ones\r\n\r\n const currentWatchEffectDepth = watchEffectDepth;\r\n const dependencyMap = new Map<any, Set<string>>();\r\n\r\n let listenerAlreadyMatched = false;\r\n const removeGlobalWatch = globalWatch(\r\n {\r\n type: 'onGet',\r\n fn: ({ path, reactiveVariable }) => {\r\n // If the currentwatch effect depth is not the same then it mean we have an effect in an effect\r\n // In this case we don't want to listen to the effect child deps\r\n if (currentWatchEffectDepth !== watchEffectDepth) return;\r\n\r\n const listener: OnSetListener = {\r\n type: 'onSet',\r\n fn: toWatch => {\r\n if (listenerAlreadyMatched) return;\r\n\r\n const matcher = matchPath(toWatch.path, path);\r\n if (matcher.isMatching) {\r\n listenerAlreadyMatched = true;\r\n if (opts.onDepChange) opts.onDepChange(clean);\r\n if (!opts.noSelfUpdate) watchDeps();\r\n }\r\n }\r\n };\r\n\r\n // We check the dep is not already registered\r\n const currentDeps = dependencyMap.get(reactiveVariable) || new Set<string>();\r\n if (currentDeps.has(path)) return;\r\n currentDeps.add(path);\r\n dependencyMap.set(reactiveVariable, currentDeps);\r\n\r\n // We attach the on set listener\r\n // We ensure we register the remove listener before adding it because attach listener car directly call the listener which can call clean\r\n const removeListener = () => reactiveVariable.removeListener(listener);\r\n removeListenersSet.add(removeListener);\r\n reactiveVariable.attachListener(listener);\r\n }\r\n },\r\n false\r\n );\r\n\r\n try {\r\n effect();\r\n --watchEffectDepth;\r\n } finally {\r\n removeGlobalWatch();\r\n }\r\n }\r\n\r\n watchDeps();\r\n\r\n if (trackCallback) trackCallback({ type: 'effect', clean });\r\n\r\n return clean;\r\n}\r\n","const isComputedSymbol = Symbol();\r\n\r\n/**\r\n * Will return a boolean determining if an object is a computed value or not\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function isComputed(obj: any) {\r\n return !!obj?.[isComputedSymbol];\r\n}\r\n\r\n/**\r\n * Create a computed variable based on a signal\r\n * Example:\r\n * const count = signal(1);\r\n * const doubleCount = computed(() => count.value * 2);\r\n * console.log(doubleCount); // 2\r\n * @param getter\r\n * @param setter\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function computed<T extends () => unknown, R extends ReturnType<T>>(\r\n getter: () => R,\r\n setter?: (newValue: R) => void\r\n) {\r\n return {\r\n [isComputedSymbol]: true,\r\n get value(): R {\r\n return getter();\r\n },\r\n set value(newValue: R) {\r\n if (setter) setter(newValue);\r\n else\r\n throw new Error(\r\n 'You are trying to modify the \"value\" property of a computed, but this computed have no setter setuped.'\r\n );\r\n }\r\n };\r\n}\r\n","import { ReactiveVariable } from './ReactiveVariable';\r\n\r\n/**\r\n * Allow us to lock every watcher if we need to do a set/get action on the object without calling the watcher\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function lockWatchers() {\r\n ReactiveVariable.IS_GLOBAL_LOCK = true;\r\n}\r\n","import { reactivesVariablesList } from './data';\r\n\r\n/**\r\n * Register a name for a reactive variable\r\n * It allow us to have a correct path name\r\n * Example of use case:\r\n * cont count = signal(0);\r\n * watch(({ path }) => console.log(path), [count]);\r\n * count.value += 1;\r\n *\r\n * The path is going to be \"value\" instead of \"count.value\" because we don't know the variable name\r\n * So to fixe that we just need to put registerName(\"count\", count) after the variable declaration\r\n * @param name\r\n * @param obj\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function registerName(name: string, obj: any) {\r\n for (const reactiveVariable of reactivesVariablesList.values()) {\r\n if (reactiveVariable.getProxy() === obj) {\r\n reactiveVariable.name = name + '.';\r\n return;\r\n }\r\n }\r\n}\r\n","import { ReactiveVariable } from './ReactiveVariable';\r\n\r\n/**\r\n * Unlock every watchers\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function unlockWatchers() {\r\n ReactiveVariable.IS_GLOBAL_LOCK = false;\r\n}\r\n","/**\r\n * Convert a kebab string into a camelCase string\r\n * Example: show-error -> showError\r\n * @param str\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function kebabToCamelCase(str: string): string {\r\n return str\r\n .toLowerCase()\r\n .split('-')\r\n .map((word, index) => (index === 0 ? word : word.charAt(0).toUpperCase() + word.slice(1)))\r\n .join('');\r\n}\r\n","import { kebabToCamelCase } from './kebabToCamelCase';\r\n\r\n/**\r\n * Fixe an attribute name to avoid setAttribute throwing error\r\n * @param attrName\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function fixeAttrName(attrName: string) {\r\n return attrName\r\n .replace(/^@/, 'd-on:')\r\n .replace(/^:/, 'd-bind:')\r\n .replace(/#(\\S+)/, function (_, name) {\r\n return `d-name=\"${kebabToCamelCase(name)}\"`;\r\n });\r\n}\r\n\r\n/**\r\n * Get the name of a domy attribute/prefix\r\n * It will remove the domy \"d-\" prefix of a string\r\n * Otherwise it retun an empty string\r\n * @param attrName\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getDomyName(str: string) {\r\n return str.startsWith('d-') ? str.slice(2) : '';\r\n}\r\n\r\n/**\r\n * Retrieve some utils informations from a domy attribute\r\n * @param attr\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getDomyAttributeInformations(attr: Attr) {\r\n // Allow us to separate the prefix, the domy attribute name and the modifiers\r\n const [attrNameWithPrefix, ...modifiers] = attr.name.split('.');\r\n let prefix = '';\r\n let attrName = attrNameWithPrefix;\r\n if (attrName.includes(':')) {\r\n [prefix, attrName] = attrName.split(':');\r\n }\r\n\r\n return {\r\n prefix: getDomyName(prefix),\r\n directive: getDomyName(attrName),\r\n modifiers,\r\n attrName: attrName.replace(/^@/, '')\r\n };\r\n}\r\n","import { isComputed, isSignal } from '@domyjs/reactive';\r\n\r\n/**\r\n * Return the get and set method for a reactive variable\r\n * It allow us to keep the proxy and to handle signals\r\n * @param obj\r\n * @param key\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getReactiveHandler(obj: Record<string, any>, key: string): PropertyDescriptor {\r\n return {\r\n enumerable: true,\r\n configurable: true,\r\n get() {\r\n return isSignal(obj[key]) || isComputed(obj[key]) ? obj[key].value : obj[key];\r\n },\r\n set(newValue: any) {\r\n if (isSignal(obj[key]) || isComputed(obj[key])) return (obj[key].value = newValue);\r\n return (obj[key] = newValue);\r\n }\r\n };\r\n}\r\n","/**\r\n * Handle class attribute if it's a string or an object like\r\n * { show: true }\r\n * or\r\n * [\"show\"]\r\n * @param executedValue\r\n * @param defaultClass\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function handleClass(\r\n executedValue: any,\r\n defaultClass: string = ''\r\n): { class: string; cleanedClass: (newDefaultClass: string) => string } {\r\n const classNames = new Set(defaultClass.split(/\\s+/).filter(Boolean));\r\n const added = new Set<string>();\r\n\r\n if (typeof executedValue === 'string') {\r\n executedValue.split(/\\s+/).forEach(cls => {\r\n classNames.add(cls);\r\n added.add(cls);\r\n });\r\n } else if (Array.isArray(executedValue)) {\r\n executedValue.forEach(cls => {\r\n classNames.add(cls);\r\n added.add(cls);\r\n });\r\n } else if (executedValue && typeof executedValue === 'object') {\r\n for (const [cls, shouldAdd] of Object.entries(executedValue)) {\r\n if (shouldAdd) {\r\n classNames.add(cls);\r\n added.add(cls);\r\n }\r\n }\r\n }\r\n\r\n const merged = [...classNames].join(' ');\r\n\r\n function cleanedClass(newDefaultClass: string): string {\r\n return newDefaultClass\r\n .split(/\\s+/)\r\n .filter(cls => cls && !added.has(cls))\r\n .join(' ');\r\n }\r\n\r\n return { class: merged, cleanedClass };\r\n}\r\n","import { toKebabCase } from './toKebabCase';\r\n\r\n/**\r\n * Handle style attribute if it's an object\r\n * { backgroundColor: '#fff', color: 'red' .... }\r\n * @param executedValue\r\n * @param defaultStyle\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function handleStyle(\r\n executedValue: any,\r\n defaultStyle: string = ''\r\n): { style: string; cleanedStyle: (newDefaultStyle: string) => string } {\r\n const addedKeys = new Set<string>();\r\n const styleDict: Record<string, string> = {};\r\n\r\n // Parse defaultStyle\r\n for (const pair of defaultStyle\r\n .split(';')\r\n .map(s => s.trim())\r\n .filter(Boolean)) {\r\n const [key, value] = pair.split(':').map(s => s.trim());\r\n if (key && value) styleDict[key] = value;\r\n }\r\n\r\n // Parse executedValue\r\n if (typeof executedValue === 'string') {\r\n for (const pair of executedValue\r\n .split(';')\r\n .map(s => s.trim())\r\n .filter(Boolean)) {\r\n const [key, value] = pair.split(':').map(s => s.trim());\r\n if (key && value) {\r\n styleDict[key] = value;\r\n addedKeys.add(key);\r\n }\r\n }\r\n } else if (executedValue && typeof executedValue === 'object') {\r\n for (const key in executedValue) {\r\n const kebab = toKebabCase(key);\r\n styleDict[kebab] = executedValue[key];\r\n addedKeys.add(kebab);\r\n }\r\n }\r\n\r\n const style = Object.entries(styleDict)\r\n .map(([k, v]) => `${k}:${v}`)\r\n .join('; ');\r\n\r\n function cleanedStyle(newDefaultStyle: string): string {\r\n const newDict: Record<string, string> = {};\r\n for (const pair of newDefaultStyle\r\n .split(';')\r\n .map(s => s.trim())\r\n .filter(Boolean)) {\r\n const [key, value] = pair.split(':').map(s => s.trim());\r\n if (key && value && !addedKeys.has(key)) {\r\n newDict[key] = value;\r\n }\r\n }\r\n return Object.entries(newDict)\r\n .map(([k, v]) => `${k}:${v}`)\r\n .join('; ');\r\n }\r\n\r\n return { style, cleanedStyle };\r\n}\r\n","import { callWithErrorHandling } from './callWithErrorHandling';\r\nimport { fixeAttrName, getDomyAttributeInformations } from './domyAttrUtils';\r\nimport { executeActionAfterAnimation } from './executeActionAfterAnimation';\r\nimport { get, set } from './getAndSet';\r\nimport { getElementVisibilityHandler } from './getElementVisibilityHandler';\r\nimport { getPreviousConditionsElements } from './getPreviousConditionsElements';\r\nimport { getReactiveHandler } from './getReactiveHandler';\r\nimport { handleClass } from './handleClass';\r\nimport { handleStyle } from './handleStyle';\r\nimport {\r\n isBindAttr,\r\n isDNameAttr,\r\n isDomyAttr,\r\n isEventAttr,\r\n isNormalAttr\r\n} from './isSpecialAttribute';\r\nimport { kebabToCamelCase } from './kebabToCamelCase';\r\nimport { error, warn } from './logs';\r\nimport { mergeToNegativeCondition } from './mergeToNegativeCondition';\r\nimport { toKebabCase } from './toKebabCase';\r\n\r\n// A list of utils we can access in helpers\r\nexport const helpersUtils = {\r\n handleClass,\r\n handleStyle,\r\n callWithErrorHandling,\r\n toKebabCase,\r\n kebabToCamelCase,\r\n getElementVisibilityHandler,\r\n get,\r\n set,\r\n getPreviousConditionsElements,\r\n executeActionAfterAnimation,\r\n getReactiveHandler,\r\n mergeToNegativeCondition,\r\n fixeAttrName,\r\n getDomyAttributeInformations,\r\n isDomyAttr,\r\n isNormalAttr,\r\n isEventAttr,\r\n isBindAttr,\r\n isDNameAttr,\r\n warn,\r\n error\r\n};\r\n","import { Block } from '../core/Block';\r\nimport { DomyDirectiveHelper } from '../types/Domy';\r\n\r\ntype Props = {\r\n shouldBeDisplay: () => boolean;\r\n domy: DomyDirectiveHelper;\r\n};\r\n\r\n/**\r\n * Handle the visibility of an element with the transition\r\n * @param props\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getElementVisibilityHandler(props: Props) {\r\n const domy = props.domy;\r\n const originalEl = domy.block.getEl();\r\n\r\n const tracePositionComment = new Comment('d-if position tracking, do not remove');\r\n originalEl.before(tracePositionComment);\r\n originalEl.remove();\r\n\r\n let lastRender: Block = domy.block;\r\n let isInit = false;\r\n\r\n /**\r\n * Check if an element should be display\r\n * If the element should be display we render it, add it to the dom and add the corresponding transition\r\n * Otherwise we remove it from the dom and add the exit transition\r\n *\r\n * @author yoannchb-pro\r\n */\r\n function handleVisibility() {\r\n const isConnected = !!lastRender.getEl().parentNode;\r\n const shouldBeDisplay = props.shouldBeDisplay();\r\n\r\n if (isConnected && !shouldBeDisplay) {\r\n // Remove the element and unmount it\r\n lastRender.transition = domy.block.transition;\r\n lastRender.remove();\r\n lastRender.unmount();\r\n } else if (!isConnected && shouldBeDisplay) {\r\n const clone = originalEl.cloneNode(true) as Element;\r\n\r\n // Restore the element to his original position\r\n tracePositionComment.after(clone);\r\n\r\n // Render the clone and create a new block\r\n lastRender = domy.deepRender({\r\n element: clone,\r\n scopedNodeData: domy.scopedNodeData\r\n });\r\n\r\n // Replace the current block with the new rendered block\r\n domy.block.setEl(lastRender);\r\n\r\n // Handle enter transition\r\n // Need to be apply after the block know the new element\r\n if (domy.block.transition?.init || isInit) domy.block.applyTransition('enterTransition');\r\n }\r\n\r\n isInit = true;\r\n }\r\n\r\n return {\r\n effect: handleVisibility,\r\n cleanup: () => {\r\n tracePositionComment.remove();\r\n }\r\n };\r\n}\r\n","/**\r\n * Return the list of previous conditions elements before an element\r\n * Useful for d-else and d-else-if directives\r\n * @param element\r\n * @param previousAuthorizedAttrs\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getPreviousConditionsElements(\r\n element: HTMLElement,\r\n previousAuthorizedAttrs: string[]\r\n) {\r\n const previousSibling = element.previousElementSibling;\r\n\r\n if (!previousSibling) return [];\r\n\r\n const allPreviousConditions: Element[] = [previousSibling];\r\n\r\n while (true) {\r\n const currentPreviousSibling =\r\n allPreviousConditions[allPreviousConditions.length - 1].previousElementSibling;\r\n\r\n if (!currentPreviousSibling) {\r\n break;\r\n }\r\n\r\n let isValid = false;\r\n for (const previousAuthorizedAttr of previousAuthorizedAttrs) {\r\n if (currentPreviousSibling.getAttribute(previousAuthorizedAttr)) isValid = true;\r\n }\r\n if (!isValid) break;\r\n\r\n allPreviousConditions.push(currentPreviousSibling as Element);\r\n }\r\n\r\n return allPreviousConditions;\r\n}\r\n","/**\r\n * Allow us to merge conditions for d-else and d-else-if\r\n * @param conditions\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function mergeToNegativeCondition(conditions: string[]) {\r\n return conditions.map(condition => `!(${condition})`).join(' && ');\r\n}\r\n","import * as ReactiveUtils from '@domyjs/reactive';\r\nimport { DomySpecialHelper } from '../types/Domy';\r\nimport { Helpers } from '../types/Helpers';\r\nimport { State } from '../types/State';\r\nimport { helpersUtils } from './helpersUtils';\r\nimport { Config } from '../types/Config';\r\nimport { PluginHelper } from '../core/plugin';\r\n\r\ntype Props = {\r\n domyHelperId?: number;\r\n el?: Element | Text;\r\n state: State;\r\n config: Config;\r\n scopedNodeData: Record<string, any>[];\r\n pluginHelper: PluginHelper;\r\n};\r\n\r\n/**\r\n * Return the initialised helpers with everything it need\r\n * @param el\r\n * @param state\r\n * @param scopedNodeData\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getHelpers(props: Props): Helpers {\r\n const helpers: Record<string, (domy: DomySpecialHelper) => any> = {};\r\n for (const [name, fn] of Object.entries(props.pluginHelper.PLUGINS.helpers)) {\r\n helpers['$' + name] = fn({\r\n ...props,\r\n ...ReactiveUtils,\r\n utils: helpersUtils\r\n });\r\n }\r\n return helpers;\r\n}\r\n","import { Config } from '../types/Config';\r\nimport { State } from '../types/State';\r\nimport { getHelpers } from './getHelpers';\r\nimport { getReactiveHandler } from './getReactiveHandler';\r\nimport { PluginHelper } from '../core/plugin';\r\n\r\ntype Props = {\r\n domyHelperId?: number;\r\n el?: Element | Text;\r\n state: State;\r\n scopedNodeData: Record<string, any>[];\r\n config: Config;\r\n pluginHelper: PluginHelper;\r\n};\r\n\r\n/**\r\n * Return a context with all what domy need to render\r\n * Like variables, methods, helpers ...\r\n * @param el\r\n * @param state\r\n * @param scopedNodeData\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getContext(props: Props) {\r\n const helpers = getHelpers(props);\r\n\r\n const context = {\r\n ...helpers\r\n };\r\n\r\n for (const key in props.state.data) {\r\n Object.defineProperty(context, key, getReactiveHandler(props.state.data, key));\r\n }\r\n\r\n for (const obj of props.scopedNodeData) {\r\n for (const key in obj) {\r\n Object.defineProperty(context, key, getReactiveHandler(obj, key));\r\n }\r\n }\r\n\r\n return context;\r\n}\r\n","import { callWithErrorHandling } from '../utils/callWithErrorHandling';\r\nimport { error } from '../utils/logs';\r\n\r\ntype QueueElement = () => any;\r\n\r\nlet queued = false;\r\nlet queueIndex = 0;\r\nlet queueId = 0;\r\n\r\nconst queue: QueueElement[] = [];\r\nconst resolvedPromise = Promise.resolve();\r\n\r\nconst queueCallbacks: { job: QueueElement; id: number }[] = [];\r\n\r\nconst seen = new Map<number, number>(); // <id, count>\r\nconst MAX_RECURSION = 100;\r\n\r\n/**\r\n * Wait for the queue to be fully empty\r\n * @param job\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function queueJobOnQueueEmpty(job: QueueElement, id: number) {\r\n queueCallbacks.push({ job, id });\r\n}\r\n\r\n/**\r\n * Flush the queue\r\n *\r\n * @author yoannchb-pro\r\n */\r\nfunction flushJobs() {\r\n queued = true;\r\n\r\n for (; queueIndex < queue.length; ++queueIndex) {\r\n const job = queue[queueIndex];\r\n callWithErrorHandling(job, err => error(err));\r\n }\r\n\r\n if (queueIndex < queue.length) {\r\n flushJobs();\r\n } else {\r\n seen.clear();\r\n queueIndex = 0;\r\n queue.length = 0;\r\n queued = false;\r\n\r\n for (const queueCb of queueCallbacks) {\r\n queueJob(queueCb.job, queueCb.id);\r\n }\r\n\r\n queueCallbacks.length = 0;\r\n }\r\n}\r\n\r\n/**\r\n * Scheduler function to add a job to the queue\r\n * @param job\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function queueJob(job: QueueElement, id: number) {\r\n const count = seen.get(id) ?? 1;\r\n\r\n if (count > MAX_RECURSION) {\r\n error(\r\n `A job as been skipped because it look like he is calling it self a bounch of times and exceed the max recursive amount (${MAX_RECURSION}).`\r\n );\r\n return;\r\n }\r\n\r\n seen.set(id, count + 1);\r\n\r\n queue.push(job);\r\n\r\n if (!queued) {\r\n // Use Promise.resolve to defer the execution and regroup DOM updates\r\n resolvedPromise.then(flushJobs);\r\n }\r\n}\r\n\r\n/**\r\n * Return an unique queue id\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getUniqueQueueId() {\r\n return ++queueId;\r\n}\r\n","import { watchEffect } from '@domyjs/reactive';\r\nimport { getUniqueQueueId, queueJob } from '../core/scheduler';\r\n\r\ntype Options = {\r\n dontQueueOnFirstExecution?: boolean;\r\n effectId?: number;\r\n};\r\n\r\n/**\r\n * Allow to queue an effect\r\n * @param effect\r\n * @param opts\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function queuedWatchEffect(effect: () => any, opts: Options = {}) {\r\n let currUnEffect: (() => void) | null = null;\r\n\r\n opts.effectId = opts.effectId ?? getUniqueQueueId();\r\n\r\n function makeEffect() {\r\n currUnEffect = watchEffect(effect, {\r\n // make sure the job is queue again and we listen for dep changes\r\n onDepChange: uneffect => {\r\n uneffect();\r\n queueJob(makeEffect, opts.effectId as number);\r\n },\r\n noSelfUpdate: true\r\n });\r\n }\r\n\r\n if (opts.dontQueueOnFirstExecution) {\r\n makeEffect();\r\n } else queueJob(makeEffect, opts.effectId);\r\n\r\n return () => {\r\n if (currUnEffect) {\r\n currUnEffect();\r\n currUnEffect = null;\r\n }\r\n };\r\n}\r\n","import { getHelpers } from './getHelpers';\r\nimport { helpersUtils } from './helpersUtils';\r\nimport { queuedWatchEffect } from './queuedWatchEffect';\r\n\r\n// A list of utils we can access in directives/prefix\r\nexport const directivesUtils = {\r\n ...helpersUtils,\r\n getHelpers,\r\n queuedWatchEffect\r\n};\r\n","import { cspEvaluate } from '../utils/cspEvaluate';\r\nimport { evaluate } from '../utils/evaluate';\r\nimport { getContext } from '../utils/getContext';\r\nimport * as ReactiveUtils from '@domyjs/reactive';\r\nimport { getUniqueQueueId, queueJob } from './scheduler';\r\nimport { State } from '../types/State';\r\nimport { Config } from '../types/Config';\r\nimport { directivesUtils } from '../utils/directivesUtils';\r\nimport { DomyDirectiveHelper } from '../types/Domy';\r\nimport { createDeepRenderFn } from './deepRender';\r\nimport { getDomyAttributeInformations } from '../utils/domyAttrUtils';\r\nimport type { Block } from './Block';\r\nimport { DOMY_EVENTS } from './DomyEvents';\r\nimport { error } from '../utils/logs';\r\nimport { PluginHelper } from './plugin';\r\nimport { AppStateObserver } from './AppState';\r\n\r\nlet domyHelperId = 0;\r\n\r\n/**\r\n * Domy helper class that handle dependencie change and give everything we need\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport class DomyHelper {\r\n private domyHelperId = ++domyHelperId;\r\n\r\n private isUnmountCalled = false;\r\n\r\n private cleanupFn: (() => void) | null = null;\r\n private clearEffectList: (() => void)[] = [];\r\n\r\n public prefix: string = '';\r\n public directive: string = '';\r\n public attrName: string = ''; // The attribute name without the modifiers and prefix\r\n public attr: { name: string; value: string } = { name: '', value: '' };\r\n public modifiers: string[] = [];\r\n\r\n constructor(\r\n private appId: number,\r\n private deepRenderFn: ReturnType<typeof createDeepRenderFn>,\r\n public block: Block,\r\n public state: State,\r\n public scopedNodeData: Record<string, any>[] = [],\r\n public config: Config,\r\n public renderWithoutListeningToChange: boolean,\r\n public appState: AppStateObserver,\r\n public pluginHelper: PluginHelper\r\n ) {}\r\n\r\n getPluginHelper(): DomyDirectiveHelper {\r\n return {\r\n domyHelperId: this.domyHelperId,\r\n pluginHelper: this.pluginHelper,\r\n appState: this.appState,\r\n block: this.block,\r\n state: this.state,\r\n scopedNodeData: this.scopedNodeData,\r\n config: this.config,\r\n\r\n prefix: this.prefix,\r\n directive: this.directive,\r\n modifiers: this.modifiers,\r\n\r\n attrName: this.attrName,\r\n attr: this.attr,\r\n\r\n ...ReactiveUtils,\r\n utils: directivesUtils,\r\n\r\n queueJob,\r\n getUniqueQueueId,\r\n onElementMounted: this.onElementMounted.bind(this),\r\n onAppMounted: this.onAppMounted.bind(this),\r\n effect: this.effect.bind(this),\r\n cleanup: this.cleanup.bind(this),\r\n evaluate: this.evaluate.bind(this),\r\n deepRender: this.deepRenderFn,\r\n addScopeToNode: this.addScopeToNode.bind(this),\r\n removeScopeToNode: this.removeScopeToNode.bind(this),\r\n getContext\r\n };\r\n }\r\n\r\n copy() {\r\n const copy = new DomyHelper(\r\n this.appId,\r\n this.deepRenderFn,\r\n this.block,\r\n this.state,\r\n [...this.scopedNodeData], // Ensure the scoped node data of the current node are not affected by the next operations (like removing the scoped data in d-for)\r\n this.config,\r\n this.renderWithoutListeningToChange,\r\n this.appState,\r\n this.pluginHelper\r\n );\r\n return copy;\r\n }\r\n\r\n setAttrInfos(attr: Attr) {\r\n const attrInfos = getDomyAttributeInformations(attr);\r\n this.prefix = attrInfos.prefix;\r\n this.directive = attrInfos.directive;\r\n this.modifiers = attrInfos.modifiers;\r\n this.attrName = attrInfos.attrName; // The attribute name without the modifiers and prefix (examples: d-on:click.{enter} -> click)\r\n this.attr.name = attr.name; // the full attribute name\r\n this.attr.value = attr.value;\r\n }\r\n\r\n onElementMounted(cb: () => void) {\r\n if (this.appState.isMounted) cb();\r\n else this.block.attachListener(DOMY_EVENTS.Element.Mounted, cb, { once: true });\r\n }\r\n\r\n onAppMounted(cb: () => void) {\r\n if (this.appState.isMounted) return cb();\r\n\r\n const removeObserver = this.appState.addObserver({\r\n type: 'isMounted',\r\n callback: () => {\r\n if (!this.appState.isMounted) return;\r\n\r\n removeObserver();\r\n cb();\r\n }\r\n });\r\n }\r\n\r\n clearEffects() {\r\n for (const clearEffect of this.clearEffectList) {\r\n clearEffect();\r\n }\r\n this.clearEffectList.length = 0;\r\n }\r\n\r\n effect(fn: () => void) {\r\n // Ensure to not make the effect if the app is unmounted\r\n const fixedFn = () => {\r\n if (!this.isUnmountCalled) directivesUtils.callWithErrorHandling(fn, err => error(err));\r\n };\r\n\r\n if (!this.renderWithoutListeningToChange) {\r\n const uneffect = directivesUtils.queuedWatchEffect(fixedFn, {\r\n dontQueueOnFirstExecution: !this.appState.isMounted\r\n });\r\n this.clearEffectList.push(uneffect);\r\n return uneffect;\r\n } else {\r\n fixedFn();\r\n }\r\n }\r\n\r\n cleanup(cb: () => void) {\r\n this.cleanupFn = cb;\r\n }\r\n\r\n evaluate(code: string, scope?: Record<string, any>) {\r\n const evaluator = this.config.CSP ? cspEvaluate : evaluate;\r\n\r\n const context = getContext({\r\n domyHelperId: this.domyHelperId,\r\n el: this.block.getEl(),\r\n state: this.state,\r\n scopedNodeData: scope ? [...this.scopedNodeData, scope] : this.scopedNodeData,\r\n config: this.config,\r\n pluginHelper: this.pluginHelper\r\n });\r\n\r\n const executedValued = evaluator({\r\n code: code,\r\n contextAsGlobal: !this.config.avoidDeprecatedWith,\r\n context,\r\n returnResult: true\r\n });\r\n\r\n return executedValued;\r\n }\r\n\r\n addScopeToNode(obj: Record<string, any>) {\r\n this.scopedNodeData.push(obj);\r\n }\r\n\r\n removeScopeToNode(obj: Record<string, any>) {\r\n const index = this.scopedNodeData.findIndex(o => o === obj);\r\n if (index !== -1) this.scopedNodeData.splice(index, 1);\r\n }\r\n\r\n getCleanupFn() {\r\n return this.callCleanup.bind(this);\r\n }\r\n\r\n callCleanup() {\r\n const unmountQueueId = getUniqueQueueId();\r\n\r\n // Ensure the jobs already in queue that affect this element don't start\r\n this.isUnmountCalled = true;\r\n\r\n queueJob(() => {\r\n this.clearEffects();\r\n if (typeof this.cleanupFn === 'function') this.cleanupFn();\r\n this.cleanupFn = null;\r\n }, unmountQueueId);\r\n }\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-name implementation\r\n * This attribute allow the component to identify a child\r\n * The component can use the helper $names['MyName'] to retrieve the child\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dNameImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n domy.block.name = domy.attr.value;\r\n}\r\n","import { DomyDirectiveHelper } from '../types/Domy';\r\nimport { handleClass } from '../utils/handleClass';\r\nimport { handleStyle } from '../utils/handleStyle';\r\n\r\n/**\r\n * Handle binding attributes like :class or d-bind:class\r\n * It will catch the value into the attribute\r\n * Example: with isOpen = true\r\n * d-bind:class=\"isOpen ? 'show' : 'hide'\"\r\n * will give\r\n * class=\"show\"\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function binding(domy: DomyDirectiveHelper) {\r\n const el = domy.block.getEl() as HTMLElement;\r\n const attrName = domy.attrName;\r\n const isStyle = attrName === 'style';\r\n const isClass = attrName === 'class';\r\n\r\n // We check the attribute is not already present (only class and style can already be there)\r\n if (!isClass && !isStyle && el.getAttribute(attrName))\r\n throw new Error(`Binding failed. The attribute \"${attrName}\" already exist on the element.`);\r\n\r\n let cleanFn: (() => void) | null = null;\r\n\r\n domy.effect(() => {\r\n // Cleaning last class/style\r\n if (cleanFn) cleanFn();\r\n\r\n const executedValue = domy.evaluate(domy.attr.value);\r\n\r\n if (isStyle) {\r\n const fixedStyle = handleStyle(executedValue, el.style.cssText);\r\n cleanFn = () => el.setAttribute('style', fixedStyle.cleanedStyle(el.style.cssText));\r\n el.setAttribute('style', fixedStyle.style);\r\n } else if (isClass) {\r\n const fixedClass = handleClass(executedValue, el.className);\r\n cleanFn = () => (el.className = fixedClass.cleanedClass(el.className));\r\n el.className = fixedClass.class;\r\n } else el.setAttribute(attrName, executedValue);\r\n });\r\n\r\n domy.cleanup(() => {\r\n if (cleanFn) cleanFn();\r\n else el.removeAttribute(attrName);\r\n });\r\n}\r\n","/**\r\n * Wrap a function\r\n * It allow us to apply many effects to a listener\r\n * @param listener\r\n * @param wrapper\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nfunction wrapListener(\r\n listener: EventListener,\r\n wrapper: (next: EventListener, event: Event) => void\r\n): EventListener {\r\n return (event: Event) => wrapper(listener, event);\r\n}\r\n\r\n/**\r\n * Add some directives to a listener, customise options ...\r\n * @param props\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport default function on(props: {\r\n el: Element;\r\n eventName: string;\r\n modifiers: string[];\r\n listener: EventListener;\r\n options?: AddEventListenerOptions;\r\n}) {\r\n const options: AddEventListenerOptions = props.options ?? {};\r\n\r\n let listener = props.listener;\r\n let listenerTarget = props.el;\r\n\r\n const { el, eventName, modifiers } = props;\r\n\r\n if (modifiers.includes('prevent'))\r\n listener = wrapListener(listener, (next, event) => {\r\n event.preventDefault();\r\n next(event);\r\n });\r\n if (modifiers.includes('stop'))\r\n listener = wrapListener(listener, (next, event) => {\r\n event.stopPropagation();\r\n next(event);\r\n });\r\n if (modifiers.includes('self'))\r\n listener = wrapListener(listener, (next, event) => {\r\n if (event.target === listenerTarget) next(event);\r\n });\r\n\r\n if (modifiers.includes('passive')) options.passive = true;\r\n if (modifiers.includes('capture')) options.capture = true;\r\n if (modifiers.includes('once')) options.once = true;\r\n\r\n // We handle keys\r\n // Example: keydown.{enter}\r\n const keyReg = /^\\{(?<keys>.+?)\\}$/gi;\r\n const keyModifier = modifiers.find(modifier => !!modifier.match(keyReg));\r\n if (keyModifier) {\r\n const keys = keyReg\r\n .exec(keyModifier)!\r\n .groups!.keys.split(',')\r\n .map(key => key.toLocaleLowerCase());\r\n\r\n listener = wrapListener(listener, (next, event) => {\r\n if ('key' in event && keys.find(key => key === (event.key as string).toLowerCase())) {\r\n event.preventDefault(); // Ensure the pressed key is not happened to the input value\r\n next(event);\r\n }\r\n });\r\n }\r\n\r\n if (modifiers.includes('away')) {\r\n listenerTarget = document.body;\r\n listener = wrapListener(listener, (next, event) => {\r\n if (event.target !== el && !el.contains(event.target as Node)) {\r\n next(event);\r\n }\r\n });\r\n }\r\n\r\n return {\r\n listenerTarget,\r\n eventName,\r\n listener,\r\n options\r\n };\r\n}\r\n","import { DomyDirectiveHelper } from '../types/Domy';\r\nimport on from '../utils/on';\r\n\r\n/**\r\n * Handle event applied on an item\r\n * Example:\r\n * d-on:click=\"console.log('hello')\"\r\n * will add an event listener on the click\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function events(domy: DomyDirectiveHelper) {\r\n const queueId = domy.getUniqueQueueId();\r\n const eventName = domy.attrName;\r\n let el = domy.block.getEl();\r\n\r\n let removeEventListener: (() => void) | null = null;\r\n\r\n function setUpEvent() {\r\n const eventListener: EventListenerOrEventListenerObject = async event => {\r\n const scope = {\r\n $event: event\r\n };\r\n\r\n domy.queueJob(() => {\r\n const executedValue = domy.evaluate(domy.attr.value, scope);\r\n if (typeof executedValue === 'function') executedValue(event);\r\n }, queueId);\r\n };\r\n\r\n // We add wrappers to the listener to ensure we can add modifiers\r\n const wrap = on({\r\n el: el,\r\n eventName,\r\n listener: eventListener,\r\n modifiers: domy.modifiers\r\n });\r\n\r\n wrap.listenerTarget.addEventListener(wrap.eventName, wrap.listener, wrap.options);\r\n\r\n removeEventListener = () =>\r\n wrap.listenerTarget.removeEventListener(wrap.eventName, wrap.listener, wrap.options);\r\n }\r\n\r\n setUpEvent();\r\n\r\n const cleanup = () => {\r\n if (removeEventListener) removeEventListener();\r\n };\r\n\r\n domy.block.onElementChange(newEl => {\r\n cleanup();\r\n el = newEl;\r\n setUpEvent();\r\n });\r\n\r\n domy.cleanup(cleanup);\r\n}\r\n","import { dNameImplementation } from '../directives/d-name';\r\nimport { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\nimport { binding } from './binding';\r\nimport { events } from './events';\r\n\r\n/**\r\n * Render a special attribute\r\n * It can be an event, a binding, a domy attribute or a domy prefix\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function renderAttribute(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n const PLUGINS = domy.pluginHelper.PLUGINS;\r\n\r\n // Handle prefix attribute (example: d-on:click)\r\n if (domy.prefix.length > 0) {\r\n const prefixImplementation = PLUGINS.prefixes[domy.prefix];\r\n return prefixImplementation?.(domy);\r\n }\r\n\r\n // Handle binding attribute like :style\r\n if (domy.utils.isBindAttr(domy.attr.name)) {\r\n return binding(domy);\r\n }\r\n\r\n // Handle event attribute like @click\r\n if (domy.utils.isEventAttr(domy.attr.name)) {\r\n return events(domy);\r\n }\r\n\r\n // Handle d-name shortcut like #\r\n if (domy.utils.isDNameAttr(domy.attr.name)) {\r\n domy.attr.value = domy.utils.kebabToCamelCase(domy.attr.name.replace(/^#/, ''));\r\n return dNameImplementation(domy);\r\n }\r\n\r\n // Handle domy attribute like d-for, d-if, ...\r\n // Every attributes starting by \"d-\"\r\n if (domy.utils.isDomyAttr(PLUGINS, domy.attr.name)) {\r\n const directiveImplementation = PLUGINS.directives[domy.directive];\r\n return directiveImplementation?.(domy);\r\n }\r\n}\r\n","import { DomyDirectiveHelper } from '../types/Domy';\r\n\r\n/**\r\n * Render a textContent\r\n * Example with count = 5:\r\n * Count: {{ count }}\r\n * Will give\r\n * Count: 5\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function renderText(domy: DomyDirectiveHelper) {\r\n const originalTextContent = domy.block.getEl().textContent ?? '';\r\n\r\n domy.effect(() => {\r\n domy.block.getEl().textContent = originalTextContent.replace(\r\n /\\{\\{\\s*(?<org>.+?)\\s*\\}\\}/g,\r\n function (_, code) {\r\n return domy.evaluate(code);\r\n }\r\n );\r\n });\r\n}\r\n","import type { createDeepRenderFn } from './deepRender';\r\n\r\n/**\r\n * Get the render function after mounting a DOMY app\r\n * It allow the user to append html element\r\n * Example:\r\n * const p = document.createElement('p');\r\n * p.textContent = 'Count: {{ count }}';\r\n * app.render(p);\r\n * container.appendChild(p);\r\n * @param deepRender\r\n * @param state\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function getRender(deepRender: ReturnType<typeof createDeepRenderFn>) {\r\n return (element: Element) => {\r\n return deepRender({\r\n element,\r\n scopedNodeData: []\r\n });\r\n };\r\n}\r\n","type Callback = () => void | Promise<void>;\r\n\r\n/**\r\n * Allow to create a registrer for callbacks\r\n * Usefull for onMounted, onUnmount ...\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function createCallbackRegistrer<T = Callback>() {\r\n const callbackList: T[] = [];\r\n\r\n return {\r\n fn(cb: T) {\r\n callbackList.push(cb);\r\n },\r\n clear() {\r\n callbackList.length = 0;\r\n },\r\n getCallbacks() {\r\n return [...callbackList];\r\n }\r\n };\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\n/**\r\n * Give the components attributes\r\n * Example:\r\n * const ErrorMessage = DOMY.createComponent(...)\r\n * <Error-Message class=\"red\" :count=\"5\">\r\n * <p>Hello</p>\r\n * </Error-Message>\r\n * Inside Error-Message\r\n * console.log($attrs) // { class: \"red\" }\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $attrs(domy: DomySpecialHelper) {\r\n return domy.state.componentInfos?.componentData.$attrs;\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\n/**\r\n * Give the passed props for a component only\r\n * Example:\r\n * const Count = DOMY.createComponent(...)\r\n * <Count :count=\"5\"></Count>\r\n * Inside Count\r\n * console.log($props.count) // 5\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $props(domy: DomySpecialHelper) {\r\n return domy.state.componentInfos?.componentData.$props;\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\n/**\r\n * Give the passed childrens for a component only\r\n * Example:\r\n * const ErrorMessage = DOMY.createComponent(...)\r\n * <Error-Message :count=\"5\">\r\n * <p>Hello</p>\r\n * </Error-Message>\r\n * Inside Error-Message\r\n * console.log($childrens) // [p]\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $childrens(domy: DomySpecialHelper) {\r\n return domy.state.componentInfos?.childrens;\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\n/**\r\n * Give the current config\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $config(domy: DomySpecialHelper) {\r\n return domy.config;\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\n/**\r\n * Give the registered child with a name to a component\r\n * Example:\r\n * const ErrorMessage = DOMY.createComponent(...)\r\n * <Error-Message :count=\"5\">\r\n * <p d-name='example'>Hello</p>\r\n * </Error-Message>\r\n * Inside Error-Message\r\n * console.log($names['example']) // [p]\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $names(domy: DomySpecialHelper) {\r\n return domy.state.componentInfos?.names;\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\ntype Refs = Record<string, Element>;\r\n\r\n/**\r\n * Get a registered ref element\r\n * Example:\r\n * <p d-ref=\"text\">Hello !</p>\r\n * $refs.text.textContent // Hello !\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $refs(domy: DomySpecialHelper): Refs {\r\n return domy.state.refs;\r\n}\r\n","import { getUniqueQueueId, queueJob } from '../core/scheduler';\r\n\r\n/**\r\n * Wait until domy finished updating dependencies\r\n * Exemple:\r\n * With msg: \"\"\r\n * <p @click=\"() => {\r\n * msg = 'Hello World!';\r\n * console.log($el.textContent); // \"\"\r\n * $nextTick(() => console.log($el.textContent)); // \"Hello World!\"\r\n * }\">{{ msg }}</p>\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $nextTick() {\r\n const queueId = getUniqueQueueId();\r\n\r\n return (cb?: () => void | Promise<void>) => {\r\n return new Promise(resolve => {\r\n queueJob(() => {\r\n if (typeof cb === 'function') cb();\r\n resolve(true);\r\n }, queueId);\r\n });\r\n };\r\n}\r\n","import { createCallbackRegistrer } from '../utils/createCallbackRegistrer';\r\nimport { createHelperToHookRegistrer } from './createHelperToHookRegistrer';\r\nimport { $attrs } from '../helpers/$attrs';\r\nimport { $props } from '../helpers/$props';\r\nimport { $childrens } from '../helpers/$childrens';\r\nimport { $config } from '../helpers/$config';\r\nimport { $names } from '../helpers/$names';\r\nimport { $refs } from '../helpers/$refs';\r\nimport { $nextTick } from '../helpers/$nextTick';\r\nimport { globalWatch, watch } from '@domyjs/reactive';\r\nimport { OnSetListener } from 'packages/reactive/src/core/ReactiveVariable';\r\nimport { getUniqueQueueId, queueJob } from './scheduler';\r\nimport { queuedWatchEffect } from '../utils/queuedWatchEffect';\r\n\r\nexport const helperToHookRegistrer = createHelperToHookRegistrer();\r\n\r\nexport const onSetupedTracker = createCallbackRegistrer();\r\nexport const onMountedTracker = createCallbackRegistrer();\r\nexport const onBeforeUnmountTracker = createCallbackRegistrer();\r\nexport const onUnmountedTracker = createCallbackRegistrer();\r\n\r\nexport const allHooks = {\r\n // Lifecycle\r\n onSetuped: onSetupedTracker.fn,\r\n onMounted: onMountedTracker.fn,\r\n onBeforeUnmount: onBeforeUnmountTracker.fn,\r\n onUnmounted: onUnmountedTracker.fn,\r\n\r\n // Helpers hooks\r\n useAttrs: helperToHookRegistrer.getHook($attrs),\r\n useProps: helperToHookRegistrer.getHook($props),\r\n useChildrens: helperToHookRegistrer.getHook($childrens),\r\n useConfig: helperToHookRegistrer.getHook($config),\r\n useNames: helperToHookRegistrer.getHook($names),\r\n useRefs: helperToHookRegistrer.getHook($refs),\r\n\r\n // Utilities\r\n nextTick: $nextTick(),\r\n watch: (listener: OnSetListener['fn'], effect: () => any) => {\r\n const queueId = getUniqueQueueId();\r\n return watch(\r\n {\r\n type: 'onSet',\r\n fn: props => queueJob(() => listener(props), queueId)\r\n },\r\n effect\r\n );\r\n },\r\n watchEffect: (effect: () => any) => {\r\n const uneffect = queuedWatchEffect(effect);\r\n return uneffect;\r\n },\r\n globalWatch: (listener: OnSetListener['fn']) => {\r\n const queueId = getUniqueQueueId();\r\n return globalWatch({\r\n type: 'onSet',\r\n fn: props => queueJob(() => listener(props), queueId)\r\n });\r\n }\r\n};\r\n","import { DomySpecialHelper } from '../types/Domy';\r\nimport { error } from '../utils/logs';\r\n\r\ntype Fn = (domy: DomySpecialHelper) => any;\r\n\r\n/**\r\n * Convert a helper to a hook by providing everything it need when initialising the app\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function createHelperToHookRegistrer() {\r\n const helpersHooksList = new Set<Fn>();\r\n let domy: DomySpecialHelper | null = null;\r\n\r\n return {\r\n getHook<T extends Fn>(helper: T): () => ReturnType<T> {\r\n helpersHooksList.add(helper);\r\n\r\n return () => {\r\n if (!domy) {\r\n error('A helper hook as been call out of a domy app body.');\r\n return;\r\n }\r\n\r\n return helper(domy);\r\n };\r\n },\r\n provideHookMandatories(domyHelper: DomySpecialHelper) {\r\n domy = domyHelper;\r\n },\r\n clear() {\r\n helpersHooksList.clear();\r\n }\r\n };\r\n}\r\n","import { AppState } from '../types/App';\r\n\r\ntype Observer = { type: keyof AppState; callback: () => void };\r\n\r\n/**\r\n * Register the current lifecycle state of the current app\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport class AppStateObserver {\r\n private observers: Observer[] = [];\r\n\r\n private appState: AppState = {\r\n isSetuped: false,\r\n isMounted: false,\r\n isUnmounted: false\r\n };\r\n\r\n get isMounted() {\r\n return this.appState.isMounted;\r\n }\r\n\r\n get isSetuped() {\r\n return this.appState.isSetuped;\r\n }\r\n\r\n get isUnmounted() {\r\n return this.appState.isUnmounted;\r\n }\r\n\r\n set isMounted(newValue: boolean) {\r\n this.appState.isMounted = newValue;\r\n this.callObservers('isMounted');\r\n }\r\n\r\n set isSetuped(newValue: boolean) {\r\n this.appState.isSetuped = newValue;\r\n this.callObservers('isSetuped');\r\n }\r\n\r\n set isUnmounted(newValue: boolean) {\r\n this.appState.isUnmounted = newValue;\r\n this.callObservers('isUnmounted');\r\n }\r\n\r\n private callObservers(type: keyof AppState) {\r\n const observers = this.observers.filter(ob => ob.type === type);\r\n for (const observer of observers) {\r\n observer.callback();\r\n }\r\n }\r\n\r\n addObserver(observer: Observer) {\r\n this.observers.push(observer);\r\n return () => this.removeObserver(observer);\r\n }\r\n\r\n removeObserver(observer: Observer) {\r\n const index = this.observers.indexOf(observer);\r\n if (index !== 1) this.observers.splice(index, 1);\r\n }\r\n}\r\n","import { Config } from '../types/Config';\r\nimport { State } from '../types/State';\r\nimport { error } from '../utils/logs';\r\nimport { createDeepRenderFn } from './deepRender';\r\nimport { trackDeps } from '@domyjs/reactive';\r\nimport { getRender } from './getRender';\r\nimport { ComponentInfos, Components } from '../types/Component';\r\nimport { App } from '../types/App';\r\nimport { PluginHelper } from './plugin';\r\nimport { callWithErrorHandling } from '../utils/callWithErrorHandling';\r\nimport {\r\n onMountedTracker,\r\n onUnmountedTracker,\r\n onSetupedTracker,\r\n helperToHookRegistrer,\r\n onBeforeUnmountTracker\r\n} from './hooks';\r\nimport { AppStateObserver } from './AppState';\r\nimport * as ReactiveUtils from '@domyjs/reactive';\r\nimport { helpersUtils } from '../utils/helpersUtils';\r\nimport { getUniqueQueueId, queueJob } from './scheduler';\r\n\r\ntype Params = {\r\n appId: number;\r\n app?: App;\r\n target: HTMLElement;\r\n config: Config;\r\n components: Components;\r\n componentInfos?: ComponentInfos;\r\n pluginHelper: PluginHelper;\r\n byPassAttributes?: string[]; // Some attribute have to be handled by an other DOMY instance in some components\r\n};\r\n\r\n/**\r\n * App initialisation\r\n * @param app\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function initApp(params: Params) {\r\n let unmountRender: (() => void) | null = null;\r\n const appState = new AppStateObserver();\r\n const { components, config, target, app, componentInfos } = params;\r\n\r\n // State of the app\r\n const state: State = {\r\n data: {},\r\n componentInfos,\r\n refs: ReactiveUtils.reactive({})\r\n };\r\n\r\n // Initialising hooks\r\n helperToHookRegistrer.provideHookMandatories({\r\n config,\r\n scopedNodeData: [] as Record<string, any>[],\r\n state,\r\n ...ReactiveUtils,\r\n utils: helpersUtils\r\n });\r\n\r\n // Getting app data, methods and deps\r\n let deps: ReturnType<typeof trackDeps> = [];\r\n if (app) deps = trackDeps(() => (state.data = app() ?? {}));\r\n\r\n // Calling onSetuped hooks\r\n appState.isSetuped = true;\r\n const setupedCallbacks = onSetupedTracker.getCallbacks();\r\n onSetupedTracker.clear();\r\n for (const setupedCallback of setupedCallbacks) {\r\n callWithErrorHandling(setupedCallback);\r\n }\r\n\r\n // Render the dom with DOMY\r\n const deepRender = createDeepRenderFn(\r\n params.appId,\r\n appState,\r\n state,\r\n config,\r\n components,\r\n params.pluginHelper\r\n );\r\n try {\r\n const block = deepRender({\r\n element: target,\r\n scopedNodeData: [],\r\n byPassAttributes: params.byPassAttributes\r\n });\r\n unmountRender = block.unmount.bind(block);\r\n } catch (err: any) {\r\n error(err);\r\n }\r\n\r\n // Calling onMounted hooks\r\n appState.isMounted = true;\r\n const mountedCallbacks = onMountedTracker.getCallbacks();\r\n onMountedTracker.clear();\r\n for (const mountedCallback of mountedCallbacks) {\r\n callWithErrorHandling(mountedCallback);\r\n }\r\n\r\n const unmountQueueId = getUniqueQueueId();\r\n // Get the beforeUnmount callbacks\r\n const beforeUnmountCallbacks = onBeforeUnmountTracker.getCallbacks();\r\n onBeforeUnmountTracker.clear();\r\n\r\n // Get the unmounted callbaks\r\n const unmountedCallbacks = onUnmountedTracker.getCallbacks();\r\n onUnmountedTracker.clear();\r\n\r\n return {\r\n render: getRender(deepRender),\r\n unmount() {\r\n // Calling onBeforeUnmount hooks\r\n for (const beforeUnmountCallback of beforeUnmountCallbacks) {\r\n queueJob(beforeUnmountCallback, unmountQueueId);\r\n }\r\n\r\n // We clean the dependencies of the current app/component\r\n for (const dep of deps) {\r\n dep.clean();\r\n }\r\n\r\n // unmount every deep component, ...\r\n if (unmountRender) unmountRender();\r\n\r\n // Calling onUnmount hooks\r\n appState.isUnmounted = true;\r\n for (const unmountedCallback of unmountedCallbacks) {\r\n queueJob(unmountedCallback, unmountQueueId);\r\n }\r\n }\r\n };\r\n}\r\n","import { Components } from '../types/Component';\r\nimport { Config } from '../types/Config';\r\nimport { DomyDirectiveReturn } from '../types/Domy';\r\nimport { State } from '../types/State';\r\nimport { isBindAttr, isNormalAttr } from '../utils/isSpecialAttribute';\r\nimport { AppStateObserver } from './AppState';\r\nimport { Block } from './Block';\r\nimport { DOMY_EVENTS } from './DomyEvents';\r\nimport { DomyHelper } from './DomyHelper';\r\nimport { PluginHelper } from './plugin';\r\nimport { renderAttribute } from './renderAttribute';\r\nimport { renderText } from './renderText';\r\n\r\ntype Elem = {\r\n parentBlock?: Block;\r\n element: Element;\r\n scopedNodeData?: Record<string, any>[];\r\n};\r\n\r\ntype Props = {\r\n element: Element | Block;\r\n scopedNodeData: Record<string, any>[];\r\n byPassAttributes?: string[];\r\n skipChildRendering?: boolean;\r\n renderWithoutListeningToChange?: boolean;\r\n};\r\n\r\n/**\r\n * Deep render an element (with the childs and textContent)\r\n * It will keep the config for all the specified target only\r\n * @param config\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function createDeepRenderFn(\r\n appId: number,\r\n appState: AppStateObserver,\r\n state: State,\r\n config: Config,\r\n components: Components,\r\n pluginHelper: PluginHelper\r\n) {\r\n // Deep render function for a specific block/element\r\n return function deepRender(props: Props) {\r\n const rootBlock = props.element instanceof Block ? props.element : new Block(props.element);\r\n const rootElement = rootBlock.getEl();\r\n\r\n const toRenderList: (Elem | (() => void))[] = [\r\n {\r\n element: rootElement,\r\n scopedNodeData: props.scopedNodeData ?? []\r\n }\r\n ];\r\n\r\n while (toRenderList.length > 0) {\r\n let skipOtherAttributesRendering = false;\r\n let skipChildRendering = props.skipChildRendering ?? false;\r\n let skipComponentRendering = false;\r\n\r\n // We use pop for performance issue and because we render the tree from the bottom to top\r\n // It's usefull in the case of d-if, d-else-if, d-else to find the previous sibling element which are conditions\r\n const toRender = toRenderList.pop()!;\r\n\r\n if (typeof toRender === 'function') {\r\n const action = toRender;\r\n action();\r\n continue;\r\n }\r\n\r\n const element = toRender.element;\r\n const isRootRendering = element === rootElement;\r\n\r\n // Creating the block\r\n const block = isRootRendering ? rootBlock : new Block(element);\r\n if (toRender.parentBlock) block.parentBlock = toRender.parentBlock;\r\n\r\n // If we are to the previous element then the next element is rendered because we go from bottom to top\r\n const lastRenderedElement = element.nextElementSibling;\r\n if (lastRenderedElement) {\r\n lastRenderedElement.dispatchEvent(new CustomEvent(DOMY_EVENTS.Element.Mounted));\r\n } else {\r\n // If the element doesn't have a next sibling then on the next render we want to ensure the mounted event on this element is dispatched\r\n toRenderList.push(() =>\r\n block.getEl().dispatchEvent(new CustomEvent(DOMY_EVENTS.Element.Mounted))\r\n );\r\n }\r\n\r\n const safeDeepRender = (args: Props) => {\r\n const render = deepRender(args);\r\n\r\n const argElement = args.element instanceof Block ? args.element.getEl() : args.element;\r\n const isCurrentElement = argElement === block.getEl();\r\n if (isCurrentElement) {\r\n // If deep render is called on the current element we skip the current rendering to avoid errors\r\n skipChildRendering = true;\r\n skipComponentRendering = true;\r\n skipOtherAttributesRendering = true;\r\n }\r\n\r\n return render;\r\n };\r\n\r\n let domyHelper = new DomyHelper(\r\n appId,\r\n safeDeepRender,\r\n block,\r\n state,\r\n toRender.scopedNodeData,\r\n config,\r\n props.renderWithoutListeningToChange ?? false,\r\n appState,\r\n pluginHelper\r\n );\r\n\r\n // Rendering textContent\r\n if (element.nodeType === Node.TEXT_NODE) {\r\n if (/\\{\\{\\s*(?<org>.+?)\\s*\\}\\}/g.test(element.textContent ?? '')) {\r\n renderText(domyHelper.getPluginHelper());\r\n block.addCleanup(domyHelper.getCleanupFn());\r\n }\r\n\r\n continue;\r\n }\r\n\r\n // Rendering attributes if it's an element\r\n const isComponent = element.localName in components;\r\n const attrs = Array.from(element.attributes ?? []);\r\n\r\n for (const attr of attrs) {\r\n if (!block.getEl().hasAttribute(attr.name)) continue;\r\n\r\n const shouldByPassAttribute =\r\n props.byPassAttributes && props.byPassAttributes.includes(attr.name);\r\n\r\n if (shouldByPassAttribute || isNormalAttr(pluginHelper.PLUGINS, attr.name)) continue;\r\n if (isComponent && (isBindAttr(attr.name) || isNormalAttr(pluginHelper.PLUGINS, attr.name)))\r\n continue; // We only render the directives/events for a component\r\n\r\n // We create a copy of the scopedNodeData because after the attribute is rendered it will remove the scopedNodeData (but we still need it for later)\r\n // We also need a new domy helper because every attribute need his own call effect\r\n domyHelper = domyHelper.copy();\r\n\r\n domyHelper.setAttrInfos(attr);\r\n\r\n // We render the attribute\r\n // It's the main logic of DOMY\r\n element.removeAttribute(attr.name);\r\n const options: DomyDirectiveReturn = renderAttribute(domyHelper.getPluginHelper());\r\n block.addCleanup(domyHelper.getCleanupFn());\r\n\r\n // Handling options returned by the attribute\r\n if (options) {\r\n if (options.skipChildsRendering) skipChildRendering = true;\r\n if (options.skipComponentRendering) skipComponentRendering = true;\r\n if (options.skipOtherAttributesRendering) break;\r\n }\r\n if (skipOtherAttributesRendering) break;\r\n }\r\n\r\n // Rendering component\r\n if (!skipComponentRendering && isComponent) {\r\n const componentSetup = components[element.localName];\r\n componentSetup({\r\n name: element.localName,\r\n componentElement: element as HTMLElement,\r\n domy: domyHelper.getPluginHelper()\r\n });\r\n block.addCleanup(domyHelper.getCleanupFn());\r\n continue;\r\n }\r\n\r\n // Rendering childs\r\n if (skipChildRendering) continue;\r\n for (const child of element.childNodes) {\r\n if ((child as HTMLElement).tagName === 'SCRIPT') continue; // We ensure we never render script\r\n\r\n toRenderList.push({\r\n parentBlock: block,\r\n element: child as Element,\r\n scopedNodeData: domyHelper.scopedNodeData\r\n });\r\n }\r\n }\r\n\r\n return rootBlock;\r\n };\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-else-if implementation\r\n * Like like a } else if(condition) { in javascript\r\n * The element is only rendered when displayed\r\n * It also handle animation\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dElseIfImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n const el = domy.block.getEl() as HTMLElement;\r\n\r\n const allPreviousConditions = domy.utils.getPreviousConditionsElements(el, ['d-if', 'd-else-if']);\r\n\r\n if (allPreviousConditions.length === 0) {\r\n throw new Error(`\"${domy.attrName}\" should be preceded by \"d-if\" or \"d-else-if\" element.`);\r\n }\r\n\r\n const mergedNegativeCondition = domy.utils.mergeToNegativeCondition(\r\n allPreviousConditions.map(\r\n previousCondition =>\r\n previousCondition.getAttribute('d-if') || previousCondition.getAttribute('d-else-if') || ''\r\n )\r\n );\r\n\r\n const visibilityHandler = domy.utils.getElementVisibilityHandler({\r\n shouldBeDisplay: () => domy.evaluate(mergedNegativeCondition) && domy.evaluate(domy.attr.value),\r\n domy\r\n });\r\n\r\n domy.effect(visibilityHandler.effect);\r\n domy.cleanup(visibilityHandler.cleanup);\r\n\r\n return {\r\n skipChildsRendering: true,\r\n skipOtherAttributesRendering: true,\r\n skipComponentRendering: true\r\n };\r\n}\r\n","import { Block } from '../core/Block';\r\nimport { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\ntype LastRender = {\r\n render: Block;\r\n reactiveIndex: { value: number };\r\n loopId: number;\r\n currentKey?: string;\r\n};\r\n\r\nfunction moveToIndexBetweenComments(\r\n element: Element,\r\n index: number,\r\n startComment: Comment,\r\n endComment: Comment\r\n) {\r\n const nodesBetween: Element[] = [];\r\n let current = startComment.nextSibling;\r\n\r\n while (current && current !== endComment) {\r\n if (current.nodeType === Node.ELEMENT_NODE && current !== element) {\r\n nodesBetween.push(current as Element);\r\n }\r\n current = current.nextSibling;\r\n }\r\n\r\n const refNode = nodesBetween[index] || endComment;\r\n\r\n if (element.nextSibling === refNode) {\r\n return;\r\n }\r\n\r\n refNode.before(element);\r\n}\r\n\r\n/**\r\n * d-for implementation\r\n * Allow to render a list of element\r\n * It act like a for in javascript\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dForImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n let currentLoopId = 0;\r\n\r\n const originalEl = domy.block.getEl();\r\n const rawKey = originalEl.getAttribute('d-key');\r\n\r\n const traceStartPositionComment = new Comment('d-for start position tracking, do not remove');\r\n const traceEndPositionComment = new Comment('d-for end position tracking, do not remove');\r\n originalEl.before(traceStartPositionComment);\r\n traceStartPositionComment.after(traceEndPositionComment);\r\n originalEl.remove();\r\n\r\n // Display a warning message if the childrens don't have a d-key attribute\r\n if (!rawKey) {\r\n domy.utils.warn(\r\n `Elements inside the \"${domy.directive}\" directive should be rendered with \"key\" directive.`\r\n );\r\n }\r\n\r\n function cleanupLastRender(lastRender: LastRender) {\r\n domy.unReactive(lastRender.reactiveIndex);\r\n lastRender.render.remove();\r\n lastRender.render.unmount();\r\n }\r\n\r\n // Checking \"for\" pattern\r\n const forRegex = /^(?<dest>\\w+)(?:,\\s*(?<index>\\w+))?\\s+(?<type>in|of)\\s+(?<org>.+)$/i;\r\n const forPattern = forRegex.exec(domy.attr.value);\r\n\r\n if (!forPattern)\r\n throw new Error(`Invalide \"${domy.attr.name}\" attribute value: \"${domy.attr.value}\".`);\r\n\r\n const isForIn = forPattern.groups!.type === 'in';\r\n const lastRenders: LastRender[] = [];\r\n const keyedLastRenders = new Map<string, LastRender>();\r\n\r\n domy.effect(() => {\r\n currentLoopId += 1;\r\n\r\n const executedValue = domy.evaluate(forPattern.groups!.org);\r\n const executedValueObjs = isForIn ? Object.keys(executedValue) : executedValue;\r\n\r\n // Create or swap the elements\r\n const currentElements: { element: Element; index: number }[] = [];\r\n const renderFns: (() => LastRender)[] = [];\r\n let canUseTemplate = true;\r\n for (let index = 0; index < executedValueObjs.length; ++index) {\r\n const value = executedValueObjs[index];\r\n\r\n // Add the value to the scope\r\n let scope = {\r\n [forPattern!.groups!.dest]: value\r\n };\r\n // Add the index to the scope if needed\r\n const indexName = forPattern!.groups?.index;\r\n const reactiveIndex = indexName ? domy.signal(index) : { value: index };\r\n if (indexName) {\r\n scope = {\r\n ...scope,\r\n [indexName]: reactiveIndex\r\n };\r\n }\r\n\r\n let currentKeyValue: string | null = null;\r\n if (rawKey) {\r\n // Check if the key already exist so we can skip render\r\n currentKeyValue = domy.evaluate(rawKey, scope) as string;\r\n const oldRender = keyedLastRenders.get(currentKeyValue);\r\n\r\n if (oldRender) {\r\n canUseTemplate = false;\r\n\r\n const oldRenderEl = oldRender.render.getEl();\r\n const oldRenderIndex = oldRender.reactiveIndex.value;\r\n\r\n // Update the index if needed\r\n if (oldRenderIndex !== index) oldRender.reactiveIndex.value = index;\r\n\r\n currentElements.push({ element: oldRenderEl, index });\r\n oldRender.loopId = currentLoopId;\r\n\r\n continue;\r\n }\r\n }\r\n\r\n // Create and render the new element\r\n const newEl = originalEl.cloneNode(true) as Element;\r\n currentElements.push({ element: newEl, index });\r\n renderFns.push(() => {\r\n const render = domy.deepRender({\r\n element: newEl,\r\n scopedNodeData: [...domy.scopedNodeData, scope]\r\n });\r\n const newRender: LastRender = {\r\n render,\r\n reactiveIndex,\r\n loopId: currentLoopId\r\n };\r\n lastRenders.push(newRender);\r\n if (currentKeyValue) {\r\n newRender.currentKey = currentKeyValue;\r\n keyedLastRenders.set(currentKeyValue, newRender);\r\n }\r\n return newRender;\r\n });\r\n }\r\n\r\n // Remove unecessary elements\r\n for (let i = lastRenders.length - 1; i >= 0; --i) {\r\n const render = lastRenders[i];\r\n if (render.loopId !== currentLoopId) {\r\n if (render.currentKey) keyedLastRenders.delete(render.currentKey);\r\n lastRenders.splice(i, 1);\r\n cleanupLastRender(render);\r\n }\r\n }\r\n\r\n // Move elements to the correct index\r\n if (canUseTemplate) {\r\n const fragment = document.createDocumentFragment();\r\n for (const { element } of currentElements) {\r\n fragment.appendChild(element);\r\n }\r\n traceStartPositionComment.after(fragment);\r\n } else {\r\n for (const { element, index } of currentElements) {\r\n moveToIndexBetweenComments(\r\n element,\r\n index,\r\n traceStartPositionComment,\r\n traceEndPositionComment\r\n );\r\n }\r\n }\r\n\r\n // Render new elements from bottom to top\r\n for (let i = renderFns.length - 1; i >= 0; --i) {\r\n const renderFn = renderFns[i];\r\n renderFn();\r\n }\r\n });\r\n\r\n domy.cleanup(() => {\r\n traceStartPositionComment.remove();\r\n traceEndPositionComment.remove();\r\n for (const render of lastRenders) cleanupLastRender(render);\r\n });\r\n\r\n return {\r\n skipChildsRendering: true,\r\n skipComponentRendering: true,\r\n skipOtherAttributesRendering: true\r\n };\r\n}\r\n","import { DomyDirectiveHelper } from '../types/Domy';\r\n\r\n/**\r\n * d-html implementation\r\n * Allow to dynamically change the innerHTML of an element\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dHtmlImplementation(domy: DomyDirectiveHelper) {\r\n domy.effect(() => {\r\n domy.block.getEl().innerHTML = domy.evaluate(domy.attr.value);\r\n });\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-if implementation\r\n * Like like a if(condition) {} in javascript\r\n * The element is only rendered when displayed\r\n * It also handle animation\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dIfImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n const visibilityHandler = domy.utils.getElementVisibilityHandler({\r\n shouldBeDisplay: () => domy.evaluate(domy.attr.value),\r\n domy\r\n });\r\n\r\n domy.effect(visibilityHandler.effect);\r\n domy.cleanup(visibilityHandler.cleanup);\r\n\r\n return {\r\n skipChildsRendering: true,\r\n skipOtherAttributesRendering: true,\r\n skipComponentRendering: true\r\n };\r\n}\r\n","import { DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-ignore implementation\r\n * Allow to skip the rendering of an element even if it have domies attributes\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dIgnoreImplementation(): DomyDirectiveReturn {\r\n return {\r\n skipChildsRendering: true,\r\n skipOtherAttributesRendering: true,\r\n skipComponentRendering: true\r\n };\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\ntype Value = string | number | boolean | string[] | undefined;\r\n\r\n/**\r\n * Trigger a change to the data when the value of an input change\r\n *\r\n * @author yoannchb-pro\r\n */\r\nfunction changeValue(domy: DomyDirectiveHelper) {\r\n const el = domy.block.getEl() as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\r\n\r\n let value: Value = el.value;\r\n const prevValue = domy.evaluate(domy.attr.value);\r\n const isPrevValueArray = Array.isArray(prevValue);\r\n\r\n if (el.tagName === 'SELECT') {\r\n // Select handling\r\n const select = el as HTMLSelectElement;\r\n const isMultiple = select.multiple;\r\n const selectedOptions = select.selectedOptions;\r\n\r\n if (isMultiple) {\r\n value = [];\r\n for (const selectedOption of selectedOptions) {\r\n value.push(selectedOption.value);\r\n }\r\n } else {\r\n value = selectedOptions[0]?.value ?? '';\r\n }\r\n } else if ((el.type === 'number' || domy.modifiers.includes('number')) && value) {\r\n // Number handling\r\n value = Number(value);\r\n value = isNaN(value) ? 0 : value;\r\n } else if (el.type === 'radio') {\r\n // Radio handling\r\n const radio = el as HTMLInputElement;\r\n if (radio.checked) value = el.value;\r\n } else if (el.type === 'checkbox') {\r\n // Checkbox handling\r\n const checkbox = el as HTMLInputElement;\r\n const isChecked = checkbox.checked;\r\n\r\n if (!isPrevValueArray) {\r\n value = isChecked;\r\n } else {\r\n if (isChecked && !prevValue.includes(value)) {\r\n value = [...prevValue, value];\r\n } else if (!isChecked && prevValue.includes(value)) {\r\n value = prevValue.filter(e => e !== value);\r\n } else {\r\n value = prevValue;\r\n }\r\n }\r\n }\r\n\r\n const config = domy.config;\r\n const isCsp = config.CSP;\r\n const avoidDeprecatedWith = config.avoidDeprecatedWith;\r\n\r\n if (isCsp) {\r\n const objPath = avoidDeprecatedWith ? domy.attr.value.replace(/^this\\./g, '') : domy.attr.value;\r\n const obj = domy.utils.get(domy.state.data, objPath);\r\n if (domy.isSignal(obj)) {\r\n obj.value = value;\r\n } else domy.utils.set(domy.state.data, objPath, value);\r\n } else {\r\n const setter = domy.evaluate(`(__val) => (${domy.attr.value}) = __val`);\r\n setter(value);\r\n }\r\n}\r\n\r\n/**\r\n * d-model implementation\r\n * Handle input, select and checkbox\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dModelImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n // We ensure to render the element/childs first so we can access to their value\r\n // For example select need to know the options value\r\n // So in case the value is a binding we need to ensure domy rendered the childs before handling d-model\r\n domy.onElementMounted(() => {\r\n const el = domy.block.getEl() as HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement;\r\n\r\n // We look at change made by the user\r\n const eventName = domy.modifiers.includes('lazy') ? 'change' : 'input';\r\n const listenChangeCallback = () => changeValue(domy);\r\n el.addEventListener(eventName, listenChangeCallback);\r\n\r\n domy.cleanup(() => {\r\n el.removeEventListener(eventName, listenChangeCallback);\r\n });\r\n\r\n // On a un pb car le effect s'ajoute avant les effects creer par le effect du d-for\r\n domy.effect(() => {\r\n const executedValue = domy.evaluate(domy.attr.value);\r\n const isValueArray = Array.isArray(executedValue);\r\n\r\n if (isValueArray && el.tagName === 'SELECT' && (el as HTMLSelectElement).multiple) {\r\n // Handle multiple select\r\n const options = el.querySelectorAll('option') as NodeListOf<HTMLOptionElement>;\r\n\r\n for (const option of options) {\r\n option.selected = executedValue.includes(option.value);\r\n }\r\n } else if (isValueArray && el.type === 'checkbox') {\r\n // Handling multiple checkbox\r\n const checkbox = el as HTMLInputElement;\r\n checkbox.checked = executedValue.includes(checkbox.value);\r\n } else if (el.type === 'checkbox') {\r\n // Handling checkbox\r\n const checkbox = el as HTMLInputElement;\r\n checkbox.checked = executedValue;\r\n } else if (el.type === 'radio') {\r\n // Handling radio\r\n const radio = el as HTMLInputElement;\r\n radio.checked = radio.value === executedValue;\r\n } else {\r\n // Handling other kind of element\r\n el.value = executedValue;\r\n }\r\n });\r\n });\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-once implementation\r\n * Only execute one time the rendering of an element\r\n * So even if a dependencie change the effect will not be trigger again\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dOnceImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n domy.deepRender({\r\n element: domy.block,\r\n scopedNodeData: domy.scopedNodeData,\r\n renderWithoutListeningToChange: true\r\n });\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-ref implementation\r\n * Reference an element to be use later\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dRefImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n const isDynamic = domy.modifiers.includes('dynamic');\r\n let refName = domy.attr.value;\r\n let isFirstRefInit = true;\r\n\r\n function cleanRef() {\r\n if (!isFirstRefInit) delete domy.state.refs[refName];\r\n }\r\n function setRef() {\r\n if (domy.state.refs[refName])\r\n throw new Error(`A ref with the name \"${refName}\" already exist.`);\r\n updateRef();\r\n }\r\n function updateRef() {\r\n isFirstRefInit = false;\r\n domy.state.refs[refName] = domy.skipReactive(domy.block.getEl());\r\n }\r\n\r\n if (isDynamic) {\r\n domy.effect(() => {\r\n cleanRef();\r\n refName = domy.evaluate(domy.attr.value);\r\n setRef();\r\n });\r\n } else {\r\n setRef();\r\n }\r\n\r\n domy.block.onElementChange(updateRef);\r\n\r\n domy.cleanup(() => {\r\n cleanRef();\r\n });\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-show implementation\r\n * It's like a d-if but the element is fully rendered and we don't remove it from the dom\r\n * We just hide it with a display none and show it back with the correct display\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dShowImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n // We deep render the element first to ensure to get the correct initial style (in particular if the style is binded with :style)\r\n domy.onElementMounted(() => {\r\n // Ensure the code is started after the effects of the previous deepRender\r\n let isInit = false;\r\n const needInitTransition = domy.block.transition?.init;\r\n const originalDisplay = (domy.block.getEl() as HTMLElement).style.display ?? '';\r\n\r\n function visibilityHandler() {\r\n const el = domy.block.getEl() as HTMLElement;\r\n const shouldBeDisplay = domy.evaluate(domy.attr.value);\r\n const isAlreadyShow = el.style.display !== 'none';\r\n\r\n if (shouldBeDisplay && !isAlreadyShow) {\r\n el.style.display = originalDisplay;\r\n\r\n if (needInitTransition || isInit) domy.block.applyTransition('enterTransition');\r\n } else if (isAlreadyShow && !shouldBeDisplay) {\r\n if (needInitTransition || isInit) {\r\n domy.block.applyTransition('outTransition', () => {\r\n el.style.display = 'none';\r\n });\r\n } else {\r\n el.style.display = 'none';\r\n }\r\n }\r\n\r\n isInit = true;\r\n }\r\n\r\n domy.block.onElementChange(() => {\r\n visibilityHandler();\r\n });\r\n\r\n domy.effect(visibilityHandler);\r\n });\r\n}\r\n","import { DomyDirectiveHelper } from '../types/Domy';\r\n\r\n/**\r\n * d-text implementation\r\n * Allow to dynamically change the textContent of an element\r\n * It's really usefull in case we use a templating langage like mustache.js which also use {{ expression }}\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dTextImplementation(domy: DomyDirectiveHelper) {\r\n domy.effect(() => {\r\n domy.block.getEl().textContent = domy.evaluate(domy.attr.value);\r\n });\r\n}\r\n","import { DomyDirectiveHelper } from '../types/Domy';\r\n\r\n/**\r\n * d-transition implementation\r\n * Register a transition name for an element\r\n * It's really usefull when we render it with d-show, d-if, d-else-if, d-else, d-insert\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dTransitionImplementation(domy: DomyDirectiveHelper) {\r\n const isDynamic = domy.modifiers.includes('dynamic');\r\n\r\n const updateTransition = () => {\r\n const transitionName = isDynamic ? domy.evaluate(domy.attr.value) : domy.attr.value;\r\n\r\n // If no transition is provided we remove it\r\n if (!transitionName) {\r\n domy.block.transition = null;\r\n return;\r\n }\r\n\r\n const enterTransition = `${transitionName}-enter`;\r\n const enterTransitionTo = `${enterTransition}-to`;\r\n const outTransition = `${transitionName}-out`;\r\n const outTransitionTo = `${outTransition}-to`;\r\n\r\n domy.block.transition = {\r\n enterTransition,\r\n enterTransitionTo,\r\n outTransition,\r\n outTransitionTo,\r\n init: domy.modifiers.includes('init')\r\n };\r\n };\r\n\r\n if (isDynamic) domy.effect(updateTransition);\r\n else updateTransition();\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\n/**\r\n * Give the current element\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $el(domy: DomySpecialHelper) {\r\n return domy.el?.nodeType === Node.TEXT_NODE ? domy.el.parentNode : domy.el;\r\n}\r\n","import { DomySpecialHelper } from '../types/Domy';\r\n\r\n/**\r\n * Give the current parent of the element\r\n * @param domy\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function $root(domy: DomySpecialHelper) {\r\n return domy.el?.nodeType === Node.TEXT_NODE\r\n ? domy.el?.parentNode?.parentNode\r\n : domy.el?.parentNode;\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-else implementation\r\n * Like like a } else { in javascript\r\n * The element is only rendered when displayed\r\n * It also handle animation\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dElseImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n const el = domy.block.getEl() as HTMLElement;\r\n\r\n const allPreviousConditions = domy.utils.getPreviousConditionsElements(el, ['d-if', 'd-else-if']);\r\n\r\n if (allPreviousConditions.length === 0) {\r\n throw new Error(`\"${domy.attrName}\" should be preceded by \"d-if\" or \"d-else-if\" element.`);\r\n }\r\n\r\n const mergedNegativeCondition = domy.utils.mergeToNegativeCondition(\r\n allPreviousConditions.map(\r\n previousCondition =>\r\n previousCondition.getAttribute('d-if') || previousCondition.getAttribute('d-else-if') || ''\r\n )\r\n );\r\n\r\n const visibilityHandler = domy.utils.getElementVisibilityHandler({\r\n shouldBeDisplay: () => domy.evaluate(mergedNegativeCondition),\r\n domy\r\n });\r\n\r\n domy.effect(visibilityHandler.effect);\r\n domy.cleanup(visibilityHandler.cleanup);\r\n\r\n return {\r\n skipChildsRendering: true,\r\n skipOtherAttributesRendering: true,\r\n skipComponentRendering: true\r\n };\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-scope implementation\r\n * It create a reactive variable only accessible in the scoped node element\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dScopeImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n const data = domy.evaluate(domy.attr.value);\r\n const reactiveData = domy.reactive(data);\r\n\r\n domy.addScopeToNode(reactiveData);\r\n\r\n domy.cleanup(() => {\r\n domy.unReactive(reactiveData);\r\n });\r\n}\r\n","import { DomyDirectiveHelper } from '../types/Domy';\r\n\r\n/**\r\n * d-setup implementation\r\n * Allow to execute some javascript/a function when an element is initialised by domy for the first time\r\n * Example: <div d-setup=\"console.log('My div is rendering')\">...</div>\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dSetupImplementation(domy: DomyDirectiveHelper) {\r\n const executedValue = domy.evaluate(domy.attr.value);\r\n if (typeof executedValue === 'function') executedValue();\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-teleport implementation\r\n * Teleport the template content to a specific location\r\n * Usefull for modal for example which need to be at top of the screen\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dTeleportImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n if (!domy.block.isTemplate())\r\n throw Error(`The directive \"${domy.directive}\" should only be use on template element.`);\r\n\r\n function teleport() {\r\n const el = domy.block.getEl() as HTMLTemplateElement;\r\n\r\n const childs = Array.from(el.content.childNodes);\r\n const target = document.querySelector(domy.attr.value);\r\n\r\n if (!target) throw Error(`Teleport canceled: can't find target \"${domy.attr.value}\".`);\r\n\r\n const unmountFns: (() => void)[] = [];\r\n\r\n // We mount the child after teleoportation to ensure they have correct parent and everything\r\n for (const child of childs) {\r\n target.appendChild(child);\r\n const { unmount } = domy.deepRender({\r\n element: child as Element,\r\n scopedNodeData: domy.scopedNodeData\r\n });\r\n unmountFns.push(unmount);\r\n }\r\n\r\n domy.cleanup(() => {\r\n for (const unmountFn of unmountFns) {\r\n unmountFn();\r\n }\r\n });\r\n\r\n el.remove();\r\n }\r\n\r\n if (domy.modifiers.includes('defer')) domy.onAppMounted(teleport);\r\n else teleport();\r\n\r\n return { skipChildsRendering: true };\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-mounted implementation\r\n * Allow to execute some javascript/a function when an element and his childrens are mounted\r\n * Example:\r\n * <div d-mounted=\"console.log($refs.text.textContent)\">\r\n * <p d-ref=\"text\">...</p>\r\n * </div>\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dMountedImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n domy.onElementMounted(() => {\r\n const executedValue = domy.evaluate(domy.attr.value);\r\n if (typeof executedValue === 'function') executedValue();\r\n });\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-unmount implementation\r\n * Allow to execute some javascript/a function when an element is unmounted\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dUnMountImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n domy.cleanup(() => {\r\n const executedValue = domy.evaluate(domy.attr.value);\r\n if (typeof executedValue === 'function') executedValue();\r\n });\r\n}\r\n","import type { Block } from '../core/Block';\r\nimport { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-attrs implementation\r\n * Allow to dynamically set attrbiutes on an element\r\n * Example: <div d-attrs=\"{ title: 'Hello' }\"></div>\r\n * Will give <div title=\"Hello\"></div>\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dAttrsImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n const needRender = domy.modifiers.includes('render');\r\n\r\n let render: Block | null = null;\r\n let lastAttrs: Record<string, string> = {};\r\n\r\n domy.effect(() => {\r\n const el = render?.getEl() ?? domy.block.getEl();\r\n const attrs: Record<string, string> = domy.evaluate(domy.attr.value);\r\n\r\n if (render) render.unmount();\r\n\r\n // handled the cleanup in by binding.ts\r\n if (!needRender) {\r\n for (const attrName in lastAttrs) {\r\n el.removeAttribute(attrName);\r\n }\r\n }\r\n\r\n for (const attrName in attrs) {\r\n const value = attrs[attrName];\r\n const isObject = typeof value !== 'string';\r\n el.setAttribute(attrName, isObject ? JSON.stringify(value) : value);\r\n }\r\n\r\n // In case we need to render DOMY attributes\r\n if (needRender) {\r\n render = domy.deepRender({\r\n element: el,\r\n scopedNodeData: domy.scopedNodeData,\r\n skipChildRendering: domy.appState.isMounted\r\n });\r\n }\r\n\r\n lastAttrs = { ...attrs };\r\n });\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-key implementation\r\n * Allow to keep track of change into an array\r\n * It have to be combined with d-for\r\n * Example:\r\n * <ul d-for=\"element of array\">\r\n * <li d-key=\"element.id\">...</li>\r\n * </ul>\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dKeyImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n domy.effect(() => {\r\n const key = domy.evaluate(domy.attr.value);\r\n domy.block.key = key;\r\n });\r\n}\r\n","import { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-component implementation\r\n * Render a component based on the name and transfert the attributes to it\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dComponentImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n if (!domy.block.isTemplate())\r\n throw new Error(`The directive \"${domy.directive}\" sould only be use on template element.`);\r\n\r\n const el = domy.block.getEl() as HTMLTemplateElement;\r\n const childs = Array.from(el.content.childNodes);\r\n const attrs = el.attributes;\r\n\r\n // We replace the current element by a d-insert.render\r\n const render = document.createElement('template');\r\n render.setAttribute('d-insert.render', '$createComponent()');\r\n domy.block.replaceWith(render);\r\n\r\n // Because of d-insert.render watch function dependencie we will automtically re-execute this function when domy.attr.value change\r\n function $createComponent() {\r\n const componentName = domy.evaluate(domy.attr.value);\r\n\r\n if (!componentName) return null;\r\n\r\n const componentElement = document.createElement(domy.utils.toKebabCase(componentName));\r\n for (const attr of attrs) {\r\n componentElement.setAttribute(domy.utils.fixeAttrName(attr.name), attr.value);\r\n }\r\n for (const child of childs) {\r\n componentElement.appendChild(child.cloneNode(true));\r\n }\r\n\r\n return componentElement;\r\n }\r\n\r\n // We render d-component as a d-insert.render\r\n domy.deepRender({\r\n element: domy.block,\r\n scopedNodeData: [...domy.scopedNodeData, { $createComponent }]\r\n });\r\n}\r\n","import { Block } from '../core/Block';\r\nimport { DomyDirectiveHelper, DomyDirectiveReturn } from '../types/Domy';\r\n\r\n/**\r\n * d-insert implementation\r\n * Allow to replace the current element by an other element and to render it with a modifier\r\n * Example:\r\n * <div\r\n * d-scope=\"{ count: 0, createP: () => {\r\n * const p = document.createElement('p');\r\n * p.textContent = 'Count: {{ count }}';\r\n * return p;\r\n * } }\"\r\n * >\r\n * <template d-insert.render=\"createP()\"></template>\r\n * </di>\r\n * @param domy\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function dInsertImplementation(domy: DomyDirectiveHelper): DomyDirectiveReturn {\r\n if (!domy.block.isTemplate())\r\n throw new Error(`The directive \"${domy.directive}\" sould only be use on template element.`);\r\n\r\n let isInit = false;\r\n const shouldBeRender = domy.modifiers.includes('render');\r\n const originalEl = domy.block.getEl();\r\n\r\n const tracePositionComment = new Comment('d-insert position tracking, do not remove');\r\n originalEl.before(tracePositionComment);\r\n originalEl.remove();\r\n\r\n const lastRenders: Block[] = [];\r\n\r\n domy.cleanup(() => {\r\n tracePositionComment.remove();\r\n });\r\n\r\n domy.effect(() => {\r\n const elementToRender: Element | null | undefined = domy.evaluate(domy.attr.value.trim());\r\n\r\n if (Array.isArray(elementToRender))\r\n throw new Error(`The directive \"${domy.directive}\" only support one element as parameter.`);\r\n\r\n // Handle remove transition and unmount the last render\r\n if (lastRenders.length > 0) {\r\n // Ensure we have a max of two elements (the one entering and the one leaving) as same time\r\n while (lastRenders.length > 1) lastRenders[0].cleanTransition();\r\n\r\n // We unmount the current lastRender not the current block otherwise this effect will be unmount too\r\n const lastRender = lastRenders[lastRenders.length - 1];\r\n lastRender.transition = domy.block.transition;\r\n lastRender.applyTransition('outTransition', () => {\r\n lastRender.getEl().remove();\r\n const index = lastRenders.indexOf(lastRender);\r\n if (index !== -1) lastRenders.splice(index, 1);\r\n });\r\n lastRender.unmount();\r\n }\r\n\r\n // Handle the case we don't have any element to render\r\n if (!elementToRender) return;\r\n\r\n // We restore the element to his original position\r\n tracePositionComment.after(elementToRender);\r\n\r\n // Render the element\r\n if (shouldBeRender) {\r\n const newRender = domy.deepRender({\r\n element: elementToRender,\r\n scopedNodeData: domy.scopedNodeData\r\n });\r\n\r\n lastRenders.push(newRender);\r\n domy.block.setEl(newRender);\r\n } else {\r\n domy.block.setEl(elementToRender);\r\n const newBlock = domy.block.createNewElementBlock(); // avoid unmounting the template\r\n lastRenders.push(newBlock);\r\n }\r\n\r\n // Handle enter transition\r\n if (isInit || domy.block.transition?.init) {\r\n const lastRender = lastRenders[lastRenders.length - 1];\r\n lastRender.transition = domy.block.transition;\r\n lastRender.applyTransition('enterTransition');\r\n }\r\n\r\n isInit = true;\r\n });\r\n\r\n return {\r\n skipChildsRendering: true,\r\n skipComponentRendering: true,\r\n skipOtherAttributesRendering: true\r\n };\r\n}\r\n","import { dElseIfImplementation } from '../directives/d-else-if';\r\nimport { dForImplementation } from '../directives/d-for';\r\nimport { dHtmlImplementation } from '../directives/d-html';\r\nimport { dIfImplementation } from '../directives/d-if';\r\nimport { dIgnoreImplementation } from '../directives/d-ignore';\r\nimport { dModelImplementation } from '../directives/d-model';\r\nimport { dOnceImplementation } from '../directives/d-once';\r\nimport { dRefImplementation } from '../directives/d-ref';\r\nimport { dShowImplementation } from '../directives/d-show';\r\nimport { dTextImplementation } from '../directives/d-text';\r\nimport { dTransitionImplementation } from '../directives/d-transition';\r\nimport { $el } from '../helpers/$el';\r\nimport { $nextTick } from '../helpers/$nextTick';\r\nimport { $refs } from '../helpers/$refs';\r\nimport { $root } from '../helpers/$root';\r\nimport { error } from '../utils/logs';\r\nimport { dElseImplementation } from '../directives/d-else';\r\nimport { binding } from './binding';\r\nimport { events } from './events';\r\nimport { dScopeImplementation } from '../directives/d-scope';\r\nimport { DomyDirectiveFn, DomyPlugin, DomyPluginDefinition, DomySpecialFn } from '../types/Domy';\r\nimport { dSetupImplementation } from '../directives/d-setup';\r\nimport { $childrens } from '../helpers/$childrens';\r\nimport { $props } from '../helpers/$props';\r\nimport { dTeleportImplementation } from '../directives/d-teleport';\r\nimport { $config } from '../helpers/$config';\r\nimport { dMountedImplementation } from '../directives/d-mounted';\r\nimport { dUnMountImplementation } from '../directives/d-unmount';\r\nimport { dAttrsImplementation } from '../directives/d-attrs';\r\nimport { dKeyImplementation } from '../directives/d-key';\r\nimport { dComponentImplementation } from '../directives/d-component';\r\nimport { $attrs } from '../helpers/$attrs';\r\nimport { dInsertImplementation } from '../directives/d-insert';\r\nimport { dNameImplementation } from '../directives/d-name';\r\nimport { $names } from '../helpers/$names';\r\nimport { callWithErrorHandling } from '../utils/callWithErrorHandling';\r\n\r\nexport type PluginHelper = ReturnType<typeof createPluginRegistrer>;\r\nexport type Plugins = {\r\n prefixes: Record<string, DomyDirectiveFn>;\r\n directives: Record<string, DomyDirectiveFn>;\r\n helpers: Record<string, DomySpecialFn>;\r\n};\r\n\r\n/**\r\n * Allow to make a copy of the default plugin so each app can add their own plugin\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nfunction getDefaultsPlugin() {\r\n const DEFAULT_PLUGINS: Plugins = {\r\n prefixes: {\r\n bind: binding,\r\n on: events\r\n },\r\n directives: {\r\n key: dKeyImplementation,\r\n attrs: dAttrsImplementation,\r\n teleport: dTeleportImplementation,\r\n insert: dInsertImplementation,\r\n mounted: dMountedImplementation,\r\n unmount: dUnMountImplementation,\r\n setup: dSetupImplementation,\r\n scope: dScopeImplementation,\r\n if: dIfImplementation,\r\n 'else-if': dElseIfImplementation,\r\n else: dElseImplementation,\r\n for: dForImplementation,\r\n html: dHtmlImplementation,\r\n text: dTextImplementation,\r\n model: dModelImplementation,\r\n ref: dRefImplementation,\r\n transition: dTransitionImplementation,\r\n ignore: dIgnoreImplementation,\r\n once: dOnceImplementation,\r\n show: dShowImplementation,\r\n component: dComponentImplementation,\r\n name: dNameImplementation\r\n },\r\n helpers: {\r\n el: $el,\r\n refs: $refs,\r\n root: $root,\r\n nextTick: $nextTick,\r\n childrens: $childrens,\r\n props: $props,\r\n config: $config,\r\n attrs: $attrs,\r\n names: $names\r\n }\r\n };\r\n return DEFAULT_PLUGINS;\r\n}\r\n\r\n/**\r\n * Allow to register plugin for the current instance\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function createPluginRegistrer() {\r\n const PLUGINS: Plugins = getDefaultsPlugin();\r\n\r\n const pluginDefinition: DomyPluginDefinition = {\r\n prefix(name, fn) {\r\n if (name in PLUGINS.prefixes) {\r\n throw new Error(`A prefix with the name \"${name}\" already exist.`);\r\n }\r\n PLUGINS.prefixes[name] = fn;\r\n },\r\n directive(name, fn) {\r\n if (name in PLUGINS.directives) {\r\n throw new Error(`A directive with the name \"${name}\" already exist.`);\r\n }\r\n PLUGINS.directives[name] = fn;\r\n },\r\n helper(name, fn) {\r\n if (name in PLUGINS.helpers) {\r\n throw new Error(`A special with the name \"${name}\" already exist.`);\r\n }\r\n PLUGINS.helpers[name] = fn;\r\n }\r\n };\r\n\r\n /**\r\n * Allow the user to register a custom directive or special\r\n * @param plugin\r\n *\r\n * @author yoannchb-pro\r\n */\r\n function plugin(pluginMaker: DomyPlugin) {\r\n callWithErrorHandling(\r\n () => pluginMaker(pluginDefinition),\r\n err => error(err)\r\n );\r\n }\r\n\r\n return {\r\n PLUGINS,\r\n plugin\r\n };\r\n}\r\n","import { App } from '../types/App';\r\nimport { Components, ComponentInfos } from '../types/Component';\r\nimport { Config } from '../types/Config';\r\nimport { DomyPlugin } from '../types/Domy';\r\nimport { toKebabCase } from '../utils/toKebabCase';\r\nimport { getRender } from './getRender';\r\nimport { initApp } from './initApp';\r\nimport { createPluginRegistrer } from './plugin';\r\n\r\nlet appId = 0;\r\n\r\n/**\r\n * Initialise domy on a target (by default the body)\r\n * @param appDefinition\r\n * @param target\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function createAdvancedApp(\r\n appDefinition?: App,\r\n componentInfos?: ComponentInfos,\r\n byPassAttributes?: string[]\r\n) {\r\n ++appId;\r\n\r\n const pluginHelper = componentInfos?.parentPluginHelper ?? createPluginRegistrer();\r\n\r\n let config: Config = {};\r\n let componentsList: Components = {};\r\n\r\n function mount(target?: HTMLElement): {\r\n render: ReturnType<typeof getRender>;\r\n unmount: () => void;\r\n } {\r\n const build = () => {\r\n const domTarget = target ?? document.body;\r\n\r\n return initApp({\r\n appId,\r\n app: appDefinition,\r\n components: componentsList,\r\n config,\r\n target: domTarget,\r\n componentInfos,\r\n byPassAttributes,\r\n pluginHelper\r\n });\r\n };\r\n\r\n // We ensure the DOM is accessible before mounting the app\r\n return build();\r\n }\r\n\r\n function configure(c: Config) {\r\n config = c;\r\n\r\n return { plugins, components, mount };\r\n }\r\n\r\n function plugins(pluginsList: DomyPlugin[]) {\r\n for (const plugin of pluginsList) {\r\n pluginHelper.plugin(plugin);\r\n }\r\n\r\n return { components, mount };\r\n }\r\n\r\n function components(c: Components) {\r\n const kebabCaseComponents: Components = {};\r\n\r\n for (const key in c) {\r\n const kebabKey = toKebabCase(key);\r\n kebabCaseComponents[kebabKey] = c[key];\r\n }\r\n\r\n componentsList = kebabCaseComponents;\r\n\r\n return { mount };\r\n }\r\n\r\n return {\r\n appId,\r\n mount,\r\n configure,\r\n components,\r\n plugins\r\n };\r\n}\r\n\r\n/**\r\n * Same as createAdvancedApp but the user can't inject data or methods\r\n * @param appDefinition\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function createApp(appDefinition?: App) {\r\n return createAdvancedApp(appDefinition);\r\n}\r\n","import { ComponentDefinition, ComponentInfos, Components } from '../types/Component';\r\nimport { callWithErrorHandling } from '../utils/callWithErrorHandling';\r\nimport { createAdvancedApp } from './createApp';\r\nimport { getUniqueQueueId } from './scheduler';\r\n\r\nfunction cleanup(unmountFns: (() => void)[]) {\r\n for (const unmountFn of unmountFns) {\r\n unmountFn();\r\n }\r\n}\r\n\r\n/**\r\n * Parse a html string\r\n * @param html\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nfunction parseHTMl(html: string) {\r\n const temp = document.createElement('div');\r\n temp.innerHTML = html;\r\n return temp.childNodes;\r\n}\r\n\r\n/**\r\n * Allow the user to create component\r\n * This function get the component without the directives which has already been rendered\r\n * Example:\r\n * createComponent({\r\n * props: ['title'],\r\n * html: `\r\n * <div>\r\n * <h1>{{ $props.title }}</h1>\r\n * <p>Count: {{ count }}</p>\r\n * <button @click=\"++count\">+</button>\r\n * <button @click=\"--count\">-</button>\r\n * </div>\r\n * `,\r\n * app(){\r\n * const count = signal(0);\r\n * return { count };\r\n * }\r\n * })\r\n * @param componentDefinition\r\n * @returns\r\n *\r\n * @author yoannchb-pro\r\n */\r\nexport function createComponent(\r\n componentDefinition: ComponentDefinition\r\n): Components[keyof Components] {\r\n const props = componentDefinition.props ?? [];\r\n const propsName = new Set(props.map(prop => prop.replace(/^!/, '')));\r\n\r\n return ({ name, componentElement, domy }) => {\r\n const unmountChilds: (() => void)[] = [];\r\n\r\n callWithErrorHandling(\r\n () => {\r\n const tree = parseHTMl(componentDefinition.html.trim());\r\n\r\n if (tree.length !== 1) {\r\n throw new Error(`The component can only have one element as root.`);\r\n }\r\n\r\n const root = tree[0] as HTMLElement;\r\n\r\n if (root.getAttribute('d-for')) {\r\n throw new Error(\r\n `The component can't have a \"d-for\" directive/attribute on the root element.`\r\n );\r\n }\r\n\r\n const requiredProps = new Set(\r\n props.filter(e => e.startsWith('!')).map(prop => prop.slice(1))\r\n );\r\n\r\n const data = domy.reactive({\r\n $props: {} as ComponentInfos['componentData']['$props'],\r\n $attrs: {} as ComponentInfos['componentData']['$attrs']\r\n });\r\n\r\n const propsAttributes: Attr[] = [];\r\n const componentAttributes: string[] = [];\r\n\r\n // We handle the attributes\r\n for (const attr of componentElement.attributes) {\r\n const attrNameWithoutBinding = attr.name.replace(/^(:|d-bind:)/, '');\r\n const propName = domy.utils.kebabToCamelCase(attrNameWithoutBinding);\r\n\r\n // In case it's a prop\r\n if (propsName.has(propName)) {\r\n requiredProps.delete(propName);\r\n propsAttributes.push(attr);\r\n continue;\r\n }\r\n\r\n // Handling attrs\r\n const { attrName } = domy.utils.getDomyAttributeInformations(attr);\r\n const isClass = attrName === 'class';\r\n const isStyle = attrName === 'style';\r\n let cleanAttr: (() => void) | null = null;\r\n if (domy.utils.isBindAttr(attr.name)) {\r\n let lastExecutedValue: any = null;\r\n\r\n domy.effect(() => {\r\n // Clearing previous class and style\r\n if (cleanAttr) cleanAttr();\r\n\r\n lastExecutedValue = domy.evaluate(attr.value);\r\n\r\n domy.lockWatchers();\r\n if (isClass) {\r\n const fixedClass = domy.utils.handleClass(\r\n lastExecutedValue,\r\n data.$attrs[attrName] ?? ''\r\n );\r\n cleanAttr = () =>\r\n (data.$attrs[attrName] = fixedClass.cleanedClass(data.$attrs[attrName]));\r\n data.$attrs[attrName] = fixedClass.class;\r\n } else if (isStyle) {\r\n const fixedStyle = domy.utils.handleStyle(\r\n lastExecutedValue,\r\n data.$attrs[attrName] ?? ''\r\n );\r\n cleanAttr = () =>\r\n (data.$attrs[attrName] = fixedStyle.cleanedStyle(data.$attrs[attrName]));\r\n data.$attrs[attrName] = fixedStyle.style;\r\n } else data.$attrs[attrName] = lastExecutedValue;\r\n domy.unlockWatchers();\r\n });\r\n } else {\r\n if (isClass)\r\n data.$attrs[attrName] = [data.$attrs[attrName], attr.value].filter(Boolean).join(' ');\r\n else if (isStyle)\r\n data.$attrs[attrName] = [data.$attrs[attrName], attr.value].filter(Boolean).join(';');\r\n else data.$attrs[attrName] = attr.value;\r\n }\r\n }\r\n\r\n // Error handling for required props\r\n for (const requiredProp of requiredProps) {\r\n throw Error(`The prop \"${requiredProp}\" is required on the component \"${name}\".`);\r\n }\r\n\r\n // reactive props\r\n for (const attr of propsAttributes) {\r\n const attrInfos = domy.utils.getDomyAttributeInformations(attr);\r\n const propName = domy.utils.kebabToCamelCase(attrInfos.attrName);\r\n if (domy.utils.isBindAttr(attr.name)) {\r\n domy.effect(() => {\r\n const executedValue = attr.value === '' ? true : domy.evaluate(attr.value);\r\n data.$props[propName] = executedValue;\r\n });\r\n } else {\r\n data.$props[propName] = attr.value === '' ? true : attr.value;\r\n }\r\n }\r\n\r\n // We render the childs first to ensure they keep the current state and not the component state\r\n const names: { [name: string]: Element | undefined } = domy.reactive({});\r\n const childrens: Element[] = domy.reactive([]);\r\n const childrensCache: (Element | undefined)[] = [];\r\n const updateChildrens = () => {\r\n childrens.length = 0;\r\n childrens.push(...(childrensCache.filter(Boolean) as Element[]));\r\n };\r\n const filtredChilds = Array.from(componentElement.childNodes).filter(child => {\r\n const isTextNode = child.nodeType === Node.TEXT_NODE;\r\n return isTextNode ? child.textContent?.trim() !== '' : true;\r\n });\r\n for (let i = 0; i < filtredChilds.length; ++i) {\r\n const child = filtredChilds[i];\r\n const childBlock = domy.deepRender({\r\n element: child as Element,\r\n scopedNodeData: domy.scopedNodeData\r\n });\r\n\r\n unmountChilds.push(childBlock.unmount.bind(childBlock));\r\n\r\n domy.lockWatchers();\r\n // Insert initial render\r\n let childEl: Element | undefined = domy.skipReactive(childBlock.getEl());\r\n childEl = childEl.parentNode ? childEl : undefined;\r\n childrensCache.push(childEl);\r\n if (childBlock.name) names[childBlock.name] = childEl;\r\n updateChildrens();\r\n\r\n // Handle the case the element change (for example with \"d-if\")\r\n childBlock.onElementChange(newEl => {\r\n const newChildEl: Element | undefined = domy.skipReactive(newEl);\r\n childrensCache[i] = newChildEl;\r\n if (childBlock.name) names[childBlock.name] = newChildEl;\r\n updateChildrens();\r\n });\r\n domy.unlockWatchers();\r\n }\r\n\r\n // Replace the component by the root\r\n domy.block.replaceWith(root);\r\n\r\n let unmountComponent: (() => void) | undefined;\r\n const queueId = getUniqueQueueId();\r\n\r\n const mountComponent = (target: HTMLElement) => {\r\n const makeComponent = () => {\r\n if (unmountComponent) unmountComponent();\r\n const render = createAdvancedApp(\r\n componentDefinition.app,\r\n {\r\n componentData: data,\r\n names,\r\n childrens,\r\n parentPluginHelper: domy.pluginHelper\r\n },\r\n componentAttributes\r\n )\r\n .configure(domy.config)\r\n .components(componentDefinition.components ?? {})\r\n .mount(target);\r\n\r\n unmountComponent = render.unmount;\r\n };\r\n\r\n if (domy.appState.isMounted) domy.queueJob(makeComponent, queueId);\r\n else makeComponent();\r\n };\r\n\r\n // We mount the new app on the component\r\n mountComponent(root as HTMLElement);\r\n\r\n domy.block.onElementChange(newEl => {\r\n mountComponent(newEl as HTMLElement);\r\n });\r\n\r\n domy.cleanup(() => {\r\n if (unmountComponent) unmountComponent();\r\n cleanup(unmountChilds);\r\n domy.unReactive(data);\r\n domy.unReactive(childrens);\r\n domy.unReactive(names);\r\n });\r\n },\r\n err => {\r\n // In cas we had an error creating the component we remove it and unmount his childs\r\n componentElement.remove();\r\n cleanup(unmountChilds);\r\n\r\n domy.utils.error(`Component \"${name}\":`, err);\r\n }\r\n );\r\n };\r\n}\r\n","import { createApp } from './core/createApp';\r\nimport { createComponent } from './core/createComponent';\r\nimport * as ReactiveUtils from '@domyjs/reactive';\r\nimport { allHooks, helperToHookRegistrer } from './core/hooks';\r\n\r\nconst DOMY = {\r\n matchPath: ReactiveUtils.matchPath,\r\n signal: ReactiveUtils.signal,\r\n computed: ReactiveUtils.computed,\r\n skipReactive: ReactiveUtils.skipReactive,\r\n\r\n helperToHookRegistrer,\r\n ...allHooks,\r\n\r\n createApp,\r\n createComponent\r\n};\r\n\r\nexport default DOMY;\r\n\r\nexport type * from './types/App';\r\nexport type * from './types/Component';\r\nexport type * from './types/Config';\r\nexport type * from './types/Domy';\r\nexport type * from './types/Helpers';\r\nexport type * from './types/State';\r\nexport type { Block } from './core/Block';\r\n"],"names":["toKebabCase","str","replace","toLowerCase","error","errs","console","isBindAttr","attr","startsWith","isEventAttr","isDNameAttr","isDomyAttr","PLUGINS","attrName","split","attrNameWithoutDPrefix","slice","directives","prefixes","isNormalAttr","callWithErrorHandling","fn","onError","hasError","result","err","executeActionAfterAnimation","el","action","computedStyle","window","getComputedStyle","hasAnimation","animationName","hasTransition","transitionDuration","addEventListener","once","removeEventListener","Block","constructor","element","this","name","key","pluginsData","Map","transition","cleanupTransition","cleanups","onElChangeCbList","parentBlock","getDataForPluginId","pluginId","get","setDataForPluginId","data","set","cleanTransition","callCbForElementChange","newEl","cb","createNewElementBlock","getEl","attachListener","type","listener","options","backEl","onElementChange","push","setEl","applyTransition","transitionType","currentEl","transitionName","classList","add","requestAnimationFrame","transitionNameTo","remove","replaceWith","oldEl","isTemplate","tagName","isTextNode","nodeType","Node","TEXT_NODE","addCleanup","cleanup","unmount","length","DOMY_EVENTS","Mounted","splitPath","path","object","defaultValue","keys","undefined","cspEvaluate","evaluatorConf","pathFn","contextAsGlobal","code","isFn","endsWith","value","context","returnResult","evaluate","props","Function","call","reactivesVariablesList","globalListenersList","Set","trackCallback","trackDeps","deps","dep","globalWatch","tracking","clean","has","delete","removeGlobalWatch","isProxySymbol","Symbol","isSignalSymbol","skipReactivitySymbol","ReactiveVariable","target","proxy","onSetListeners","onGetListeners","getProxy","createProxy","isReactive","isSignal","shouldBeSkip","clearListeners","clear","l","removeListener","canAttachProxy","isCollection","WeakMap","WeakSet","createCollectionHandler","ctx","property","receiver","Reflect","fullPath","args","prevValue","newValue","isNewObj","includes","obj","apply","callOnSetListeners","callOnGetListeners","createHandler","p","deleteProperty","exists","ownKeys","Object","defineProperty","enumerable","writable","configurable","Proxy","IS_GLOBAL_LOCK","params","join","reactiveVariable","matchPath","reg","defaultRes","isMatching","rules","paths","isArrayLength","i","isParam","match","paramName","substring","isNaN","Number","unReactive","reactiveInstance","reactive","createGlobalListener","globalListener","signal","sig","watch","effect","removeWatcherLists","registerListener","overideListener","removeWatcher","removeEffect","Array","isArray","skipReactive","watchEffectDepth","watchEffect","opts","removeListenersSet","watchDeps","currentWatchEffectDepth","dependencyMap","listenerAlreadyMatched","toWatch","onDepChange","noSelfUpdate","currentDeps","isComputedSymbol","isComputed","computed","getter","setter","Error","values","kebabToCamelCase","map","word","index","charAt","toUpperCase","getDomyName","getDomyAttributeInformations","attrNameWithPrefix","modifiers","prefix","directive","getReactiveHandler","handleClass","executedValue","defaultClass","classNames","filter","Boolean","added","forEach","cls","shouldAdd","entries","class","cleanedClass","newDefaultClass","handleStyle","defaultStyle","addedKeys","styleDict","pair","s","trim","kebab","style","k","v","cleanedStyle","newDefaultStyle","newDict","helpersUtils","getElementVisibilityHandler","domy","originalEl","block","tracePositionComment","Comment","before","lastRender","isInit","isConnected","parentNode","shouldBeDisplay","clone","cloneNode","after","deepRender","scopedNodeData","_a","init","temp","test","getPreviousConditionsElements","previousAuthorizedAttrs","previousSibling","previousElementSibling","allPreviousConditions","currentPreviousSibling","isValid","previousAuthorizedAttr","getAttribute","mergeToNegativeCondition","conditions","condition","fixeAttrName","_","warn","msg","getHelpers","helpers","pluginHelper","ReactiveUtils","utils","getContext","state","queued","queueIndex","queueId","queue","resolvedPromise","Promise","resolve","queueCallbacks","seen","flushJobs","queueCb","queueJob","job","id","count","then","getUniqueQueueId","queuedWatchEffect","currUnEffect","makeEffect","uneffect","effectId","dontQueueOnFirstExecution","directivesUtils","domyHelperId","DomyHelper","appId","deepRenderFn","config","renderWithoutListeningToChange","appState","isUnmountCalled","cleanupFn","clearEffectList","getPluginHelper","onElementMounted","bind","onAppMounted","addScopeToNode","removeScopeToNode","copy","setAttrInfos","attrInfos","isMounted","removeObserver","addObserver","callback","clearEffects","clearEffect","fixedFn","scope","evaluator","CSP","avoidDeprecatedWith","findIndex","o","splice","getCleanupFn","callCleanup","unmountQueueId","dNameImplementation","binding","isStyle","isClass","cleanFn","fixedStyle","cssText","setAttribute","fixedClass","className","removeAttribute","wrapListener","wrapper","event","events","eventName","setUpEvent","wrap","listenerTarget","next","preventDefault","stopPropagation","passive","capture","keyReg","keyModifier","find","modifier","exec","groups","toLocaleLowerCase","document","body","contains","on","async","$event","renderAttribute","prefixImplementation","directiveImplementation","renderText","originalTextContent","textContent","getRender","createCallbackRegistrer","callbackList","getCallbacks","$attrs","componentInfos","componentData","$props","$childrens","childrens","$config","$names","names","$refs","refs","$nextTick","helperToHookRegistrer","helpersHooksList","getHook","helper","provideHookMandatories","domyHelper","createHelperToHookRegistrer","onSetupedTracker","onMountedTracker","onBeforeUnmountTracker","onUnmountedTracker","allHooks","onSetuped","onMounted","onBeforeUnmount","onUnmounted","useAttrs","useProps","useChildrens","useConfig","useNames","useRefs","nextTick","AppStateObserver","observers","isSetuped","isUnmounted","callObservers","ob","observer","indexOf","initApp","unmountRender","components","app","ReactiveUtils.reactive","setupedCallbacks","setupedCallback","rootBlock","rootElement","toRenderList","skipOtherAttributesRendering","skipChildRendering","_b","skipComponentRendering","toRender","pop","lastRenderedElement","nextElementSibling","dispatchEvent","CustomEvent","render","_c","_d","isComponent","localName","attrs","from","_e","attributes","hasAttribute","byPassAttributes","skipChildsRendering","child","childNodes","componentSetup","componentElement","createDeepRenderFn","mountedCallbacks","mountedCallback","beforeUnmountCallbacks","unmountedCallbacks","beforeUnmountCallback","unmountedCallback","dElseIfImplementation","mergedNegativeCondition","previousCondition","visibilityHandler","moveToIndexBetweenComments","startComment","endComment","nodesBetween","current","nextSibling","ELEMENT_NODE","refNode","dForImplementation","currentLoopId","rawKey","traceStartPositionComment","traceEndPositionComment","cleanupLastRender","reactiveIndex","forPattern","isForIn","lastRenders","keyedLastRenders","org","executedValueObjs","currentElements","renderFns","canUseTemplate","dest","indexName","currentKeyValue","oldRender","oldRenderEl","loopId","newRender","currentKey","fragment","createDocumentFragment","appendChild","renderFn","dHtmlImplementation","innerHTML","dIfImplementation","dIgnoreImplementation","dModelImplementation","listenChangeCallback","isPrevValueArray","select","isMultiple","multiple","selectedOptions","selectedOption","checked","isChecked","e","isCsp","objPath","changeValue","isValueArray","querySelectorAll","option","selected","checkbox","radio","dOnceImplementation","dRefImplementation","isDynamic","refName","isFirstRefInit","cleanRef","setRef","updateRef","dShowImplementation","needInitTransition","originalDisplay","display","isAlreadyShow","dTextImplementation","dTransitionImplementation","updateTransition","enterTransition","enterTransitionTo","outTransition","outTransitionTo","$el","$root","dElseImplementation","dScopeImplementation","reactiveData","dSetupImplementation","dTeleportImplementation","teleport","childs","content","querySelector","unmountFns","unmountFn","dMountedImplementation","dUnMountImplementation","dAttrsImplementation","needRender","lastAttrs","isObject","JSON","stringify","dKeyImplementation","dComponentImplementation","createElement","$createComponent","componentName","dInsertImplementation","shouldBeRender","elementToRender","newBlock","createPluginRegistrer","insert","mounted","setup","if","else","for","html","text","model","ref","ignore","show","component","root","pluginDefinition","plugin","pluginMaker","createAdvancedApp","appDefinition","parentPluginHelper","componentsList","mount","domTarget","build","plugins","pluginsList","c","kebabCaseComponents","configure","DOMY","ReactiveUtils.matchPath","ReactiveUtils.signal","ReactiveUtils.computed","ReactiveUtils.skipReactive","createApp","createComponent","componentDefinition","propsName","prop","unmountChilds","tree","parseHTMl","requiredProps","propsAttributes","componentAttributes","attrNameWithoutBinding","propName","cleanAttr","lastExecutedValue","lockWatchers","unlockWatchers","requiredProp","childrensCache","updateChildrens","filtredChilds","childBlock","childEl","newChildEl","unmountComponent","mountComponent","makeComponent"],"mappings":"oOAWM,SAAUA,EAAYC,GAC1B,OAAOA,EACJC,QAAQ,kBAAmB,SAC3BA,QAAQ,OAAQ,KAChBC,aACL,CCAM,SAAUC,KAASC,GACvBC,QAAQF,MAAM,kBAAmBC,EACnC,CCTM,SAAUE,EAAWC,GACzB,OAAOA,EAAKC,WAAW,MAAQD,EAAKC,WAAW,UACjD,CASM,SAAUC,EAAYF,GAC1B,OAAOA,EAAKC,WAAW,MAAQD,EAAKC,WAAW,QACjD,CAEM,SAAUE,EAAYH,GAC1B,OAAOA,EAAKC,WAAW,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H,WAAyC,QAA9BnL,EAAAmX,EAAoBhM,kBAAU,IAAAnL,EAAAA,EAAI,CAAA,GAC7CoW,MAAMhgB,GAETqiB,EAAmBpM,EAAO3Y,SAGxBsL,EAAKyE,SAASa,UAAWtF,EAAKsD,SAASqW,EAAe9W,GACrD8W,KAIPD,EAAe9C,GAEf5W,EAAKE,MAAM9M,gBAAgBT,IACzB+mB,EAAe/mB,KAGjBqN,EAAKvL,QAAQ,KACPglB,GAAkBA,IACtBhlB,GAAQ6jB,GACRtY,EAAK/E,WAAW1I,GAChByN,EAAK/E,WAAW0O,GAChB3J,EAAK/E,WAAW6O,MAGpBtZ,IAEE4d,EAAiBra,SACjBU,GAAQ6jB,GAERtY,EAAKwC,MAAMtT,MAAM,cAAcwC,MAAUlB,KAIjD"}
|
package/package.json
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
{
|
2
|
+
"name": "@domyjs/domy",
|
3
|
+
"unpkg": "./dist/index.js",
|
4
|
+
"buildName": "DOMY",
|
5
|
+
"version": "1.0.0",
|
6
|
+
"description": "A lightweight and minimal javascript framework for your frontend",
|
7
|
+
"main": "./dist/index.js",
|
8
|
+
"types": "./dist/index.d.ts",
|
9
|
+
"files": [
|
10
|
+
"./dist",
|
11
|
+
"package.json",
|
12
|
+
"README.md",
|
13
|
+
"./assets"
|
14
|
+
],
|
15
|
+
"scripts": {
|
16
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
17
|
+
},
|
18
|
+
"repository": {
|
19
|
+
"type": "git",
|
20
|
+
"url": "git+https://github.com/yoannchb-pro/domy.git"
|
21
|
+
},
|
22
|
+
"keywords": [
|
23
|
+
"domyjs",
|
24
|
+
"typescript",
|
25
|
+
"javascript",
|
26
|
+
"framework"
|
27
|
+
],
|
28
|
+
"author": "yoannchb",
|
29
|
+
"license": "MIT",
|
30
|
+
"bugs": {
|
31
|
+
"url": "https://github.com/yoannchb-pro/domy/issues"
|
32
|
+
},
|
33
|
+
"homepage": "https://domyjs.github.io/domy/"
|
34
|
+
}
|