@telepath-computer/television 1.5.10 → 1.6.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/dist/THIRD-PARTY-NOTICES.txt +701 -0
- package/dist/cli.cjs +9035 -596
- package/dist/onboarding/tv-guide/welcome.html +14 -4
- package/dist/skills/television/SKILL.md +39 -33
- package/dist/skills/television/resources.md +4 -4
- package/dist/skills/television/templates.md +77 -0
- package/dist/skills/television/theming.md +31 -17
- package/dist/templates/calendar/README.md +17 -0
- package/dist/{skills/tv-tasks → templates/calendar}/THIRD-PARTY-NOTICES.txt +22 -22
- package/dist/templates/calendar/calendar-attendees.js +131 -0
- package/dist/templates/calendar/calendar-event.js +22 -0
- package/dist/templates/calendar/calendar-motion.js +273 -0
- package/dist/templates/calendar/calendar-page.js +403 -0
- package/dist/templates/calendar/calendar-time-axis.js +32 -0
- package/dist/templates/calendar/calendar-week.js +711 -0
- package/dist/templates/calendar/data.json +3 -0
- package/dist/templates/calendar/icon.svg +1 -0
- package/dist/templates/calendar/index.html +27 -0
- package/dist/templates/calendar/manifest.json +148 -0
- package/dist/templates/calendar/styles.css +771 -0
- package/dist/templates/checklist/README.md +45 -0
- package/dist/templates/checklist/THIRD-PARTY-NOTICES.txt +29 -0
- package/dist/templates/checklist/data.json +1 -0
- package/dist/templates/checklist/icon.svg +8 -0
- package/dist/templates/checklist/icons.css +61 -0
- package/dist/templates/checklist/index.html +47 -0
- package/dist/templates/checklist/manifest.json +49 -0
- package/dist/templates/checklist/model.d.ts +30 -0
- package/dist/templates/checklist/model.js +60 -0
- package/dist/templates/checklist/page.js +425 -0
- package/dist/templates/checklist/styles.css +206 -0
- package/dist/templates/document/README.md +55 -0
- package/dist/templates/document/THIRD-PARTY-NOTICES.txt +1080 -0
- package/dist/templates/document/data.json +3 -0
- package/dist/templates/document/editor.css +1 -0
- package/dist/templates/document/editor.js +37 -0
- package/dist/templates/document/icon.svg +6 -0
- package/dist/templates/document/index.html +29 -0
- package/dist/templates/document/manifest.json +22 -0
- package/dist/templates/document/page.js +190 -0
- package/dist/templates/document/styles.css +76 -0
- package/dist/templates/map/README.md +85 -0
- package/dist/templates/map/THIRD-PARTY-NOTICES.txt +84 -0
- package/dist/templates/map/data.json +1 -0
- package/dist/templates/map/icon.svg +8 -0
- package/dist/templates/map/icons.svg +43 -0
- package/dist/templates/map/index.html +95 -0
- package/dist/templates/map/manifest.json +227 -0
- package/dist/templates/map/map-model.js +18 -0
- package/dist/templates/map/map.css +202 -0
- package/dist/templates/map/map.js +728 -0
- package/dist/templates/map/vendor/LICENSE +26 -0
- package/dist/templates/map/vendor/README.md +11 -0
- package/dist/templates/map/vendor/leaflet.css +661 -0
- package/dist/templates/map/vendor/leaflet.js +6 -0
- package/dist/templates/map/vendor/lucide/LICENSE +43 -0
- package/dist/templates/map/vendor/lucide/README.md +46 -0
- package/dist/templates/map/vendor/lucide/icons.js +832 -0
- package/dist/templates/map/vendor/lucide/svg/airport.svg +15 -0
- package/dist/templates/map/vendor/lucide/svg/bar.svg +17 -0
- package/dist/templates/map/vendor/lucide/svg/beach.svg +17 -0
- package/dist/templates/map/vendor/lucide/svg/bridge.svg +20 -0
- package/dist/templates/map/vendor/lucide/svg/bus.svg +21 -0
- package/dist/templates/map/vendor/lucide/svg/church.svg +19 -0
- package/dist/templates/map/vendor/lucide/svg/coffee.svg +18 -0
- package/dist/templates/map/vendor/lucide/svg/ferry.svg +19 -0
- package/dist/templates/map/vendor/lucide/svg/flag.svg +15 -0
- package/dist/templates/map/vendor/lucide/svg/heart.svg +15 -0
- package/dist/templates/map/vendor/lucide/svg/home.svg +16 -0
- package/dist/templates/map/vendor/lucide/svg/hospital.svg +19 -0
- package/dist/templates/map/vendor/lucide/svg/hotel.svg +24 -0
- package/dist/templates/map/vendor/lucide/svg/info.svg +17 -0
- package/dist/templates/map/vendor/lucide/svg/landmark.svg +20 -0
- package/dist/templates/map/vendor/lucide/svg/mountain.svg +15 -0
- package/dist/templates/map/vendor/lucide/svg/museum.svg +20 -0
- package/dist/templates/map/vendor/lucide/svg/music.svg +17 -0
- package/dist/templates/map/vendor/lucide/svg/park.svg +18 -0
- package/dist/templates/map/vendor/lucide/svg/parking.svg +16 -0
- package/dist/templates/map/vendor/lucide/svg/pin.svg +16 -0
- package/dist/templates/map/vendor/lucide/svg/restaurant.svg +17 -0
- package/dist/templates/map/vendor/lucide/svg/school.svg +20 -0
- package/dist/templates/map/vendor/lucide/svg/shop.svg +17 -0
- package/dist/templates/map/vendor/lucide/svg/sports.svg +19 -0
- package/dist/templates/map/vendor/lucide/svg/star.svg +15 -0
- package/dist/templates/map/vendor/lucide/svg/theatre.svg +23 -0
- package/dist/templates/map/vendor/lucide/svg/train.svg +20 -0
- package/dist/templates/map/vendor/lucide/svg/viewpoint.svg +20 -0
- package/dist/templates/map/vendor/lucide/svg/work.svg +18 -0
- package/dist/templates/sticky-note/Caveat-Medium.woff2 +0 -0
- package/dist/templates/sticky-note/README.md +47 -0
- package/dist/templates/sticky-note/THIRD-PARTY-NOTICES.txt +127 -0
- package/dist/templates/sticky-note/data.json +1 -0
- package/dist/templates/sticky-note/icon.svg +16 -0
- package/dist/templates/sticky-note/icons.css +61 -0
- package/dist/templates/sticky-note/index.html +31 -0
- package/dist/templates/sticky-note/manifest.json +27 -0
- package/dist/templates/sticky-note/model.d.ts +33 -0
- package/dist/templates/sticky-note/model.js +152 -0
- package/dist/templates/sticky-note/page.js +84 -0
- package/dist/templates/sticky-note/styles.css +140 -0
- package/dist/templates/table/README.md +107 -0
- package/dist/templates/table/data.json +4 -0
- package/dist/templates/table/icon.svg +6 -0
- package/dist/templates/table/index.html +15 -0
- package/dist/templates/table/manifest.json +70 -0
- package/dist/templates/table/model.d.ts +164 -0
- package/dist/templates/table/model.js +395 -0
- package/dist/templates/table/page.js +1045 -0
- package/dist/templates/table/selection-model.d.ts +67 -0
- package/dist/templates/table/selection-model.js +163 -0
- package/dist/templates/table/styles.css +522 -0
- package/dist/views/markdown/THIRD-PARTY-NOTICES.txt +408 -0
- package/dist/views/markdown/index.html +21 -21
- package/dist/web/assets/main-CRSNodQt.js +864 -0
- package/dist/web/assets/main-DnvQkpg4.css +1 -0
- package/dist/web/index.html +2 -2
- package/package.json +1 -1
- package/dist/skills/tv-calendar/SKILL.md +0 -100
- package/dist/skills/tv-calendar/calendar.css +0 -1
- package/dist/skills/tv-calendar/calendar.js +0 -400
- package/dist/skills/tv-table/SKILL.md +0 -95
- package/dist/skills/tv-tasks/SKILL.md +0 -269
- package/dist/skills/tv-tasks/task.css +0 -180
- package/dist/skills/tv-tasks/task.js +0 -304
- package/dist/web/assets/calendar-DToAnkzj.png +0 -0
- package/dist/web/assets/main-CekDfJPz.js +0 -848
- package/dist/web/assets/main-CunC2_Nx.css +0 -1
- package/dist/web/assets/markdown-DdDrJuVK.png +0 -0
- package/dist/web/assets/table-oeG9uAN1.png +0 -0
- package/dist/web/assets/tasks-D4xqXFPl.png +0 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { DisplayAxisItem } from "./model.js";
|
|
2
|
+
|
|
3
|
+
/** The displayed row and column positions used by selection transitions. */
|
|
4
|
+
export interface TableDisplayAxes {
|
|
5
|
+
rows: DisplayAxisItem[];
|
|
6
|
+
columns: DisplayAxisItem[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** One selected cell. */
|
|
10
|
+
export interface TableCellSelection {
|
|
11
|
+
kind: "cell";
|
|
12
|
+
rowId: string;
|
|
13
|
+
columnId: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** One contiguous whole-row or whole-column selection. */
|
|
17
|
+
export interface TableAxisSelection {
|
|
18
|
+
kind: "rows" | "columns";
|
|
19
|
+
ids: string[];
|
|
20
|
+
anchorId: string;
|
|
21
|
+
activeId: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** Any current Table selection. */
|
|
25
|
+
export type TableSelection = TableCellSelection | TableAxisSelection;
|
|
26
|
+
|
|
27
|
+
/** A keyboard command that can affect selection. */
|
|
28
|
+
export type TableSelectionCommand = "left" | "right" | "up" | "down" | "tab-forward" | "tab-backward"
|
|
29
|
+
| "select-row" | "select-column";
|
|
30
|
+
|
|
31
|
+
/** The result of one keyboard selection command. */
|
|
32
|
+
export interface TableSelectionMove {
|
|
33
|
+
selection: TableSelection | null;
|
|
34
|
+
exit: "before" | "after" | null;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** Selects one cell at a displayed position. */
|
|
38
|
+
export function cellSelectionAt(axes: TableDisplayAxes, rowIndex: number, columnIndex: number): TableCellSelection | null;
|
|
39
|
+
|
|
40
|
+
/** Selects one axis item or extends an existing same-axis range from its anchor. */
|
|
41
|
+
export function selectAxis(selection: TableSelection | null, kind: "rows" | "columns", index: number,
|
|
42
|
+
extend: boolean, axes: TableDisplayAxes): TableAxisSelection | null;
|
|
43
|
+
|
|
44
|
+
/** Applies one keyboard selection command and reports when Tab should leave the table. */
|
|
45
|
+
export function moveSelection(selection: TableSelection | null, command: TableSelectionCommand, axes: TableDisplayAxes,
|
|
46
|
+
options?: { extend?: boolean }): TableSelectionMove;
|
|
47
|
+
|
|
48
|
+
/** Returns the retained selection when entering the table, or selects its first cell. */
|
|
49
|
+
export function enterTable(selection: TableSelection | null, axes: TableDisplayAxes): TableSelection | null;
|
|
50
|
+
|
|
51
|
+
/** Resolves the row or column selection whose action menu should open. */
|
|
52
|
+
export function selectionForMenu(selection: TableSelection | null, axes: TableDisplayAxes): TableAxisSelection | null;
|
|
53
|
+
|
|
54
|
+
/** Follows selected identities through a new display snapshot, clearing any invalid selection. */
|
|
55
|
+
export function reconcileSelection(selection: TableSelection | null, axes: TableDisplayAxes): TableSelection | null;
|
|
56
|
+
|
|
57
|
+
/** Selects the new entry's cell after an add-at-end action. */
|
|
58
|
+
export function selectionAfterAdd(previous: TableSelection | null, axis: "rows" | "columns", newKey: string,
|
|
59
|
+
axes: TableDisplayAxes): TableCellSelection | null;
|
|
60
|
+
|
|
61
|
+
/** Selects the one new whole row or column after insertion. */
|
|
62
|
+
export function selectionAfterInsert(axis: "rows" | "columns", newKey: string,
|
|
63
|
+
axes: TableDisplayAxes): TableAxisSelection | null;
|
|
64
|
+
|
|
65
|
+
/** Selects the former position, or the new last position, after deletion. */
|
|
66
|
+
export function selectionAfterDelete(axis: "rows" | "columns", formerIndex: number,
|
|
67
|
+
axes: TableDisplayAxes): TableAxisSelection | null;
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
/* Pure selection, navigation and reconciliation rules for the Table page. */
|
|
2
|
+
|
|
3
|
+
function clamp(value, minimum, maximum) {
|
|
4
|
+
return Math.max(minimum, Math.min(value, maximum));
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
function itemAt(items, index) {
|
|
8
|
+
return Number.isInteger(index) && index >= 0 && index < items.length ? items[index] : undefined;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
function indexOfId(items, id) {
|
|
12
|
+
return items.findIndex(item => item.id === id);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/** Selects one cell at a displayed position. */
|
|
16
|
+
export function cellSelectionAt(axes, rowIndex, columnIndex) {
|
|
17
|
+
const row = itemAt(axes.rows, rowIndex);
|
|
18
|
+
const column = itemAt(axes.columns, columnIndex);
|
|
19
|
+
if (row === undefined || column === undefined) return null;
|
|
20
|
+
return { kind: "cell", rowId: row.id, columnId: column.id };
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function axisItems(axes, kind) {
|
|
24
|
+
return kind === "rows" ? axes.rows : axes.columns;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function axisSelection(kind, items, anchorIndex, activeIndex) {
|
|
28
|
+
const start = Math.min(anchorIndex, activeIndex);
|
|
29
|
+
const end = Math.max(anchorIndex, activeIndex);
|
|
30
|
+
return {
|
|
31
|
+
kind,
|
|
32
|
+
ids: items.slice(start, end + 1).map(item => item.id),
|
|
33
|
+
anchorId: items[anchorIndex].id,
|
|
34
|
+
activeId: items[activeIndex].id,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** Selects one axis item or extends an existing same-axis range from its anchor. */
|
|
39
|
+
export function selectAxis(selection, kind, index, extend, axes) {
|
|
40
|
+
const items = axisItems(axes, kind);
|
|
41
|
+
const targetIndex = clamp(index, 0, items.length - 1);
|
|
42
|
+
if (items[targetIndex] === undefined) return null;
|
|
43
|
+
const anchorIndex = extend && selection?.kind === kind ? indexOfId(items, selection.anchorId) : targetIndex;
|
|
44
|
+
return axisSelection(kind, items, anchorIndex < 0 ? targetIndex : anchorIndex, targetIndex);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function unchanged(selection, exit = null) {
|
|
48
|
+
return { selection, exit };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function moveAxisSelection(selection, command, axes, extend) {
|
|
52
|
+
const items = axisItems(axes, selection.kind);
|
|
53
|
+
if (command === "tab-forward") return unchanged(selection, "after");
|
|
54
|
+
if (command === "tab-backward") return unchanged(selection, "before");
|
|
55
|
+
const delta = selection.kind === "rows"
|
|
56
|
+
? command === "up" ? -1 : command === "down" ? 1 : 0
|
|
57
|
+
: command === "left" ? -1 : command === "right" ? 1 : 0;
|
|
58
|
+
if (delta === 0) return unchanged(selection);
|
|
59
|
+
const baseId = extend ? selection.activeId : selection.anchorId;
|
|
60
|
+
const baseIndex = indexOfId(items, baseId);
|
|
61
|
+
if (baseIndex < 0) return unchanged(selection);
|
|
62
|
+
const targetIndex = clamp(baseIndex + delta, 0, items.length - 1);
|
|
63
|
+
return unchanged(selectAxis(extend ? selection : null, selection.kind, targetIndex, extend, axes));
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function moveCellSelection(selection, command, axes) {
|
|
67
|
+
const rowIndex = indexOfId(axes.rows, selection.rowId);
|
|
68
|
+
const columnIndex = indexOfId(axes.columns, selection.columnId);
|
|
69
|
+
if (columnIndex < 0 || rowIndex < 0) return unchanged(selection);
|
|
70
|
+
if (command === "select-column") return unchanged(selectAxis(null, "columns", columnIndex, false, axes));
|
|
71
|
+
if (command === "select-row") return unchanged(selectAxis(null, "rows", rowIndex, false, axes));
|
|
72
|
+
|
|
73
|
+
if (command === "tab-forward" || command === "tab-backward") {
|
|
74
|
+
const delta = command === "tab-forward" ? 1 : -1;
|
|
75
|
+
const nextColumn = columnIndex + delta;
|
|
76
|
+
if (nextColumn < 0) return unchanged(selection, "before");
|
|
77
|
+
if (nextColumn >= axes.columns.length) return unchanged(selection, "after");
|
|
78
|
+
return unchanged(cellSelectionAt(axes, rowIndex, nextColumn));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (command === "left" || command === "right") {
|
|
82
|
+
const nextColumn = clamp(columnIndex + (command === "left" ? -1 : 1), 0, axes.columns.length - 1);
|
|
83
|
+
return unchanged(cellSelectionAt(axes, rowIndex, nextColumn));
|
|
84
|
+
}
|
|
85
|
+
if (command === "up") {
|
|
86
|
+
return unchanged(cellSelectionAt(axes, Math.max(0, rowIndex - 1), columnIndex));
|
|
87
|
+
}
|
|
88
|
+
if (command === "down") {
|
|
89
|
+
return unchanged(cellSelectionAt(axes, Math.min(axes.rows.length - 1, rowIndex + 1), columnIndex));
|
|
90
|
+
}
|
|
91
|
+
return unchanged(selection);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** Applies one keyboard selection command and reports when Tab should leave the table. */
|
|
95
|
+
export function moveSelection(selection, command, axes, options = {}) {
|
|
96
|
+
if (selection === null) {
|
|
97
|
+
return ["left", "right", "up", "down"].includes(command)
|
|
98
|
+
? unchanged(cellSelectionAt(axes, 0, 0)) : unchanged(null);
|
|
99
|
+
}
|
|
100
|
+
if (selection.kind === "rows" || selection.kind === "columns") {
|
|
101
|
+
return moveAxisSelection(selection, command, axes, options.extend === true);
|
|
102
|
+
}
|
|
103
|
+
return moveCellSelection(selection, command, axes);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** Returns the retained selection when entering the table, or selects its first cell. */
|
|
107
|
+
export function enterTable(selection, axes) {
|
|
108
|
+
return selection ?? cellSelectionAt(axes, 0, 0);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** Resolves the row or column selection whose action menu should open. */
|
|
112
|
+
export function selectionForMenu(selection, axes) {
|
|
113
|
+
if (selection?.kind === "rows" || selection?.kind === "columns") return selection;
|
|
114
|
+
if (selection?.kind === "cell") {
|
|
115
|
+
const index = indexOfId(axes.rows, selection.rowId);
|
|
116
|
+
return index < 0 ? null : selectAxis(null, "rows", index, false, axes);
|
|
117
|
+
}
|
|
118
|
+
return null;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
function reconcileAxisSelection(selection, items) {
|
|
122
|
+
const positions = selection.ids.map(id => indexOfId(items, id));
|
|
123
|
+
if (positions.some(position => position < 0) || new Set(positions).size !== positions.length) return null;
|
|
124
|
+
const sorted = [...positions].sort((left, right) => left - right);
|
|
125
|
+
if (sorted.at(-1) - sorted[0] + 1 !== sorted.length) return null;
|
|
126
|
+
if (indexOfId(items, selection.anchorId) < 0 || indexOfId(items, selection.activeId) < 0) return null;
|
|
127
|
+
return { ...selection, ids: items.slice(sorted[0], sorted.at(-1) + 1).map(item => item.id) };
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/** Follows selected identities through a new display snapshot, clearing any invalid selection. */
|
|
131
|
+
export function reconcileSelection(selection, axes) {
|
|
132
|
+
if (selection === null) return null;
|
|
133
|
+
if (selection.kind === "cell") {
|
|
134
|
+
return indexOfId(axes.rows, selection.rowId) < 0 || indexOfId(axes.columns, selection.columnId) < 0 ? null : selection;
|
|
135
|
+
}
|
|
136
|
+
return reconcileAxisSelection(selection, axisItems(axes, selection.kind));
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/** Selects the new entry's cell after an add-at-end action. */
|
|
140
|
+
export function selectionAfterAdd(previous, axis, newKey, axes) {
|
|
141
|
+
const newId = `stored:${newKey}`;
|
|
142
|
+
if (axis === "rows") {
|
|
143
|
+
const rowIndex = indexOfId(axes.rows, newId);
|
|
144
|
+
const columnIndex = previous?.kind === "cell" ? indexOfId(axes.columns, previous.columnId) : 0;
|
|
145
|
+
return rowIndex < 0 || columnIndex < 0 ? null : cellSelectionAt(axes, rowIndex, columnIndex);
|
|
146
|
+
}
|
|
147
|
+
const columnIndex = indexOfId(axes.columns, newId);
|
|
148
|
+
const rowIndex = previous?.kind === "cell" ? indexOfId(axes.rows, previous.rowId) : 0;
|
|
149
|
+
return rowIndex < 0 || columnIndex < 0 ? null : cellSelectionAt(axes, rowIndex, columnIndex);
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
/** Selects the one new whole row or column after insertion. */
|
|
153
|
+
export function selectionAfterInsert(axis, newKey, axes) {
|
|
154
|
+
const kind = axis;
|
|
155
|
+
const index = indexOfId(axisItems(axes, kind), `stored:${newKey}`);
|
|
156
|
+
return index < 0 ? null : selectAxis(null, kind, index, false, axes);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** Selects the former position, or the new last position, after deletion. */
|
|
160
|
+
export function selectionAfterDelete(axis, formerIndex, axes) {
|
|
161
|
+
const items = axisItems(axes, axis);
|
|
162
|
+
return selectAxis(null, axis, Math.min(formerIndex, items.length - 1), false, axes);
|
|
163
|
+
}
|