Skip to content

Commit 6cf43ea

Browse files
committed
Revert "reproduce exactly the correct css"
This reverts commit 970b34f.
1 parent 970b34f commit 6cf43ea

File tree

1 file changed

+17
-79
lines changed

1 file changed

+17
-79
lines changed

frameworks/keyed/ivi/src/main.ts

Lines changed: 17 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -3,49 +3,9 @@ import { htm } from "@ivi/tpl";
33
import { Entry, State, Action, ActionType } from "./types.js";
44

55
const random = (max: number) => Math.round(Math.random() * 1000) % max;
6-
const A = [
7-
"pretty",
8-
"large",
9-
"big",
10-
"small",
11-
"tall",
12-
"short",
13-
"long",
14-
"handsome",
15-
"plain",
16-
"quaint",
17-
"clean",
18-
"elegant",
19-
"easy",
20-
"angry",
21-
"crazy",
22-
"helpful",
23-
"mushy",
24-
"odd",
25-
"unsightly",
26-
"adorable",
27-
"important",
28-
"inexpensive",
29-
"cheap",
30-
"expensive",
31-
"fancy",
32-
];
6+
const A = ["pretty", "large", "big", "small", "tall", "short", "long", "handsome", "plain", "quaint", "clean", "elegant", "easy", "angry", "crazy", "helpful", "mushy", "odd", "unsightly", "adorable", "important", "inexpensive", "cheap", "expensive", "fancy"];
337
const C = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"];
34-
const N = [
35-
"table",
36-
"chair",
37-
"house",
38-
"bbq",
39-
"desk",
40-
"car",
41-
"pony",
42-
"cookie",
43-
"sandwich",
44-
"burger",
45-
"pizza",
46-
"mouse",
47-
"keyboard",
48-
];
8+
const N = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"];
499

5010
let nextId = 1;
5111
function buildData(count: number): Entry[] {
@@ -104,19 +64,15 @@ interface RowProps {
10464
}
10565

10666
const Row = component<RowProps>((c) => {
107-
const onSelect = () => {
108-
dispatch(c, { type: ActionType.Select, entry: getProps(c).entry });
109-
};
110-
const onRemove = () => {
111-
dispatch(c, { type: ActionType.Remove, entry: getProps(c).entry });
112-
};
67+
const onSelect = () => { dispatch(c, { type: ActionType.Select, entry: getProps(c).entry }); };
68+
const onRemove = () => { dispatch(c, { type: ActionType.Remove, entry: getProps(c).entry }); };
11369
return ({ entry, selected }) => htm`
11470
tr${selected === true ? "danger" : ""}
11571
td.col-md-1 =${entry.id}
11672
td.col-md-4
117-
a.lbl @click=${onSelect} =${entry.label}
73+
a @click=${onSelect} =${entry.label}
11874
td.col-md-1
119-
a.remove @click=${onRemove} span.remove.glyphicon.glyphicon-remove :aria-hidden='true'
75+
a @click=${onRemove} span.glyphicon.glyphicon-remove :aria-hidden='true'
12076
td.col-md-6
12177
`;
12278
});
@@ -130,28 +86,14 @@ const Button = (text: string, id: string, onClick: () => void) => /* preventClon
13086
const App = component((c) => {
13187
const [_state, _dispatch] = useReducer(c, INITIAL_STATE, appStateReducer);
13288

133-
const onDispatch = (ev: CustomEvent<Action>) => {
134-
_dispatch(ev.detail);
135-
};
89+
const onDispatch = (ev: CustomEvent<Action>) => { _dispatch(ev.detail); };
13690
const buttons = [
137-
Button("Create 1,000 rows", "run", () => {
138-
_dispatch({ type: ActionType.Run });
139-
}),
140-
Button("Create 10,000 rows", "runlots", () => {
141-
_dispatch({ type: ActionType.RunLots });
142-
}),
143-
Button("Append 1,000 rows", "add", () => {
144-
_dispatch({ type: ActionType.Add });
145-
}),
146-
Button("Update every 10th row", "update", () => {
147-
_dispatch({ type: ActionType.Update });
148-
}),
149-
Button("Clear", "clear", () => {
150-
_dispatch({ type: ActionType.Clear });
151-
}),
152-
Button("Swap Rows", "swaprows", () => {
153-
_dispatch({ type: ActionType.SwapRows });
154-
}),
91+
Button("Create 1,000 rows", "run", () => { _dispatch({ type: ActionType.Run }); }),
92+
Button("Create 10,000 rows", "runlots", () => { _dispatch({ type: ActionType.RunLots }); }),
93+
Button("Append 1,000 rows", "add", () => { _dispatch({ type: ActionType.Add }); }),
94+
Button("Update every 10th row", "update", () => { _dispatch({ type: ActionType.Update }); }),
95+
Button("Clear", "clear", () => { _dispatch({ type: ActionType.Clear }); }),
96+
Button("Swap Rows", "swaprows", () => { _dispatch({ type: ActionType.SwapRows }); }),
15597
];
15698

15799
return () => {
@@ -164,20 +106,16 @@ const App = component((c) => {
164106
div.col-md-6 div.row ${buttons}
165107
table.table.table-hover.table-striped.test-data
166108
@dispatch=${onDispatch}
167-
${
168-
data.length
169-
? htm`tbody ${List(data, getEntryId, (entry) => Row({ entry, selected: selected === entry.id }))}`
170-
: htm`tbody`
171-
}
109+
${data.length
110+
? htm`tbody ${List(data, getEntryId, (entry) => Row({ entry, selected: selected === entry.id }))}`
111+
: htm`tbody`}
172112
span.preloadicon.glyphicon.glyphicon-remove :aria-hidden='true'
173113
`;
174114
};
175115
});
176116

177117
update(
178118
// Defines a custom root node that disables batching for benchmark.
179-
defineRoot((root) => {
180-
dirtyCheck(root);
181-
})(document.getElementById("main")!),
119+
defineRoot((root) => { dirtyCheck(root); })(document.getElementById("main")!),
182120
App()
183121
);

0 commit comments

Comments
 (0)