Skip to content

Commit f9e0059

Browse files
author
Zaydek Michels-Gualtieri
committed
Upgraded dependencies to "latest"
1 parent 66cc51d commit f9e0059

5 files changed

Lines changed: 2295 additions & 2797 deletions

File tree

notes/notes-2.js

Whitespace-only changes.

notes/notes.js

Lines changed: 0 additions & 90 deletions
This file was deleted.

package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22
"name": "codex-wysiwyg",
33
"dependencies": {
44
"emoji-trie": "https://github.com/codex-src/emoji-trie.js",
5-
"lodash": "^4.17.19",
6-
"react": "next",
7-
"react-dom": "next",
8-
"react-scripts": "next",
9-
"use-immer": "^0.4.1",
10-
"uuidv4": "^6.1.0"
5+
"lodash": "latest",
6+
"react": "latest",
7+
"react-dom": "latest",
8+
"react-scripts": "latest",
9+
"use-immer": "latest",
10+
"uuidv4": "latest"
1111
},
1212
"scripts": {
1313
"tailwind-start": "tailwind build -c src/tailwind-css/js/tailwind.config.js -o src/tailwind-css/css/tailwind.generated.css",
@@ -33,9 +33,9 @@
3333
]
3434
},
3535
"devDependencies": {
36-
"@tailwindcss/ui": "^0.4.0",
36+
"@tailwindcss/ui": "latest",
3737
"debug.css": "https://github.com/codex-src/debug.css",
38-
"serve": "^11.3.2",
39-
"tailwindcss": "^1.6.2"
38+
"serve": "latest",
39+
"tailwindcss": "latest"
4040
}
4141
}

src/Editor/components/toReactTree2/notes.js

Lines changed: 193 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,199 @@ function fn(children) {
102102
// ...
103103
}
104104

105+
// function doSomething(children) {
106+
// const cloned = JSONClone(children)
107+
// for (let x1 = 0; x1 < children.length; x1++) {
108+
// for (let x2 = x1; x2 < children.length; x2++) {
109+
// // ...
110+
// }
111+
// // recurse?
112+
// }
113+
// // iterate?
114+
// }
115+
116+
const children = [
117+
{
118+
types: {
119+
code: {},
120+
},
121+
props: {
122+
children: "aaa"
123+
},
124+
},
125+
{
126+
types: {
127+
code: {},
128+
strong: {},
129+
},
130+
props: {
131+
children: "bbb",
132+
},
133+
},
134+
{
135+
types: {
136+
code: {},
137+
strong: {},
138+
strong: {},
139+
},
140+
props: {
141+
children: "ccc",
142+
},
143+
},
144+
{
145+
types: {
146+
code: {},
147+
strong: {},
148+
},
149+
props: {
150+
children: "ddd",
151+
},
152+
},
153+
{
154+
types: {
155+
code: {},
156+
},
157+
props: {
158+
children: "eee"
159+
},
160+
},
161+
]
162+
163+
function JSONEqual(v1 , v2) {
164+
const ok = (
165+
JSON.stringify(v1) === JSON.stringify(v2)
166+
)
167+
return ok
168+
}
169+
170+
// Returns whether types have one or more types in common.
171+
function hasOneOrMoreTypesInCommon(types1, types2) {
172+
return Object.keys(types1).some(each => JSONEqual(types1[each], types2[each]))
173+
174+
// for (const each of Object.keys(types1)) {
175+
// if (types2[each] && JSONEqual(types1[each], types2[each])) {
176+
// return true
177+
// }
178+
// }
179+
// return false
180+
}
181+
182+
// aaa
183+
// -> bbb
184+
// -> -> ccc
185+
// -> ddd
186+
// eee
187+
188+
// // Emits an <AnyList> element.
189+
// function emitAnyList(range) {
190+
// const { parent } = parseMetadata(range[0])
191+
// const element = {
192+
// ...parent,
193+
// children: [],
194+
// }
195+
// for (const each of range) {
196+
// const { matches, parent, ...etc } = parseMetadata(each)
197+
// const [, tabs, syntax] = matches
198+
// let ref = element.children
199+
// for (let x = 0; x < tabs.length; x++) {
200+
// if (!ref.length || ref[ref.length - 1].type !== typeEnum.AnyList) {
201+
// ref.push({
202+
// ...parent,
203+
// children: [],
204+
// })
205+
// }
206+
// ref = ref[ref.length - 1].children
207+
// }
208+
// ref.push({
209+
// ...etc,
210+
// syntax: [tabs + syntax],
211+
// children: parseInlineElements(each.data.slice((tabs + syntax).length)),
212+
// })
213+
// }
214+
// return element
215+
// }
216+
217+
// find the longest chain
218+
// recurse on the contents of the chain, **excluding the
219+
// types the longest has in common**?
220+
221+
function render(children, types) {
222+
const tree = {}
223+
for (const each of types) {
224+
Object.assign(tree, {
225+
...children, // ??
226+
type: each,
227+
props: {
228+
....children.props,
229+
},
230+
})
231+
}
232+
return tree
233+
}
234+
235+
function (children, ctx) {
236+
let tree = []
237+
for () {
238+
for () {
239+
const common = getCommonTypes(children, ctx)
240+
if (!common) {
241+
tree.push(render())
242+
} else {
243+
tree.push(recurse(common))
244+
}
245+
}
246+
}
247+
return tree
248+
}
249+
250+
function fn(children) {
251+
let x1 = 0
252+
for (; x1 < children.length; x1++) {
253+
let x2 = x1 + 1
254+
for (; x2 < children.length; x2++) {
255+
if (!hasOneOrMoreTypesInCommon(children[x1].types, children[x2].types)) {
256+
// No-op
257+
break
258+
}
259+
}
260+
x1 = x2
261+
console.log({ x1 })
262+
}
263+
}
264+
265+
fn(children)
266+
267+
// let x = 1
268+
// for (; x < children.length; x++) {
269+
// if (!hasOneOrMoreTypesInCommon(children[0].types, children[x].types)) {
270+
// // No-op
271+
// break
272+
// }
273+
// }
274+
// if (children.slice(1, x).length) {
275+
// fn(children.slice(1, x))
276+
// }
277+
// console.log(children.slice(0, x))
278+
}
279+
280+
fn(children)
281+
282+
// function doSomething(children, typesCtx = {}) {
283+
// for (let x = 0; x < children.length - 1; x++) {
284+
// if (x + 1 < children.length - 1) {
285+
// if (!JSONEqual(children[x], children[x + 1])) {
286+
// render(children[x])
287+
// // recurse(children.slice(x + 1))
288+
// }
289+
// }
290+
// }
291+
// }
292+
293+
// function typesAreStrictlyCommon(types1, types2) {
294+
// return JSONEqual(types1, types2)
295+
// }
296+
297+
105298
// Stress test
106299

107300
// - code

0 commit comments

Comments
 (0)