@adobe/data 0.9.39 → 0.9.41
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/AGENTS.md +84 -16
- package/package.json +1 -1
- package/references/data-lit/package.json +1 -1
- package/references/data-lit-tictactoe/package.json +22 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-app/tictactoe-app.css.ts +11 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-app/tictactoe-app.ts +22 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-board/tictactoe-board-presentation.ts +13 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-board/tictactoe-board.css.ts +17 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-board/tictactoe-board.ts +18 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-cell/tictactoe-cell-presentation.ts +22 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-cell/tictactoe-cell.css.ts +31 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-cell/tictactoe-cell.ts +41 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-hud/tictactoe-hud-presentation.ts +16 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-hud/tictactoe-hud.css.ts +18 -0
- package/references/data-lit-tictactoe/src/elements/tictactoe-hud/tictactoe-hud.ts +44 -0
- package/references/data-lit-tictactoe/src/main.ts +9 -0
- package/references/data-lit-tictactoe/src/state/agent-plugin.ts +117 -0
- package/references/data-lit-tictactoe/src/state/tictactoe-plugin.ts +56 -0
- package/references/data-lit-tictactoe/src/tictactoe-element.ts +10 -0
- package/references/data-lit-tictactoe/src/types/board-cell.ts +5 -0
- package/references/data-lit-tictactoe/src/types/board-state/board-state.ts +7 -0
- package/references/data-lit-tictactoe/src/types/board-state/create-initial-board.ts +5 -0
- package/references/data-lit-tictactoe/src/types/board-state/current-player.ts +13 -0
- package/references/data-lit-tictactoe/src/types/board-state/derive-status.ts +12 -0
- package/references/data-lit-tictactoe/src/types/board-state/get-cell.ts +7 -0
- package/references/data-lit-tictactoe/src/types/board-state/get-move-count.ts +6 -0
- package/references/data-lit-tictactoe/src/types/board-state/get-winner.ts +14 -0
- package/references/data-lit-tictactoe/src/types/board-state/get-winning-line.ts +25 -0
- package/references/data-lit-tictactoe/src/types/board-state/is-board-full.ts +5 -0
- package/references/data-lit-tictactoe/src/types/board-state/is-cell-playable.ts +13 -0
- package/references/data-lit-tictactoe/src/types/board-state/is-cell-winning.ts +9 -0
- package/references/data-lit-tictactoe/src/types/board-state/is-game-over.ts +8 -0
- package/references/data-lit-tictactoe/src/types/board-state/public.ts +15 -0
- package/references/data-lit-tictactoe/src/types/board-state/schema.ts +10 -0
- package/references/data-lit-tictactoe/src/types/board-state/set-board-cell.ts +13 -0
- package/references/data-lit-tictactoe/src/types/game-status.ts +3 -0
- package/references/data-lit-tictactoe/src/types/move-reject-reason.ts +7 -0
- package/references/data-lit-tictactoe/src/types/play-move-args/can-play-move.ts +33 -0
- package/references/data-lit-tictactoe/src/types/play-move-args/play-move-args.ts +4 -0
- package/references/{data-lit-todo/src/elements/todo-undo-redo/index.ts → data-lit-tictactoe/src/types/play-move-args/public.ts} +1 -1
- package/references/data-lit-tictactoe/src/types/player-mark/player-mark.ts +7 -0
- package/references/{data-lit-todo/src/elements/todo-row/index.ts → data-lit-tictactoe/src/types/player-mark/public.ts} +2 -1
- package/references/data-lit-tictactoe/src/types/player-mark/schema.ts +9 -0
- package/references/data-lit-tictactoe/src/types/winning-line.ts +3 -0
- package/references/data-lit-tictactoe/tsconfig.json +16 -0
- package/references/data-react/package.json +1 -1
- package/references/data-react-hello/package.json +1 -1
- package/references/data-react-hello/src/{App.tsx → app.tsx} +2 -2
- package/references/data-react-hello/src/components/counter/counter-presentation.tsx +13 -0
- package/references/data-react-hello/src/components/counter/counter.tsx +26 -0
- package/references/data-react-hello/src/main.tsx +1 -1
- package/references/data-react-hello/src/state/use-counter-database.ts +6 -0
- package/references/data-react-pixie/package.json +1 -1
- package/references/data-react-pixie/src/{App.tsx → app.tsx} +7 -7
- package/references/data-react-pixie/src/{filter-toggle.tsx → components/filter-selector/filter-selector-presentation.tsx} +9 -15
- package/references/data-react-pixie/src/components/filter-selector/filter-selector.tsx +22 -0
- package/references/data-react-pixie/src/{filters.ts → components/pixie-scene/pixie-filters.ts} +3 -1
- package/references/data-react-pixie/src/components/pixie-scene/pixie-scene-presentation.tsx +18 -0
- package/references/data-react-pixie/src/components/pixie-scene/pixie-scene.tsx +26 -0
- package/references/data-react-pixie/src/components/pixie-scene/pixie-tick.tsx +12 -0
- package/references/data-react-pixie/src/components/sprite/sprite-presentation.tsx +39 -0
- package/references/data-react-pixie/src/components/sprite/sprite.tsx +37 -0
- package/references/data-react-pixie/src/{hooks/use-texture.ts → components/sprite/use-sprite-texture.ts} +3 -1
- package/references/data-react-pixie/src/main.tsx +1 -1
- package/references/data-react-pixie/src/{pixie-plugin.ts → state/pixie-plugin.ts} +4 -7
- package/references/data-react-pixie/src/state/use-pixie-database.ts +6 -0
- package/references/data-react-pixie/src/types/filter-type.ts +3 -0
- package/references/data-react-pixie/src/types/sprite-type/image.ts +14 -0
- package/references/data-react-pixie/src/types/sprite-type/public.ts +4 -0
- package/references/data-react-pixie/src/types/sprite-type/schema.ts +5 -0
- package/references/data-react-pixie/src/types/sprite-type/sprite-type.ts +7 -0
- package/references/data-lit-todo/package.json +0 -30
- package/references/data-lit-todo/src/elements/todo-list/todo-list-presentation.ts +0 -22
- package/references/data-lit-todo/src/elements/todo-list/todo-list.css.ts +0 -12
- package/references/data-lit-todo/src/elements/todo-list/todo-list.ts +0 -45
- package/references/data-lit-todo/src/elements/todo-row/todo-row-presentation.ts +0 -68
- package/references/data-lit-todo/src/elements/todo-row/todo-row.css.ts +0 -49
- package/references/data-lit-todo/src/elements/todo-row/todo-row.ts +0 -46
- package/references/data-lit-todo/src/elements/todo-toolbar/index.ts +0 -2
- package/references/data-lit-todo/src/elements/todo-toolbar/todo-toolbar-presentation.ts +0 -55
- package/references/data-lit-todo/src/elements/todo-toolbar/todo-toolbar.css.ts +0 -34
- package/references/data-lit-todo/src/elements/todo-toolbar/todo-toolbar.ts +0 -62
- package/references/data-lit-todo/src/elements/todo-undo-redo/todo-undo-redo-presentation.ts +0 -41
- package/references/data-lit-todo/src/elements/todo-undo-redo/todo-undo-redo.css.ts +0 -12
- package/references/data-lit-todo/src/elements/todo-undo-redo/todo-undo-redo.ts +0 -37
- package/references/data-lit-todo/src/index.ts +0 -9
- package/references/data-lit-todo/src/main.ts +0 -29
- package/references/data-lit-todo/src/sample-types.ts +0 -14
- package/references/data-lit-todo/src/services/dependent-state-service/create-dependent-state-service.ts +0 -8
- package/references/data-lit-todo/src/services/dependent-state-service/dependent-state/all-todos.ts +0 -5
- package/references/data-lit-todo/src/services/dependent-state-service/dependent-state/complete-todos.ts +0 -5
- package/references/data-lit-todo/src/services/dependent-state-service/dependent-state/incomplete-todos.ts +0 -5
- package/references/data-lit-todo/src/services/dependent-state-service/dependent-state/index.ts +0 -4
- package/references/data-lit-todo/src/services/dependent-state-service/dependent-state-service.ts +0 -4
- package/references/data-lit-todo/src/services/main-service/create-main-service.ts +0 -53
- package/references/data-lit-todo/src/services/main-service/todo-main-service.ts +0 -20
- package/references/data-lit-todo/src/services/state-service/create-todo-database.ts +0 -16
- package/references/data-lit-todo/src/services/state-service/create-todo-store.ts +0 -28
- package/references/data-lit-todo/src/services/state-service/todo-state-service.ts +0 -9
- package/references/data-lit-todo/src/services/state-service/transactions/create-bulk-todos.ts +0 -12
- package/references/data-lit-todo/src/services/state-service/transactions/create-todo.test.ts +0 -17
- package/references/data-lit-todo/src/services/state-service/transactions/create-todo.ts +0 -15
- package/references/data-lit-todo/src/services/state-service/transactions/delete-all-todos.ts +0 -18
- package/references/data-lit-todo/src/services/state-service/transactions/delete-todo.test.ts +0 -25
- package/references/data-lit-todo/src/services/state-service/transactions/delete-todo.ts +0 -11
- package/references/data-lit-todo/src/services/state-service/transactions/drag-todo.ts +0 -19
- package/references/data-lit-todo/src/services/state-service/transactions/index.ts +0 -8
- package/references/data-lit-todo/src/services/state-service/transactions/reorder-todos.ts +0 -13
- package/references/data-lit-todo/src/services/state-service/transactions/toggle-complete.test.ts +0 -78
- package/references/data-lit-todo/src/services/state-service/transactions/toggle-complete.ts +0 -15
- package/references/data-lit-todo/src/todo-element.ts +0 -6
- package/references/data-lit-todo/src/todo-host.ts +0 -29
- package/references/data-lit-todo/src/todo-main-element.ts +0 -40
- package/references/data-lit-todo/src/todo-sample.ts +0 -21
- package/references/data-lit-todo/tsconfig.json +0 -10
- package/references/data-react-hello/src/Counter.tsx +0 -21
- package/references/data-react-pixie/src/hooks/use-database.ts +0 -6
- package/references/data-react-pixie/src/pixi-react.d.ts +0 -1
- package/references/data-react-pixie/src/sprite-container.tsx +0 -23
- package/references/data-react-pixie/src/sprite-urls.ts +0 -9
- package/references/data-react-pixie/src/sprite.tsx +0 -35
- package/references/data-react-pixie/src/tick.tsx +0 -10
- /package/references/data-react-hello/src/{counter-plugin.ts → state/counter-plugin.ts} +0 -0
- /package/references/data-react-pixie/src/{bunny.png → types/sprite-type/bunny.png} +0 -0
- /package/references/data-react-pixie/src/{fox.png → types/sprite-type/fox.png} +0 -0
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
2
|
|
|
3
3
|
import { Database } from "@adobe/data/ecs";
|
|
4
|
-
import { Boolean
|
|
4
|
+
import { Boolean } from "@adobe/data/schema";
|
|
5
5
|
import { Vec2, F32 } from "@adobe/data/math";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
export type SpriteType = Schema.ToType<typeof spriteTypeSchema>;
|
|
9
|
-
|
|
10
|
-
export type FilterType = "none" | "sepia" | "blur" | "vintage" | "night";
|
|
6
|
+
import type { FilterType } from "../types/filter-type";
|
|
7
|
+
import { SpriteType } from "../types/sprite-type/sprite-type";
|
|
11
8
|
|
|
12
9
|
export const pixiePlugin = Database.Plugin.create({
|
|
13
10
|
components: {
|
|
14
11
|
position: Vec2.schema,
|
|
15
12
|
rotation: F32.schema,
|
|
16
|
-
sprite:
|
|
13
|
+
sprite: SpriteType.schema,
|
|
17
14
|
hovered: Boolean.schema,
|
|
18
15
|
active: Boolean.schema,
|
|
19
16
|
},
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
+
|
|
3
|
+
import { Schema } from "@adobe/data/schema";
|
|
4
|
+
import { schema } from "./schema";
|
|
5
|
+
|
|
6
|
+
import bunnyUrl from "./bunny.png";
|
|
7
|
+
import foxUrl from "./fox.png";
|
|
8
|
+
|
|
9
|
+
type SpriteType = Schema.ToType<typeof schema>;
|
|
10
|
+
|
|
11
|
+
export const image = {
|
|
12
|
+
bunny: bunnyUrl,
|
|
13
|
+
fox: foxUrl,
|
|
14
|
+
} as const satisfies Record<SpriteType, string>;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "data-lit-todo",
|
|
3
|
-
"version": "0.9.39",
|
|
4
|
-
"description": "Todo sample app demonstrating @adobe/data with Lit",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"private": true,
|
|
7
|
-
"scripts": {
|
|
8
|
-
"build": "vite build",
|
|
9
|
-
"dev": "vite",
|
|
10
|
-
"publish-public": "true"
|
|
11
|
-
},
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@adobe/data": "workspace:*",
|
|
14
|
-
"@adobe/data-lit": "workspace:*",
|
|
15
|
-
"@spectrum-web-components/action-button": "^1.7.0",
|
|
16
|
-
"@spectrum-web-components/action-group": "^1.7.0",
|
|
17
|
-
"@spectrum-web-components/button": "^1.7.0",
|
|
18
|
-
"@spectrum-web-components/card": "^1.7.0",
|
|
19
|
-
"@spectrum-web-components/checkbox": "^1.7.0",
|
|
20
|
-
"@spectrum-web-components/icons-workflow": "^1.7.0",
|
|
21
|
-
"@spectrum-web-components/styles": "^1.7.0",
|
|
22
|
-
"@spectrum-web-components/theme": "^1.7.0",
|
|
23
|
-
"lit": "^3.3.1"
|
|
24
|
-
},
|
|
25
|
-
"devDependencies": {
|
|
26
|
-
"typescript": "^5.8.3",
|
|
27
|
-
"vite": "^6.4.0",
|
|
28
|
-
"vitest": "^1.6.0"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import type { Entity } from "@adobe/data/ecs";
|
|
3
|
-
import { html } from 'lit';
|
|
4
|
-
import { repeat } from 'lit/directives/repeat.js';
|
|
5
|
-
import '@spectrum-web-components/action-button/sp-action-button.js';
|
|
6
|
-
import '../todo-row/todo-row.js';
|
|
7
|
-
|
|
8
|
-
type RenderArgs = {
|
|
9
|
-
todos: readonly Entity[];
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export function render(args: RenderArgs) {
|
|
13
|
-
return html`
|
|
14
|
-
<div class="todo-list">
|
|
15
|
-
${repeat(
|
|
16
|
-
args.todos,
|
|
17
|
-
todo => todo,
|
|
18
|
-
(todo, index) => html` <data-todo-row .entity=${todo} .index=${index}></data-todo-row> `
|
|
19
|
-
)}
|
|
20
|
-
</div>
|
|
21
|
-
`;
|
|
22
|
-
}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import * as presentation from './todo-list-presentation.js';
|
|
3
|
-
import { styles } from './todo-list.css.js';
|
|
4
|
-
import { customElement } from 'lit/decorators.js';
|
|
5
|
-
import { css } from 'lit';
|
|
6
|
-
|
|
7
|
-
import { useObservableValues } from "@adobe/data-lit";
|
|
8
|
-
import { TodoElement } from '../../todo-element.js';
|
|
9
|
-
import '../todo-row/todo-row.js';
|
|
10
|
-
|
|
11
|
-
export const tagName = 'data-todo-list';
|
|
12
|
-
|
|
13
|
-
declare global {
|
|
14
|
-
interface HTMLElementTagNameMap {
|
|
15
|
-
[tagName]: TodoList;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@customElement(tagName)
|
|
20
|
-
export class TodoList extends TodoElement {
|
|
21
|
-
static styles = [
|
|
22
|
-
styles,
|
|
23
|
-
css`
|
|
24
|
-
:host {
|
|
25
|
-
display: block;
|
|
26
|
-
height: 100%;
|
|
27
|
-
width: 100%;
|
|
28
|
-
overflow-y: auto;
|
|
29
|
-
position: relative;
|
|
30
|
-
}
|
|
31
|
-
`
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
render() {
|
|
35
|
-
const values = useObservableValues(() => ({
|
|
36
|
-
todos: this.service.dependentState.allTodos,
|
|
37
|
-
}));
|
|
38
|
-
|
|
39
|
-
if (!values) return;
|
|
40
|
-
|
|
41
|
-
return presentation.render({
|
|
42
|
-
...values,
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
|
|
4
|
-
import { useDragTransaction } from "@adobe/data-lit";
|
|
5
|
-
import '@spectrum-web-components/action-button/sp-action-button.js';
|
|
6
|
-
import '@spectrum-web-components/checkbox/sp-checkbox.js';
|
|
7
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-delete.js';
|
|
8
|
-
|
|
9
|
-
// Temporarily disable localization for the sample
|
|
10
|
-
// import { Localized, Unlocalized } from '../../../../services/locale-service/locale-service.js';
|
|
11
|
-
import { DragTodoFunction, Todo } from '../../services/state-service/todo-state-service.js';
|
|
12
|
-
|
|
13
|
-
const TODO_ROW_HEIGHT = 56;
|
|
14
|
-
|
|
15
|
-
// Simplified localization for sample - using static strings
|
|
16
|
-
const localizedStrings = {
|
|
17
|
-
deleteTodo: 'Delete',
|
|
18
|
-
toggleComplete: 'Toggle complete',
|
|
19
|
-
} as const;
|
|
20
|
-
|
|
21
|
-
type RenderArgs = {
|
|
22
|
-
localized: typeof localizedStrings;
|
|
23
|
-
todo: Todo;
|
|
24
|
-
toggleComplete: () => void;
|
|
25
|
-
deleteTodo: () => void;
|
|
26
|
-
dragTodo: DragTodoFunction;
|
|
27
|
-
index: number;
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
export function render(args: RenderArgs) {
|
|
31
|
-
const { localized, todo, toggleComplete, deleteTodo, index, dragTodo } = args;
|
|
32
|
-
|
|
33
|
-
useDragTransaction({
|
|
34
|
-
transaction: dragTodo,
|
|
35
|
-
update: (value) => {
|
|
36
|
-
if (value.type === 'move') {
|
|
37
|
-
return {
|
|
38
|
-
todo: todo.id,
|
|
39
|
-
dragPosition: value.delta[1],
|
|
40
|
-
};
|
|
41
|
-
} else if (value.type === 'end') {
|
|
42
|
-
const finalIndex = index + Math.round(value.position[1] / TODO_ROW_HEIGHT);
|
|
43
|
-
return {
|
|
44
|
-
todo: todo.id,
|
|
45
|
-
dragPosition: index,
|
|
46
|
-
finalIndex,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
},
|
|
50
|
-
}, [dragTodo, todo.id, index]);
|
|
51
|
-
|
|
52
|
-
const dragging = todo.dragPosition !== null;
|
|
53
|
-
const position = index * TODO_ROW_HEIGHT + (todo.dragPosition ?? 0);
|
|
54
|
-
|
|
55
|
-
return html`
|
|
56
|
-
<div
|
|
57
|
-
class="todo-row ${dragging ? 'dragging' : ''}"
|
|
58
|
-
style="height: ${TODO_ROW_HEIGHT}px; position: absolute; top: ${position}px; left: 0; right: 0;">
|
|
59
|
-
<sp-checkbox @change=${toggleComplete} title=${localized.toggleComplete} ?checked=${todo.complete}> </sp-checkbox>
|
|
60
|
-
|
|
61
|
-
<span class="todo-name"> ${index}: ${todo.name} </span>
|
|
62
|
-
|
|
63
|
-
<sp-action-button @click=${deleteTodo} quiet title=${localized.deleteTodo}>
|
|
64
|
-
<sp-icon-delete slot="icon"></sp-icon-delete>
|
|
65
|
-
</sp-action-button>
|
|
66
|
-
</div>
|
|
67
|
-
`;
|
|
68
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { css } from 'lit';
|
|
3
|
-
|
|
4
|
-
export const styles = css`
|
|
5
|
-
:host {
|
|
6
|
-
display: block;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.todo-row {
|
|
10
|
-
--todo-row-height: 56px;
|
|
11
|
-
box-sizing: border-box;
|
|
12
|
-
display: flex;
|
|
13
|
-
align-items: center;
|
|
14
|
-
gap: var(--spectrum-spacing-200);
|
|
15
|
-
padding: var(--spectrum-spacing-200) var(--spectrum-spacing-300);
|
|
16
|
-
border-bottom: 1px solid var(--spectrum-gray-200);
|
|
17
|
-
min-height: var(--todo-row-height);
|
|
18
|
-
height: var(--todo-row-height);
|
|
19
|
-
contain: layout paint style; /* or at least paint/layout */
|
|
20
|
-
content-visibility: auto; /* skip offscreen work: https://developer.mozilla.org/en-US/docs/Web/CSS/content-visibility */
|
|
21
|
-
contain-intrinsic-size: 500px var(--todo-row-height); /* reserve space so auto can skip paint: https://developer.mozilla.org/en-US/docs/Web/CSS/contain-intrinsic-size */
|
|
22
|
-
transition: background-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
.todo-row.dragging {
|
|
26
|
-
background-color: var(--spectrum-gray-100);
|
|
27
|
-
z-index: 100;
|
|
28
|
-
box-shadow: 0 0 10px var(--spectrum-gray-300);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
.todo-row:hover {
|
|
32
|
-
background-color: var(--spectrum-gray-100);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
.todo-name {
|
|
36
|
-
flex: 1;
|
|
37
|
-
font-size: var(--spectrum-font-size-100);
|
|
38
|
-
line-height: var(--spectrum-line-height-100);
|
|
39
|
-
color: var(--spectrum-gray-800);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
sp-checkbox {
|
|
43
|
-
flex-shrink: 0;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
sp-action-button {
|
|
47
|
-
flex-shrink: 0;
|
|
48
|
-
}
|
|
49
|
-
`;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import * as presentation from './todo-row-presentation.js';
|
|
3
|
-
import { styles } from './todo-row.css.js';
|
|
4
|
-
import type { Entity } from "@adobe/data/ecs";
|
|
5
|
-
import { customElement, property } from 'lit/decorators.js';
|
|
6
|
-
|
|
7
|
-
import { useObservableValues } from "@adobe/data-lit";
|
|
8
|
-
import { TodoElement } from '../../todo-element.js';
|
|
9
|
-
|
|
10
|
-
export const tagName = 'data-todo-row';
|
|
11
|
-
|
|
12
|
-
declare global {
|
|
13
|
-
interface HTMLElementTagNameMap {
|
|
14
|
-
[tagName]: TodoRow;
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
@customElement(tagName)
|
|
19
|
-
export class TodoRow extends TodoElement {
|
|
20
|
-
static styles = styles;
|
|
21
|
-
|
|
22
|
-
@property({ type: Number })
|
|
23
|
-
entity!: Entity;
|
|
24
|
-
|
|
25
|
-
@property({ type: Number })
|
|
26
|
-
index!: number;
|
|
27
|
-
|
|
28
|
-
render() {
|
|
29
|
-
const localized = { toggleComplete: 'Toggle complete', deleteTodo: 'Delete' } as const;
|
|
30
|
-
const values = useObservableValues(() => ({
|
|
31
|
-
todo: this.service.state.observe.entity(this.entity, this.service.state.archetypes.Todo),
|
|
32
|
-
}));
|
|
33
|
-
|
|
34
|
-
if (!values || !values.todo) return;
|
|
35
|
-
|
|
36
|
-
return presentation.render({
|
|
37
|
-
...values,
|
|
38
|
-
localized,
|
|
39
|
-
todo: values.todo,
|
|
40
|
-
toggleComplete: () => this.service.state.transactions.toggleComplete(this.entity),
|
|
41
|
-
deleteTodo: () => this.service.state.transactions.deleteTodo(this.entity),
|
|
42
|
-
dragTodo: this.service.state.transactions.dragTodo,
|
|
43
|
-
index: this.index,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
|
|
4
|
-
import '../todo-undo-redo/index.js';
|
|
5
|
-
import '@spectrum-web-components/action-button/sp-action-button.js';
|
|
6
|
-
|
|
7
|
-
// Temporarily disable localization for the sample
|
|
8
|
-
// import { Localized, Unlocalized } from '../../../../services/locale-service/locale-service.js';
|
|
9
|
-
|
|
10
|
-
// Simplified localization for sample - using static strings
|
|
11
|
-
const localizedStrings = {
|
|
12
|
-
add1Todo: 'Add 1 Todo',
|
|
13
|
-
add10Todos: 'Add 10 Todos',
|
|
14
|
-
add1000Todos: 'Add 1000 Todos',
|
|
15
|
-
clearCompleted: 'Clear Completed',
|
|
16
|
-
toggleAll: 'Toggle All',
|
|
17
|
-
todoCount: 'todos',
|
|
18
|
-
completedCount: 'completed',
|
|
19
|
-
} as const;
|
|
20
|
-
|
|
21
|
-
type RenderArgs = {
|
|
22
|
-
localized: typeof localizedStrings;
|
|
23
|
-
todoCount: number;
|
|
24
|
-
completedCount: number;
|
|
25
|
-
isGenerating: boolean;
|
|
26
|
-
createBulkTodos: (count: number) => void;
|
|
27
|
-
clearCompleted: () => void;
|
|
28
|
-
toggleAll: () => void;
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
export function render(args: RenderArgs) {
|
|
32
|
-
const { localized, todoCount, completedCount, isGenerating, createBulkTodos, clearCompleted, toggleAll } = args;
|
|
33
|
-
|
|
34
|
-
return html`
|
|
35
|
-
<div class="todo-toolbar">
|
|
36
|
-
<div class="toolbar-left">
|
|
37
|
-
<data-todo-undo-redo></data-todo-undo-redo>
|
|
38
|
-
<sp-action-button @click=${toggleAll} ?disabled=${isGenerating} quiet> ${localized.toggleAll} </sp-action-button>
|
|
39
|
-
</div>
|
|
40
|
-
|
|
41
|
-
<div class="toolbar-center">
|
|
42
|
-
<sp-action-button @click=${() => createBulkTodos(1)} ?disabled=${isGenerating}> ${localized.add1Todo} </sp-action-button>
|
|
43
|
-
<sp-action-button @click=${() => createBulkTodos(10)} ?disabled=${isGenerating}> ${localized.add10Todos} </sp-action-button>
|
|
44
|
-
<sp-action-button @click=${() => createBulkTodos(1000)} ?disabled=${isGenerating}> ${localized.add1000Todos} </sp-action-button>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<div class="toolbar-right">
|
|
48
|
-
<sp-action-button @click=${clearCompleted} ?disabled=${completedCount === 0 || isGenerating} quiet>
|
|
49
|
-
${localized.clearCompleted}
|
|
50
|
-
</sp-action-button>
|
|
51
|
-
<span class="todo-stats"> ${completedCount} / ${todoCount} </span>
|
|
52
|
-
</div>
|
|
53
|
-
</div>
|
|
54
|
-
`;
|
|
55
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { css } from 'lit';
|
|
3
|
-
|
|
4
|
-
export const styles = css`
|
|
5
|
-
.todo-toolbar {
|
|
6
|
-
display: flex;
|
|
7
|
-
align-items: center;
|
|
8
|
-
justify-content: space-between;
|
|
9
|
-
padding: var(--spectrum-spacing-200) var(--spectrum-spacing-300);
|
|
10
|
-
background-color: var(--spectrum-gray-100);
|
|
11
|
-
border-bottom: 1px solid var(--spectrum-gray-300);
|
|
12
|
-
gap: var(--spectrum-spacing-200);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
.toolbar-left,
|
|
16
|
-
.toolbar-center,
|
|
17
|
-
.toolbar-right {
|
|
18
|
-
display: flex;
|
|
19
|
-
align-items: center;
|
|
20
|
-
gap: var(--spectrum-spacing-100);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.toolbar-center {
|
|
24
|
-
flex: 1;
|
|
25
|
-
justify-content: center;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.todo-stats {
|
|
29
|
-
font-size: var(--spectrum-font-size-100);
|
|
30
|
-
color: var(--spectrum-gray-600);
|
|
31
|
-
margin-left: var(--spectrum-spacing-200);
|
|
32
|
-
width: 100px;
|
|
33
|
-
}
|
|
34
|
-
`;
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import * as presentation from './todo-toolbar-presentation.js';
|
|
3
|
-
import { styles } from './todo-toolbar.css.js';
|
|
4
|
-
import { Observe } from "@adobe/data/observe";
|
|
5
|
-
import { customElement } from 'lit/decorators.js';
|
|
6
|
-
import { css } from 'lit';
|
|
7
|
-
|
|
8
|
-
import { useObservableValues } from "@adobe/data-lit";
|
|
9
|
-
import { TodoElement } from '../../todo-element.js';
|
|
10
|
-
|
|
11
|
-
export const tagName = 'data-todo-toolbar';
|
|
12
|
-
|
|
13
|
-
declare global {
|
|
14
|
-
interface HTMLElementTagNameMap {
|
|
15
|
-
[tagName]: TodoToolbar;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@customElement(tagName)
|
|
20
|
-
export class TodoToolbar extends TodoElement {
|
|
21
|
-
static styles = [
|
|
22
|
-
styles,
|
|
23
|
-
css`
|
|
24
|
-
:host {
|
|
25
|
-
display: block;
|
|
26
|
-
flex-shrink: 0;
|
|
27
|
-
width: 100%;
|
|
28
|
-
}
|
|
29
|
-
`
|
|
30
|
-
];
|
|
31
|
-
|
|
32
|
-
render() {
|
|
33
|
-
const localized = {
|
|
34
|
-
add1Todo: 'Add 1 Todo',
|
|
35
|
-
add10Todos: 'Add 10 Todos',
|
|
36
|
-
add1000Todos: 'Add 1000 Todos',
|
|
37
|
-
clearCompleted: 'Clear Completed',
|
|
38
|
-
toggleAll: 'Toggle All',
|
|
39
|
-
todoCount: 'todos',
|
|
40
|
-
completedCount: 'completed',
|
|
41
|
-
} as const;
|
|
42
|
-
const values = useObservableValues(() => ({
|
|
43
|
-
completedCount: Observe.withMap(this.service.dependentState.completeTodos, (todos: unknown) => (todos as { length: number }).length),
|
|
44
|
-
todoCount: Observe.withMap(this.service.dependentState.allTodos, (todos: unknown) => (todos as { length: number }).length),
|
|
45
|
-
}));
|
|
46
|
-
|
|
47
|
-
if (!values) return;
|
|
48
|
-
|
|
49
|
-
return presentation.render({
|
|
50
|
-
...values,
|
|
51
|
-
localized,
|
|
52
|
-
isGenerating: false,
|
|
53
|
-
createBulkTodos: this.service.state.transactions.createBulkTodos,
|
|
54
|
-
clearCompleted: () => {
|
|
55
|
-
// Placeholder - would need to implement this transaction
|
|
56
|
-
},
|
|
57
|
-
toggleAll: () => {
|
|
58
|
-
// Placeholder - would need to implement this transaction
|
|
59
|
-
},
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { html } from 'lit';
|
|
3
|
-
|
|
4
|
-
import '@spectrum-web-components/action-button/sp-action-button.js';
|
|
5
|
-
import '@spectrum-web-components/action-group/sp-action-group.js';
|
|
6
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-redo.js';
|
|
7
|
-
import '@spectrum-web-components/icons-workflow/icons/sp-icon-undo.js';
|
|
8
|
-
|
|
9
|
-
// Temporarily disable localization for the sample
|
|
10
|
-
// import { Localized, Unlocalized } from '../../../../services/locale-service/locale-service.js';
|
|
11
|
-
|
|
12
|
-
// Simplified localization for sample - using static strings
|
|
13
|
-
const localizedStrings = {
|
|
14
|
-
undo: 'Undo',
|
|
15
|
-
redo: 'Redo',
|
|
16
|
-
} as const;
|
|
17
|
-
|
|
18
|
-
type RenderArgs = {
|
|
19
|
-
localized: typeof localizedStrings;
|
|
20
|
-
hasUndo: boolean;
|
|
21
|
-
hasRedo: boolean;
|
|
22
|
-
undo: () => void;
|
|
23
|
-
redo: () => void;
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export function render(args: RenderArgs) {
|
|
27
|
-
const { localized, hasUndo, hasRedo, undo, redo } = args;
|
|
28
|
-
|
|
29
|
-
return html`
|
|
30
|
-
<sp-action-group>
|
|
31
|
-
<sp-action-button @click=${undo} ?disabled=${!hasUndo} quiet>
|
|
32
|
-
<sp-icon-undo slot="icon"></sp-icon-undo>
|
|
33
|
-
${localized.undo}
|
|
34
|
-
</sp-action-button>
|
|
35
|
-
<sp-action-button @click=${redo} ?disabled=${!hasRedo} quiet>
|
|
36
|
-
<sp-icon-redo slot="icon"></sp-icon-redo>
|
|
37
|
-
${localized.redo}
|
|
38
|
-
</sp-action-button>
|
|
39
|
-
</sp-action-group>
|
|
40
|
-
`;
|
|
41
|
-
}
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { css } from 'lit';
|
|
3
|
-
|
|
4
|
-
export const styles = css`
|
|
5
|
-
sp-action-group {
|
|
6
|
-
gap: var(--spectrum-global-dimension-size-100);
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
sp-action-button {
|
|
10
|
-
min-width: var(--spectrum-global-dimension-size-300);
|
|
11
|
-
}
|
|
12
|
-
`;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import * as presentation from './todo-undo-redo-presentation.js';
|
|
3
|
-
import { styles } from './todo-undo-redo.css.js';
|
|
4
|
-
import { customElement } from 'lit/decorators.js';
|
|
5
|
-
|
|
6
|
-
import { useObservableValues } from "@adobe/data-lit";
|
|
7
|
-
import { TodoElement } from '../../todo-element.js';
|
|
8
|
-
|
|
9
|
-
export const tagName = 'data-todo-undo-redo';
|
|
10
|
-
|
|
11
|
-
declare global {
|
|
12
|
-
interface HTMLElementTagNameMap {
|
|
13
|
-
[tagName]: TodoUndoRedo;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
@customElement(tagName)
|
|
18
|
-
export class TodoUndoRedo extends TodoElement {
|
|
19
|
-
static styles = styles;
|
|
20
|
-
|
|
21
|
-
render() {
|
|
22
|
-
const localized = { undo: 'Undo', redo: 'Redo' } as const;
|
|
23
|
-
const values = useObservableValues(() => ({
|
|
24
|
-
hasUndo: this.service.undoRedo.undoEnabled,
|
|
25
|
-
hasRedo: this.service.undoRedo.redoEnabled,
|
|
26
|
-
}));
|
|
27
|
-
|
|
28
|
-
if (!values) return;
|
|
29
|
-
|
|
30
|
-
return presentation.render({
|
|
31
|
-
...values,
|
|
32
|
-
localized,
|
|
33
|
-
undo: this.service.undoRedo.undo,
|
|
34
|
-
redo: this.service.undoRedo.redo,
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
|
|
3
|
-
export type { SampleMetadata, Sample } from "./sample-types.js";
|
|
4
|
-
|
|
5
|
-
import type { Sample } from "./sample-types.js";
|
|
6
|
-
import { todoSample } from "./todo-sample.js";
|
|
7
|
-
import "./todo-host.js"; // Ensure todo-host is registered
|
|
8
|
-
|
|
9
|
-
export const samples: readonly Sample[] = [todoSample];
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
|
|
3
|
-
import "@spectrum-web-components/theme/sp-theme.js";
|
|
4
|
-
import "@spectrum-web-components/theme/theme-light.js";
|
|
5
|
-
import "@spectrum-web-components/theme/scale-medium.js";
|
|
6
|
-
import "@spectrum-web-components/styles/all-medium-light.css";
|
|
7
|
-
import { samples } from "./index.js";
|
|
8
|
-
|
|
9
|
-
const app = document.getElementById("app");
|
|
10
|
-
if (app) {
|
|
11
|
-
app.innerHTML = samples
|
|
12
|
-
.map(
|
|
13
|
-
(s) =>
|
|
14
|
-
`<div style="margin-bottom: 1rem;">
|
|
15
|
-
<h2>${s.title}</h2>
|
|
16
|
-
<p>${s.description}</p>
|
|
17
|
-
<div id="sample-${s.id}"></div>
|
|
18
|
-
</div>`
|
|
19
|
-
)
|
|
20
|
-
.join("");
|
|
21
|
-
|
|
22
|
-
samples.forEach((s) => {
|
|
23
|
-
const container = document.getElementById(`sample-${s.id}`);
|
|
24
|
-
if (container) {
|
|
25
|
-
const el = document.createElement(s.elementTag);
|
|
26
|
-
container.appendChild(el);
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
|
|
3
|
-
export interface SampleMetadata {
|
|
4
|
-
readonly id: string;
|
|
5
|
-
readonly title: string;
|
|
6
|
-
readonly description: string;
|
|
7
|
-
readonly category: string;
|
|
8
|
-
readonly difficulty: "beginner" | "intermediate" | "advanced";
|
|
9
|
-
readonly features: readonly string[];
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export interface Sample extends SampleMetadata {
|
|
13
|
-
readonly elementTag: string;
|
|
14
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
// © 2026 Adobe. MIT License. See /LICENSE for details.
|
|
2
|
-
import { applyArg } from "@adobe/data/functions";
|
|
3
|
-
|
|
4
|
-
import * as dependentState from './dependent-state/index.js';
|
|
5
|
-
|
|
6
|
-
import { TodoCoreService } from '../main-service/todo-main-service.js';
|
|
7
|
-
|
|
8
|
-
export const createDependentStateService = (service: TodoCoreService) => applyArg(service, dependentState);
|