This file contains hidden or 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
| // @ts-check | |
| import { WebComponent } from "./utils.js"; | |
| const tagName = "my-element"; | |
| const template = /*html*/ ` | |
| <span> | |
| Hello, <span id="name">World</span>! | |
| </span> |
This file contains hidden or 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:jaspr/jaspr.dart'; | |
| import 'package:signals/signals_core.dart'; | |
| import 'watch.dart'; | |
| import 'embedded_counter.dart'; | |
| class Counter extends StatefulComponent { | |
| const Counter({super.key}); | |
| @override |
This file contains hidden or 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 'dart:js_interop_unsafe'; | |
| import 'package:web/web.dart'; | |
| class WebComponent<T extends HTMLElement> { | |
| late T element; | |
| String get extendsType => 'HTMLElement'; | |
| void connectedCallback() {} |
This file contains hidden or 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:mustache_template/mustache_template.dart'; | |
| import 'package:signals/signals_core.dart'; | |
| import 'package:sqlite3/sqlite3.dart'; | |
| class UndoRedoManager { | |
| final Database _db; | |
| UndoRedoManager(this._db); | |
| bool _active = false; | |
| List<List<int>> _undoStack = []; |
This file contains hidden or 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'; | |
| final debugShowCheckedModeBanner = signal(false); | |
| final app = computed<Widget>(() { | |
| return MaterialApp( | |
| debugShowCheckedModeBanner: debugShowCheckedModeBanner(), | |
| home: home(), | |
| ); |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 { |