xinyu-pro 0.22.6 → 0.23.0

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.
Files changed (105) hide show
  1. package/app/api/chat/route.ts +2 -2
  2. package/app/api/generate-svg/route.ts +1 -1
  3. package/app/api/generate-theme/route.ts +112 -135
  4. package/app/api/plugins/bindings/route.ts +4 -4
  5. package/app/api/plugins/export/route.ts +9 -3
  6. package/app/api/plugins/export-xye/route.ts +12 -7
  7. package/app/api/plugins/files/route.ts +9 -9
  8. package/app/api/plugins/files-list/route.ts +7 -3
  9. package/app/api/plugins/files-upload/route.ts +3 -3
  10. package/app/api/plugins/files-write/all/route.ts +250 -0
  11. package/app/api/plugins/files-write/route.ts +13 -15
  12. package/app/api/plugins/import/route.ts +5 -5
  13. package/app/api/plugins/import-package/route.ts +9 -9
  14. package/app/api/plugins/resources/route.ts +6 -2
  15. package/app/api/plugins/route.ts +215 -119
  16. package/app/api/plugins/scan/route.ts +1 -1
  17. package/app/api/plugins/storage/route.ts +3 -3
  18. package/app/api/plugins/toggle/route.ts +21 -0
  19. package/app/api/sessions/route.ts +8 -3
  20. package/app/api/settings/route.ts +2 -2
  21. package/app/api/suggest-fields/route.ts +1 -1
  22. package/app/api/templates/route.ts +2 -2
  23. package/app/api/themes/route.ts +116 -0
  24. package/app/editor/page.tsx +21 -4
  25. package/app/extensions/edit/[id]/page.tsx +2148 -984
  26. package/app/extensions/page.tsx +477 -86
  27. package/app/extensions/tutorial/code-examples.ts +833 -0
  28. package/app/extensions/tutorial/nav-link.tsx +27 -0
  29. package/app/extensions/tutorial/page.tsx +47 -3616
  30. package/app/extensions/tutorial/sections/AiInterceptionSection.tsx +87 -0
  31. package/app/extensions/tutorial/sections/ArchitectureSection.tsx +39 -0
  32. package/app/extensions/tutorial/sections/BestPracticesSection.tsx +78 -0
  33. package/app/extensions/tutorial/sections/ChatApiSection.tsx +212 -0
  34. package/app/extensions/tutorial/sections/CrossPluginSection.tsx +90 -0
  35. package/app/extensions/tutorial/sections/CssVariablesSection.tsx +189 -0
  36. package/app/extensions/tutorial/sections/DebugSection.tsx +48 -0
  37. package/app/extensions/tutorial/sections/DependencySection.tsx +134 -0
  38. package/app/extensions/tutorial/sections/DomSandboxSection.tsx +229 -0
  39. package/app/extensions/tutorial/sections/ExamplesSection.tsx +29 -0
  40. package/app/extensions/tutorial/sections/FileApiSection.tsx +44 -0
  41. package/app/extensions/tutorial/sections/GlobalApiSection.tsx +50 -0
  42. package/app/extensions/tutorial/sections/InputApiSection.tsx +213 -0
  43. package/app/extensions/tutorial/sections/LifecycleSection.tsx +105 -0
  44. package/app/extensions/tutorial/sections/OverviewSection.tsx +54 -0
  45. package/app/extensions/tutorial/sections/PermissionsSection.tsx +239 -0
  46. package/app/extensions/tutorial/sections/PersistentStorageSection.tsx +49 -0
  47. package/app/extensions/tutorial/sections/PluginConfigSection.tsx +81 -0
  48. package/app/extensions/tutorial/sections/PluginImportExportSection.tsx +68 -0
  49. package/app/extensions/tutorial/sections/PluginStorageSection.tsx +94 -0
  50. package/app/extensions/tutorial/sections/ResourceApiSection.tsx +88 -0
  51. package/app/extensions/tutorial/sections/SecuritySection.tsx +106 -0
  52. package/app/extensions/tutorial/sections/SlotsSection.tsx +130 -0
  53. package/app/extensions/tutorial/sections/UiApiSection.tsx +147 -0
  54. package/app/extensions/tutorial/sections/UtilsApiSection.tsx +96 -0
  55. package/app/extensions/tutorial/sections-data.tsx +325 -0
  56. package/app/extensions/tutorial/styles.ts +59 -0
  57. package/app/extensions/tutorial/types.ts +14 -0
  58. package/app/game/[id]/page.tsx +336 -148
  59. package/app/globals.css +41 -0
  60. package/app/page.tsx +17 -10
  61. package/app/settings/page.tsx +218 -236
  62. package/bin/cli.js +3 -10
  63. package/components/ChatInput.tsx +20 -6
  64. package/components/ChatWindow.tsx +1 -1
  65. package/components/MessageBubble.tsx +5 -6
  66. package/components/ui/ConfirmDialog.tsx +28 -6
  67. package/components/ui/DeprecatedBadge.tsx +163 -0
  68. package/components/ui/PageHeader.tsx +1 -1
  69. package/components/ui/PermissionConflictDialog.tsx +1 -1
  70. package/components/ui/PluginConfigForm.tsx +2 -3
  71. package/components/ui/PluginFloatingLayer.tsx +2 -2
  72. package/components/ui/PluginModalRenderer.tsx +84 -38
  73. package/components/ui/PluginProvider.tsx +32 -13
  74. package/components/ui/PluginSlotRenderer.tsx +2 -2
  75. package/components/ui/ThemeCustomizer.tsx +4 -7
  76. package/components/ui/ThemeProvider.tsx +214 -125
  77. package/components/ui/ThemeSwitcher.tsx +119 -157
  78. package/components/ui/ToastProvider.tsx +47 -17
  79. package/lib/{parseWorldCard.ts → client/parseWorldCard.ts} +1 -1
  80. package/lib/{plugin-dom-sandbox.ts → client/plugin-dom-sandbox.ts} +2 -2
  81. package/lib/{plugin-runtime.ts → client/plugin-runtime.ts} +166 -67
  82. package/lib/client/plugin-utils.ts +105 -0
  83. package/lib/{router-history.ts → client/router-history.ts} +1 -1
  84. package/lib/{storage.ts → client/storage.ts} +66 -3
  85. package/lib/{themes.ts → client/themes.ts} +21 -1
  86. package/lib/{builtin-plugins.ts → server/builtin-plugins.ts} +1 -1
  87. package/lib/{db-init.ts → server/db-init.ts} +2 -2
  88. package/lib/{db.ts → server/db.ts} +48 -8
  89. package/lib/{get-ai-config.ts → server/get-ai-config.ts} +2 -2
  90. package/lib/{plugin-files.ts → server/plugin-files.ts} +7 -2
  91. package/lib/server/plugin-utils.ts +88 -0
  92. package/lib/{manifest-parser.ts → shared/manifest-parser.ts} +4 -4
  93. package/lib/{plugin-types.ts → shared/plugin-types.ts} +11 -6
  94. package/lib/{version.ts → shared/version.ts} +1 -1
  95. package/next.config.mjs +3 -2
  96. package/package.json +4 -3
  97. package/styles/themes.css +7 -2
  98. package/version.json +2 -2
  99. package/app/extensions/create/page.tsx +0 -1422
  100. /package/lib/{plugin-events.ts → client/plugin-events.ts} +0 -0
  101. /package/lib/{plugin-resource-tracker.ts → client/plugin-resource-tracker.ts} +0 -0
  102. /package/lib/{plugin-html-sanitizer.ts → shared/plugin-html-sanitizer.ts} +0 -0
  103. /package/lib/{plugin-security.ts → shared/plugin-security.ts} +0 -0
  104. /package/lib/{prompt-builder.ts → shared/prompt-builder.ts} +0 -0
  105. /package/lib/{types.ts → shared/types.ts} +0 -0
@@ -0,0 +1,27 @@
1
+ // app/extensions/tutorial/nav-link.tsx - 内部锚点跳转组件
2
+ 'use client';
3
+
4
+ import React, { useState } from 'react';
5
+ import { linkStyle, linkHoverStyle } from './styles';
6
+
7
+ export default function NavLink({ sectionId, children, style }: {
8
+ sectionId: string;
9
+ children: React.ReactNode;
10
+ style?: React.CSSProperties;
11
+ }) {
12
+ const [hovered, setHovered] = useState(false);
13
+ return (
14
+ <span
15
+ style={{
16
+ ...linkStyle,
17
+ ...(hovered ? linkHoverStyle : {}),
18
+ ...style,
19
+ }}
20
+ onClick={() => document.getElementById('section-' + sectionId)?.scrollIntoView({ behavior: 'smooth' })}
21
+ onMouseEnter={() => setHovered(true)}
22
+ onMouseLeave={() => setHovered(false)}
23
+ >
24
+ {children}
25
+ </span>
26
+ );
27
+ }