1
0

Compare commits

..

10 Commits

Author SHA1 Message Date
13a40d750e Footprints I used for my keyboards
See https://github.com/tgrosinger/keyboards
2023-12-27 20:29:10 -08:00
Bán Dénes
14cd499182 4.0.4 2023-05-20 22:07:22 +02:00
Bán Dénes
7baa6a3b3a 4.0.3 2023-05-20 22:03:21 +02:00
Bán Dénes
9f644c2e2b Independent per-point adjustment 2023-05-20 22:03:21 +02:00
Bán Dénes
9832489d41
Sponsor fixes 2023-05-08 18:46:26 +02:00
Bán Dénes
89981199d9
Initial list of distinguished sponsors 2023-05-08 17:42:43 +02:00
Bán Dénes
63684e33d7
Add donate button to readme 2023-05-01 13:37:48 +02:00
Bán Dénes
d74f657f24
Add sponsorship button 2023-05-01 13:25:16 +02:00
Bán Dénes
daaef0af79 4.0.2 2023-03-18 16:24:47 +01:00
Bán Dénes
4d65eb19a6 Filter negation bugfix 2023-03-18 16:23:05 +01:00
24 changed files with 1361 additions and 97 deletions

13
.github/FUNDING.yml vendored Normal file
View File

@ -0,0 +1,13 @@
# These are supported funding model platforms
github: [mrzealot] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']

View File

@ -24,6 +24,7 @@ The project aims to provide a common configuration format to describe ***ergonom
[![Button WebUI]][WebUI] [![Button WebUI]][WebUI]
[![Button Documentation]][Documentation] [![Button Documentation]][Documentation]
[![Button Discord]][Discord] [![Button Discord]][Discord]
[![Button Donate]][Donate]
--- ---
@ -79,6 +80,17 @@ Get in touch on our **[Discord]**, and we can definitely find something you can
<br> <br>
## Sponsors
Huge thanks go to everyone who chooses to support my work!
But even huger thanks are due to the following, *distinguished* sponsors:
- [perce](https://madebyperce.com/)
- [Cache](https://github.com/MvEerd)
- [Neil Gilmour](https://github.com/neilgilmour)
- [ochief](https://github.com/ochief)
- [Alyx Brett](https://github.com/alyx-brett)
<!-----------------------------------------------------------------------------> <!----------------------------------------------------------------------------->
[Absolem keyboard]: https://zealot.hu/absolem [Absolem keyboard]: https://zealot.hu/absolem
@ -87,6 +99,7 @@ Get in touch on our **[Discord]**, and we can definitely find something you can
[WebUI]: https://ergogen.xyz [WebUI]: https://ergogen.xyz
[Unofficial]: https://ergogen.cache.works/ [Unofficial]: https://ergogen.cache.works/
[Topic]: https://github.com/topics/ergogen [Topic]: https://github.com/topics/ergogen
[Donate]: https://github.com/sponsors/mrzealot
<!--------------------------------{ Buttons }----------------------------------> <!--------------------------------{ Buttons }---------------------------------->
@ -95,3 +108,4 @@ Get in touch on our **[Discord]**, and we can definitely find something you can
[Button Official]: https://img.shields.io/badge/Official-37a779?style=for-the-badge [Button Official]: https://img.shields.io/badge/Official-37a779?style=for-the-badge
[Button Documentation]: https://img.shields.io/badge/Documentation-1793D1?style=for-the-badge&logoColor=white&logo=GitBook [Button Documentation]: https://img.shields.io/badge/Documentation-1793D1?style=for-the-badge&logoColor=white&logo=GitBook
[Button Discord]: https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logoColor=white&logo=Discord [Button Discord]: https://img.shields.io/badge/Discord-5865F2?style=for-the-badge&logoColor=white&logo=Discord
[Button Donate]: https://img.shields.io/badge/Donate-EA4AAA?style=for-the-badge&logoColor=white&logo=githubsponsors

4
package-lock.json generated
View File

@ -1,12 +1,12 @@
{ {
"name": "ergogen", "name": "ergogen",
"version": "4.0.1", "version": "4.0.4",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "ergogen", "name": "ergogen",
"version": "4.0.1", "version": "4.0.4",
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fs-extra": "^11.1.0", "fs-extra": "^11.1.0",

View File

@ -1,6 +1,6 @@
{ {
"name": "ergogen", "name": "ergogen",
"version": "4.0.1", "version": "4.0.4",
"description": "Ergonomic keyboard layout generator", "description": "Ergonomic keyboard layout generator",
"author": "Bán Dénes <mr@zealot.hu>", "author": "Bán Dénes <mr@zealot.hu>",
"license": "MIT", "license": "MIT",

View File

@ -15,7 +15,7 @@
### Minor ### Minor
- Support "direct" anchors, as in, recognize num arrays and parse them as x/y/r - Support "direct" anchors, as in, recognize num arrays and parse them as x/y/r
- Add full anchor support to individual points (via `adjust`, probably) - Add `origin` to zone-wide and global rotation in points
- Handle unnecessary (but seemingly consistent, so easy to confuse) `key` subfield of row-level overrides - Handle unnecessary (but seemingly consistent, so easy to confuse) `key` subfield of row-level overrides
- Allow footprints to access raw array/object fields from points with templating - Allow footprints to access raw array/object fields from points with templating
- Include raw kicad footprint integrations - Include raw kicad footprint integrations

View File

@ -9,9 +9,8 @@ const _false = () => false
const _and = arr => p => arr.map(e => e(p)).reduce((a, b) => a && b) const _and = arr => p => arr.map(e => e(p)).reduce((a, b) => a && b)
const _or = arr => p => arr.map(e => e(p)).reduce((a, b) => a || b) const _or = arr => p => arr.map(e => e(p)).reduce((a, b) => a || b)
const similar = (key, reference, name, units) => { const similar = (keys, reference, name, units) => {
let neg = false let neg = false
if (reference.startsWith('-')) { if (reference.startsWith('-')) {
neg = true neg = true
reference = reference.slice(1) reference = reference.slice(1)
@ -20,15 +19,19 @@ const similar = (key, reference, name, units) => {
// support both string or regex as reference // support both string or regex as reference
let internal_tester = val => (''+val) == reference let internal_tester = val => (''+val) == reference
if (reference.startsWith('/')) { if (reference.startsWith('/')) {
try {
const regex_parts = reference.split('/') const regex_parts = reference.split('/')
regex_parts.shift() // remove starting slash regex_parts.shift() // remove starting slash
const flags = regex_parts.pop() const flags = regex_parts.pop()
const regex = new RegExp(regex_parts.join('/'), flags) const regex = new RegExp(regex_parts.join('/'), flags)
internal_tester = val => regex.test(''+val) internal_tester = val => regex.test(''+val)
} catch (ex) {
throw new Error(`Invalid regex "${reference}" found at filter "${name}"!`)
}
} }
// support strings, arrays, or objects as key // support strings, arrays, or objects as key
const external_tester = point => { const external_tester = (point, key) => {
const value = u.deep(point, key) const value = u.deep(point, key)
if (a.type(value)() == 'array') { if (a.type(value)() == 'array') {
return value.some(subkey => internal_tester(subkey)) return value.some(subkey => internal_tester(subkey))
@ -39,11 +42,12 @@ const similar = (key, reference, name, units) => {
} }
} }
// negation happens at the end // consider negation
if (neg) { if (neg) {
return point => !external_tester(point) return point => keys.every(key => !external_tester(point, key))
} else {
return point => keys.some(key => external_tester(point, key))
} }
return external_tester
} }
const comparators = { const comparators = {
@ -75,7 +79,7 @@ const simple = (exp, name, units) => {
value = exp value = exp
} }
return point => keys.some(key => comparators[op](key, value, name, units)(point)) return point => comparators[op](keys, value, name, units)(point)
} }
const complex = (config, name, units, aggregator=_or) => { const complex = (config, name, units, aggregator=_or) => {

View File

@ -0,0 +1,95 @@
module.exports = {
nets: {
neg: undefined,
pos: undefined,
},
body: p => `
(module BatteryPads
(layer "F.Cu")
${p.at /* parametric position */}
${'' /* TODO: Does not yet support rotation */}
(fp_text reference "BT1" (at 0 0.5) (layer "F.SilkS") hide (effects (font (size 1 1) (thickness 0.15))))
(fp_text value "Battery_Cell" (at 0 -0.5) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
(fp_text user "Battery_Cell" (at 0 -0.5) (layer "B.Fab") (effects (font (size 1 1) (thickness 0.15)) (justify mirror)))
(fp_text user "BT01" (at 0 0.5) (layer "B.SilkS") hide (effects (font (size 1 1) (thickness 0.15)) (justify mirror)))
(fp_text user "Battery" (at 3.175 0.79375 90) (layer "F.SilkS") hide (effects (font (size 0.8 0.8) (thickness 0.1))))
(fp_text user "Battery" (at 3.175 0.79375 90) (layer "B.SilkS") hide (effects (font (size 0.8 0.8) (thickness 0.1)) (justify mirror)))
(fp_text user "(+)" (at -1.1 -2.286) (layer "F.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1))))
(fp_text user "(+)" (at -1.1 -2.286) (layer "B.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1)) (justify mirror)))
(fp_text user "(-)" (at 1.1 -2.286) (layer "F.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1))))
(fp_text user "(-)" (at 1.1 -2.286) (layer "B.SilkS") (effects (font (size 0.8 0.8) (thickness 0.1)) (justify mirror)))
(fp_poly (pts
(xy 0.4 -1)
(xy 0.4 1)
(xy 1.8 1)
(xy 1.8 -1)
) (layer "B.Mask") (width 0.1) (fill solid))
(fp_poly (pts
(xy -1.8 -1)
(xy -1.8 1)
(xy -0.4 1)
(xy -0.4 -1)
) (layer "B.Mask") (width 0.1) (fill solid))
(fp_poly (pts
(xy -0.401442 -1)
(xy -0.401442 1)
(xy -1.801442 1)
(xy -1.801442 -1)
) (layer "F.Mask") (width 0.1) (fill solid))
(fp_poly (pts
(xy 1.8 -1)
(xy 1.8 1)
(xy 0.4 1)
(xy 0.4 -1)
) (layer "F.Mask") (width 0.1) (fill solid))
(pad "1" thru_hole circle (at -1.1004 -1.3416) (size 0.4572 0.4572) (drill 0.3048) (layers *.Cu) ${p.net.pos.str})
(pad "1" smd custom (at -1.1 0 180) (size 1.5 2.1) (layers "F.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.179 1.3352)
(xy -0.1766 1.3352)
(xy -0.1766 0.762)
(xy 0.179 0.762)
) (width 0.1) (fill yes))
))
(pad "1" smd custom (at -1.1 0) (size 1.5 2.1) (layers "B.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.176556 -0.7618)
(xy -0.179044 -0.7618)
(xy -0.179044 -1.335)
(xy 0.176556 -1.335)
) (width 0.1) (fill yes))
))
(pad "2" thru_hole circle (at 1.1 -1.3416) (size 0.4572 0.4572) (drill 0.3048) (layers *.Cu) ${p.net.neg.str})
(pad "2" smd custom (at 1.1 0 180) (size 1.5 2.1) (layers "F.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.1786 1.3352)
(xy -0.177 1.3352)
(xy -0.177 0.762)
(xy 0.1786 0.762)
) (width 0.1) (fill yes))
))
(pad "2" smd custom (at 1.1 0) (size 1.5 2.1) (layers "B.Cu")
(options (clearance outline) (anchor rect))
(primitives
(gr_poly (pts
(xy 0.1766 -0.7618)
(xy -0.179 -0.7618)
(xy -0.179 -1.335)
(xy 0.1766 -1.335)
) (width 0.1) (fill yes))
))
)
`
}

View File

@ -0,0 +1,121 @@
// Kailh Choc PG1350
// Nets
// from: corresponds to pin 1
// to: corresponds to pin 2
// Params
// hotswap: default is false
// if true, will include holes and pads for Kailh choc hotswap sockets
// reverse: default is false
// if true, will flip the footprint such that the pcb can be reversible
// keycaps: default is false
// if true, will add choc sized keycap box around the footprint
//
// note: hotswap and reverse can be used simultaneously
module.exports = {
nets: {
from: undefined,
to: undefined
},
params: {
class: 'S',
hotswap: false,
reverse: false,
keycaps: false
},
body: p => {
const standard = `
(module PG1350 (layer F.Cu) (tedit 5DD50112)
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_text value "" (at 0 0) (layer F.SilkS) hide (effects (font (size 1.27 1.27) (thickness 0.15))))
${''/* diode box marker */}
(fp_line (start 2.868 3.326) (end 2.868 5.476) (layer "Dwgs.User") (width 0.15))
(fp_line (start -2.732 5.476) (end 2.868 5.476) (layer "Dwgs.User") (width 0.15))
(fp_line (start 2.868 3.326) (end -2.732 3.326) (layer "Dwgs.User") (width 0.15))
(fp_line (start -2.732 3.326) (end -2.732 5.476) (layer "Dwgs.User") (width 0.15))
${''/* diode direction marker */}
(fp_line (start -0.282 4.426) (end 0.318 4.026) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.318 4.826) (end -0.282 4.426) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.282 4.426) (end -0.282 3.876) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.282 4.426) (end -0.282 4.976) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.682 4.426) (end -0.282 4.426) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.318 4.426) (end 0.818 4.426) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.318 4.026) (end 0.318 4.826) (layer "F.SilkS") (width 0.1))
${''/* diode pads */}
(pad "" smd rect (at 1.776 4.401 ${ p.rot }) (size 1.1 1.9) (layers "B.Cu" "B.Paste" "B.Mask"))
(pad 2 smd rect (at -1.524 4.401 ${ p.rot }) (size 1.1 1.9) (layers "B.Cu" "B.Paste" "B.Mask") ${p.net.to.str})
${''/* corner marks */}
(fp_line (start -7 -6) (end -7 -7) (layer Dwgs.User) (width 0.15))
(fp_line (start -7 7) (end -6 7) (layer Dwgs.User) (width 0.15))
(fp_line (start -6 -7) (end -7 -7) (layer Dwgs.User) (width 0.15))
(fp_line (start -7 7) (end -7 6) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 6) (end 7 7) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 -7) (end 6 -7) (layer Dwgs.User) (width 0.15))
(fp_line (start 6 7) (end 7 7) (layer Dwgs.User) (width 0.15))
(fp_line (start 7 -7) (end 7 -6) (layer Dwgs.User) (width 0.15))
${''/* middle shaft */}
(pad "" np_thru_hole circle (at 0 0) (size 3.429 3.429) (drill 3.429) (layers *.Cu *.Mask))
${''/* stabilizers */}
(pad "" np_thru_hole circle (at 5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at -5.5 0) (size 1.7018 1.7018) (drill 1.7018) (layers *.Cu *.Mask))
`
const keycap = `
${'' /* keycap marks */}
(fp_line (start -9 -8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 -8.5) (end 9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 8.5) (end -9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15))
`
function pins(def_neg, def_pos, def_side) {
if(p.param.hotswap) {
return `
${'' /* holes */}
(pad "" np_thru_hole circle (at ${def_pos}5 -3.75) (size 3 3) (drill 3) (layers *.Cu *.Mask))
(pad "" np_thru_hole circle (at 0 -5.95) (size 3 3) (drill 3) (layers *.Cu *.Mask))
${'' /* net pads (other pad is with diode) */}
(pad 1 smd rect (at ${def_neg}3.275 -5.95 ${p.rot}) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask) ${p.net.from.str})
${''/* right hotswap pad and trace to diode */}
(pad "" smd custom (at 8.275 -3.75 ${ p.rot }) (size 2.6 2.6) (layers ${def_side}.Cu ${def_side}.Paste ${def_side}.Mask)
(clearance 0.2)
(options (clearance outline) (anchor rect))
(primitives
(gr_line (start -0.5 1) (end -0.5 4.6) (width 0.2))
(gr_line (start -3.3284 7.4284) (end -6.5 7.4284) (width 0.2))
(gr_line (start -0.499981 4.599974) (end -3.328408 7.428401) (width 0.2))
))
`
} else {
return `
${''/* pins (other pad is with diode) */}
(pad 1 thru_hole circle (at ${def_pos}5 -3.8) (size 2.032 2.032) (drill 1.27) (layers *.Cu *.Mask) ${p.net.from.str})
`
}
}
if(p.param.reverse) {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')}
${pins('', '-', 'F')})
`
} else {
return `
${standard}
${p.param.keycaps ? keycap : ''}
${pins('-', '', 'B')})
`
}
}
}

View File

@ -0,0 +1,109 @@
// Kailh Choc PG1232
// Nets
// from: corresponds to pin 1
// to: corresponds to pin 2
// Params
// reverse: default is false
// if true, will flip the footprint such that the pcb can be reversible
// keycaps: default is false
// if true, will add choc sized keycap box around the footprint
module.exports = {
nets: {
from: undefined,
to: undefined
},
params: {
class: 'S',
side: 'F',
keycaps: false
},
body: p => {
const standard = `
(module lib:Kailh_PG1232 (layer F.Cu) (tedit 5E1ADAC2)
${p.at /* parametric position */}
${'' /* footprint reference */}
(fp_text reference "${p.ref}" (at 0 0) (layer F.SilkS) ${p.ref_hide} (effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_text value Kailh_PG1232 (at 0 -7.3) (layer F.Fab) (effects (font (size 1 1) (thickness 0.15))))
${'' /* corner marks */}
(fp_line (start -7.25 -6.75) (end -6.25 -6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 -6.75) (end -7.25 -5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 6.75) (end -6.25 6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start -7.25 6.75) (end -7.25 5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 -6.75) (end 6.25 -6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 -6.75) (end 7.25 -5.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 6.75) (end 6.25 6.75) (layer Dwgs.User) (width 0.15))
(fp_line (start 7.25 6.75) (end 7.25 5.75) (layer Dwgs.User) (width 0.15))
${''/* diode box marker */}
(fp_line (start 2.8 -5.35) (end -2.8 -5.35) (layer Dwgs.User) (width 0.15))
(fp_line (start -2.8 -3.2) (end 2.8 -3.2) (layer Dwgs.User) (width 0.15))
(fp_line (start 2.8 -3.2) (end 2.8 -5.35) (layer Dwgs.User) (width 0.15))
(fp_line (start -2.8 -3.2) (end -2.8 -5.35) (layer Dwgs.User) (width 0.15))
${''/* diode direction marker */}
(fp_line (start 0.35 -4.3) (end 0.35 -3.75) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.25 -3.9) (end -0.25 -4.7) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.25 -4.3) (end -0.75 -4.3) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.35 -4.3) (end 0.35 -4.85) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.75 -4.3) (end 0.35 -4.3) (layer "F.SilkS") (width 0.1))
(fp_line (start 0.35 -4.3) (end -0.25 -3.9) (layer "F.SilkS") (width 0.1))
(fp_line (start -0.25 -4.7) (end 0.35 -4.3) (layer "F.SilkS") (width 0.1))
${''/* middle shaft */}
(fp_line (start 2.25 2.6) (end 5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 2.6) (end -5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start 2.25 3.6) (end 2.25 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 3.6) (end 2.25 3.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -2.25 2.6) (end -2.25 3.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -5.8 2.6) (end -5.8 -2.95) (layer Edge.Cuts) (width 0.12))
(fp_line (start 5.8 -2.95) (end 5.8 2.6) (layer Edge.Cuts) (width 0.12))
(fp_line (start -5.8 -2.95) (end 5.8 -2.95) (layer Edge.Cuts) (width 0.12))
${''/* stabilizers */}
(pad 3 thru_hole circle (at 5.3 -4.75) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
(pad 4 thru_hole circle (at -5.3 -4.75) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
${''/* bottom-left switch pin */}
(pad 1 thru_hole circle (at -4.58 5.1) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) ${p.net.from.str} (clearance 0.2))
${''/* bottom-right switch pin and trace */}
(pad "" smd custom (at 2 5.4 ${ p.rot }) (size 1.6 1.6) (layers "F.Cu")
(clearance 0.2)
(options (clearance outline) (anchor circle))
(primitives
(gr_line (start 0 0) (end -4 0) (width 0.13))
(gr_line (start -4 0) (end -6 -2) (width 0.13))
(gr_line (start -6 -2) (end -8 -2) (width 0.13))
(gr_line (start -8.5 -2.5) (end -8.5 -8.35) (width 0.13))
(gr_line (start -8 -8.85) (end -3.65 -8.85) (width 0.13))
(gr_line (start -8.5 -8.35) (end -8 -8.85) (width 0.13) (fill yes))
(gr_line (start -8.5 -2.5) (end -8 -2) (width 0.13) (fill yes))
))
(pad "" thru_hole circle (at 2 5.4 22) (size 1.6 1.6) (drill 1.1) (layers *.Cu *.Mask) (clearance 0.2))
${''/* diode pads */}
(pad "" smd rect (at -1.65 -4.3 ${ p.rot }) (size 1.1 1.9) (layers "F.Cu" "F.Paste" "F.Mask"))
(pad "2" smd rect (at 1.65 -4.3 ${ p.rot }) (size 1.1 1.9) (layers "F.Cu" "F.Paste" "F.Mask") ${p.net.to.str})
`
const keycap = `
${'' /* keycap marks */}
(fp_line (start -9 -8.5) (end 9 -8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 -8.5) (end 9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start 9 8.5) (end -9 8.5) (layer Dwgs.User) (width 0.15))
(fp_line (start -9 8.5) (end -9 -8.5) (layer Dwgs.User) (width 0.15))
`
return `
${standard}
${p.param.keycaps ? keycap : ''}
)
`
}
}

View File

@ -4,6 +4,11 @@ module.exports = {
from: undefined, from: undefined,
to: undefined to: undefined
}, },
params: {
class: 'D',
through_hole: true,
via_in_pad: false
},
body: p => ` body: p => `
(module ComboDiode (layer F.Cu) (tedit 5B24D78E) (module ComboDiode (layer F.Cu) (tedit 5B24D78E)
@ -31,16 +36,32 @@ module.exports = {
(fp_line (start -0.35 0) (end -0.35 -0.55) (layer B.SilkS) (width 0.1)) (fp_line (start -0.35 0) (end -0.35 -0.55) (layer B.SilkS) (width 0.1))
(fp_line (start -0.75 0) (end -0.35 0) (layer B.SilkS) (width 0.1)) (fp_line (start -0.75 0) (end -0.35 0) (layer B.SilkS) (width 0.1))
${ p.param.via_in_pad ?
`
${''/* Vias in SMD pads */}
(pad 1 thru_hole rect (at -1.65 0 ${ p.rot }) (size 0.9 1.2) (drill 0.3) (layers *.Cu *.Mask) (zone_connect 2) ${ p.net.to.str })
(pad 2 thru_hole rect (at 1.65 0 ${ p.rot }) (size 0.9 1.2) (drill 0.3) (layers *.Cu *.Mask) (zone_connect 2) ${ p.net.from.str })
`
:
`
${ ''/* SMD pads on both sides */ } ${ ''/* SMD pads on both sides */ }
(pad 1 smd rect (at -1.65 0 ${p.rot}) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${p.to.str}) (pad 1 smd rect (at -1.65 0 ${ p.rot }) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${ p.net.to.str })
(pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${p.from.str}) (pad 2 smd rect (at 1.65 0 ${ p.rot }) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${ p.net.from.str })
(pad 1 smd rect (at -1.65 0 ${p.rot}) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${p.to.str}) (pad 1 smd rect (at -1.65 0 ${ p.rot }) (size 0.9 1.2) (layers B.Cu B.Paste B.Mask) ${ p.net.to.str })
(pad 2 smd rect (at 1.65 0 ${p.rot}) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${p.from.str}) (pad 2 smd rect (at 1.65 0 ${ p.rot }) (size 0.9 1.2) (layers F.Cu F.Paste F.Mask) ${ p.net.from.str })
`
${''/* THT terminals */} }
(pad 1 thru_hole rect (at -3.81 0 ${p.rot}) (size 1.778 1.778) (drill 0.9906) (layers *.Cu *.Mask) ${p.to.str})
(pad 2 thru_hole circle (at 3.81 0 ${p.rot}) (size 1.905 1.905) (drill 0.9906) (layers *.Cu *.Mask) ${p.from.str}) ${ p.param.through_hole === false ?
) ''
:
`
${''/* THT terminals */}
(pad 1 thru_hole circle (at 3.81 0 ${ p.rot }) (size 1.905 1.905) (drill 0.9906) (layers *.Cu *.Mask) ${ p.net.from.str })
(pad 2 thru_hole rect (at -3.81 0 ${ p.rot }) (size 1.778 1.778) (drill 0.9906) (layers *.Cu *.Mask) ${ p.net.to.str })
`
}
)
` `
} }

View File

@ -1,11 +1,15 @@
module.exports = { module.exports = {
alps: require('./alps'), alps: require('./alps'),
battery_pads: require('./battery_pads.js'),
button: require('./button'), button: require('./button'),
choc: require('./choc'), choc: require('./choc'),
choc_with_diode: require('./choc_with_diode'),
chocmini: require('./chocmini'), chocmini: require('./chocmini'),
chocmini_with_diode: require('./chocmini_with_diode'),
diode: require('./diode'), diode: require('./diode'),
jstph: require('./jstph'), jstph: require('./jstph'),
jumper: require('./jumper'), jumper: require('./jumper'),
m2_mounting_hole: require('./m2_mounting_hole'),
mx: require('./mx'), mx: require('./mx'),
oled: require('./oled'), oled: require('./oled'),
omron: require('./omron'), omron: require('./omron'),
@ -16,5 +20,6 @@ module.exports = {
scrollwheel: require('./scrollwheel'), scrollwheel: require('./scrollwheel'),
slider: require('./slider'), slider: require('./slider'),
trrs: require('./trrs'), trrs: require('./trrs'),
two_lead_button: require('./two_lead_button'),
via: require('./via'), via: require('./via'),
} }

View File

@ -0,0 +1,16 @@
module.exports = {
body: p => `
(module M2MountingHole
(layer "F.Cu")
${p.at /* parametric position */}
(fp_text reference "HOLE1" (at 0 -3.2 22) (layer "F.SilkS") hide
(effects (font (size 1 1) (thickness 0.15))))
(fp_text value "Val**" (at 0 0) (layer "F.SilkS") hide
(effects (font (size 1.27 1.27) (thickness 0.15))))
(fp_circle (center 0 0) (end 2 0) (layer "F.CrtYd") (width 0.05) (fill none))
(pad "1" thru_hole circle (at 0 0 22) (size 3.6 3.6) (drill 2.2) (layers *.Cu *.Mask))
)
`
}

View File

@ -0,0 +1,19 @@
module.exports = {
nets: {
from: undefined,
to: undefined,
},
body: p => `
(module TwoLeadButton
(layer "F.Cu")
${p.at /* parametric position */}
(fp_text reference "B1" (at 0 0 unlocked) (layer "F.SilkS") (effects (font (size 1 1) (thickness 0.15))))
(fp_text value "Button" (at 0 2.54 unlocked) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
(fp_text user "Button" (at 0 0 unlocked) (layer "F.Fab") (effects (font (size 1 1) (thickness 0.15))))
(pad "1" smd roundrect (at -2.2 0) (size 1 2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) ${p.net.from.str})
(pad "2" smd roundrect (at 2.2 0) (size 1 2) (layers "F.Cu" "F.Paste" "F.Mask") (roundrect_rratio 0.25) ${p.net.to.str})
)
`
}

View File

@ -92,6 +92,7 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
orient: 0, orient: 0,
shift: [0, 0], shift: [0, 0],
rotate: 0, rotate: 0,
adjust: {},
width: units.$default_width, width: units.$default_width,
height: units.$default_height, height: units.$default_height,
padding: units.$default_padding, padding: units.$default_padding,
@ -168,11 +169,17 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
// copy the current column anchor // copy the current column anchor
let point = running_anchor.clone() let point = running_anchor.clone()
// apply per-key adjustments // apply cumulative per-key adjustments
point.r += key.orient point.r += key.orient
point.shift(key.shift) point.shift(key.shift)
point.r += key.rotate point.r += key.rotate
// commit running anchor
running_anchor = point.clone()
// apply independent adjustments
point = anchor_lib.parse(key.adjust, `${key.name}.adjust`, {}, point)(units)
// save new key // save new key
point.meta = key point.meta = key
points[key.name] = point points[key.name] = point
@ -182,7 +189,6 @@ const render_zone = exports._render_zone = (zone_name, zone, anchor, global_key,
col_minmax[col_name].max = Math.max(col_minmax[col_name].max, point.y) col_minmax[col_name].max = Math.max(col_minmax[col_name].max, point.y)
// advance the running anchor to the next position // advance the running anchor to the next position
running_anchor = point.clone()
running_anchor.shift([0, key.padding]) running_anchor.shift([0, key.padding])
} }

View File

@ -14,6 +14,7 @@ matrix:
- 0 - 0
- 0 - 0
rotate: 0 rotate: 0
adjust: {}
width: 18 width: 18
height: 18 height: 18
padding: 19 padding: 19

View File

@ -14,6 +14,7 @@ matrix_col_row:
- 0 - 0
- 0 - 0
rotate: 0 rotate: 0
adjust: {}
width: 18 width: 18
height: 18 height: 18
padding: 19 padding: 19

View File

@ -3,17 +3,21 @@ points:
matrix: matrix:
columns: columns:
left: left:
middle.rows.home.adjust:
shift: [-2u, 0]
rotate: 45
right: right:
key: key:
stagger: 5 stagger: 5
spread: 25 spread: 25
splay: 5 splay: -5
origin: [-9, -9] origin: [-9, -9]
rows: rows:
top: home:
orient: -90 orient: -90
shift: [0, 10] shift: [0, 10]
rotate: 90 rotate: 90
rows: rows:
bottom: bottom:
home:
top: top:

View File

@ -145,35 +145,227 @@ LINE
8 8
0 0
10 10
14.4311966 -9
20
47
11
9
21
47
0
LINE
8
0
10
9
20
47
11
9
21
29
0
LINE
8
0
10
9
20
29
11
-9
21
29
0
LINE
8
0
10
-9
20
29
11
-9
21
47
0
LINE
8
0
10
10
20
9
11
28
21
9
0
LINE
8
0
10
28
20
9
11
28
21
-9
0
LINE
8
0
10
28
20
-9
11
10
21
-9
0
LINE
8
0
10
10
20
-9
11
10
21
9
0
LINE
8
0
10
-31.7279221
20
19
11
-19
21
31.7279221
0
LINE
8
0
10
-19
20
31.7279221
11
-6.2720779
21
19
0
LINE
8
0
10
-6.2720779
20
19
11
-19
21
6.2720779
0
LINE
8
0
10
-19
20
6.2720779
11
-31.7279221
21
19
0
LINE
8
0
10
10
20
47
11
28
21
47
0
LINE
8
0
10
28
20
47
11
28
21
29
0
LINE
8
0
10
28
20
29
11
10
21
29
0
LINE
8
0
10
10
20
29
11
10
21
47
0
LINE
8
0
10
36.5688034
20 20
13.9315046 13.9315046
11 11
32.3627012 54.500308
21 21
15.500308 12.3627012
0 0
LINE LINE
8 8
0 0
10 10
32.3627012 54.500308
20 20
15.500308 12.3627012
11 11
33.9315046 52.9315046
21 21
-2.4311966 -5.5688034
0 0
LINE LINE
8 8
0 0
10 10
33.9315046 52.9315046
20 20
-2.4311966 -5.5688034
11 11
16 35
21 21
-4 -4
0 0
@ -181,11 +373,11 @@ LINE
8 8
0 0
10 10
16 35
20 20
-4 -4
11 11
14.4311966 36.5688034
21 21
13.9315046 13.9315046
0 0
@ -193,49 +385,97 @@ LINE
8 8
0 0
10 10
22.7371845 48.1867095
20 20
33.7307613 31.9876465
11 11
40.6686891 66.1182141
21 21
35.2995647 30.4188431
0 0
LINE LINE
8 8
0 0
10 10
40.6686891 66.1182141
20 20
35.2995647 30.4188431
11 11
42.2374925 64.5494107
21 21
17.3680601 12.4873385
0 0
LINE LINE
8 8
0 0
10 10
42.2374925 64.5494107
20 20
17.3680601 12.4873385
11 11
24.3059879 46.6179061
21 21
15.7992567 14.0561419
0 0
LINE LINE
8 8
0 0
10 10
24.3059879 46.6179061
20 20
15.7992567 14.0561419
11 11
22.7371845 48.1867095
21 21
33.7307613 31.9876465
0
LINE
8
0
10
49.8426686
20
50.9153458
11
67.7741732
21
49.3465424
0
LINE
8
0
10
67.7741732
20
49.3465424
11
66.2053698
21
31.4150378
0
LINE
8
0
10
66.2053698
20
31.4150378
11
48.2738652
21
32.9838412
0
LINE
8
0
10
48.2738652
20
32.9838412
11
49.8426686
21
50.9153458
0 0
ENDSEC ENDSEC
0 0

View File

@ -17,6 +17,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -28,18 +29,33 @@
"zone": { "zone": {
"columns": { "columns": {
"left": null, "left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": { "right": {
"key": { "key": {
"stagger": 5, "stagger": 5,
"spread": 25, "spread": 25,
"splay": 5, "splay": -5,
"origin": [ "origin": [
-9, -9,
-9 -9
] ]
}, },
"rows": { "rows": {
"top": { "home": {
"orient": -90, "orient": -90,
"shift": [ "shift": [
0, 0,
@ -53,6 +69,7 @@
}, },
"rows": { "rows": {
"bottom": {}, "bottom": {},
"home": {},
"top": {} "top": {}
}, },
"name": "matrix" "name": "matrix"
@ -65,13 +82,13 @@
"row": "bottom", "row": "bottom",
"bind": [ "bind": [
10, 10,
0, 10,
0, 0,
0 0
] ]
} }
}, },
"matrix_left_top": { "matrix_left_home": {
"x": 0, "x": 0,
"y": 19, "y": 19,
"r": 0, "r": 0,
@ -89,29 +106,45 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
"autobind": 10, "autobind": 10,
"skip": false, "skip": false,
"asym": "both", "asym": "both",
"colrow": "left_top", "colrow": "left_home",
"name": "matrix_left_top", "name": "matrix_left_home",
"zone": { "zone": {
"columns": { "columns": {
"left": null, "left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": { "right": {
"key": { "key": {
"stagger": 5, "stagger": 5,
"spread": 25, "spread": 25,
"splay": 5, "splay": -5,
"origin": [ "origin": [
-9, -9,
-9 -9
] ]
}, },
"rows": { "rows": {
"top": { "home": {
"orient": -90, "orient": -90,
"shift": [ "shift": [
0, 0,
@ -125,6 +158,96 @@
}, },
"rows": { "rows": {
"bottom": {}, "bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {},
"key": {},
"name": "left"
},
"row": "home",
"bind": [
10,
10,
10,
0
]
}
},
"matrix_left_top": {
"x": 0,
"y": 38,
"r": 0,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "left_top",
"name": "matrix_left_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {} "top": {}
}, },
"name": "matrix" "name": "matrix"
@ -143,17 +266,17 @@
] ]
} }
}, },
"matrix_right_bottom": { "matrix_middle_bottom": {
"x": 24.181350600000002, "x": 19,
"y": 5.750154, "y": 0,
"r": 5, "r": 0,
"meta": { "meta": {
"stagger": 5, "stagger": 0,
"spread": 25, "spread": 19,
"splay": 5, "splay": 0,
"origin": [ "origin": [
-9, 0,
-9 0
], ],
"orient": 0, "orient": 0,
"shift": [ "shift": [
@ -161,29 +284,45 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
"autobind": 10, "autobind": 10,
"skip": false, "skip": false,
"asym": "both", "asym": "both",
"colrow": "right_bottom", "colrow": "middle_bottom",
"name": "matrix_right_bottom", "name": "matrix_middle_bottom",
"zone": { "zone": {
"columns": { "columns": {
"left": null, "left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": { "right": {
"key": { "key": {
"stagger": 5, "stagger": 5,
"spread": 25, "spread": 25,
"splay": 5, "splay": -5,
"origin": [ "origin": [
-9, -9,
-9 -9
] ]
}, },
"rows": { "rows": {
"top": { "home": {
"orient": -90, "orient": -90,
"shift": [ "shift": [
0, 0,
@ -197,6 +336,310 @@
}, },
"rows": { "rows": {
"bottom": {}, "bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "bottom",
"bind": [
10,
0,
0,
10
]
}
},
"matrix_middle_home": {
"x": -19,
"y": 19,
"r": 45,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "middle_home",
"name": "matrix_middle_home",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "home",
"bind": [
10,
10,
10,
10
]
}
},
"matrix_middle_top": {
"x": 19,
"y": 38,
"r": 0,
"meta": {
"stagger": 0,
"spread": 19,
"splay": 0,
"origin": [
0,
0
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "middle_top",
"name": "matrix_middle_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"row": "top",
"bind": [
0,
10,
10,
10
]
}
},
"matrix_right_bottom": {
"x": 44.750154,
"y": 4.1813506,
"r": -5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "right_bottom",
"name": "matrix_right_bottom",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {} "top": {}
}, },
"name": "matrix" "name": "matrix"
@ -205,14 +648,14 @@
"key": { "key": {
"stagger": 5, "stagger": 5,
"spread": 25, "spread": 25,
"splay": 5, "splay": -5,
"origin": [ "origin": [
-9, -9,
-9 -9
] ]
}, },
"rows": { "rows": {
"top": { "home": {
"orient": -90, "orient": -90,
"shift": [ "shift": [
0, 0,
@ -232,14 +675,14 @@
] ]
} }
}, },
"matrix_right_top": { "matrix_right_home": {
"x": 32.4873385, "x": 56.3680601,
"y": 25.549410700000003, "y": 22.237492500000002,
"r": 5, "r": -5,
"meta": { "meta": {
"stagger": 5, "stagger": 5,
"spread": 25, "spread": 25,
"splay": 5, "splay": -5,
"origin": [ "origin": [
-9, -9,
-9 -9
@ -250,29 +693,45 @@
10 10
], ],
"rotate": 90, "rotate": 90,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
"autobind": 10, "autobind": 10,
"skip": false, "skip": false,
"asym": "both", "asym": "both",
"colrow": "right_top", "colrow": "right_home",
"name": "matrix_right_top", "name": "matrix_right_home",
"zone": { "zone": {
"columns": { "columns": {
"left": null, "left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": { "right": {
"key": { "key": {
"stagger": 5, "stagger": 5,
"spread": 25, "spread": 25,
"splay": 5, "splay": -5,
"origin": [ "origin": [
-9, -9,
-9 -9
] ]
}, },
"rows": { "rows": {
"top": { "home": {
"orient": -90, "orient": -90,
"shift": [ "shift": [
0, 0,
@ -286,6 +745,7 @@
}, },
"rows": { "rows": {
"bottom": {}, "bottom": {},
"home": {},
"top": {} "top": {}
}, },
"name": "matrix" "name": "matrix"
@ -294,14 +754,120 @@
"key": { "key": {
"stagger": 5, "stagger": 5,
"spread": 25, "spread": 25,
"splay": 5, "splay": -5,
"origin": [ "origin": [
-9, -9,
-9 -9
] ]
}, },
"rows": { "rows": {
"top": { "home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
},
"row": "home",
"bind": [
10,
0,
10,
10
]
}
},
"matrix_right_top": {
"x": 58.0240192,
"y": 41.1651918,
"r": -5,
"meta": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
],
"orient": 0,
"shift": [
0,
0
],
"rotate": 0,
"adjust": {},
"width": 18,
"height": 18,
"padding": 19,
"autobind": 10,
"skip": false,
"asym": "both",
"colrow": "right_top",
"name": "matrix_right_top",
"zone": {
"columns": {
"left": null,
"middle": {
"rows": {
"home": {
"adjust": {
"shift": [
"-2u",
0
],
"rotate": 45
}
}
},
"key": {},
"name": "middle"
},
"right": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90,
"shift": [
0,
10
],
"rotate": 90
}
},
"name": "right"
}
},
"rows": {
"bottom": {},
"home": {},
"top": {}
},
"name": "matrix"
},
"col": {
"key": {
"stagger": 5,
"spread": 25,
"splay": -5,
"origin": [
-9,
-9
]
},
"rows": {
"home": {
"orient": -90, "orient": -90,
"shift": [ "shift": [
0, 0,

View File

@ -17,6 +17,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -68,6 +69,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -119,6 +121,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -170,6 +173,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,

View File

@ -17,6 +17,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -60,6 +61,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,

View File

@ -17,6 +17,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -87,6 +88,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -150,6 +152,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -213,6 +216,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -283,6 +287,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -346,6 +351,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -409,6 +415,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -479,6 +486,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -542,6 +550,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -605,6 +614,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -675,6 +685,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -738,6 +749,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,

View File

@ -17,6 +17,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -85,6 +86,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -153,6 +155,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -223,6 +226,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -293,6 +297,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -363,6 +368,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,
@ -437,6 +443,7 @@
0 0
], ],
"rotate": 0, "rotate": 0,
"adjust": {},
"width": 18, "width": 18,
"height": 18, "height": 18,
"padding": 19, "padding": 19,

View File

@ -49,17 +49,21 @@ describe('Filter', function() {
names(filter('/^o/', '', points)).should.deep.equal(['one', 'three', 'mirror_one']) names(filter('/^o/', '', points)).should.deep.equal(['one', 'three', 'mirror_one'])
// middle spec, should be the same as above, only explicit // middle spec, should be the same as above, only explicit
names(filter('~ /^o/', '', points)).should.deep.equal(['one', 'three', 'mirror_one']) names(filter('~ /^o/', '', points)).should.deep.equal(['one', 'three', 'mirror_one'])
// full spec (n would normally match both one and even, but on the tags level, it's just even) // full spec (/n/ would normally match both "one" and "even", but on the tags level, it's just even)
names(filter('meta.tags ~ /n/', '', points)).should.deep.equal(['two']) names(filter('meta.tags ~ /n/', '', points)).should.deep.equal(['two'])
names(filter('meta.name,meta.tags ~ /n/', '', points)).should.deep.equal(['one', 'two', 'mirror_one'])
// negation // negation
names(filter('meta.tags ~ -/n/', '', points)).should.deep.equal(['one', 'three', 'mirror_one']) names(filter('meta.tags ~ -/n/', '', points)).should.deep.equal(['one', 'three', 'mirror_one'])
names(filter('meta.name,meta.tags ~ -/n/', '', points)).should.deep.equal(['three'])
// arrays OR by default at odd levels (including top level)... // arrays OR by default at odd levels (including top level)...
names(filter(['one', 'two'], '', points)).should.deep.equal(['one', 'two']) names(filter(['one', 'two'], '', points)).should.deep.equal(['one', 'two'])
// ...and AND at even levels // ...and AND at even levels
names(filter([['even', 'prime']], '', points)).should.deep.equal(['two']) names(filter([['even', 'prime']], '', points)).should.deep.equal(['two'])
// arbitrary nesting should be possible // arbitrary nesting should be possible
names(filter([[['even', 'odd'], 'prime']], '', points)).should.deep.equal(['two', 'three']) names(filter([[['even', 'odd'], 'prime']], '', points)).should.deep.equal(['two', 'three'])
// anything other than string/array/object/undefined is an error // invalid regexes should throw meaningful errors
filter.bind(this, '/\\/', '', points).should.throw('Invalid regex')
// anything other than string/array/object/undefined is also an error
filter.bind(this, 28, '', points).should.throw('Unexpected type') filter.bind(this, 28, '', points).should.throw('Unexpected type')
}) })