Skip to content

Commit b46c41f

Browse files
committed
Import V3 source
1 parent ffba225 commit b46c41f

File tree

241 files changed

+67961
-52095
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

241 files changed

+67961
-52095
lines changed

.gitignore

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
/node_modules/
2-
SCRATCH.md
3-
COMMIT_MSG.aim.txt
1+
node_modules
2+
scratch.md
3+
package-lock.json
4+
dist/

README.ar.md

-960
This file was deleted.

README.ckb.md

-806
This file was deleted.

README.de.md

-795
This file was deleted.

README.es.md

-752
This file was deleted.

README.fa.md

-1,061
This file was deleted.

README.fr.md

-793
This file was deleted.

README.id.md

-802
This file was deleted.

README.ja.md

-551
This file was deleted.

README.ko.md

-783
This file was deleted.

README.md

+29-797
Large diffs are not rendered by default.

README.no.md

-796
This file was deleted.

README.pt.md

-789
This file was deleted.

README.ru.md

-787
This file was deleted.

README.tr.md

-792
This file was deleted.

README.zh-CN.md

-783
This file was deleted.

README.zh-TW.md

-750
This file was deleted.

babel.config.js

-13
This file was deleted.

benchmarks/giant.html

+25,601
Large diffs are not rendered by default.

benchmarks/init.html

+22,142
Large diffs are not rendered by default.

benchmarks/loop.html

+201
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,201 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8" />
5+
<title>Alpine-3-keyed</title>
6+
<link href="/css/currentStyle.css" rel="stylesheet" />
7+
<script src="http://alpine-next.test/packages/alpinejs/dist/cdn.js" defer></script>
8+
<!-- <script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script> -->
9+
</head>
10+
<body>
11+
<div class="container" id="main" x-data="{ data: []}">
12+
<div class="jumbotron">
13+
<div class="row">
14+
<div class="col-md-6">
15+
<h1>Alpine-3-keyed</h1>
16+
</div>
17+
<div class="col-md-6">
18+
<div class="row">
19+
<div class="col-sm-6 smallpad">
20+
<button
21+
type="button"
22+
class="btn btn-primary btn-block"
23+
id="run"
24+
@click="run"
25+
>
26+
Create 1,000 rows
27+
</button>
28+
</div>
29+
<div class="col-sm-6 smallpad">
30+
<button
31+
type="button"
32+
class="btn btn-primary btn-block"
33+
id="runlots"
34+
@click="runLots"
35+
>
36+
Create 10,000 rows
37+
</button>
38+
</div>
39+
<div class="col-sm-6 smallpad">
40+
<button
41+
type="button"
42+
class="btn btn-primary btn-block"
43+
id="add"
44+
@click="add"
45+
>
46+
Append 1,000 rows
47+
</button>
48+
</div>
49+
<div class="col-sm-6 smallpad">
50+
<button
51+
type="button"
52+
class="btn btn-primary btn-block"
53+
id="update"
54+
@click="update"
55+
>
56+
Update every 10th row
57+
</button>
58+
</div>
59+
<div class="col-sm-6 smallpad">
60+
<button
61+
type="button"
62+
class="btn btn-primary btn-block"
63+
id="clear"
64+
@click="clear"
65+
>
66+
Clear
67+
</button>
68+
</div>
69+
<div class="col-sm-6 smallpad">
70+
<button
71+
type="button"
72+
class="btn btn-primary btn-block"
73+
id="swaprows"
74+
@click="swapRows"
75+
>
76+
Swap Rows
77+
</button>
78+
</div>
79+
</div>
80+
</div>
81+
</div>
82+
</div>
83+
<table class="table table-hover table-striped test-data">
84+
<tbody>
85+
<template x-for="item in data" :key="item.id">
86+
<tr :class="item.id === selected ? 'danger' : ''">
87+
<td class="col-md-1" x-text="item.id"></td>
88+
<td class="col-md-4">
89+
<a @click="select(item.id)" x-text="item.label"></a>
90+
</td>
91+
<td class="col-md-1">
92+
<a @click="remove(item.id)" >x</a>
93+
</td>
94+
<td class="col-md-6"></td>
95+
</tr>
96+
</template>
97+
</tbody>
98+
</table>
99+
100+
<span
101+
class="preloadicon glyphicon glyphicon-remove"
102+
aria-hidden="true"
103+
></span>
104+
</div>
105+
106+
<script>
107+
let idCounter = 1;
108+
const adjectives = ["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"],
109+
colours = ["red", "yellow", "blue", "green", "pink", "brown", "purple", "brown", "white", "black", "orange"],
110+
nouns = ["table", "chair", "house", "bbq", "desk", "car", "pony", "cookie", "sandwich", "burger", "pizza", "mouse", "keyboard"];
111+
112+
function _random (max) { return Math.round(Math.random() * 1000) % max; };
113+
114+
function buildData(count) {
115+
let data = new Array(count);
116+
for (let i = 0; i < count; i++) {
117+
data[i] = {
118+
id: idCounter++,
119+
label: `${adjectives[_random(adjectives.length)]} ${colours[_random(colours.length)]} ${nouns[_random(nouns.length)]}`
120+
}
121+
}
122+
return data;
123+
}
124+
125+
function app() {
126+
return {
127+
data: [],
128+
selected: undefined,
129+
130+
add() {
131+
let start = performance.now()
132+
this.data = this.data.concat(buildData(1000))
133+
setTimeout(() => {
134+
console.log(performance.now() - start);
135+
}, 0)
136+
},
137+
clear() {
138+
let start = performance.now()
139+
this.data = [];
140+
this.selected = undefined;
141+
setTimeout(() => {
142+
console.log(performance.now() - start);
143+
}, 0)
144+
},
145+
update() {
146+
let start = performance.now()
147+
for (let i = 0; i < this.data.length; i += 10) {
148+
this.data[i].label += ' !!!';
149+
}
150+
setTimeout(() => {
151+
console.log(performance.now() - start);
152+
}, 0)
153+
},
154+
remove(id) {
155+
let start = performance.now()
156+
const idx = this.data.findIndex(d => d.id === id);
157+
this.data.splice(idx, 1);
158+
setTimeout(() => {
159+
console.log(performance.now() - start);
160+
}, 0)
161+
},
162+
run() {
163+
let start = performance.now()
164+
this.data = buildData(100);
165+
this.selected = undefined;
166+
setTimeout(() => {
167+
console.log(performance.now() - start);
168+
}, 0)
169+
},
170+
runLots() {
171+
let start = performance.now()
172+
this.data = buildData(10000);
173+
this.selected = undefined;
174+
setTimeout(() => {
175+
console.log(performance.now() - start);
176+
}, 0)
177+
},
178+
select(id) {
179+
let start = performance.now()
180+
this.selected = id
181+
setTimeout(() => {
182+
console.log(performance.now() - start);
183+
}, 0)
184+
},
185+
swapRows() {
186+
let start = performance.now()
187+
const d = this.data;
188+
if (d.length > 998) {
189+
const tmp = d[998];
190+
d[998] = d[1];
191+
d[1] = tmp;
192+
}
193+
setTimeout(() => {
194+
console.log(performance.now() - start);
195+
}, 0)
196+
}
197+
}
198+
}
199+
</script>
200+
</body>
201+
</html>

benchmarks/memory.html

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<html>
2+
<script src="http://alpine-next.test/packages/alpinejs/dist/cdn.js" defer></script>
3+
4+
<div x-data="{ items: [] }">
5+
<template x-for="item in items">
6+
<h1>hi</h1>
7+
</template>
8+
9+
<button @click="items.length === 0 ? items.push('ggoo') : items = []" x-text="'ghjghj'">delete</button>
10+
</div>
11+
12+
<script>
13+
function remove() {
14+
document.querySelector('span').remove()
15+
}
16+
</script>
17+
</html>

benchmarks/mutation_observer.html

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
<html lang="en">
2+
<head>
3+
<meta charset="UTF-8">
4+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>Document</title>
7+
<script>
8+
let mutations = []
9+
10+
let pauseCollection = false
11+
12+
function reverseMutation(mutation) {
13+
let table = {
14+
characterData: () => {
15+
mutation.target.textContent = mutation.oldValue
16+
},
17+
attributes: () => {
18+
if (! mutation.oldValue) {
19+
mutation.target.removeAttribute(mutation.attributeName)
20+
return
21+
}
22+
23+
mutation.target.setAttribute(mutation.attributeName, mutation.oldValue)
24+
},
25+
childList: () => {
26+
if (mutation.removedNodes) {
27+
let parent = mutation.target
28+
}
29+
}
30+
}
31+
32+
console.log(mutation);
33+
table[mutation.type]()
34+
}
35+
36+
function reverse() {
37+
pauseCollection = true
38+
39+
while (mutations.length > 0) reverseMutation(mutations.pop())
40+
41+
pauseCollection = false
42+
}
43+
44+
document.addEventListener('DOMContentLoaded', () => {
45+
let observer = new MutationObserver(imutations => {
46+
if (pauseCollection) return
47+
48+
imutations.forEach(i => mutations.push(i))
49+
50+
console.log(imutations);
51+
})
52+
53+
observer.observe(document.body, { characterData: true, attributeOldValue: true, characterDataOldValue: true, childList: true, subtree: true, attributes: true })
54+
})
55+
</script>
56+
</head>
57+
<body>
58+
<div>
59+
<h1 foo="bar">yo</h1>
60+
<h1>there</h1>
61+
62+
<button>this is cool</button>
63+
</div>
64+
</body>
65+
</html>

cypress.json

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"ignoreTestFiles": "*.html",
3+
"screenshotOnRunFailure": false,
4+
"video": false,
5+
"fixturesFolder": "tests/cypress/fixtures",
6+
"integrationFolder": "tests/cypress/integration",
7+
"pluginsFile": "tests/cypress/plugins/index.js",
8+
"screenshotsFolder": "tests/cypress/screenshots",
9+
"videosFolder": "tests/cypress/videos",
10+
"supportFile": "tests/cypress/support/index.js"
11+
}

0 commit comments

Comments
 (0)