fix CE defines 2

This commit is contained in:
“chrisshank” 2024-12-03 14:34:48 -08:00
parent 9d1d202dee
commit 53a87fa344
22 changed files with 45 additions and 61 deletions

View File

@ -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);
}

View File

@ -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);
}
@ -62,3 +63,5 @@ export class GeoWiki extends HTMLElement {
this.appendChild(list);
}
}
GeoWiki.define();

View File

@ -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);
}
@ -384,3 +385,5 @@ function diffStyles(stylesA: Map<string, string>, stylesB: Map<string, string>):
return changedProperties;
}
RecordPlayer.define();

View File

@ -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>

View File

@ -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);
}
@ -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();

View File

@ -86,6 +86,4 @@ export class FolkConnection extends AbstractArrow {
}
}
if (!customElements.get('folk-connection')) {
FolkConnection.define();
}
FolkConnection.define();

View File

@ -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();

View File

@ -111,6 +111,4 @@ export function makeHull(rects: DOMRectReadOnly[]): Point[] {
return upperHull.concat(lowerHull);
}
if (!customElements.get('folk-hull')) {
FolkHull.define();
}
FolkHull.define();

View File

@ -212,6 +212,4 @@ export class FolkInk extends HTMLElement {
}
}
if (!customElements.get('folk-ink')) {
FolkInk.define();
}
FolkInk.define();

View File

@ -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);
}
@ -103,6 +104,4 @@ declare global {
}
}
if (!customElements.get('folk-llm')) {
FolkLLM.define();
}
FolkLLM.define();

View File

@ -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);
}
@ -95,6 +96,4 @@ export class FolkMap extends HTMLElement {
};
}
if (!customElements.get('folk-map')) {
FolkMap.define();
}
FolkMap.define();

View File

@ -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);
}
@ -70,6 +71,4 @@ export class FolkMetronome extends HTMLElement {
};
}
if (!customElements.get('folk-metronome')) {
FolkMetronome.define();
}
FolkMetronome.define();

View File

@ -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);
}
@ -193,6 +194,5 @@ export class FolkProximity extends HTMLElement {
}
}
if (!customElements.get('folk-proximity')) {
FolkProximity.define();
}
FolkCluster.define();
FolkProximity.define();

View File

@ -258,6 +258,4 @@ function applyConstraint(p1: RopePoint, p2: RopePoint) {
}
}
if (!customElements.get('folk-rope')) {
FolkRope.define();
}
FolkRope.define();

View File

@ -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);
}
@ -79,6 +80,4 @@ export class FolkSet extends HTMLElement {
update() {}
}
if (!customElements.get('folk-set')) {
FolkSet.define();
}
FolkSet.define();

View File

@ -91,7 +91,7 @@ styles.replaceSync(css`
div {
height: 100%;
width: 100%;
overflow: hidden;
overflow: scroll;
pointer-events: none;
}
@ -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);
}
@ -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.
@ -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']));
}
@ -684,6 +685,4 @@ export class FolkShape extends HTMLElement {
}
}
if (!customElements.get('folk-shape')) {
FolkShape.define();
}
FolkShape.define();

View File

@ -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);
}
@ -71,6 +72,4 @@ export class FolkSpace extends HTMLElement {
}
}
if (!customElements.get('folk-space')) {
FolkSpace.define();
}
FolkSpace.define();

View File

@ -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);
@ -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);
}
@ -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);
}
@ -514,6 +517,4 @@ export class FolkSpreadSheetCell extends HTMLElement {
}
}
if (!customElements.get('folk-cell')) {
FolkSpreadSheetCell.define();
}
FolkSpreadsheet.define();

View File

@ -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);
}
@ -40,6 +41,4 @@ export class FolkTimer extends HTMLElement {
};
}
if (!customElements.get('folk-timer')) {
FolkTimer.define();
}
FolkTimer.define();

View File

@ -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);
}
@ -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);
}
@ -129,6 +127,5 @@ export class FolkToolbar extends HTMLElement {
}
}
if (!customElements.get('folk-toolbar')) {
FolkToolbar.define();
}
FolkEventPropagator.define();
FolkToolbar.define();

View File

@ -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);
}
@ -69,6 +70,4 @@ export class FolkWeather extends HTMLElement {
}
}
if (!customElements.get('folk-weather')) {
FolkWeather.define();
}
FolkWeather.define();

View File

@ -101,6 +101,4 @@ function computeInlineVertices(rects: DOMRect[]): Point[] {
return vertices;
}
if (!customElements.get('folk-xanadu')) {
FolkXanadu.define();
}
FolkXanadu.define();