@graffiticode/basis 1.6.3 → 1.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude/settings.local.json +16 -0
- package/package.json +5 -4
- package/spec/build.js +54 -0
- package/spec/spec.html +44 -1
- package/src/compiler.js +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"WebFetch(domain:www.npmjs.com)",
|
|
5
|
+
"WebFetch(domain:raw.githubusercontent.com)",
|
|
6
|
+
"Bash(gh api:*)",
|
|
7
|
+
"WebFetch(domain:api.github.com)",
|
|
8
|
+
"Bash(npm ls:*)",
|
|
9
|
+
"Bash(npx spec-md:*)",
|
|
10
|
+
"Bash(node:*)",
|
|
11
|
+
"Bash(npx:*)",
|
|
12
|
+
"Bash(npm run:*)",
|
|
13
|
+
"Bash(npm install:*)"
|
|
14
|
+
]
|
|
15
|
+
}
|
|
16
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graffiticode/basis",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.
|
|
4
|
+
"version": "1.6.4",
|
|
5
5
|
"description": "The basis library for creating Graffiticode languages",
|
|
6
6
|
"main": "index.js",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"test": "jest",
|
|
9
|
-
"build-spec": "
|
|
10
|
-
"watch-spec": "npx nodemon --exec '
|
|
9
|
+
"build-spec": "node spec/build.js",
|
|
10
|
+
"watch-spec": "npx nodemon --exec 'node spec/build.js' ./spec/spec.md",
|
|
11
11
|
"publish-spec": "npm run build-spec && for dir in ../l0*/packages/api/public; do cp ./spec/spec.html \"$dir/graffiticode-language-spec.html\"; echo \"Copied to $dir/graffiticode-language-spec.html\"; done"
|
|
12
12
|
},
|
|
13
13
|
"engines": {
|
|
@@ -28,7 +28,8 @@
|
|
|
28
28
|
"hashids": "^2.2.8",
|
|
29
29
|
"https": "^1.0.0",
|
|
30
30
|
"jest": "^27.0.1",
|
|
31
|
-
"react": "^17.0.2"
|
|
31
|
+
"react": "^17.0.2",
|
|
32
|
+
"spec-md": "^3.1.0"
|
|
32
33
|
},
|
|
33
34
|
"dependencies": {
|
|
34
35
|
"decimal.js": "^10.5.0"
|
package/spec/build.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const specMarkdown = require('spec-md');
|
|
2
|
+
const fs = require('fs');
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
const source = path.join(__dirname, 'spec.md');
|
|
6
|
+
const dest = path.join(__dirname, 'spec.html');
|
|
7
|
+
|
|
8
|
+
const copyButtonHead = `
|
|
9
|
+
<style>
|
|
10
|
+
pre {
|
|
11
|
+
position: relative;
|
|
12
|
+
}
|
|
13
|
+
.copy-button {
|
|
14
|
+
position: absolute;
|
|
15
|
+
top: 6px;
|
|
16
|
+
right: 6px;
|
|
17
|
+
padding: 3px 8px;
|
|
18
|
+
border: 1px solid var(--color-pre-border);
|
|
19
|
+
border-radius: 4px;
|
|
20
|
+
background: var(--color-background);
|
|
21
|
+
color: var(--color-grey);
|
|
22
|
+
font-family: var(--font-family);
|
|
23
|
+
font-size: 12px;
|
|
24
|
+
cursor: pointer;
|
|
25
|
+
opacity: 0;
|
|
26
|
+
transition: opacity 0.15s;
|
|
27
|
+
}
|
|
28
|
+
pre:hover .copy-button {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
.copy-button:hover {
|
|
32
|
+
background: var(--color-pre-border);
|
|
33
|
+
}
|
|
34
|
+
</style>
|
|
35
|
+
<script>
|
|
36
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
37
|
+
document.querySelectorAll("pre > code").forEach(function (code) {
|
|
38
|
+
var pre = code.parentElement;
|
|
39
|
+
var btn = document.createElement("button");
|
|
40
|
+
btn.className = "copy-button";
|
|
41
|
+
btn.textContent = "Copy";
|
|
42
|
+
btn.addEventListener("click", function () {
|
|
43
|
+
navigator.clipboard.writeText(code.textContent).then(function () {
|
|
44
|
+
btn.textContent = "Copied!";
|
|
45
|
+
setTimeout(function () { btn.textContent = "Copy"; }, 1500);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
pre.appendChild(btn);
|
|
49
|
+
});
|
|
50
|
+
});
|
|
51
|
+
</script>`;
|
|
52
|
+
|
|
53
|
+
const html = specMarkdown.html(source, { head: copyButtonHead });
|
|
54
|
+
fs.writeFileSync(dest, html);
|
package/spec/spec.html
CHANGED
|
@@ -7,7 +7,50 @@
|
|
|
7
7
|
<script>(function(){var r,a=[];document.addEventListener("readystatechange",function(){document.readyState==="interactive"&&u()});function u(){var n=document.querySelector('label[for="spec-sidebar-toggle"]');n.addEventListener("scroll",o),n.addEventListener("touchmove",o);function o(d){d.preventDefault()}for(var t=document.getElementsByTagName("section"),e=0;e<t.length;e++)t[e].getAttribute("secid")&&a.push(t[e]);var i=window.scrollY,c=!1;window.addEventListener("scroll",function(d){i=window.scrollY,c||(c=!0,window.requestAnimationFrame(function(){s(i),c=!1}))})}function s(n){for(var o=n+document.documentElement.clientHeight/4,t,e=a.length-1;e>=0;e--)if(a[e].offsetTop<o){t=a[e];break}var i=t&&t.getAttribute("secid");i!==r&&(r&&l(r,!1),i&&l(i,!0),r=i)}function l(n,o){document.getElementById("_sidebar_"+n).className=o?"viewing":"";for(var t=n.split(".");t.length;){var e=document.getElementById("_toggle_"+t.join("."));e&&(e.checked=o),t.pop()}}s(window.scrollY);})();</script>
|
|
8
8
|
<script>(function(){var n=document.getElementsByTagName("style")[0].sheet,e;function u(){e&&(n.deleteRule(e),e=void 0)}function d(t){u(),e=n.insertRule('*[data-name="'+t+'"] { background: rgba(230,215,0,0.12); }',n.cssRules.length)}document.documentElement.addEventListener("mouseover",function(t){var a=t.target.attributes["data-name"];a&&d(a.value)});document.documentElement.addEventListener("mouseout",u);})();</script>
|
|
9
9
|
<script>(function(){var R="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",o,p,r,g;document.addEventListener("selectionchange",E);window.addEventListener("resize",C);window.addEventListener("hashchange",x);window.addEventListener("load",x);function S(n){y(new URL(n.target.href))}function x(){y(window.location)}function y(n){var e=n.hash.match(/^#sel-([A-Za-z0-9-_]+)$/);if(!!e){g=e[1],r=k(g);var t=r.getBoundingClientRect(),d=Math.max(20,Math.floor((window.innerHeight-t.height)*.4));window.scrollTo(0,window.scrollY+t.y-d);var c=document.getSelection();c.empty(),c.addRange(r),C()}}function E(n){var e=document.getSelection();if(e.isCollapsed)o&&(o.parentNode.removeChild(o),o=null);else{var t=e.getRangeAt(0);(!r||t.compareBoundaryPoints(Range.START_TO_START,r)!==0||t.compareBoundaryPoints(Range.END_TO_END,r)!==0)&&(r=t,g=B(r),C())}}function C(){if(!!r){p||(p=document.getElementsByTagName("article")[0]),o||(o=document.createElement("a"),document.body.appendChild(o)),o.href="#sel-"+g,o.onclick=S,o.className=r.isOutdated?"outdated-selection-link":"selection-link",o.innerText=r.isOutdated?"!":"\u201F";var n=window.innerWidth<720,e=r.getBoundingClientRect();if(n)o.style.left=Math.floor(e.x+e.width/2+window.scrollX-13)+"px",o.style.top=Math.floor(e.bottom+window.scrollY+10)+"px";else{var t=p.getBoundingClientRect().x;o.style.left=Math.floor(t+window.scrollX-37)+"px",o.style.top=Math.floor(e.y+window.scrollY-3)+"px"}}}function B(n){var e="",t=N(n.startContainer),d=N(n.endContainer),c=M(t,d);return l(c),l(t.slice(c.length).concat(n.startOffset)),l(d.slice(c.length).concat(n.endOffset)),i(L(n.toString())),e;function i(a){do e+=R[a&31|(a>31?32:0)],a>>=5;while(a>0)}function l(a){i(a.length);for(var h=0;h<a.length;h++)i(a[h])}}function k(n){for(var e=new Array(64),t=0;t<64;t++)e[R.charCodeAt(t)]=t;var d=0,c=m(),i=m(),l=m(),a=w(),h=i.pop(),P=O(c.concat(i)),T=l.pop(),A=O(c.concat(l)),u=document.createRange();return u.setStart(P,h),u.setEnd(A,T),u.isOutdated=a!==void 0&&a!==L(u.toString()),u;function w(){for(var s=0,v=0;d<n.length;){var f=e[n.charCodeAt(d++)];if(s|=(f&31)<<v,v+=5,f<32)return s}}function m(){var s=w();if(s!=null){for(var v=new Array(s),f=0;f<s;f++)v[f]=w();return v}}}function N(n){for(var e=[];n!=document.body;){var t=n.parentNode;e.push(Array.prototype.indexOf.call(t.childNodes,n)),n=t}return e.reverse()}function O(n){for(var e=document.body,t=0;t<n.length&&e;t++)e=e.childNodes[n[t]];return e}function M(n,e){for(var t=0;t<n.length&&t<e.length&&n[t]===e[t];)t++;return n.slice(0,t)}function L(n){for(var e=2166136261,t=0;t<n.length;++t)e^=n.charCodeAt(t),e+=(e<<1)+(e<<4)+(e<<7)+(e<<8)+(e<<24);return(e>>15^e)&32767}})();</script>
|
|
10
|
-
|
|
10
|
+
|
|
11
|
+
<style>
|
|
12
|
+
pre {
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
.copy-button {
|
|
16
|
+
position: absolute;
|
|
17
|
+
top: 6px;
|
|
18
|
+
right: 6px;
|
|
19
|
+
padding: 3px 8px;
|
|
20
|
+
border: 1px solid var(--color-pre-border);
|
|
21
|
+
border-radius: 4px;
|
|
22
|
+
background: var(--color-background);
|
|
23
|
+
color: var(--color-grey);
|
|
24
|
+
font-family: var(--font-family);
|
|
25
|
+
font-size: 12px;
|
|
26
|
+
cursor: pointer;
|
|
27
|
+
opacity: 0;
|
|
28
|
+
transition: opacity 0.15s;
|
|
29
|
+
}
|
|
30
|
+
pre:hover .copy-button {
|
|
31
|
+
opacity: 1;
|
|
32
|
+
}
|
|
33
|
+
.copy-button:hover {
|
|
34
|
+
background: var(--color-pre-border);
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
37
|
+
<script>
|
|
38
|
+
document.addEventListener("DOMContentLoaded", function () {
|
|
39
|
+
document.querySelectorAll("pre > code").forEach(function (code) {
|
|
40
|
+
var pre = code.parentElement;
|
|
41
|
+
var btn = document.createElement("button");
|
|
42
|
+
btn.className = "copy-button";
|
|
43
|
+
btn.textContent = "Copy";
|
|
44
|
+
btn.addEventListener("click", function () {
|
|
45
|
+
navigator.clipboard.writeText(code.textContent).then(function () {
|
|
46
|
+
btn.textContent = "Copied!";
|
|
47
|
+
setTimeout(function () { btn.textContent = "Copy"; }, 1500);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
50
|
+
pre.appendChild(btn);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
</script></head>
|
|
11
54
|
<body><article>
|
|
12
55
|
<header>
|
|
13
56
|
<h1>Graffiticode Core Language Specification</h1>
|