juxscript 1.1.318 → 1.1.320

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.
@@ -1 +1 @@
1
- {"version":3,"file":"codeparser.d.ts","sourceRoot":"","sources":["../../../lib/utils/codeparser.ts"],"names":[],"mappings":"AA2DA,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOxC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqB,GAAG,UAAU,EAAE,CAQrF;AAwOD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAkG9C;;;;;;;AAED,wBAKE"}
1
+ {"version":3,"file":"codeparser.d.ts","sourceRoot":"","sources":["../../../lib/utils/codeparser.ts"],"names":[],"mappings":"AA2DA,MAAM,WAAW,UAAU;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,iBAAS,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOxC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,GAAE,MAAqB,GAAG,UAAU,EAAE,CAQrF;AAuPD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,UAAU,EAAE,UAAU,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,qBAAqB,IAAI,MAAM,CAyD9C;;;;;;;AAED,wBAKE"}
@@ -225,7 +225,16 @@ function tokenizeLine(line) {
225
225
  result += `<span class="${tokenClass}">${escaped}</span>`;
226
226
  }
227
227
  else {
228
- result += escaped;
228
+ // Check if it's a function call
229
+ let k = i + word.length;
230
+ while (k < len && line[k] === ' ')
231
+ k++;
232
+ if (line[k] === '(') {
233
+ result += `<span class="token-function">${escaped}</span>`;
234
+ }
235
+ else {
236
+ result += `<span class="token-identifier">${escaped}</span>`;
237
+ }
229
238
  }
230
239
  i += word.length;
231
240
  continue;
@@ -237,6 +246,13 @@ function tokenizeLine(line) {
237
246
  i += num.length;
238
247
  continue;
239
248
  }
249
+ // Dot/spread
250
+ if (char === '.') {
251
+ const op = consumeOperator(line, i);
252
+ result += `<span class="token-operator">${escapeHtml(op)}</span>`;
253
+ i += op.length;
254
+ continue;
255
+ }
240
256
  // Operators (multi-char)
241
257
  if (isOperator(char)) {
242
258
  const op = consumeOperator(line, i);
@@ -304,102 +320,61 @@ export function renderLineWithTokens(parsedLine) {
304
320
  */
305
321
  export function getSyntaxHighlightCSS() {
306
322
  return `
307
- /* Semantic Code Highlighting */
308
323
  .jux-code {
309
- font-family: 'Consolas', 'Monaco', monospace;
324
+ font-family: 'SF Mono', 'Fira Code', 'Consolas', 'Monaco', monospace;
310
325
  font-size: 14px;
311
- line-height: 1.6;
312
- background: #1e1e1e;
313
- border-radius: 8px;
326
+ font-weight: 500;
327
+ line-height: 1.7;
328
+ background: hsl(var(--muted, 0 0% 96%));
329
+ color: hsl(var(--foreground, 0 0% 9%));
330
+ border: 1px solid hsl(var(--border, 0 0% 89.8%));
331
+ border-radius: var(--radius, 6px);
314
332
  overflow: hidden;
315
- margin: 1rem 0;
333
+ margin: 0;
316
334
  padding: 1rem;
317
335
  overflow-x: auto;
318
336
  }
319
-
320
337
  .jux-code-lines {
321
338
  display: block;
322
339
  }
323
-
324
340
  .jux-code-line {
325
341
  display: flex;
326
342
  align-items: flex-start;
327
- min-height: 1.6em;
343
+ min-height: 1.7em;
328
344
  }
329
-
330
345
  .jux-code-line:hover {
331
- background-color: rgba(255, 255, 255, 0.03);
346
+ background-color: hsl(var(--accent, 0 0% 93%) / 0.5);
332
347
  }
333
-
334
- .jux-code-line-highlight {
335
- background-color: rgba(255, 215, 0, 0.1);
336
- border-left: 3px solid #ffd700;
337
- padding-left: 0.5rem;
338
- }
339
-
340
348
  .jux-code-line-number {
341
349
  display: inline-block;
342
- min-width: 3rem;
350
+ min-width: 2.5rem;
343
351
  text-align: right;
344
352
  padding-right: 1rem;
345
- color: #858585;
353
+ color: hsl(var(--muted-foreground, 0 0% 45%));
346
354
  user-select: none;
347
355
  flex-shrink: 0;
356
+ font-size: 12px;
348
357
  }
349
-
350
358
  .jux-code-line-content {
351
359
  flex: 1;
352
- color: #d4d4d4;
353
360
  white-space: pre;
354
- overflow-x: auto;
355
- }
356
-
357
- .jux-code-no-numbers .jux-code-line-number {
358
- display: none;
359
361
  }
360
362
 
361
- /* Token colors - Semantic categories */
362
- .token-control {
363
- color: #c678dd; /* Purple - control flow (if, for, return) */
364
- font-weight: 600;
365
- }
366
- .token-declaration {
367
- color: #61afef; /* Blue - declarations (const, let, function) */
368
- font-weight: 600;
369
- }
370
- .token-operator-keyword {
371
- color: #e06c75; /* Red - operator keywords (typeof, instanceof) */
372
- font-weight: 600;
373
- }
374
- .token-special {
375
- color: #e5c07b; /* Yellow - special keywords (this, super, async) */
376
- font-weight: 600;
377
- }
378
- .token-jux {
379
- color: #56b6c2; /* Cyan - JUX-specific (jux, state, render) */
380
- font-weight: 700;
381
- }
382
- .token-number {
383
- color: #d19a66; /* Orange - numbers */
384
- }
385
- .token-string {
386
- color: #98c379; /* Green - strings */
387
- }
388
- .token-comment {
389
- color: #5c6370; /* Gray - comments */
390
- font-style: italic;
391
- }
392
- .token-structural {
393
- color: #abb2bf; /* Light gray - braces, brackets, parens */
394
- font-weight: 600;
395
- }
396
- .token-delimiter {
397
- color: #777; /* Dark gray - semicolons, commas, colons */
398
- }
399
- .token-operator {
400
- color: #56b6c2; /* Cyan - operators (+, -, *, etc.) */
401
- }
402
- `;
363
+ /* Token colors — shadcn-aware light theme */
364
+ .token-control { color: hsl(262 83% 50%); font-weight: 700; }
365
+ .token-declaration { color: hsl(221 83% 45%); font-weight: 700; }
366
+ .token-operator-keyword { color: hsl(0 68% 45%); font-weight: 600; }
367
+ .token-special { color: hsl(35 80% 40%); font-weight: 600; }
368
+ .token-jux { color: hsl(187 70% 35%); font-weight: 700; }
369
+ .token-number { color: hsl(25 85% 45%); font-weight: 500; }
370
+ .token-string { color: hsl(142 60% 35%); font-weight: 500; }
371
+ .token-comment { color: hsl(var(--muted-foreground, 0 0% 45%)); font-style: italic; font-weight: 400; }
372
+ .token-function { color: hsl(221 83% 45%); font-weight: 600; }
373
+ .token-identifier { color: hsl(var(--foreground, 0 0% 9%)); font-weight: 500; }
374
+ .token-structural { color: hsl(var(--foreground, 0 0% 9%)); font-weight: 700; }
375
+ .token-delimiter { color: hsl(var(--muted-foreground, 0 0% 45%)); font-weight: 500; }
376
+ .token-operator { color: hsl(187 70% 35%); font-weight: 600; }
377
+ `;
403
378
  }
404
379
  export default {
405
380
  parse: parseCode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juxscript",
3
- "version": "1.1.318",
3
+ "version": "1.1.320",
4
4
  "type": "module",
5
5
  "description": "A JavaScript UX authorship platform",
6
6
  "main": "./dist/lib/index.js",