From 603b7c4132a00eb44597c78a7ecd2584bc5f1ed6 Mon Sep 17 00:00:00 2001 From: lesion Date: Thu, 13 Jan 2022 21:52:56 +0100 Subject: [PATCH] update webcomponents test and deps --- static/gancio-events.es.js | 94 +++++++++++++++++++++++--------------- webcomponents/index.html | 8 ++-- webcomponents/package.json | 6 +-- webcomponents/yarn.lock | 68 +++++++++++++-------------- 4 files changed, 100 insertions(+), 76 deletions(-) diff --git a/static/gancio-events.es.js b/static/gancio-events.es.js index 4096fee2..95bfea0a 100644 --- a/static/gancio-events.es.js +++ b/static/gancio-events.es.js @@ -101,20 +101,20 @@ function schedule_update() { function add_render_callback(fn) { render_callbacks.push(fn); } -let flushing = false; const seen_callbacks = new Set(); +let flushidx = 0; function flush() { - if (flushing) - return; - flushing = true; + const saved_component = current_component; do { - for (let i = 0; i < dirty_components.length; i += 1) { - const component = dirty_components[i]; + while (flushidx < dirty_components.length) { + const component = dirty_components[flushidx]; + flushidx++; set_current_component(component); update(component.$$); } set_current_component(null); dirty_components.length = 0; + flushidx = 0; while (binding_callbacks.length) binding_callbacks.pop()(); for (let i = 0; i < render_callbacks.length; i += 1) { @@ -130,8 +130,8 @@ function flush() { flush_callbacks.pop()(); } update_scheduled = false; - flushing = false; seen_callbacks.clear(); + set_current_component(saved_component); } function update($$) { if ($$.fragment !== null) { @@ -279,7 +279,7 @@ if (typeof HTMLElement === "function") { } function get_each_context(ctx, list, i) { const child_ctx = ctx.slice(); - child_ctx[8] = list[i]; + child_ctx[9] = list[i]; return child_ctx; } function create_if_block$1(ctx) { @@ -293,7 +293,7 @@ function create_if_block$1(ctx) { let img; let img_src_value; let t2; - let each_value = ctx[2]; + let each_value = ctx[3]; let each_blocks = []; for (let i = 0; i < each_value.length; i += 1) { each_blocks[i] = create_each_block(get_each_context(ctx, each_value, i)); @@ -320,6 +320,7 @@ function create_if_block$1(ctx) { attr(a, "href", ctx[0]); attr(a, "target", "_blank"); attr(div1, "id", "gancioEvents"); + attr(div1, "class", ctx[2]); }, m(target, anchor) { insert(target, div1, anchor); @@ -343,8 +344,8 @@ function create_if_block$1(ctx) { if (dirty & 1) { attr(a, "href", ctx2[0]); } - if (dirty & 5) { - each_value = ctx2[2]; + if (dirty & 9) { + each_value = ctx2[3]; let i; for (i = 0; i < each_value.length; i += 1) { const child_ctx = get_each_context(ctx2, each_value, i); @@ -361,6 +362,9 @@ function create_if_block$1(ctx) { } each_blocks.length = each_value.length; } + if (dirty & 4) { + attr(div1, "class", ctx2[2]); + } }, d(detaching) { if (detaching) @@ -373,19 +377,20 @@ function create_each_block(ctx) { let a; let div2; let div0; - let t0_value = when$1(ctx[8].start_datetime) + ""; + let t0_value = when$1(ctx[9].start_datetime) + ""; let t0; let t1; let span; let t2; - let t3_value = ctx[8].place.name + ""; + let t3_value = ctx[9].place.name + ""; let t3; let t4; let div1; - let t5_value = ctx[8].title + ""; + let t5_value = ctx[9].title + ""; let t5; let t6; let a_href_value; + let a_title_value; return { c() { a = element("a"); @@ -404,7 +409,8 @@ function create_each_block(ctx) { attr(div0, "class", "subtitle"); attr(div1, "class", "title"); attr(div2, "class", "content"); - attr(a, "href", a_href_value = "" + (ctx[0] + "/event/" + (ctx[8].slug || ctx[8].id))); + attr(a, "href", a_href_value = "" + (ctx[0] + "/event/" + (ctx[9].slug || ctx[9].id))); + attr(a, "title", a_title_value = ctx[9].title); attr(a, "target", "_blank"); }, m(target, anchor) { @@ -422,15 +428,18 @@ function create_each_block(ctx) { append(a, t6); }, p(ctx2, dirty) { - if (dirty & 4 && t0_value !== (t0_value = when$1(ctx2[8].start_datetime) + "")) + if (dirty & 8 && t0_value !== (t0_value = when$1(ctx2[9].start_datetime) + "")) set_data(t0, t0_value); - if (dirty & 4 && t3_value !== (t3_value = ctx2[8].place.name + "")) + if (dirty & 8 && t3_value !== (t3_value = ctx2[9].place.name + "")) set_data(t3, t3_value); - if (dirty & 4 && t5_value !== (t5_value = ctx2[8].title + "")) + if (dirty & 8 && t5_value !== (t5_value = ctx2[9].title + "")) set_data(t5, t5_value); - if (dirty & 5 && a_href_value !== (a_href_value = "" + (ctx2[0] + "/event/" + (ctx2[8].slug || ctx2[8].id)))) { + if (dirty & 9 && a_href_value !== (a_href_value = "" + (ctx2[0] + "/event/" + (ctx2[9].slug || ctx2[9].id)))) { attr(a, "href", a_href_value); } + if (dirty & 8 && a_title_value !== (a_title_value = ctx2[9].title)) { + attr(a, "title", a_title_value); + } }, d(detaching) { if (detaching) @@ -440,7 +449,7 @@ function create_each_block(ctx) { } function create_fragment$1(ctx) { let if_block_anchor; - let if_block = ctx[2].length && create_if_block$1(ctx); + let if_block = ctx[3].length && create_if_block$1(ctx); return { c() { if (if_block) @@ -454,7 +463,7 @@ function create_fragment$1(ctx) { insert(target, if_block_anchor, anchor); }, p(ctx2, [dirty]) { - if (ctx2[2].length) { + if (ctx2[3].length) { if (if_block) { if_block.p(ctx2, dirty); } else { @@ -492,9 +501,10 @@ function instance$1($$self, $$props, $$invalidate) { let { maxlength = false } = $$props; let { tags = "" } = $$props; let { places = "" } = $$props; + let { theme = "light" } = $$props; let mounted = false; let events = []; - function update2(v) { + async function update2(v) { if (!mounted) return; const params = []; @@ -508,7 +518,9 @@ function instance$1($$self, $$props, $$invalidate) { params.push(`places=${places}`); } fetch(`${baseurl}/api/events?${params.join("&")}`).then((res) => res.json()).then((e) => { - $$invalidate(2, events = e); + $$invalidate(3, events = e); + }).catch((e) => { + console.error("Error loading Gancio API -> ", e); }); } onMount(() => { @@ -521,23 +533,25 @@ function instance$1($$self, $$props, $$invalidate) { if ("title" in $$props2) $$invalidate(1, title = $$props2.title); if ("maxlength" in $$props2) - $$invalidate(3, maxlength = $$props2.maxlength); + $$invalidate(4, maxlength = $$props2.maxlength); if ("tags" in $$props2) - $$invalidate(4, tags = $$props2.tags); + $$invalidate(5, tags = $$props2.tags); if ("places" in $$props2) - $$invalidate(5, places = $$props2.places); + $$invalidate(6, places = $$props2.places); + if ("theme" in $$props2) + $$invalidate(2, theme = $$props2.theme); }; $$self.$$.update = () => { - if ($$self.$$.dirty & 58) { + if ($$self.$$.dirty & 118) { update2(); } }; - return [baseurl, title, events, maxlength, tags, places]; + return [baseurl, title, theme, events, maxlength, tags, places]; } class GancioEvents extends SvelteElement { constructor(options) { super(); - this.shadowRoot.innerHTML = ``; + this.shadowRoot.innerHTML = ``; init(this, { target: this.shadowRoot, props: attribute_to_object(this.attributes), @@ -545,9 +559,10 @@ class GancioEvents extends SvelteElement { }, instance$1, create_fragment$1, safe_not_equal, { baseurl: 0, title: 1, - maxlength: 3, - tags: 4, - places: 5 + maxlength: 4, + tags: 5, + places: 6, + theme: 2 }, null); if (options) { if (options.target) { @@ -560,7 +575,7 @@ class GancioEvents extends SvelteElement { } } static get observedAttributes() { - return ["baseurl", "title", "maxlength", "tags", "places"]; + return ["baseurl", "title", "maxlength", "tags", "places", "theme"]; } get baseurl() { return this.$$.ctx[0]; @@ -577,26 +592,33 @@ class GancioEvents extends SvelteElement { flush(); } get maxlength() { - return this.$$.ctx[3]; + return this.$$.ctx[4]; } set maxlength(maxlength) { this.$$set({ maxlength }); flush(); } get tags() { - return this.$$.ctx[4]; + return this.$$.ctx[5]; } set tags(tags) { this.$$set({ tags }); flush(); } get places() { - return this.$$.ctx[5]; + return this.$$.ctx[6]; } set places(places) { this.$$set({ places }); flush(); } + get theme() { + return this.$$.ctx[2]; + } + set theme(theme) { + this.$$set({ theme }); + flush(); + } } customElements.define("gancio-events", GancioEvents); function create_if_block(ctx) { diff --git a/webcomponents/index.html b/webcomponents/index.html index 95a69b70..ed611ec8 100644 --- a/webcomponents/index.html +++ b/webcomponents/index.html @@ -7,9 +7,11 @@ Gancio Events Custom Element Demo - - + +
+ +
+ diff --git a/webcomponents/package.json b/webcomponents/package.json index 1488ed0b..1facfb05 100644 --- a/webcomponents/package.json +++ b/webcomponents/package.json @@ -9,8 +9,8 @@ "serve": "vite preview" }, "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.0-next.11", - "svelte": "^3.37.0", - "vite": "^2.6.4" + "@sveltejs/vite-plugin-svelte": "^1.0.0-next.34", + "svelte": "^3.46.1", + "vite": "^2.7.11" } } diff --git a/webcomponents/yarn.lock b/webcomponents/yarn.lock index 54769a19..bc3fcbd4 100644 --- a/webcomponents/yarn.lock +++ b/webcomponents/yarn.lock @@ -2,25 +2,25 @@ # yarn lockfile v1 -"@rollup/pluginutils@^4.1.1": - version "4.1.1" - resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.1.1.tgz#1d4da86dd4eded15656a57d933fda2b9a08d47ec" - integrity sha512-clDjivHqWGXi7u+0d2r2sBi4Ie6VLEAzWMIkvJLnDmxoOhBYOTfzGbOQBA32THHm11/LiJbd01tJUpJsbshSWQ== +"@rollup/pluginutils@^4.1.2": + version "4.1.2" + resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-4.1.2.tgz#ed5821c15e5e05e32816f5fb9ec607cdf5a75751" + integrity sha512-ROn4qvkxP9SyPeHaf7uQC/GPFY6L/OWy9+bd9AwcjOAWQwxRscoEyAUD8qCY5o5iL4jqQwoLk2kaTKJPb/HwzQ== dependencies: estree-walker "^2.0.1" picomatch "^2.2.2" -"@sveltejs/vite-plugin-svelte@^1.0.0-next.11": - version "1.0.0-next.31" - resolved "https://registry.yarnpkg.com/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.31.tgz#5d0d5445ed85a1af613224eacff78c69f14c7fad" - integrity sha512-8K3DcGP1V+XBv389u32S6wt8xiun6hHd5wn28AKLSoNTIhOmJOA2RJUJzp0seTRI86Shme4lzHI2Fgq4qz1wXQ== +"@sveltejs/vite-plugin-svelte@^1.0.0-next.34": + version "1.0.0-next.34" + resolved "https://registry.yarnpkg.com/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-1.0.0-next.34.tgz#24150ba572652cb3abdfc1205d6aae2326cc93b4" + integrity sha512-qZH2jndijrdkvevgbO7OH3iQsviM5Kz7h5APiNP4yEMZTrwq9bifzYvco6BprwtPvLb5wYlRVFZUOdusY6AovQ== dependencies: - "@rollup/pluginutils" "^4.1.1" + "@rollup/pluginutils" "^4.1.2" debug "^4.3.3" kleur "^4.1.4" magic-string "^0.25.7" require-relative "^0.8.7" - svelte-hmr "^0.14.7" + svelte-hmr "^0.14.9" debug@^4.3.3: version "4.3.3" @@ -114,7 +114,7 @@ esbuild-windows-arm64@0.13.15: resolved "https://registry.yarnpkg.com/esbuild-windows-arm64/-/esbuild-windows-arm64-0.13.15.tgz#482173070810df22a752c686509c370c3be3b3c3" integrity sha512-zzvyCVVpbwQQATaf3IG8mu1IwGEiDxKkYUdA4FpoCHi1KtPa13jeScYDjlW0Qh+ebWzpKfR2ZwvqAQkSWNcKjA== -esbuild@^0.13.2: +esbuild@^0.13.12: version "0.13.15" resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.13.15.tgz#db56a88166ee373f87dbb2d8798ff449e0450cdf" integrity sha512-raCxt02HBKv8RJxE8vkTSCXGIyKHdEdGfUmiYb8wnabnaEmHzyW7DCHb5tEN0xU8ryqg5xw54mcwnYkC4x3AIw== @@ -203,10 +203,10 @@ picomatch@^2.2.2: resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.0.tgz#f1f061de8f6a4bf022892e2d128234fb98302972" integrity sha512-lY1Q/PiJGC2zOv/z391WOTD+Z02bCgsFfvxoXXf6h7kv9o+WmsmzYqrAwY63sNgOxE4xEdq0WyUnXfKeBrSvYw== -postcss@^8.3.8: - version "8.4.4" - resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.4.tgz#d53d4ec6a75fd62557a66bb41978bf47ff0c2869" - integrity sha512-joU6fBsN6EIer28Lj6GDFoC/5yOZzLCfn0zHAn/MYXI7aPt4m4hK5KC5ovEZXy+lnCjmYIbQWngvju2ddyEr8Q== +postcss@^8.4.5: + version "8.4.5" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-8.4.5.tgz#bae665764dfd4c6fcc24dc0fdf7e7aa00cc77f95" + integrity sha512-jBDboWM8qpaqwkMwItqTQTiFikhs/67OYVvblFFTM7MrZjt6yMKd6r2kgXizEbTTljacm4NldIlZnhbjr84QYg== dependencies: nanoid "^3.1.30" picocolors "^1.0.0" @@ -225,10 +225,10 @@ resolve@^1.20.0: is-core-module "^2.2.0" path-parse "^1.0.6" -rollup@^2.57.0: - version "2.60.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.60.2.tgz#3f45ace36a9b10b4297181831ea0719922513463" - integrity sha512-1Bgjpq61sPjgoZzuiDSGvbI1tD91giZABgjCQBKM5aYLnzjq52GoDuWVwT/cm/MCxCMPU8gqQvkj8doQ5C8Oqw== +rollup@^2.59.0: + version "2.63.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.63.0.tgz#fe2f7fec2133f3fab9e022b9ac245628d817c6bb" + integrity sha512-nps0idjmD+NXl6OREfyYXMn/dar3WGcyKn+KBzPdaLecub3x/LrId0wUcthcr8oZUAcZAR8NKcfGGFlNgGL1kQ== optionalDependencies: fsevents "~2.3.2" @@ -242,24 +242,24 @@ sourcemap-codec@^1.4.4: resolved "https://registry.yarnpkg.com/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz#ea804bd94857402e6992d05a38ef1ae35a9ab4c4" integrity sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA== -svelte-hmr@^0.14.7: - version "0.14.7" - resolved "https://registry.yarnpkg.com/svelte-hmr/-/svelte-hmr-0.14.7.tgz#7fa8261c7b225d9409f0a86f3b9ea5c3ca6f6607" - integrity sha512-pDrzgcWSoMaK6AJkBWkmgIsecW0GChxYZSZieIYfCP0v2oPyx2CYU/zm7TBIcjLVUPP714WxmViE9Thht4etog== +svelte-hmr@^0.14.9: + version "0.14.9" + resolved "https://registry.yarnpkg.com/svelte-hmr/-/svelte-hmr-0.14.9.tgz#35f277efc789e1a6230185717347cddb2f8e9833" + integrity sha512-bKE9+4qb4sAnA+TKHiYurUl970rjA0XmlP9TEP7K/ncyWz3m81kA4HOgmlZK/7irGK7gzZlaPDI3cmf8fp/+tg== -svelte@^3.37.0: - version "3.44.2" - resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.44.2.tgz#3e69be2598308dfc8354ba584cec54e648a50f7f" - integrity sha512-jrZhZtmH3ZMweXg1Q15onb8QlWD+a5T5Oca4C1jYvSURp2oD35h4A5TV6t6MEa93K4LlX6BkafZPdQoFjw/ylA== +svelte@^3.46.1: + version "3.46.1" + resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.46.1.tgz#8ea23595824a39d47d04c16c217000fbc4c52c49" + integrity sha512-Ue8ivq+G45AfZZL4Z93xNFiC352wPkyGiY9QSuWjxXh6jiaZMrpthinjc1rz0OSTceuST7Pxr1HDBj2KioliZg== -vite@^2.6.4: - version "2.6.14" - resolved "https://registry.yarnpkg.com/vite/-/vite-2.6.14.tgz#35c09a15e4df823410819a2a239ab11efb186271" - integrity sha512-2HA9xGyi+EhY2MXo0+A2dRsqsAG3eFNEVIo12olkWhOmc8LfiM+eMdrXf+Ruje9gdXgvSqjLI9freec1RUM5EA== +vite@^2.7.11: + version "2.7.11" + resolved "https://registry.yarnpkg.com/vite/-/vite-2.7.11.tgz#b3caca377c202db887afda16b85b0ab111146bd9" + integrity sha512-W1OVwJmtuxnzt9HwZ1AebVLgvsgNpe4TK/sxvF+1x2y8MRnTEHvaPqxy9A67IYb5BR0Q+nENmLYa3QfESmp5GQ== dependencies: - esbuild "^0.13.2" - postcss "^8.3.8" + esbuild "^0.13.12" + postcss "^8.4.5" resolve "^1.20.0" - rollup "^2.57.0" + rollup "^2.59.0" optionalDependencies: fsevents "~2.3.2"