From 92cae49d393be2ae3597d3592184e450c8d3f575 Mon Sep 17 00:00:00 2001 From: Michael Klein Date: Mon, 23 Dec 2019 23:05:27 +0100 Subject: [PATCH] now supports partials directly in templates --- dist/src/html.js | 28 ++- dist/src/html.js.map | 2 +- example/dist/example.77de5100.js | 356 ++++++++++++++------------- example/dist/example.77de5100.js.map | 2 +- example/index.ts | 22 +- src/html.ts | 26 +- 6 files changed, 237 insertions(+), 199 deletions(-) diff --git a/dist/src/html.js b/dist/src/html.js index c643c6a..fbaf58f 100644 --- a/dist/src/html.js +++ b/dist/src/html.js @@ -1,4 +1,5 @@ import { IS_DIRECTIVE } from "./directive.js"; +import { sub } from "./directives/sub.js"; const isLetter = (c) => { return c.toLowerCase() != c.toUpperCase(); }; @@ -29,6 +30,9 @@ export const getAttributeMarker = (id) => { function isDirective(thing) { return thing.is && thing.is === IS_DIRECTIVE; } +function isHTMLResult(thing) { + return thing.template && thing.directives; +} let resultCache = new WeakMap(); export const html = (staticParts, ...dynamicParts) => { let result = resultCache.get(staticParts); @@ -36,12 +40,18 @@ export const html = (staticParts, ...dynamicParts) => { let appendedStatic = ''; const directives = []; for (let i = 0; i < dynamicParts.length; i++) { - const dynamicPart = dynamicParts[i]; + let dynamicPart = dynamicParts[i]; const staticPart = staticParts[i]; appendedStatic += staticPart; if (!isDirective(dynamicPart)) { - appendedStatic += dynamicPart; - continue; + if (isHTMLResult(dynamicPart)) { + const htmlResult = dynamicPart; + dynamicPart = sub(() => htmlResult); + } + else { + appendedStatic += dynamicPart; + continue; + } } let id = directives.push({ d: dynamicPart, @@ -111,8 +121,16 @@ export const html = (staticParts, ...dynamicParts) => { else { let directiveIndex = 0; dynamicParts.forEach((value) => { - if (isDirective(value)) { - result.directives[directiveIndex].d = value; + if (isDirective(value) || isHTMLResult(value)) { + if (isHTMLResult(value)) { + result.directives[directiveIndex].d = { + args: [() => value], + factory: undefined, + }; + } + else { + result.directives[directiveIndex].d = value; + } directiveIndex++; } }); diff --git a/dist/src/html.js.map b/dist/src/html.js.map index 2438d1a..054db78 100644 --- a/dist/src/html.js.map +++ b/dist/src/html.js.map @@ -1 +1 @@ -{"version":3,"file":"html.js","sourceRoot":"","sources":["../../src/html.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAmB,uBAAoB;AAE5D,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAW,EAAE;IACtC,OAAO,CAAC,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,CAAC;AAC5C,CAAC,CAAC;AAEF,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,iDAAI,CAAA;IACJ,2DAAS,CAAA;IACT,uEAAe,CAAA;AACjB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAMD,MAAM,qBAAqB,GAAG,CAC5B,MAAc,EACd,EAAU,EACV,cAAsB,EACd,EAAE;IACV,OAAO,EAAE,EAAE,EAAE;QACX,MAAM,IAAI,GAAG,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QACvC,IAAI,CAAC,IAAI,EAAE;YACT,MAAM;SACP;QACD,IAAI,IAAI,KAAK,GAAG,EAAE;YAChB,OAAO,CACL,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,MAAM,GAAG,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CACtE,CAAC;SACH;KACF;IACD,OAAO,cAAc,CAAC;AACxB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAU,EAAU,EAAE;IAClD,OAAO,MAAM,EAAE,EAAE,CAAC;AACpB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAAU,EAAU,EAAE;IACvD,OAAO,WAAW,EAAE,EAAE,CAAC;AACzB,CAAC,CAAC;AAKF,SAAS,WAAW,CAAC,KAAU;IAC7B,OAAO,KAAK,CAAC,EAAE,IAAI,KAAK,CAAC,EAAE,KA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CAAC,CAAC,CAAC;qBACrE;oBACD,MAAM;iBACP;gBACD,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,kBAAkB,EAAE;oBACvC,cAAc,GAAG,qBAAqB,CACpC,kBAAkB,CAAC,EAAE,CAAC,EACtB,EAAE,EACF,cAAc,CACf,CAAC;oBACF,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,SAAS,CAAC;oBAC3C,MAAM;iBACP;aACF;SACF;QACD,cAAc,IAAI,WAAW,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QACtD,MAAM,QAAQ,GAAG,QAAQ,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;QACpD,QAAQ,CAAC,SAAS,GAAG,cAAc,CAAC;QACpC,MAAM,GAAG;YACP,QAAQ;YACR,UAAU;SACX,CAAC;KACH;SAAM;QACL,IAAI,cAAc,GAAW,CAAC,CAAC;QAC/B,YAAY,CAAC,OAAO,CAAC,CAAC,KAAU,EAAE,EAAE;YAClC,IAAI,WAAW,CAAC,KAAK,CAAC,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;gBAC7C,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;oBACvB,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG;wBACpC,IAAI,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC;wBACnB,OAAO,EAAE,SAAS;qBACnB,CAAC;iBACH;qBAAM;oBACL,MAAM,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;iBAC7C;gBACD,cAAc,EAAE,CAAC;aAClB;QACH,CAAC,CAAC,CAAC;KACJ;IACD,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC"} \ No newline at end of file diff --git a/example/dist/example.77de5100.js b/example/dist/example.77de5100.js index 394595e..e83a98c 100644 --- a/example/dist/example.77de5100.js +++ b/example/dist/example.77de5100.js @@ -150,163 +150,7 @@ function createDirective(factory) { return directive; })(factory); } -},{}],"../dist/src/html.js":[function(require,module,exports) { -"use strict"; - -Object.defineProperty(exports, "__esModule", { - value: true -}); -exports.html = exports.getAttributeMarker = exports.getTextMarker = exports.DirectiveType = void 0; - -var _directive = require("./directive.js"); - -const isLetter = c => { - return c.toLowerCase() != c.toUpperCase(); -}; - -var DirectiveType; -exports.DirectiveType = DirectiveType; - -(function (DirectiveType) { - DirectiveType[DirectiveType["TEXT"] = 0] = "TEXT"; - DirectiveType[DirectiveType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; - DirectiveType[DirectiveType["ATTRIBUTE_VALUE"] = 2] = "ATTRIBUTE_VALUE"; -})(DirectiveType || (exports.DirectiveType = DirectiveType = {})); - -const insertAttributeMarker = (marker, si, appendedStatic) => { - while (si++) { - const char = appendedStatic.charAt(si); - - if (!char) { - break; - } - - if (char === ' ') { - return appendedStatic.slice(0, si) + ' ' + marker + appendedStatic.slice(si); - } - } - - return appendedStatic; -}; - -const getTextMarker = id => { - return `tm-${id}`; -}; - -exports.getTextMarker = getTextMarker; - -const getAttributeMarker = id => { - return `data-am-${id}`; -}; - -exports.getAttributeMarker = getAttributeMarker; - -function isDirective(thing) { - return thing.is && thing.is === _directive.IS_DIRECTIVE; -} - -let resultCache = new WeakMap(); - -const html = (staticParts, ...dynamicParts) => { - let result = resultCache.get(staticParts); - - if (!result) { - let appendedStatic = ''; - const directives = []; - - for (let i = 0; i < dynamicParts.length; i++) { - const dynamicPart = dynamicParts[i]; - const staticPart = staticParts[i]; - appendedStatic += staticPart; - - if (!isDirective(dynamicPart)) { - appendedStatic += dynamicPart; - continue; - } - - let id = directives.push({ - d: dynamicPart - }) - 1; - let si = appendedStatic.length + 1; - let attributeValueMode = false; - let attributeMode = false; - let attributeNameFound = false; - let attributeName = ''; - - while (si--) { - const char = appendedStatic.charAt(si); - const nextChar = appendedStatic.charAt(si - 1); - const nextNextChar = appendedStatic.charAt(si - 2); - - if (char === '>' || si === 0) { - let marker = getTextMarker(id); - appendedStatic += `<${marker}>‌`; - directives[id].t = DirectiveType.TEXT; - break; - } - - if (char === '"' && nextChar === '=' && isLetter(nextNextChar) && !attributeMode) { - attributeValueMode = true; - continue; - } - - if (char === '"' && nextNextChar !== '=' && !attributeValueMode) { - attributeValueMode = false; - attributeMode = true; - continue; - } - - if (attributeValueMode && char !== '"' && char !== '=' && !attributeNameFound) { - if (char !== ' ') { - attributeName = char + attributeName; - } else { - attributeNameFound = true; - } - } - - if (char === '<' && attributeValueMode) { - appendedStatic = insertAttributeMarker(getAttributeMarker(id), si, appendedStatic); - directives[id].t = DirectiveType.ATTRIBUTE_VALUE; - directives[id].a = attributeName; - - if (appendedStatic[appendedStatic.length - 1] === ' ') { - appendedStatic = appendedStatic.slice(0, appendedStatic.length - 1); - } - - break; - } - - if (char === '<' && !attributeValueMode) { - appendedStatic = insertAttributeMarker(getAttributeMarker(id), si, appendedStatic); - directives[id].t = DirectiveType.ATTRIBUTE; - break; - } - } - } - - appendedStatic += staticParts[staticParts.length - 1]; - const template = document.createElement('template'); - template.innerHTML = appendedStatic; - result = { - template, - directives - }; - } else { - let directiveIndex = 0; - dynamicParts.forEach(value => { - if (isDirective(value)) { - result.directives[directiveIndex].d = value; - directiveIndex++; - } - }); - } - - resultCache.set(staticParts, result); - return result; -}; - -exports.html = html; -},{"./directive.js":"../dist/src/directive.js"}],"../dist/src/scheduler.js":[function(require,module,exports) { +},{}],"../dist/src/scheduler.js":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -493,7 +337,182 @@ const sub = (0, _directive.createDirective)(function* (node, cb) { } }); exports.sub = sub; -},{"../directive.js":"../dist/src/directive.js","../render.js":"../dist/src/render.js"}],"../dist/src/misc.js":[function(require,module,exports) { +},{"../directive.js":"../dist/src/directive.js","../render.js":"../dist/src/render.js"}],"../dist/src/html.js":[function(require,module,exports) { +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.html = exports.getAttributeMarker = exports.getTextMarker = exports.DirectiveType = void 0; + +var _directive = require("./directive.js"); + +var _sub = require("./directives/sub.js"); + +const isLetter = c => { + return c.toLowerCase() != c.toUpperCase(); +}; + +var DirectiveType; +exports.DirectiveType = DirectiveType; + +(function (DirectiveType) { + DirectiveType[DirectiveType["TEXT"] = 0] = "TEXT"; + DirectiveType[DirectiveType["ATTRIBUTE"] = 1] = "ATTRIBUTE"; + DirectiveType[DirectiveType["ATTRIBUTE_VALUE"] = 2] = "ATTRIBUTE_VALUE"; +})(DirectiveType || (exports.DirectiveType = DirectiveType = {})); + +const insertAttributeMarker = (marker, si, appendedStatic) => { + while (si++) { + const char = appendedStatic.charAt(si); + + if (!char) { + break; + } + + if (char === ' ') { + return appendedStatic.slice(0, si) + ' ' + marker + appendedStatic.slice(si); + } + } + + return appendedStatic; +}; + +const getTextMarker = id => { + return `tm-${id}`; +}; + +exports.getTextMarker = getTextMarker; + +const getAttributeMarker = id => { + return `data-am-${id}`; +}; + +exports.getAttributeMarker = getAttributeMarker; + +function isDirective(thing) { + return thing.is && thing.is === _directive.IS_DIRECTIVE; +} + +function isHTMLResult(thing) { + return thing.template && thing.directives; +} + +let resultCache = new WeakMap(); + +const html = (staticParts, ...dynamicParts) => { + let result = resultCache.get(staticParts); + + if (!result) { + let appendedStatic = ''; + const directives = []; + + for (let i = 0; i < dynamicParts.length; i++) { + let dynamicPart = dynamicParts[i]; + const staticPart = staticParts[i]; + appendedStatic += staticPart; + + if (!isDirective(dynamicPart)) { + if (isHTMLResult(dynamicPart)) { + const htmlResult = dynamicPart; + dynamicPart = (0, _sub.sub)(() => htmlResult); + } else { + appendedStatic += dynamicPart; + continue; + } + } + + let id = directives.push({ + d: dynamicPart + }) - 1; + let si = appendedStatic.length + 1; + let attributeValueMode = false; + let attributeMode = false; + let attributeNameFound = false; + let attributeName = ''; + + while (si--) { + const char = appendedStatic.charAt(si); + const nextChar = appendedStatic.charAt(si - 1); + const nextNextChar = appendedStatic.charAt(si - 2); + + if (char === '>' || si === 0) { + let marker = getTextMarker(id); + appendedStatic += `<${marker}>‌`; + directives[id].t = DirectiveType.TEXT; + break; + } + + if (char === '"' && nextChar === '=' && isLetter(nextNextChar) && !attributeMode) { + attributeValueMode = true; + continue; + } + + if (char === '"' && nextNextChar !== '=' && !attributeValueMode) { + attributeValueMode = false; + attributeMode = true; + continue; + } + + if (attributeValueMode && char !== '"' && char !== '=' && !attributeNameFound) { + if (char !== ' ') { + attributeName = char + attributeName; + } else { + attributeNameFound = true; + } + } + + if (char === '<' && attributeValueMode) { + appendedStatic = insertAttributeMarker(getAttributeMarker(id), si, appendedStatic); + directives[id].t = DirectiveType.ATTRIBUTE_VALUE; + directives[id].a = attributeName; + + if (appendedStatic[appendedStatic.length - 1] === ' ') { + appendedStatic = appendedStatic.slice(0, appendedStatic.length - 1); + } + + break; + } + + if (char === '<' && !attributeValueMode) { + appendedStatic = insertAttributeMarker(getAttributeMarker(id), si, appendedStatic); + directives[id].t = DirectiveType.ATTRIBUTE; + break; + } + } + } + + appendedStatic += staticParts[staticParts.length - 1]; + const template = document.createElement('template'); + template.innerHTML = appendedStatic; + result = { + template, + directives + }; + } else { + let directiveIndex = 0; + dynamicParts.forEach(value => { + if (isDirective(value) || isHTMLResult(value)) { + if (isHTMLResult(value)) { + result.directives[directiveIndex].d = { + args: [() => value], + factory: undefined + }; + } else { + result.directives[directiveIndex].d = value; + } + + directiveIndex++; + } + }); + } + + resultCache.set(staticParts, result); + return result; +}; + +exports.html = html; +},{"./directive.js":"../dist/src/directive.js","./directives/sub.js":"../dist/src/directives/sub.js"}],"../dist/src/misc.js":[function(require,module,exports) { "use strict"; Object.defineProperty(exports, "__esModule", { @@ -1067,20 +1086,6 @@ index_js_1.component('test-component', () => { return () => {}; }, () => [$s.inputValue]); console.log(index_js_1.getElement()); - - const renderSub = () => { - if ($s.swap) { - return index_js_1.html` -
this text
- `; - } else { - return index_js_1.html` -
can be changed
-
just like this
- `; - } - }; - return { watch: [$s, $test, $toast], render: () => { @@ -1097,7 +1102,12 @@ index_js_1.component('test-component', () => { })} />
- ${index_js_1.sub(renderSub)} + ${$s.swap ? index_js_1.html` +
this text
+ ` : index_js_1.html` +
can be changed
+
just like this
+ `} \n \n `;\n },\n };\n});\n","var OVERLAY_ID = '__parcel__error__overlay__';\n\nvar OldModule = module.bundle.Module;\n\nfunction Module(moduleName) {\n OldModule.call(this, moduleName);\n this.hot = {\n data: module.bundle.hotData,\n _acceptCallbacks: [],\n _disposeCallbacks: [],\n accept: function (fn) {\n this._acceptCallbacks.push(fn || function () {});\n },\n dispose: function (fn) {\n this._disposeCallbacks.push(fn);\n }\n };\n\n module.bundle.hotData = null;\n}\n\nmodule.bundle.Module = Module;\nvar checkedAssets, assetsToAccept;\n\nvar parent = module.bundle.parent;\nif ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {\n var hostname = process.env.HMR_HOSTNAME || location.hostname;\n var protocol = location.protocol === 'https:' ? 'wss' : 'ws';\n var ws = new WebSocket(protocol + '://' + hostname + ':' + process.env.HMR_PORT + '/');\n ws.onmessage = function(event) {\n checkedAssets = {};\n assetsToAccept = [];\n\n var data = JSON.parse(event.data);\n\n if (data.type === 'update') {\n var handled = false;\n data.assets.forEach(function(asset) {\n if (!asset.isNew) {\n var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);\n if (didAccept) {\n handled = true;\n }\n }\n });\n\n // Enable HMR for CSS by default.\n handled = handled || data.assets.every(function(asset) {\n return asset.type === 'css' && asset.generated.js;\n });\n\n if (handled) {\n console.clear();\n\n data.assets.forEach(function (asset) {\n hmrApply(global.parcelRequire, asset);\n });\n\n assetsToAccept.forEach(function (v) {\n hmrAcceptRun(v[0], v[1]);\n });\n } else if (location.reload) { // `location` global exists in a web worker context but lacks `.reload()` function.\n location.reload();\n }\n }\n\n if (data.type === 'reload') {\n ws.close();\n ws.onclose = function () {\n location.reload();\n }\n }\n\n if (data.type === 'error-resolved') {\n console.log('[parcel] ✨ Error resolved');\n\n removeErrorOverlay();\n }\n\n if (data.type === 'error') {\n console.error('[parcel] 🚨 ' + data.error.message + '\\n' + data.error.stack);\n\n removeErrorOverlay();\n\n var overlay = createErrorOverlay(data);\n document.body.appendChild(overlay);\n }\n };\n}\n\nfunction removeErrorOverlay() {\n var overlay = document.getElementById(OVERLAY_ID);\n if (overlay) {\n overlay.remove();\n }\n}\n\nfunction createErrorOverlay(data) {\n var overlay = document.createElement('div');\n overlay.id = OVERLAY_ID;\n\n // html encode message and stack trace\n var message = document.createElement('div');\n var stackTrace = document.createElement('pre');\n message.innerText = data.error.message;\n stackTrace.innerText = data.error.stack;\n\n overlay.innerHTML = (\n '
' +\n 'ERROR' +\n '🚨' +\n '
' + message.innerHTML + '
' +\n '
' + stackTrace.innerHTML + '
' +\n '
'\n );\n\n return overlay;\n\n}\n\nfunction getParents(bundle, id) {\n var modules = bundle.modules;\n if (!modules) {\n return [];\n }\n\n var parents = [];\n var k, d, dep;\n\n for (k in modules) {\n for (d in modules[k][1]) {\n dep = modules[k][1][d];\n if (dep === id || (Array.isArray(dep) && dep[dep.length - 1] === id)) {\n parents.push(k);\n }\n }\n }\n\n if (bundle.parent) {\n parents = parents.concat(getParents(bundle.parent, id));\n }\n\n return parents;\n}\n\nfunction hmrApply(bundle, asset) {\n var modules = bundle.modules;\n if (!modules) {\n return;\n }\n\n if (modules[asset.id] || !bundle.parent) {\n var fn = new Function('require', 'module', 'exports', asset.generated.js);\n asset.isNew = !modules[asset.id];\n modules[asset.id] = [fn, asset.deps];\n } else if (bundle.parent) {\n hmrApply(bundle.parent, asset);\n }\n}\n\nfunction hmrAcceptCheck(bundle, id) {\n var modules = bundle.modules;\n if (!modules) {\n return;\n }\n\n if (!modules[id] && bundle.parent) {\n return hmrAcceptCheck(bundle.parent, id);\n }\n\n if (checkedAssets[id]) {\n return;\n }\n checkedAssets[id] = true;\n\n var cached = bundle.cache[id];\n\n assetsToAccept.push([bundle, id]);\n\n if (cached && cached.hot && cached.hot._acceptCallbacks.length) {\n return true;\n }\n\n return getParents(global.parcelRequire, id).some(function (id) {\n return hmrAcceptCheck(global.parcelRequire, id)\n });\n}\n\nfunction hmrAcceptRun(bundle, id) {\n var cached = bundle.cache[id];\n bundle.hotData = {};\n if (cached) {\n cached.hot.data = bundle.hotData;\n }\n\n if (cached && cached.hot && cached.hot._disposeCallbacks.length) {\n cached.hot._disposeCallbacks.forEach(function (cb) {\n cb(bundle.hotData);\n });\n }\n\n delete bundle.cache[id];\n bundle(id);\n\n cached = bundle.cache[id];\n if (cached && cached.hot && cached.hot._acceptCallbacks.length) {\n cached.hot._acceptCallbacks.forEach(function (cb) {\n cb();\n });\n return true;\n }\n}\n"]} \ No newline at end of file +{"version":3,"sources":["../../src/directive.ts","../../src/scheduler.ts","../../src/render.ts","../../../src/directives/sub.ts","../../src/html.ts","../../src/misc.ts","../../src/context.ts","../../src/sideeffects.ts","../../src/component.ts","../../src/reactivity.ts","../../src/properties.ts","../../src/attributes.ts","../../../src/directives/text.ts","../../../src/directives/input.ts","../../../src/directives/on.ts","../../src/index.ts","index.ts","node_modules/parcel/src/builtins/hmr-runtime.js"],"names":["OVERLAY_ID","OldModule","module","bundle","Module","moduleName","call","hot","data","hotData","_acceptCallbacks","_disposeCallbacks","accept","fn","push","dispose","checkedAssets","assetsToAccept","parent","isParcelRequire","WebSocket","hostname","location","protocol","ws","onmessage","event","JSON","parse","type","handled","assets","forEach","asset","isNew","didAccept","hmrAcceptCheck","global","parcelRequire","id","every","generated","js","console","clear","hmrApply","v","hmrAcceptRun","reload","close","onclose","log","removeErrorOverlay","error","message","stack","overlay","createErrorOverlay","document","body","appendChild","getElementById","remove","createElement","stackTrace","innerText","innerHTML","getParents","modules","parents","k","d","dep","Array","isArray","length","concat","Function","deps","cached","cache","some","cb"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AuBC,EAAvB,CAArB;AACD,GAFM,CAAP;AAGD;;AAED,SAASQ,YAAT,CAAsB5C,MAAtB,EAA8BoC,EAA9B,EAAkC;AAChC,MAAIwC,MAAM,GAAG5E,MAAM,CAAC6E,KAAP,CAAazC,EAAb,CAAb;AACApC,EAAAA,MAAM,CAACM,OAAP,GAAiB,EAAjB;;AACA,MAAIsE,MAAJ,EAAY;AACVA,IAAAA,MAAM,CAACxE,GAAP,CAAWC,IAAX,GAAkBL,MAAM,CAACM,OAAzB;AACD;;AAED,MAAIsE,MAAM,IAAIA,MAAM,CAACxE,GAAjB,IAAwBwE,MAAM,CAACxE,GAAP,CAAWI,iBAAX,CAA6BgE,MAAzD,EAAiE;AAC/DI,IAAAA,MAAM,CAACxE,GAAP,CAAWI,iBAAX,CAA6BqB,OAA7B,CAAqC,UAAUkD,EAAV,EAAc;AACjDA,MAAAA,EAAE,CAAC/E,MAAM,CAACM,OAAR,CAAF;AACD,KAFD;AAGD;;AAED,SAAON,MAAM,CAAC6E,KAAP,CAAazC,EAAb,CAAP;AACApC,EAAAA,MAAM,CAACoC,EAAD,CAAN;AAEAwC,EAAAA,MAAM,GAAG5E,MAAM,CAAC6E,KAAP,CAAazC,EAAb,CAAT;;AACA,MAAIwC,MAAM,IAAIA,MAAM,CAACxE,GAAjB,IAAwBwE,MAAM,CAACxE,GAAP,CAAWG,gBAAX,CAA4BiE,MAAxD,EAAgE;AAC9DI,IAAAA,MAAM,CAACxE,GAAP,CAAWG,gBAAX,CAA4BsB,OAA5B,CAAoC,UAAUkD,EAAV,EAAc;AAChDA,MAAAA,EAAE;AACH,KAFD;;AAGA,WAAO,IAAP;AACD;AACF","file":"example.77de5100.js","sourceRoot":"..","sourcesContent":["export interface DOMUpdate {\n node: Node;\n newNode?: Node;\n type: DOMUpdateType;\n value?: string;\n}\nexport enum DOMUpdateType {\n TEXT,\n REPLACE_NODE,\n ADD_NODE,\n}\n\nexport type DirectiveGenerator = Generator<\n DOMUpdate[] | Promise | void,\n void,\n Args\n>;\n\nexport type DirectiveGeneratorFactory<\n N extends Node = Node,\n Args extends any[] = any[]\n> = (node: N, ...initialArgs: Args) => DirectiveGenerator;\nexport interface DirectiveResult<\n N extends Node = Node,\n Args extends any[] = any[]\n> {\n factory: DirectiveGeneratorFactory;\n args: Args;\n}\nexport type Directive = (\n ...args: Args\n) => DirectiveResult;\nexport const IS_DIRECTIVE = Symbol('directive');\nexport function createDirective<\n Args extends any[],\n N extends Node = any,\n F extends DirectiveGeneratorFactory = DirectiveGeneratorFactory<\n N,\n Args\n >\n>(\n factory: F\n): F extends (node: N, ...initialArgs: infer A) => DirectiveGenerator\n ? Directive\n : never {\n return ((factory: F) => {\n const directive = function(...args: Args) {\n return {\n is: IS_DIRECTIVE,\n factory,\n args,\n };\n } as any;\n return directive;\n })(factory);\n}\n","export enum PriorityLevel {\n IMMEDIATE = 0, //synchronous\n USER_BLOCKING = 250, //.25s timeout\n NORMAL = 5000, // 5s timeout\n LOW = 10000, // 10s timeout\n IDLE = 99999999, // no timeout (run only when nothing else is scheduled)\n}\ntype ScheduledJob = [() => void, number];\nlet scheduledJobs: ScheduledJob[] = [];\nlet schedulerRunning: boolean = false;\nconst MAX_ELAPSED: number = 17;\nconst processJobQueue = (\n queue: ScheduledJob[],\n now: number\n): ScheduledJob[] => {\n let index = 0;\n for (let length = queue.length; index < length; index++) {\n const totalElapsed: number = Date.now() - now;\n const [cb, latestEndTime] = queue[index];\n if (now >= latestEndTime || totalElapsed < MAX_ELAPSED) {\n cb();\n } else {\n break;\n }\n }\n return queue.slice(index);\n};\nconst processScheduledJobs = () => {\n const now: number = Date.now();\n scheduledJobs = processJobQueue(\n scheduledJobs.sort((a, b) => (a[1] < b[1] ? -1 : 1)),\n now\n );\n if (scheduledJobs.length > 0) {\n requestAnimationFrame(processScheduledJobs);\n } else {\n schedulerRunning = false;\n }\n};\nexport const schedule = (\n cb: () => void,\n priority: PriorityLevel = PriorityLevel.NORMAL\n): Promise => {\n if (priority === PriorityLevel.IMMEDIATE) {\n cb();\n } else {\n return new Promise(resolve => {\n scheduledJobs.push([\n () => {\n cb();\n resolve();\n },\n Date.now() + priority,\n ]);\n if (!schedulerRunning) {\n requestAnimationFrame(processScheduledJobs);\n schedulerRunning = true;\n }\n });\n }\n return Promise.resolve();\n};\nexport type Schedule = typeof schedule;\n","import {\n HTMLResult,\n DirectiveType,\n getTextMarker,\n getAttributeMarker,\n} from './html';\nimport { DirectiveGenerator, DOMUpdate, DOMUpdateType } from './directive';\nimport { schedule } from './scheduler';\n\nconst renderedNodesMap: WeakMap = new WeakMap();\nexport const clear = (container: HTMLElement) => {\n if (renderedNodesMap.has(container)) {\n renderedNodesMap\n .get(container)\n .forEach(node => container.removeChild(node));\n renderedNodesMap.delete(container);\n }\n};\nconst generatorMap: WeakMap = new WeakMap();\nexport const render = (\n container: HTMLElement,\n htmlResult: HTMLResult\n): void => {\n let fragment: DocumentFragment;\n if (!renderedNodesMap.has(container)) {\n const generators: DirectiveGenerator[] = [];\n generatorMap.set(container, generators);\n fragment = htmlResult.template.content.cloneNode(true) as DocumentFragment;\n htmlResult.directives.forEach((directiveData, id) => {\n switch (directiveData.t) {\n case DirectiveType.TEXT:\n const placeholder = fragment.querySelector(getTextMarker(id));\n const textNode = placeholder.firstChild;\n generators[id] = directiveData.d.factory(\n textNode,\n ...directiveData.d.args\n );\n placeholder.parentElement.replaceChild(textNode, placeholder);\n break;\n case DirectiveType.ATTRIBUTE:\n case DirectiveType.ATTRIBUTE_VALUE:\n const marker = getAttributeMarker(id);\n const node = fragment.querySelector(`[${marker}]`);\n generators[id] = directiveData.d.factory(\n node,\n ...directiveData.d.args\n );\n node.removeAttribute(marker);\n }\n });\n renderedNodesMap.set(container, Array.from(fragment.childNodes));\n }\n\n const generators: DirectiveGenerator[] = generatorMap.get(container);\n htmlResult.directives.forEach(async (directiveData, id) => {\n const result = generators[id].next(directiveData.d.args);\n if (result.value) {\n const domUpdate: DOMUpdate[] = await result.value;\n schedule(() => {\n domUpdate.forEach(d => {\n switch (d.type) {\n case DOMUpdateType.TEXT:\n d.node.textContent = d.value;\n break;\n case DOMUpdateType.ADD_NODE:\n d.node.appendChild(d.newNode);\n break;\n case DOMUpdateType.REPLACE_NODE:\n d.node.parentElement.replaceChild(d.newNode, d.node);\n break;\n }\n });\n });\n }\n });\n if (fragment) {\n container.appendChild(fragment);\n }\n};\n","import { createDirective, DOMUpdateType } from '../directive';\nimport { HTMLResult } from '../html';\nimport { render } from '../render';\n\nexport const sub = createDirective(function*(node: Text, cb: () => HTMLResult) {\n if (node.nodeType === 3) {\n let span: HTMLSpanElement;\n for (;;) {\n cb = (yield new Promise(resolve => {\n const newSpan = document.createElement('span');\n render(newSpan as HTMLElement, cb());\n resolve([\n {\n type: DOMUpdateType.REPLACE_NODE,\n node: node.parentElement ? node : span,\n newNode: newSpan,\n },\n ]);\n span = newSpan;\n }))[0];\n }\n }\n});\n","import { IS_DIRECTIVE, DirectiveResult } from './directive';\nimport { sub } from './directives/sub';\n\nconst isLetter = (c: string): boolean => {\n return c.toLowerCase() != c.toUpperCase();\n};\n\nexport enum DirectiveType {\n TEXT,\n ATTRIBUTE,\n ATTRIBUTE_VALUE,\n}\nexport interface DirectiveData {\n d: DirectiveResult;\n t?: DirectiveType;\n a?: string;\n}\nconst insertAttributeMarker = (\n marker: string,\n si: number,\n appendedStatic: string\n): string => {\n while (si++) {\n const char = appendedStatic.charAt(si);\n if (!char) {\n break;\n }\n if (char === ' ') {\n return (\n appendedStatic.slice(0, si) + ' ' + marker + appendedStatic.slice(si)\n );\n }\n }\n return appendedStatic;\n};\nexport const getTextMarker = (id: number): string => {\n return `tm-${id}`;\n};\nexport const getAttributeMarker = (id: number): string => {\n return `data-am-${id}`;\n};\nexport interface HTMLResult {\n template: HTMLTemplateElement;\n directives: DirectiveData[];\n}\nfunction isDirective(thing: any): boolean {\n return thing.is && thing.is === IS_DIRECTIVE;\n}\nfunction isHTMLResult(thing: any): boolean {\n return thing.template && thing.directives;\n}\nlet resultCache: WeakMap = new WeakMap();\nexport const html = (\n staticParts: TemplateStringsArray,\n ...dynamicParts: any[]\n): HTMLResult => {\n let result: HTMLResult = resultCache.get(staticParts);\n if (!result) {\n let appendedStatic: string = '';\n const directives: DirectiveData[] = [];\n for (let i = 0; i < dynamicParts.length; i++) {\n let dynamicPart = dynamicParts[i];\n const staticPart = staticParts[i];\n appendedStatic += staticPart;\n if (!isDirective(dynamicPart)) {\n if (isHTMLResult(dynamicPart)) {\n const htmlResult = dynamicPart;\n dynamicPart = sub(() => htmlResult);\n } else {\n appendedStatic += dynamicPart;\n continue;\n }\n }\n let id =\n directives.push({\n d: dynamicPart,\n }) - 1;\n let si = appendedStatic.length + 1;\n let attributeValueMode = false;\n let attributeMode = false;\n let attributeNameFound = false;\n let attributeName = '';\n while (si--) {\n const char = appendedStatic.charAt(si);\n const nextChar = appendedStatic.charAt(si - 1);\n const nextNextChar = appendedStatic.charAt(si - 2);\n if (char === '>' || si === 0) {\n let marker = getTextMarker(id);\n appendedStatic += `<${marker}>‌`;\n directives[id].t = DirectiveType.TEXT;\n break;\n }\n if (\n char === '\"' &&\n nextChar === '=' &&\n isLetter(nextNextChar) &&\n !attributeMode\n ) {\n attributeValueMode = true;\n continue;\n }\n if (char === '\"' && nextNextChar !== '=' && !attributeValueMode) {\n attributeValueMode = false;\n attributeMode = true;\n continue;\n }\n if (\n attributeValueMode &&\n char !== '\"' &&\n char !== '=' &&\n !attributeNameFound\n ) {\n if (char !== ' ') {\n attributeName = char + attributeName;\n } else {\n attributeNameFound = true;\n }\n }\n if (char === '<' && attributeValueMode) {\n appendedStatic = insertAttributeMarker(\n getAttributeMarker(id),\n si,\n appendedStatic\n );\n directives[id].t = DirectiveType.ATTRIBUTE_VALUE;\n directives[id].a = attributeName;\n if (appendedStatic[appendedStatic.length - 1] === ' ') {\n appendedStatic = appendedStatic.slice(0, appendedStatic.length - 1);\n }\n break;\n }\n if (char === '<' && !attributeValueMode) {\n appendedStatic = insertAttributeMarker(\n getAttributeMarker(id),\n si,\n appendedStatic\n );\n directives[id].t = DirectiveType.ATTRIBUTE;\n break;\n }\n }\n }\n appendedStatic += staticParts[staticParts.length - 1];\n const template = document.createElement('template');\n template.innerHTML = appendedStatic;\n result = {\n template,\n directives,\n };\n } else {\n let directiveIndex: number = 0;\n dynamicParts.forEach((value: any) => {\n if (isDirective(value) || isHTMLResult(value)) {\n if (isHTMLResult(value)) {\n result.directives[directiveIndex].d = {\n args: [() => value],\n factory: undefined,\n };\n } else {\n result.directives[directiveIndex].d = value;\n }\n directiveIndex++;\n }\n });\n }\n resultCache.set(staticParts, result);\n return result;\n};\n","export const getOnlySetupError = (subject: string): string =>\n `${subject} can only be used during setup!`;\n","import { getOnlySetupError } from './misc';\n\nconst global: { __$c: HTMLElement } = window as any;\n\nexport const setUpContext = (context: HTMLElement, cb: () => void): void => {\n global.__$c = context;\n cb();\n global.__$c = undefined;\n};\n\nexport const getElement = (): HTMLElement => {\n if (global.__$c) {\n return global.__$c;\n } else {\n throw getOnlySetupError('getElement');\n }\n};\n","import { getElement } from './context';\nimport { schedule, PriorityLevel } from './scheduler';\n\nexport type CleanUp = () => void;\nexport type SideEffect = () => void | CleanUp;\ninterface SideEffectsMapItem {\n e: SideEffect;\n d?: () => any[];\n p?: any[];\n c?: CleanUp;\n}\nconst sideEffectsMap: WeakMap<\n HTMLElement,\n SideEffectsMapItem[]\n> = new WeakMap();\n\nexport const sideEffect = (effect: () => void, dependencies?: () => any[]) => {\n const element = getElement();\n sideEffectsMap.set(\n element,\n (sideEffectsMap.get(element) || []).concat({\n e: effect,\n d: dependencies,\n })\n );\n};\nconst shouldEffectRun = (effectMapItem: SideEffectsMapItem): boolean => {\n const { d, p } = effectMapItem;\n let shouldRun: boolean = true;\n if (d) {\n const deps = d();\n if (\n p &&\n (deps === p ||\n (deps.length === p.length &&\n deps.findIndex((dep, index) => p[index] !== dep))) === -1\n ) {\n shouldRun = false;\n }\n }\n return shouldRun;\n};\nexport const runSideEffects = (element: HTMLElement): Promise => {\n const sideEffects = sideEffectsMap.get(element) || [];\n if (sideEffects.length > 0) {\n return Promise.all(\n sideEffects\n .map(effectMapItem => {\n const { c } = effectMapItem;\n if (c && shouldEffectRun(effectMapItem)) {\n return schedule(() => {\n c();\n effectMapItem.c = undefined;\n }, PriorityLevel.USER_BLOCKING);\n }\n return undefined;\n })\n .filter(p => p)\n ).then(() =>\n Promise.all(\n sideEffects\n .map(effectMapItem => {\n const { e, d } = effectMapItem;\n let shouldRun: boolean = shouldEffectRun(effectMapItem);\n if (d) {\n effectMapItem.p = d();\n }\n if (shouldRun) {\n return schedule(() => {\n const cleanUp = e();\n if (cleanUp) {\n effectMapItem.c = cleanUp;\n }\n }, PriorityLevel.USER_BLOCKING);\n }\n return undefined;\n })\n .filter(p => p)\n )\n );\n } else {\n return Promise.resolve([]);\n }\n};\n","import { HTMLResult } from './html';\nimport { render } from './render';\nimport { schedule, PriorityLevel } from './scheduler';\nimport { setUpContext } from './context';\nimport { runSideEffects } from './sideeffects';\nimport { State } from './reactivity';\n\nexport interface ComponentDefinition {\n render: () => HTMLResult;\n watch?: State<{}>[];\n}\nexport type Setup = () => ComponentDefinition;\nexport const component = (name: string, setup: Setup) => {\n customElements.define(\n name,\n class extends HTMLElement {\n private renderQueued: boolean = false;\n private nextRenderQueued: boolean = false;\n private render: () => HTMLResult;\n private watch: State<{}>[] = [];\n private watchOff: (() => void)[];\n constructor() {\n super();\n this.attachShadow({ mode: 'open' });\n\n setUpContext(this, () => {\n const result = setup();\n this.render = result.render;\n this.watch = result.watch;\n });\n }\n\n private wasConnected: boolean = false;\n public connectedCallback() {\n if (this.isConnected && !this.wasConnected) {\n this.wasConnected = true;\n this.performRender();\n if (this.watch) {\n this.watchOff = this.watch.map(s =>\n s.on(() => {\n this.performRender();\n })\n );\n }\n }\n }\n\n public disconnectedCallback() {\n if (this.wasConnected) {\n this.wasConnected = false;\n if (this.watchOff) {\n this.watchOff.forEach(s => s());\n this.watchOff = undefined;\n }\n }\n }\n\n private performRender() {\n if (!this.renderQueued) {\n this.renderQueued = true;\n schedule(() => {\n render(this.shadowRoot as any, this.render());\n }, PriorityLevel.USER_BLOCKING)\n .then(async () => await runSideEffects(this))\n .then(() => {\n this.renderQueued = false;\n if (this.nextRenderQueued) {\n this.nextRenderQueued = false;\n this.performRender();\n }\n });\n } else {\n this.nextRenderQueued = true;\n }\n }\n }\n );\n};\n","const IS_PROXY = Symbol('$P');\nfunction proxify(obj: any, onChange: () => void): any {\n const proxy = new Proxy(obj, {\n get: (obj, prop) => {\n if (\n obj[prop] &&\n typeof obj[prop] === 'object' &&\n obj[prop].__$p !== IS_PROXY &&\n prop !== 'on'\n ) {\n obj[prop] = proxify(obj[prop], onChange);\n }\n return obj[prop];\n },\n set: (obj, prop, value) => {\n if (obj[prop] !== value && prop !== '__$p' && prop !== 'on') {\n obj[prop] = value;\n onChange();\n } else if (prop === 'on') {\n obj[prop] = value;\n }\n return true;\n },\n });\n proxy.__$p = IS_PROXY;\n return proxy;\n}\nexport type State = S & {\n on: (listener: () => void) => () => void;\n};\n\nexport const $state = (\n initialState: Partial = {}\n): State => {\n const proxy = proxify(initialState, () => {\n listeners.forEach(l => l());\n });\n let listeners: (() => void)[] = [];\n proxy.on = (listener: () => void): (() => void) => {\n listeners.push(listener);\n return () => {\n const index = listeners.indexOf(listener);\n if (index > 1) {\n listeners.splice(index, 1);\n }\n };\n };\n return proxy;\n};\n","import { getElement } from './context';\nimport { $state } from './reactivity';\n\nexport const $prop = (name: string, initialValue: T): { value: T } => {\n const element = getElement() as any;\n const state = $state({ value: initialValue });\n Object.defineProperty(element, name, {\n get: () => state.value,\n set: (value: any) => {\n state.value = value;\n },\n });\n return state;\n};\n","import { $state } from './reactivity';\nimport { getElement } from './context';\nimport { sideEffect } from './sideeffects';\n\nconst attributeCallbackMap: WeakMap<\n HTMLElement,\n { [key: string]: (() => void)[] }\n> = new Map();\nconst observerMap: WeakMap = new WeakMap();\n\nconst addObserver = (element: HTMLElement): void => {\n if (!observerMap.has(element)) {\n const observer = new MutationObserver((mutationsList: MutationRecord[]) => {\n for (const mutation of mutationsList) {\n if (mutation.type === 'attributes') {\n const callbacks =\n (attributeCallbackMap.get(element) || {})[mutation.attributeName] ||\n [];\n callbacks.forEach(cb => cb());\n }\n }\n });\n observerMap.set(element, observer);\n }\n};\n\nconst startObserving = (element: HTMLElement) => {\n if (observerMap.has(element)) {\n observerMap.get(element).observe(element, { attributes: true });\n }\n};\n\nconst stopObserving = (element: HTMLElement) => {\n if (observerMap.has(element)) {\n observerMap.get(element).disconnect();\n }\n};\n\nconst observeAttribute = (\n element: HTMLElement,\n name: string,\n cb: () => void\n): void => {\n if (!attributeCallbackMap.has(element)) {\n attributeCallbackMap.set(element, {});\n }\n if (!attributeCallbackMap.get(element)[name]) {\n attributeCallbackMap.get(element)[name] = [];\n }\n attributeCallbackMap.get(element)[name].push(cb);\n};\n\nexport const $attr = (\n name: string,\n initialValue: string = ''\n): { value: string } => {\n const element = getElement();\n addObserver(element);\n observeAttribute(element, name, () => {\n const value = element.getAttribute(name);\n if (state.value !== value) {\n state.value = element.getAttribute(name);\n }\n });\n\n element.setAttribute(name, initialValue);\n\n const state = $state({ value: element.getAttribute(name) });\n\n sideEffect(\n () => {\n stopObserving(element);\n element.setAttribute(name, state.value);\n startObserving(element);\n },\n () => [state.value]\n );\n\n return state;\n};\n","import { createDirective, DOMUpdateType } from '../directive';\n\nexport const text = createDirective(function*(node: Text, value: string) {\n for (;;) {\n const result = yield [\n {\n node,\n value,\n type: DOMUpdateType.TEXT,\n },\n ];\n value = result[0];\n }\n});\n","import { createDirective } from '../directive';\nimport { PriorityLevel, schedule } from '../scheduler';\n\nexport const input = createDirective(function*(\n node: HTMLElement,\n cb: (value: string) => void\n) {\n const cbRef = {\n cb,\n };\n node.addEventListener('input', e => {\n const value: string = (e.target as HTMLInputElement).value;\n schedule(() => cbRef.cb(value), PriorityLevel.NORMAL);\n });\n for (;;) {\n cbRef.cb = (yield)[0];\n }\n});\n","import { createDirective } from '../directive';\nimport { PriorityLevel, schedule } from '../scheduler';\n\nexport const on = createDirective(function*(\n node: HTMLElement,\n name: string,\n cb: (e: E) => void\n) {\n const cbRef = {\n cb,\n };\n node.addEventListener(name, e => {\n schedule(() => cbRef.cb(e), PriorityLevel.IMMEDIATE);\n });\n for (;;) {\n cbRef.cb = (yield)[1];\n }\n});\n","export { html, HTMLResult } from './html';\nexport { render } from './render';\nexport { sub } from './directives/sub';\nexport { component } from './component';\nexport { $prop } from './properties';\nexport { $attr } from './attributes';\nexport { sideEffect } from './sideeffects';\nexport { $state } from './reactivity';\nexport { Directive, createDirective } from './directive';\nexport { text } from './directives/text';\nexport { input } from './directives/input';\nexport { on } from './directives/on';\nexport { getElement } from './context';\n","import {\n html,\n $attr,\n text,\n on,\n input,\n $state,\n $prop,\n getElement,\n sideEffect,\n component,\n} from '../dist/src/index.js';\n\n// this is (currently) how you define a component\ncomponent('test-component', () => {\n // this method is the \"setup\" of the component\n // it will only run once!\n\n // $state creates a reactive object\n // any changes to the object (even nested) will trigger a re-render\n const $s = $state({ inputValue: '', swap: true });\n const $test = $attr('test');\n const $toast = $prop('toast', '');\n\n sideEffect(\n () => {\n $test.value = $s.inputValue;\n $toast.value = $s.inputValue;\n return () => {};\n },\n () => [$s.inputValue]\n ); // only runs when values in array change\n\n console.log(getElement());\n\n return {\n watch: [$s, $test, $toast],\n render: () => {\n return html`\n
\n
input value: ${text($s.inputValue)}
\n
test attribute value: ${text($test.value)}
\n
toast prop value: ${text($toast.value)}
\n {\n $s.inputValue = value; // simply re-assign inputValue to re-render\n })}\n />\n
\n ${$s.swap\n ? html`\n
this text
\n `\n : html`\n
can be changed
\n
just like this
\n `}\n {\n $s.swap = !$s.swap;\n })}\n >\n swap\n \n
\n `;\n },\n };\n});\n","var OVERLAY_ID = '__parcel__error__overlay__';\n\nvar OldModule = module.bundle.Module;\n\nfunction Module(moduleName) {\n OldModule.call(this, moduleName);\n this.hot = {\n data: module.bundle.hotData,\n _acceptCallbacks: [],\n _disposeCallbacks: [],\n accept: function (fn) {\n this._acceptCallbacks.push(fn || function () {});\n },\n dispose: function (fn) {\n this._disposeCallbacks.push(fn);\n }\n };\n\n module.bundle.hotData = null;\n}\n\nmodule.bundle.Module = Module;\nvar checkedAssets, assetsToAccept;\n\nvar parent = module.bundle.parent;\nif ((!parent || !parent.isParcelRequire) && typeof WebSocket !== 'undefined') {\n var hostname = process.env.HMR_HOSTNAME || location.hostname;\n var protocol = location.protocol === 'https:' ? 'wss' : 'ws';\n var ws = new WebSocket(protocol + '://' + hostname + ':' + process.env.HMR_PORT + '/');\n ws.onmessage = function(event) {\n checkedAssets = {};\n assetsToAccept = [];\n\n var data = JSON.parse(event.data);\n\n if (data.type === 'update') {\n var handled = false;\n data.assets.forEach(function(asset) {\n if (!asset.isNew) {\n var didAccept = hmrAcceptCheck(global.parcelRequire, asset.id);\n if (didAccept) {\n handled = true;\n }\n }\n });\n\n // Enable HMR for CSS by default.\n handled = handled || data.assets.every(function(asset) {\n return asset.type === 'css' && asset.generated.js;\n });\n\n if (handled) {\n console.clear();\n\n data.assets.forEach(function (asset) {\n hmrApply(global.parcelRequire, asset);\n });\n\n assetsToAccept.forEach(function (v) {\n hmrAcceptRun(v[0], v[1]);\n });\n } else if (location.reload) { // `location` global exists in a web worker context but lacks `.reload()` function.\n location.reload();\n }\n }\n\n if (data.type === 'reload') {\n ws.close();\n ws.onclose = function () {\n location.reload();\n }\n }\n\n if (data.type === 'error-resolved') {\n console.log('[parcel] ✨ Error resolved');\n\n removeErrorOverlay();\n }\n\n if (data.type === 'error') {\n console.error('[parcel] 🚨 ' + data.error.message + '\\n' + data.error.stack);\n\n removeErrorOverlay();\n\n var overlay = createErrorOverlay(data);\n document.body.appendChild(overlay);\n }\n };\n}\n\nfunction removeErrorOverlay() {\n var overlay = document.getElementById(OVERLAY_ID);\n if (overlay) {\n overlay.remove();\n }\n}\n\nfunction createErrorOverlay(data) {\n var overlay = document.createElement('div');\n overlay.id = OVERLAY_ID;\n\n // html encode message and stack trace\n var message = document.createElement('div');\n var stackTrace = document.createElement('pre');\n message.innerText = data.error.message;\n stackTrace.innerText = data.error.stack;\n\n overlay.innerHTML = (\n '
' +\n 'ERROR' +\n '🚨' +\n '
' + message.innerHTML + '
' +\n '
' + stackTrace.innerHTML + '
' +\n '
'\n );\n\n return overlay;\n\n}\n\nfunction getParents(bundle, id) {\n var modules = bundle.modules;\n if (!modules) {\n return [];\n }\n\n var parents = [];\n var k, d, dep;\n\n for (k in modules) {\n for (d in modules[k][1]) {\n dep = modules[k][1][d];\n if (dep === id || (Array.isArray(dep) && dep[dep.length - 1] === id)) {\n parents.push(k);\n }\n }\n }\n\n if (bundle.parent) {\n parents = parents.concat(getParents(bundle.parent, id));\n }\n\n return parents;\n}\n\nfunction hmrApply(bundle, asset) {\n var modules = bundle.modules;\n if (!modules) {\n return;\n }\n\n if (modules[asset.id] || !bundle.parent) {\n var fn = new Function('require', 'module', 'exports', asset.generated.js);\n asset.isNew = !modules[asset.id];\n modules[asset.id] = [fn, asset.deps];\n } else if (bundle.parent) {\n hmrApply(bundle.parent, asset);\n }\n}\n\nfunction hmrAcceptCheck(bundle, id) {\n var modules = bundle.modules;\n if (!modules) {\n return;\n }\n\n if (!modules[id] && bundle.parent) {\n return hmrAcceptCheck(bundle.parent, id);\n }\n\n if (checkedAssets[id]) {\n return;\n }\n checkedAssets[id] = true;\n\n var cached = bundle.cache[id];\n\n assetsToAccept.push([bundle, id]);\n\n if (cached && cached.hot && cached.hot._acceptCallbacks.length) {\n return true;\n }\n\n return getParents(global.parcelRequire, id).some(function (id) {\n return hmrAcceptCheck(global.parcelRequire, id)\n });\n}\n\nfunction hmrAcceptRun(bundle, id) {\n var cached = bundle.cache[id];\n bundle.hotData = {};\n if (cached) {\n cached.hot.data = bundle.hotData;\n }\n\n if (cached && cached.hot && cached.hot._disposeCallbacks.length) {\n cached.hot._disposeCallbacks.forEach(function (cb) {\n cb(bundle.hotData);\n });\n }\n\n delete bundle.cache[id];\n bundle(id);\n\n cached = bundle.cache[id];\n if (cached && cached.hot && cached.hot._acceptCallbacks.length) {\n cached.hot._acceptCallbacks.forEach(function (cb) {\n cb();\n });\n return true;\n }\n}\n"]} \ No newline at end of file diff --git a/example/index.ts b/example/index.ts index e19750c..de8540b 100644 --- a/example/index.ts +++ b/example/index.ts @@ -9,7 +9,6 @@ import { getElement, sideEffect, component, - sub, } from '../dist/src/index.js'; // this is (currently) how you define a component @@ -34,18 +33,6 @@ component('test-component', () => { console.log(getElement()); - const renderSub = () => { - if ($s.swap) { - return html` -
this text
- `; - } else { - return html` -
can be changed
-
just like this
- `; - } - }; return { watch: [$s, $test, $toast], render: () => { @@ -62,7 +49,14 @@ component('test-component', () => { })} />
- ${sub(renderSub)} + ${$s.swap + ? html` +
this text
+ ` + : html` +
can be changed
+
just like this
+ `}