@walkeros/explorer 0.3.0 → 0.3.1

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/dist/index.mjs CHANGED
@@ -5,7 +5,7 @@ import {
5
5
  loadPackageTypes,
6
6
  loadTypeLibraryFromURL,
7
7
  registerWalkerOSTypes
8
- } from "./chunk-P5UDSGZL.mjs";
8
+ } from "./chunk-BEAIHYJ5.mjs";
9
9
 
10
10
  // src/components/demos/MappingDemo.tsx
11
11
  import { useState as useState5, useCallback as useCallback4, useEffect as useEffect4 } from "react";
@@ -202,8 +202,9 @@ var palenightTheme = {
202
202
  // Transparent
203
203
  "editorLineNumber.foreground": "#676E95",
204
204
  "editorLineNumber.activeForeground": "#c084fc",
205
- // Editor Cursor & Selection - transparent for read-only snippets
206
- "editorCursor.foreground": "#00000000",
205
+ // Editor Cursor & Selection
206
+ "editorCursor.foreground": "#c084fc",
207
+ // Purple cursor for dark theme
207
208
  "editor.selectionBackground": "#00000000",
208
209
  "editor.inactiveSelectionBackground": "#00000000",
209
210
  "editor.selectionHighlightBackground": "#00000000",
@@ -404,8 +405,9 @@ var lighthouseTheme = {
404
405
  // Transparent
405
406
  "editorLineNumber.foreground": "#1B1F2380",
406
407
  "editorLineNumber.activeForeground": "#6F42C1",
407
- // Editor Cursor & Selection - transparent for read-only snippets
408
- "editorCursor.foreground": "#00000000",
408
+ // Editor Cursor & Selection
409
+ "editorCursor.foreground": "#6F42C1",
410
+ // Purple cursor for light theme
409
411
  "editor.selectionBackground": "#00000000",
410
412
  "editor.inactiveSelectionBackground": "#00000000",
411
413
  "editor.selectionHighlightBackground": "#00000000",
@@ -548,6 +550,130 @@ function registerDataElbStyles() {
548
550
  document.head.appendChild(style);
549
551
  }
550
552
 
553
+ // src/utils/monaco-formatters.ts
554
+ import * as prettier from "prettier/standalone";
555
+ import prettierBabel from "prettier/plugins/babel";
556
+ import prettierEstree from "prettier/plugins/estree";
557
+ import prettierTypescript from "prettier/plugins/typescript";
558
+ import prettierHtml from "prettier/plugins/html";
559
+ function registerFormatters(monacoInstance) {
560
+ monacoInstance.languages.registerDocumentFormattingEditProvider(
561
+ "javascript",
562
+ {
563
+ async provideDocumentFormattingEdits(model, options) {
564
+ try {
565
+ const text = model.getValue();
566
+ const formatted = await prettier.format(text, {
567
+ parser: "babel",
568
+ plugins: [prettierBabel, prettierEstree],
569
+ tabWidth: options.tabSize,
570
+ useTabs: !options.insertSpaces,
571
+ semi: true,
572
+ singleQuote: true,
573
+ trailingComma: "all"
574
+ });
575
+ return [
576
+ {
577
+ range: model.getFullModelRange(),
578
+ text: formatted
579
+ }
580
+ ];
581
+ } catch (error) {
582
+ return [];
583
+ }
584
+ }
585
+ }
586
+ );
587
+ monacoInstance.languages.registerDocumentFormattingEditProvider(
588
+ "typescript",
589
+ {
590
+ async provideDocumentFormattingEdits(model, options) {
591
+ try {
592
+ const text = model.getValue();
593
+ const formatted = await prettier.format(text, {
594
+ parser: "typescript",
595
+ plugins: [prettierTypescript, prettierEstree],
596
+ tabWidth: options.tabSize,
597
+ useTabs: !options.insertSpaces,
598
+ semi: true,
599
+ singleQuote: true,
600
+ trailingComma: "all"
601
+ });
602
+ return [
603
+ {
604
+ range: model.getFullModelRange(),
605
+ text: formatted
606
+ }
607
+ ];
608
+ } catch (error) {
609
+ return [];
610
+ }
611
+ }
612
+ }
613
+ );
614
+ monacoInstance.languages.registerDocumentFormattingEditProvider("json", {
615
+ async provideDocumentFormattingEdits(model, options) {
616
+ try {
617
+ const text = model.getValue();
618
+ const parsed = JSON.parse(text);
619
+ const formatted = JSON.stringify(parsed, null, options.tabSize);
620
+ return [
621
+ {
622
+ range: model.getFullModelRange(),
623
+ text: formatted
624
+ }
625
+ ];
626
+ } catch (error) {
627
+ return [];
628
+ }
629
+ }
630
+ });
631
+ monacoInstance.languages.registerDocumentFormattingEditProvider("html", {
632
+ async provideDocumentFormattingEdits(model, options) {
633
+ try {
634
+ const text = model.getValue();
635
+ const formatted = await prettier.format(text, {
636
+ parser: "html",
637
+ plugins: [prettierHtml],
638
+ tabWidth: options.tabSize,
639
+ useTabs: !options.insertSpaces,
640
+ htmlWhitespaceSensitivity: "css"
641
+ });
642
+ return [
643
+ {
644
+ range: model.getFullModelRange(),
645
+ text: formatted
646
+ }
647
+ ];
648
+ } catch (error) {
649
+ return [];
650
+ }
651
+ }
652
+ });
653
+ monacoInstance.languages.registerDocumentFormattingEditProvider("css", {
654
+ async provideDocumentFormattingEdits(model, options) {
655
+ try {
656
+ const text = model.getValue();
657
+ const formatted = await prettier.format(text, {
658
+ parser: "css",
659
+ plugins: [prettierHtml],
660
+ // CSS parser is in html plugin
661
+ tabWidth: options.tabSize,
662
+ useTabs: !options.insertSpaces
663
+ });
664
+ return [
665
+ {
666
+ range: model.getFullModelRange(),
667
+ text: formatted
668
+ }
669
+ ];
670
+ } catch (error) {
671
+ return [];
672
+ }
673
+ }
674
+ });
675
+ }
676
+
551
677
  // src/hooks/useMonacoHeight.ts
552
678
  import { useState, useRef, useCallback } from "react";
553
679
  function useMonacoHeight({
@@ -738,9 +864,10 @@ function Code({
738
864
  return;
739
865
  }
740
866
  registerAllThemes(monaco);
867
+ registerFormatters(monaco);
741
868
  if (packages && packages.length > 0) {
742
869
  registerWalkerOSTypes(monaco);
743
- const { loadPackageTypes: loadPackageTypes2 } = await import("./monaco-types-T3WXA7KH.mjs");
870
+ const { loadPackageTypes: loadPackageTypes2 } = await import("./monaco-types-GBPMPIMU.mjs");
744
871
  for (const pkg of packages) {
745
872
  if (pkg !== "@walkeros/core") {
746
873
  await loadPackageTypes2(monaco, { package: pkg }).catch((err) => {
@@ -823,7 +950,26 @@ function Code({
823
950
  vertical: "auto",
824
951
  horizontal: "auto",
825
952
  alwaysConsumeMouseWheel: false
826
- }
953
+ },
954
+ // Cursor and selection behavior
955
+ cursorBlinking: "blink",
956
+ // Make cursor blink visibly
957
+ cursorStyle: "line",
958
+ // Use line cursor (most visible)
959
+ cursorWidth: 2,
960
+ // Make cursor 2px wide for better visibility
961
+ cursorSmoothCaretAnimation: "off",
962
+ // Disable smooth cursor animation
963
+ selectionHighlight: false,
964
+ // Disable auto-highlighting of selected text occurrences
965
+ occurrencesHighlight: "off",
966
+ // Disable highlighting matching words
967
+ selectOnLineNumbers: false,
968
+ // Don't select line when clicking line numbers
969
+ wordBasedSuggestions: "off",
970
+ // Reduce auto-completion interference
971
+ quickSuggestions: false
972
+ // Disable quick suggestions popup
827
973
  }
828
974
  }
829
975
  ) });
@@ -2163,10 +2309,14 @@ function PromotionPlayground({
2163
2309
  const [capturedEvent, setCapturedEvent] = useState12(
2164
2310
  null
2165
2311
  );
2312
+ const [eventInput, setEventInput] = useState12(
2313
+ "// Click elements in the preview to see events"
2314
+ );
2166
2315
  const handleEvent = useCallback9((event) => {
2167
2316
  setCapturedEvent(event);
2317
+ setEventInput(JSON.stringify(event, null, 2));
2168
2318
  }, []);
2169
- const eventDisplay = capturedEvent ? JSON.stringify(capturedEvent, null, 2) : "// Click elements in the preview to see events";
2319
+ const eventDisplay = eventInput;
2170
2320
  return /* @__PURE__ */ jsxs9(Grid, { columns: 5, rowHeight: 600, children: [
2171
2321
  /* @__PURE__ */ jsx16(
2172
2322
  BrowserBox,
@@ -2198,7 +2348,7 @@ function PromotionPlayground({
2198
2348
  {
2199
2349
  label: labelEvents,
2200
2350
  code: eventDisplay,
2201
- disabled: true,
2351
+ onChange: setEventInput,
2202
2352
  language: "json",
2203
2353
  wordWrap: true
2204
2354
  }
@@ -2216,7 +2366,7 @@ function PromotionPlayground({
2216
2366
  /* @__PURE__ */ jsx16(
2217
2367
  CollectorBox,
2218
2368
  {
2219
- event: capturedEvent ? JSON.stringify(capturedEvent) : "{}",
2369
+ event: eventInput,
2220
2370
  mapping: mappingInput,
2221
2371
  destination,
2222
2372
  label: labelResult,
@@ -10238,22 +10388,96 @@ function ConfigEditor(props) {
10238
10388
  return /* @__PURE__ */ jsx87(ConfigEditorBox, { ...props });
10239
10389
  }
10240
10390
 
10391
+ // src/components/molecules/code-snippet.tsx
10392
+ import { useState as useState36, useEffect as useEffect24 } from "react";
10393
+
10394
+ // src/utils/format-code.ts
10395
+ import * as prettier2 from "prettier/standalone";
10396
+ import prettierBabel2 from "prettier/plugins/babel";
10397
+ import prettierEstree2 from "prettier/plugins/estree";
10398
+ import prettierTypescript2 from "prettier/plugins/typescript";
10399
+ import prettierHtml2 from "prettier/plugins/html";
10400
+ async function formatCode(code, language) {
10401
+ try {
10402
+ let formatted;
10403
+ switch (language) {
10404
+ case "javascript":
10405
+ case "js":
10406
+ formatted = await prettier2.format(code, {
10407
+ parser: "babel",
10408
+ plugins: [prettierBabel2, prettierEstree2],
10409
+ semi: true,
10410
+ singleQuote: true,
10411
+ trailingComma: "all"
10412
+ });
10413
+ break;
10414
+ case "typescript":
10415
+ case "ts":
10416
+ case "tsx":
10417
+ formatted = await prettier2.format(code, {
10418
+ parser: "typescript",
10419
+ plugins: [prettierTypescript2, prettierEstree2],
10420
+ semi: true,
10421
+ singleQuote: true,
10422
+ trailingComma: "all"
10423
+ });
10424
+ break;
10425
+ case "json":
10426
+ const parsed = JSON.parse(code);
10427
+ formatted = JSON.stringify(parsed, null, 2);
10428
+ break;
10429
+ case "html":
10430
+ formatted = await prettier2.format(code, {
10431
+ parser: "html",
10432
+ plugins: [prettierHtml2],
10433
+ htmlWhitespaceSensitivity: "css"
10434
+ });
10435
+ break;
10436
+ case "css":
10437
+ case "scss":
10438
+ formatted = await prettier2.format(code, {
10439
+ parser: "css",
10440
+ plugins: [prettierHtml2]
10441
+ });
10442
+ break;
10443
+ default:
10444
+ return code;
10445
+ }
10446
+ return formatted.trim();
10447
+ } catch (error) {
10448
+ return code;
10449
+ }
10450
+ }
10451
+
10241
10452
  // src/components/molecules/code-snippet.tsx
10242
10453
  import { jsx as jsx88 } from "react/jsx-runtime";
10243
10454
  function CodeSnippet(props) {
10244
10455
  const {
10456
+ code,
10457
+ language = "javascript",
10245
10458
  className,
10246
10459
  disabled = true,
10247
10460
  showCopy = true,
10248
10461
  autoHeight = { min: 20, max: 600 },
10249
10462
  fontSize = 15,
10463
+ format: format3 = true,
10250
10464
  ...rest
10251
10465
  } = props;
10252
10466
  const snippetClassName = `elb-code-snippet ${className || ""}`.trim();
10467
+ const [formattedCode, setFormattedCode] = useState36(code);
10468
+ useEffect24(() => {
10469
+ if (format3) {
10470
+ formatCode(code, language).then(setFormattedCode);
10471
+ } else {
10472
+ setFormattedCode(code);
10473
+ }
10474
+ }, [code, language, format3]);
10253
10475
  return /* @__PURE__ */ jsx88(
10254
10476
  CodeBox,
10255
10477
  {
10256
10478
  ...rest,
10479
+ code: formattedCode,
10480
+ language,
10257
10481
  className: snippetClassName,
10258
10482
  showHeader: false,
10259
10483
  disabled,
@@ -10265,7 +10489,7 @@ function CodeSnippet(props) {
10265
10489
  }
10266
10490
 
10267
10491
  // src/components/molecules/property-table.tsx
10268
- import { useState as useState36 } from "react";
10492
+ import { useState as useState37 } from "react";
10269
10493
  import { jsx as jsx89, jsxs as jsxs66 } from "react/jsx-runtime";
10270
10494
  function schemaToProperties(schema) {
10271
10495
  const properties = [];
@@ -10377,10 +10601,10 @@ function PropertyModal({ property, isOpen, onClose }) {
10377
10601
  ] }) });
10378
10602
  }
10379
10603
  function PropertyTable({ schema, className }) {
10380
- const [selectedProperty, setSelectedProperty] = useState36(
10604
+ const [selectedProperty, setSelectedProperty] = useState37(
10381
10605
  null
10382
10606
  );
10383
- const [isModalOpen, setIsModalOpen] = useState36(false);
10607
+ const [isModalOpen, setIsModalOpen] = useState37(false);
10384
10608
  const properties = schemaToProperties(schema);
10385
10609
  const hasRequiredProperties = properties.some(
10386
10610
  (property) => property.required
@@ -10572,7 +10796,7 @@ function PanelHints({
10572
10796
  ] });
10573
10797
  }
10574
10798
 
10575
- // node_modules/@mdx-js/react/lib/index.js
10799
+ // ../node_modules/@mdx-js/react/lib/index.js
10576
10800
  import React23 from "react";
10577
10801
  var emptyComponents = {};
10578
10802
  var MDXContext = React23.createContext(emptyComponents);
@@ -10662,7 +10886,7 @@ var MDXProvider2 = ({ children }) => {
10662
10886
  return /* @__PURE__ */ jsx93(MDXProvider, { components, children });
10663
10887
  };
10664
10888
 
10665
- // node_modules/clsx/dist/clsx.mjs
10889
+ // ../node_modules/clsx/dist/clsx.mjs
10666
10890
  function r(e) {
10667
10891
  var t, f, n = "";
10668
10892
  if ("string" == typeof e || "number" == typeof e) n += e;
@@ -10677,7 +10901,7 @@ function clsx() {
10677
10901
  return n;
10678
10902
  }
10679
10903
 
10680
- // node_modules/tailwind-merge/dist/bundle-mjs.mjs
10904
+ // ../node_modules/tailwind-merge/dist/bundle-mjs.mjs
10681
10905
  var CLASS_PART_SEPARATOR = "-";
10682
10906
  var createClassGroupUtils = (config) => {
10683
10907
  const classMap = createClassMap(config);