Skip to content

Commit

Permalink
misc puttering
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorchard committed May 18, 2024
1 parent 21278cc commit cf7fca3
Show file tree
Hide file tree
Showing 10 changed files with 222 additions and 218 deletions.
10 changes: 4 additions & 6 deletions public/lib/components/StickyNote.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { html } from "../dom.js";
import { html, BaseElement } from "../dom.js";
import { StickyNotesCanvasChildDraggableMixin } from "../mixins/StickyNotesCanvasChildDraggableMixin.js";

export class StickyNote extends StickyNotesCanvasChildDraggableMixin() {
static observedAttributes = [
...StickyNotesCanvasChildDraggableMixin.observedAttributes,
"color",
];
const BaseClass = StickyNotesCanvasChildDraggableMixin(BaseElement);
export class StickyNote extends BaseClass {
static observedAttributes = [...BaseClass.observedAttributes, "color"];

static template = html`
<style>
Expand Down
25 changes: 7 additions & 18 deletions public/lib/components/StickyNotesCanvas.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,8 @@ import { html, BaseElement, $ } from "../dom.js";
import { PanZoomableMixin } from "../mixins/PanZoomableMixin.js";
import { GraphLayoutMixin } from "../mixins/GraphLayoutMixin.js";

export class StickyNotesCanvas extends GraphLayoutMixin(
PanZoomableMixin(BaseElement)
) {
static observedAttributes = [
...PanZoomableMixin.observedAttributes,
...GraphLayoutMixin.observedAttributes,
];

const BaseClass = GraphLayoutMixin(PanZoomableMixin(BaseElement));
export class StickyNotesCanvas extends BaseClass {
static template = html`
<style>
:host {
Expand All @@ -24,7 +18,6 @@ export class StickyNotesCanvas extends GraphLayoutMixin(
height: 100%;
}
.canvas {
}
.background {
position: absolute;
Expand All @@ -34,7 +27,11 @@ export class StickyNotesCanvas extends GraphLayoutMixin(
top: -5000px;
z-index: -100;
background-image: radial-gradient(circle at 5px 5px, rgba(0, 0, 0, 0.25) 3px, transparent 0);
background-image: radial-gradient(
circle at 5px 5px,
rgba(0, 0, 0, 0.25) 3px,
transparent 0
);
background-size: 40px 40px;
}
</style>
Expand All @@ -46,14 +43,6 @@ export class StickyNotesCanvas extends GraphLayoutMixin(
<div class="background"></div>
</div>
`;

get viewport() {
return this.$(".viewport");
}

constructor() {
super();
}
}

customElements.define("sticky-notes-canvas", StickyNotesCanvas);
8 changes: 3 additions & 5 deletions public/lib/components/StickyNotesClusterTopic.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { html, BaseElement } from "../dom.js";
import { StickyNotesCanvasChildDraggableMixin } from "../mixins/StickyNotesCanvasChildDraggableMixin.js";

export class StickyNotesClusterTopic extends StickyNotesCanvasChildDraggableMixin() {
static observedAttributes = [
...StickyNotesCanvasChildDraggableMixin.observedAttributes,
"color",
];
const BaseClass = StickyNotesCanvasChildDraggableMixin(BaseElement);
export class StickyNotesClusterTopic extends BaseClass {
static observedAttributes = [...BaseClass.observedAttributes, "color"];

static template = html`
<style>
Expand Down
2 changes: 2 additions & 0 deletions public/lib/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ export function createElement(name, changeSet = {}, context = document) {
}

export class BaseElement extends HTMLElement {
static observedAttributes = [];

static template = html`<slot></slot>`;

constructor() {
Expand Down
6 changes: 4 additions & 2 deletions public/lib/mixins/DraggableMixin.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
export const DraggableMixin = (Base) =>
class extends Base {
import { BaseElement } from "../dom.js";

export const DraggableMixin = (BaseClass = BaseElement) =>
class extends BaseClass {
connectedCallback() {
super.connectedCallback();
this.dragging = false;
Expand Down

0 comments on commit cf7fca3

Please sign in to comment.