{"version":3,"sources":["type-definitions.ts"],"sourcesContent":["import { $$, Datex } from \"datex-core-legacy\";\nimport { DOMUtils } from \"./dom-utils.ts\"\nimport { DX_VALUE, INIT_PROPS, logger } from \"datex-core-legacy/datex_all.ts\";\nimport { DX_IGNORE } from \"datex-core-legacy/runtime/constants.ts\";\nimport type { DOMContext } from \"../dom/DOMContext.ts\";\nimport { querySelector } from \"../dom/shadow_dom_selector.ts\";\nimport { client_type } from \"datex-core-legacy/utils/constants.ts\";\nimport { commentType, documentType, fragmentType, htmlType, mathmlType, svgType } from \"./dom-datex-types.ts\";\nimport { getTransformWrapper } from \"./transform-wrapper.ts\";\n\nlet definitionsLoaded = false;\n\nconst OBSERVER = Symbol(\"OBSERVER\");\nconst OBSERVER_EXCLUDE_UPDATES = Symbol(\"OBSERVER_EXCLUDE_UPDATES\");\nconst OBSERVER_IGNORE = Symbol(\"OBSERVER_IGNORE\");\n\n\nexport type BindingOptions = {\n\tmapFileURL?: (url: `file://${string}`) => string\n}\n\nexport function loadDefinitions(context: DOMContext, domUtils: DOMUtils, options?: BindingOptions) {\n\n\t// definitions cannot be loaded multiple times\n\tif (definitionsLoaded) throw new Error(\"DATEX type binding very already loaded for a window object\")\n\tdefinitionsLoaded = true;\n\n\n\t// TODO: not functional yet\n\tfunction bindObserver(element:Element) {\n\t\tconst pointer = Datex.Pointer.getByValue(element);\n\t\tif (!pointer) throw new Error(\"cannot bind observers for HTMLElement without pointer\")\n\t\tif (!element.dataset) {\n\t\t\tconsole.log(element)\n\t\t\tthrow new Error(\"element has no dataset, todo\");\n\t\t}\n\t\tif (!element.hasAttribute(\"uix-ptr\") && client_type == \"deno\") element.setAttribute(\"uix-ptr\", pointer.id);\n\n\t\t// @ts-ignore\n\t\tif (element[OBSERVER]) return;\n\t\tif (element[OBSERVER_IGNORE]) return;\n\n\t\t// const ptr = Datex.Pointer.getByValue(element);\n\n\t\t// important: no direct references to ptr or element in this handler!!!!\n\t\tconst handler: MutationCallback = (mutations: MutationRecord[], observer: MutationObserver) => {\n\n\t\t\t// TODO:\n\t\t\t// // @ts-ignore\n\t\t\t// if (element[OBSERVER_EXCLUDE_UPDATES]) {\n\t\t\t// \t// @ts-ignore\n\t\t\t// \tptr.excludeEndpointFromUpdates(element[OBSERVER_EXCLUDE_UPDATES])\n\t\t\t// \t// @ts-ignore\n\t\t\t// \telement[OBSERVER_EXCLUDE_UPDATES] = undefined;\n\t\t\t// }\n\n\t\t\tfor (const mut of mutations) {\n\t\t\t\tif (mut.type == \"attributes\") {\n\t\t\t\t\tif (mut.attributeName == \"uix-ptr\") continue;\n\t\t\t\t\t// TODO find style changes, don't send full style attribute\n\t\t\t\t\t// ptr.handleSetObservers(mut.attributeName)\n\t\t\t\t}\n\t\t\t\telse if (mut.type == \"childList\") {\n\t\t\t\t\tconsole.log(\"mut\")//,mut, mut.addedNodes, mut.removedNodes)\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//ptr.enableUpdatesForAll();\n\t\t\t\n\t\t}\n\n\t\t// @ts-ignore\n\t\telement[OBSERVER] = new context.MutationObserver(handler)\n\n\t\treturn element;\n\t}\n\n\tconst transformWrapper = getTransformWrapper(domUtils, context)\n\n\t// handle htmlfragment (DocumentFragment)\n\tfragmentType.setJSInterface({\n\t\tclass: context.DocumentFragment,\n\n\t\t...transformWrapper,\n\n\t\tcreate_proxy(value, pointer) {\n\t\t\treturn value;\n\t\t},\n\n\t\t// called when replicating from state\n\t\tcast_no_tuple(val) {\n\t\t\tconst fragment = new context.DocumentFragment();\n\t\t\tfor (const child of val) {\n\t\t\t\tdomUtils.append(fragment, child);\n\t\t\t}\n\t\t\treturn fragment;\n\t\t},\n\n\t\tserialize(val:DocumentFragment) {\n\t\t\treturn serializeChildren(val)\n\t\t}\n\t})\n\n\t// handle htmlfragment (Document)\n\tdocumentType.setJSInterface({\n\t\tclass: context.Document,\n\n\t\tcreate_proxy(value, pointer) {\n\t\t\treturn value;\n\t\t},\n\n\t\t// called when replicating from state\n\t\tcast_no_tuple(val) {\n\t\t\tconst document = new context.Document();\n\t\t\tfor (const child of val) {\n\t\t\t\tdocument.appendChild(child);\n\t\t\t}\n\t\t\treturn document;\n\t\t},\n\n\t\tserialize(val:Document) {\n\t\t\treturn serializeChildren(val)\n\t\t}\n\t})\n\n\t// handle htmlfragment (Document)\n\tcommentType.setJSInterface({\n\t\tclass: context.Comment,\n\n\t\t...transformWrapper,\n\n\t\tcreate_proxy(value, pointer) {\n\t\t\treturn value;\n\t\t},\n\n\t\t// called when replicating from state\n\t\tcast_no_tuple(val) {\n\t\t\treturn new context.Comment(val);;\n\t\t},\n\n\t\tserialize(val:Comment) {\n\t\t\treturn val.textContent;\n\t\t}\n\t})\n\n\tfunction serializeChildren(parent:Element|DocumentFragment|Document) {\n\t\t// children\n\t\tconst children = [];\n\t\tfor (let i = 0; i < parent.childNodes.length; i++) {\n\t\t\tconst child = parent.childNodes[i];\n\t\t\tif (child instanceof context.Text) children.push(child[DX_VALUE] ?? child.textContent);\n\t\t\telse children.push(child);\n\t\t}\n\t\treturn children;\n\t}\n\n\tfunction getExistingElement(ptrId?: string) {\n\t\tif (!ptrId) return;\n\t\tif (client_type == \"browser\") {\n\t\t\tconst existingElement = querySelector(`[uix-ptr=\"${ptrId}\"]`) as Element;\n\t\t\texistingElement?.removeAttribute(\"uix-static\");\n\t\t\texistingElement?.removeAttribute(\"uix-dry\");\n\t\t\texistingElement?.setAttribute(\"uix-hydrated\", \"\");\n\t\t\treturn existingElement;\n\t\t}\n\t}\n\n\t/**\n\t * Replaces existing children of an element with new children.\n\t * If there are no lazy children, everything is replaced immediately.\n\t * Otherwise the replacement happens asynchronously.\n\t */\n\tfunction replaceChildrenInOrder(parent: Element | DocumentFragment, currentChildNodes: Node[], newChildren: any[], i = 0) {\n\n\n\n\t\t// end of new children reached\n\t\tif (i >= newChildren.length) {\n\t\t\treturn;\n\t\t}\n\n\t\tlet currentChild:any = currentChildNodes[i];\n\t\tif (currentChild instanceof context.Text) currentChild = currentChild.textContent;\n\t\tconst child = newChildren[i];\n\n\t\t// child does no exist, just append\n\t\tif (currentChild === undefined) {\n\t\t\tdomUtils.append(parent, child);\n\t\t\treplaceChildrenInOrder(parent, currentChildNodes, newChildren, i+1);\n\t\t}\n\t\t// different child, replace\n\t\telse if (child !== currentChild) {\n\t\t\tconst result = domUtils.replaceWith(currentChildNodes[i], child, true);\n\t\t\t// only continue with next child when replacement is done\n\t\t\tif (result instanceof Promise) \n\t\t\t\tresult.then(() => replaceChildrenInOrder(parent, currentChildNodes, newChildren, i+1))\n\t\t\t// otherwise continue immediately\n\t\t\telse replaceChildrenInOrder(parent, currentChildNodes, newChildren, i+1);\n\t\t}\n\t\t// same child, ignore\n\t\telse {\n\t\t\treplaceChildrenInOrder(parent, currentChildNodes, newChildren, i+1);\n\t\t}\n\t}\n\n\t// handles html/x and also casts from uix/x\n\n\n\n\tconst elementInterface:Datex.js_interface_configuration & {_name:string} = {\n\t\t_name: \"unset\",\n\n\t\tget_type(val) {\n\t\t\tif (val instanceof this.class!) return Datex.Type.get('std', this._name, val.tagName.toLowerCase());\n\t\t\telse throw \"not an \" + this.class!.name;\n\t\t},\n\n\t\t// enable <uix-fragment> wrapping\n\t\t//...transformWrapper,\n\n\t\t// called when replicating from state\n\t\tcast_no_tuple(val, type, _ctx, _origin, assigningPtrId) {\n\n\t\t\t// merge with existing element in DOM\n\t\t\tconst existingElement = getExistingElement(assigningPtrId)\n\n\t\t\tconst isComponent = type.name == \"uix\";\n\t\t\tif (!isComponent && !type.variation) throw new Error(\"cannot create \"+this.class!.name+\" without concrete type\")\n\t\t\t\n\t\t\tconst propertyInitializer = isComponent ? type.getPropertyInitializer(val?.p ?? {}, false) : null;\n\t\t\t// create HTMLElement / UIX component\n\t\t\tconst el = existingElement ?? (\n\t\t\t\tisComponent ?\n\t\t\t\ttype.newJSInstance(false) :  // call js constructor, but don't handle as constructor in lifecycle, propertyInitializer is always called afterwards\n\t\t\t\tdomUtils.createElement(type.variation) // create normal Element, no UIX lifecycle\n\t\t\t);\n\n\t\t\t// set attrs, style, content from object\n\t\t\tif (typeof val == \"object\" && Object.getPrototypeOf(val) === Object.prototype) {\n\t\t\t\t\n\t\t\t\t// sort entries: content, attr, style\n\t\t\t\tconst order = [\"content\", \"attr\", \"style\"];\n\t\t\t\tconst entries = Object.entries(val).sort(([name]) => order.indexOf(name));\n\t\t\t\t\n\t\t\t\tfor (const [prop,value] of entries) {\n\t\t\t\t\tif (prop==\"style\" && typeof value != \"string\") {\n\t\t\t\t\t\tfor (const [prop, val] of Object.entries(value)) {\n\t\t\t\t\t\t\tel.style[prop] = val;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (prop==\"attr\") {\n\t\t\t\t\t\tfor (const [prop, val] of Object.entries(value)) {\n\t\t\t\t\t\t\tdomUtils.setElementAttribute(el, prop, val);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (prop==\"content\") {\n\t\t\t\t\t\t// only update new content (lazy hydration)\n\t\t\t\t\t\tif (existingElement) {\n\t\t\t\t\t\t\tconst currentChildNodes = [...existingElement.childNodes as Iterable<Node>];\n\n\t\t\t\t\t\t\t// skip overriding content for frontend slot (TODO: better solution?)\n\t\t\t\t\t\t\tif (el.tagName.toLowerCase() == \"frontend-slot\") {\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\treplaceChildrenInOrder(el, currentChildNodes, value instanceof Array ? value : [value])\n\t\t\t\t\t\t}\n\t\t\t\t\t\t// append content\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tfor (const child of (value instanceof Array ? value : [value])) {\n\t\t\t\t\t\t\t\tdomUtils.append(el, child);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\telse if (prop==\"shadowroot\") {\n\t\t\t\t\t\tconst shadowRoot = el.attachShadow({mode:\"open\"});\n\t\t\t\t\t\tshadowRoot.append(value);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// set direct content when cast from different value\n\t\t\telse {\n\t\t\t\tdomUtils.append(el, val);\n\t\t\t}\n\n\t\t\t\n\t\t\t// uix component\n\t\t\tif (isComponent) {\n\t\t\t\t// set 'p' properties (contains options, other properties)\n\t\t\t\tpropertyInitializer![INIT_PROPS](el);\n\t\t\t\t// trigger UIX lifecycle (onReplicate)\n\t\t\t\ttype.construct(el, undefined, false, true);\n\t\t\t}\n\t\t\t\n\t\t\treturn el;\n\t\t},\n\n\t\tserialize(val: Element&{[DOMUtils.EVENT_LISTENERS]?:Map<keyof HTMLElementEventMap, Set<[Function, boolean]>>}) {\n\t\t\tif (!(val instanceof this.class!)) throw \"not an \" + this.class!.name;\n\t\t\tconst data: {style:Record<string,unknown>, content:any[], attr:Record<string,unknown>, shadowroot?:DocumentFragment} = {style: {}, attr: {}, content: []}\n\n\t\t\t// attributes\n\t\t\tfor (let i = 0; i < val.attributes.length; i++) {\n\t\t\t\tconst attrib = val.attributes[i];\n\t\t\t\tconst value = attrib.value;\n\t\t\t\t// relative web path (@...)\n\t\t\t\tif (options?.mapFileURL && value.startsWith(\"file://\")) data.attr[attrib.name] = options.mapFileURL(value as `file://${string}`);\n\t\t\t\t// default attr, ignore style + uix-ptr\n\t\t\t\telse if (attrib.name !== \"style\" && attrib.name !== \"uix-ptr\") data.attr[attrib.name] = value;\n\t\t\t\t\n\t\t\t\t// blob -> data url TODO: handle (async blob to base64)\n\t\t\t\tif (value.startsWith(\"blob:\")) {\n\t\t\t\t\tlogger.warn(\"todo: blob url attribute serialization\")\n\t\t\t\t\t// val = await blobToBase64(val);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// special attr bindings (value, checked)\n\t\t\tfor (const [attr, ref] of (<DOMUtils.elWithUIXAttributes><unknown>val)[DOMUtils.ATTR_BINDINGS]??[]) {\n\t\t\t\tdata.attr[attr] = ref;\n\t\t\t}\n\t\t\tfor (const [attr, ref] of (<DOMUtils.elWithUIXAttributes><unknown>val)[DOMUtils.ATTR_DX_VALUES]??[]) {\n\t\t\t\tdata.attr[attr] = ref;\n\t\t\t}\n\n\t\t\t// event handler attributes\n\t\t\tfor (const [name, handlers] of val[DOMUtils.EVENT_LISTENERS]??[]) {\n\t\t\t\tconst allowedHandlers = [];\n\t\t\t\tfor (const [handler] of handlers) {\n\t\t\t\t\tallowedHandlers.push($(handler))\n\t\t\t\t}\n\t\t\t\tdata.attr['on'+String(name)] = allowedHandlers;\n\t\t\t}\n\n\t\t\t// style (uix _original_style)\n\t\t\t// @ts-ignore \n\t\t\tconst style = val.style;\n\t\t\t\n\t\t\tlet style_props = (style?._importants ? [...Object.keys(style._importants)] : style) ?? [];\n\t\t\tif (style_props && !(style_props instanceof Array || (context.CSSStyleDeclaration && style_props instanceof context.CSSStyleDeclaration))) style_props = [...Object.keys(style_props)];\n\n\t\t\tconst weakProps = (<DOMUtils.elWithUIXAttributes><unknown>val)[DOMUtils.STYLE_WEAK_PROPS];\n\n\t\t\tif (style_props instanceof Array || style_props instanceof context.CSSStyleDeclaration) {\n\t\t\t\tfor (let prop of style_props) {\n\t\t\t\t\tlet val = style_props[prop];\n\t\t\t\t\t// no value, try to find a matching property: background-color -> background\n\t\t\t\t\tif (!val) {\n\t\t\t\t\t\tprop = prop.split(\"-\")[0]\n\t\t\t\t\t\tval = style_props[prop];\n\t\t\t\t\t\tif (!val) logger.warn(\"style property has no value\",prop)\n\t\t\t\t\t}\n\n\t\t\t\t\tif (weakProps?.get(prop)) continue; // is a weak binding, ignore\n\t\t\t\t\tdata.style[prop] = val;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tfor (const [prop, ref] of (<DOMUtils.elWithUIXAttributes><unknown>val)[DOMUtils.STYLE_DX_VALUES]??[]) {\n\t\t\t\tif (weakProps?.get(prop)) continue; // is a weak binding, ignore\n\t\t\t\tdata.style[prop] = ref;\n\t\t\t}\n\n\t\t\t// children\n\t\t\tdata.content = serializeChildren(val);\n\n\t\t\t// shadowroot\n\t\t\tif (val.shadowRoot && !(<any>val.shadowRoot)[DX_IGNORE]) {\n\t\t\t\tdata.shadowroot = val.shadowRoot;\n\t\t\t}\n\n\t\t\t// logger.info(\"serialize\",data)\n\n\t\t\t// optimize serialization\n\t\t\tif (Object.keys(data.style).length == 0) delete data.style;\n\t\t\tif (Object.keys(data.attr).length == 0) delete data.attr;\n\t\t\tif (Object.keys(data.content).length == 0) delete data.content;\n\n\t\t\tif (data.content?.length == 1) {\n\t\t\t\tdata.content = data.content[0];\n\t\t\t}\n\n\t\t\treturn data;\n\t\t},\n\n\t\tget_property(parent, key) {\n\t\t\treturn parent.getAttribute(key);\n\t\t},\n\n\t\tset_property_silently(parent, key, value) {\n\t\t\tparent[OBSERVER_IGNORE] = true; // ignore next observer event\n\t\t\tparent.setAttribute(key, value);\n\t\t},\n\n\t\tset_property(parent, key, value, exclude) {\n\t\t\t// has ptr (+ MutationObserver) - tell MutationObserver which endpoint to ignore when triggered for this update\n\t\t\tconst ptr = Datex.Pointer.getByValue(parent);\n\t\t\t// @ts-ignore\n\t\t\tif (ptr && exclude) parent[OBSERVER_EXCLUDE_UPDATES] = exclude;\n\t\t\tparent.setAttribute(key, value);\n\t\t},\n\n\t\tcreate_proxy(val, pointer) {\n\t\t\tif (!val.hasAttribute(\"uix-ptr\") && client_type == \"deno\") val.setAttribute(\"uix-ptr\", pointer.id);\n\n\t\t\tconst cloneNodeOriginal = val.cloneNode.bind(val);\n\n\t\t\t// override cloneNode to bind cloned node to a new pointer\n\t\t\tval.cloneNode = function(deep: boolean) {\n\t\t\t\tconst clone = cloneNodeOriginal(deep);\n\t\t\t\tclone.removeAttribute(\"uix-ptr\");\n\t\t\t\tdelete clone[Datex.DX_PTR];\n\t\t\t\treturn $(clone);\n\t\t\t}\n\n\t\t\t// TODO: (handled separately for components)\n\t\t\t// bindObserver(val);\n\t\t\treturn val;\n\t\t}\n\n\t}\n\n\thtmlType.setJSInterface(Object.assign(Object.create(elementInterface), {\n\t\t_name: 'html',\n\t\tclass: context.HTMLElement\n\t}))\n\n\tsvgType.setJSInterface(Object.assign(Object.create(elementInterface), {\n\t\t_name: 'svg',\n\t\tclass: context.SVGElement\n\t}))\n\n\tmathmlType.setJSInterface(Object.assign(Object.create(elementInterface), {\n\t\t_name: 'mathml',\n\t    class: context.MathMLElement\n\t}))\n\n\n\treturn {\n\t\tbindObserver\n\t}\n}"],"names":["Datex","DOMUtils","DX_VALUE","INIT_PROPS","logger","DX_IGNORE","querySelector","client_type","commentType","documentType","fragmentType","htmlType","mathmlType","svgType","getTransformWrapper","definitionsLoaded","OBSERVER","Symbol","OBSERVER_EXCLUDE_UPDATES","OBSERVER_IGNORE","loadDefinitions","context","domUtils","options","Error","bindObserver","element","pointer","Pointer","getByValue","dataset","console","log","hasAttribute","setAttribute","id","MutationObserver","mutations","observer","mut","type","attributeName","transformWrapper","serializeChildren","parent","children","i","childNodes","length","child","Text","push","textContent","getExistingElement","ptrId","existingElement","removeAttribute","replaceChildrenInOrder","currentChildNodes","newChildren","currentChild","undefined","append","result","replaceWith","Promise","then","setJSInterface","class","DocumentFragment","create_proxy","value","cast_no_tuple","val","fragment","serialize","Document","document","appendChild","Comment","elementInterface","_name","get_type","Type","get","tagName","toLowerCase","name","_ctx","_origin","assigningPtrId","isComponent","variation","propertyInitializer","getPropertyInitializer","p","el","newJSInstance","createElement","Object","getPrototypeOf","prototype","order","prop","entries","sort","indexOf","style","setElementAttribute","Array","shadowRoot","attachShadow","mode","construct","data","attr","content","attributes","attrib","mapFileURL","startsWith","warn","ref","ATTR_BINDINGS","ATTR_DX_VALUES","handlers","EVENT_LISTENERS","allowedHandlers","handler","$","String","style_props","_importants","keys","CSSStyleDeclaration","weakProps","STYLE_WEAK_PROPS","split","STYLE_DX_VALUES","shadowroot","get_property","key","getAttribute","set_property_silently","set_property","exclude","cloneNodeOriginal","cloneNode","bind","deep","clone","DX_PTR","assign","create","HTMLElement","SVGElement","MathMLElement"],"mappings":"AAAA,SA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