Skip to content

Commit

Permalink
fix CE defines 2
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisShank committed Dec 3, 2024
1 parent 9d1d202 commit 53a87fa
Show file tree
Hide file tree
Showing 22 changed files with 45 additions and 61 deletions.
1 change: 1 addition & 0 deletions demo/chains-of-thought/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ class FolkThought extends HTMLElement {
static tagName = 'fc-thought';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down
3 changes: 3 additions & 0 deletions demo/src/geo-wiki.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export class GeoWiki extends HTMLElement {
static tagName = 'geo-wiki';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -62,3 +63,5 @@ export class GeoWiki extends HTMLElement {
this.appendChild(list);
}
}

GeoWiki.define();
3 changes: 3 additions & 0 deletions demo/src/record-player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ export class RecordPlayer extends HTMLElement {
static tagName = 'record-player';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -384,3 +385,5 @@ function diffStyles(stylesA: Map<string, string>, stylesB: Map<string, string>):

return changedProperties;
}

RecordPlayer.define();
4 changes: 2 additions & 2 deletions demo/sticky-html-arrow-between-iframes.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@
</head>
<body>
<folk-shape x="10" y="100" width="250" height="400">
<iframe id="frame1" src="./arrows.html"></iframe>
<iframe id="frame1" src="./sticky-html-arrow.html"></iframe>
</folk-shape>
<folk-shape x="300" y="100" width="250" height="400">
<iframe id="frame2" src="./arrows.html"></iframe>
<iframe id="frame2" src="./sticky-html-arrow.html"></iframe>
</folk-shape>

<folk-rope source="#frame1 >>> #box1" target="#frame2 >>> #box1"></folk-rope>
Expand Down
5 changes: 2 additions & 3 deletions src/distance-field.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export class DistanceField extends HTMLElement {
private isPingTexture: boolean = true;

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -569,6 +570,4 @@ void main() {
outColor = vec4(seedCoord, v_shapeID, 0.0); // Seed coords (x, y), shape ID (z), initial distance (a)
}`;

if (!customElements.get('distance-field')) {
DistanceField.define();
}
DistanceField.define();
4 changes: 1 addition & 3 deletions src/folk-connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,4 @@ export class FolkConnection extends AbstractArrow {
}
}

if (!customElements.get('folk-connection')) {
FolkConnection.define();
}
FolkConnection.define();
4 changes: 1 addition & 3 deletions src/folk-event-propagator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,4 @@ function parseAst(functionBody: string) {
console.log('Properties accessed on from:', Array.from(fromProps));
}

if (!customElements.get('folk-event-propagator')) {
FolkEventPropagator.define();
}
FolkEventPropagator.define();
4 changes: 1 addition & 3 deletions src/folk-hull.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,4 @@ export function makeHull(rects: DOMRectReadOnly[]): Point[] {
return upperHull.concat(lowerHull);
}

if (!customElements.get('folk-hull')) {
FolkHull.define();
}
FolkHull.define();
4 changes: 1 addition & 3 deletions src/folk-ink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,4 @@ export class FolkInk extends HTMLElement {
}
}

if (!customElements.get('folk-ink')) {
FolkInk.define();
}
FolkInk.define();
5 changes: 2 additions & 3 deletions src/folk-llm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export class FolkLLM extends HTMLElement {
static tagName = 'folk-llm';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -103,6 +104,4 @@ declare global {
}
}

if (!customElements.get('folk-llm')) {
FolkLLM.define();
}
FolkLLM.define();
5 changes: 2 additions & 3 deletions src/folk-map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export class FolkMap extends HTMLElement {
static tagName = 'folk-map';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -95,6 +96,4 @@ export class FolkMap extends HTMLElement {
};
}

if (!customElements.get('folk-map')) {
FolkMap.define();
}
FolkMap.define();
5 changes: 2 additions & 3 deletions src/folk-metronome.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class FolkMetronome extends HTMLElement {
static tagName = 'folk-metronome';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -70,6 +71,4 @@ export class FolkMetronome extends HTMLElement {
};
}

if (!customElements.get('folk-metronome')) {
FolkMetronome.define();
}
FolkMetronome.define();
6 changes: 3 additions & 3 deletions src/folk-proximity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export class FolkProximity extends HTMLElement {
static tagName = 'folk-proximity';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -193,6 +194,5 @@ export class FolkProximity extends HTMLElement {
}
}

if (!customElements.get('folk-proximity')) {
FolkProximity.define();
}
FolkCluster.define();
FolkProximity.define();
4 changes: 1 addition & 3 deletions src/folk-rope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,4 @@ function applyConstraint(p1: RopePoint, p2: RopePoint) {
}
}

if (!customElements.get('folk-rope')) {
FolkRope.define();
}
FolkRope.define();
5 changes: 2 additions & 3 deletions src/folk-set.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class FolkSet extends HTMLElement {
static tagName = 'folk-set';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -79,6 +80,4 @@ export class FolkSet extends HTMLElement {
update() {}
}

if (!customElements.get('folk-set')) {
FolkSet.define();
}
FolkSet.define();
9 changes: 4 additions & 5 deletions src/folk-shape.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ styles.replaceSync(css`
div {
height: 100%;
width: 100%;
overflow: hidden;
overflow: scroll;
pointer-events: none;
}
Expand Down Expand Up @@ -221,6 +221,7 @@ export class FolkShape extends HTMLElement {
static tagName = 'folk-shape';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -326,7 +327,6 @@ export class FolkShape extends HTMLElement {
super();

this.addEventListener('pointerdown', this);
this.setAttribute('tabindex', '0');

this.#shadow.adoptedStyleSheets = [styles, this.#dynamicStyles];
// Ideally we would creating these lazily on first focus, but the resize handlers need to be around for delegate focus to work.
Expand All @@ -348,6 +348,7 @@ export class FolkShape extends HTMLElement {

#isConnected = false;
connectedCallback() {
this.setAttribute('tabindex', '0');
this.#isConnected = true;
this.#update(new Set(['type', 'x', 'y', 'height', 'width', 'rotation']));
}
Expand Down Expand Up @@ -684,6 +685,4 @@ export class FolkShape extends HTMLElement {
}
}

if (!customElements.get('folk-shape')) {
FolkShape.define();
}
FolkShape.define();
5 changes: 2 additions & 3 deletions src/folk-space.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export class FolkSpace extends HTMLElement {
static tagName = 'folk-space';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -71,6 +72,4 @@ export class FolkSpace extends HTMLElement {
}
}

if (!customElements.get('folk-space')) {
FolkSpace.define();
}
FolkSpace.define();
7 changes: 4 additions & 3 deletions src/folk-spreadsheet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export class FolkSpreadsheet extends HTMLElement {
static tagName = 'folk-spreadsheet';

static define() {
if (customElements.get(this.tagName)) return;
FolkSpreadSheetCell.define();
FolkSpreadsheetHeader.define();
customElements.define(this.tagName, this);
Expand Down Expand Up @@ -349,6 +350,7 @@ export class FolkSpreadsheetHeader extends HTMLElement {
static tagName = 's-header';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -379,6 +381,7 @@ export class FolkSpreadSheetCell extends HTMLElement {
static tagName = 'folk-cell';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -514,6 +517,4 @@ export class FolkSpreadSheetCell extends HTMLElement {
}
}

if (!customElements.get('folk-cell')) {
FolkSpreadSheetCell.define();
}
FolkSpreadsheet.define();
5 changes: 2 additions & 3 deletions src/folk-timer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export class FolkTimer extends HTMLElement {
static tagName = 'folk-timer';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -40,6 +41,4 @@ export class FolkTimer extends HTMLElement {
};
}

if (!customElements.get('folk-timer')) {
FolkTimer.define();
}
FolkTimer.define();
9 changes: 3 additions & 6 deletions src/folk-toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export class FolkToolbar extends HTMLElement {
static tagName = 'folk-toolbar';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -113,9 +114,6 @@ export class FolkToolbar extends HTMLElement {
'text/html'
).body.firstElementChild;

if (!customElements.get('folk-event-propagator')) {
FolkEventPropagator.define();
}
if (propagator) {
document.body.appendChild(propagator);
}
Expand All @@ -129,6 +127,5 @@ export class FolkToolbar extends HTMLElement {
}
}

if (!customElements.get('folk-toolbar')) {
FolkToolbar.define();
}
FolkEventPropagator.define();
FolkToolbar.define();
5 changes: 2 additions & 3 deletions src/folk-weather.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export class FolkWeather extends HTMLElement {
static tagName = 'folk-weather';

static define() {
if (customElements.get(this.tagName)) return;
customElements.define(this.tagName, this);
}

Expand Down Expand Up @@ -69,6 +70,4 @@ export class FolkWeather extends HTMLElement {
}
}

if (!customElements.get('folk-weather')) {
FolkWeather.define();
}
FolkWeather.define();
4 changes: 1 addition & 3 deletions src/folk-xanadu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,4 @@ function computeInlineVertices(rects: DOMRect[]): Point[] {
return vertices;
}

if (!customElements.get('folk-xanadu')) {
FolkXanadu.define();
}
FolkXanadu.define();

0 comments on commit 53a87fa

Please sign in to comment.