{"_id":"@7syllable/photon-core","name":"@7syllable/photon-core","dist-tags":{"latest":"0.18.1"},"versions":{"0.18.1":{"name":"@7syllable/photon-core","version":"0.18.1","description":"Photon is a modern JavaScript library for creating and sharing modular line drawings for CNC and laser cutters. Resurrected from Microsoft's Maker.js.","type":"module","main":"dist/photon.umd.js","module":"dist/photon.es.js","types":"dist/types/index.d.ts","exports":{".":{"types":"./dist/types/index.d.ts","import":"./dist/photon.es.js","require":"./dist/photon.umd.js","default":"./dist/photon.umd.js"},"./dist/*":"./dist/*"},"scripts":{"build-debug":"tsc","build-model-schema":"typescript-json-schema \"src/core/schema.ts\" Photon.IModel > schemas/photon-model.json","build-schemas":"npm run build-model-schema","project":"typedoc ./src --json ./dist/project.json","gen-cascades":"npm run project && node ./target/cascadable.js > ./src/core/cascades.ts","prebuild":"npm run gen-cascades","build":"npm run build:types && npm run build:lib","build:types":"tsc -p target/tsconfig.esm.json","build:lib":"vite build","dev:lib":"vite","test":"npm run build && mocha --timeout 15000","prepublish":"node ./target/prepublish.js"},"maintainers":[{"name":"7syllable","email":"mwhite454@gmail.com"}],"repository":{"type":"git","url":"git+https://github.com/mwhite454/photon.git"},"keywords":["Photon","CAD","2D","3D","OpenJScad","OpenSCAD","vector","drawing","point","points","path","model","arc","circle","line","triangle","outline","bezier","quadratic","cubic","curve","ellipse","polygon","rectangle","square","star","dome","bolt","holes","oval","belt","ring","slot","kerf","shape","font","geometry","trigonometry","boolean","chain","distort","dogbone","fillet","intsersect","intsersection","measure","mirror","rotate","scale","SVG","STL","DXF","CNC","PDF","laser","plasma","cutter","water jet"],"author":{"name":"Myka White"},"license":"Apache-2.0","bugs":{"url":"https://github.com/mwhite454/photon/issues"},"homepage":"https://github.com/mwhite454/photon","devDependencies":{"@jscad/csg":"^0.3.7","@jscad/stl-serializer":"^0.1.0","@types/graham_scan":"^1.0.28","dxf-parser-typings":"^1.3.0"},"dependencies":{"@danmarshall/jscad-typings":"^1.0.0","@types/bezier-js":"^0.0.7","@types/node":"^7.0.5","@types/opentype.js":"^0.7.0","@types/pdfkit":"^0.7.34","bezier-js":"^6.1.4","clone":"^1.0.2","graham_scan":"^1.0.5","kdbush":"^4.0.2"},"_id":"@7syllable/photon-core@0.18.1","gitHead":"8d9229f7afd829bf1cb39cc0fb71692429624792","_nodeVersion":"20.13.1","_npmVersion":"10.5.2","dist":{"integrity":"sha512-zZ7z5cFJNE9cMM/Xe/WeT9b74dDUUk9RXZcDgHqCrsvmgmItAXc7omeC6PyFAW0IE3FPhDWdGwg99Of6u3TOgg==","shasum":"7164c2c4e7fc61a83adb60d3d5f1e9a6aac8adc5","tarball":"https://registry.npmjs.org/@7syllable/photon-core/-/photon-core-0.18.1.tgz","fileCount":68,"unpackedSize":1776855,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGG3ObuaWn92840eaQr4bB7ZzdvwCSHi+2SZ9N60idK7AiEAz8S4aRbbdbbG8PCVxTpzFUxkcK3vXCNtGVWpInvKWUI="}]},"_npmUser":{"name":"7syllable","email":"mwhite454@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/photon-core_0.18.1_1760535057800_0.7938770538610442"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-15T13:30:57.616Z","0.18.1":"2025-10-15T13:30:58.066Z","modified":"2025-10-15T13:30:58.398Z"},"maintainers":[{"name":"7syllable","email":"mwhite454@gmail.com"}],"description":"Photon is a modern JavaScript library for creating and sharing modular line drawings for CNC and laser cutters. Resurrected from Microsoft's Maker.js.","homepage":"https://github.com/mwhite454/photon","keywords":["Photon","CAD","2D","3D","OpenJScad","OpenSCAD","vector","drawing","point","points","path","model","arc","circle","line","triangle","outline","bezier","quadratic","cubic","curve","ellipse","polygon","rectangle","square","star","dome","bolt","holes","oval","belt","ring","slot","kerf","shape","font","geometry","trigonometry","boolean","chain","distort","dogbone","fillet","intsersect","intsersection","measure","mirror","rotate","scale","SVG","STL","DXF","CNC","PDF","laser","plasma","cutter","water jet"],"repository":{"type":"git","url":"git+https://github.com/mwhite454/photon.git"},"author":{"name":"Myka White"},"bugs":{"url":"https://github.com/mwhite454/photon/issues"},"license":"Apache-2.0","readme":"# Photon\n\nYour compass and straightedge, in JavaScript.\n\nCreate line drawings using familiar constructs from geometry and drafting. Initially designated for CNC and laser cutters, Photon can also help you programmatically draw shapes for any purpose. It runs in both Node.js and web browsers.\n\n2D Export formats: \n[DXF](https://maker.js.org/docs/api/modules/makerjs.exporter.html#todxf), \n[SVG](https://maker.js.org/docs/api/modules/makerjs.exporter.html#tosvg),\n[PDF](https://maker.js.org/docs/api/modules/makerjs.exporter.html#topdf),\n[Jscad CAG object](https://maker.js.org/docs/api/modules/makerjs.exporter.html#tojscadcag)\n\n3D Export formats:\n[Jscad Script](https://maker.js.org/docs/api/modules/makerjs.exporter.html#tojscadscript),\n[Jscad CSG object](https://maker.js.org/docs/api/modules/makerjs.exporter.html#tojscadcsg),\n[STL](https://maker.js.org/docs/api/modules/makerjs.exporter.html#tojscadstl)\n\n[Demos](https://maker.js.org/demos/) - [Documentation](http://maker.js.org/docs/)\n\n![Sample animation](https://maker.js.org/images/anim-wheel.gif)\n\n## Origins\n\nPhoton is a modern continuation of Microsoft's Maker.js project. When Microsoft archived the original Maker.js repository, we forked it to ensure this valuable tool continues to evolve and serve the maker community.\n\n**Original Project**: [Microsoft Maker.js](https://github.com/Microsoft/maker.js) (archived)  \n**License**: Apache 2.0  \n**Original Author**: Dan Marshall / Microsoft Corporation\n\nWe're grateful to Microsoft and the original contributors for creating and open-sourcing this excellent library. Photon maintains full backward compatibility while adding modern features and active maintenance.\n\n## Core concepts\n\n* [paths](https://maker.js.org/docs/basic-drawing/#Paths) - The primitive elements of a drawing are lines, arcs, and circles.\n* [models](https://maker.js.org/docs/basic-drawing/#Models) - Groups of paths to compose a shape.\n* [layers](https://maker.js.org/docs/advanced-drawing/#Layers) - Organization of models, such as by color or tool type.\n* [chains](https://maker.js.org/docs/working-with-chains/#content) - A series of lines and arcs that connect end-to-end continuously.\n\nLearn more in [the tutorial](https://maker.js.org/docs/basic-drawing/) or [API documentation](https://maker.js.org/docs/api/).\n\n## Features\n\n* Drawings are a [simple JavaScript object](https://maker.js.org/docs/basic-drawing/#It%27s%20Just%20JSON) which can be serialized / deserialized conventionally with JSON. This also makes a drawing easy to [clone](https://maker.js.org/docs/intermediate-drawing/#Cloning).\n\n* Other people's Models can be required the Node.js way, [modified](https://maker.js.org/docs/intermediate-drawing/#Modifying%20models), and re-exported.\n\n* Models can be [scaled](https://maker.js.org/docs/intermediate-drawing/#Scaling), [distorted](https://maker.js.org/docs/intermediate-drawing/#Distorting), [measured](https://maker.js.org/docs/api/modules/makerjs.measure.html#modelextents), and [converted to different unit systems](https://maker.js.org/docs/basic-drawing/#Units).\n\n* Paths can be [distorted](https://maker.js.org/docs/api/modules/makerjs.path.html#distort).\n\n* Models can be [rotated](https://maker.js.org/docs/intermediate-drawing/#Rotating) or [mirrored](https://maker.js.org/docs/intermediate-drawing/#Mirroring).\n\n* Find [intersection points or intersection angles](https://maker.js.org/docs/intermediate-drawing/#Intersection) of paths.\n\n* [Traverse a model tree](https://maker.js.org/docs/model-trees/#content) to reason over its children.\n\n* Detect [chains](https://maker.js.org/docs/api/modules/makerjs.model.html#findchains) formed by paths connecting end to end.\n\n* Get the [points along a path](https://maker.js.org/docs/api/modules/makerjs.path.html#topoints) or along a [chain of paths](https://maker.js.org/docs/api/modules/makerjs.chain.html#topoints).\n\n* Easily add a curvature at the joint between any 2 paths, using a [traditional or a dogbone fillet](https://maker.js.org/docs/intermediate-drawing/#Fillets).\n\n* [Combine models](https://maker.js.org/docs/advanced-drawing/#Combining%20with%20Boolean%20operations) with boolean operations to get unions, intersections, or punches.\n\n* [Expand paths](https://maker.js.org/docs/advanced-drawing/#Expanding%20paths) to simulate a stroke thickness, with the option to bevel joints.\n\n* [Outline model](https://maker.js.org/docs/advanced-drawing/#Outlining%20a%20model) to create a surrounding outline, with the option to bevel joints.\n\n* Layout clones into [rows](http://maker.js.org/docs/api/modules/makerjs.layout.html#clonetorow), [columns](https://maker.js.org/docs/api/modules/makerjs.layout.html#clonetocolumn), [grids](https://maker.js.org/docs/api/modules/makerjs.layout.html#clonetogrid), [bricks](https://maker.js.org/docs/api/modules/makerjs.layout.html#clonetobrick), or [honeycombs](https://maker.js.org/docs/api/modules/makerjs.layout.html#clonetohoneycomb)\n\n#### Built-in models\n\n* [Belt](https://maker.js.org/playground/?script=Belt)\n* [Bezier Curve](https://maker.js.org/playground/?script=BezierCurve)\n* [Bolt Circle](https://maker.js.org/playground/?script=BoltCircle)\n* [Bolt Rectangle](https://maker.js.org/playground/?script=BoltRectangle)\n* [Connect the dots](https://maker.js.org/playground/?script=ConnectTheDots)\n* [Dogbone](https://maker.js.org/playground/?script=Dogbone)\n* [Dome](https://maker.js.org/playground/?script=Dome)\n* [Ellipse](https://maker.js.org/playground/?script=Ellipse)\n* [Elliptic Arc](https://maker.js.org/playground/?script=EllipticArc)\n* [Holes](https://maker.js.org/playground/?script=Holes)\n* [Oval](https://maker.js.org/playground/?script=Oval)\n* [OvalArc](https://maker.js.org/playground/?script=OvalArc)\n* [Polygon](https://maker.js.org/playground/?script=Polygon)\n* [Rectangle](https://maker.js.org/playground/?script=Rectangle)\n* [Ring](https://maker.js.org/playground/?script=Ring)\n* [RoundRectangle](https://maker.js.org/playground/?script=RoundRectangle)\n* [S curve](https://maker.js.org/playground/?script=SCurve)\n* [Slot](https://maker.js.org/playground/?script=Slot)\n* [Square](https://maker.js.org/playground/?script=Square)\n* [Star](https://maker.js.org/playground/?script=Star)\n* [Text](https://maker.js.org/playground/?script=Text)\n\n#### Import formats\n\n* [Fonts](https://maker.js.org/playground/?script=Text) (Requires [opentype.js](https://opentype.js.org/))\n* [SVG Path Data](https://maker.js.org/docs/importing/#SVG+path+data)\n* [SVG Points](https://maker.js.org/docs/importing/#SVG+points)\n\n## Getting Started\n\n### Installation\n\nInstall Photon via npm:\n\n```bash\nnpm install @photon/core\n```\n\n### Usage in Node.js\n\nIn ESM code (recommended):\n\n```js\nimport * as photon from '@photon/core';\n\n// Create a simple rectangle\nconst rect = new photon.models.Rectangle(100, 50);\n\n// Export to SVG\nconst svg = photon.exporter.toSVG(rect);\n```\n\nIn CommonJS code:\n\n```js\nconst photon = require('@photon/core');\n\n// Create a simple rectangle\nconst rect = new photon.models.Rectangle(100, 50);\n```\n\n### Usage in Web Browser\n\nUse the ES module build (recommended):\n\n```html\n<script type=\"module\">\n  import * as photon from \"https://cdn.jsdelivr.net/npm/@photon/core@latest/dist/photon.es.js\";\n  \n  // Create a simple star\n  const star = new photon.models.Star(5, 50, 25);\n  const svg = photon.exporter.toSVG(star);\n  document.body.innerHTML = svg;\n</script>\n```\n\nOr use the UMD bundle for a global `Photon` variable:\n\n```html\n<script src=\"https://cdn.jsdelivr.net/npm/@photon/core@latest/dist/photon.umd.js\"></script>\n<script>\n  const { models, paths, exporter } = window.Photon;\n  const circle = new models.Circle([0, 0], 50);\n</script>\n```\n\n### CDN Links\n\n- ES module: `https://cdn.jsdelivr.net/npm/@photon/core@latest/dist/photon.es.js`\n- UMD global: `https://cdn.jsdelivr.net/npm/@photon/core@latest/dist/photon.umd.js`\n\nOptional dependencies:\n\n```html\n<!-- Bezier support (required for BezierCurve model) -->\n<script src=\"https://cdn.jsdelivr.net/npm/bezier-js@2/bezier.js\"></script>\n\n<!-- Font support for Text model -->\n<script src=\"https://cdn.jsdelivr.net/npm/opentype.js@0/dist/opentype.js\"></script>\n```\n\n### Try it now\n\nVisit the [Photon Playground](https://maker.js.org/playground/) to edit and run JavaScript from your browser.\n\nEach of the [demos](https://maker.js.org/demos/#content) will also open in the playground so that you can explore and modify their code.\n\n## Migrating from Maker.js\n\nPhoton maintains API compatibility with Maker.js. To migrate:\n\n1. **Update package name**:\n   ```bash\n   npm uninstall makerjs\n   npm install @photon/core\n   ```\n\n2. **Update imports**:\n   ```js\n   // Old (Maker.js)\n   import * as makerjs from 'makerjs';\n   \n   // New (Photon)\n   import * as photon from '@photon/core';\n   ```\n\n3. **Update variable names** (optional but recommended):\n   ```js\n   // Old\n   const rect = new makerjs.models.Rectangle(100, 50);\n   const svg = makerjs.exporter.toSVG(rect);\n   \n   // New\n   const rect = new photon.models.Rectangle(100, 50);\n   const svg = photon.exporter.toSVG(rect);\n   ```\n\n4. **Update global namespace** (if using UMD/browser builds):\n   - Old: `window.MakerJs` or `window.makerjs`\n   - New: `window.Photon`\n\nAll APIs, models, and functionality remain the same. The core library is fully compatible.\n\n## Contributing\n\nThere are many ways to contribute to Photon:\n* [★ Star Photon on GitHub](https://github.com/mwhite454/photon)\n* Submit bugs and feature requests [on GitHub](https://github.com/mwhite454/photon/issues)\n* Create a demo for the [gallery](http://maker.js.org/demos/#content)\n* Create lessons or videos for the [documentation](http://maker.js.org/docs/#content)\n* Enhance the [website](https://github.com/mwhite454/photon/tree/gh-pages)\n* Add features to the [Playground app](https://maker.js.org/playground/)\n* Create a new Photon app, and we will link to it here\n* Find TODOs in the [core source code](https://github.com/mwhite454/photon/tree/main/packages/photon/src)\n* Create unit tests for the core\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n### Credits\n\nPhoton depends on:\n* [bezier-js](https://github.com/Pomax/bezierjs) by Pomax\n* [graham_scan](https://github.com/brian3kb/graham_scan_js) by Brian Barnett\n* [kdbush](https://github.com/mourner/kdbush) by Vladimir Agafonkin\n\n---\n\n**Original Project**: Maker.js was a Microsoft Garage project. We're grateful to Microsoft and Dan Marshall for creating and open-sourcing this excellent library under the Apache 2.0 license.\n","readmeFilename":"README.md","_rev":"1-f7ae9a7d02b8361a5cce2ec6adfba3e4"}