tdecker91 / puzzle-gen Goto Github PK
View Code? Open in Web Editor NEWGenerate Full 3D pictures of WCA twisty puzzles! (Rubiks cube, Pyraminx, Skewb, Megaminx, Square1 image generator)
License: Apache License 2.0
Generate Full 3D pictures of WCA twisty puzzles! (Rubiks cube, Pyraminx, Skewb, Megaminx, Square1 image generator)
License: Apache License 2.0
Trying to use this library in a svelte component, getting an error from inside the dist:
Cannot use import statement outside a module
/home/trexrush/dev/personal/cubing/node_modules/.pnpm/[email protected]/node_modules/sr-puzzlegen/dist/lib/index.js:1
import { TurnType } from "./algorithms/algorithm";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1027:15)
at Module._compile (node:internal/modules/cjs/loader:1063:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:170:29)
at ModuleJob.run (node:internal/modules/esm/module_job:198:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:385:24)
relevant code:
import { CubeOptions, PNG, Type } from "sr-puzzlegen"
// ...
const newImage = (node: HTMLElement) => {
let type: Type = Type.CUBE_TOP
PNG(node, type, {})
return {
destroy(){}
}
}
//...
<div use:newImage />
same error occurs without a use directive too.
edit: code is irrelevent, the mere act of importing causes the issue
initial google search yields this SO post, which suggests:
package.json
, which my app already was, but the nearest parent package.json is the one for puzzle-gen, and this library does not use type: modulethough since the package is a commonJS package, alternatively publish as both cjs and esm? or just explicitly define the package as a cjs module
do you have any ideas here? This is the only library with a megaminx visualization that fits my use case, I have until now been using your visualcube fork sr-visualizer
which doesnt have this issue.
im not too familiar with dealing with dependencies in the js environment, so apologies if this isnt framed correctly.
Eg this. A Pyraminx with size 4 and Alg R and Case L => but shows a solved pyramid?
Tested on your test site [https://tdecker91.github.io/puzzlegen-demo/](tdeck91 Demo)
`let type = "pyraminx";
let options = {
"width": 500,
"height": 500,
"puzzle": {
"alg": "R",
"case": "L",
"size": 4
}
For OLL cases where the edges are all oriented, there are 7 possible cases, and above is one of them (commonly named "U" OCLL). The full 7 OCLL names would be U, T, L, H, Pi, S, AS. There can be 4 possible angles for this but they're relatively the same, so accounting for a U/U'/U2 turns from that position, an OCLL can have 4 different angles, and working from there, the 7 initial OCLL states can be expanded to 7 * 4 = 28 shapes.
Is it possible for PuzzleGen to output some kind of text/ store some text in a variable that shows what OCLL cases you generated? Strictly for the oriented edges case, so we can just check the color of the corners that faces up. Like for example,
Will something like that be possible to implement? Thank you for your time for this!
Best,
Adi
Add the ability to overlay text over stickers.
This should be possible in svg mode. Probably also in canvas mode. This would be useful for adding labels to pieces besides just arrows.
Any chance we can port this package to PHP? I know there's https://github.com/Cride5/visualcube already, but it kinda seems abandoned AND this library has way more features.
I'd be willing to kickstart this...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.