This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'dart:js_interop'; | |
import 'package:web/web.dart'; | |
void onMessage(Event event) { | |
if (event is MessageEvent) { | |
print('Worker received message: ${event.data}'); | |
} | |
} | |
void postMessage( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { computed, signal } from "@preact/signals-core"; | |
import { html } from "@lit-labs/preact-signals"; | |
import { LitTemplateMixin } from "./mixins.js"; | |
import { mix } from "./mixwith.js"; | |
import { styleMap } from "lit/directives/style-map.js"; | |
class Example extends mix(HTMLElement).with(LitTemplateMixin) { | |
tags = signal<string[]>([ | |
"Docker", | |
"Kubernetes", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { computed } from "@preact/signals-core"; | |
import { css } from "lit"; | |
import { html } from "@lit-labs/preact-signals"; | |
import { WithShadowRoot } from "./element-utils.js"; | |
class Counter extends WithShadowRoot(HTMLElement) { | |
count = this.attr("count", "0"); | |
countInt = computed(() => parseInt(this.count.value)); | |
private increment() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
ReadonlySignal, | |
Signal, | |
computed, | |
effect, | |
signal, | |
} from "@preact/signals-core"; | |
import { CSSResult, render, TemplateResult, unsafeCSS, html } from "lit"; | |
export type Style = string | CSSResult | CSSStyleSheet; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ReadonlySignal, computed, effect, signal } from "@preact/signals-core"; | |
export class AsyncState<T> { | |
constructor() {} | |
get value(): T | null { | |
return null; | |
} | |
get requireValue(): T { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { computed } from "@preact/signals-core"; | |
import { css } from "lit"; | |
import { html } from "@lit-labs/preact-signals"; | |
import { WithShadowRoot, WithLitTemplate } from "./utils.js"; | |
class Counter extends WithShadowRoot(HTMLElement) { | |
count = this.attr("count", "0"); | |
countInt = computed(() => parseInt(this.count.value)); | |
private increment() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { computed, signal } from "@preact/signals-core"; | |
import { type SignalsTemplate, render } from "./signals-template"; | |
import { SignalsWebComponent } from "./signals-web-component"; | |
const tagName = "x-counter"; | |
class Counter extends SignalsWebComponent { | |
counter = signal(0); | |
counterStr = computed(() => this.counter.value.toString()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ignore_for_file: non_constant_identifier_names | |
import 'package:flutter/material.dart'; | |
import 'package:signals/signals_flutter.dart'; | |
void main() { | |
runApp(MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Counter(( | |
counter: signal(0), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ignore_for_file: non_constant_identifier_names | |
import 'package:flutter/material.dart'; | |
import 'package:signals/signals_flutter.dart'; | |
void main() { | |
runApp(MaterialApp( | |
debugShowCheckedModeBanner: false, | |
home: Counter(), | |
)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
import 'package:signals/signals_flutter.dart'; | |
import 'package:google_fonts/google_fonts.dart'; | |
import 'package:mix/mix.dart'; | |
const _colors = ColorTokens(); | |
const _fonts = TextStyleTokens(); | |
final seedColor = signal(const Color(0xFF7326E0)); |
NewerOlder