plainscript-lang 1.0.3 → 1.0.36
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/README.md +836 -188
- package/compiler/cli.js +68 -4
- package/compiler/dependency-detector.js +6 -2
- package/compiler/generator.js +737 -51
- package/compiler/lexer.js +12 -0
- package/compiler/parser.js +184 -14
- package/compiler/version.js +1 -1
- package/docs/CAPABILITY_GAP_AUDIT.md +32 -5
- package/docs/GAME-PROMPT.md +915 -0
- package/docs/PLAINSCRIPT-SPEC.md +264 -3
- package/docs/index.html +41 -33
- package/docs/logo-pln.jpg +0 -0
- package/docs/visualization-example.svg +32 -0
- package/docs/website/script.js +130 -1
- package/docs/website/style.css +253 -122
- package/examples/ai-providers.pln +1 -1
- package/examples/arrays.pln +1 -1
- package/examples/async-errors.pln +1 -1
- package/examples/auth-api.pln +1 -1
- package/examples/auth-sessions.pln +1 -1
- package/examples/basics.pln +1 -1
- package/examples/bots.pln +1 -1
- package/examples/browser-interactive/README.md +29 -0
- package/examples/browser-interactive/public/index.html +83 -0
- package/examples/browser-interactive/public/interactive.js +27 -0
- package/examples/browser-interactive/src/interactive.pln +34 -0
- package/examples/cache-and-jobs.pln +1 -1
- package/examples/cache-schedule.pln +1 -1
- package/examples/canvas-game/README.md +34 -0
- package/examples/canvas-game/public/game.js +131 -0
- package/examples/canvas-game/public/index.html +48 -0
- package/examples/canvas-game/src/game.pln +139 -0
- package/examples/collections.pln +1 -1
- package/examples/concurrency.pln +1 -1
- package/examples/conditions.pln +1 -1
- package/examples/database.pln +1 -1
- package/examples/day2.pln +1 -1
- package/examples/day3.pln +1 -1
- package/examples/deployment.pln +1 -1
- package/examples/email-send.pln +1 -1
- package/examples/error-handling.pln +1 -1
- package/examples/expressions.pln +1 -1
- package/examples/file-uploads.pln +1 -1
- package/examples/files-and-config.pln +1 -1
- package/examples/files.pln +1 -1
- package/examples/football-backend/app.pln +1 -1
- package/examples/functions.pln +1 -1
- package/examples/hello.pln +1 -1
- package/examples/http-client.pln +1 -1
- package/examples/http.pln +1 -1
- package/examples/id-verification/app.pln +1 -1
- package/examples/javascript-library/README.md +54 -0
- package/examples/javascript-library/package-lock.json +21 -0
- package/examples/javascript-library/package.json +8 -0
- package/examples/javascript-library/public/config.json +4 -0
- package/examples/javascript-library/public/index.html +40 -0
- package/examples/javascript-library/src/interop.pln +53 -0
- package/examples/json.pln +1 -1
- package/examples/loops.pln +1 -1
- package/examples/modules/app.pln +1 -1
- package/examples/modules/main.pln +1 -1
- package/examples/modules/math.pln +1 -1
- package/examples/mongo.pln +1 -1
- package/examples/objects.pln +1 -1
- package/examples/ocr.pln +1 -1
- package/examples/packages.pln +1 -1
- package/examples/record-kinds.pln +1 -1
- package/examples/records.pln +1 -1
- package/examples/rest-api-fetch.pln +1 -1
- package/examples/rest-api.pln +1 -1
- package/examples/scheduled-tasks.pln +1 -1
- package/examples/search-and-filter.pln +1 -1
- package/examples/server.pln +1 -1
- package/examples/sessions-and-cookies.pln +1 -1
- package/examples/sqlite.pln +1 -1
- package/examples/start.pln +1 -1
- package/examples/stdlib.pln +1 -1
- package/examples/string-verbs.pln +1 -1
- package/examples/telegram-ai-bot.pln +1 -1
- package/examples/telegram-bot.pln +1 -1
- package/examples/testing.pln +1 -1
- package/examples/three-dimensional/README.md +51 -0
- package/examples/three-dimensional/public/index.html +33 -0
- package/examples/three-dimensional/src/scene.pln +34 -0
- package/examples/visualization.pln +12 -0
- package/examples/web-api.pln +1 -1
- package/examples/web-app.pln +1 -1
- package/examples/websocket-server.pln +1 -1
- package/examples/websocket.pln +1 -1
- package/examples/whatsapp-bot/pairing.pln +24 -2
- package/examples/whatsapp-bot/qr.pln +18 -2
- package/package.json +5 -3
- package/docs/logo.jpg +0 -0
package/docs/website/style.css
CHANGED
|
@@ -1,47 +1,40 @@
|
|
|
1
1
|
:root {
|
|
2
|
-
--bg: #
|
|
3
|
-
--bg-elev: #
|
|
4
|
-
--panel:
|
|
5
|
-
--
|
|
6
|
-
--line:
|
|
7
|
-
--
|
|
8
|
-
--
|
|
9
|
-
--
|
|
10
|
-
--accent: #
|
|
11
|
-
--accent-glow: rgba(
|
|
12
|
-
--accent-dim: #
|
|
13
|
-
--
|
|
14
|
-
|
|
15
|
-
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
2
|
+
--bg: #0e1210;
|
|
3
|
+
--bg-elev: #141a17;
|
|
4
|
+
--panel: #131916;
|
|
5
|
+
--line: #233026;
|
|
6
|
+
--line-strong: #34472f;
|
|
7
|
+
--text: #edefea;
|
|
8
|
+
--muted: #7c9186;
|
|
9
|
+
--accent: #35c773;
|
|
10
|
+
--accent-bright: #4fe08a;
|
|
11
|
+
--accent-glow: rgba(53, 199, 115, .16);
|
|
12
|
+
--accent-dim: #17301f;
|
|
13
|
+
--radius: 0px;
|
|
14
|
+
font-family: "Public Sans", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
16
15
|
color: var(--text);
|
|
17
16
|
background: var(--bg);
|
|
18
17
|
}
|
|
19
18
|
|
|
20
19
|
* { box-sizing: border-box; }
|
|
21
|
-
html { scroll-behavior: smooth; }
|
|
20
|
+
html { scroll-behavior: smooth; overflow-x: hidden; }
|
|
22
21
|
body { margin: 0; line-height: 1.6; overflow-x: hidden; }
|
|
23
22
|
a { color: var(--accent); }
|
|
24
|
-
a:hover { color:
|
|
25
|
-
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace; }
|
|
26
|
-
code { font-size: .92em; color: #
|
|
23
|
+
a:hover { color: var(--accent-bright); }
|
|
24
|
+
code, pre { font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", ui-monospace, monospace; }
|
|
25
|
+
code { font-size: .92em; color: #b9e6c7; }
|
|
27
26
|
|
|
28
27
|
.container { width: min(1120px, calc(100% - 40px)); margin: 0 auto; }
|
|
29
28
|
|
|
30
|
-
/* Full-bleed animated background */
|
|
29
|
+
/* Full-bleed animated background — flat, no glow */
|
|
31
30
|
.bg-scrim, #bg-canvas {
|
|
32
31
|
position: fixed;
|
|
33
32
|
inset: 0;
|
|
34
33
|
width: 100%;
|
|
35
34
|
height: 100%;
|
|
36
35
|
}
|
|
37
|
-
.bg-scrim {
|
|
38
|
-
|
|
39
|
-
background:
|
|
40
|
-
radial-gradient(1100px 640px at 78% -10%, rgba(70, 230, 180, .14), transparent 62%),
|
|
41
|
-
radial-gradient(900px 560px at 6% 28%, rgba(60, 110, 240, .12), transparent 60%),
|
|
42
|
-
linear-gradient(180deg, #070c16 0%, #0a1120 55%, #070c16 100%);
|
|
43
|
-
}
|
|
44
|
-
#bg-canvas { z-index: -1; opacity: .85; }
|
|
36
|
+
.bg-scrim { z-index: -2; background: var(--bg); }
|
|
37
|
+
#bg-canvas { z-index: -1; opacity: .18; }
|
|
45
38
|
|
|
46
39
|
/* Nav */
|
|
47
40
|
.site-nav {
|
|
@@ -49,109 +42,213 @@ code { font-size: .92em; color: #bfe9ff; }
|
|
|
49
42
|
top: 0;
|
|
50
43
|
z-index: 6;
|
|
51
44
|
border-bottom: 1px solid transparent;
|
|
52
|
-
background: rgba(
|
|
53
|
-
backdrop-filter: blur(
|
|
45
|
+
background: rgba(14, 18, 16, .92);
|
|
46
|
+
backdrop-filter: blur(8px);
|
|
54
47
|
transition: background .3s ease, border-color .3s ease;
|
|
55
48
|
}
|
|
56
|
-
.site-nav.is-scrolled { background: rgba(
|
|
57
|
-
.nav-inner, .nav-logo, .nav-links, .
|
|
58
|
-
.nav-inner { min-height:
|
|
59
|
-
.nav-logo { gap: 10px; color: var(--text); font-weight:
|
|
60
|
-
.nav-logo-
|
|
49
|
+
.site-nav.is-scrolled { background: rgba(14, 18, 16, .98); border-color: var(--line); }
|
|
50
|
+
.nav-inner, .nav-logo, .nav-links, .footer-bottom, .library-toolbar { display: flex; align-items: center; }
|
|
51
|
+
.nav-inner { min-height: 64px; justify-content: space-between; gap: 24px; }
|
|
52
|
+
.nav-logo { gap: 10px; color: var(--text); font-weight: 500; text-decoration: none; letter-spacing: -.01em; }
|
|
53
|
+
.nav-logo-image {
|
|
61
54
|
display: inline-grid;
|
|
62
55
|
place-items: center;
|
|
63
|
-
width:
|
|
64
|
-
height:
|
|
65
|
-
border-radius:
|
|
66
|
-
|
|
67
|
-
background: var(--accent);
|
|
68
|
-
font-size: .82rem;
|
|
69
|
-
font-weight: 900;
|
|
70
|
-
box-shadow: 0 0 18px var(--accent-glow);
|
|
56
|
+
width: 26px;
|
|
57
|
+
height: 26px;
|
|
58
|
+
border-radius: 0;
|
|
59
|
+
object-fit: cover;
|
|
71
60
|
}
|
|
72
|
-
.logo-ver { padding:
|
|
61
|
+
.logo-ver { padding: 0; color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: .76rem; font-weight: 400; }
|
|
73
62
|
.nav-links { gap: 22px; }
|
|
74
63
|
.nav-links a { color: var(--muted); font-size: .9rem; text-decoration: none; transition: color .2s; }
|
|
75
64
|
.nav-links a:hover { color: var(--accent); }
|
|
76
65
|
|
|
77
|
-
/*
|
|
78
|
-
.
|
|
79
|
-
|
|
80
|
-
|
|
66
|
+
/* Hamburger toggle */
|
|
67
|
+
.nav-toggle {
|
|
68
|
+
display: none;
|
|
69
|
+
flex-direction: column;
|
|
70
|
+
justify-content: center;
|
|
71
|
+
gap: 5px;
|
|
72
|
+
width: 44px;
|
|
73
|
+
height: 44px;
|
|
74
|
+
padding: 10px;
|
|
75
|
+
border: none;
|
|
76
|
+
border-radius: 0;
|
|
77
|
+
background: transparent;
|
|
78
|
+
cursor: pointer;
|
|
79
|
+
-webkit-tap-highlight-color: transparent;
|
|
80
|
+
}
|
|
81
|
+
.nav-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
82
|
+
.nav-toggle-bar { display: block; width: 100%; height: 2px; background: var(--text); transition: transform .3s ease, opacity .3s ease; }
|
|
83
|
+
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
|
|
84
|
+
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) { opacity: 0; }
|
|
85
|
+
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
|
|
86
|
+
|
|
87
|
+
/* Hero — asymmetric, the headline is the demo */
|
|
88
|
+
.hero { position: relative; border-bottom: 1px solid var(--line); }
|
|
89
|
+
.hero-content { position: relative; z-index: 1; padding: 0; }
|
|
90
|
+
.hero-grid {
|
|
91
|
+
display: grid;
|
|
92
|
+
grid-template-columns: 1.1fr 1fr;
|
|
93
|
+
}
|
|
94
|
+
.hero-headline-block {
|
|
95
|
+
padding: 56px 40px 48px 0;
|
|
96
|
+
border-right: 1px solid var(--line);
|
|
97
|
+
}
|
|
98
|
+
.hero-badge {
|
|
99
|
+
display: block;
|
|
100
|
+
margin: 0 0 18px;
|
|
101
|
+
color: var(--muted);
|
|
102
|
+
font-family: "JetBrains Mono", monospace;
|
|
103
|
+
font-size: .84rem;
|
|
104
|
+
font-weight: 400;
|
|
105
|
+
}
|
|
81
106
|
.hero-title {
|
|
82
|
-
|
|
83
|
-
|
|
107
|
+
margin: 0 0 22px;
|
|
108
|
+
color: var(--text);
|
|
109
|
+
font-family: "Newsreader", Georgia, serif;
|
|
110
|
+
font-weight: 500;
|
|
111
|
+
font-size: clamp(1.7rem, 3vw, 2.3rem);
|
|
112
|
+
line-height: 1.55;
|
|
113
|
+
letter-spacing: -.01em;
|
|
114
|
+
}
|
|
115
|
+
.hero-title .kw { color: var(--accent); font-family: "JetBrains Mono", monospace; font-size: .85em; }
|
|
116
|
+
.hero-lead { max-width: 420px; margin: 0 0 26px; color: var(--muted); font-size: 1rem; line-height: 1.75; }
|
|
117
|
+
.hero-actions { display: block; margin: 0; }
|
|
118
|
+
.hero-install-label { display: block; color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: .76rem; margin-bottom: 6px; }
|
|
119
|
+
.hero-actions .button {
|
|
120
|
+
display: inline-block;
|
|
121
|
+
padding: 0;
|
|
122
|
+
border: none;
|
|
123
|
+
border-radius: 0;
|
|
124
|
+
background: none;
|
|
84
125
|
color: var(--text);
|
|
85
|
-
font-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
text-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
.hero-actions {
|
|
93
|
-
.
|
|
94
|
-
.
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
126
|
+
font-family: "JetBrains Mono", monospace;
|
|
127
|
+
font-size: .95rem;
|
|
128
|
+
font-weight: 500;
|
|
129
|
+
text-decoration: none;
|
|
130
|
+
border-bottom: 1px solid var(--line-strong);
|
|
131
|
+
transition: border-color .2s, color .2s;
|
|
132
|
+
}
|
|
133
|
+
.hero-actions .button:hover { color: var(--accent); border-color: var(--accent); transform: none; }
|
|
134
|
+
.hero-panel { padding: 0; display: flex; flex-direction: column; }
|
|
135
|
+
.hero-panel-label {
|
|
136
|
+
padding: 12px 24px;
|
|
137
|
+
border-bottom: 1px solid var(--line);
|
|
138
|
+
color: var(--muted);
|
|
139
|
+
font-family: "JetBrains Mono", monospace;
|
|
140
|
+
font-size: .74rem;
|
|
141
|
+
}
|
|
142
|
+
.button { display: inline-block; padding: 11px 18px; border: 1px solid var(--line-strong); border-radius: 0; font-weight: 500; text-decoration: none; transition: border-color .2s ease, color .2s ease, background .2s ease; }
|
|
143
|
+
.button-primary { color: var(--bg); background: var(--accent); border-color: var(--accent); }
|
|
144
|
+
.button-primary:hover { background: var(--accent-bright); border-color: var(--accent-bright); }
|
|
145
|
+
.button-secondary { color: var(--text); background: transparent; }
|
|
146
|
+
.button-secondary:hover { color: var(--accent); border-color: var(--accent); }
|
|
147
|
+
.reference-actions { display: flex; gap: 0; flex-wrap: wrap; margin: 24px 0; }
|
|
148
|
+
.button-reference {
|
|
149
|
+
color: var(--text);
|
|
150
|
+
border: 1px solid var(--line-strong);
|
|
151
|
+
border-radius: 0;
|
|
152
|
+
margin: 0 -1px -1px 0;
|
|
153
|
+
background: transparent;
|
|
154
|
+
}
|
|
155
|
+
.button-reference:hover { color: var(--accent); border-color: var(--accent); }
|
|
98
156
|
|
|
99
157
|
/* Code windows */
|
|
100
158
|
.code-window {
|
|
101
159
|
position: relative;
|
|
102
|
-
|
|
160
|
+
width: 100%;
|
|
161
|
+
max-width: 100%;
|
|
162
|
+
min-width: 0;
|
|
163
|
+
overflow: hidden;
|
|
103
164
|
margin: 28px 0 0;
|
|
104
|
-
padding:
|
|
105
|
-
border: 1px solid var(--line
|
|
106
|
-
border-radius:
|
|
107
|
-
color: #
|
|
108
|
-
background:
|
|
109
|
-
box-shadow: 0 24px 60px rgba(0, 0, 0, .5);
|
|
165
|
+
padding: 20px 24px;
|
|
166
|
+
border: 1px solid var(--line);
|
|
167
|
+
border-radius: 0;
|
|
168
|
+
color: #d6ead7;
|
|
169
|
+
background: var(--panel);
|
|
110
170
|
}
|
|
111
|
-
.code-window
|
|
112
|
-
|
|
171
|
+
.hero-panel .code-window { margin: 0; border: none; flex: 1; }
|
|
172
|
+
.code-window::before { content: none; }
|
|
173
|
+
.code-window code { color: inherit; }
|
|
174
|
+
pre code {
|
|
113
175
|
display: block;
|
|
114
|
-
width:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
176
|
+
max-width: 100%;
|
|
177
|
+
color: #d6ead7;
|
|
178
|
+
font-size: .86rem;
|
|
179
|
+
font-weight: 400;
|
|
180
|
+
letter-spacing: -.006em;
|
|
181
|
+
line-height: 1.7;
|
|
182
|
+
white-space: pre-wrap;
|
|
183
|
+
overflow-wrap: anywhere;
|
|
184
|
+
word-break: break-word;
|
|
119
185
|
}
|
|
120
|
-
.code-
|
|
186
|
+
.code-token--keyword { color: var(--accent); font-weight: 500; }
|
|
187
|
+
.code-token--declaration { color: var(--accent); font-weight: 500; font-style: normal; }
|
|
188
|
+
.code-token--comparison,
|
|
189
|
+
.code-token--operator { color: #7fc8d6; }
|
|
190
|
+
.code-token--assignment,
|
|
191
|
+
.code-token--web,
|
|
192
|
+
.code-token--error { color: #e0847e; }
|
|
193
|
+
.code-token--string,
|
|
194
|
+
.code-token--template,
|
|
195
|
+
.code-token--test { color: #b9e6c7; }
|
|
196
|
+
.code-token--number,
|
|
197
|
+
.code-token--constant { color: #d4b483; }
|
|
198
|
+
.code-token--comment { color: #5c6a61; font-style: italic; }
|
|
199
|
+
.code-token--function { color: #7fb0e0; font-weight: 500; }
|
|
200
|
+
.code-token--builtin,
|
|
201
|
+
.code-token--database { color: #d6c27f; }
|
|
202
|
+
.copy-button {
|
|
203
|
+
position: absolute;
|
|
204
|
+
top: 10px;
|
|
205
|
+
right: 10px;
|
|
206
|
+
min-height: 30px;
|
|
207
|
+
padding: 4px 9px;
|
|
208
|
+
border: 1px solid var(--line-strong);
|
|
209
|
+
border-radius: 0;
|
|
210
|
+
color: var(--muted);
|
|
211
|
+
background: var(--bg);
|
|
212
|
+
cursor: pointer;
|
|
213
|
+
font: inherit;
|
|
214
|
+
font-size: .72rem;
|
|
215
|
+
line-height: 1.2;
|
|
216
|
+
transition: color .2s, border-color .2s, background .2s;
|
|
217
|
+
}
|
|
218
|
+
.copy-button:hover, .copy-button:focus-visible { color: var(--accent); border-color: var(--accent); background: var(--accent-dim); }
|
|
219
|
+
.copy-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
|
|
220
|
+
.copy-button.is-copied { color: var(--bg); border-color: var(--accent); background: var(--accent); }
|
|
121
221
|
|
|
122
|
-
.section { padding:
|
|
123
|
-
.section--alt { background:
|
|
124
|
-
.section-
|
|
222
|
+
.section { padding: 72px 0; border-bottom: 1px solid var(--line); }
|
|
223
|
+
.section--alt { background: var(--bg-elev); }
|
|
224
|
+
.section-tag { margin: 0 0 8px; color: var(--muted); font-family: "JetBrains Mono", monospace; font-size: .8rem; font-weight: 400; }
|
|
225
|
+
.section-title { max-width: 640px; margin: 0 0 34px; color: var(--text); font-family: "Newsreader", Georgia, serif; font-weight: 500; font-size: clamp(1.6rem, 3.4vw, 2.4rem); line-height: 1.3; letter-spacing: -.01em; }
|
|
125
226
|
.section-lead { color: var(--muted); }
|
|
126
|
-
.three-column, .feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap:
|
|
227
|
+
.three-column, .feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
|
|
127
228
|
|
|
128
|
-
/* Cards */
|
|
229
|
+
/* Cards — flat, hairline-separated, no shadow */
|
|
129
230
|
.info-card, .feature-card, .library-card {
|
|
130
231
|
padding: 24px;
|
|
131
|
-
border:
|
|
132
|
-
border-radius:
|
|
232
|
+
border: none;
|
|
233
|
+
border-radius: 0;
|
|
133
234
|
background: var(--panel);
|
|
134
|
-
|
|
135
|
-
transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
|
|
136
|
-
}
|
|
137
|
-
.info-card:hover, .feature-card:hover, .library-card:hover {
|
|
138
|
-
transform: translateY(-4px);
|
|
139
|
-
border-color: var(--line-strong);
|
|
140
|
-
box-shadow: 0 18px 44px rgba(0, 0, 0, .45);
|
|
235
|
+
transition: background .2s ease;
|
|
141
236
|
}
|
|
142
|
-
.info-card
|
|
237
|
+
.info-card:hover, .feature-card:hover, .library-card:hover { transform: none; background: var(--bg-elev); box-shadow: none; }
|
|
238
|
+
.info-card h3, .feature-card h3, .library-card h3 { margin: 8px 0 6px; color: var(--text); font-weight: 500; }
|
|
143
239
|
.info-card p, .feature-card p, .library-card p { margin: 0; color: var(--muted); }
|
|
144
|
-
.card-number { color: var(--accent); font-
|
|
240
|
+
.card-number { color: var(--accent); font-family: "JetBrains Mono", monospace; font-size: .8rem; font-weight: 400; }
|
|
145
241
|
|
|
146
|
-
.capability-list { display: flex; gap:
|
|
242
|
+
.capability-list { display: flex; gap: 0; flex-wrap: wrap; border-top: 1px solid var(--line); border-left: 1px solid var(--line); }
|
|
147
243
|
.capability-list span, .library-category {
|
|
148
|
-
padding: 8px
|
|
149
|
-
border-radius:
|
|
150
|
-
color: var(--
|
|
151
|
-
border: 1px solid var(--line
|
|
152
|
-
|
|
244
|
+
padding: 8px 14px;
|
|
245
|
+
border-radius: 0;
|
|
246
|
+
color: var(--muted);
|
|
247
|
+
border-right: 1px solid var(--line);
|
|
248
|
+
border-bottom: 1px solid var(--line);
|
|
249
|
+
background: transparent;
|
|
153
250
|
font-size: .84rem;
|
|
154
|
-
font-weight:
|
|
251
|
+
font-weight: 400;
|
|
155
252
|
}
|
|
156
253
|
|
|
157
254
|
/* Library */
|
|
@@ -160,20 +257,21 @@ code { font-size: .92em; color: #bfe9ff; }
|
|
|
160
257
|
min-width: 240px;
|
|
161
258
|
padding: 12px 14px;
|
|
162
259
|
border: 1px solid var(--line-strong);
|
|
163
|
-
border-radius:
|
|
260
|
+
border-radius: 0;
|
|
164
261
|
font: inherit;
|
|
165
262
|
color: var(--text);
|
|
166
|
-
background:
|
|
263
|
+
background: var(--panel);
|
|
167
264
|
outline: none;
|
|
168
265
|
transition: border-color .2s, box-shadow .2s;
|
|
169
266
|
}
|
|
170
267
|
.lib-search-input::placeholder { color: var(--muted); }
|
|
171
|
-
.lib-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0
|
|
172
|
-
.lib-filters { display: flex; gap:
|
|
268
|
+
.lib-search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-glow); }
|
|
269
|
+
.lib-filters { display: flex; gap: 0; flex-wrap: wrap; }
|
|
173
270
|
.lib-filter {
|
|
174
271
|
padding: 8px 12px;
|
|
175
272
|
border: 1px solid var(--line-strong);
|
|
176
|
-
border-radius:
|
|
273
|
+
border-radius: 0;
|
|
274
|
+
margin: 0 -1px -1px 0;
|
|
177
275
|
color: var(--muted);
|
|
178
276
|
background: transparent;
|
|
179
277
|
cursor: pointer;
|
|
@@ -182,39 +280,72 @@ code { font-size: .92em; color: #bfe9ff; }
|
|
|
182
280
|
text-transform: capitalize;
|
|
183
281
|
transition: all .2s;
|
|
184
282
|
}
|
|
185
|
-
.lib-filter.is-active, .lib-filter:hover { color:
|
|
186
|
-
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap:
|
|
283
|
+
.lib-filter.is-active, .lib-filter:hover { color: var(--bg); border-color: var(--accent); background: var(--accent); box-shadow: none; }
|
|
284
|
+
.lib-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); }
|
|
187
285
|
.library-card-top { min-height: 102px; }
|
|
188
286
|
.library-card pre {
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
287
|
+
position: relative;
|
|
288
|
+
width: 100%;
|
|
289
|
+
max-width: 100%;
|
|
290
|
+
min-width: 0;
|
|
291
|
+
overflow: hidden;
|
|
292
|
+
margin: 18px 0 -8px;
|
|
293
|
+
padding: 44px 16px 16px;
|
|
294
|
+
border-radius: 0;
|
|
295
|
+
color: #d6ead7;
|
|
296
|
+
background: var(--bg);
|
|
195
297
|
border: 1px solid var(--line);
|
|
196
298
|
font-size: .82rem;
|
|
197
299
|
}
|
|
198
300
|
.lib-empty { color: var(--muted); }
|
|
199
301
|
|
|
200
302
|
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
|
|
201
|
-
.site-footer { padding:
|
|
202
|
-
.footer-bottom { justify-content: space-between; gap: 16px; }
|
|
303
|
+
.site-footer { padding: 24px 0; color: var(--muted); border-top: 1px solid var(--line); background: var(--bg); }
|
|
304
|
+
.footer-bottom { justify-content: space-between; gap: 16px; font-family: "JetBrains Mono", monospace; font-size: .8rem; }
|
|
203
305
|
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
|
|
204
306
|
|
|
205
|
-
::selection { color:
|
|
307
|
+
::selection { color: var(--bg); background: var(--accent); }
|
|
206
308
|
textarea, input { caret-color: var(--accent); }
|
|
207
309
|
|
|
208
310
|
@media (prefers-reduced-motion: reduce) {
|
|
209
311
|
html { scroll-behavior: auto; }
|
|
210
312
|
* { animation: none !important; transition: none !important; }
|
|
211
|
-
.info-card:hover, .feature-card:hover, .library-card:hover { transform: none; }
|
|
212
313
|
}
|
|
213
314
|
|
|
315
|
+
/* ──────────────────────────────────────────────────────────────────────
|
|
316
|
+
MOBILE LAYOUT (≤ 760px)
|
|
317
|
+
────────────────────────────────────────────────────────────────────── */
|
|
214
318
|
@media (max-width: 760px) {
|
|
215
|
-
.nav-
|
|
216
|
-
.nav-
|
|
217
|
-
.
|
|
319
|
+
.nav-toggle { display: flex; }
|
|
320
|
+
.nav-inner { flex-wrap: wrap; padding: 12px 0; }
|
|
321
|
+
.nav-links { display: none; flex-basis: 100%; flex-direction: column; gap: 0; padding: 8px 0 4px; }
|
|
322
|
+
.nav-links.is-open { display: flex; }
|
|
323
|
+
.nav-links a { display: flex; align-items: center; min-height: 44px; padding: 6px 0; font-size: 1rem; color: var(--muted); border-bottom: 1px solid var(--line); }
|
|
324
|
+
.nav-links a:last-child { border-bottom: none; }
|
|
325
|
+
|
|
326
|
+
.hero-grid { grid-template-columns: 1fr; }
|
|
327
|
+
.hero-headline-block { padding: 40px 0 32px; border-right: none; border-bottom: 1px solid var(--line); }
|
|
328
|
+
.hero-title { font-size: 1.5rem; line-height: 1.5; }
|
|
329
|
+
.hero-lead { font-size: .98rem; line-height: 1.65; max-width: 100%; }
|
|
330
|
+
.hero-panel { border-top: none; }
|
|
331
|
+
|
|
332
|
+
.button { padding: 12px 20px; font-size: .95rem; min-height: 44px; }
|
|
333
|
+
.code-window { padding: 16px 14px; font-size: .82rem; }
|
|
334
|
+
|
|
335
|
+
.section { padding: 44px 0; }
|
|
336
|
+
.section-title { font-size: clamp(1.4rem, 6vw, 1.9rem); margin-bottom: 22px; }
|
|
337
|
+
|
|
218
338
|
.three-column, .feature-grid, .lib-grid, .split { grid-template-columns: 1fr; }
|
|
219
|
-
|
|
220
|
-
}
|
|
339
|
+
|
|
340
|
+
.info-card, .feature-card, .library-card { padding: 20px 18px; }
|
|
341
|
+
.capability-list span { font-size: .8rem; padding: 7px 10px; }
|
|
342
|
+
|
|
343
|
+
.library-toolbar { flex-direction: column; gap: 12px; }
|
|
344
|
+
.lib-search-input { width: 100%; min-width: 0; font-size: 1rem; }
|
|
345
|
+
.lib-filters { width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
|
|
346
|
+
.lib-filter { white-space: nowrap; min-height: 40px; font-size: .84rem; }
|
|
347
|
+
|
|
348
|
+
.split { gap: 24px; }
|
|
349
|
+
.footer-bottom { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
|
|
350
|
+
#bg-canvas { width: 100vw; height: 100vh; pointer-events: none; }
|
|
351
|
+
}
|
package/examples/arrays.pln
CHANGED
package/examples/auth-api.pln
CHANGED
package/examples/basics.pln
CHANGED
package/examples/bots.pln
CHANGED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
# DOM-first interactive clicker
|
|
2
|
+
|
|
3
|
+
A small dashboard built with PlainScript that talks to the DOM directly —
|
|
4
|
+
no canvas, no library, no bundler. Click **+10 points** and the score span
|
|
5
|
+
updates; click **Log entry** to append a line to the run log; press **R** to
|
|
6
|
+
reset both.
|
|
7
|
+
|
|
8
|
+
It demonstrates the v1.0.36 browser API:
|
|
9
|
+
|
|
10
|
+
- `document.querySelector` + `.innerHTML becomes` / `.textContent becomes`.
|
|
11
|
+
- `when clickButton "click" happens` DOM event handlers.
|
|
12
|
+
- `document.createElement("li")` + `historyEl.appendChild(item)`.
|
|
13
|
+
- Reading state back out of the DOM (`parseInt(scoreEl.textContent)`) instead
|
|
14
|
+
of keeping a parallel variable.
|
|
15
|
+
- `document.addEventListener("keydown", ...)` via `when document "keydown" happens as e`
|
|
16
|
+
and `classList.add` / `classList.remove`.
|
|
17
|
+
- The DOM-overlay UI pattern: a plain HTML dashboard driving game-style logic.
|
|
18
|
+
|
|
19
|
+
## Run
|
|
20
|
+
|
|
21
|
+
Build the compiled script and serve the folder (any static file server works —
|
|
22
|
+
`npx serve public` is one option):
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx plainscript build src/interactive.pln -o public/interactive.js
|
|
26
|
+
npx serve public
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Then open http://localhost:3000.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
6
|
+
<title>PlainScript Clicker</title>
|
|
7
|
+
<style>
|
|
8
|
+
body {
|
|
9
|
+
margin: 0;
|
|
10
|
+
min-height: 100vh;
|
|
11
|
+
display: flex;
|
|
12
|
+
flex-direction: column;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: center;
|
|
15
|
+
gap: 16px;
|
|
16
|
+
background: #0d1117;
|
|
17
|
+
color: #e6edf3;
|
|
18
|
+
font-family: system-ui, "Segoe UI", sans-serif;
|
|
19
|
+
}
|
|
20
|
+
.card {
|
|
21
|
+
width: 360px;
|
|
22
|
+
padding: 20px;
|
|
23
|
+
border: 1px solid #30363d;
|
|
24
|
+
border-radius: 10px;
|
|
25
|
+
background: #161b22;
|
|
26
|
+
text-align: center;
|
|
27
|
+
}
|
|
28
|
+
#score { font-size: 34px; font-weight: 700; color: #40c463; }
|
|
29
|
+
.row { display: flex; gap: 10px; justify-content: center; }
|
|
30
|
+
button {
|
|
31
|
+
padding: 10px 16px;
|
|
32
|
+
font-size: 14px;
|
|
33
|
+
font-weight: 600;
|
|
34
|
+
border: none;
|
|
35
|
+
border-radius: 8px;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
background: #40c463;
|
|
38
|
+
color: #0d1117;
|
|
39
|
+
}
|
|
40
|
+
button.secondary { background: #30363d; color: #e6edf3; }
|
|
41
|
+
button.level-up { animation: pulse 0.6s ease-in-out; }
|
|
42
|
+
@keyframes pulse {
|
|
43
|
+
0% { transform: scale(1); }
|
|
44
|
+
50% { transform: scale(1.12); }
|
|
45
|
+
100% { transform: scale(1); }
|
|
46
|
+
}
|
|
47
|
+
ul#history {
|
|
48
|
+
list-style: none;
|
|
49
|
+
padding: 0;
|
|
50
|
+
margin: 0;
|
|
51
|
+
max-height: 140px;
|
|
52
|
+
overflow: auto;
|
|
53
|
+
font-size: 13px;
|
|
54
|
+
color: #8b949e;
|
|
55
|
+
text-align: left;
|
|
56
|
+
}
|
|
57
|
+
ul#history li { padding: 2px 0; }
|
|
58
|
+
kbd {
|
|
59
|
+
padding: 1px 5px;
|
|
60
|
+
border: 1px solid #30363d;
|
|
61
|
+
border-radius: 4px;
|
|
62
|
+
background: #21262d;
|
|
63
|
+
font-size: 12px;
|
|
64
|
+
}
|
|
65
|
+
</style>
|
|
66
|
+
</head>
|
|
67
|
+
<body>
|
|
68
|
+
<div class="card">
|
|
69
|
+
<h1>PlainScript Clicker</h1>
|
|
70
|
+
<p><span id="score">0</span></p>
|
|
71
|
+
<div class="row">
|
|
72
|
+
<button id="click-button" type="button">+10 points</button>
|
|
73
|
+
<button id="log-button" type="button" class="secondary">Log entry</button>
|
|
74
|
+
</div>
|
|
75
|
+
<p><kbd>R</kbd> resets the score and history</p>
|
|
76
|
+
</div>
|
|
77
|
+
<div class="card">
|
|
78
|
+
<h2>Run log</h2>
|
|
79
|
+
<ul id="history"></ul>
|
|
80
|
+
</div>
|
|
81
|
+
<script src="interactive.js"></script>
|
|
82
|
+
</body>
|
|
83
|
+
</html>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
let scoreEl = document.querySelector("#score");
|
|
2
|
+
let historyEl = document.querySelector("#history");
|
|
3
|
+
let clickButton = document.querySelector("#click-button");
|
|
4
|
+
let logButton = document.querySelector("#log-button");
|
|
5
|
+
let entryCount = 0;
|
|
6
|
+
console.log("PlainScript clicker dashboard ready");
|
|
7
|
+
clickButton.addEventListener("click", function (event) {
|
|
8
|
+
let current = parseInt(scoreEl.textContent);
|
|
9
|
+
let updated = current + 10;
|
|
10
|
+
scoreEl.innerHTML = String(updated);
|
|
11
|
+
if (updated >= 50) {
|
|
12
|
+
clickButton.classList.add("level-up");
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
logButton.addEventListener("click", function (event) {
|
|
16
|
+
entryCount = entryCount + 1;
|
|
17
|
+
let item = document.createElement("li");
|
|
18
|
+
item.textContent = ((("Entry " + entryCount) + " (score ") + scoreEl.textContent) + ")";
|
|
19
|
+
historyEl.appendChild(item);
|
|
20
|
+
});
|
|
21
|
+
document.addEventListener("keydown", function (e) {
|
|
22
|
+
if (e.key === "r" || e.key === "R") {
|
|
23
|
+
scoreEl.textContent = "0";
|
|
24
|
+
clickButton.classList.remove("level-up");
|
|
25
|
+
historyEl.innerHTML = "";
|
|
26
|
+
}
|
|
27
|
+
});
|