diff --git a/packages/furo-fbp/.gitignore b/packages/furo-fbp/.gitignore index 5c4d921fe..9fc52ad4e 100644 --- a/packages/furo-fbp/.gitignore +++ b/packages/furo-fbp/.gitignore @@ -17,7 +17,6 @@ # build /_site/ -/dist/ /out-tsc/ storybook-static diff --git a/packages/furo-fbp/src/DOMFBP.d.ts b/packages/furo-fbp/dist/DOMFBP.d.ts similarity index 85% rename from packages/furo-fbp/src/DOMFBP.d.ts rename to packages/furo-fbp/dist/DOMFBP.d.ts index 243cee9e9..89469aadf 100644 --- a/packages/furo-fbp/src/DOMFBP.d.ts +++ b/packages/furo-fbp/dist/DOMFBP.d.ts @@ -5,9 +5,9 @@ declare const DOMFBP_base: { __wirebundle: {}; __wireQueue: any[]; firstUpdated(): void; - __fbpAppended: boolean; + __fbpAppended: boolean | undefined; _FBPTriggerWire(wire: any, detailData: any): void; - __domPath: any; + __domPath: string | undefined; _call(detailData: any, receiver: any): void; _FBPAddWireHook(wire: any, cb: any, before?: any): number; _FBPTraceWires(): void; @@ -15,14 +15,14 @@ declare const DOMFBP_base: { __toCamelCase(str: any): any; _appendFBP(dom: any): void; _FBPReady(): void; - __fbp_ready: boolean; + __fbp_ready: boolean | undefined; __enqueueTrigger(wire: any, detailData: any): void; __resolveWireAndPath(w: any): { path: any; receivingWire: any; }; - _pathGet(root: any, path: string | (string | number)[]): any; - _pathSet(root: any, path: string | (string | number)[], value: any): string | boolean; + _pathGet(root: Object, path: string | (string | number)[]): any; + _pathSet(root: Object, path: string | (string | number)[], value: any): string | boolean; _split(path: string | (string | number)[]): string[]; }; [x: string]: any; diff --git a/packages/furo-fbp/dist/DOMFBP.js b/packages/furo-fbp/dist/DOMFBP.js new file mode 100644 index 000000000..c19807bec --- /dev/null +++ b/packages/furo-fbp/dist/DOMFBP.js @@ -0,0 +1,48 @@ +// eslint-disable-next-line max-classes-per-file +import { FBP } from './fbp.js'; +/** + * DOMFBP allows you to append FBP to any dom element. + * + * **Usage:** + * + * ```html + * + * + * + * + * Title + * + * + * + * + * + * + * + * ``` + * + * ```js + * import {DOMFBP} from '@furo/fbp/src/DOMFBP.js'; + * + * // append fbp to the body + * new DOMFBP(document.body); + * + * + * ``` + * + * + */ +export class DOMFBP extends FBP(class DUMMY { +}) { + constructor(domNode) { + super(); + this._appendFBP(domNode); + } +} +//# sourceMappingURL=DOMFBP.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/DOMFBP.js.map b/packages/furo-fbp/dist/DOMFBP.js.map new file mode 100644 index 000000000..fa5e2fac3 --- /dev/null +++ b/packages/furo-fbp/dist/DOMFBP.js.map @@ -0,0 +1 @@ +{"version":3,"file":"DOMFBP.js","sourceRoot":"./src/","sources":["DOMFBP.js"],"names":[],"mappings":"AAAA,gDAAgD;AAChD,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,MAAM,OAAO,MAAO,SAAQ,GAAG,CAAC,MAAM,KAAK;CAAG,CAAC;IAC7C,YAAY,OAAO;QACjB,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC;CACF","sourcesContent":["// eslint-disable-next-line max-classes-per-file\nimport { FBP } from './fbp.js';\n\n/**\n * DOMFBP allows you to append FBP to any dom element.\n *\n * **Usage:**\n *\n * ```html\n * \n * \n * \n * \n * Title\n * \n * \n * \n * \n * \n * \n * \n * ```\n *\n * ```js\n * import {DOMFBP} from '@furo/fbp/src/DOMFBP.js';\n *\n * // append fbp to the body\n * new DOMFBP(document.body);\n *\n *\n * ```\n *\n *\n */\nexport class DOMFBP extends FBP(class DUMMY {}) {\n constructor(domNode) {\n super();\n this._appendFBP(domNode);\n }\n}\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/FbpBreakpoints.d.ts b/packages/furo-fbp/dist/FbpBreakpoints.d.ts similarity index 93% rename from packages/furo-fbp/src/FbpBreakpoints.d.ts rename to packages/furo-fbp/dist/FbpBreakpoints.d.ts index 955cf869e..6e30efd17 100644 --- a/packages/furo-fbp/src/FbpBreakpoints.d.ts +++ b/packages/furo-fbp/dist/FbpBreakpoints.d.ts @@ -20,5 +20,5 @@ export class FbpBreakpoints { * @return {string} * @private */ - static getDomPath(node :Node) :string; + private static getDomPath; } diff --git a/packages/furo-fbp/dist/FbpBreakpoints.js b/packages/furo-fbp/dist/FbpBreakpoints.js new file mode 100644 index 000000000..7d9f4427b --- /dev/null +++ b/packages/furo-fbp/dist/FbpBreakpoints.js @@ -0,0 +1,111 @@ +/** + * + * ```json + * { + * path: "app-shell::shadow > main-stage::shadow > furo-pages > view-echo", + * wire: "--responseEcho", + * kind: "CONDITIONAL", + * condition:"data.data.message==='Ping Pong'", + * enabled : true + * },{ + * path: "app-shell::shadow > main-stage::shadow > furo-pages > view-echo", + * wire: "--responseEcho", + * kind: "CONDITIONAL", + * condition:"this.getAttribute('name')==='echo-service'",_getDomPath + * enabled : true + * }, { + * path: "app-shell::shadow > main-stage::shadow > furo-pages > view-echo", + * wire: "|--FBPready", + * kind: "TRACE", + * enabled : true + * },{ + * path: "app-shell::shadow > main-stage::shadow > furo-pages > view-echo", + * wire: "|--FBPready", + * kind: "BREAKPOINT", + * enabled : false + * } + * ``` + * @type {*[]} + */ +let Breakpoints = []; +export class FbpBreakpoints { + static SetBreakpoints(breakpoints) { + Breakpoints = breakpoints; + } + static Breakpoints() { + return Breakpoints; + } + /** + * This will get the DOM Node for a path produced by FBP._getDomPath + * @param path + * @return {*} + * @constructor + */ + static GetElementByPath(path) { + const stack = path.split(' > '); + let node = document; // start on document + stack.forEach(n => { + const t = n.split('::'); + node = node.querySelector(t[0]); + if (t[1] === 'shadow' && node.shadowRoot) { + node = node.shadowRoot; + } + }); + return node; + } + /** + * returns the querySelectorable path of the component. + * + * Note: html and body are not included. + * + * source inspired from https://stackoverflow.com/a/31281201/2946421 + * + * Even there is no ::shadow selector in DOM v1, this works fine for us + * + * @return {string} + * @private + */ + static getDomPath(el) { + const stack = []; + let isShadow = false; + while (el.parentNode != null) { + // console.log(el.nodeName); + let sibCount = 0; + let sibIndex = 0; + // get sibling indexes + // eslint-disable-next-line no-plusplus + for (let i = 0; i < el.parentNode.childNodes.length; i++) { + const sib = el.parentNode.childNodes[i]; + if (sib.nodeName === el.nodeName) { + if (sib === el) { + sibIndex = sibCount; + } + // eslint-disable-next-line no-plusplus + sibCount++; + } + } + let nodeName = el.nodeName.toLowerCase(); + if (isShadow) { + nodeName += '::shadow'; + isShadow = false; + } + if (sibCount > 1) { + stack.unshift(`${nodeName}:nth-of-type(${sibIndex + 1})`); + } + else { + stack.unshift(nodeName); + } + // eslint-disable-next-line no-param-reassign + el = el.parentNode; + if (el.nodeType === 11) { + // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType + isShadow = true; + // eslint-disable-next-line no-param-reassign + el = el.host; + } + } + stack.splice(0, 1); // remove the html element + return stack.join(' > '); + } +} +//# sourceMappingURL=FbpBreakpoints.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/FbpBreakpoints.js.map b/packages/furo-fbp/dist/FbpBreakpoints.js.map new file mode 100644 index 000000000..231d1c1f9 --- /dev/null +++ b/packages/furo-fbp/dist/FbpBreakpoints.js.map @@ -0,0 +1 @@ +{"version":3,"file":"FbpBreakpoints.js","sourceRoot":"./src/","sources":["FbpBreakpoints.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,IAAI,WAAW,GAAG,EAAE,CAAC;AAErB,MAAM,OAAO,cAAc;IACzB,MAAM,CAAC,cAAc,CAAC,WAAW;QAC/B,WAAW,GAAG,WAAW,CAAC;IAC5B,CAAC;IAED,MAAM,CAAC,WAAW;QAChB,OAAO,WAAW,CAAC;IACrB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,gBAAgB,CAAC,IAAI;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CA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AAW,EAAE,CAAC;YAEzC,IAAI,QAAQ,EAAE,CAAC;gBACb,QAAQ,IAAI,UAAU,CAAC;gBACvB,QAAQ,GAAG,KAAK,CAAC;YACnB,CAAC;YACD,IAAI,QAAQ,GAAG,CAAC,EAAE,CAAC;gBACjB,KAAK,CAAC,OAAO,CAAC,GAAG,QAAQ,gBAAgB,QAAQ,GAAG,CAAC,GAAG,CAAC,CAAC;YAC5D,CAAC;iBAAM,CAAC;gBACN,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC1B,CAAC;YACD,6CAA6C;YAC7C,EAAE,GAAG,EAAE,CAAC,UAAU,CAAC;YACnB,IAAI,EAAE,CAAC,QAAQ,KAAK,EAAE,EAAE,CAAC;gBACvB,iEAAiE;gBACjE,QAAQ,GAAG,IAAI,CAAC;gBAChB,6CAA6C;gBAC7C,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC;YACf,CAAC;QACH,CAAC;QACD,KAAK,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,2BAA2B;QAC/C,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC3B,CAAC;CACF","sourcesContent":["/**\n *\n * ```json\n * {\n * path: \"app-shell::shadow > main-stage::shadow > furo-pages > view-echo\",\n * wire: \"--responseEcho\",\n * kind: \"CONDITIONAL\",\n * condition:\"data.data.message==='Ping Pong'\",\n * enabled : true\n * },{\n * path: \"app-shell::shadow > main-stage::shadow > furo-pages > view-echo\",\n * wire: \"--responseEcho\",\n * kind: \"CONDITIONAL\",\n * condition:\"this.getAttribute('name')==='echo-service'\",_getDomPath\n * enabled : true\n * }, {\n * path: \"app-shell::shadow > main-stage::shadow > furo-pages > view-echo\",\n * wire: \"|--FBPready\",\n * kind: \"TRACE\",\n * enabled : true\n * },{\n * path: \"app-shell::shadow > main-stage::shadow > furo-pages > view-echo\",\n * wire: \"|--FBPready\",\n * kind: \"BREAKPOINT\",\n * enabled : false\n * }\n * ```\n * @type {*[]}\n */\nlet Breakpoints = [];\n\nexport class FbpBreakpoints {\n static SetBreakpoints(breakpoints) {\n Breakpoints = breakpoints;\n }\n\n static Breakpoints() {\n return Breakpoints;\n }\n\n /**\n * This will get the DOM Node for a path produced by FBP._getDomPath\n * @param path\n * @return {*}\n * @constructor\n */\n static GetElementByPath(path) {\n const stack = path.split(' > ');\n\n let node = document; // start on document\n\n stack.forEach(n => {\n const t = n.split('::');\n node = node.querySelector(t[0]);\n if (t[1] === 'shadow' && node.shadowRoot) {\n node = node.shadowRoot;\n }\n });\n return node;\n }\n\n /**\n * returns the querySelectorable path of the component.\n *\n * Note: html and body are not included.\n *\n * source inspired from https://stackoverflow.com/a/31281201/2946421\n *\n * Even there is no ::shadow selector in DOM v1, this works fine for us\n *\n * @return {string}\n * @private\n */\n static getDomPath(el) {\n const stack = [];\n let isShadow = false;\n while (el.parentNode != null) {\n // console.log(el.nodeName);\n let sibCount = 0;\n let sibIndex = 0;\n // get sibling indexes\n // eslint-disable-next-line no-plusplus\n for (let i = 0; i < el.parentNode.childNodes.length; i++) {\n const sib = el.parentNode.childNodes[i];\n if (sib.nodeName === el.nodeName) {\n if (sib === el) {\n sibIndex = sibCount;\n }\n // eslint-disable-next-line no-plusplus\n sibCount++;\n }\n }\n\n let nodeName = el.nodeName.toLowerCase();\n\n if (isShadow) {\n nodeName += '::shadow';\n isShadow = false;\n }\n if (sibCount > 1) {\n stack.unshift(`${nodeName}:nth-of-type(${sibIndex + 1})`);\n } else {\n stack.unshift(nodeName);\n }\n // eslint-disable-next-line no-param-reassign\n el = el.parentNode;\n if (el.nodeType === 11) {\n // https://developer.mozilla.org/en-US/docs/Web/API/Node/nodeType\n isShadow = true;\n // eslint-disable-next-line no-param-reassign\n el = el.host;\n }\n }\n stack.splice(0, 1); // remove the html element\n return stack.join(' > ');\n }\n}\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/LitFBP.d.ts b/packages/furo-fbp/dist/LitFBP.d.ts similarity index 100% rename from packages/furo-fbp/src/LitFBP.d.ts rename to packages/furo-fbp/dist/LitFBP.d.ts diff --git a/packages/furo-fbp/src/LitFBP.js b/packages/furo-fbp/dist/LitFBP.js similarity index 99% rename from packages/furo-fbp/src/LitFBP.js rename to packages/furo-fbp/dist/LitFBP.js index 6e4ce06a5..14bdc4de7 100644 --- a/packages/furo-fbp/src/LitFBP.js +++ b/packages/furo-fbp/dist/LitFBP.js @@ -373,7 +373,6 @@ export const LitFBP = (superClass) => { preventdefault(e) { e.preventDefault(); }, - // todo veith nachschauen ob |Event call(e) { /** * Prüfe ob die Funktion mit einem Wert aus dem Host oder mit den Details des Events ausgeführt werden soll. diff --git a/packages/furo-fbp/dist/LitFBP.js.map b/packages/furo-fbp/dist/LitFBP.js.map new file mode 100644 index 000000000..75fd60dad --- /dev/null +++ b/packages/furo-fbp/dist/LitFBP.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LitFBP.js","sourceRoot":"./src/","sources":["LitFBP.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAoC,UAAa,EAAE,EAAE;IACzE,MAAM,UAAW,SAAQ,UAAU;QAWjC,YAAY,GAAG,GAAU;YACvB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAXR,uBAAkB,GAAU,EAAE,CAAC;YAE/B,iBAAY,GAA6B,EAAE,CAAC;YAE5C,gBAAW,GAAU,EAAE,CAAC;YAExB,kBAAa,GAAY,KAAK,CAAC;YAE/B,gBAAW,GAAY,KAAK,CAAC;QAIrC,CAAC;QAED;;;WAGG;QACgB,YAAY,CAAC,kBAAkC;YAChE,6BAA6B;YAC7B,IAAI,CAAC,IAAI,CAAC,aAAa,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,EAAE,CAAC;gBACpD,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;Y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AAM,CAAC,IAAI,CAAC,CAAC;YAChC,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YACrC,kCAAkC;YAClC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBACrB,+CAA+C;gBAC/C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;oBACtB,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;oBAClB,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,OAAO,KAAK,CAAC;oBACf,CAAC;gBACH,CAAC;gBACD,qCAAqC;gBACrC,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACN,sBAAsB;gBACtB,IAAI,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;YACrB,CAAC;YACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACzB,CAAC;QAED;;;;;;;;;;;;;;WAcG;QACH,kDAAkD;QACxC,MAAM,CAAC,IAAY;YAC3B,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACpC,CAAC;KACF;IAED,oDAAoD;IACpD,OAAO,UAAkD,CAAC;AAC5D,CAAC,CAAC","sourcesContent":["/**\n * Use this to enable FBP to your lit element written in typescript.\n */\n\nimport { LitElement, PropertyValues } from \"lit\";\n// eslint-disable-next-line import/extensions\nimport {LitFBPAC} from \"./LitFBPAC\"\n\ntype Constructor = new (...args: any[]) => T;\n\nexport const LitFBP = >(superClass: T) => {\n class MixinClass extends superClass {\n private __FBPEventlistener: any[] = [];\n\n private __wirebundle: { [key: string]: [any] } = {};\n\n private __wireQueue: any[] = [];\n\n private __fbpAppended: Boolean = false;\n\n private __fbp_ready: Boolean = false;\n\n constructor(...arg: any[]) {\n super(arg[0]);\n }\n\n /**\n * Auto append fbp for lit elements\n * @private\n */\n protected override firstUpdated(_changedProperties: PropertyValues): void {\n // ensure to append only once\n if (!this.__fbpAppended && this.shadowRoot !== null) {\n this._appendFBP(this.shadowRoot);\n this.__fbpAppended = true;\n }\n\n super.firstUpdated(_changedProperties);\n }\n\n /**\n * Triggers a wire\n * @param wire (String) Name of the wire like --buttonClicked\n * @param detailData (*) data to pass\n * @private\n */\n protected _FBPTriggerWire(wire: string, detailData: any) {\n if (this.__fbp_ready) {\n if (this.__wirebundle[wire]) {\n this.__wirebundle[wire].forEach(receiver => {\n // check for hooks\n if (typeof receiver === \"function\") {\n receiver(detailData);\n } else if (\n typeof receiver.element[receiver.method] === \"function\"\n ) {\n this._call(detailData, receiver);\n } else if (receiver.property) {\n let data = detailData;\n if (receiver.path) {\n data = this._pathGet(detailData, receiver.path);\n }\n this._pathSet(receiver.element, receiver.property, data);\n } else if (receiver.element.localName.includes(\"-\")) {\n // retry call with whenDefined because sometimes the components are just not defined at the time ƒ-method is triggered\n customElements\n .whenDefined(receiver.element.localName)\n .then(() => {\n if (typeof receiver.element[receiver.method] === \"function\") {\n this._call(detailData, receiver);\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `${receiver.method} is not a method of ${receiver.element.nodeName}`,\n receiver.element\n );\n }\n });\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `${receiver.method} is not a method of ${receiver.element.nodeName}`,\n receiver.element\n );\n }\n });\n }\n } else {\n this.__enqueueTrigger(wire, detailData);\n }\n }\n\n /**\n *\n * @param detailData\n * @param receiver\n * @private\n */\n private _call(detailData: any, receiver: any) {\n let response;\n // array spreaden\n if (\n Array.isArray(detailData) &&\n receiver.element[receiver.method].length > 1\n ) {\n // eslint-disable-next-line prefer-spread\n response = receiver.element[receiver.method].apply(\n receiver.element,\n detailData\n );\n } else {\n let data = detailData;\n if (receiver.path) {\n data = this._pathGet(detailData, receiver.path);\n }\n response = receiver.element[receiver.method](data);\n }\n\n // fnret-function auslösen\n receiver.element.dispatchEvent(\n new CustomEvent(`fnret-${receiver.attrName}`, {\n composed: false,\n bubbles: false,\n detail: response,\n })\n );\n }\n\n /**\n *\n * @param wire (String) Name of the wire\n * @param cb (function) Callback function cb(detailData)\n * @param [before] (Boolean) append before the components are triggered, default is false\n * @returns {number} Index of hook\n * @private\n */\n protected _FBPAddWireHook(wire: string, cb: Function, before: boolean) {\n // eslint-disable-next-line no-param-reassign\n before = before || false;\n if (this.__wirebundle[wire]) {\n if (before) {\n this.__wirebundle[wire].unshift(cb);\n return 0;\n }\n const l = this.__wirebundle[wire].push(cb);\n return l - 1;\n }\n this.__wirebundle[wire] = [cb];\n return 1;\n }\n\n /**\n * Log all triggered wires for this component. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPTraceWires()`\n *\n *\n * @private\n */\n protected _FBPTraceWires() {\n const self = this;\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const wire in this.__wirebundle) {\n this._FBPAddWireHook(\n wire,\n (e: any) => {\n const ua = navigator.userAgent.toLowerCase();\n let agent = true;\n if (ua.indexOf(\"safari\") !== -1) {\n if (ua.indexOf(\"chrome\") > -1) {\n agent = true; // Chrome\n } else {\n agent = false; // Safari\n }\n }\n\n if (agent) {\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Trace for\", `${this.nodeName}: ${wire}`);\n // eslint-disable-next-line no-console\n console.table([{ host: self, wire, data: e }]);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Data\");\n // eslint-disable-next-line no-console\n console.log(e);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Target Elements\");\n // eslint-disable-next-line no-console\n console.table(self.__wirebundle[wire]);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Call Stack\");\n // eslint-disable-next-line no-console\n console.log(new Error().stack);\n // eslint-disable-next-line no-console\n console.groupEnd();\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n },\n true\n );\n }\n }\n\n /**\n * Get information for the triggered wire. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPDebug('--dataReceived')`\n *\n * @param wire\n * @param openDebugger opens the debugger console, so you can inspect your component.\n * @private\n */\n protected _FBPDebug(wire: string, openDebugger: boolean) {\n const self = this;\n this._FBPAddWireHook(\n wire,\n (e: any) => {\n if (openDebugger) {\n // eslint-disable-next-line no-debugger\n debugger;\n } else {\n const ua = navigator.userAgent.toLowerCase();\n let agent = true;\n if (ua.indexOf(\"safari\") !== -1) {\n if (ua.indexOf(\"chrome\") > -1) {\n agent = true; // Chrome\n } else {\n agent = false; // Safari\n }\n }\n\n if (agent) {\n // eslint-disable-next-line no-console\n console.group(\"Debug\", `${this.nodeName}: ${wire}`);\n // eslint-disable-next-line no-console\n console.group(\"Target Elements\");\n // eslint-disable-next-line no-console\n console.table(self.__wirebundle[wire]);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Data\");\n // eslint-disable-next-line no-console\n console.log(e);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Call Stack\");\n // eslint-disable-next-line no-console\n console.log(new Error().stack);\n // eslint-disable-next-line no-console\n console.groupEnd();\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n }\n },\n true\n );\n }\n\n /**\n *\n * @param str\n * @return {*}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n private __toCamelCase(str: string) {\n return str.replace(/-([a-z])/g, g => g[1].toUpperCase());\n }\n\n /**\n * parses the dom for flowbased programming tags\n * @param dom dom node\n * @private\n */\n private _appendFBP(dom: ShadowRoot) {\n const self = this;\n const wirebundle = this.__wirebundle;\n // get all elements which live in the host\n const nl = dom.querySelectorAll(\"*\");\n const l = nl.length - 1;\n\n // eslint-disable-next-line func-names\n const _collectReceivers = (element: Element, i: number, attr: string) => {\n // collect receiver\n element.attributes[i].value.split(\",\").forEach(w => {\n const r = this.__resolveWireAndPath(w);\n // create empty if not exist\n if (!wirebundle[r.receivingWire]) {\n // @ts-ignore\n wirebundle[r.receivingWire] = [];\n }\n wirebundle[r.receivingWire].push({\n element,\n method: this.__toCamelCase(attr),\n attrName: attr,\n path: r.path,\n });\n });\n };\n // eslint-disable-next-line func-names\n const _collectPropertySetters = (\n element: Element,\n i: number,\n property: string\n ) => {\n // split multiple wires\n element.attributes[i].value.split(\",\").forEach((w: string) => {\n const r = this.__resolveWireAndPath(w);\n // create empty if not exist\n if (!wirebundle[r.receivingWire]) {\n // @ts-ignore\n wirebundle[r.receivingWire] = [];\n }\n wirebundle[r.receivingWire].push({\n element,\n property: this.__toCamelCase(property),\n path: r.path,\n });\n });\n };\n\n // eslint-disable-next-line func-names\n const _extractEventWires = (fwire: string) => {\n let wire;\n\n const trimmedWire = fwire.trim();\n\n let type = \"call\";\n if (trimmedWire.startsWith(\"((\")) {\n wire = trimmedWire.substring(2, trimmedWire.length - 2);\n type = \"setValue\";\n } else if (trimmedWire.startsWith(\"-^\")) {\n wire = trimmedWire.substring(2);\n type = \"fireOnHost\";\n } else if (trimmedWire.startsWith(\"^\")) {\n wire = trimmedWire.substring(1);\n type = \"fire\";\n if (trimmedWire.startsWith(\"^^\")) {\n wire = trimmedWire.substring(2);\n type = \"fireBubble\";\n }\n } else if (trimmedWire === \":STOP\") {\n type = \"stop\";\n wire = \"stop\";\n } else if (trimmedWire === \":PREVENTDEFAULT\") {\n type = \"preventdefault\";\n wire = \"preventdefault\";\n } else {\n wire = trimmedWire;\n type = \"call\";\n }\n return { type, wire };\n };\n\n // eslint-disable-next-line no-plusplus\n for (let x = l; x >= 0; --x) {\n const element = nl[x];\n\n // skip template tags\n if (element.tagName === \"TEMPLATE\") {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n for (let i = 0; i < element.attributes.length; i += 1) {\n // collect receiving tags\n if (element.attributes[i].name.startsWith(\"fn-\")) {\n const attr = element.attributes[i].name.substring(3);\n _collectReceivers.call(this, element, i, attr);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // collect sending tags\n if (element.attributes[i].name.startsWith(\"at-\")) {\n const eventname = element.attributes[i].name.substring(3);\n const fwires = element.attributes[i].value;\n fwires.split(\",\").forEach(fwire => {\n const __ret = _extractEventWires(fwire);\n // eslint-disable-next-line no-use-before-define\n registerEvent(eventname, __ret.type, __ret.wire, element);\n });\n // eslint-disable-next-line no-continue\n continue;\n }\n // collect data property setter receiver\n if (element.attributes[i].name.startsWith(\"set-\")) {\n const property = element.attributes[i].name.substring(4);\n _collectPropertySetters.call(this, element, i, property);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n }\n }\n\n /**\n * register event on current element\n * @param eventname\n * @param type\n * @param wire\n * @private\n */\n function registerEvent(\n eventname: string,\n type: string,\n wire: string,\n element: Element\n ) {\n // find properties in wire\n // eslint-disable-next-line no-useless-escape\n const match = wire.match(/([a-z0-9\\-_*\\.]+)/gi);\n\n const handler: Record = {\n // prevent default and stop propagation\n stop(e: Event) {\n e.stopPropagation();\n },\n preventdefault(e: Event) {\n e.preventDefault();\n },\n call(e: CustomEvent) {\n /**\n * Prüfe ob die Funktion mit einem Wert aus dem Host oder mit den Details des Events ausgeführt werden soll.\n * --wire(hostName) ==> wirft this.hostName in die Funktion sonst wird e.detail verwendet\n *\n */\n\n let effectiveWire = wire;\n let detailData = e.detail;\n if (match !== null && match.length > 1) {\n // --wireName(*) sends the raw event\n // --wireName(*.mouseX) sends property mouseX of the event\n\n if (match[1].startsWith(\"*\")) {\n if (match[1].length === 1) {\n // send raw event\n detailData = e;\n } else {\n // send event subprop with *.notDetail.xxx\n detailData = self._pathGet(\n e,\n match[1].substring(2, match[1].length)\n );\n }\n } else {\n // send host property\n detailData = self._pathGet(self, match[1]);\n }\n // eslint-disable-next-line prefer-destructuring\n effectiveWire = match[0];\n }\n self._FBPTriggerWire(effectiveWire, detailData);\n },\n\n fire(e: CustomEvent) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n\n let edetail: any;\n // send details with *.sub or *\n if (prop.startsWith(\"*\")) {\n if (prop.length === 1) {\n // send raw event\n edetail = e;\n } else {\n edetail = self._pathGet(e, prop.substring(2));\n }\n } else {\n edetail = self._pathGet(self, prop);\n }\n\n const customEvent = new CustomEvent(theEvent, {\n composed: false,\n bubbles: true,\n detail: edetail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n } else {\n const customEvent = new CustomEvent(wire, {\n composed: false,\n bubbles: true,\n detail: e.detail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n }\n },\n\n fireOnHost(e: CustomEvent) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n let edetail: any;\n\n // send details with *.sub or *\n if (prop.startsWith(\"*\")) {\n if (prop.length === 1) {\n // send raw event\n edetail = e;\n } else {\n edetail = self._pathGet(e, prop.substring(2));\n }\n } else {\n edetail = self._pathGet(self, prop);\n }\n\n const customEvent = new CustomEvent(theEvent, {\n composed: false,\n bubbles: true,\n detail: edetail,\n });\n\n self.dispatchEvent(customEvent);\n } else {\n const customEvent = new CustomEvent(wire, {\n composed: false,\n bubbles: true,\n detail: e.detail,\n });\n\n self.dispatchEvent(customEvent);\n }\n },\n\n fireBubble(e: CustomEvent) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n let edetail: any;\n\n // send details with *.sub or *\n\n if (prop.startsWith(\"*\")) {\n if (prop.length === 1) {\n // send raw event\n edetail = e;\n } else {\n edetail = self._pathGet(e, prop.substring(2));\n }\n } else {\n edetail = self._pathGet(self, prop);\n }\n\n const customEvent = new CustomEvent(theEvent, {\n composed: true,\n bubbles: true,\n detail: edetail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n } else {\n const customEvent = new CustomEvent(wire, {\n composed: true,\n bubbles: true,\n detail: e.detail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n }\n },\n setValue(e: any) {\n self._pathSet(self, wire, e.detail);\n // self.set(wire, e.detail, self);\n },\n };\n\n element.addEventListener(eventname, handler[type]);\n self.__FBPEventlistener.push({\n element,\n event: eventname,\n handler: handler[type],\n });\n }\n\n // queueing for _FBPTriggerWire\n if (!this.__fbp_ready) {\n this._FBPReady();\n\n const queuelength = this.__wireQueue.length;\n for (let i = 0; i < queuelength; i += 1) {\n const t = this.__wireQueue.shift();\n this._FBPTriggerWire(t.w, t.d);\n }\n }\n }\n\n /**\n * Livecycle method\n * This method is called, when the wires are ready.\n * And triggers the `|--FBPready` wire. This does *not* respect a lit updateComplete\n * @private\n */\n protected _FBPReady() {\n this.__fbp_ready = true;\n this._FBPTriggerWire(\"|--FBPready\", this);\n }\n\n /**\n *\n * @param wire\n * @param detailData\n * @private\n */\n private __enqueueTrigger(wire: string, detailData: any) {\n this.__wireQueue.push({ w: wire, d: detailData });\n }\n\n /**\n *\n * @param w\n * @return {{path, receivingWire}}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n private __resolveWireAndPath(w: string) {\n // finde --wire(*.xx.yy) => group1 = --wire group2 = xx.yy\n\n // eslint-disable-next-line no-useless-escape\n const match = w.trim().match(/(^[^\\(]*)\\(?\\*?\\.?([^\\)]*)/);\n\n // @ts-ignore\n const receivingWire = match[1];\n // @ts-ignore\n const path = match[2];\n\n return { receivingWire, path };\n }\n\n /**\n * Reads a value from a path. If any sub-property in the path is `undefined`,\n * this method returns `undefined` (will never throw.\n *\n * @param {Object} root Object from which to dereference path from\n * @param {string | !Array} path Path to read\n * @return {*} Value at path, or `undefined` if the path could not be fully dereferenced.\n * @protected\n */\n protected _pathGet(root: any, path: string) {\n let prop = root;\n const parts = this._split(path);\n // Loop over path parts[0..n-1] and dereference\n for (let i = 0; i < parts.length; i += 1) {\n if (!prop) {\n return false;\n }\n const part = parts[i];\n prop = prop[part];\n }\n\n return prop;\n }\n\n /**\n * Sets a value to a path. If any sub-property in the path is `undefined`,\n * this method will no-op.\n *\n * @param {Object} root Object from which to dereference path from\n * @param {string | !Array} path Path to set\n * @param {*} value Value to set to path\n * @private\n */\n protected _pathSet(root: any, path: string, value: any) {\n let prop = root;\n const parts = this._split(path);\n const last = parts[parts.length - 1];\n // used for @-event=\"((prop.sub))\"\n if (parts.length > 1) {\n // Loop over path parts[0..n-2] and dereference\n for (let i = 0; i < parts.length - 1; i += 1) {\n const part = parts[i];\n prop = prop[part];\n if (!prop) {\n return false;\n }\n }\n // Set value to object at end of path\n prop[last] = value;\n } else {\n // Simple property set\n prop[path] = value;\n }\n return parts.join(\".\");\n }\n\n /**\n * Splits a path into an array of property names. Accepts either arrays\n * of path parts or strings.\n *\n * Example:\n *\n * ```\n * split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz']\n * split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz']\n * ```\n *\n * @param {string | !Array} path Input path\n * @suppress {checkTypes}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n protected _split(path: string) {\n return path.toString().split(\".\");\n }\n }\n\n // Cast return type to the superClass type passed in\n return MixinClass as unknown as Constructor & T;\n};\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/LitFBPAC.d.ts b/packages/furo-fbp/dist/LitFBPAC.d.ts similarity index 100% rename from packages/furo-fbp/src/LitFBPAC.d.ts rename to packages/furo-fbp/dist/LitFBPAC.d.ts diff --git a/packages/furo-fbp/src/LitFBPAC.js b/packages/furo-fbp/dist/LitFBPAC.js similarity index 100% rename from packages/furo-fbp/src/LitFBPAC.js rename to packages/furo-fbp/dist/LitFBPAC.js diff --git a/packages/furo-fbp/src/LitFBPAC.js.map b/packages/furo-fbp/dist/LitFBPAC.js.map similarity index 100% rename from packages/furo-fbp/src/LitFBPAC.js.map rename to packages/furo-fbp/dist/LitFBPAC.js.map diff --git a/packages/furo-fbp/dist/empty-fbp-node.d.ts b/packages/furo-fbp/dist/empty-fbp-node.d.ts new file mode 100644 index 000000000..b8bcf1991 --- /dev/null +++ b/packages/furo-fbp/dist/empty-fbp-node.d.ts @@ -0,0 +1,32 @@ +declare const EmptyFBPNode_base: { + new (): { + [x: string]: any; + __FBPEventlistener: any[]; + __wirebundle: {}; + __wireQueue: any[]; + firstUpdated(): void; + __fbpAppended: boolean | undefined; + _FBPTriggerWire(wire: any, detailData: any): void; + __domPath: string | undefined; + _call(detailData: any, receiver: any): void; + _FBPAddWireHook(wire: any, cb: any, before?: any): number; + _FBPTraceWires(): void; + _FBPDebug(wire: any, openDebugger: any): void; + __toCamelCase(str: any): any; + _appendFBP(dom: any): void; + _FBPReady(): void; + __fbp_ready: boolean | undefined; + __enqueueTrigger(wire: any, detailData: any): void; + __resolveWireAndPath(w: any): { + path: any; + receivingWire: any; + }; + _pathGet(root: Object, path: string | (string | number)[]): any; + _pathSet(root: Object, path: string | (string | number)[], value: any): string | boolean; + _split(path: string | (string | number)[]): string[]; + }; + [x: string]: any; +}; +export class EmptyFBPNode extends EmptyFBPNode_base { +} +export {}; diff --git a/packages/furo-fbp/dist/empty-fbp-node.js b/packages/furo-fbp/dist/empty-fbp-node.js new file mode 100644 index 000000000..3e85cc91a --- /dev/null +++ b/packages/furo-fbp/dist/empty-fbp-node.js @@ -0,0 +1,6 @@ +// empty fbp element handler to have fbp scope +import { FBP } from './fbp.js'; +export class EmptyFBPNode extends FBP(HTMLElement) { +} +window.customElements.define('empty-fbp-node', EmptyFBPNode); +//# sourceMappingURL=empty-fbp-node.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/empty-fbp-node.js.map b/packages/furo-fbp/dist/empty-fbp-node.js.map new file mode 100644 index 000000000..81a4e299e --- /dev/null +++ b/packages/furo-fbp/dist/empty-fbp-node.js.map @@ -0,0 +1 @@ +{"version":3,"file":"empty-fbp-node.js","sourceRoot":"./src/","sources":["empty-fbp-node.js"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAE/B,MAAM,OAAO,YAAa,SAAQ,GAAG,CAAC,WAAW,CAAC;CAAG;AACrD,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,gBAAgB,EAAE,YAAY,CAAC,CAAC","sourcesContent":["// empty fbp element handler to have fbp scope\nimport { FBP } from './fbp.js';\n\nexport class EmptyFBPNode extends FBP(HTMLElement) {}\nwindow.customElements.define('empty-fbp-node', EmptyFBPNode);\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/fbp.d.ts b/packages/furo-fbp/dist/fbp.d.ts similarity index 93% rename from packages/furo-fbp/src/fbp.d.ts rename to packages/furo-fbp/dist/fbp.d.ts index 203c3291f..5c91342fc 100644 --- a/packages/furo-fbp/src/fbp.d.ts +++ b/packages/furo-fbp/dist/fbp.d.ts @@ -24,7 +24,7 @@ export function FBP(superClass: any): { * @private */ firstUpdated(): void; - __fbpAppended: boolean; + __fbpAppended: boolean | undefined; /** * Triggers a wire * @param wire (String) Name of the wire like --buttonClicked @@ -32,7 +32,7 @@ export function FBP(superClass: any): { * @private */ _FBPTriggerWire(wire: any, detailData: any): void; - __domPath: any; + __domPath: string | undefined; /** * * @param detailData @@ -86,7 +86,7 @@ export function FBP(superClass: any): { * @private */ _FBPReady(): void; - __fbp_ready: boolean; + __fbp_ready: boolean | undefined; /** * * @param wire @@ -113,7 +113,7 @@ export function FBP(superClass: any): { * @return {*} Value at path, or `undefined` if the path could not be fully dereferenced. * @private */ - _pathGet(root: any, path: string | Array): any; + _pathGet(root: Object, path: string | Array): any; /** * Sets a value to a path. If any sub-property in the path is `undefined`, * this method will no-op. @@ -124,7 +124,7 @@ export function FBP(superClass: any): { * @return {string | boolean} The normalized version of the input path, return false if no prop * @private */ - _pathSet(root: any, path: string | Array, value: any): string | boolean; + _pathSet(root: Object, path: string | Array, value: any): string | boolean; /** * Splits a path into an array of property names. Accepts either arrays * of path parts or strings. diff --git a/packages/furo-fbp/dist/fbp.js b/packages/furo-fbp/dist/fbp.js new file mode 100644 index 000000000..cdaf3b4a8 --- /dev/null +++ b/packages/furo-fbp/dist/fbp.js @@ -0,0 +1,821 @@ +/** + * furo-fbp base class + * + * [read the guide](https://fbp.furo.pro/) + * + * + * ### **_FBPTriggerWire** + * **_FBPTriggerWire**(*wire* `` *detailData* `` ) ⟹ `void` + * + * Triggers a wire + * + * - wire (String) Name of the wire like --buttonClicked + * - detailData (*) data to pass + * + * + * ### **_FBPAddWireHook** + * **_FBPAddWireHook**(*wire* `` *cb* `` *before* `` ) ⟹ `number` + * + * + * + * - wire (String) Name of the wire + * - cb (function) Callback function cb(detailData) + * - before (Boolean) append before the components are triggered, default is false + * + * + * ### **_FBPTraceWires** + * **_FBPTraceWires**() ⟹ `void` + * + * Log all triggered wires for this component. This function may help you at debugging. + * Select your element in the dev console and call `$0._FBPTraceWires()` + * + * + * + * ### **_FBPDebug** + * **_FBPDebug**(*wire* `` *openDebugger* `` ) ⟹ `void` + * + * Get information for the triggered wire. This function may help you at debugging. + * Select your element in the dev console and call `$0._FBPDebug('--dataReceived')` + * + * - wire + * - openDebugger opens the debugger console, so you can inspect your component. + * + * + * + * @summary Please read the guide for a better understanding + * @polymer + * @mixinFunction FBP + */ +import { FbpBreakpoints } from './FbpBreakpoints.js'; +export const FBP = superClass => +/** + * @polymerMixinClass + */ +class extends superClass { + constructor() { + super(); + /** + * used to store the listeners + * @type {*[]} + * @private + */ + this.__FBPEventlistener = []; + /** + * + * @type {{}} + * @private + */ + this.__wirebundle = {}; + /** + * + * @type {*[]} + * @private + */ + this.__wireQueue = []; + } + /** + * Auto append fbp for lit elements + * @private + */ + firstUpdated() { + // ensure to append only once + if (!this.__fbpAppended) { + this._appendFBP(this.shadowRoot); + this.__fbpAppended = true; + } + super.firstUpdated(); + } + /** + * Triggers a wire + * @param wire (String) Name of the wire like --buttonClicked + * @param detailData (*) data to pass + * @private + */ + _FBPTriggerWire(wire, detailData) { + if (this.__fbp_ready) { + /** + * Check breakpoints, this slows down every wire (if you have set breakpoints). + * While debuging, this is absolute OK. + */ + FbpBreakpoints.Breakpoints().forEach(breakpoint => { + // start with cheapest + if (breakpoint.enabled && + breakpoint.wire === wire && + breakpoint.path.endsWith(this.tagName.toLowerCase())) { + if (this.__domPath === undefined) { + this.__domPath = FbpBreakpoints.getDomPath(this); + } + if (this.__domPath === breakpoint.path) { + // eslint-disable-next-line default-case + switch (breakpoint.kind) { + case 'BREAKPOINT': + // eslint-disable-next-line no-unused-vars,no-case-declarations + const tagName = this.tagName.toLowerCase(); + // eslint-disable-next-line no-unused-expressions + wire; + // eslint-disable-next-line no-unused-expressions + detailData; + // eslint-disable-next-line no-case-declarations,no-unused-vars + const domnode = FbpBreakpoints.GetElementByPath(breakpoint.path); + // eslint-disable-next-line no-case-declarations,no-unused-vars + const targets = this.__wirebundle[wire]; + // eslint-disable-next-line no-debugger + debugger; + break; + case 'CONDITIONAL': + // eslint-disable-next-line no-case-declarations,no-new-func + const c = new Function('data', `return (${breakpoint.condition})`); + if (c.call(this, detailData)) { + // eslint-disable-next-line no-case-declarations,no-unused-vars + const { condition } = breakpoint; + // eslint-disable-next-line no-case-declarations,no-unused-vars,no-shadow + const tagName = this.tagName.toLowerCase(); + // eslint-disable-next-line no-case-declarations,no-unused-vars,no-unused-expressions + wire; + // eslint-disable-next-line no-case-declarations,no-unused-vars,no-unused-expressions + detailData; + // eslint-disable-next-line no-unused-vars,no-shadow + const domnode = FbpBreakpoints.GetElementByPath(breakpoint.path); + // eslint-disable-next-line no-unused-vars,no-shadow + const targets = this.__wirebundle[wire]; + // eslint-disable-next-line no-debugger + debugger; + } + break; + case 'TRACE': + // eslint-disable-next-line no-case-declarations + const ua = navigator.userAgent.toLowerCase(); + // eslint-disable-next-line no-case-declarations + let agent = true; + if (ua.indexOf('safari') !== -1) { + if (ua.indexOf('chrome') > -1) { + agent = true; // Chrome + } + else { + agent = false; // Safari + } + } + if (agent) { + // eslint-disable-next-line no-console + console.group('Trace', `${this.nodeName}: ${wire}`); + // eslint-disable-next-line no-console + console.log(FbpBreakpoints.GetElementByPath(breakpoint.path)); + // eslint-disable-next-line no-console + console.group('Target Elements'); + // eslint-disable-next-line no-console + console.table(this.__wirebundle[wire]); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupCollapsed('Data'); + // eslint-disable-next-line no-console + console.log(detailData); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupCollapsed('Call Stack'); + // eslint-disable-next-line no-console + console.log(new Error().stack); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupEnd(); + } + break; + } + } + } + }); + if (this.__wirebundle[wire]) { + this.__wirebundle[wire].forEach(receiver => { + // check for hooks + if (typeof receiver === 'function') { + receiver(detailData); + } + else if (typeof receiver.element[receiver.method] === 'function') { + this._call(detailData, receiver); + } + else if (receiver.property) { + let data = detailData; + if (receiver.path) { + data = this._pathGet(detailData, receiver.path); + } + this._pathSet(receiver.element, receiver.property, data); + } + else if (receiver.element.localName.includes('-')) { + // retry call with whenDefined because sometimes the components are just not defined at the time ƒ-method is triggered + customElements + .whenDefined(receiver.element.localName) + .then(() => { + if (typeof receiver.element[receiver.method] === 'function') { + this._call(detailData, receiver); + } + else { + // eslint-disable-next-line no-console + console.warn(`${receiver.method} is not a method of ${receiver.element.nodeName}`, receiver.element); + } + }); + } + else { + // eslint-disable-next-line no-console + console.warn(`${receiver.method} is not a method of ${receiver.element.nodeName}`, receiver.element); + } + }); + } + } + else { + this.__enqueueTrigger(wire, detailData); + } + } + /** + * + * @param detailData + * @param receiver + * @private + */ + _call(detailData, receiver) { + let response; + // array spreaden + if (Array.isArray(detailData) && + receiver.element[receiver.method].length > 1) { + // eslint-disable-next-line prefer-spread + response = receiver.element[receiver.method].apply(receiver.element, detailData); + } + else { + let data = detailData; + if (receiver.path) { + data = this._pathGet(detailData, receiver.path); + } + response = receiver.element[receiver.method](data); + } + // fnret-function auslösen + const fnret = new Event(`fnret-${receiver.attrName}`, { + composed: false, + bubbles: false, + }); + fnret.detail = response; + receiver.element.dispatchEvent(fnret); + // @-ƒ-function auslösen + const customEvent = new Event(`ƒ-${receiver.attrName}`, { + composed: false, + bubbles: false, + }); + customEvent.detail = response; + receiver.element.dispatchEvent(customEvent); + } + /** + * + * @param wire (String) Name of the wire + * @param cb (function) Callback function cb(detailData) + * @param [before] (Boolean) append before the components are triggered, default is false + * @returns {number} Index of hook + * @private + */ + _FBPAddWireHook(wire, cb, before) { + // eslint-disable-next-line no-param-reassign + before = before || false; + if (this.__wirebundle[wire]) { + if (before) { + this.__wirebundle[wire].unshift(cb); + return 0; + } + const l = this.__wirebundle[wire].push(cb); + return l - 1; + } + this.__wirebundle[wire] = [cb]; + return 1; + } + /** + * Log all triggered wires for this component. This function may help you at debugging. + * Select your element in the dev console and call `$0._FBPTraceWires()` + * + * + * @private + */ + _FBPTraceWires() { + const self = this; + // eslint-disable-next-line guard-for-in,no-restricted-syntax + for (const wire in this.__wirebundle) { + this._FBPAddWireHook(wire, e => { + const ua = navigator.userAgent.toLowerCase(); + let agent = true; + if (ua.indexOf('safari') !== -1) { + if (ua.indexOf('chrome') > -1) { + agent = true; // Chrome + } + else { + agent = false; // Safari + } + } + if (agent) { + // eslint-disable-next-line no-console + console.groupCollapsed('Trace for', `${this.nodeName}: ${wire}`); + // eslint-disable-next-line no-console + console.table([{ host: self, wire, data: e }]); + // eslint-disable-next-line no-console + console.groupCollapsed('Data'); + // eslint-disable-next-line no-console + console.log(e); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupCollapsed('Target Elements'); + // eslint-disable-next-line no-console + console.table(self.__wirebundle[wire]); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupCollapsed('Call Stack'); + // eslint-disable-next-line no-console + console.log(new Error().stack); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupEnd(); + } + }, true); + } + } + /** + * Get information for the triggered wire. This function may help you at debugging. + * Select your element in the dev console and call `$0._FBPDebug('--dataReceived')` + * + * @param wire + * @param openDebugger opens the debugger console, so you can inspect your component. + * @private + */ + _FBPDebug(wire, openDebugger) { + const self = this; + this._FBPAddWireHook(wire, e => { + if (openDebugger) { + // eslint-disable-next-line no-debugger + debugger; + } + else { + const ua = navigator.userAgent.toLowerCase(); + let agent = true; + if (ua.indexOf('safari') !== -1) { + if (ua.indexOf('chrome') > -1) { + agent = true; // Chrome + } + else { + agent = false; // Safari + } + } + if (agent) { + // eslint-disable-next-line no-console + console.group('Debug', `${this.nodeName}: ${wire}`); + // eslint-disable-next-line no-console + console.group('Target Elements'); + // eslint-disable-next-line no-console + console.table(self.__wirebundle[wire]); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupCollapsed('Data'); + // eslint-disable-next-line no-console + console.log(e); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupCollapsed('Call Stack'); + // eslint-disable-next-line no-console + console.log(new Error().stack); + // eslint-disable-next-line no-console + console.groupEnd(); + // eslint-disable-next-line no-console + console.groupEnd(); + } + } + }, true); + } + /** + * + * @param str + * @return {*} + * @private + */ + // eslint-disable-next-line class-methods-use-this + __toCamelCase(str) { + return str.replace(/-([a-z])/g, g => g[1].toUpperCase()); + } + /** + * parses the dom for flowbased programming tags + * @param dom dom node + * @private + */ + _appendFBP(dom) { + const self = this; + const wirebundle = this.__wirebundle; + // get all elements which live in the host + const nl = dom.querySelectorAll('*'); + const l = nl.length - 1; + // eslint-disable-next-line func-names + const _collectReceivers = function (element, i, attr) { + // collect receiver + element.attributes[i].value.split(',').forEach(w => { + const r = this.__resolveWireAndPath(w); + // create empty if not exist + if (!wirebundle[r.receivingWire]) { + wirebundle[r.receivingWire] = []; + } + wirebundle[r.receivingWire].push({ + element, + method: this.__toCamelCase(attr), + attrName: attr, + path: r.path, + }); + }); + }; + // eslint-disable-next-line func-names + const _collectPropertySetters = function (element, i, property) { + // split multiple wires + element.attributes[i].value.split(',').forEach(w => { + const r = this.__resolveWireAndPath(w); + // create empty if not exist + if (!wirebundle[r.receivingWire]) { + wirebundle[r.receivingWire] = []; + } + wirebundle[r.receivingWire].push({ + element, + property: this.__toCamelCase(property), + path: r.path, + }); + }); + }; + // eslint-disable-next-line func-names + const _extractEventWires = function (fwire) { + let wire; + const trimmedWire = fwire.trim(); + let type = 'call'; + if (trimmedWire.startsWith('((')) { + wire = trimmedWire.substring(2, trimmedWire.length - 2); + type = 'setValue'; + } + else if (trimmedWire.startsWith('-^')) { + wire = trimmedWire.substring(2); + type = 'fireOnHost'; + } + else if (trimmedWire.startsWith('^')) { + wire = trimmedWire.substring(1); + type = 'fire'; + if (trimmedWire.startsWith('^^')) { + wire = trimmedWire.substring(2); + type = 'fireBubble'; + } + } + else if (trimmedWire === ':STOP') { + type = 'stop'; + wire = 'stop'; + } + else if (trimmedWire === ':PREVENTDEFAULT') { + type = 'preventdefault'; + wire = 'preventdefault'; + } + else { + wire = trimmedWire; + type = 'call'; + } + return { type, wire }; + }; + // eslint-disable-next-line no-plusplus + for (let x = l; x >= 0; --x) { + const element = nl[x]; + // skip template tags + if (element.tagName === 'TEMPLATE') { + // eslint-disable-next-line no-continue + continue; + } + for (let i = 0; i < element.attributes.length; i += 1) { + // collect receiving tags + if (element.attributes[i].name.startsWith('fn-')) { + const attr = element.attributes[i].name.substring(3); + _collectReceivers.call(this, element, i, attr); + // eslint-disable-next-line no-continue + continue; + } + // collect sending tags + if (element.attributes[i].name.startsWith('at-')) { + const eventname = element.attributes[i].name.substring(3); + const fwires = element.attributes[i].value; + fwires.split(',').forEach(fwire => { + const __ret = _extractEventWires(fwire); + // eslint-disable-next-line no-use-before-define + registerEvent(eventname, __ret.type, __ret.wire, element); + }); + // eslint-disable-next-line no-continue + continue; + } + // collect data property setter receiver + if (element.attributes[i].name.startsWith('set-')) { + const property = element.attributes[i].name.substring(4); + _collectPropertySetters.call(this, element, i, property); + // eslint-disable-next-line no-continue + continue; + } + // collect data property receiver + if (element.attributes[i].name.startsWith('ƒ-.')) { + const property = element.attributes[i].name.substring(3); + _collectPropertySetters.call(this, element, i, property); + // eslint-disable-next-line no-continue + continue; + } + // collect receiving tags + if (element.attributes[i].name.startsWith('ƒ-')) { + const attr = element.attributes[i].name.substring(2); + _collectReceivers.call(this, element, i, attr); + // eslint-disable-next-line no-continue + continue; + } + // collect sending tags + if (element.attributes[i].name.startsWith('@-')) { + const eventname = element.attributes[i].name.substring(2); + const fwires = element.attributes[i].value; + fwires.split(',').forEach(fwire => { + const __ret = _extractEventWires(fwire); + // eslint-disable-next-line no-use-before-define + registerEvent(eventname, __ret.type, __ret.wire, element); + }); + // eslint-disable-next-line no-continue + continue; + } + } + } + /** + * register event on current element + * @param eventname + * @param type + * @param wire + * @private + */ + function registerEvent(eventname, type, wire, element) { + // find properties in wire + // eslint-disable-next-line no-useless-escape + const match = wire.match(/([a-z0-9\-_*\.]+)/gi); + const handler = { + // prevent default and stop propagation + stop(e) { + e.stopPropagation(); + }, + preventdefault(e) { + e.preventDefault(); + }, + call(e) { + /** + * Prüfe ob die Funktion mit einem Wert aus dem Host oder mit den Details des Events ausgeführt werden soll. + * --wire(hostName) ==> wirft this.hostName in die Funktion sonst wird e.detail verwendet + * + */ + let effectiveWire = wire; + let detailData = e.detail; + if (match !== null && match.length > 1) { + // --wireName(*) sends the raw event + // --wireName(*.mouseX) sends property mouseX of the event + if (match[1].startsWith('*')) { + if (match[1].length === 1) { + // send raw event + detailData = e; + } + else { + // send event subprop with *.notDetail.xxx + detailData = self._pathGet(e, match[1].substring(2, match[1].length)); + } + } + else { + // send host property + detailData = self._pathGet(self, match[1]); + } + // eslint-disable-next-line prefer-destructuring + effectiveWire = match[0]; + } + self._FBPTriggerWire(effectiveWire, detailData); + }, + fire(e) { + if (match !== null && match.length > 1) { + const prop = match[1]; + const theEvent = match[0]; + const customEvent = new Event(theEvent, { + composed: false, + bubbles: true, + }); + // send details with *.sub or * + if (prop.startsWith('*')) { + if (prop.length === 1) { + // send raw event + customEvent.detail = e; + } + else { + customEvent.detail = self._pathGet(e, prop.substring(2)); + } + } + else { + customEvent.detail = self._pathGet(self, prop); + } + e.currentTarget.dispatchEvent(customEvent); + } + else { + const customEvent = new Event(wire, { + composed: false, + bubbles: true, + }); + customEvent.detail = e.detail; + e.currentTarget.dispatchEvent(customEvent); + } + }, + fireOnHost(e) { + if (match !== null && match.length > 1) { + const prop = match[1]; + const theEvent = match[0]; + const customEvent = new Event(theEvent, { + composed: false, + bubbles: true, + }); + // send details with *.sub or * + if (prop.startsWith('*')) { + if (prop.length === 1) { + // send raw event + customEvent.detail = e; + } + else { + customEvent.detail = self._pathGet(e, prop.substring(2)); + } + } + else { + customEvent.detail = self._pathGet(self, prop); + } + self.dispatchEvent(customEvent); + } + else { + const customEvent = new Event(wire, { + composed: false, + bubbles: true, + }); + customEvent.detail = e.detail; + self.dispatchEvent(customEvent); + } + }, + fireBubble(e) { + if (match !== null && match.length > 1) { + const prop = match[1]; + const theEvent = match[0]; + const customEvent = new Event(theEvent, { + composed: true, + bubbles: true, + }); + // send details with *.sub or * + if (prop.startsWith('*')) { + if (prop.length === 1) { + // send raw event + customEvent.detail = e; + } + else { + customEvent.detail = self._pathGet(e, prop.substring(2)); + } + } + else { + customEvent.detail = self._pathGet(self, prop); + } + e.currentTarget.dispatchEvent(customEvent); + } + else { + const customEvent = new Event(wire, { + composed: true, + bubbles: true, + }); + customEvent.detail = e.detail; + e.currentTarget.dispatchEvent(customEvent); + } + }, + setValue(e) { + self._pathSet(self, wire, e.detail); + // self.set(wire, e.detail, self); + }, + }; + element.addEventListener(eventname, handler[type]); + self.__FBPEventlistener.push({ + element, + event: eventname, + handler: handler[type], + }); + } + // queueing for _FBPTriggerWire + if (!this.__fbp_ready) { + this._FBPReady(); + const queuelength = this.__wireQueue.length; + for (let i = 0; i < queuelength; i += 1) { + const t = this.__wireQueue.shift(); + this._FBPTriggerWire(t.w, t.d); + } + } + } + /** + * Livecycle method + * This method is called, when the wires are ready. + * And triggers the `|--FBPready` wire. This does *not* respect a lit updateComplete + * @private + */ + _FBPReady() { + this.__fbp_ready = true; + this._FBPTriggerWire('|--FBPready', this); + } + /** + * + * @param wire + * @param detailData + * @private + */ + __enqueueTrigger(wire, detailData) { + this.__wireQueue.push({ w: wire, d: detailData }); + } + /** + * + * @param w + * @return {{path, receivingWire}} + * @private + */ + // eslint-disable-next-line class-methods-use-this + __resolveWireAndPath(w) { + // finde --wire(*.xx.yy) => group1 = --wire group2 = xx.yy + // eslint-disable-next-line no-useless-escape + const match = w.trim().match(/(^[^\(]*)\(?\*?\.?([^\)]*)/); + const receivingWire = match[1]; + const path = match[2]; + return { receivingWire, path }; + } + /** + * Reads a value from a path. If any sub-property in the path is `undefined`, + * this method returns `undefined` (will never throw. + * + * @param {Object} root Object from which to dereference path from + * @param {string | !Array} path Path to read + * @return {*} Value at path, or `undefined` if the path could not be fully dereferenced. + * @private + */ + _pathGet(root, path) { + let prop = root; + const parts = this._split(path); + // Loop over path parts[0..n-1] and dereference + for (let i = 0; i < parts.length; i += 1) { + if (!prop) { + return false; + } + const part = parts[i]; + prop = prop[part]; + } + return prop; + } + /** + * Sets a value to a path. If any sub-property in the path is `undefined`, + * this method will no-op. + * + * @param {Object} root Object from which to dereference path from + * @param {string | !Array} path Path to set + * @param {*} value Value to set to path + * @return {string | boolean} The normalized version of the input path, return false if no prop + * @private + */ + _pathSet(root, path, value) { + let prop = root; + const parts = this._split(path); + const last = parts[parts.length - 1]; + // used for @-event="((prop.sub))" + if (parts.length > 1) { + // Loop over path parts[0..n-2] and dereference + for (let i = 0; i < parts.length - 1; i += 1) { + const part = parts[i]; + prop = prop[part]; + if (!prop) { + return false; + } + } + // Set value to object at end of path + prop[last] = value; + } + else { + // Simple property set + prop[path] = value; + } + return parts.join('.'); + } + /** + * Splits a path into an array of property names. Accepts either arrays + * of path parts or strings. + * + * Example: + * + * ``` + * split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz'] + * split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz'] + * ``` + * + * @param {string | !Array} path Input path + * @return {!Array} Array of path parts + * @suppress {checkTypes} + * @private + */ + // eslint-disable-next-line class-methods-use-this + _split(path) { + return path.toString().split('.'); + } +}; +//# sourceMappingURL=fbp.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/fbp.js.map b/packages/furo-fbp/dist/fbp.js.map new file mode 100644 index 000000000..024a3b38b --- /dev/null +++ b/packages/furo-fbp/dist/fbp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fbp.js","sourceRoot":"./src/","sources":["fbp.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,CAAC,MAAM,GAAG,GAAG,UAAU,CAAC,EAAE;AAC9B;;GAEG;AACH,KAAM,SAAQ,UAAU;IACtB;QACE,KAAK,EAAE,CAAC;QACR;;;;WAIG;QACH,IAAI,CAAC,kBAAkB,GAAG,EAAE,CAAC;QAC7B;;;;WAIG;QACH,IAAI,CAAC,YAAY,GAAG,EAAE,CAAC;QACvB;;;;WAIG;QACH,IAAI,CAAC,WAAW,GAAG,EAAE,CAAC;IACxB,CAAC;IAED;;;OAGG;IACH,YAAY;QACV,6BAA6B;QAC7B,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE,CAAC;YACxB,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;YACjC,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC;QAC5B,CAAC;QAED,KAAK,CAAC,YAAY,EAAE,CAAC;IACvB,CAAC;IAED;;;;;OAKG;IACH,eAAe,CAAC,IAAI,EAAE,UAAU;QAC9B,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;YACrB;;;eAG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AAC,GAAG,KAAK,CAAC;QACrB,CAAC;QACD,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;IAED;;;;;;;;;;;;;;;OAeG;IACH,kDAAkD;IAClD,MAAM,CAAC,IAAI;QACT,OAAO,IAAI,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;CACF,CAAC","sourcesContent":["/**\n * furo-fbp base class\n *\n * [read the guide](https://fbp.furo.pro/)\n *\n *\n * ### **_FBPTriggerWire**\n * **_FBPTriggerWire**(*wire* `` *detailData* `` ) ⟹ `void`\n *\n * Triggers a wire\n *\n * - wire (String) Name of the wire like --buttonClicked\n * - detailData (*) data to pass\n *\n *\n * ### **_FBPAddWireHook**\n * **_FBPAddWireHook**(*wire* `` *cb* `` *before* `` ) ⟹ `number`\n *\n *\n *\n * - wire (String) Name of the wire\n * - cb (function) Callback function cb(detailData)\n * - before (Boolean) append before the components are triggered, default is false\n *\n *\n * ### **_FBPTraceWires**\n * **_FBPTraceWires**() ⟹ `void`\n *\n * Log all triggered wires for this component. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPTraceWires()`\n *\n *\n *\n * ### **_FBPDebug**\n * **_FBPDebug**(*wire* `` *openDebugger* `` ) ⟹ `void`\n *\n * Get information for the triggered wire. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPDebug('--dataReceived')`\n *\n * - wire \n * - openDebugger opens the debugger console, so you can inspect your component.\n *\n *\n *\n * @summary Please read the guide for a better understanding\n * @polymer\n * @mixinFunction FBP\n */\n\nimport { FbpBreakpoints } from './FbpBreakpoints.js';\n\nexport const FBP = superClass =>\n /**\n * @polymerMixinClass\n */\n class extends superClass {\n constructor() {\n super();\n /**\n * used to store the listeners\n * @type {*[]}\n * @private\n */\n this.__FBPEventlistener = [];\n /**\n *\n * @type {{}}\n * @private\n */\n this.__wirebundle = {};\n /**\n *\n * @type {*[]}\n * @private\n */\n this.__wireQueue = [];\n }\n\n /**\n * Auto append fbp for lit elements\n * @private\n */\n firstUpdated() {\n // ensure to append only once\n if (!this.__fbpAppended) {\n this._appendFBP(this.shadowRoot);\n this.__fbpAppended = true;\n }\n\n super.firstUpdated();\n }\n\n /**\n * Triggers a wire\n * @param wire (String) Name of the wire like --buttonClicked\n * @param detailData (*) data to pass\n * @private\n */\n _FBPTriggerWire(wire, detailData) {\n if (this.__fbp_ready) {\n /**\n * Check breakpoints, this slows down every wire (if you have set breakpoints).\n * While debuging, this is absolute OK.\n */\n FbpBreakpoints.Breakpoints().forEach(breakpoint => {\n // start with cheapest\n\n if (\n breakpoint.enabled &&\n breakpoint.wire === wire &&\n breakpoint.path.endsWith(this.tagName.toLowerCase())\n ) {\n if (this.__domPath === undefined) {\n this.__domPath = FbpBreakpoints.getDomPath(this);\n }\n\n if (this.__domPath === breakpoint.path) {\n // eslint-disable-next-line default-case\n switch (breakpoint.kind) {\n case 'BREAKPOINT':\n // eslint-disable-next-line no-unused-vars,no-case-declarations\n const tagName = this.tagName.toLowerCase();\n // eslint-disable-next-line no-unused-expressions\n wire;\n // eslint-disable-next-line no-unused-expressions\n detailData;\n // eslint-disable-next-line no-case-declarations,no-unused-vars\n const domnode = FbpBreakpoints.GetElementByPath(\n breakpoint.path\n );\n // eslint-disable-next-line no-case-declarations,no-unused-vars\n const targets = this.__wirebundle[wire];\n\n // eslint-disable-next-line no-debugger\n debugger;\n break;\n case 'CONDITIONAL':\n // eslint-disable-next-line no-case-declarations,no-new-func\n const c = new Function(\n 'data',\n `return (${breakpoint.condition})`\n );\n if (c.call(this, detailData)) {\n // eslint-disable-next-line no-case-declarations,no-unused-vars\n const { condition } = breakpoint;\n // eslint-disable-next-line no-case-declarations,no-unused-vars,no-shadow\n const tagName = this.tagName.toLowerCase();\n // eslint-disable-next-line no-case-declarations,no-unused-vars,no-unused-expressions\n wire;\n // eslint-disable-next-line no-case-declarations,no-unused-vars,no-unused-expressions\n detailData;\n // eslint-disable-next-line no-unused-vars,no-shadow\n const domnode = FbpBreakpoints.GetElementByPath(\n breakpoint.path\n );\n // eslint-disable-next-line no-unused-vars,no-shadow\n const targets = this.__wirebundle[wire];\n\n // eslint-disable-next-line no-debugger\n debugger;\n }\n\n break;\n case 'TRACE':\n // eslint-disable-next-line no-case-declarations\n const ua = navigator.userAgent.toLowerCase();\n // eslint-disable-next-line no-case-declarations\n let agent = true;\n if (ua.indexOf('safari') !== -1) {\n if (ua.indexOf('chrome') > -1) {\n agent = true; // Chrome\n } else {\n agent = false; // Safari\n }\n }\n\n if (agent) {\n // eslint-disable-next-line no-console\n console.group('Trace', `${this.nodeName}: ${wire}`);\n\n // eslint-disable-next-line no-console\n console.log(\n FbpBreakpoints.GetElementByPath(breakpoint.path)\n );\n // eslint-disable-next-line no-console\n console.group('Target Elements');\n // eslint-disable-next-line no-console\n console.table(this.__wirebundle[wire]);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('Data');\n // eslint-disable-next-line no-console\n console.log(detailData);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('Call Stack');\n // eslint-disable-next-line no-console\n console.log(new Error().stack);\n // eslint-disable-next-line no-console\n console.groupEnd();\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n break;\n }\n }\n }\n });\n\n if (this.__wirebundle[wire]) {\n this.__wirebundle[wire].forEach(receiver => {\n // check for hooks\n if (typeof receiver === 'function') {\n receiver(detailData);\n } else if (\n typeof receiver.element[receiver.method] === 'function'\n ) {\n this._call(detailData, receiver);\n } else if (receiver.property) {\n let data = detailData;\n if (receiver.path) {\n data = this._pathGet(detailData, receiver.path);\n }\n this._pathSet(receiver.element, receiver.property, data);\n } else if (receiver.element.localName.includes('-')) {\n // retry call with whenDefined because sometimes the components are just not defined at the time ƒ-method is triggered\n customElements\n .whenDefined(receiver.element.localName)\n .then(() => {\n if (typeof receiver.element[receiver.method] === 'function') {\n this._call(detailData, receiver);\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `${receiver.method} is not a method of ${receiver.element.nodeName}`,\n receiver.element\n );\n }\n });\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `${receiver.method} is not a method of ${receiver.element.nodeName}`,\n receiver.element\n );\n }\n });\n }\n } else {\n this.__enqueueTrigger(wire, detailData);\n }\n }\n\n /**\n *\n * @param detailData\n * @param receiver\n * @private\n */\n _call(detailData, receiver) {\n let response;\n // array spreaden\n if (\n Array.isArray(detailData) &&\n receiver.element[receiver.method].length > 1\n ) {\n // eslint-disable-next-line prefer-spread\n response = receiver.element[receiver.method].apply(\n receiver.element,\n detailData\n );\n } else {\n let data = detailData;\n if (receiver.path) {\n data = this._pathGet(detailData, receiver.path);\n }\n response = receiver.element[receiver.method](data);\n }\n\n // fnret-function auslösen\n const fnret = new Event(`fnret-${receiver.attrName}`, {\n composed: false,\n bubbles: false,\n });\n fnret.detail = response;\n receiver.element.dispatchEvent(fnret);\n\n // @-ƒ-function auslösen\n const customEvent = new Event(`ƒ-${receiver.attrName}`, {\n composed: false,\n bubbles: false,\n });\n customEvent.detail = response;\n receiver.element.dispatchEvent(customEvent);\n }\n\n /**\n *\n * @param wire (String) Name of the wire\n * @param cb (function) Callback function cb(detailData)\n * @param [before] (Boolean) append before the components are triggered, default is false\n * @returns {number} Index of hook\n * @private\n */\n _FBPAddWireHook(wire, cb, before) {\n // eslint-disable-next-line no-param-reassign\n before = before || false;\n if (this.__wirebundle[wire]) {\n if (before) {\n this.__wirebundle[wire].unshift(cb);\n return 0;\n }\n const l = this.__wirebundle[wire].push(cb);\n return l - 1;\n }\n this.__wirebundle[wire] = [cb];\n return 1;\n }\n\n /**\n * Log all triggered wires for this component. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPTraceWires()`\n *\n *\n * @private\n */\n _FBPTraceWires() {\n const self = this;\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const wire in this.__wirebundle) {\n this._FBPAddWireHook(\n wire,\n e => {\n const ua = navigator.userAgent.toLowerCase();\n let agent = true;\n if (ua.indexOf('safari') !== -1) {\n if (ua.indexOf('chrome') > -1) {\n agent = true; // Chrome\n } else {\n agent = false; // Safari\n }\n }\n\n if (agent) {\n // eslint-disable-next-line no-console\n console.groupCollapsed('Trace for', `${this.nodeName}: ${wire}`);\n // eslint-disable-next-line no-console\n console.table([{ host: self, wire, data: e }]);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('Data');\n // eslint-disable-next-line no-console\n console.log(e);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('Target Elements');\n // eslint-disable-next-line no-console\n console.table(self.__wirebundle[wire]);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('Call Stack');\n // eslint-disable-next-line no-console\n console.log(new Error().stack);\n // eslint-disable-next-line no-console\n console.groupEnd();\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n },\n true\n );\n }\n }\n\n /**\n * Get information for the triggered wire. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPDebug('--dataReceived')`\n *\n * @param wire\n * @param openDebugger opens the debugger console, so you can inspect your component.\n * @private\n */\n _FBPDebug(wire, openDebugger) {\n const self = this;\n this._FBPAddWireHook(\n wire,\n e => {\n if (openDebugger) {\n // eslint-disable-next-line no-debugger\n debugger;\n } else {\n const ua = navigator.userAgent.toLowerCase();\n let agent = true;\n if (ua.indexOf('safari') !== -1) {\n if (ua.indexOf('chrome') > -1) {\n agent = true; // Chrome\n } else {\n agent = false; // Safari\n }\n }\n\n if (agent) {\n // eslint-disable-next-line no-console\n console.group('Debug', `${this.nodeName}: ${wire}`);\n // eslint-disable-next-line no-console\n console.group('Target Elements');\n // eslint-disable-next-line no-console\n console.table(self.__wirebundle[wire]);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('Data');\n // eslint-disable-next-line no-console\n console.log(e);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed('Call Stack');\n // eslint-disable-next-line no-console\n console.log(new Error().stack);\n // eslint-disable-next-line no-console\n console.groupEnd();\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n }\n },\n true\n );\n }\n\n /**\n *\n * @param str\n * @return {*}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n __toCamelCase(str) {\n return str.replace(/-([a-z])/g, g => g[1].toUpperCase());\n }\n\n /**\n * parses the dom for flowbased programming tags\n * @param dom dom node\n * @private\n */\n _appendFBP(dom) {\n const self = this;\n const wirebundle = this.__wirebundle;\n // get all elements which live in the host\n const nl = dom.querySelectorAll('*');\n const l = nl.length - 1;\n\n // eslint-disable-next-line func-names\n const _collectReceivers = function (element, i, attr) {\n // collect receiver\n element.attributes[i].value.split(',').forEach(w => {\n const r = this.__resolveWireAndPath(w);\n // create empty if not exist\n if (!wirebundle[r.receivingWire]) {\n wirebundle[r.receivingWire] = [];\n }\n wirebundle[r.receivingWire].push({\n element,\n method: this.__toCamelCase(attr),\n attrName: attr,\n path: r.path,\n });\n });\n };\n // eslint-disable-next-line func-names\n const _collectPropertySetters = function (element, i, property) {\n // split multiple wires\n element.attributes[i].value.split(',').forEach(w => {\n const r = this.__resolveWireAndPath(w);\n // create empty if not exist\n if (!wirebundle[r.receivingWire]) {\n wirebundle[r.receivingWire] = [];\n }\n wirebundle[r.receivingWire].push({\n element,\n property: this.__toCamelCase(property),\n path: r.path,\n });\n });\n };\n\n // eslint-disable-next-line func-names\n const _extractEventWires = function (fwire) {\n let wire;\n\n const trimmedWire = fwire.trim();\n\n let type = 'call';\n if (trimmedWire.startsWith('((')) {\n wire = trimmedWire.substring(2, trimmedWire.length - 2);\n type = 'setValue';\n } else if (trimmedWire.startsWith('-^')) {\n wire = trimmedWire.substring(2);\n type = 'fireOnHost';\n } else if (trimmedWire.startsWith('^')) {\n wire = trimmedWire.substring(1);\n type = 'fire';\n if (trimmedWire.startsWith('^^')) {\n wire = trimmedWire.substring(2);\n type = 'fireBubble';\n }\n } else if (trimmedWire === ':STOP') {\n type = 'stop';\n wire = 'stop';\n } else if (trimmedWire === ':PREVENTDEFAULT') {\n type = 'preventdefault';\n wire = 'preventdefault';\n } else {\n wire = trimmedWire;\n type = 'call';\n }\n return { type, wire };\n };\n\n // eslint-disable-next-line no-plusplus\n for (let x = l; x >= 0; --x) {\n const element = nl[x];\n\n // skip template tags\n if (element.tagName === 'TEMPLATE') {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n for (let i = 0; i < element.attributes.length; i += 1) {\n // collect receiving tags\n if (element.attributes[i].name.startsWith('fn-')) {\n const attr = element.attributes[i].name.substring(3);\n _collectReceivers.call(this, element, i, attr);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // collect sending tags\n if (element.attributes[i].name.startsWith('at-')) {\n const eventname = element.attributes[i].name.substring(3);\n const fwires = element.attributes[i].value;\n fwires.split(',').forEach(fwire => {\n const __ret = _extractEventWires(fwire);\n // eslint-disable-next-line no-use-before-define\n registerEvent(eventname, __ret.type, __ret.wire, element);\n });\n // eslint-disable-next-line no-continue\n continue;\n }\n // collect data property setter receiver\n if (element.attributes[i].name.startsWith('set-')) {\n const property = element.attributes[i].name.substring(4);\n _collectPropertySetters.call(this, element, i, property);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // collect data property receiver\n if (element.attributes[i].name.startsWith('ƒ-.')) {\n const property = element.attributes[i].name.substring(3);\n _collectPropertySetters.call(this, element, i, property);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // collect receiving tags\n if (element.attributes[i].name.startsWith('ƒ-')) {\n const attr = element.attributes[i].name.substring(2);\n _collectReceivers.call(this, element, i, attr);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // collect sending tags\n if (element.attributes[i].name.startsWith('@-')) {\n const eventname = element.attributes[i].name.substring(2);\n const fwires = element.attributes[i].value;\n fwires.split(',').forEach(fwire => {\n const __ret = _extractEventWires(fwire);\n // eslint-disable-next-line no-use-before-define\n registerEvent(eventname, __ret.type, __ret.wire, element);\n });\n // eslint-disable-next-line no-continue\n continue;\n }\n }\n }\n\n /**\n * register event on current element\n * @param eventname\n * @param type\n * @param wire\n * @private\n */\n function registerEvent(eventname, type, wire, element) {\n // find properties in wire\n // eslint-disable-next-line no-useless-escape\n const match = wire.match(/([a-z0-9\\-_*\\.]+)/gi);\n\n const handler = {\n // prevent default and stop propagation\n stop(e) {\n e.stopPropagation();\n },\n preventdefault(e) {\n e.preventDefault();\n },\n\n call(e) {\n /**\n * Prüfe ob die Funktion mit einem Wert aus dem Host oder mit den Details des Events ausgeführt werden soll.\n * --wire(hostName) ==> wirft this.hostName in die Funktion sonst wird e.detail verwendet\n *\n */\n\n let effectiveWire = wire;\n let detailData = e.detail;\n if (match !== null && match.length > 1) {\n // --wireName(*) sends the raw event\n // --wireName(*.mouseX) sends property mouseX of the event\n\n if (match[1].startsWith('*')) {\n if (match[1].length === 1) {\n // send raw event\n detailData = e;\n } else {\n // send event subprop with *.notDetail.xxx\n detailData = self._pathGet(\n e,\n match[1].substring(2, match[1].length)\n );\n }\n } else {\n // send host property\n detailData = self._pathGet(self, match[1]);\n }\n // eslint-disable-next-line prefer-destructuring\n effectiveWire = match[0];\n }\n\n self._FBPTriggerWire(effectiveWire, detailData);\n },\n\n fire(e) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n const customEvent = new Event(theEvent, {\n composed: false,\n bubbles: true,\n });\n // send details with *.sub or *\n if (prop.startsWith('*')) {\n if (prop.length === 1) {\n // send raw event\n customEvent.detail = e;\n } else {\n customEvent.detail = self._pathGet(e, prop.substring(2));\n }\n } else {\n customEvent.detail = self._pathGet(self, prop);\n }\n e.currentTarget.dispatchEvent(customEvent);\n } else {\n const customEvent = new Event(wire, {\n composed: false,\n bubbles: true,\n });\n customEvent.detail = e.detail;\n e.currentTarget.dispatchEvent(customEvent);\n }\n },\n\n fireOnHost(e) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n const customEvent = new Event(theEvent, {\n composed: false,\n bubbles: true,\n });\n // send details with *.sub or *\n if (prop.startsWith('*')) {\n if (prop.length === 1) {\n // send raw event\n customEvent.detail = e;\n } else {\n customEvent.detail = self._pathGet(e, prop.substring(2));\n }\n } else {\n customEvent.detail = self._pathGet(self, prop);\n }\n self.dispatchEvent(customEvent);\n } else {\n const customEvent = new Event(wire, {\n composed: false,\n bubbles: true,\n });\n customEvent.detail = e.detail;\n self.dispatchEvent(customEvent);\n }\n },\n\n fireBubble(e) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n const customEvent = new Event(theEvent, {\n composed: true,\n bubbles: true,\n });\n // send details with *.sub or *\n\n if (prop.startsWith('*')) {\n if (prop.length === 1) {\n // send raw event\n customEvent.detail = e;\n } else {\n customEvent.detail = self._pathGet(e, prop.substring(2));\n }\n } else {\n customEvent.detail = self._pathGet(self, prop);\n }\n e.currentTarget.dispatchEvent(customEvent);\n } else {\n const customEvent = new Event(wire, {\n composed: true,\n bubbles: true,\n });\n customEvent.detail = e.detail;\n e.currentTarget.dispatchEvent(customEvent);\n }\n },\n setValue(e) {\n self._pathSet(self, wire, e.detail);\n\n // self.set(wire, e.detail, self);\n },\n };\n\n element.addEventListener(eventname, handler[type]);\n self.__FBPEventlistener.push({\n element,\n event: eventname,\n handler: handler[type],\n });\n }\n\n // queueing for _FBPTriggerWire\n if (!this.__fbp_ready) {\n this._FBPReady();\n\n const queuelength = this.__wireQueue.length;\n for (let i = 0; i < queuelength; i += 1) {\n const t = this.__wireQueue.shift();\n this._FBPTriggerWire(t.w, t.d);\n }\n }\n }\n\n /**\n * Livecycle method\n * This method is called, when the wires are ready.\n * And triggers the `|--FBPready` wire. This does *not* respect a lit updateComplete\n * @private\n */\n _FBPReady() {\n this.__fbp_ready = true;\n this._FBPTriggerWire('|--FBPready', this);\n }\n\n /**\n *\n * @param wire\n * @param detailData\n * @private\n */\n __enqueueTrigger(wire, detailData) {\n this.__wireQueue.push({ w: wire, d: detailData });\n }\n\n /**\n *\n * @param w\n * @return {{path, receivingWire}}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n __resolveWireAndPath(w) {\n // finde --wire(*.xx.yy) => group1 = --wire group2 = xx.yy\n\n // eslint-disable-next-line no-useless-escape\n const match = w.trim().match(/(^[^\\(]*)\\(?\\*?\\.?([^\\)]*)/);\n const receivingWire = match[1];\n const path = match[2];\n\n return { receivingWire, path };\n }\n\n /**\n * Reads a value from a path. If any sub-property in the path is `undefined`,\n * this method returns `undefined` (will never throw.\n *\n * @param {Object} root Object from which to dereference path from\n * @param {string | !Array} path Path to read\n * @return {*} Value at path, or `undefined` if the path could not be fully dereferenced.\n * @private\n */\n _pathGet(root, path) {\n let prop = root;\n const parts = this._split(path);\n // Loop over path parts[0..n-1] and dereference\n for (let i = 0; i < parts.length; i += 1) {\n if (!prop) {\n return false;\n }\n const part = parts[i];\n prop = prop[part];\n }\n\n return prop;\n }\n\n /**\n * Sets a value to a path. If any sub-property in the path is `undefined`,\n * this method will no-op.\n *\n * @param {Object} root Object from which to dereference path from\n * @param {string | !Array} path Path to set\n * @param {*} value Value to set to path\n * @return {string | boolean} The normalized version of the input path, return false if no prop\n * @private\n */\n _pathSet(root, path, value) {\n let prop = root;\n const parts = this._split(path);\n const last = parts[parts.length - 1];\n // used for @-event=\"((prop.sub))\"\n if (parts.length > 1) {\n // Loop over path parts[0..n-2] and dereference\n for (let i = 0; i < parts.length - 1; i += 1) {\n const part = parts[i];\n prop = prop[part];\n if (!prop) {\n return false;\n }\n }\n // Set value to object at end of path\n prop[last] = value;\n } else {\n // Simple property set\n prop[path] = value;\n }\n return parts.join('.');\n }\n\n /**\n * Splits a path into an array of property names. Accepts either arrays\n * of path parts or strings.\n *\n * Example:\n *\n * ```\n * split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz']\n * split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz']\n * ```\n *\n * @param {string | !Array} path Input path\n * @return {!Array} Array of path parts\n * @suppress {checkTypes}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n _split(path) {\n return path.toString().split('.');\n }\n };\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/dist/flow-bind.d.ts b/packages/furo-fbp/dist/flow-bind.d.ts new file mode 100644 index 000000000..5f8a88bf3 --- /dev/null +++ b/packages/furo-fbp/dist/flow-bind.d.ts @@ -0,0 +1,65 @@ +declare const FlowBind_base: { + new (): { + [x: string]: any; + __FBPEventlistener: any[]; + __wirebundle: {}; + __wireQueue: any[]; + firstUpdated(): void; + __fbpAppended: boolean | undefined; + _FBPTriggerWire(wire: any, detailData: any): void; + __domPath: string | undefined; + _call(detailData: any, receiver: any): void; + _FBPAddWireHook(wire: any, cb: any, before?: any): number; + _FBPTraceWires(): void; + _FBPDebug(wire: any, openDebugger: any): void; + __toCamelCase(str: any): any; + _appendFBP(dom: any): void; + _FBPReady(): void; + __fbp_ready: boolean | undefined; + __enqueueTrigger(wire: any, detailData: any): void; + __resolveWireAndPath(w: any): { + path: any; + receivingWire: any; + }; + _pathGet(root: Object, path: string | (string | number)[]): any; + _pathSet(root: Object, path: string | (string | number)[], value: any): string | boolean; + _split(path: string | (string | number)[]): string[]; + }; + [x: string]: any; +}; +/** + * `flow-bind` + * + * Custom element to allow using furo-fbp's template features in a html document. + * It comes very handy, when you want write tests or make some demos. + * + *```html + * + * + * + *``` + * + * @customElement + * @mixes FBP + * @summary Custom element to allow using furo-fbp's template features in a html document. + */ +export class FlowBind extends FlowBind_base { + /** + * @private + */ + private template; + /** + * + * @type {HTMLElement} + * @private + */ + private _host; +} +export {}; diff --git a/packages/furo-fbp/dist/flow-bind.js b/packages/furo-fbp/dist/flow-bind.js new file mode 100644 index 000000000..c73d0995b --- /dev/null +++ b/packages/furo-fbp/dist/flow-bind.js @@ -0,0 +1,50 @@ +import { FBP } from './fbp.js'; +import './empty-fbp-node.js'; +/** + * `flow-bind` + * + * Custom element to allow using furo-fbp's template features in a html document. + * It comes very handy, when you want write tests or make some demos. + * + *```html + * + * + * + *``` + * + * @customElement + * @mixes FBP + * @summary Custom element to allow using furo-fbp's template features in a html document. + */ +export class FlowBind extends FBP(HTMLElement) { + constructor() { + super(); + this.attachShadow({ mode: 'open' }); + // eslint-disable-next-line wc/no-constructor-attributes + const t = this.querySelector('template'); + /** + * @private + */ + this.template = t.content; + const elem = document.createElement('empty-fbp-node'); + elem.attachShadow({ mode: 'open' }); + elem.shadowRoot.appendChild(this.template.cloneNode(true)); + elem._appendFBP(elem.shadowRoot); + /** + * + * @type {HTMLElement} + * @private + */ + this._host = elem; + this.parentNode.appendChild(elem.shadowRoot); + } +} +window.customElements.define('flow-bind', FlowBind); +//# sourceMappingURL=flow-bind.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/flow-bind.js.map b/packages/furo-fbp/dist/flow-bind.js.map new file mode 100644 index 000000000..0cd39807a --- /dev/null +++ b/packages/furo-fbp/dist/flow-bind.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flow-bind.js","sourceRoot":"./src/","sources":["flow-bind.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,QAAS,SAAQ,GAAG,CAAC,WAAW,CAAC;IAC5C;QACE,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACpC,wDAAwD;QACxD,MAAM,CAAC,GAAG,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACzC;;WAEG;QACH,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC,OAAO,CAAC;QAC1B,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,gBAAgB,CAAC,CAAC;QACtD,IAAI,CAAC,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC;QACpC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC3D,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;QACjC;;;;WAIG;QACH,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IAC/C,CAAC;CACF;AAED,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC","sourcesContent":["import { FBP } from './fbp.js';\nimport './empty-fbp-node.js';\n\n/**\n * `flow-bind`\n *\n * Custom element to allow using furo-fbp's template features in a html document.\n * It comes very handy, when you want write tests or make some demos.\n *\n *```html\n *\n * \n *\n *```\n *\n * @customElement\n * @mixes FBP\n * @summary Custom element to allow using furo-fbp's template features in a html document.\n */\nexport class FlowBind extends FBP(HTMLElement) {\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n // eslint-disable-next-line wc/no-constructor-attributes\n const t = this.querySelector('template');\n /**\n * @private\n */\n this.template = t.content;\n const elem = document.createElement('empty-fbp-node');\n elem.attachShadow({ mode: 'open' });\n elem.shadowRoot.appendChild(this.template.cloneNode(true));\n elem._appendFBP(elem.shadowRoot);\n /**\n *\n * @type {HTMLElement}\n * @private\n */\n this._host = elem;\n this.parentNode.appendChild(elem.shadowRoot);\n }\n}\n\nwindow.customElements.define('flow-bind', FlowBind);\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/flow-repeat.d.ts b/packages/furo-fbp/dist/flow-repeat.d.ts similarity index 93% rename from packages/furo-fbp/src/flow-repeat.d.ts rename to packages/furo-fbp/dist/flow-repeat.d.ts index 8cc6dd47e..f6af74137 100644 --- a/packages/furo-fbp/src/flow-repeat.d.ts +++ b/packages/furo-fbp/dist/flow-repeat.d.ts @@ -5,9 +5,9 @@ declare const FlowRepeat_base: { __wirebundle: {}; __wireQueue: any[]; firstUpdated(): void; - __fbpAppended: boolean; + __fbpAppended: boolean | undefined; _FBPTriggerWire(wire: any, detailData: any): void; - __domPath: any; + __domPath: string | undefined; _call(detailData: any, receiver: any): void; _FBPAddWireHook(wire: any, cb: any, before?: any): number; _FBPTraceWires(): void; @@ -15,14 +15,14 @@ declare const FlowRepeat_base: { __toCamelCase(str: any): any; _appendFBP(dom: any): void; _FBPReady(): void; - __fbp_ready: boolean; + __fbp_ready: boolean | undefined; __enqueueTrigger(wire: any, detailData: any): void; __resolveWireAndPath(w: any): { path: any; receivingWire: any; }; - _pathGet(root: any, path: string | (string | number)[]): any; - _pathSet(root: any, path: string | (string | number)[], value: any): string | boolean; + _pathGet(root: Object, path: string | (string | number)[]): any; + _pathSet(root: Object, path: string | (string | number)[], value: any): string | boolean; _split(path: string | (string | number)[]): string[]; }; [x: string]: any; @@ -91,7 +91,7 @@ export class FlowRepeat extends FlowRepeat_base { * * @param index {int} - Index of item to select */ - select(index: any): void; + select(index: int): void; selectedIndex: any; /** * Select item by its identity. @@ -149,8 +149,8 @@ export class FlowRepeat extends FlowRepeat_base { * * @param ref {DomNode} - Node to append the repeated items. */ - setInsertRef(ref: any): void; - _insertMode: string; + setInsertRef(ref: DomNode): void; + _insertMode: string | undefined; _insertTarget: any; /** * @@ -221,6 +221,6 @@ export class FlowRepeat extends FlowRepeat_base { * @param i {int} - index of item that you want to trigger. * @param data {*} - data to forward to the item. */ - triggerIndex(i: any, data: any): void; + triggerIndex(i: int, data: any): void; } export {}; diff --git a/packages/furo-fbp/dist/flow-repeat.js b/packages/furo-fbp/dist/flow-repeat.js new file mode 100644 index 000000000..bae233bf7 --- /dev/null +++ b/packages/furo-fbp/dist/flow-repeat.js @@ -0,0 +1,415 @@ +import { FBP } from './fbp.js'; +import './empty-fbp-node.js'; +/** + * `flow-repeat` + * + * Custom element to repeat Arrays. The repeated items are injected *before* the `flow-repeat` element. If you need the repeated items inside of an other dom node, use [`setInsertRef`](./flow-repeat/#setinsertref) + * + * + * ```html + * + * + * + * ``` + * > **Note**: if you want to bind a repeater node, use `furo-data-flow-repeat`. + * + * + * ## Available wires in the template: + * + * > **Note**: Each repeated item has its own closed scope. You can not use the wires outside of the `template`. + * > Use events to interact with components outside of the template. + * + * - `--init` : contains the repeated item, fired only once on creation of the repeated node + * - `--item` : contains the repeated item, fired on every inject + * - `--firstItem` : contains the repeated item, fired on the first element. + * - `--lastItem` : contains the repeated item, fired on the last element. + * - `--index` : contains a number with the index of the element. + * - `--host` : contains a reference to the host component. + * - `--trigger` : contains what was passed in to the triggering method. + * - `--triggerFirst` : contains what was passed in to the triggering method. + * - `--triggerLast` : contains what was passed in to the triggering method. + * - `--itemSelected` : contains `true`, is triggered with select(index). + * - `--itemDeSelected` : contains `false`, is triggered when another item is selected with select(index). + * + * ## Available attributes + * **index** contains the current index of the item. Use this to fire a event with an index like `@-click="^^item-clicked(index)"` + * **item** contains the current index of the item. Use this to fire a event with the repeated item like `@-click="^^item-selected(item)"` + * + * + * @summary Custom element to allow using FBPs template features in repeated template + * + * @fires {index of the element} last-element-selected - Fired when the last element is selected. Use this to trigger a load next. + * @fires {Number} items-in-dom - Fired when items are attached to the dom, with Number of items. + * + * @customElement + * @mixes FBP + */ +export class FlowRepeat extends FBP(HTMLElement) { + constructor() { + super(); + /** + * @private + */ + this.template = undefined; + /** + * @private + */ + this._insertedItems = []; + } + /** + * Clear the list + */ + clear() { + this.injectItems([]); + } + /** + * Triggers the wire `--itemSelected` on selected item and `--itemDeSelected` on last selected Item. + * + * @param index {int} - Index of item to select + */ + select(index) { + if (this._insertedItems[index]) { + // deselect the last selected + if (this.selectedIndex !== undefined) { + this.deselect(this.selectedIndex); + } + this._insertedItems[index].virtualElement._FBPTriggerWire('--itemSelected', true); + this.selectedIndex = index; + } + } + /** + * Select item by its identity. + * + * Using this method only works when you have set the `identity-path`. + * + * @param identifier {*} Identity from `identity-path` + */ + selectIdentity(identifier) { + if (this._insertedItems.length === 0) { + this._selIdentityQueue = identifier; + } + else { + this._selIdentityQueue = undefined; + // eslint-disable-next-line no-restricted-syntax + const arrayLength = this._insertedItems.length; + let i = 0; + do { + if (this._insertedItems[i].identity === identifier) { + this.select(i); + break; + } + i += 1; + } while (i < arrayLength); + } + } + /** + * Selects next index. If none was selected, the first index will be selected. + * + * If you reached the last index, the first index will be selected. + * + * If you reach the last element, `last-element-selected` will fire. + * + * Triggers the wire `--itemSelected` on selected item and `--itemDeSelected` on last selected Item + */ + selectNextIndex() { + let i = this.selectedIndex + 1; + // loop around + if (!this._insertedItems[i]) { + i = 0; + } + this.select(i); + if (this._insertedItems.length - 1 === this.selectedIndex) { + const customEvent = new Event('last-element-selected', { + composed: true, + bubbles: true, + }); + customEvent.detail = i; + this.dispatchEvent(customEvent); + } + } + /** + * Selects the previous index. + * + * If you are on the first item, the last will be selected. + * + * Triggers the wire `--itemSelected` on selected item and `--itemDeSelected` on last selected Item + */ + selectPreviousIndex() { + let i = this.selectedIndex - 1; + // loop around + if (i < 0) { + i = this._insertedItems.length - 1; + } + this.select(i); + } + /** + * Triggers the currently selected item. + * + * Triggers the wire `--trigger` on the every item. + * + * Triggers the wire `--triggerIndex` on the every item. + * + * @param data {*} - Data to forward. + */ + triggerSelected(data) { + this.triggerIndex(this.selectedIndex, data); + } + /** + * Triggers all nodes. + * + * Triggers the wire `--trigger` on the every item. + * + * Triggers the wire `--triggerIndex` on the every item. + * + * @param data {*} - data to forward + */ + triggerAll(data) { + for (let i = 0; i < this._insertedItems.length; i += 1) { + this.triggerIndex(i, data); + } + } + /** + * Triggers the wire `--itemDeSelected` on the last selected item + */ + deselect() { + if (this.selectedIndex !== undefined && + this._insertedItems[this.selectedIndex]) { + this._insertedItems[this.selectedIndex].virtualElement._FBPTriggerWire('--itemDeSelected', false); + this.selectedIndex = undefined; + } + } + /** + * Set a reference to append the repeated elements in to the ref instead of appending them before the repeater itself. + * + * @param ref {DomNode} - Node to append the repeated items. + */ + setInsertRef(ref) { + this._insertMode = 'appendchild'; + this._insertTarget = ref; + } + /** + * + * @param attachedElem + * @param reference + * @private + */ + _insertToDom(attachedElem, reference) { + if (this._insertMode === 'appendchild') { + this._insertTarget.appendChild(attachedElem); + } + else { + this.parentNode.insertBefore(attachedElem, reference); + } + } + /** + * Triggers the wire `--itemDeSelected` on all items + */ + deselectAll() { + this._insertedItems.forEach(item => { + item.virtualElement._FBPTriggerWire('--itemDeSelected', false); + this.selectedIndex = undefined; + }); + } + /** + * + * @param parent + * @return {null|*} + * @private + */ + _findFirstHost(parent) { + if (parent && parent.host) { + return parent.host; + } + if (parent === null) { + return null; + } + return this._findFirstHost(parent.parentNode); + } + /** + * Inject items to repeat. + * + * @param items {Array} - Items to repeat + */ + injectItems(items) { + if (!Array.isArray(items)) { + // eslint-disable-next-line no-console + console.info('Items is not an array ', items, this); + // make the list empty + // eslint-disable-next-line no-param-reassign + items = []; + } + this._firstHost = this._findFirstHost(this.parentNode); + items.forEach((e, i, a) => { + let identity = false; + if (this.identityPath) { + identity = this.identityPath + .split('.') + .reduce((acc, part) => acc && acc[part], e); + } + let elem; + // wenn das element noch nicht existiert + if (!this._insertedItems[i]) { + elem = this._buildDomNode(identity, i); + elem._FBPTriggerWire('--init', e); + } + else if (this._insertedItems[i].identity === false || + this._insertedItems[i].identity !== identity) { + elem = this._buildDomNode(identity, i); + // Schiebe alle elemente des Knotens vor das erste kind des nächsten möglichen knoten + let reference = this; + if (this._insertedItems[i + 1] && + this._insertedItems[i + 1].children[0]) { + [reference] = this._insertedItems[i + 1].children; + } + // move the nodes + this._insertedItems[i].children.forEach(attachedElem => { + this._insertToDom(attachedElem, reference); + }); + elem._FBPTriggerWire('--init', e); + } + else { + elem = this._insertedItems[i].virtualElement; + } + // set item and index value on created element + elem.item = e; + elem.index = i; + // trigger wires + elem._FBPTriggerWire(this._internalWire, { item: e, index: i }); + if (i === 0) { + elem._FBPTriggerWire('--firstItem', e); + } + if (i === a.length - 1) { + elem._FBPTriggerWire('--lastItem', e); + } + elem._FBPTriggerWire('--item', e); + elem._FBPTriggerWire('--host', this._firstHost); + elem._FBPTriggerWire('--index', i); + }); + // überzählige elemente aus dem dom entfernen + this._insertedItems + .slice(items.length, this._insertedItems.length) + .forEach(handle => { + handle.children.forEach(attachedElem => { + attachedElem.remove(); + }); + }); + // überzählige elemente aus dem array entfernen + this._insertedItems.splice(items.length); + if (items.length > 0) { + setTimeout(() => { + const customEvent = new Event('items-in-dom', { + composed: true, + bubbles: false, + }); + customEvent.detail = items.length; + this.dispatchEvent(customEvent); + }, 0); + } + // selectByIdentity queue + if (this._selIdentityQueue) { + this.selectIdentity(this._selIdentityQueue); + } + } + /** + * + * @param identity + * @param i + * @return {HTMLElement} + * @private + */ + _buildDomNode(identity, i) { + // build hidden elem + const elem = document.createElement('empty-fbp-node'); + elem.attachShadow({ mode: 'open' }); + // this is sometimes needed when template is="flow-repeat" is used. + if (this.template === undefined) { + const t = this.querySelector('template'); + if (t && t.content) { + this.template = t.content; + } + } + elem.shadowRoot.appendChild(this.template.cloneNode(true)); + elem._appendFBP(elem.shadowRoot); + const handle = { + virtualElement: elem, + children: [].slice.call(elem.shadowRoot.children), + identity, + }; + // remove old entries + if (this._insertedItems[i]) { + this._insertedItems[i].children.forEach(attachedElem => { + attachedElem.remove(); + }); + } + this._insertedItems[i] = handle; + this._insertToDom(elem.shadowRoot.firstElementChild, this); + return elem; + } + /** + * @private + */ + connectedCallback() { + this.style.display = 'none'; + // Create a shadow root to the element. + const t = this.querySelector('template'); + if (t && t.content) { + this.template = t.content; + } + /** + * Identity path of a single item. + * Use this if you have a field which identifies the item. + * @type {*string} + */ + this.identityPath = this.getAttribute('identity-path') || false; + this._internalWire = this.getAttribute('internal-wire') || '--itemInjected'; + } + /** + * Triggers the wire `--trigger` on the first item. + * + * Triggers the wire --triggerFirst on the first item. + * + * @param data {*} - data to forward to the item. + */ + triggerFirst(data) { + if (this._insertedItems[0]) { + this._insertedItems[0].virtualElement._FBPTriggerWire('--trigger', data); + this._insertedItems[0].virtualElement._FBPTriggerWire('--triggerFirst', data); + } + } + /** + * Triggers the wire `--trigger` on the last item. + * + * Triggers the wire --triggerLast on the last item. + * + * @param data {*} - data to forward to the item. + */ + triggerLast(data) { + if (this._insertedItems[this._insertedItems.length - 1]) { + this._insertedItems[this._insertedItems.length - 1].virtualElement._FBPTriggerWire('--trigger', data); + this._insertedItems[this._insertedItems.length - 1].virtualElement._FBPTriggerWire('--triggerLast', data); + } + } + /** + * Triggers the wire `--trigger` on the item. + * + * Triggers the wire `--triggerIndex` on the item. + * + * + * @param i {int} - index of item that you want to trigger. + * @param data {*} - data to forward to the item. + */ + triggerIndex(i, data) { + if (this._insertedItems[i]) { + this._insertedItems[i].virtualElement._FBPTriggerWire('--trigger', data); + this._insertedItems[i].virtualElement._FBPTriggerWire('--triggerIndex', data); + } + else { + // eslint-disable-next-line no-console + console.warn('Out of index', this); + } + } +} +window.customElements.define('flow-repeat', FlowRepeat); +//# sourceMappingURL=flow-repeat.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/flow-repeat.js.map b/packages/furo-fbp/dist/flow-repeat.js.map new file mode 100644 index 000000000..03a6420d2 --- /dev/null +++ b/packages/furo-fbp/dist/flow-repeat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flow-repeat.js","sourceRoot":"./src/","sources":["flow-repeat.js"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC/B,OAAO,qBAAqB,CAAC;AAE7B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,OAAO,UAAW,SAAQ,GAAG,CAAC,WAAW,CAAC;IAC9C;QACE,KAAK,EAAE,CAAC;QACR;;WAEG;QACH,IAAI,CAAC,QAAQ,GAAG,SAAS,CAAC;QAC1B;;WAEG;QACH,IAAI,CAAC,cAAc,GAAG,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D,gBAAgB,EAChB,IAAI,CACL,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,sCAAsC;YACtC,OAAO,CAAC,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,CAAC;QACrC,CAAC;IACH,CAAC;CACF;AAED,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,aAAa,EAAE,UAAU,CAAC,CAAC","sourcesContent":["import { FBP } from './fbp.js';\nimport './empty-fbp-node.js';\n\n/**\n * `flow-repeat`\n *\n * Custom element to repeat Arrays. The repeated items are injected *before* the `flow-repeat` element. If you need the repeated items inside of an other dom node, use [`setInsertRef`](./flow-repeat/#setinsertref)\n *\n *\n * ```html\n * \n * \n * \n * ```\n * > **Note**: if you want to bind a repeater node, use `furo-data-flow-repeat`.\n *\n *\n * ## Available wires in the template:\n *\n * > **Note**: Each repeated item has its own closed scope. You can not use the wires outside of the `template`.\n * > Use events to interact with components outside of the template.\n *\n * - `--init` : contains the repeated item, fired only once on creation of the repeated node\n * - `--item` : contains the repeated item, fired on every inject\n * - `--firstItem` : contains the repeated item, fired on the first element.\n * - `--lastItem` : contains the repeated item, fired on the last element.\n * - `--index` : contains a number with the index of the element.\n * - `--host` : contains a reference to the host component.\n * - `--trigger` : contains what was passed in to the triggering method.\n * - `--triggerFirst` : contains what was passed in to the triggering method.\n * - `--triggerLast` : contains what was passed in to the triggering method.\n * - `--itemSelected` : contains `true`, is triggered with select(index).\n * - `--itemDeSelected` : contains `false`, is triggered when another item is selected with select(index).\n *\n * ## Available attributes\n * **index** contains the current index of the item. Use this to fire a event with an index like `@-click=\"^^item-clicked(index)\"`\n * **item** contains the current index of the item. Use this to fire a event with the repeated item like `@-click=\"^^item-selected(item)\"`\n *\n *\n * @summary Custom element to allow using FBPs template features in repeated template\n *\n * @fires {index of the element} last-element-selected - Fired when the last element is selected. Use this to trigger a load next.\n * @fires {Number} items-in-dom - Fired when items are attached to the dom, with Number of items.\n *\n * @customElement\n * @mixes FBP\n */\nexport class FlowRepeat extends FBP(HTMLElement) {\n constructor() {\n super();\n /**\n * @private\n */\n this.template = undefined;\n /**\n * @private\n */\n this._insertedItems = [];\n }\n\n /**\n * Clear the list\n */\n clear() {\n this.injectItems([]);\n }\n\n /**\n * Triggers the wire `--itemSelected` on selected item and `--itemDeSelected` on last selected Item.\n *\n * @param index {int} - Index of item to select\n */\n select(index) {\n if (this._insertedItems[index]) {\n // deselect the last selected\n if (this.selectedIndex !== undefined) {\n this.deselect(this.selectedIndex);\n }\n\n this._insertedItems[index].virtualElement._FBPTriggerWire(\n '--itemSelected',\n true\n );\n this.selectedIndex = index;\n }\n }\n\n /**\n * Select item by its identity.\n *\n * Using this method only works when you have set the `identity-path`.\n *\n * @param identifier {*} Identity from `identity-path`\n */\n selectIdentity(identifier) {\n if (this._insertedItems.length === 0) {\n this._selIdentityQueue = identifier;\n } else {\n this._selIdentityQueue = undefined;\n\n // eslint-disable-next-line no-restricted-syntax\n const arrayLength = this._insertedItems.length;\n let i = 0;\n do {\n if (this._insertedItems[i].identity === identifier) {\n this.select(i);\n break;\n }\n i += 1;\n } while (i < arrayLength);\n }\n }\n\n /**\n * Selects next index. If none was selected, the first index will be selected.\n *\n * If you reached the last index, the first index will be selected.\n *\n * If you reach the last element, `last-element-selected` will fire.\n *\n * Triggers the wire `--itemSelected` on selected item and `--itemDeSelected` on last selected Item\n */\n selectNextIndex() {\n let i = this.selectedIndex + 1;\n // loop around\n if (!this._insertedItems[i]) {\n i = 0;\n }\n this.select(i);\n\n if (this._insertedItems.length - 1 === this.selectedIndex) {\n const customEvent = new Event('last-element-selected', {\n composed: true,\n bubbles: true,\n });\n customEvent.detail = i;\n this.dispatchEvent(customEvent);\n }\n }\n\n /**\n * Selects the previous index.\n *\n * If you are on the first item, the last will be selected.\n *\n * Triggers the wire `--itemSelected` on selected item and `--itemDeSelected` on last selected Item\n */\n selectPreviousIndex() {\n let i = this.selectedIndex - 1;\n // loop around\n if (i < 0) {\n i = this._insertedItems.length - 1;\n }\n this.select(i);\n }\n\n /**\n * Triggers the currently selected item.\n *\n * Triggers the wire `--trigger` on the every item.\n *\n * Triggers the wire `--triggerIndex` on the every item.\n *\n * @param data {*} - Data to forward.\n */\n triggerSelected(data) {\n this.triggerIndex(this.selectedIndex, data);\n }\n\n /**\n * Triggers all nodes.\n *\n * Triggers the wire `--trigger` on the every item.\n *\n * Triggers the wire `--triggerIndex` on the every item.\n *\n * @param data {*} - data to forward\n */\n triggerAll(data) {\n for (let i = 0; i < this._insertedItems.length; i += 1) {\n this.triggerIndex(i, data);\n }\n }\n\n /**\n * Triggers the wire `--itemDeSelected` on the last selected item\n */\n deselect() {\n if (\n this.selectedIndex !== undefined &&\n this._insertedItems[this.selectedIndex]\n ) {\n this._insertedItems[this.selectedIndex].virtualElement._FBPTriggerWire(\n '--itemDeSelected',\n false\n );\n this.selectedIndex = undefined;\n }\n }\n\n /**\n * Set a reference to append the repeated elements in to the ref instead of appending them before the repeater itself.\n *\n * @param ref {DomNode} - Node to append the repeated items.\n */\n setInsertRef(ref) {\n this._insertMode = 'appendchild';\n this._insertTarget = ref;\n }\n\n /**\n *\n * @param attachedElem\n * @param reference\n * @private\n */\n _insertToDom(attachedElem, reference) {\n if (this._insertMode === 'appendchild') {\n this._insertTarget.appendChild(attachedElem);\n } else {\n this.parentNode.insertBefore(attachedElem, reference);\n }\n }\n\n /**\n * Triggers the wire `--itemDeSelected` on all items\n */\n deselectAll() {\n this._insertedItems.forEach(item => {\n item.virtualElement._FBPTriggerWire('--itemDeSelected', false);\n this.selectedIndex = undefined;\n });\n }\n\n /**\n *\n * @param parent\n * @return {null|*}\n * @private\n */\n _findFirstHost(parent) {\n if (parent && parent.host) {\n return parent.host;\n }\n if (parent === null) {\n return null;\n }\n return this._findFirstHost(parent.parentNode);\n }\n\n /**\n * Inject items to repeat.\n *\n * @param items {Array} - Items to repeat\n */\n injectItems(items) {\n if (!Array.isArray(items)) {\n // eslint-disable-next-line no-console\n console.info('Items is not an array ', items, this);\n // make the list empty\n // eslint-disable-next-line no-param-reassign\n items = [];\n }\n\n this._firstHost = this._findFirstHost(this.parentNode);\n items.forEach((e, i, a) => {\n let identity = false;\n if (this.identityPath) {\n identity = this.identityPath\n .split('.')\n .reduce((acc, part) => acc && acc[part], e);\n }\n\n let elem;\n // wenn das element noch nicht existiert\n if (!this._insertedItems[i]) {\n elem = this._buildDomNode(identity, i);\n elem._FBPTriggerWire('--init', e);\n } else if (\n this._insertedItems[i].identity === false ||\n this._insertedItems[i].identity !== identity\n ) {\n elem = this._buildDomNode(identity, i);\n // Schiebe alle elemente des Knotens vor das erste kind des nächsten möglichen knoten\n let reference = this;\n if (\n this._insertedItems[i + 1] &&\n this._insertedItems[i + 1].children[0]\n ) {\n [reference] = this._insertedItems[i + 1].children;\n }\n\n // move the nodes\n this._insertedItems[i].children.forEach(attachedElem => {\n this._insertToDom(attachedElem, reference);\n });\n elem._FBPTriggerWire('--init', e);\n } else {\n elem = this._insertedItems[i].virtualElement;\n }\n\n // set item and index value on created element\n elem.item = e;\n elem.index = i;\n\n // trigger wires\n elem._FBPTriggerWire(this._internalWire, { item: e, index: i });\n if (i === 0) {\n elem._FBPTriggerWire('--firstItem', e);\n }\n\n if (i === a.length - 1) {\n elem._FBPTriggerWire('--lastItem', e);\n }\n\n elem._FBPTriggerWire('--item', e);\n\n elem._FBPTriggerWire('--host', this._firstHost);\n elem._FBPTriggerWire('--index', i);\n });\n\n // überzählige elemente aus dem dom entfernen\n this._insertedItems\n .slice(items.length, this._insertedItems.length)\n .forEach(handle => {\n handle.children.forEach(attachedElem => {\n attachedElem.remove();\n });\n });\n // überzählige elemente aus dem array entfernen\n this._insertedItems.splice(items.length);\n\n if (items.length > 0) {\n setTimeout(() => {\n const customEvent = new Event('items-in-dom', {\n composed: true,\n bubbles: false,\n });\n customEvent.detail = items.length;\n this.dispatchEvent(customEvent);\n }, 0);\n }\n\n // selectByIdentity queue\n if (this._selIdentityQueue) {\n this.selectIdentity(this._selIdentityQueue);\n }\n }\n\n /**\n *\n * @param identity\n * @param i\n * @return {HTMLElement}\n * @private\n */\n _buildDomNode(identity, i) {\n // build hidden elem\n\n const elem = document.createElement('empty-fbp-node');\n elem.attachShadow({ mode: 'open' });\n\n // this is sometimes needed when template is=\"flow-repeat\" is used.\n if (this.template === undefined) {\n const t = this.querySelector('template');\n if (t && t.content) {\n this.template = t.content;\n }\n }\n\n elem.shadowRoot.appendChild(this.template.cloneNode(true));\n elem._appendFBP(elem.shadowRoot);\n\n const handle = {\n virtualElement: elem,\n children: [].slice.call(elem.shadowRoot.children),\n identity,\n };\n\n // remove old entries\n if (this._insertedItems[i]) {\n this._insertedItems[i].children.forEach(attachedElem => {\n attachedElem.remove();\n });\n }\n\n this._insertedItems[i] = handle;\n\n this._insertToDom(elem.shadowRoot.firstElementChild, this);\n return elem;\n }\n\n /**\n * @private\n */\n connectedCallback() {\n this.style.display = 'none';\n // Create a shadow root to the element.\n\n const t = this.querySelector('template');\n if (t && t.content) {\n this.template = t.content;\n }\n\n /**\n * Identity path of a single item.\n * Use this if you have a field which identifies the item.\n * @type {*string}\n */\n this.identityPath = this.getAttribute('identity-path') || false;\n\n this._internalWire = this.getAttribute('internal-wire') || '--itemInjected';\n }\n\n /**\n * Triggers the wire `--trigger` on the first item.\n *\n * Triggers the wire --triggerFirst on the first item.\n *\n * @param data {*} - data to forward to the item.\n */\n triggerFirst(data) {\n if (this._insertedItems[0]) {\n this._insertedItems[0].virtualElement._FBPTriggerWire('--trigger', data);\n this._insertedItems[0].virtualElement._FBPTriggerWire(\n '--triggerFirst',\n data\n );\n }\n }\n\n /**\n * Triggers the wire `--trigger` on the last item.\n *\n * Triggers the wire --triggerLast on the last item.\n *\n * @param data {*} - data to forward to the item.\n */\n triggerLast(data) {\n if (this._insertedItems[this._insertedItems.length - 1]) {\n this._insertedItems[\n this._insertedItems.length - 1\n ].virtualElement._FBPTriggerWire('--trigger', data);\n this._insertedItems[\n this._insertedItems.length - 1\n ].virtualElement._FBPTriggerWire('--triggerLast', data);\n }\n }\n\n /**\n * Triggers the wire `--trigger` on the item.\n *\n * Triggers the wire `--triggerIndex` on the item.\n *\n *\n * @param i {int} - index of item that you want to trigger.\n * @param data {*} - data to forward to the item.\n */\n triggerIndex(i, data) {\n if (this._insertedItems[i]) {\n this._insertedItems[i].virtualElement._FBPTriggerWire('--trigger', data);\n this._insertedItems[i].virtualElement._FBPTriggerWire(\n '--triggerIndex',\n data\n );\n } else {\n // eslint-disable-next-line no-console\n console.warn('Out of index', this);\n }\n }\n}\n\nwindow.customElements.define('flow-repeat', FlowRepeat);\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/furo-catalog.d.ts b/packages/furo-fbp/dist/furo-catalog.d.ts similarity index 100% rename from packages/furo-fbp/src/furo-catalog.d.ts rename to packages/furo-fbp/dist/furo-catalog.d.ts diff --git a/packages/furo-fbp/dist/furo-catalog.js b/packages/furo-fbp/dist/furo-catalog.js new file mode 100644 index 000000000..539675e85 --- /dev/null +++ b/packages/furo-fbp/dist/furo-catalog.js @@ -0,0 +1,5 @@ +import './flow-repeat.js'; +import './fbp.js'; +import './flow-bind.js'; +import './DOMFBP.js'; +//# sourceMappingURL=furo-catalog.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/furo-catalog.js.map b/packages/furo-fbp/dist/furo-catalog.js.map new file mode 100644 index 000000000..9285f54c4 --- /dev/null +++ b/packages/furo-fbp/dist/furo-catalog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"furo-catalog.js","sourceRoot":"./src/","sources":["furo-catalog.js"],"names":[],"mappings":"AAAA,OAAO,kBAAkB,CAAC;AAC1B,OAAO,UAAU,CAAC;AAClB,OAAO,gBAAgB,CAAC;AACxB,OAAO,aAAa,CAAC","sourcesContent":["import './flow-repeat.js';\nimport './fbp.js';\nimport './flow-bind.js';\nimport './DOMFBP.js';\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/vizConnector.d.ts b/packages/furo-fbp/dist/vizConnector.d.ts similarity index 100% rename from packages/furo-fbp/src/vizConnector.d.ts rename to packages/furo-fbp/dist/vizConnector.d.ts diff --git a/packages/furo-fbp/dist/vizConnector.js b/packages/furo-fbp/dist/vizConnector.js new file mode 100644 index 000000000..9e0ffad83 --- /dev/null +++ b/packages/furo-fbp/dist/vizConnector.js @@ -0,0 +1,121 @@ +/** + * Connect to viz.furo.pro to visualize your running application. + * + * ### Usage + * ```js + * + * viz() // starts the rendering at document.body + * + * viz($0) // starts the rendering at the selected element (chrome) + * + * ``` + * + * Set `window._viz.url` to change the viz instance. Default goes to 'https://viz.furo.pro/' + * + * @param root DomNode The root node to start the rendering. + */ +import { FbpBreakpoints } from './FbpBreakpoints.js'; +window._viz = { + url: 'https://viz.furo.pro/', +}; +const bp = JSON.parse(sessionStorage.getItem('__fbp_breakpoints')); +FbpBreakpoints.SetBreakpoints(bp || []); +window.onmessage = m => { + if (m.data.type === 'PARENT_REFRESHED') { + // STEP 3 + window._viz.visualizer = m.source; + window._viz.url = m.data.url; + // notify viz + window._viz.visualizer.postMessage('PARENT_RECONNECTED', window._viz.url); + // eslint-disable-next-line no-use-before-define + messages(); + // eslint-disable-next-line no-console + console.log('VIZ Reconnected'); + } +}; +window.addEventListener('beforeunload', () => { + if (window._viz.visualizer) { + // STEP 1 + window._viz.visualizer.postMessage('PARENT_REFRESHING', window._viz.url); + // eslint-disable-next-line no-console + console.log('PARENT_REFRESHING'); + } +}); +window.viz = root => { + const visualizer = window.open(window._viz.url); + window._viz.visualizer = visualizer; + // build flat node list and register events + // eslint-disable-next-line no-use-before-define + messages(root); +}; +function messages(root) { + if (root === undefined) { + // eslint-disable-next-line no-param-reassign + root = window.document.body; + } + window.onmessage = m => { + if (m.data.type === 'COMPONENT_REQUEST') { + const node = FbpBreakpoints.GetElementByPath(m.data.path); + window._viz.visualizer.postMessage({ + type: 'RENDER_REQUEST', + data: node.shadowRoot?.innerHTML || node.innerHTML, + component: node.tagName, + path: FbpBreakpoints.getDomPath(node), + }, window._viz.url); + // eslint-disable-next-line no-console + console.log('render request for ', node.tagName); + } + if (m.data.type === 'PARENT_COMPONENT_REQUEST') { + const stack = m.data.path.split(' > '); + // todo rewind until next shadow host + while (!stack[stack.length - 1].endsWith('::shadow') && + stack.length > 1) { + stack.pop(); + } + // remove shadow from last element + stack[stack.length - 1] = stack[stack.length - 1].replace('::shadow', ''); + const path = stack.join(' > '); + const node = FbpBreakpoints.GetElementByPath(path); + let data = ''; + if (node.shadowRoot) { + data = node.shadowRoot.innerHTML; + } + else { + data = node.innerHTML; + } + window._viz.visualizer.postMessage({ + type: 'RENDER_REQUEST', + data, + component: node.tagName, + path: FbpBreakpoints.getDomPath(node), + }, window._viz.url); + // eslint-disable-next-line no-console + console.log('render request for ', FbpBreakpoints.GetElementByPath(path)); + } + if (m.data.type === 'BREAKPOINTS') { + FbpBreakpoints.SetBreakpoints(m.data.breakpoints); + sessionStorage.setItem('__fbp_breakpoints', JSON.stringify(m.data.breakpoints)); + } + if (m.data.type === 'ANALYZER_READY') { + let data = root.innerHTML; + if (root.shadowRoot && root.shadowRoot.innerHTML) { + data = root.shadowRoot.innerHTML; + } + // for elements created with domfbp + if (root.vizRoot) { + data = root.vizRoot.innerHTML; + } + window._viz.visualizer.postMessage({ + type: 'BREAKPOINTS', + breakpoints: FbpBreakpoints.Breakpoints(), + }, window._viz.url); + window._viz.visualizer.postMessage({ + type: 'RENDER_REQUEST', + data, + component: root.tagName, + path: FbpBreakpoints.getDomPath(root), + }, window._viz.url); + } + }; +} +//# sourceMappingURL=vizConnector.js.map \ No newline at end of file diff --git a/packages/furo-fbp/dist/vizConnector.js.map b/packages/furo-fbp/dist/vizConnector.js.map new file mode 100644 index 000000000..532022098 --- /dev/null +++ b/packages/furo-fbp/dist/vizConnector.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vizConnector.js","sourceRoot":"./src/","sources":["vizConnector.js"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MA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AE,CAAC;YACrC,IAAI,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC;YAC1B,IAAI,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,CAAC;gBACjD,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YACnC,CAAC;YACD,mCAAmC;YACnC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;gBACjB,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;YAChC,CAAC;YAED,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC;gBACE,IAAI,EAAE,aAAa;gBACnB,WAAW,EAAE,cAAc,CAAC,WAAW,EAAE;aAC1C,EACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAChB,CAAC;YAEF,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAChC;gBACE,IAAI,EAAE,gBAAgB;gBACtB,IAAI;gBACJ,SAAS,EAAE,IAAI,CAAC,OAAO;gBACvB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,IAAI,CAAC;aACtC,EACD,MAAM,CAAC,IAAI,CAAC,GAAG,CAChB,CAAC;QACJ,CAAC;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["/**\n * Connect to viz.furo.pro to visualize your running application.\n *\n * ### Usage\n * ```js\n *\n * viz() // starts the rendering at document.body\n *\n * viz($0) // starts the rendering at the selected element (chrome)\n *\n * ```\n *\n * Set `window._viz.url` to change the viz instance. Default goes to 'https://viz.furo.pro/'\n *\n * @param root DomNode The root node to start the rendering.\n */\n\nimport { FbpBreakpoints } from './FbpBreakpoints.js';\n\nwindow._viz = {\n url: 'https://viz.furo.pro/',\n};\n\nconst bp = JSON.parse(sessionStorage.getItem('__fbp_breakpoints'));\nFbpBreakpoints.SetBreakpoints(bp || []);\n\nwindow.onmessage = m => {\n if (m.data.type === 'PARENT_REFRESHED') {\n // STEP 3\n window._viz.visualizer = m.source;\n window._viz.url = m.data.url;\n // notify viz\n window._viz.visualizer.postMessage('PARENT_RECONNECTED', window._viz.url);\n // eslint-disable-next-line no-use-before-define\n messages();\n // eslint-disable-next-line no-console\n console.log('VIZ Reconnected');\n }\n};\n\nwindow.addEventListener('beforeunload', () => {\n if (window._viz.visualizer) {\n // STEP 1\n window._viz.visualizer.postMessage('PARENT_REFRESHING', window._viz.url);\n // eslint-disable-next-line no-console\n console.log('PARENT_REFRESHING');\n }\n});\n\nwindow.viz = root => {\n const visualizer = window.open(window._viz.url);\n window._viz.visualizer = visualizer;\n // build flat node list and register events\n // eslint-disable-next-line no-use-before-define\n messages(root);\n};\n\nfunction messages(root) {\n if (root === undefined) {\n // eslint-disable-next-line no-param-reassign\n root = window.document.body;\n }\n\n window.onmessage = m => {\n if (m.data.type === 'COMPONENT_REQUEST') {\n const node = FbpBreakpoints.GetElementByPath(m.data.path);\n\n window._viz.visualizer.postMessage(\n {\n type: 'RENDER_REQUEST',\n data: node.shadowRoot?.innerHTML || node.innerHTML,\n component: node.tagName,\n path: FbpBreakpoints.getDomPath(node),\n },\n window._viz.url\n );\n // eslint-disable-next-line no-console\n console.log('render request for ', node.tagName);\n }\n if (m.data.type === 'PARENT_COMPONENT_REQUEST') {\n const stack = m.data.path.split(' > ');\n // todo rewind until next shadow host\n while (\n !stack[stack.length - 1].endsWith('::shadow') &&\n stack.length > 1\n ) {\n stack.pop();\n }\n\n // remove shadow from last element\n stack[stack.length - 1] = stack[stack.length - 1].replace('::shadow', '');\n const path = stack.join(' > ');\n\n const node = FbpBreakpoints.GetElementByPath(path);\n let data = '';\n if (node.shadowRoot) {\n data = node.shadowRoot.innerHTML;\n } else {\n data = node.innerHTML;\n }\n\n window._viz.visualizer.postMessage(\n {\n type: 'RENDER_REQUEST',\n data,\n component: node.tagName,\n path: FbpBreakpoints.getDomPath(node),\n },\n window._viz.url\n );\n // eslint-disable-next-line no-console\n console.log('render request for ', FbpBreakpoints.GetElementByPath(path));\n }\n\n if (m.data.type === 'BREAKPOINTS') {\n FbpBreakpoints.SetBreakpoints(m.data.breakpoints);\n sessionStorage.setItem(\n '__fbp_breakpoints',\n JSON.stringify(m.data.breakpoints)\n );\n }\n\n if (m.data.type === 'ANALYZER_READY') {\n let data = root.innerHTML;\n if (root.shadowRoot && root.shadowRoot.innerHTML) {\n data = root.shadowRoot.innerHTML;\n }\n // for elements created with domfbp\n if (root.vizRoot) {\n data = root.vizRoot.innerHTML;\n }\n\n window._viz.visualizer.postMessage(\n {\n type: 'BREAKPOINTS',\n breakpoints: FbpBreakpoints.Breakpoints(),\n },\n window._viz.url\n );\n\n window._viz.visualizer.postMessage(\n {\n type: 'RENDER_REQUEST',\n data,\n component: root.tagName,\n path: FbpBreakpoints.getDomPath(root),\n },\n window._viz.url\n );\n }\n };\n}\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/package.json b/packages/furo-fbp/package.json index 3e9892490..5903e7645 100644 --- a/packages/furo-fbp/package.json +++ b/packages/furo-fbp/package.json @@ -10,6 +10,14 @@ "email": "", "url": "" }, + "files": [ + "./dist", + "./src", + "icon.svg", + "README.md", + "custom-elements.json", + "web-types.json" + ], "keywords": [ "web-components", "flow based programming", diff --git a/packages/furo-fbp/src/LitFBP.js.map b/packages/furo-fbp/src/LitFBP.js.map deleted file mode 100644 index acc57d544..000000000 --- a/packages/furo-fbp/src/LitFBP.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"LitFBP.js","sourceRoot":"./src/","sources":["LitFBP.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,CAAC,MAAM,MAAM,GAAG,CAAoC,UAAa,EAAE,EAAE;IACzE,MAAM,UAAW,SAAQ,UAAU;QAWjC,YAAY,GAAG,GAAU;YACvB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAXR,uBAAkB,GAAU,EAAE,CAAC;YAE/B,iBAAY,GAA6B,EAAE,CAAC;YAE5C,gBAAW,GAAU,EAAE,CAAC;YAExB,kBA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IACpD,OAAO,UAAkD,CAAC;AAC5D,CAAC,CAAC","sourcesContent":["/**\n * Use this to enable FBP to your lit element written in typescript.\n */\n\nimport { LitElement, PropertyValues } from \"lit\";\n// eslint-disable-next-line import/extensions\nimport {LitFBPAC} from \"./LitFBPAC\"\n\ntype Constructor = new (...args: any[]) => T;\n\nexport const LitFBP = >(superClass: T) => {\n class MixinClass extends superClass {\n private __FBPEventlistener: any[] = [];\n\n private __wirebundle: { [key: string]: [any] } = {};\n\n private __wireQueue: any[] = [];\n\n private __fbpAppended: Boolean = false;\n\n private __fbp_ready: Boolean = false;\n\n constructor(...arg: any[]) {\n super(arg[0]);\n }\n\n /**\n * Auto append fbp for lit elements\n * @private\n */\n protected override firstUpdated(_changedProperties: PropertyValues): void {\n // ensure to append only once\n if (!this.__fbpAppended && this.shadowRoot !== null) {\n this._appendFBP(this.shadowRoot);\n this.__fbpAppended = true;\n }\n\n super.firstUpdated(_changedProperties);\n }\n\n /**\n * Triggers a wire\n * @param wire (String) Name of the wire like --buttonClicked\n * @param detailData (*) data to pass\n * @private\n */\n protected _FBPTriggerWire(wire: string, detailData: any) {\n if (this.__fbp_ready) {\n if (this.__wirebundle[wire]) {\n this.__wirebundle[wire].forEach(receiver => {\n // check for hooks\n if (typeof receiver === \"function\") {\n receiver(detailData);\n } else if (\n typeof receiver.element[receiver.method] === \"function\"\n ) {\n this._call(detailData, receiver);\n } else if (receiver.property) {\n let data = detailData;\n if (receiver.path) {\n data = this._pathGet(detailData, receiver.path);\n }\n this._pathSet(receiver.element, receiver.property, data);\n } else if (receiver.element.localName.includes(\"-\")) {\n // retry call with whenDefined because sometimes the components are just not defined at the time ƒ-method is triggered\n customElements\n .whenDefined(receiver.element.localName)\n .then(() => {\n if (typeof receiver.element[receiver.method] === \"function\") {\n this._call(detailData, receiver);\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `${receiver.method} is not a method of ${receiver.element.nodeName}`,\n receiver.element\n );\n }\n });\n } else {\n // eslint-disable-next-line no-console\n console.warn(\n `${receiver.method} is not a method of ${receiver.element.nodeName}`,\n receiver.element\n );\n }\n });\n }\n } else {\n this.__enqueueTrigger(wire, detailData);\n }\n }\n\n /**\n *\n * @param detailData\n * @param receiver\n * @private\n */\n private _call(detailData: any, receiver: any) {\n let response;\n // array spreaden\n if (\n Array.isArray(detailData) &&\n receiver.element[receiver.method].length > 1\n ) {\n // eslint-disable-next-line prefer-spread\n response = receiver.element[receiver.method].apply(\n receiver.element,\n detailData\n );\n } else {\n let data = detailData;\n if (receiver.path) {\n data = this._pathGet(detailData, receiver.path);\n }\n response = receiver.element[receiver.method](data);\n }\n\n // fnret-function auslösen\n receiver.element.dispatchEvent(\n new CustomEvent(`fnret-${receiver.attrName}`, {\n composed: false,\n bubbles: false,\n detail: response,\n })\n );\n }\n\n /**\n *\n * @param wire (String) Name of the wire\n * @param cb (function) Callback function cb(detailData)\n * @param [before] (Boolean) append before the components are triggered, default is false\n * @returns {number} Index of hook\n * @private\n */\n protected _FBPAddWireHook(wire: string, cb: Function, before: boolean) {\n // eslint-disable-next-line no-param-reassign\n before = before || false;\n if (this.__wirebundle[wire]) {\n if (before) {\n this.__wirebundle[wire].unshift(cb);\n return 0;\n }\n const l = this.__wirebundle[wire].push(cb);\n return l - 1;\n }\n this.__wirebundle[wire] = [cb];\n return 1;\n }\n\n /**\n * Log all triggered wires for this component. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPTraceWires()`\n *\n *\n * @private\n */\n protected _FBPTraceWires() {\n const self = this;\n // eslint-disable-next-line guard-for-in,no-restricted-syntax\n for (const wire in this.__wirebundle) {\n this._FBPAddWireHook(\n wire,\n (e: any) => {\n const ua = navigator.userAgent.toLowerCase();\n let agent = true;\n if (ua.indexOf(\"safari\") !== -1) {\n if (ua.indexOf(\"chrome\") > -1) {\n agent = true; // Chrome\n } else {\n agent = false; // Safari\n }\n }\n\n if (agent) {\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Trace for\", `${this.nodeName}: ${wire}`);\n // eslint-disable-next-line no-console\n console.table([{ host: self, wire, data: e }]);\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Data\");\n // eslint-disable-next-line no-console\n console.log(e);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Target Elements\");\n // eslint-disable-next-line no-console\n console.table(self.__wirebundle[wire]);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Call Stack\");\n // eslint-disable-next-line no-console\n console.log(new Error().stack);\n // eslint-disable-next-line no-console\n console.groupEnd();\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n },\n true\n );\n }\n }\n\n /**\n * Get information for the triggered wire. This function may help you at debugging.\n * Select your element in the dev console and call `$0._FBPDebug('--dataReceived')`\n *\n * @param wire\n * @param openDebugger opens the debugger console, so you can inspect your component.\n * @private\n */\n protected _FBPDebug(wire: string, openDebugger: boolean) {\n const self = this;\n this._FBPAddWireHook(\n wire,\n (e: any) => {\n if (openDebugger) {\n // eslint-disable-next-line no-debugger\n debugger;\n } else {\n const ua = navigator.userAgent.toLowerCase();\n let agent = true;\n if (ua.indexOf(\"safari\") !== -1) {\n if (ua.indexOf(\"chrome\") > -1) {\n agent = true; // Chrome\n } else {\n agent = false; // Safari\n }\n }\n\n if (agent) {\n // eslint-disable-next-line no-console\n console.group(\"Debug\", `${this.nodeName}: ${wire}`);\n // eslint-disable-next-line no-console\n console.group(\"Target Elements\");\n // eslint-disable-next-line no-console\n console.table(self.__wirebundle[wire]);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Data\");\n // eslint-disable-next-line no-console\n console.log(e);\n // eslint-disable-next-line no-console\n console.groupEnd();\n\n // eslint-disable-next-line no-console\n console.groupCollapsed(\"Call Stack\");\n // eslint-disable-next-line no-console\n console.log(new Error().stack);\n // eslint-disable-next-line no-console\n console.groupEnd();\n // eslint-disable-next-line no-console\n console.groupEnd();\n }\n }\n },\n true\n );\n }\n\n /**\n *\n * @param str\n * @return {*}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n private __toCamelCase(str: string) {\n return str.replace(/-([a-z])/g, g => g[1].toUpperCase());\n }\n\n /**\n * parses the dom for flowbased programming tags\n * @param dom dom node\n * @private\n */\n private _appendFBP(dom: ShadowRoot) {\n const self = this;\n const wirebundle = this.__wirebundle;\n // get all elements which live in the host\n const nl = dom.querySelectorAll(\"*\");\n const l = nl.length - 1;\n\n // eslint-disable-next-line func-names\n const _collectReceivers = (element: Element, i: number, attr: string) => {\n // collect receiver\n element.attributes[i].value.split(\",\").forEach(w => {\n const r = this.__resolveWireAndPath(w);\n // create empty if not exist\n if (!wirebundle[r.receivingWire]) {\n // @ts-ignore\n wirebundle[r.receivingWire] = [];\n }\n wirebundle[r.receivingWire].push({\n element,\n method: this.__toCamelCase(attr),\n attrName: attr,\n path: r.path,\n });\n });\n };\n // eslint-disable-next-line func-names\n const _collectPropertySetters = (\n element: Element,\n i: number,\n property: string\n ) => {\n // split multiple wires\n element.attributes[i].value.split(\",\").forEach((w: string) => {\n const r = this.__resolveWireAndPath(w);\n // create empty if not exist\n if (!wirebundle[r.receivingWire]) {\n // @ts-ignore\n wirebundle[r.receivingWire] = [];\n }\n wirebundle[r.receivingWire].push({\n element,\n property: this.__toCamelCase(property),\n path: r.path,\n });\n });\n };\n\n // eslint-disable-next-line func-names\n const _extractEventWires = (fwire: string) => {\n let wire;\n\n const trimmedWire = fwire.trim();\n\n let type = \"call\";\n if (trimmedWire.startsWith(\"((\")) {\n wire = trimmedWire.substring(2, trimmedWire.length - 2);\n type = \"setValue\";\n } else if (trimmedWire.startsWith(\"-^\")) {\n wire = trimmedWire.substring(2);\n type = \"fireOnHost\";\n } else if (trimmedWire.startsWith(\"^\")) {\n wire = trimmedWire.substring(1);\n type = \"fire\";\n if (trimmedWire.startsWith(\"^^\")) {\n wire = trimmedWire.substring(2);\n type = \"fireBubble\";\n }\n } else if (trimmedWire === \":STOP\") {\n type = \"stop\";\n wire = \"stop\";\n } else if (trimmedWire === \":PREVENTDEFAULT\") {\n type = \"preventdefault\";\n wire = \"preventdefault\";\n } else {\n wire = trimmedWire;\n type = \"call\";\n }\n return { type, wire };\n };\n\n // eslint-disable-next-line no-plusplus\n for (let x = l; x >= 0; --x) {\n const element = nl[x];\n\n // skip template tags\n if (element.tagName === \"TEMPLATE\") {\n // eslint-disable-next-line no-continue\n continue;\n }\n\n for (let i = 0; i < element.attributes.length; i += 1) {\n // collect receiving tags\n if (element.attributes[i].name.startsWith(\"fn-\")) {\n const attr = element.attributes[i].name.substring(3);\n _collectReceivers.call(this, element, i, attr);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n // collect sending tags\n if (element.attributes[i].name.startsWith(\"at-\")) {\n const eventname = element.attributes[i].name.substring(3);\n const fwires = element.attributes[i].value;\n fwires.split(\",\").forEach(fwire => {\n const __ret = _extractEventWires(fwire);\n // eslint-disable-next-line no-use-before-define\n registerEvent(eventname, __ret.type, __ret.wire, element);\n });\n // eslint-disable-next-line no-continue\n continue;\n }\n // collect data property setter receiver\n if (element.attributes[i].name.startsWith(\"set-\")) {\n const property = element.attributes[i].name.substring(4);\n _collectPropertySetters.call(this, element, i, property);\n // eslint-disable-next-line no-continue\n continue;\n }\n\n }\n }\n\n /**\n * register event on current element\n * @param eventname\n * @param type\n * @param wire\n * @private\n */\n function registerEvent(\n eventname: string,\n type: string,\n wire: string,\n element: Element\n ) {\n // find properties in wire\n // eslint-disable-next-line no-useless-escape\n const match = wire.match(/([a-z0-9\\-_*\\.]+)/gi);\n\n const handler: Record = {\n // prevent default and stop propagation\n stop(e: Event) {\n e.stopPropagation();\n },\n preventdefault(e: Event) {\n e.preventDefault();\n },\n // todo veith nachschauen ob |Event\n call(e: CustomEvent) {\n /**\n * Prüfe ob die Funktion mit einem Wert aus dem Host oder mit den Details des Events ausgeführt werden soll.\n * --wire(hostName) ==> wirft this.hostName in die Funktion sonst wird e.detail verwendet\n *\n */\n\n let effectiveWire = wire;\n let detailData = e.detail;\n if (match !== null && match.length > 1) {\n // --wireName(*) sends the raw event\n // --wireName(*.mouseX) sends property mouseX of the event\n\n if (match[1].startsWith(\"*\")) {\n if (match[1].length === 1) {\n // send raw event\n detailData = e;\n } else {\n // send event subprop with *.notDetail.xxx\n detailData = self._pathGet(\n e,\n match[1].substring(2, match[1].length)\n );\n }\n } else {\n // send host property\n detailData = self._pathGet(self, match[1]);\n }\n // eslint-disable-next-line prefer-destructuring\n effectiveWire = match[0];\n }\n self._FBPTriggerWire(effectiveWire, detailData);\n },\n\n fire(e: CustomEvent) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n\n let edetail: any;\n // send details with *.sub or *\n if (prop.startsWith(\"*\")) {\n if (prop.length === 1) {\n // send raw event\n edetail = e;\n } else {\n edetail = self._pathGet(e, prop.substring(2));\n }\n } else {\n edetail = self._pathGet(self, prop);\n }\n\n const customEvent = new CustomEvent(theEvent, {\n composed: false,\n bubbles: true,\n detail: edetail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n } else {\n const customEvent = new CustomEvent(wire, {\n composed: false,\n bubbles: true,\n detail: e.detail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n }\n },\n\n fireOnHost(e: CustomEvent) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n let edetail: any;\n\n // send details with *.sub or *\n if (prop.startsWith(\"*\")) {\n if (prop.length === 1) {\n // send raw event\n edetail = e;\n } else {\n edetail = self._pathGet(e, prop.substring(2));\n }\n } else {\n edetail = self._pathGet(self, prop);\n }\n\n const customEvent = new CustomEvent(theEvent, {\n composed: false,\n bubbles: true,\n detail: edetail,\n });\n\n self.dispatchEvent(customEvent);\n } else {\n const customEvent = new CustomEvent(wire, {\n composed: false,\n bubbles: true,\n detail: e.detail,\n });\n\n self.dispatchEvent(customEvent);\n }\n },\n\n fireBubble(e: CustomEvent) {\n if (match !== null && match.length > 1) {\n const prop = match[1];\n const theEvent = match[0];\n let edetail: any;\n\n // send details with *.sub or *\n\n if (prop.startsWith(\"*\")) {\n if (prop.length === 1) {\n // send raw event\n edetail = e;\n } else {\n edetail = self._pathGet(e, prop.substring(2));\n }\n } else {\n edetail = self._pathGet(self, prop);\n }\n\n const customEvent = new CustomEvent(theEvent, {\n composed: true,\n bubbles: true,\n detail: edetail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n } else {\n const customEvent = new CustomEvent(wire, {\n composed: true,\n bubbles: true,\n detail: e.detail,\n });\n\n // @ts-ignore\n e.currentTarget.dispatchEvent(customEvent);\n }\n },\n setValue(e: any) {\n self._pathSet(self, wire, e.detail);\n // self.set(wire, e.detail, self);\n },\n };\n\n element.addEventListener(eventname, handler[type]);\n self.__FBPEventlistener.push({\n element,\n event: eventname,\n handler: handler[type],\n });\n }\n\n // queueing for _FBPTriggerWire\n if (!this.__fbp_ready) {\n this._FBPReady();\n\n const queuelength = this.__wireQueue.length;\n for (let i = 0; i < queuelength; i += 1) {\n const t = this.__wireQueue.shift();\n this._FBPTriggerWire(t.w, t.d);\n }\n }\n }\n\n /**\n * Livecycle method\n * This method is called, when the wires are ready.\n * And triggers the `|--FBPready` wire. This does *not* respect a lit updateComplete\n * @private\n */\n protected _FBPReady() {\n this.__fbp_ready = true;\n this._FBPTriggerWire(\"|--FBPready\", this);\n }\n\n /**\n *\n * @param wire\n * @param detailData\n * @private\n */\n private __enqueueTrigger(wire: string, detailData: any) {\n this.__wireQueue.push({ w: wire, d: detailData });\n }\n\n /**\n *\n * @param w\n * @return {{path, receivingWire}}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n private __resolveWireAndPath(w: string) {\n // finde --wire(*.xx.yy) => group1 = --wire group2 = xx.yy\n\n // eslint-disable-next-line no-useless-escape\n const match = w.trim().match(/(^[^\\(]*)\\(?\\*?\\.?([^\\)]*)/);\n\n // @ts-ignore\n const receivingWire = match[1];\n // @ts-ignore\n const path = match[2];\n\n return { receivingWire, path };\n }\n\n /**\n * Reads a value from a path. If any sub-property in the path is `undefined`,\n * this method returns `undefined` (will never throw.\n *\n * @param {Object} root Object from which to dereference path from\n * @param {string | !Array} path Path to read\n * @return {*} Value at path, or `undefined` if the path could not be fully dereferenced.\n * @protected\n */\n protected _pathGet(root: any, path: string) {\n let prop = root;\n const parts = this._split(path);\n // Loop over path parts[0..n-1] and dereference\n for (let i = 0; i < parts.length; i += 1) {\n if (!prop) {\n return false;\n }\n const part = parts[i];\n prop = prop[part];\n }\n\n return prop;\n }\n\n /**\n * Sets a value to a path. If any sub-property in the path is `undefined`,\n * this method will no-op.\n *\n * @param {Object} root Object from which to dereference path from\n * @param {string | !Array} path Path to set\n * @param {*} value Value to set to path\n * @private\n */\n protected _pathSet(root: any, path: string, value: any) {\n let prop = root;\n const parts = this._split(path);\n const last = parts[parts.length - 1];\n // used for @-event=\"((prop.sub))\"\n if (parts.length > 1) {\n // Loop over path parts[0..n-2] and dereference\n for (let i = 0; i < parts.length - 1; i += 1) {\n const part = parts[i];\n prop = prop[part];\n if (!prop) {\n return false;\n }\n }\n // Set value to object at end of path\n prop[last] = value;\n } else {\n // Simple property set\n prop[path] = value;\n }\n return parts.join(\".\");\n }\n\n /**\n * Splits a path into an array of property names. Accepts either arrays\n * of path parts or strings.\n *\n * Example:\n *\n * ```\n * split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz']\n * split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz']\n * ```\n *\n * @param {string | !Array} path Input path\n * @suppress {checkTypes}\n * @private\n */\n // eslint-disable-next-line class-methods-use-this\n protected _split(path: string) {\n return path.toString().split(\".\");\n }\n }\n\n // Cast return type to the superClass type passed in\n return MixinClass as unknown as Constructor & T;\n};\n"]} \ No newline at end of file diff --git a/packages/furo-fbp/src/empty-fbp-node.d.ts b/packages/furo-fbp/src/empty-fbp-node.d.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/packages/furo-fbp/src/empty-fbp-node.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/furo-fbp/src/flow-bind.d.ts b/packages/furo-fbp/src/flow-bind.d.ts deleted file mode 100644 index cb0ff5c3b..000000000 --- a/packages/furo-fbp/src/flow-bind.d.ts +++ /dev/null @@ -1 +0,0 @@ -export {}; diff --git a/packages/furo-fbp/src/ngFBP.ts b/packages/furo-fbp/src/ngFBP.ts deleted file mode 100644 index bc410d715..000000000 --- a/packages/furo-fbp/src/ngFBP.ts +++ /dev/null @@ -1,904 +0,0 @@ -// @ts-ignore -import {Injectable, ElementRef} from '@angular/core'; -import "@furo/fbp/src/vizConnector"; -import {FbpBreakpoints} from '@furo/fbp/src/FbpBreakpoints.js'; - -/** - * FBP support for angular components. - * - * Usage: - * - * include `"node_modules/@furo/fbp/src/ngFBP.ts"` in your tsconfig includes - * - * ``` - * - * import {Component, ElementRef} from '@angular/core'; - * import {NgFBP} from "@furo/fbp/src/ngFBP"; - * - * // extend NgFBP. - * export class AppComponent extends NgFBP { - * - * // set the reference in the constructor. - * constructor(elref: ElementRef) { - * super(elref) - * ``` - */ -// eslint-disable-next-line -@Injectable() -export class NgFBP { - - private __FBPEventlistener: any[] = []; - - private __wirebundle: { [key: string]: [any] } = {}; - - private __wireQueue: any[] = []; - - private __fbpAppended: Boolean = false; - - private __fbp_ready: Boolean = false; - - private _domRef: HTMLElement; - - private __domPath?: String; - - constructor(elref: ElementRef) { - - /** - * used to store the listeners - * @type {*[]} - * @private - */ - this.__FBPEventlistener = []; - /** - * - * @type {{}} - * @private - */ - this.__wirebundle = {}; - /** - * - * @type {*[]} - * @private - */ - this.__wireQueue = []; - this._domRef = elref.nativeElement - - } - - - ngAfterContentInit() { - // ensure to append only once - if (!this.__fbpAppended) { - this._appendFBP(this._domRef); - this.__fbpAppended = true; - } - - } - - /** - * Triggers a wire - * @param wire (String) Name of the wire like --buttonClicked - * @param detailData (*) data to pass - */ - _FBPTriggerWire(wire: string, detailData: any) { - if (this.__fbp_ready) { - - /** - * Check breakpoints, this slows down every wire (if you have set breakpoints). - * While debuging, this is absolute OK. - */ - FbpBreakpoints.Breakpoints().forEach(breakpoint => { - // start with cheapest - - - if ( - breakpoint.enabled && - breakpoint.wire === wire && - breakpoint.path.endsWith(this._domRef.tagName.toLowerCase()) - ) { - if (this.__domPath === undefined) { - this.__domPath = FbpBreakpoints.getDomPath(this._domRef); - } - - if (this.__domPath === breakpoint.path) { - // eslint-disable-next-line default-case - switch (breakpoint.kind) { - case 'BREAKPOINT': - // eslint-disable-next-line no-unused-vars,no-case-declarations - const tagName = this._domRef.tagName.toLowerCase(); - // eslint-disable-next-line no-unused-expressions - wire; - // eslint-disable-next-line no-unused-expressions - detailData; - // eslint-disable-next-line no-case-declarations,no-unused-vars - const domnode = FbpBreakpoints.GetElementByPath( - breakpoint.path - ); - // eslint-disable-next-line no-case-declarations,no-unused-vars - const targets = this.__wirebundle[wire]; - - // eslint-disable-next-line no-debugger - debugger; - break; - case 'CONDITIONAL': - // eslint-disable-next-line no-case-declarations,no-new-func - const c = new Function( - 'data', - `return (${breakpoint.condition})` - ); - if (c.call(this, detailData)) { - // eslint-disable-next-line no-case-declarations,no-unused-vars - const {condition} = breakpoint; - // eslint-disable-next-line no-case-declarations,no-unused-vars,no-shadow - const tagName = this._domRef.tagName.toLowerCase(); - // eslint-disable-next-line no-case-declarations,no-unused-vars,no-unused-expressions - wire; - // eslint-disable-next-line no-case-declarations,no-unused-vars,no-unused-expressions - detailData; - // eslint-disable-next-line no-unused-vars,no-shadow - const domnode = FbpBreakpoints.GetElementByPath( - breakpoint.path - ); - // eslint-disable-next-line no-unused-vars,no-shadow - const targets = this.__wirebundle[wire]; - - // eslint-disable-next-line no-debugger - debugger; - } - - break; - case 'TRACE': - // eslint-disable-next-line no-case-declarations - const ua = navigator.userAgent.toLowerCase(); - // eslint-disable-next-line no-case-declarations - let agent = true; - if (ua.indexOf('safari') !== -1) { - if (ua.indexOf('chrome') > -1) { - agent = true; // Chrome - } else { - agent = false; // Safari - } - } - - if (agent) { - // eslint-disable-next-line no-console - console.group('Trace', `${this._domRef.nodeName}: ${wire}`); - - // eslint-disable-next-line no-console - console.log( - FbpBreakpoints.GetElementByPath(breakpoint.path) - ); - // eslint-disable-next-line no-console - console.group('Target Elements'); - // eslint-disable-next-line no-console - console.table(this.__wirebundle[wire]); - // eslint-disable-next-line no-console - console.groupEnd(); - - // eslint-disable-next-line no-console - console.groupCollapsed('Data'); - // eslint-disable-next-line no-console - console.log(detailData); - // eslint-disable-next-line no-console - console.groupEnd(); - - // eslint-disable-next-line no-console - console.groupCollapsed('Call Stack'); - // eslint-disable-next-line no-console - console.log(new Error().stack); - // eslint-disable-next-line no-console - console.groupEnd(); - // eslint-disable-next-line no-console - console.groupEnd(); - } - break; - } - } - } - }); - - if (this.__wirebundle[wire]) { - this.__wirebundle[wire].forEach(receiver => { - // check for hooks - if (typeof receiver === 'function') { - receiver(detailData); - } else if ( - typeof receiver.element[receiver.method] === 'function' - ) { - this._call(detailData, receiver); - } else if (receiver.property) { - let data = detailData; - if (receiver.path) { - data = this._pathGet(detailData, receiver.path); - } - this._pathSet(receiver.element, receiver.property, data); - } else if (receiver.element.localName.includes('-')) { - // retry call with whenDefined because sometimes the components are just not defined at the time ƒ-method is triggered - customElements - .whenDefined(receiver.element.localName) - .then(() => { - if (typeof receiver.element[receiver.method] === 'function') { - this._call(detailData, receiver); - } else { - // eslint-disable-next-line no-console - console.warn( - `${receiver.method} is not a method of ${receiver.element.nodeName}`, - receiver.element - ); - } - }); - } else { - // eslint-disable-next-line no-console - console.warn( - `${receiver.method} is not a method of ${receiver.element.nodeName}`, - receiver.element - ); - } - }); - } - } else { - this.__enqueueTrigger(wire, detailData); - } - } - - /** - * - * @param detailData - * @param receiver - */ - _call(detailData: any, receiver: any) { - let response; - // array spreaden - if ( - Array.isArray(detailData) && - receiver.element[receiver.method].length > 1 - ) { - // eslint-disable-next-line prefer-spread - response = receiver.element[receiver.method].apply( - receiver.element, - detailData - ); - } else { - let data = detailData; - if (receiver.path) { - data = this._pathGet(detailData, receiver.path); - } - response = receiver.element[receiver.method](data); - } - - // fnret-function auslösen - receiver.element.dispatchEvent( - new CustomEvent(`fnret-${receiver.attrName}`, { - composed: false, - bubbles: false, - detail: response, - }) - ); - - // @-ƒ-function auslösen - receiver.element.dispatchEvent( - new CustomEvent(`ƒ-${receiver.attrName}`, { - composed: false, - bubbles: false, - detail: response, - }) - ); - } - - /** - * - * @param wire (String) Name of the wire - * @param cb (function) Callback function cb(detailData) - * @param [before] (Boolean) append before the components are triggered, default is false - * @returns {number} Index of hook - */ - _FBPAddWireHook(wire: string, cb: Function, before: boolean) { - // eslint-disable-next-line no-param-reassign - before = before || false; - if (this.__wirebundle[wire]) { - if (before) { - this.__wirebundle[wire].unshift(cb); - return 0; - } - const l = this.__wirebundle[wire].push(cb); - return l - 1; - } - this.__wirebundle[wire] = [cb]; - return 1; - } - - /** - * Log all triggered wires for this component. This function may help you at debugging. - * Select your element in the dev console and call `$0._FBPTraceWires()` - * - * - */ - _FBPTraceWires() { - const self = this; - // eslint-disable-next-line guard-for-in,no-restricted-syntax - for (const wire in this.__wirebundle) { - this._FBPAddWireHook( - wire, - (e: any) => { - const ua = navigator.userAgent.toLowerCase(); - let agent = true; - if (ua.indexOf('safari') !== -1) { - if (ua.indexOf('chrome') > -1) { - agent = true; // Chrome - } else { - agent = false; // Safari - } - } - - if (agent) { - // eslint-disable-next-line no-console - console.groupCollapsed('Trace for', `${this._domRef.nodeName}: ${wire}`); - // eslint-disable-next-line no-console - console.table([{host: self, wire, data: e}]); - - // eslint-disable-next-line no-console - console.groupCollapsed('Data'); - // eslint-disable-next-line no-console - console.log(e); - // eslint-disable-next-line no-console - console.groupEnd(); - - // eslint-disable-next-line no-console - console.groupCollapsed('Target Elements'); - // eslint-disable-next-line no-console - console.table(self.__wirebundle[wire]); - // eslint-disable-next-line no-console - console.groupEnd(); - - // eslint-disable-next-line no-console - console.groupCollapsed('Call Stack'); - // eslint-disable-next-line no-console - console.log(new Error().stack); - // eslint-disable-next-line no-console - console.groupEnd(); - // eslint-disable-next-line no-console - console.groupEnd(); - } - }, - true - ); - } - } - - /** - * Get information for the triggered wire. This function may help you at debugging. - * Select your element in the dev console and call `$0._FBPDebug('--dataReceived')` - * - * @param wire - * @param openDebugger opens the debugger console, so you can inspect your component. - */ - _FBPDebug(wire: string, openDebugger: boolean) { - const self = this; - this._FBPAddWireHook( - wire, - (e: any) => { - if (openDebugger) { - // eslint-disable-next-line no-debugger - debugger; - } else { - const ua = navigator.userAgent.toLowerCase(); - let agent = true; - if (ua.indexOf('safari') !== -1) { - if (ua.indexOf('chrome') > -1) { - agent = true; // Chrome - } else { - agent = false; // Safari - } - } - - if (agent) { - // eslint-disable-next-line no-console - console.group('Debug', `${this._domRef.nodeName}: ${wire}`); - // eslint-disable-next-line no-console - console.group('Target Elements'); - // eslint-disable-next-line no-console - console.table(self.__wirebundle[wire]); - // eslint-disable-next-line no-console - console.groupEnd(); - - // eslint-disable-next-line no-console - console.groupCollapsed('Data'); - // eslint-disable-next-line no-console - console.log(e); - // eslint-disable-next-line no-console - console.groupEnd(); - - // eslint-disable-next-line no-console - console.groupCollapsed('Call Stack'); - // eslint-disable-next-line no-console - console.log(new Error().stack); - // eslint-disable-next-line no-console - console.groupEnd(); - // eslint-disable-next-line no-console - console.groupEnd(); - } - } - }, - true - ); - } - - /** - * - * @param str - * @return {*} - */ - // eslint-disable-next-line class-methods-use-this - private __toCamelCase(str: string) { - return str.replace(/-([a-z])/g, g => g[1].toUpperCase()); - } - - /** - * parses the dom for flowbased programming tags - * @param dom dom node - */ - _appendFBP(dom: HTMLElement) { - const self = this; - const wirebundle = this.__wirebundle; - // get all elements which live in the host - const nl = dom.querySelectorAll('*'); - const l = nl.length - 1; - - // eslint-disable-next-line func-names - const _collectReceivers = (element: Element, i: number, attr: string) => { - // collect receiver - element.attributes[i].value.split(',').forEach(w => { - const r = this.__resolveWireAndPath(w); - // create empty if not exist - if (!wirebundle[r.receivingWire]) { - // @ts-ignore - wirebundle[r.receivingWire] = []; - } - wirebundle[r.receivingWire].push({ - element, - method: this.__toCamelCase(attr), - attrName: attr, - path: r.path, - }); - }); - }; - // eslint-disable-next-line func-names - const _collectPropertySetters = ( - element: Element, - i: number, - property: string - ) => { - // split multiple wires - element.attributes[i].value.split(',').forEach((w: string) => { - const r = this.__resolveWireAndPath(w); - // create empty if not exist - if (!wirebundle[r.receivingWire]) { - // @ts-ignore - wirebundle[r.receivingWire] = []; - } - wirebundle[r.receivingWire].push({ - element, - property: this.__toCamelCase(property), - path: r.path, - }); - }); - }; - - // eslint-disable-next-line func-names - const _extractEventWires = (fwire: string) => { - let wire; - - const trimmedWire = fwire.trim(); - - let type = 'call'; - if (trimmedWire.startsWith('((')) { - wire = trimmedWire.substring(2, trimmedWire.length - 2); - type = 'setValue'; - } else if (trimmedWire.startsWith('-^')) { - wire = trimmedWire.substring(2); - type = 'fireOnHost'; - } else if (trimmedWire.startsWith('^')) { - wire = trimmedWire.substring(1); - type = 'fire'; - if (trimmedWire.startsWith('^^')) { - wire = trimmedWire.substring(2); - type = 'fireBubble'; - } - } else if (trimmedWire === ':STOP') { - type = 'stop'; - wire = 'stop'; - } else if (trimmedWire === ':PREVENTDEFAULT') { - type = 'preventdefault'; - wire = 'preventdefault'; - } else { - wire = trimmedWire; - type = 'call'; - } - return {type, wire}; - }; - - // eslint-disable-next-line no-plusplus - for (let x = l; x >= 0; --x) { - const element = nl[x]; - - // skip template tags - if (element.tagName === 'TEMPLATE') { - // eslint-disable-next-line no-continue - continue; - } - - for (let i = 0; i < element.attributes.length; i += 1) { - // collect receiving tags - if (element.attributes[i].name.startsWith('fn-')) { - const attr = element.attributes[i].name.substring(3); - _collectReceivers.call(this, element, i, attr); - // eslint-disable-next-line no-continue - continue; - } - - // collect sending tags - if (element.attributes[i].name.startsWith('at-')) { - const eventname = element.attributes[i].name.substring(3); - const fwires = element.attributes[i].value; - fwires.split(',').forEach(fwire => { - const __ret = _extractEventWires(fwire); - // eslint-disable-next-line no-use-before-define - registerEvent(eventname, __ret.type, __ret.wire, element); - }); - // eslint-disable-next-line no-continue - continue; - } - // collect data property setter receiver - if (element.attributes[i].name.startsWith('set-')) { - const property = element.attributes[i].name.substring(4); - _collectPropertySetters.call(this, element, i, property); - // eslint-disable-next-line no-continue - continue; - } - - // collect data property receiver - if (element.attributes[i].name.startsWith('ƒ-.')) { - const property = element.attributes[i].name.substring(3); - _collectPropertySetters.call(this, element, i, property); - // eslint-disable-next-line no-continue - continue; - } - - // collect receiving tags - if (element.attributes[i].name.startsWith('ƒ-')) { - const attr = element.attributes[i].name.substring(2); - _collectReceivers.call(this, element, i, attr); - // eslint-disable-next-line no-continue - continue; - } - - // collect sending tags - if (element.attributes[i].name.startsWith('@-')) { - const eventname = element.attributes[i].name.substring(2); - const fwires = element.attributes[i].value; - fwires.split(',').forEach(fwire => { - const __ret = _extractEventWires(fwire); - // eslint-disable-next-line no-use-before-define - registerEvent(eventname, __ret.type, __ret.wire, element); - }); - // eslint-disable-next-line no-continue - continue; - } - } - } - - /** - * register event on current element - * @param eventname - * @param type - * @param wire - * @param element - */ - function registerEvent( - eventname: string, - type: string, - wire: string, - element: Element - ) { - // find properties in wire - // eslint-disable-next-line no-useless-escape - const match = wire.match(/([a-z0-9\-_*\.]+)/gi); - - const handler: Record = { - // prevent default and stop propagation - stop(e: Event) { - e.stopPropagation(); - }, - preventdefault(e: Event) { - e.preventDefault(); - }, - // todo veith nachschauen ob |Event - call(e: CustomEvent) { - /** - * Prüfe ob die Funktion mit einem Wert aus dem Host oder mit den Details des Events ausgeführt werden soll. - * --wire(hostName) ==> wirft this.hostName in die Funktion sonst wird e.detail verwendet - * - */ - - let effectiveWire = wire; - let detailData = e.detail; - if (match !== null && match.length > 1) { - // --wireName(*) sends the raw event - // --wireName(*.mouseX) sends property mouseX of the event - - if (match[1].startsWith('*')) { - if (match[1].length === 1) { - // send raw event - detailData = e; - } else { - // send event subprop with *.notDetail.xxx - detailData = self._pathGet( - e, - match[1].substring(2, match[1].length) - ); - } - } else { - // send host property - detailData = self._pathGet(self, match[1]); - } - // eslint-disable-next-line prefer-destructuring - effectiveWire = match[0]; - } - self._FBPTriggerWire(effectiveWire, detailData); - }, - - fire(e: CustomEvent) { - if (match !== null && match.length > 1) { - const prop = match[1]; - const theEvent = match[0]; - - let edetail: any; - // send details with *.sub or * - if (prop.startsWith('*')) { - if (prop.length === 1) { - // send raw event - edetail = e; - } else { - edetail = self._pathGet(e, prop.substring(2)); - } - } else { - edetail = self._pathGet(self, prop); - } - - const customEvent = new CustomEvent(theEvent, { - composed: false, - bubbles: true, - detail: edetail, - }); - - // @ts-ignore - e.currentTarget.dispatchEvent(customEvent); - } else { - const customEvent = new CustomEvent(wire, { - composed: false, - bubbles: true, - detail: e.detail, - }); - - // @ts-ignore - e.currentTarget.dispatchEvent(customEvent); - } - }, - - fireOnHost(e: CustomEvent) { - if (match !== null && match.length > 1) { - const prop = match[1]; - const theEvent = match[0]; - let edetail: any; - - // send details with *.sub or * - if (prop.startsWith('*')) { - if (prop.length === 1) { - // send raw event - edetail = e; - } else { - edetail = self._pathGet(e, prop.substring(2)); - } - } else { - edetail = self._pathGet(self, prop); - } - - const customEvent = new CustomEvent(theEvent, { - composed: false, - bubbles: true, - detail: edetail, - }); - - self._domRef.dispatchEvent(customEvent); - } else { - const customEvent = new CustomEvent(wire, { - composed: false, - bubbles: true, - detail: e.detail, - }); - - self._domRef.dispatchEvent(customEvent); - } - }, - - fireBubble(e: CustomEvent) { - if (match !== null && match.length > 1) { - const prop = match[1]; - const theEvent = match[0]; - let edetail: any; - - // send details with *.sub or * - - if (prop.startsWith('*')) { - if (prop.length === 1) { - // send raw event - edetail = e; - } else { - edetail = self._pathGet(e, prop.substring(2)); - } - } else { - edetail = self._pathGet(self, prop); - } - - const customEvent = new CustomEvent(theEvent, { - composed: true, - bubbles: true, - detail: edetail, - }); - - // @ts-ignore - e.currentTarget.dispatchEvent(customEvent); - } else { - const customEvent = new CustomEvent(wire, { - composed: true, - bubbles: true, - detail: e.detail, - }); - - // @ts-ignore - e.currentTarget.dispatchEvent(customEvent); - } - }, - setValue(e: any) { - self._pathSet(self, wire, e.detail); - // self.set(wire, e.detail, self); - }, - }; - - element.addEventListener(eventname, handler[type]); - self.__FBPEventlistener.push({ - element, - event: eventname, - handler: handler[type], - }); - } - - // queueing for _FBPTriggerWire - if (!this.__fbp_ready) { - this._FBPReady(); - - const queuelength = this.__wireQueue.length; - for (let i = 0; i < queuelength; i += 1) { - const t = this.__wireQueue.shift(); - this._FBPTriggerWire(t.w, t.d); - } - } - } - - /** - * Livecycle method - * This method is called, when the wires are ready. - * And triggers the `|--FBPready` wire. This does *not* respect a lit updateComplete - */ - _FBPReady() { - this.__fbp_ready = true; - this._FBPTriggerWire('|--FBPready', this); - } - - /** - * - * @param wire - * @param detailData - */ - private __enqueueTrigger(wire: string, detailData: any) { - this.__wireQueue.push({w: wire, d: detailData}); - } - - /** - * - * @param w - * @return {{path, receivingWire}} - */ - // eslint-disable-next-line class-methods-use-this - private __resolveWireAndPath(w: string) { - // finde --wire(*.xx.yy) => group1 = --wire group2 = xx.yy - - // eslint-disable-next-line no-useless-escape - const match = w.trim().match(/(^[^\(]*)\(?\*?\.?([^\)]*)/); - - // @ts-ignore - const receivingWire = match[1]; - // @ts-ignore - const path = match[2]; - - return {receivingWire, path}; - } - - /** - * Reads a value from a path. If any sub-property in the path is `undefined`, - * this method returns `undefined` (will never throw. - * - * @param {Object} root Object from which to dereference path from - * @param {string | !Array} path Path to read - * @return {*} Value at path, or `undefined` if the path could not be fully dereferenced. - */ - _pathGet(root: any, path: string) { - let prop = root; - const parts = this._split(path); - // Loop over path parts[0..n-1] and dereference - for (let i = 0; i < parts.length; i += 1) { - if (!prop) { - return false; - } - const part = parts[i]; - prop = prop[part]; - } - - return prop; - } - - /** - * Sets a value to a path. If any sub-property in the path is `undefined`, - * this method will no-op. - * - * @param {Object} root Object from which to dereference path from - * @param {string | !Array} path Path to set - * @param {*} value Value to set to path - * @return {string | boolean} The normalized version of the input path, return false if no prop - */ - _pathSet(root: any, path: string, value: any) { - let prop = root; - const parts = this._split(path); - const last = parts[parts.length - 1]; - // used for @-event="((prop.sub))" - if (parts.length > 1) { - // Loop over path parts[0..n-2] and dereference - for (let i = 0; i < parts.length - 1; i += 1) { - const part = parts[i]; - prop = prop[part]; - if (!prop) { - return false; - } - } - // Set value to object at end of path - prop[last] = value; - } else { - // Simple property set - prop[path] = value; - } - return parts.join('.'); - } - - /** - * Splits a path into an array of property names. Accepts either arrays - * of path parts or strings. - * - * Example: - * - * ``` - * split(['foo.bar', 0, 'baz']) // ['foo', 'bar', '0', 'baz'] - * split('foo.bar.0.baz') // ['foo', 'bar', '0', 'baz'] - * ``` - * - * @param {string | !Array} path Input path - * @return {!Array} Array of path parts - * @suppress {checkTypes} - */ - // eslint-disable-next-line class-methods-use-this - _split(path: string | [string|number]) :string[] { - return path.toString().split('.'); - } - - -}; - diff --git a/packages/furo-fbp/tsconfig.json b/packages/furo-fbp/tsconfig.json index 7b92716ca..d3b9b7ad4 100644 --- a/packages/furo-fbp/tsconfig.json +++ b/packages/furo-fbp/tsconfig.json @@ -1,19 +1,33 @@ { "compilerOptions": { - "target": "ES2021", + "target": "ES2022", + "module": "ESNext", "moduleResolution": "node", "noEmitOnError": true, "strict": true, - "module":"es2022", + "experimentalDecorators": true, + "outDir": "dist", "sourceMap": true, "inlineSources": true, + "resolveJsonModule": true, + "allowJs": true, // Generate d.ts files "declaration": true, "skipLibCheck": true, "sourceRoot": "./src/", "rootDir": "./src/", + "lib": ["es2019", "dom", "dom.iterable"], + "useDefineForClassFields": false, + "plugins": [ + { + "name": "typescript-lit-html-plugin" + } + ] }, - - "include": ["src/**/*.ts", "global.d.ts"], - "exclude": ["src/ngFBP.ts"] + "tsc-alias": { + "resolveFullPaths": true, + "verbose": false + }, + "exclude": ["dist", "test"], + "include": ["src/**/*", "global.d.ts"] } diff --git a/packages/furo-route/src/furo-pages.js b/packages/furo-route/src/furo-pages.js index 7ea08fa44..aa8678aaf 100644 --- a/packages/furo-route/src/furo-pages.js +++ b/packages/furo-route/src/furo-pages.js @@ -158,7 +158,7 @@ export class FuroPages extends LitElement { * * To meke "sub" pages do not forget to enable the `url-space-regex` property on the *furo-location* component which feeds this component. * - * If the page/view does not exist and you have a page "404" defined, the 404 will be shown + * If the page/view does not exist, and you have a page "404" defined, the 404 will be shown * * If the page/view does not exist AND 404 does not exist, the default page gets activated. *