@celljs/ta-extensions 4.6.1 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.en.md +27 -0
- package/README.md +10 -3
- package/host/index.mjs +331 -1
- package/package.json +3 -3
- package/skills/ta-package/SKILL.md +3 -2
- package/web/index.js +937 -54
- package/web-src/actions.ts +20 -0
- package/web-src/context.ts +24 -0
- package/web-src/host.ts +16 -2
- package/web-src/i18n.ts +85 -2
- package/web-src/index.tsx +26 -22
- package/web-src/market-detail.tsx +138 -0
- package/web-src/market-parts.tsx +94 -0
- package/web-src/market-store.ts +116 -0
- package/web-src/market-style.ts +94 -0
- package/web-src/market-util.spec.ts +79 -0
- package/web-src/market-util.ts +239 -0
- package/web-src/market-view.tsx +245 -0
- package/web-src/market.spec.ts +154 -0
- package/web-src/market.ts +232 -0
- package/web-src/page.tsx +124 -92
- package/web-src/signal.ts +34 -0
- package/web-src/style.ts +4 -2
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { React } from './react';
|
|
2
|
+
|
|
3
|
+
/** A value the page and the menu of the view share: who sets it, and who renders it. */
|
|
4
|
+
export class Signal<T> {
|
|
5
|
+
protected readonly listeners = new Set<() => void>();
|
|
6
|
+
|
|
7
|
+
constructor(protected value: T) {}
|
|
8
|
+
|
|
9
|
+
get(): T {
|
|
10
|
+
return this.value;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
set(value: T): void {
|
|
14
|
+
if (!Object.is(value, this.value)) {
|
|
15
|
+
this.value = value;
|
|
16
|
+
for (const listener of this.listeners) {
|
|
17
|
+
listener();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
subscribe(listener: () => void): () => void {
|
|
23
|
+
this.listeners.add(listener);
|
|
24
|
+
return () => this.listeners.delete(listener);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** A React hook: the value, rendered again when it changes. */
|
|
28
|
+
use(): T {
|
|
29
|
+
return React.useSyncExternalStore(
|
|
30
|
+
listener => this.subscribe(listener),
|
|
31
|
+
() => this.value,
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
}
|
package/web-src/style.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import { MARKET_STYLE } from './market-style';
|
|
2
|
+
|
|
1
3
|
/** The styles of the page; only the --ta-* variables of the page, so they follow its theme. */
|
|
2
4
|
export const STYLE = `
|
|
3
5
|
.tax-page { --tax-accent: var(--ta-green); position: relative; height: 100%; overflow: auto; color: var(--ta-text); font-size: 13.5px; }
|
|
4
|
-
.tax-body { display: flex; flex-direction: column; gap: 32px; max-width: 760px; margin: 0 auto; padding:
|
|
6
|
+
.tax-body { display: flex; flex-direction: column; gap: 32px; max-width: 760px; margin: 0 auto; padding: 28px 24px 56px; box-sizing: border-box; }
|
|
5
7
|
.tax-hero { display: flex; flex-direction: column; gap: 10px; }
|
|
6
8
|
.tax-hero h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
|
|
7
9
|
.tax-hero h1 svg { color: var(--tax-accent); }
|
|
@@ -84,7 +86,7 @@ export const STYLE = `
|
|
|
84
86
|
export function injectStyle(): () => void {
|
|
85
87
|
const style = document.createElement('style');
|
|
86
88
|
style.dataset.taPackage = 'ta-extensions';
|
|
87
|
-
style.textContent = STYLE;
|
|
89
|
+
style.textContent = STYLE + MARKET_STYLE;
|
|
88
90
|
document.head.appendChild(style);
|
|
89
91
|
return () => style.remove();
|
|
90
92
|
}
|