@celljs/ta-extensions 0.0.0-stage → 4.6.1
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.md +19 -2
- package/host/index.mjs +271 -0
- package/package.json +44 -4
- package/skills/ta-package/SKILL.md +90 -0
- package/web/index.js +941 -0
- package/web-src/actions.ts +184 -0
- package/web-src/archive.spec.ts +101 -0
- package/web-src/archive.ts +229 -0
- package/web-src/extensions-util.spec.ts +38 -0
- package/web-src/extensions-util.ts +40 -0
- package/web-src/host.spec.ts +72 -0
- package/web-src/host.ts +101 -0
- package/web-src/i18n.ts +157 -0
- package/web-src/import-dialog.tsx +89 -0
- package/web-src/index.tsx +46 -0
- package/web-src/page.tsx +246 -0
- package/web-src/pictures.tsx +87 -0
- package/web-src/react.ts +11 -0
- package/web-src/style.ts +90 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// biome-ignore lint/style/useImportType: the JSX below compiles to React.createElement (jsxFactory)
|
|
2
|
+
import { React } from './react';
|
|
3
|
+
|
|
4
|
+
/** What an extension can be: each kind has its picture and an example to make. */
|
|
5
|
+
export type KindName = 'card' | 'page' | 'command' | 'skill';
|
|
6
|
+
|
|
7
|
+
const Frame = () => <rect className="tax-pic-frame" x="1" y="1" width="158" height="94" rx="9" />;
|
|
8
|
+
const Line = ({ x, y, w }: { x: number; y: number; w: number }) => <rect className="tax-pic-line" x={x} y={y} width={w} height="5" rx="2.5" />;
|
|
9
|
+
|
|
10
|
+
/** A card beside the conversation. */
|
|
11
|
+
function Card() {
|
|
12
|
+
return (
|
|
13
|
+
<>
|
|
14
|
+
<Frame />
|
|
15
|
+
<Line x={12} y={16} w={58} />
|
|
16
|
+
<Line x={12} y={27} w={74} />
|
|
17
|
+
<Line x={12} y={38} w={46} />
|
|
18
|
+
<rect className="tax-pic-pane" x="100" y="1" width="59" height="94" />
|
|
19
|
+
<rect className="tax-pic-accent" x="108" y="14" width="43" height="38" rx="6" />
|
|
20
|
+
<circle className="tax-pic-mark" cx="129.5" cy="33" r="10" />
|
|
21
|
+
<path className="tax-pic-hand" d="M129.5 27v6l4 3" />
|
|
22
|
+
<Line x={108} y={62} w={34} />
|
|
23
|
+
<rect className="tax-pic-box" x="12" y="72" width="78" height="13" rx="6.5" />
|
|
24
|
+
</>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** A page of its own. */
|
|
29
|
+
function Page() {
|
|
30
|
+
return (
|
|
31
|
+
<>
|
|
32
|
+
<Frame />
|
|
33
|
+
<rect className="tax-pic-pane" x="1" y="1" width="20" height="94" />
|
|
34
|
+
<circle className="tax-pic-line" cx="11" cy="16" r="3.5" />
|
|
35
|
+
<circle className="tax-pic-mark" cx="11" cy="30" r="3.5" />
|
|
36
|
+
<circle className="tax-pic-line" cx="11" cy="44" r="3.5" />
|
|
37
|
+
<rect className="tax-pic-accent" x="31" y="13" width="118" height="70" rx="6" />
|
|
38
|
+
{[18, 30, 24, 42, 34, 50].map((height, i) => (
|
|
39
|
+
<rect key={height} className="tax-pic-mark" x={42 + i * 17} y={73 - height} width="9" height={height} rx="2" />
|
|
40
|
+
))}
|
|
41
|
+
</>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** A command for Ta. */
|
|
46
|
+
function Command() {
|
|
47
|
+
return (
|
|
48
|
+
<>
|
|
49
|
+
<Frame />
|
|
50
|
+
<rect className="tax-pic-line" x="70" y="12" width="76" height="14" rx="7" />
|
|
51
|
+
<Line x={12} y={36} w={84} />
|
|
52
|
+
<Line x={12} y={47} w={60} />
|
|
53
|
+
<rect className="tax-pic-box" x="10" y="64" width="140" height="21" rx="10.5" />
|
|
54
|
+
<rect className="tax-pic-accent" x="16" y="68.5" width="50" height="12" rx="6" />
|
|
55
|
+
<text className="tax-pic-text" x="22" y="78">
|
|
56
|
+
/standup
|
|
57
|
+
</text>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** A skill: Ta does something new when asked in words. */
|
|
63
|
+
function Skill() {
|
|
64
|
+
return (
|
|
65
|
+
<>
|
|
66
|
+
<Frame />
|
|
67
|
+
<rect className="tax-pic-line" x="74" y="12" width="72" height="14" rx="7" />
|
|
68
|
+
<rect className="tax-pic-accent" x="12" y="34" width="96" height="30" rx="8" />
|
|
69
|
+
<rect className="tax-pic-mark tax-pic-soft" x="20" y="42" width="58" height="5" rx="2.5" />
|
|
70
|
+
<rect className="tax-pic-mark tax-pic-soft" x="20" y="51" width="40" height="5" rx="2.5" />
|
|
71
|
+
<path className="tax-pic-mark" d="M126 34l3.2 8.3 8.3 3.2-8.3 3.2-3.2 8.3-3.2-8.3-8.3-3.2 8.3-3.2z" />
|
|
72
|
+
<path className="tax-pic-mark tax-pic-soft" d="M141 60l1.6 4 4 1.6-4 1.6-1.6 4-1.6-4-4-1.6 4-1.6z" />
|
|
73
|
+
<rect className="tax-pic-box" x="12" y="74" width="136" height="12" rx="6" />
|
|
74
|
+
</>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const PICTURES: Record<KindName, () => React.ReactElement> = { card: Card, page: Page, command: Command, skill: Skill };
|
|
79
|
+
|
|
80
|
+
export function KindPicture({ kind }: { kind: KindName }): React.ReactElement {
|
|
81
|
+
const Picture = PICTURES[kind];
|
|
82
|
+
return (
|
|
83
|
+
<svg className="tax-pic" viewBox="0 0 160 96" aria-hidden="true">
|
|
84
|
+
<Picture />
|
|
85
|
+
</svg>
|
|
86
|
+
);
|
|
87
|
+
}
|
package/web-src/react.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as ReactModule from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The React of the page, which a web extension cannot import: `activate` binds it before anything
|
|
5
|
+
* renders. The JSX of this package compiles to `React.createElement` (tsconfig.json).
|
|
6
|
+
*/
|
|
7
|
+
export let React: typeof ReactModule;
|
|
8
|
+
|
|
9
|
+
export function bind(react: typeof ReactModule): void {
|
|
10
|
+
React = react;
|
|
11
|
+
}
|
package/web-src/style.ts
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** The styles of the page; only the --ta-* variables of the page, so they follow its theme. */
|
|
2
|
+
export const STYLE = `
|
|
3
|
+
.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: 44px 24px 56px; box-sizing: border-box; }
|
|
5
|
+
.tax-hero { display: flex; flex-direction: column; gap: 10px; }
|
|
6
|
+
.tax-hero h1 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; }
|
|
7
|
+
.tax-hero h1 svg { color: var(--tax-accent); }
|
|
8
|
+
.tax-hero > p { margin: 0 0 6px; color: var(--ta-muted); }
|
|
9
|
+
.tax-kinds { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 6px; }
|
|
10
|
+
@media (max-width: 640px) { .tax-kinds { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
11
|
+
.tax-kind { display: flex; flex-direction: column; gap: 8px; padding: 8px 8px 10px; border: 1px solid var(--ta-border-muted); border-radius: 12px; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; transition: border-color 140ms, background 140ms, transform 140ms var(--ta-ease); }
|
|
12
|
+
.tax-kind:hover { border-color: color-mix(in srgb, var(--tax-accent) 55%, var(--ta-border)); background: var(--ta-hover); }
|
|
13
|
+
.tax-kind:hover .tax-pic-accent { fill: color-mix(in srgb, var(--tax-accent) 26%, transparent); }
|
|
14
|
+
.tax-kind:active { transform: scale(.98); }
|
|
15
|
+
.tax-kind:disabled { opacity: .55; cursor: default; }
|
|
16
|
+
.tax-kind-label { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 0 4px; min-width: 0; }
|
|
17
|
+
.tax-kind-label strong { font-size: 13px; font-weight: 600; }
|
|
18
|
+
.tax-kind-label span { overflow: hidden; color: var(--ta-muted); font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
|
|
19
|
+
.tax-pic { display: block; width: 100%; height: auto; border-radius: 8px; }
|
|
20
|
+
.tax-pic-frame { fill: var(--ta-raised); stroke: var(--ta-border-muted); stroke-width: 1; }
|
|
21
|
+
.tax-pic-pane { fill: var(--ta-hover); }
|
|
22
|
+
.tax-pic-line { fill: var(--ta-hover-strong); }
|
|
23
|
+
.tax-pic-box { fill: none; stroke: var(--ta-border); stroke-width: 1; }
|
|
24
|
+
.tax-pic-accent { fill: color-mix(in srgb, var(--tax-accent) 16%, transparent); stroke: color-mix(in srgb, var(--tax-accent) 70%, transparent); stroke-width: 1; transition: fill 140ms; }
|
|
25
|
+
.tax-pic-mark { fill: var(--tax-accent); }
|
|
26
|
+
.tax-pic-soft { opacity: .45; }
|
|
27
|
+
.tax-pic-hand { fill: none; stroke: var(--ta-raised); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
|
|
28
|
+
.tax-pic-text { fill: var(--tax-accent); font-family: var(--ta-mono); font-size: 8px; font-weight: 600; }
|
|
29
|
+
.tax-section { display: flex; flex-direction: column; gap: 8px; }
|
|
30
|
+
.tax-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 30px; }
|
|
31
|
+
.tax-section-head h2 { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--ta-secondary); font-size: 12.5px; font-weight: 600; }
|
|
32
|
+
.tax-count { padding: 0 6px; border-radius: 8px; background: var(--ta-chip); color: var(--ta-muted); font-size: 11px; font-weight: 500; line-height: 16px; }
|
|
33
|
+
.tax-button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--ta-border-muted); border-radius: 8px; background: var(--ta-raised); color: var(--ta-text); font: inherit; font-size: 13px; cursor: pointer; transition: background 120ms, border-color 120ms; }
|
|
34
|
+
.tax-button:hover { background: var(--ta-hover); border-color: var(--ta-border); }
|
|
35
|
+
.tax-button:disabled { opacity: .55; cursor: default; }
|
|
36
|
+
.tax-list { border: 1px solid var(--ta-border-muted); border-radius: 12px; overflow: hidden; }
|
|
37
|
+
.tax-row { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; }
|
|
38
|
+
.tax-row + .tax-row { border-top: 1px solid var(--ta-border-muted); }
|
|
39
|
+
.tax-row:hover { background: var(--ta-hover); }
|
|
40
|
+
.tax-row:hover .tax-icon, .tax-row:hover .tax-tag { background: var(--ta-hover-strong); }
|
|
41
|
+
.tax-icon { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; flex: none; border-radius: 9px; background: var(--ta-chip); color: var(--tax-accent); transition: color 160ms; }
|
|
42
|
+
.tax-main { display: flex; flex-direction: column; gap: 3px; flex: 1; min-width: 0; transition: opacity 160ms; }
|
|
43
|
+
.tax-name { display: flex; align-items: center; gap: 6px; min-width: 0; font-weight: 600; }
|
|
44
|
+
.tax-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
45
|
+
.tax-version { flex: none; color: var(--ta-muted); font-size: 12px; font-weight: 400; }
|
|
46
|
+
.tax-description { overflow: hidden; color: var(--ta-secondary); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
|
|
47
|
+
.tax-tag { flex: none; padding: 0 6px; border-radius: 5px; background: var(--ta-chip); color: var(--ta-muted); font-size: 11px; font-weight: 400; line-height: 17px; }
|
|
48
|
+
.tax-off .tax-main { opacity: .5; }
|
|
49
|
+
.tax-off .tax-icon { color: var(--ta-muted); }
|
|
50
|
+
.tax-actions { display: flex; gap: 2px; flex: none; opacity: 0; transition: opacity 120ms; }
|
|
51
|
+
.tax-row:hover .tax-actions, .tax-row:focus-within .tax-actions { opacity: 1; }
|
|
52
|
+
@media (hover: none) { .tax-actions { opacity: 1; } }
|
|
53
|
+
.tax-action { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 7px; background: none; color: var(--ta-muted); cursor: pointer; }
|
|
54
|
+
.tax-action:hover { background: var(--ta-hover-strong); color: var(--ta-text); }
|
|
55
|
+
.tax-action.tax-danger:hover { color: var(--ta-red); }
|
|
56
|
+
.tax-switch { appearance: none; -webkit-appearance: none; position: relative; width: 36px; height: 20px; flex: none; margin: 0 0 0 4px; border-radius: 10px; background: var(--ta-hover-strong); cursor: pointer; transition: background 160ms; }
|
|
57
|
+
.tax-switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .3); transition: transform 180ms var(--ta-ease); }
|
|
58
|
+
.tax-switch:checked { background: var(--ta-green); }
|
|
59
|
+
.tax-switch:checked::after { transform: translateX(16px); }
|
|
60
|
+
.tax-switch:focus-visible { outline: 2px solid var(--ta-border-focus); outline-offset: 2px; }
|
|
61
|
+
.tax-empty { padding: 16px; border: 1px dashed var(--ta-border-muted); border-radius: 12px; color: var(--ta-muted); text-align: center; }
|
|
62
|
+
.tax-share { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 20px 16px 16px; border: 1px solid var(--ta-border-muted); border-radius: 12px; }
|
|
63
|
+
.tax-steps { display: flex; align-items: flex-start; justify-content: center; gap: 10px; width: 100%; }
|
|
64
|
+
.tax-step { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 120px; color: var(--ta-secondary); font-size: 12.5px; text-align: center; }
|
|
65
|
+
.tax-step-icon { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: 12px; background: color-mix(in srgb, var(--tax-accent) 12%, transparent); color: var(--tax-accent); }
|
|
66
|
+
.tax-step-arrow { display: inline-flex; align-items: center; height: 44px; color: var(--ta-muted); }
|
|
67
|
+
.tax-note { color: var(--ta-muted); font-size: 12.5px; }
|
|
68
|
+
.tax-note code { padding: 1px 5px; border-radius: 4px; background: var(--ta-code); font-family: var(--ta-mono); font-size: 12px; }
|
|
69
|
+
.tax-drop-overlay { position: absolute; inset: 12px; z-index: 5; display: flex; align-items: center; justify-content: center; border: 2px dashed var(--ta-border-focus); border-radius: 16px; background: color-mix(in srgb, var(--ta-main) 85%, transparent); color: var(--ta-text); font-size: 15px; font-weight: 600; pointer-events: none; }
|
|
70
|
+
.tax-dialog { display: flex; flex-direction: column; gap: 14px; min-width: min(440px, 80vw); }
|
|
71
|
+
.tax-drop { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 26px 16px; border: 1.5px dashed var(--ta-border); border-radius: 12px; color: var(--ta-secondary); text-align: center; transition: border-color 120ms, background 120ms; }
|
|
72
|
+
.tax-drop.tax-over { border-color: var(--ta-border-focus); background: var(--ta-hover); }
|
|
73
|
+
.tax-drop svg { color: var(--ta-muted); }
|
|
74
|
+
.tax-link { padding: 0; border: 0; background: none; color: var(--ta-link); font: inherit; cursor: pointer; }
|
|
75
|
+
.tax-link:hover { text-decoration: underline; }
|
|
76
|
+
.tax-or { display: flex; align-items: center; gap: 10px; color: var(--ta-muted); font-size: 12px; }
|
|
77
|
+
.tax-or::before, .tax-or::after { content: ''; flex: 1; height: 1px; background: var(--ta-border-muted); }
|
|
78
|
+
.tax-source { display: flex; gap: 8px; }
|
|
79
|
+
.tax-source input { flex: 1; min-width: 0; height: 34px; padding: 0 11px; border: 1px solid var(--ta-border-field); border-radius: 8px; background: var(--ta-input); color: var(--ta-text); font: inherit; font-size: 13px; outline: none; box-sizing: border-box; }
|
|
80
|
+
.tax-source input:focus { border-color: var(--ta-border-focus); }
|
|
81
|
+
.tax-source .tax-button { height: 34px; }
|
|
82
|
+
`;
|
|
83
|
+
|
|
84
|
+
export function injectStyle(): () => void {
|
|
85
|
+
const style = document.createElement('style');
|
|
86
|
+
style.dataset.taPackage = 'ta-extensions';
|
|
87
|
+
style.textContent = STYLE;
|
|
88
|
+
document.head.appendChild(style);
|
|
89
|
+
return () => style.remove();
|
|
90
|
+
}
|