diff --git a/CHANGELOG b/CHANGELOG
index bca7820d..b96d71f9 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,5 +1,8 @@
All notable changes to this project will be documented in this file.
+### 1.3.2 - 1 feb '22
+ - fix webcomponent for event without img
+
### 1.3.1 - 1 feb '22
- inherits tags in recurring events [#138](https://framagit.org/les/gancio/-/issues/138)
- you can now skip an occurrence of a recurring event
diff --git a/docs/assets/js/gancio-events.es.js b/docs/assets/js/gancio-events.es.js
index e806e8d3..8e74ffb4 100644
--- a/docs/assets/js/gancio-events.es.js
+++ b/docs/assets/js/gancio-events.es.js
@@ -466,15 +466,14 @@ function create_if_block_2(ctx) {
}
function create_else_block(ctx) {
let img;
- let img_style_value;
let img_alt_value;
let img_src_value;
return {
c() {
img = element("img");
- attr(img, "style", img_style_value = "object-position: " + position$1(ctx[11]) + "; aspect-ratio=1.7778;");
- attr(img, "alt", img_alt_value = ctx[11].media[0].name);
- if (!src_url_equal(img.src, img_src_value = ctx[11].media.length ? ctx[0] + "/media/thumb/" + ctx[11].media[0].url : ctx[0] + "/noimg.svg"))
+ attr(img, "style", "aspect-ratio=1.7778;");
+ attr(img, "alt", img_alt_value = ctx[11].title);
+ if (!src_url_equal(img.src, img_src_value = ctx[0] + "/noimg.svg"))
attr(img, "src", img_src_value);
attr(img, "loading", "lazy");
},
@@ -482,13 +481,10 @@ function create_else_block(ctx) {
insert(target, img, anchor);
},
p(ctx2, dirty) {
- if (dirty & 16 && img_style_value !== (img_style_value = "object-position: " + position$1(ctx2[11]) + "; aspect-ratio=1.7778;")) {
- attr(img, "style", img_style_value);
- }
- if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].media[0].name)) {
+ if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].title)) {
attr(img, "alt", img_alt_value);
}
- if (dirty & 17 && !src_url_equal(img.src, img_src_value = ctx2[11].media.length ? ctx2[0] + "/media/thumb/" + ctx2[11].media[0].url : ctx2[0] + "/noimg.svg")) {
+ if (dirty & 1 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/noimg.svg")) {
attr(img, "src", img_src_value);
}
},
@@ -508,7 +504,7 @@ function create_if_block_3(ctx) {
img = element("img");
attr(img, "style", img_style_value = "object-position: " + position$1(ctx[11]) + "; aspect-ratio=1.7778;");
attr(img, "alt", img_alt_value = ctx[11].media[0].name);
- if (!src_url_equal(img.src, img_src_value = ctx[11].media.length ? ctx[0] + "/media/thumb/" + ctx[11].media[0].url : ctx[0] + "/noimg.svg"))
+ if (!src_url_equal(img.src, img_src_value = ctx[0] + "/media/thumb/" + ctx[11].media[0].url))
attr(img, "src", img_src_value);
attr(img, "loading", "lazy");
},
@@ -522,7 +518,7 @@ function create_if_block_3(ctx) {
if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].media[0].name)) {
attr(img, "alt", img_alt_value);
}
- if (dirty & 17 && !src_url_equal(img.src, img_src_value = ctx2[11].media.length ? ctx2[0] + "/media/thumb/" + ctx2[11].media[0].url : ctx2[0] + "/noimg.svg")) {
+ if (dirty & 17 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/media/thumb/" + ctx2[11].media[0].url)) {
attr(img, "src", img_src_value);
}
},
@@ -869,7 +865,7 @@ function instance$1($$self, $$props, $$invalidate) {
class GancioEvents extends SvelteElement {
constructor(options) {
super();
- this.shadowRoot.innerHTML = ``;
+ this.shadowRoot.innerHTML = ``;
init(this, {
target: this.shadowRoot,
props: attribute_to_object(this.attributes),
diff --git a/docs/changelog.md b/docs/changelog.md
index 044c455b..68e88df2 100644
--- a/docs/changelog.md
+++ b/docs/changelog.md
@@ -7,6 +7,10 @@ nav_order: 10
All notable changes to this project will be documented in this file.
+
+### 1.3.2 - 1 feb '22
+ - fix webcomponent for event without img
+
### 1.3.1 - 1 feb '22
- inherits tags in recurring events [#138](https://framagit.org/les/gancio/-/issues/138)
- you can now skip an occurrence of a recurring event
diff --git a/static/gancio-events.es.js b/static/gancio-events.es.js
index e806e8d3..8e74ffb4 100644
--- a/static/gancio-events.es.js
+++ b/static/gancio-events.es.js
@@ -466,15 +466,14 @@ function create_if_block_2(ctx) {
}
function create_else_block(ctx) {
let img;
- let img_style_value;
let img_alt_value;
let img_src_value;
return {
c() {
img = element("img");
- attr(img, "style", img_style_value = "object-position: " + position$1(ctx[11]) + "; aspect-ratio=1.7778;");
- attr(img, "alt", img_alt_value = ctx[11].media[0].name);
- if (!src_url_equal(img.src, img_src_value = ctx[11].media.length ? ctx[0] + "/media/thumb/" + ctx[11].media[0].url : ctx[0] + "/noimg.svg"))
+ attr(img, "style", "aspect-ratio=1.7778;");
+ attr(img, "alt", img_alt_value = ctx[11].title);
+ if (!src_url_equal(img.src, img_src_value = ctx[0] + "/noimg.svg"))
attr(img, "src", img_src_value);
attr(img, "loading", "lazy");
},
@@ -482,13 +481,10 @@ function create_else_block(ctx) {
insert(target, img, anchor);
},
p(ctx2, dirty) {
- if (dirty & 16 && img_style_value !== (img_style_value = "object-position: " + position$1(ctx2[11]) + "; aspect-ratio=1.7778;")) {
- attr(img, "style", img_style_value);
- }
- if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].media[0].name)) {
+ if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].title)) {
attr(img, "alt", img_alt_value);
}
- if (dirty & 17 && !src_url_equal(img.src, img_src_value = ctx2[11].media.length ? ctx2[0] + "/media/thumb/" + ctx2[11].media[0].url : ctx2[0] + "/noimg.svg")) {
+ if (dirty & 1 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/noimg.svg")) {
attr(img, "src", img_src_value);
}
},
@@ -508,7 +504,7 @@ function create_if_block_3(ctx) {
img = element("img");
attr(img, "style", img_style_value = "object-position: " + position$1(ctx[11]) + "; aspect-ratio=1.7778;");
attr(img, "alt", img_alt_value = ctx[11].media[0].name);
- if (!src_url_equal(img.src, img_src_value = ctx[11].media.length ? ctx[0] + "/media/thumb/" + ctx[11].media[0].url : ctx[0] + "/noimg.svg"))
+ if (!src_url_equal(img.src, img_src_value = ctx[0] + "/media/thumb/" + ctx[11].media[0].url))
attr(img, "src", img_src_value);
attr(img, "loading", "lazy");
},
@@ -522,7 +518,7 @@ function create_if_block_3(ctx) {
if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].media[0].name)) {
attr(img, "alt", img_alt_value);
}
- if (dirty & 17 && !src_url_equal(img.src, img_src_value = ctx2[11].media.length ? ctx2[0] + "/media/thumb/" + ctx2[11].media[0].url : ctx2[0] + "/noimg.svg")) {
+ if (dirty & 17 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/media/thumb/" + ctx2[11].media[0].url)) {
attr(img, "src", img_src_value);
}
},
@@ -869,7 +865,7 @@ function instance$1($$self, $$props, $$invalidate) {
class GancioEvents extends SvelteElement {
constructor(options) {
super();
- this.shadowRoot.innerHTML = ``;
+ this.shadowRoot.innerHTML = ``;
init(this, {
target: this.shadowRoot,
props: attribute_to_object(this.attributes),
diff --git a/webcomponents/src/GancioEvents.svelte b/webcomponents/src/GancioEvents.svelte
index 45fcb51d..6fbe7159 100644
--- a/webcomponents/src/GancioEvents.svelte
+++ b/webcomponents/src/GancioEvents.svelte
@@ -90,11 +90,11 @@
{#if event.media.length}
+ src="{baseurl + '/media/thumb/' + event.media[0].url}" loading='lazy'/>
{:else}
-
+
{/if}
{/if}
@@ -147,8 +147,9 @@
.event .img {
width: 100%;
- max-width: 500px;
- height: 250px;
+ max-width: 450px;
+ max-height: 250px;
+ aspect-ratio: 1.7778;
flex: 1 0 auto;
/* height: 100%; */
}
diff --git a/wp-plugin/js/gancio-events.es.js b/wp-plugin/js/gancio-events.es.js
index 95bfea0a..8e74ffb4 100644
--- a/wp-plugin/js/gancio-events.es.js
+++ b/wp-plugin/js/gancio-events.es.js
@@ -67,6 +67,9 @@ function set_data(text2, data) {
if (text2.wholeText !== data)
text2.data = data;
}
+function toggle_class(element2, name, toggle) {
+ element2.classList[toggle ? "add" : "remove"](name);
+}
function attribute_to_object(attributes) {
const result = {};
for (const attribute of attributes) {
@@ -279,73 +282,62 @@ if (typeof HTMLElement === "function") {
}
function get_each_context(ctx, list, i) {
const child_ctx = ctx.slice();
- child_ctx[9] = list[i];
+ child_ctx[11] = list[i];
+ return child_ctx;
+}
+function get_each_context_1(ctx, list, i) {
+ const child_ctx = ctx.slice();
+ child_ctx[14] = list[i];
return child_ctx;
}
function create_if_block$1(ctx) {
- let div1;
- let a;
- let div0;
- let span;
- let t0_value = (ctx[1] || "Gancio") + "";
- let t0;
- let t1;
- let img;
- let img_src_value;
- let t2;
- let each_value = ctx[3];
+ let div;
+ let t;
+ let if_block = ctx[1] && ctx[3] === "true" && create_if_block_4(ctx);
+ let each_value = ctx[4];
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));
}
return {
c() {
- div1 = element("div");
- a = element("a");
- div0 = element("div");
- span = element("span");
- t0 = text(t0_value);
- t1 = space();
- img = element("img");
- t2 = space();
+ div = element("div");
+ if (if_block)
+ if_block.c();
+ t = space();
for (let i = 0; i < each_blocks.length; i += 1) {
each_blocks[i].c();
}
- attr(span, "id", "headerTitle");
- attr(img, "id", "logo");
- attr(img, "alt", "logo");
- if (!src_url_equal(img.src, img_src_value = "" + (ctx[0] + "/logo.png")))
- attr(img, "src", img_src_value);
- attr(div0, "class", "content");
- attr(a, "href", ctx[0]);
- attr(a, "target", "_blank");
- attr(div1, "id", "gancioEvents");
- attr(div1, "class", ctx[2]);
+ attr(div, "id", "gancioEvents");
+ toggle_class(div, "dark", ctx[2] === "dark");
+ toggle_class(div, "light", ctx[2] === "light");
+ toggle_class(div, "sidebar", ctx[3] === "true");
+ toggle_class(div, "nosidebar", ctx[3] !== "true");
},
m(target, anchor) {
- insert(target, div1, anchor);
- append(div1, a);
- append(a, div0);
- append(div0, span);
- append(span, t0);
- append(div0, t1);
- append(div0, img);
- append(div1, t2);
+ insert(target, div, anchor);
+ if (if_block)
+ if_block.m(div, null);
+ append(div, t);
for (let i = 0; i < each_blocks.length; i += 1) {
- each_blocks[i].m(div1, null);
+ each_blocks[i].m(div, null);
}
},
p(ctx2, dirty) {
- if (dirty & 2 && t0_value !== (t0_value = (ctx2[1] || "Gancio") + ""))
- set_data(t0, t0_value);
- if (dirty & 1 && !src_url_equal(img.src, img_src_value = "" + (ctx2[0] + "/logo.png"))) {
- attr(img, "src", img_src_value);
+ if (ctx2[1] && ctx2[3] === "true") {
+ if (if_block) {
+ if_block.p(ctx2, dirty);
+ } else {
+ if_block = create_if_block_4(ctx2);
+ if_block.c();
+ if_block.m(div, t);
+ }
+ } else if (if_block) {
+ if_block.d(1);
+ if_block = null;
}
- if (dirty & 1) {
- attr(a, "href", ctx2[0]);
- }
- if (dirty & 9) {
- each_value = ctx2[3];
+ if (dirty & 25) {
+ each_value = ctx2[4];
let i;
for (i = 0; i < each_value.length; i += 1) {
const child_ctx = get_each_context(ctx2, each_value, i);
@@ -354,7 +346,7 @@ function create_if_block$1(ctx) {
} else {
each_blocks[i] = create_each_block(child_ctx);
each_blocks[i].c();
- each_blocks[i].m(div1, null);
+ each_blocks[i].m(div, null);
}
}
for (; i < each_blocks.length; i += 1) {
@@ -363,82 +355,69 @@ function create_if_block$1(ctx) {
each_blocks.length = each_value.length;
}
if (dirty & 4) {
- attr(div1, "class", ctx2[2]);
+ toggle_class(div, "dark", ctx2[2] === "dark");
+ }
+ if (dirty & 4) {
+ toggle_class(div, "light", ctx2[2] === "light");
+ }
+ if (dirty & 8) {
+ toggle_class(div, "sidebar", ctx2[3] === "true");
+ }
+ if (dirty & 8) {
+ toggle_class(div, "nosidebar", ctx2[3] !== "true");
}
},
d(detaching) {
if (detaching)
- detach(div1);
+ detach(div);
+ if (if_block)
+ if_block.d();
destroy_each(each_blocks, detaching);
}
};
}
-function create_each_block(ctx) {
+function create_if_block_4(ctx) {
let a;
- let div2;
+ let div1;
let div0;
- let t0_value = when$1(ctx[9].start_datetime) + "";
let t0;
let t1;
- let span;
- let t2;
- let t3_value = ctx[9].place.name + "";
- let t3;
- let t4;
- let div1;
- let t5_value = ctx[9].title + "";
- let t5;
- let t6;
- let a_href_value;
- let a_title_value;
+ let img;
+ let img_src_value;
return {
c() {
a = element("a");
- div2 = element("div");
- div0 = element("div");
- t0 = text(t0_value);
- t1 = space();
- span = element("span");
- t2 = text("@");
- t3 = text(t3_value);
- t4 = space();
div1 = element("div");
- t5 = text(t5_value);
- t6 = space();
- attr(span, "class", "place");
- attr(div0, "class", "subtitle");
- attr(div1, "class", "title");
- attr(div2, "class", "content");
- attr(a, "href", a_href_value = "" + (ctx[0] + "/event/" + (ctx[9].slug || ctx[9].id)));
- attr(a, "title", a_title_value = ctx[9].title);
+ div0 = element("div");
+ t0 = text(ctx[1]);
+ t1 = space();
+ img = element("img");
+ attr(div0, "class", "title");
+ attr(img, "id", "logo");
+ attr(img, "alt", "logo");
+ if (!src_url_equal(img.src, img_src_value = "" + (ctx[0] + "/logo.png")))
+ attr(img, "src", img_src_value);
+ attr(div1, "class", "content");
+ attr(a, "href", ctx[0]);
attr(a, "target", "_blank");
+ attr(a, "id", "header");
},
m(target, anchor) {
insert(target, a, anchor);
- append(a, div2);
- append(div2, div0);
+ append(a, div1);
+ append(div1, div0);
append(div0, t0);
- append(div0, t1);
- append(div0, span);
- append(span, t2);
- append(span, t3);
- append(div2, t4);
- append(div2, div1);
- append(div1, t5);
- append(a, t6);
+ append(div1, t1);
+ append(div1, img);
},
p(ctx2, dirty) {
- if (dirty & 8 && t0_value !== (t0_value = when$1(ctx2[9].start_datetime) + ""))
- set_data(t0, t0_value);
- if (dirty & 8 && t3_value !== (t3_value = ctx2[9].place.name + ""))
- set_data(t3, t3_value);
- if (dirty & 8 && t5_value !== (t5_value = ctx2[9].title + ""))
- set_data(t5, t5_value);
- 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 & 2)
+ set_data(t0, ctx2[1]);
+ if (dirty & 1 && !src_url_equal(img.src, img_src_value = "" + (ctx2[0] + "/logo.png"))) {
+ attr(img, "src", img_src_value);
}
- if (dirty & 8 && a_title_value !== (a_title_value = ctx2[9].title)) {
- attr(a, "title", a_title_value);
+ if (dirty & 1) {
+ attr(a, "href", ctx2[0]);
}
},
d(detaching) {
@@ -447,9 +426,318 @@ function create_each_block(ctx) {
}
};
}
+function create_if_block_2(ctx) {
+ let div;
+ function select_block_type(ctx2, dirty) {
+ if (ctx2[11].media.length)
+ return create_if_block_3;
+ return create_else_block;
+ }
+ let current_block_type = select_block_type(ctx);
+ let if_block = current_block_type(ctx);
+ return {
+ c() {
+ div = element("div");
+ if_block.c();
+ attr(div, "class", "img");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ if_block.m(div, null);
+ },
+ p(ctx2, dirty) {
+ if (current_block_type === (current_block_type = select_block_type(ctx2)) && if_block) {
+ if_block.p(ctx2, dirty);
+ } else {
+ if_block.d(1);
+ if_block = current_block_type(ctx2);
+ if (if_block) {
+ if_block.c();
+ if_block.m(div, null);
+ }
+ }
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ if_block.d();
+ }
+ };
+}
+function create_else_block(ctx) {
+ let img;
+ let img_alt_value;
+ let img_src_value;
+ return {
+ c() {
+ img = element("img");
+ attr(img, "style", "aspect-ratio=1.7778;");
+ attr(img, "alt", img_alt_value = ctx[11].title);
+ if (!src_url_equal(img.src, img_src_value = ctx[0] + "/noimg.svg"))
+ attr(img, "src", img_src_value);
+ attr(img, "loading", "lazy");
+ },
+ m(target, anchor) {
+ insert(target, img, anchor);
+ },
+ p(ctx2, dirty) {
+ if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].title)) {
+ attr(img, "alt", img_alt_value);
+ }
+ if (dirty & 1 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/noimg.svg")) {
+ attr(img, "src", img_src_value);
+ }
+ },
+ d(detaching) {
+ if (detaching)
+ detach(img);
+ }
+ };
+}
+function create_if_block_3(ctx) {
+ let img;
+ let img_style_value;
+ let img_alt_value;
+ let img_src_value;
+ return {
+ c() {
+ img = element("img");
+ attr(img, "style", img_style_value = "object-position: " + position$1(ctx[11]) + "; aspect-ratio=1.7778;");
+ attr(img, "alt", img_alt_value = ctx[11].media[0].name);
+ if (!src_url_equal(img.src, img_src_value = ctx[0] + "/media/thumb/" + ctx[11].media[0].url))
+ attr(img, "src", img_src_value);
+ attr(img, "loading", "lazy");
+ },
+ m(target, anchor) {
+ insert(target, img, anchor);
+ },
+ p(ctx2, dirty) {
+ if (dirty & 16 && img_style_value !== (img_style_value = "object-position: " + position$1(ctx2[11]) + "; aspect-ratio=1.7778;")) {
+ attr(img, "style", img_style_value);
+ }
+ if (dirty & 16 && img_alt_value !== (img_alt_value = ctx2[11].media[0].name)) {
+ attr(img, "alt", img_alt_value);
+ }
+ if (dirty & 17 && !src_url_equal(img.src, img_src_value = ctx2[0] + "/media/thumb/" + ctx2[11].media[0].url)) {
+ attr(img, "src", img_src_value);
+ }
+ },
+ d(detaching) {
+ if (detaching)
+ detach(img);
+ }
+ };
+}
+function create_if_block_1$1(ctx) {
+ let div;
+ let each_value_1 = ctx[11].tags;
+ let each_blocks = [];
+ for (let i = 0; i < each_value_1.length; i += 1) {
+ each_blocks[i] = create_each_block_1(get_each_context_1(ctx, each_value_1, i));
+ }
+ return {
+ c() {
+ div = element("div");
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].c();
+ }
+ attr(div, "class", "tags");
+ },
+ m(target, anchor) {
+ insert(target, div, anchor);
+ for (let i = 0; i < each_blocks.length; i += 1) {
+ each_blocks[i].m(div, null);
+ }
+ },
+ p(ctx2, dirty) {
+ if (dirty & 16) {
+ each_value_1 = ctx2[11].tags;
+ let i;
+ for (i = 0; i < each_value_1.length; i += 1) {
+ const child_ctx = get_each_context_1(ctx2, each_value_1, i);
+ if (each_blocks[i]) {
+ each_blocks[i].p(child_ctx, dirty);
+ } else {
+ each_blocks[i] = create_each_block_1(child_ctx);
+ each_blocks[i].c();
+ each_blocks[i].m(div, null);
+ }
+ }
+ for (; i < each_blocks.length; i += 1) {
+ each_blocks[i].d(1);
+ }
+ each_blocks.length = each_value_1.length;
+ }
+ },
+ d(detaching) {
+ if (detaching)
+ detach(div);
+ destroy_each(each_blocks, detaching);
+ }
+ };
+}
+function create_each_block_1(ctx) {
+ let span;
+ let t0;
+ let t1_value = ctx[14] + "";
+ let t1;
+ return {
+ c() {
+ span = element("span");
+ t0 = text("#");
+ t1 = text(t1_value);
+ attr(span, "class", "tag");
+ },
+ m(target, anchor) {
+ insert(target, span, anchor);
+ append(span, t0);
+ append(span, t1);
+ },
+ p(ctx2, dirty) {
+ if (dirty & 16 && t1_value !== (t1_value = ctx2[14] + ""))
+ set_data(t1, t1_value);
+ },
+ d(detaching) {
+ if (detaching)
+ detach(span);
+ }
+ };
+}
+function create_each_block(ctx) {
+ let a;
+ let t0;
+ let div2;
+ let div0;
+ let t1_value = when$1(ctx[11].start_datetime) + "";
+ let t1;
+ let t2;
+ let div1;
+ let t3_value = ctx[11].title + "";
+ let t3;
+ let t4;
+ let span1;
+ let t5;
+ let t6_value = ctx[11].place.name + "";
+ let t6;
+ let t7;
+ let span0;
+ let t8_value = ctx[11].place.address + "";
+ let t8;
+ let t9;
+ let t10;
+ let a_href_value;
+ let a_title_value;
+ let if_block0 = ctx[3] !== "true" && create_if_block_2(ctx);
+ let if_block1 = ctx[11].tags.length && create_if_block_1$1(ctx);
+ return {
+ c() {
+ a = element("a");
+ if (if_block0)
+ if_block0.c();
+ t0 = space();
+ div2 = element("div");
+ div0 = element("div");
+ t1 = text(t1_value);
+ t2 = space();
+ div1 = element("div");
+ t3 = text(t3_value);
+ t4 = space();
+ span1 = element("span");
+ t5 = text("@");
+ t6 = text(t6_value);
+ t7 = space();
+ span0 = element("span");
+ t8 = text(t8_value);
+ t9 = space();
+ if (if_block1)
+ if_block1.c();
+ t10 = space();
+ attr(div0, "class", "subtitle");
+ attr(div1, "class", "title");
+ attr(span0, "class", "subtitle");
+ attr(span1, "class", "place");
+ attr(div2, "class", "content");
+ attr(a, "href", a_href_value = "" + (ctx[0] + "/event/" + (ctx[11].slug || ctx[11].id)));
+ attr(a, "class", "event");
+ attr(a, "title", a_title_value = ctx[11].title);
+ attr(a, "target", "_blank");
+ },
+ m(target, anchor) {
+ insert(target, a, anchor);
+ if (if_block0)
+ if_block0.m(a, null);
+ append(a, t0);
+ append(a, div2);
+ append(div2, div0);
+ append(div0, t1);
+ append(div2, t2);
+ append(div2, div1);
+ append(div1, t3);
+ append(div2, t4);
+ append(div2, span1);
+ append(span1, t5);
+ append(span1, t6);
+ append(span1, t7);
+ append(span1, span0);
+ append(span0, t8);
+ append(div2, t9);
+ if (if_block1)
+ if_block1.m(div2, null);
+ append(a, t10);
+ },
+ p(ctx2, dirty) {
+ if (ctx2[3] !== "true") {
+ if (if_block0) {
+ if_block0.p(ctx2, dirty);
+ } else {
+ if_block0 = create_if_block_2(ctx2);
+ if_block0.c();
+ if_block0.m(a, t0);
+ }
+ } else if (if_block0) {
+ if_block0.d(1);
+ if_block0 = null;
+ }
+ if (dirty & 16 && t1_value !== (t1_value = when$1(ctx2[11].start_datetime) + ""))
+ set_data(t1, t1_value);
+ if (dirty & 16 && t3_value !== (t3_value = ctx2[11].title + ""))
+ set_data(t3, t3_value);
+ if (dirty & 16 && t6_value !== (t6_value = ctx2[11].place.name + ""))
+ set_data(t6, t6_value);
+ if (dirty & 16 && t8_value !== (t8_value = ctx2[11].place.address + ""))
+ set_data(t8, t8_value);
+ if (ctx2[11].tags.length) {
+ if (if_block1) {
+ if_block1.p(ctx2, dirty);
+ } else {
+ if_block1 = create_if_block_1$1(ctx2);
+ if_block1.c();
+ if_block1.m(div2, null);
+ }
+ } else if (if_block1) {
+ if_block1.d(1);
+ if_block1 = null;
+ }
+ if (dirty & 17 && a_href_value !== (a_href_value = "" + (ctx2[0] + "/event/" + (ctx2[11].slug || ctx2[11].id)))) {
+ attr(a, "href", a_href_value);
+ }
+ if (dirty & 16 && a_title_value !== (a_title_value = ctx2[11].title)) {
+ attr(a, "title", a_title_value);
+ }
+ },
+ d(detaching) {
+ if (detaching)
+ detach(a);
+ if (if_block0)
+ if_block0.d();
+ if (if_block1)
+ if_block1.d();
+ }
+ };
+}
function create_fragment$1(ctx) {
let if_block_anchor;
- let if_block = ctx[3].length && create_if_block$1(ctx);
+ let if_block = ctx[4].length && create_if_block$1(ctx);
return {
c() {
if (if_block)
@@ -463,7 +751,7 @@ function create_fragment$1(ctx) {
insert(target, if_block_anchor, anchor);
},
p(ctx2, [dirty]) {
- if (ctx2[3].length) {
+ if (ctx2[4].length) {
if (if_block) {
if_block.p(ctx2, dirty);
} else {
@@ -486,10 +774,17 @@ function create_fragment$1(ctx) {
}
};
}
+function position$1(event) {
+ if (event.media[0].focalpoint) {
+ const focalpoint = event.media[0].focalpoint;
+ return `${(focalpoint[0] + 1) * 50}% ${(focalpoint[1] + 1) * 50}%`;
+ }
+ return "center center";
+}
function when$1(timestamp) {
return new Date(timestamp * 1e3).toLocaleDateString(void 0, {
weekday: "long",
- month: "short",
+ month: "long",
day: "numeric",
hour: "2-digit",
minute: "2-digit"
@@ -497,14 +792,16 @@ function when$1(timestamp) {
}
function instance$1($$self, $$props, $$invalidate) {
let { baseurl = "" } = $$props;
- let { title = "Gancio events" } = $$props;
+ let { title = "" } = $$props;
let { maxlength = false } = $$props;
let { tags = "" } = $$props;
let { places = "" } = $$props;
let { theme = "light" } = $$props;
+ let { show_recurrent = false } = $$props;
+ let { sidebar = "true" } = $$props;
let mounted = false;
let events = [];
- async function update2(v) {
+ function update2(v) {
if (!mounted)
return;
const params = [];
@@ -517,8 +814,11 @@ function instance$1($$self, $$props, $$invalidate) {
if (places) {
params.push(`places=${places}`);
}
+ if (show_recurrent) {
+ params.push(`show_recurrent=true`);
+ }
fetch(`${baseurl}/api/events?${params.join("&")}`).then((res) => res.json()).then((e) => {
- $$invalidate(3, events = e);
+ $$invalidate(4, events = e);
}).catch((e) => {
console.error("Error loading Gancio API -> ", e);
});
@@ -533,25 +833,39 @@ function instance$1($$self, $$props, $$invalidate) {
if ("title" in $$props2)
$$invalidate(1, title = $$props2.title);
if ("maxlength" in $$props2)
- $$invalidate(4, maxlength = $$props2.maxlength);
+ $$invalidate(5, maxlength = $$props2.maxlength);
if ("tags" in $$props2)
- $$invalidate(5, tags = $$props2.tags);
+ $$invalidate(6, tags = $$props2.tags);
if ("places" in $$props2)
- $$invalidate(6, places = $$props2.places);
+ $$invalidate(7, places = $$props2.places);
if ("theme" in $$props2)
$$invalidate(2, theme = $$props2.theme);
+ if ("show_recurrent" in $$props2)
+ $$invalidate(8, show_recurrent = $$props2.show_recurrent);
+ if ("sidebar" in $$props2)
+ $$invalidate(3, sidebar = $$props2.sidebar);
};
$$self.$$.update = () => {
- if ($$self.$$.dirty & 118) {
+ if ($$self.$$.dirty & 494) {
update2();
}
};
- return [baseurl, title, theme, events, maxlength, tags, places];
+ return [
+ baseurl,
+ title,
+ theme,
+ sidebar,
+ events,
+ maxlength,
+ tags,
+ places,
+ show_recurrent
+ ];
}
class GancioEvents extends SvelteElement {
constructor(options) {
super();
- this.shadowRoot.innerHTML = ``;
+ this.shadowRoot.innerHTML = ``;
init(this, {
target: this.shadowRoot,
props: attribute_to_object(this.attributes),
@@ -559,10 +873,12 @@ class GancioEvents extends SvelteElement {
}, instance$1, create_fragment$1, safe_not_equal, {
baseurl: 0,
title: 1,
- maxlength: 4,
- tags: 5,
- places: 6,
- theme: 2
+ maxlength: 5,
+ tags: 6,
+ places: 7,
+ theme: 2,
+ show_recurrent: 8,
+ sidebar: 3
}, null);
if (options) {
if (options.target) {
@@ -575,7 +891,16 @@ class GancioEvents extends SvelteElement {
}
}
static get observedAttributes() {
- return ["baseurl", "title", "maxlength", "tags", "places", "theme"];
+ return [
+ "baseurl",
+ "title",
+ "maxlength",
+ "tags",
+ "places",
+ "theme",
+ "show_recurrent",
+ "sidebar"
+ ];
}
get baseurl() {
return this.$$.ctx[0];
@@ -592,21 +917,21 @@ class GancioEvents extends SvelteElement {
flush();
}
get maxlength() {
- return this.$$.ctx[4];
+ return this.$$.ctx[5];
}
set maxlength(maxlength) {
this.$$set({ maxlength });
flush();
}
get tags() {
- return this.$$.ctx[5];
+ return this.$$.ctx[6];
}
set tags(tags) {
this.$$set({ tags });
flush();
}
get places() {
- return this.$$.ctx[6];
+ return this.$$.ctx[7];
}
set places(places) {
this.$$set({ places });
@@ -619,6 +944,20 @@ class GancioEvents extends SvelteElement {
this.$$set({ theme });
flush();
}
+ get show_recurrent() {
+ return this.$$.ctx[8];
+ }
+ set show_recurrent(show_recurrent) {
+ this.$$set({ show_recurrent });
+ flush();
+ }
+ get sidebar() {
+ return this.$$.ctx[3];
+ }
+ set sidebar(sidebar) {
+ this.$$set({ sidebar });
+ flush();
+ }
}
customElements.define("gancio-events", GancioEvents);
function create_if_block(ctx) {