@zihanw/pi-forge 0.5.0 → 0.5.2

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 (129) hide show
  1. package/CHANGELOG.md +53 -0
  2. package/README.md +6 -2
  3. package/README.zh-CN.md +5 -2
  4. package/dist/codecs/prompt-stack.d.ts.map +1 -1
  5. package/dist/codecs/prompt-stack.js +17 -0
  6. package/dist/codecs/prompt-stack.js.map +1 -1
  7. package/dist/compiler.d.ts.map +1 -1
  8. package/dist/compiler.js +81 -0
  9. package/dist/compiler.js.map +1 -1
  10. package/dist/context-diff-history.d.ts +61 -0
  11. package/dist/context-diff-history.d.ts.map +1 -0
  12. package/dist/context-diff-history.js +84 -0
  13. package/dist/context-diff-history.js.map +1 -0
  14. package/dist/context-diff-snapshot.d.ts +19 -0
  15. package/dist/context-diff-snapshot.d.ts.map +1 -0
  16. package/dist/context-diff-snapshot.js +146 -0
  17. package/dist/context-diff-snapshot.js.map +1 -0
  18. package/dist/context-diff.d.ts +70 -0
  19. package/dist/context-diff.d.ts.map +1 -0
  20. package/dist/context-diff.js +259 -0
  21. package/dist/context-diff.js.map +1 -0
  22. package/dist/index.d.ts.map +1 -1
  23. package/dist/index.js +5 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/lifecycle.d.ts +2 -0
  26. package/dist/lifecycle.d.ts.map +1 -1
  27. package/dist/lifecycle.js +19 -2
  28. package/dist/lifecycle.js.map +1 -1
  29. package/dist/payload-capture.d.ts +10 -0
  30. package/dist/payload-capture.d.ts.map +1 -1
  31. package/dist/payload-capture.js +39 -9
  32. package/dist/payload-capture.js.map +1 -1
  33. package/dist/payload-command.d.ts +2 -0
  34. package/dist/payload-command.d.ts.map +1 -1
  35. package/dist/payload-command.js +36 -6
  36. package/dist/payload-command.js.map +1 -1
  37. package/dist/payload-state.d.ts +3 -0
  38. package/dist/payload-state.d.ts.map +1 -1
  39. package/dist/payload-state.js +5 -0
  40. package/dist/payload-state.js.map +1 -1
  41. package/dist/preview.d.ts.map +1 -1
  42. package/dist/preview.js +43 -9
  43. package/dist/preview.js.map +1 -1
  44. package/dist/regex.d.ts +12 -0
  45. package/dist/regex.d.ts.map +1 -1
  46. package/dist/regex.js +81 -5
  47. package/dist/regex.js.map +1 -1
  48. package/dist/runtime/tool-policy-runtime.d.ts.map +1 -1
  49. package/dist/runtime/tool-policy-runtime.js +13 -3
  50. package/dist/runtime/tool-policy-runtime.js.map +1 -1
  51. package/dist/runtime/web-editor-runtime.d.ts +2 -1
  52. package/dist/runtime/web-editor-runtime.d.ts.map +1 -1
  53. package/dist/runtime/web-editor-runtime.js +8 -3
  54. package/dist/runtime/web-editor-runtime.js.map +1 -1
  55. package/dist/types.d.ts +17 -0
  56. package/dist/types.d.ts.map +1 -1
  57. package/dist/types.js.map +1 -1
  58. package/dist/ui-contribution/contrib-port.d.ts +170 -0
  59. package/dist/ui-contribution/contrib-port.d.ts.map +1 -0
  60. package/dist/ui-contribution/contrib-port.js +640 -0
  61. package/dist/ui-contribution/contrib-port.js.map +1 -0
  62. package/dist/ui-contribution/index.d.ts +3 -0
  63. package/dist/ui-contribution/index.d.ts.map +1 -0
  64. package/dist/ui-contribution/index.js +2 -0
  65. package/dist/ui-contribution/index.js.map +1 -0
  66. package/dist/web-editor/client-script.generated.d.ts.map +1 -1
  67. package/dist/web-editor/client-script.generated.js +1 -1
  68. package/dist/web-editor/client-script.generated.js.map +1 -1
  69. package/dist/web-editor/client-styles.generated.d.ts.map +1 -1
  70. package/dist/web-editor/client-styles.generated.js +1 -1
  71. package/dist/web-editor/client-styles.generated.js.map +1 -1
  72. package/dist/web-editor/contrib-service.d.ts +41 -0
  73. package/dist/web-editor/contrib-service.d.ts.map +1 -0
  74. package/dist/web-editor/contrib-service.js +174 -0
  75. package/dist/web-editor/contrib-service.js.map +1 -0
  76. package/dist/web-editor/line-diff.d.ts +28 -0
  77. package/dist/web-editor/line-diff.d.ts.map +1 -0
  78. package/dist/web-editor/line-diff.js +216 -0
  79. package/dist/web-editor/line-diff.js.map +1 -0
  80. package/dist/web-editor/page.d.ts +1 -1
  81. package/dist/web-editor/page.d.ts.map +1 -1
  82. package/dist/web-editor/page.js +2 -2
  83. package/dist/web-editor/page.js.map +1 -1
  84. package/dist/web-editor/schema-form.d.ts +63 -0
  85. package/dist/web-editor/schema-form.d.ts.map +1 -0
  86. package/dist/web-editor/schema-form.js +213 -0
  87. package/dist/web-editor/schema-form.js.map +1 -0
  88. package/dist/web-editor/server.d.ts.map +1 -1
  89. package/dist/web-editor/server.js +125 -7
  90. package/dist/web-editor/server.js.map +1 -1
  91. package/dist/web-editor/styles.d.ts.map +1 -1
  92. package/dist/web-editor/styles.js +188 -21
  93. package/dist/web-editor/styles.js.map +1 -1
  94. package/dist/web-editor/types.d.ts +19 -0
  95. package/dist/web-editor/types.d.ts.map +1 -1
  96. package/dist/web-host.d.ts +7 -3
  97. package/dist/web-host.d.ts.map +1 -1
  98. package/dist/web-host.js +85 -12
  99. package/dist/web-host.js.map +1 -1
  100. package/docs/README.md +1 -0
  101. package/docs/concepts/agent-profiles.md +1 -1
  102. package/docs/concepts/prompt-stacks.md +4 -0
  103. package/docs/design/0.5.1-plan.md +237 -0
  104. package/docs/design/architecture-0.5.md +22 -1
  105. package/docs/design/context-diff-plan.md +8 -2
  106. package/docs/development/release.md +7 -1
  107. package/docs/development/roadmap.md +14 -0
  108. package/docs/getting-started.md +1 -1
  109. package/docs/guides/delegation.md +3 -3
  110. package/docs/guides/use-cases.md +4 -2
  111. package/docs/guides/web-editor.md +5 -1
  112. package/docs/reference/commands.md +1 -1
  113. package/docs/reference/configuration.md +6 -3
  114. package/docs/reference/features.md +5 -0
  115. package/docs/reference/public-api.md +14 -2
  116. package/docs/reference/stack-schema.md +59 -2
  117. package/docs/reference/ui-contribution-port.md +51 -0
  118. package/docs/zh-CN/concepts/agent-profiles.md +1 -1
  119. package/docs/zh-CN/concepts/prompt-stacks.md +10 -4
  120. package/docs/zh-CN/guides/delegation.md +2 -2
  121. package/docs/zh-CN/guides/web-editor.md +4 -0
  122. package/docs/zh-CN/reference/commands.md +1 -1
  123. package/examples/custom-system-status-extension/README.md +4 -3
  124. package/examples/custom-system-status-extension/index.ts +8 -6
  125. package/examples/hack-prompt-stack.json +118 -0
  126. package/examples/minimal-prompt-stack.json +36 -0
  127. package/package.json +6 -1
  128. package/examples/image-reader-prompt-stack.json +0 -114
  129. package/examples/reviewer-prompt-stack.json +0 -104
@@ -1 +1 @@
1
- {"version":3,"file":"client-script.generated.js","sourceRoot":"","sources":["../../src/web-editor/client-script.generated.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAW,yowWAAyowW,CAAC"}
1
+ {"version":3,"file":"client-script.generated.js","sourceRoot":"","sources":["../../src/web-editor/client-script.generated.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAW,2ouhBAA2ouhB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"client-styles.generated.d.ts","sourceRoot":"","sources":["../../src/web-editor/client-styles.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,EAAE,MAAwkQ,CAAC"}
1
+ {"version":3,"file":"client-styles.generated.d.ts","sourceRoot":"","sources":["../../src/web-editor/client-styles.generated.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,oBAAoB,EAAE,MAA08nB,CAAC"}
@@ -1,3 +1,3 @@
1
1
  // Generated by scripts/build-web-client.mjs. Do not edit.
2
- export const EDITOR_CLIENT_STYLES = "\n.profile-editor[data-v-dd5432c1] {\n\tmax-width: 1050px;\n}\n.profile-editor-head[data-v-dd5432c1] {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tpadding-bottom: 12px;\n\tborder-bottom: 1px solid var(--line);\n}\n.profile-editor-title[data-v-dd5432c1] {\n\tfont-size: 18px;\n\tfont-weight: 700;\n}\n.profile-editor-note[data-v-dd5432c1],\n.profile-field small[data-v-dd5432c1] {\n\tdisplay: block;\n\tcolor: var(--muted);\n\tfont-size: 12px;\n}\n.profile-form[data-v-dd5432c1] {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\tgap: 14px;\n\tmargin-top: 14px;\n}\n.profile-field[data-v-dd5432c1] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 5px;\n\tmin-width: 0;\n}\n.profile-field > span[data-v-dd5432c1] {\n\tfont-weight: 650;\n}\n.profile-field-wide[data-v-dd5432c1] {\n\tgrid-column: 1 / -1;\n}\n.profile-field textarea[data-v-dd5432c1] {\n\tmin-height: 90px;\n}\n.profile-field-warning[data-v-dd5432c1] {\n\tcolor: var(--warning) !important;\n}\n.profile-check[data-v-dd5432c1] {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 8px;\n\tpadding: 10px;\n\tborder: 1px solid var(--line);\n\tborder-radius: 6px;\n\tbackground: var(--pane-soft);\n}\n.profile-check input[data-v-dd5432c1] {\n\twidth: auto;\n\tmargin-top: 3px;\n}\n.profile-check span[data-v-dd5432c1] {\n\tdisplay: flex;\n\tflex-direction: column;\n}\n.profile-editor-status[data-v-dd5432c1],\n.profile-editor-validation[data-v-dd5432c1] {\n\tmargin-top: 14px;\n}\n.profile-editor-status[data-v-dd5432c1] {\n\tcolor: var(--success);\n}\n.profile-editor-status.error[data-v-dd5432c1],\n.profile-editor-validation-summary.error[data-v-dd5432c1] {\n\tcolor: var(--error);\n}\n.profile-editor-dirty[data-v-dd5432c1] {\n\tborder: 1px solid var(--warning);\n\tborder-radius: 999px;\n\tpadding: 2px 8px;\n\tbackground: var(--warning-bg);\n\tcolor: var(--warning);\n\tfont-size: 12px;\n}\n.profile-editor-validation-summary.ready[data-v-dd5432c1] {\n\tcolor: var(--success);\n}\n.profile-editor-validation-summary[data-v-dd5432c1] {\n\tmargin-bottom: 8px;\n\tfont-weight: 650;\n}\n@media (max-width: 700px) {\n.profile-form[data-v-dd5432c1] {\n\t\tgrid-template-columns: 1fr;\n}\n.profile-field-wide[data-v-dd5432c1] {\n\t\tgrid-column: auto;\n}\n}\n\n.profile-surface[data-v-17accaea] {\n\tflex: 1;\n\tmin-height: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\tbackground: var(--bg);\n}\n.profile-toolbar[data-v-17accaea] {\n\tmin-height: 64px;\n\tpadding: 10px 12px;\n\tborder-bottom: 1px solid var(--line);\n\tbackground: var(--pane);\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 10px;\n}\n.profile-toolbar .status[data-v-17accaea] {\n\tflex: 1 1 120px;\n}\n#profileCreateScope[data-v-17accaea] {\n\tflex: 0 0 auto;\n\twidth: 110px;\n}\n.profile-heading[data-v-17accaea] {\n\tfont-size: 17px;\n\tfont-weight: 700;\n}\n.profile-subheading[data-v-17accaea] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n}\n.profile-layout[data-v-17accaea] {\n\tflex: 1;\n\tmin-height: 0;\n\tdisplay: grid;\n\tgrid-template-columns: minmax(260px, 330px) minmax(0, 1fr);\n}\n.profile-sidebar[data-v-17accaea] {\n\tmin-width: 0;\n\tmin-height: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\tborder-right: 1px solid var(--line);\n\tbackground: var(--pane);\n}\n.profile-list[data-v-17accaea] {\n\tflex: 1;\n\tmin-height: 0;\n\tpadding: 8px;\n\toverflow: auto;\n}\n.profile-row[data-v-17accaea] {\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: stretch;\n\twidth: 100%;\n\tmargin-bottom: 6px;\n\tpadding: 9px;\n\ttext-align: left;\n\tborder-color: transparent;\n\tbackground: transparent;\n}\n.profile-row[data-v-17accaea]:hover {\n\tbackground: var(--control-muted);\n}\n.profile-row.selected[data-v-17accaea] {\n\tborder-color: var(--accent);\n\tbackground: var(--accent-bg);\n}\n.profile-row-title[data-v-17accaea] {\n\tfont-weight: 700;\n}\n.profile-row-name[data-v-17accaea],\n.profile-row-meta[data-v-17accaea] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n\toverflow-wrap: anywhere;\n}\n.profile-row-state[data-v-17accaea] {\n\talign-self: flex-start;\n\tmargin-top: 6px;\n\tfont-size: 12px;\n}\n.profile-row-state.ready[data-v-17accaea],\n.profile-applicability.ready[data-v-17accaea] {\n\tcolor: var(--success);\n}\n.profile-row-state.warning[data-v-17accaea] {\n\tcolor: var(--warning);\n}\n.profile-row-state.error[data-v-17accaea],\n.profile-applicability.error[data-v-17accaea] {\n\tcolor: var(--error);\n}\n.profile-main[data-v-17accaea] {\n\tmin-width: 0;\n\tmin-height: 0;\n\toverflow: auto;\n\tpadding: 16px;\n}\n.profile-card[data-v-17accaea] {\n\tmax-width: 1050px;\n\tmargin: 0 auto 14px;\n\tpadding: 14px;\n\tborder: 1px solid var(--line);\n\tborder-radius: 8px;\n\tbackground: var(--pane);\n}\n.profile-summary-card[data-v-17accaea] {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 1fr) auto;\n\tgap: 8px 16px;\n}\n.profile-title[data-v-17accaea] {\n\tfont-size: 19px;\n\tfont-weight: 700;\n}\n.profile-path[data-v-17accaea],\n.profile-note[data-v-17accaea] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n\toverflow-wrap: anywhere;\n}\n.profile-applicability[data-v-17accaea] {\n\tfont-weight: 650;\n}\n.profile-summary-actions[data-v-17accaea] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 10px;\n}\n.profile-description[data-v-17accaea] {\n\tgrid-column: 1 / -1;\n\tmargin: 4px 0 0;\n}\n.profile-card-title[data-v-17accaea] {\n\tmargin-bottom: 10px;\n\tfont-weight: 700;\n}\n.profile-transition-grid[data-v-17accaea] {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(100px, .7fr) repeat(2, minmax(180px, 1fr));\n\tgap: 1px;\n\tborder: 1px solid var(--line);\n\tbackground: var(--line);\n}\n.profile-transition-grid > div[data-v-17accaea] {\n\tmin-width: 0;\n\tpadding: 8px;\n\tbackground: var(--pane);\n\toverflow-wrap: anywhere;\n}\n.profile-transition-head[data-v-17accaea] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n\tfont-weight: 650;\n}\n.profile-detail-row[data-v-17accaea] {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(180px, .8fr) minmax(0, 2fr);\n\tgap: 12px;\n\tmargin-top: 10px;\n}\n.profile-detail-row > span[data-v-17accaea] {\n\tcolor: var(--muted);\n}\n.profile-detail-row code[data-v-17accaea] {\n\toverflow-wrap: anywhere;\n\twhite-space: normal;\n}\n.profile-drift[data-v-17accaea] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px 16px;\n\tmargin-top: 10px;\n\tcolor: var(--muted);\n\tfont-size: 12px;\n}\n.profile-message[data-v-17accaea],\n.profile-empty[data-v-17accaea] {\n\tpadding: 20px;\n\tcolor: var(--muted);\n}\n.profile-message.error[data-v-17accaea] {\n\tcolor: var(--error);\n}\n.profile-message.warning[data-v-17accaea] {\n\tcolor: var(--warning);\n}\n@media (max-width: 800px) {\n.profile-layout[data-v-17accaea] {\n\t\tdisplay: block;\n\t\toverflow: auto;\n}\n.profile-sidebar[data-v-17accaea] {\n\t\tborder-right: 0;\n\t\tborder-bottom: 1px solid var(--line);\n}\n.profile-list[data-v-17accaea] {\n\t\tflex: none;\n\t\tmax-height: 35vh;\n}\n.profile-main[data-v-17accaea] {\n\t\toverflow: visible;\n}\n.profile-transition-grid[data-v-17accaea] {\n\t\tgrid-template-columns: minmax(80px, .7fr) repeat(2, minmax(120px, 1fr));\n\t\tfont-size: 12px;\n}\n}\n\n.app-root {\n\theight: 100%;\n\tmin-height: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n.surface-nav {\n\tflex: none;\n\theight: 44px;\n\tpadding: 5px 10px;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tborder-bottom: 1px solid var(--line);\n\tbackground: var(--pane);\n}\n.surface-brand {\n\tmargin-right: 8px;\n\tfont-weight: 750;\n\tletter-spacing: .02em;\n}\n.surface-nav button {\n\tmin-height: 32px;\n\tborder-color: transparent;\n\tbackground: transparent;\n}\n.surface-nav button.active {\n\tborder-color: var(--accent);\n\tbackground: var(--accent-bg);\n\tcolor: var(--accent);\n}\n.surface-nav-spacer {\n\tflex: 1 1 auto;\n}\n.surface-nav .theme-toggle {\n\tmin-height: 32px;\n\tborder-color: var(--line);\n\tbackground: var(--pane);\n}\n.editor-surface {\n\tflex: 1;\n\tmin-height: 0;\n}\n.legacy-editor-root {\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n.legacy-editor-root .topbar {\n\tflex: none;\n}\n.editor-surface .shell {\n\tflex: 1;\n\tmin-height: 0;\n\theight: auto;\n}\n/*$vite$:1*/";
2
+ export const EDITOR_CLIENT_STYLES = "\n.profile-editor[data-v-9cfe5c37] {\n\tmax-width: 1050px;\n}\n.profile-editor-head[data-v-9cfe5c37] {\n\tdisplay: flex;\n\talign-items: center;\n\tflex-wrap: wrap;\n\tgap: 8px;\n\tpadding-bottom: 12px;\n\tborder-bottom: 1px solid var(--line);\n}\n.profile-editor-title[data-v-9cfe5c37] {\n\tfont-size: 18px;\n\tfont-weight: 700;\n}\n.profile-editor-note[data-v-9cfe5c37],\n.profile-field small[data-v-9cfe5c37] {\n\tdisplay: block;\n\tcolor: var(--muted);\n\tfont-size: 12px;\n}\n.profile-form[data-v-9cfe5c37] {\n\tdisplay: grid;\n\tgrid-template-columns: repeat(2, minmax(0, 1fr));\n\tgap: 14px;\n\tmargin-top: 14px;\n}\n.profile-field[data-v-9cfe5c37] {\n\tdisplay: flex;\n\tflex-direction: column;\n\tgap: 5px;\n\tmin-width: 0;\n}\n.profile-field > span[data-v-9cfe5c37] {\n\tfont-weight: 650;\n}\n.profile-field-wide[data-v-9cfe5c37] {\n\tgrid-column: 1 / -1;\n}\n.profile-field textarea[data-v-9cfe5c37] {\n\tmin-height: 90px;\n}\n.profile-field-warning[data-v-9cfe5c37] {\n\tcolor: var(--warning) !important;\n}\n.profile-check[data-v-9cfe5c37] {\n\tdisplay: flex;\n\talign-items: flex-start;\n\tgap: 8px;\n\tpadding: 10px;\n\tborder: 1px solid var(--line);\n\tborder-radius: 6px;\n\tbackground: var(--pane-soft);\n}\n.profile-check input[data-v-9cfe5c37] {\n\twidth: auto;\n\tmargin-top: 3px;\n}\n.profile-check span[data-v-9cfe5c37] {\n\tdisplay: flex;\n\tflex-direction: column;\n}\n.profile-editor-status[data-v-9cfe5c37],\n.profile-editor-validation[data-v-9cfe5c37] {\n\tmargin-top: 14px;\n}\n.profile-editor-status[data-v-9cfe5c37] {\n\tcolor: var(--success);\n}\n.profile-editor-status.error[data-v-9cfe5c37],\n.profile-editor-validation-summary.error[data-v-9cfe5c37] {\n\tcolor: var(--error);\n}\n.profile-editor-dirty[data-v-9cfe5c37] {\n\tborder: 1px solid var(--warning);\n\tborder-radius: 999px;\n\tpadding: 2px 8px;\n\tbackground: var(--warning-bg);\n\tcolor: var(--warning);\n\tfont-size: 12px;\n}\n.profile-editor-validation-summary.ready[data-v-9cfe5c37] {\n\tcolor: var(--success);\n}\n.profile-editor-validation-summary[data-v-9cfe5c37] {\n\tmargin-bottom: 8px;\n\tfont-weight: 650;\n}\n@media (max-width: 700px) {\n.profile-form[data-v-9cfe5c37] {\n\t\tgrid-template-columns: 1fr;\n}\n.profile-field-wide[data-v-9cfe5c37] {\n\t\tgrid-column: auto;\n}\n}\n\n.profile-surface[data-v-e0385a21] {\n\tflex: 1;\n\tmin-height: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\tbackground: var(--bg);\n}\n.profile-toolbar[data-v-e0385a21] {\n\tmin-height: 64px;\n\tpadding: 10px 12px;\n\tborder-bottom: 1px solid var(--line);\n\tbackground: var(--pane);\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 10px;\n}\n.profile-toolbar .status[data-v-e0385a21] {\n\tflex: 1 1 120px;\n}\n#profileCreateScope[data-v-e0385a21] {\n\tflex: 0 0 auto;\n\twidth: 110px;\n}\n.profile-heading[data-v-e0385a21] {\n\tfont-size: 17px;\n\tfont-weight: 700;\n}\n.profile-subheading[data-v-e0385a21] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n}\n.profile-layout[data-v-e0385a21] {\n\tflex: 1;\n\tmin-height: 0;\n\tdisplay: grid;\n\tgrid-template-columns: minmax(260px, 330px) minmax(0, 1fr);\n}\n.profile-sidebar[data-v-e0385a21] {\n\tmin-width: 0;\n\tmin-height: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\tborder-right: 1px solid var(--line);\n\tbackground: var(--pane);\n}\n.profile-list[data-v-e0385a21] {\n\tflex: 1;\n\tmin-height: 0;\n\tpadding: 8px;\n\toverflow: auto;\n}\n.profile-row[data-v-e0385a21] {\n\tposition: relative;\n\tdisplay: flex;\n\tflex-direction: column;\n\talign-items: stretch;\n\twidth: 100%;\n\tmargin-bottom: 6px;\n\tpadding: 9px;\n\ttext-align: left;\n\tborder-color: transparent;\n\tbackground: transparent;\n}\n.profile-row[data-v-e0385a21]:hover {\n\tbackground: var(--control-muted);\n}\n.profile-row.selected[data-v-e0385a21] {\n\tborder-color: var(--accent);\n\tbackground: var(--accent-bg);\n}\n.profile-row-title[data-v-e0385a21] {\n\tfont-weight: 700;\n}\n.profile-row-name[data-v-e0385a21],\n.profile-row-meta[data-v-e0385a21] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n\toverflow-wrap: anywhere;\n}\n.profile-row-state[data-v-e0385a21] {\n\talign-self: flex-start;\n\tmargin-top: 6px;\n\tfont-size: 12px;\n}\n.profile-row-state.ready[data-v-e0385a21],\n.profile-applicability.ready[data-v-e0385a21] {\n\tcolor: var(--success);\n}\n.profile-row-state.warning[data-v-e0385a21] {\n\tcolor: var(--warning);\n}\n.profile-row-state.error[data-v-e0385a21],\n.profile-applicability.error[data-v-e0385a21] {\n\tcolor: var(--error);\n}\n.profile-main[data-v-e0385a21] {\n\tmin-width: 0;\n\tmin-height: 0;\n\toverflow: auto;\n\tpadding: 16px;\n}\n.profile-card[data-v-e0385a21] {\n\tmax-width: 1050px;\n\tmargin: 0 auto 14px;\n\tpadding: 14px;\n\tborder: 1px solid var(--line);\n\tborder-radius: 8px;\n\tbackground: var(--pane);\n}\n.profile-summary-card[data-v-e0385a21] {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(0, 1fr) auto;\n\tgap: 8px 16px;\n}\n.profile-title[data-v-e0385a21] {\n\tfont-size: 19px;\n\tfont-weight: 700;\n}\n.profile-selector[data-v-e0385a21],\n.profile-path[data-v-e0385a21],\n.profile-note[data-v-e0385a21] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n\toverflow-wrap: anywhere;\n}\n.profile-applicability[data-v-e0385a21] {\n\tfont-weight: 650;\n}\n.profile-summary-actions[data-v-e0385a21] {\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 10px;\n}\n.profile-description[data-v-e0385a21] {\n\tgrid-column: 1 / -1;\n\tmargin: 4px 0 0;\n}\n.profile-card-title[data-v-e0385a21] {\n\tmargin-bottom: 10px;\n\tfont-weight: 700;\n}\n.profile-transition-grid[data-v-e0385a21] {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(100px, .7fr) repeat(2, minmax(180px, 1fr));\n\tgap: 1px;\n\tborder: 1px solid var(--line);\n\tbackground: var(--line);\n}\n.profile-transition-grid > div[data-v-e0385a21] {\n\tmin-width: 0;\n\tpadding: 8px;\n\tbackground: var(--pane);\n\toverflow-wrap: anywhere;\n}\n.profile-transition-head[data-v-e0385a21] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n\tfont-weight: 650;\n}\n.profile-detail-row[data-v-e0385a21] {\n\tdisplay: grid;\n\tgrid-template-columns: minmax(180px, .8fr) minmax(0, 2fr);\n\tgap: 12px;\n\tmargin-top: 10px;\n}\n.profile-detail-row > span[data-v-e0385a21] {\n\tcolor: var(--muted);\n}\n.profile-detail-row code[data-v-e0385a21] {\n\toverflow-wrap: anywhere;\n\twhite-space: normal;\n}\n.profile-drift[data-v-e0385a21] {\n\tdisplay: flex;\n\tflex-wrap: wrap;\n\tgap: 8px 16px;\n\tmargin-top: 10px;\n\tcolor: var(--muted);\n\tfont-size: 12px;\n}\n.profile-message[data-v-e0385a21],\n.profile-empty[data-v-e0385a21] {\n\tpadding: 20px;\n\tcolor: var(--muted);\n}\n.profile-message.error[data-v-e0385a21] {\n\tcolor: var(--error);\n}\n.profile-message.warning[data-v-e0385a21] {\n\tcolor: var(--warning);\n}\n@media (max-width: 800px) {\n.profile-layout[data-v-e0385a21] {\n\t\tdisplay: block;\n\t\toverflow: auto;\n}\n.profile-sidebar[data-v-e0385a21] {\n\t\tborder-right: 0;\n\t\tborder-bottom: 1px solid var(--line);\n}\n.profile-list[data-v-e0385a21] {\n\t\tflex: none;\n\t\tmax-height: 35vh;\n}\n.profile-main[data-v-e0385a21] {\n\t\toverflow: visible;\n}\n.profile-transition-grid[data-v-e0385a21] {\n\t\tgrid-template-columns: minmax(80px, .7fr) repeat(2, minmax(120px, 1fr));\n\t\tfont-size: 12px;\n}\n}\n\n.schema-record-row[data-v-f9733942] {\n\tgrid-template-columns: minmax(150px, 220px) repeat(auto-fit, minmax(150px, 1fr)) 92px;\n}\n.record-empty[data-v-f9733942] {\n\tcolor: var(--muted);\n\tfont-size: 12px;\n\tpadding: 8px 0;\n}\n.schema-field-error[data-v-f9733942] {\n\tcolor: var(--error);\n\tfont-size: 12px;\n\tmargin-top: 4px;\n}\n.record-cell-label[data-v-f9733942] {\n\tdisplay: none;\n}\n@media (max-width: 700px) {\n.schema-record-row[data-v-f9733942] {\n\t\tgrid-template-columns: minmax(0, 1fr);\n}\n.schema-record-row.header[data-v-f9733942] {\n\t\tdisplay: none;\n}\n.record-cell-label[data-v-f9733942] {\n\t\tdisplay: block;\n}\n}\n\n.context-diff-dock[data-v-f794256d] { height: 100%; min-height: 0; display: flex; flex-direction: column; gap: 10px;\n}\n.context-diff-mode-tabs[data-v-f794256d] { display: flex; gap: 6px; flex: 0 0 auto;\n}\n.context-diff-expand[data-v-f794256d] { margin-left: auto;\n}\n.context-diff-mode-tabs button.active[data-v-f794256d] { border-color: var(--accent); background: var(--accent-bg); color: var(--accent);\n}\n.context-diff-panel-head[data-v-f794256d] { display: flex; align-items: center; gap: 8px; flex: 0 0 auto;\n}\n.context-diff-title[data-v-f794256d] { font-weight: 700;\n}\n.context-diff-meta[data-v-f794256d] { color: var(--muted); font-size: 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;\n}\n.context-diff-meta .error[data-v-f794256d], .context-diff-error[data-v-f794256d] { color: var(--error);\n}\n.context-diff-refresh[data-v-f794256d] { margin-left: auto; min-height: 28px; font-size: 12px; padding: 2px 8px;\n}\n.context-diff-compiled[data-v-f794256d], .context-diff-diff[data-v-f794256d] { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; overflow: auto;\n}\n.context-diff-sections[data-v-f794256d], .context-diff-blocks[data-v-f794256d] { display: flex; flex-direction: column; gap: 8px;\n}\n.context-diff-section[data-v-f794256d] { border: 1px solid var(--line); border-radius: 6px; background: var(--pane); overflow: hidden;\n}\n.context-diff-section summary[data-v-f794256d] { display: flex; align-items: center; gap: 8px; padding: 8px 10px; cursor: pointer; list-style: none; border-bottom: 1px solid transparent;\n}\n.context-diff-section[open] summary[data-v-f794256d] { border-bottom-color: var(--line);\n}\n.section-title[data-v-f794256d] { font-weight: 650;\n}\n.section-meta[data-v-f794256d] { color: var(--muted); font-size: 12px;\n}\n.section-text[data-v-f794256d], .block-text[data-v-f794256d] { margin: 0; padding: 10px; background: var(--code-bg); color: var(--code-text); white-space: pre-wrap; overflow: auto; font: 12px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n}\n.context-diff-summary[data-v-f794256d] { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--pane); font-weight: 650;\n}\n.summary-delta.positive[data-v-f794256d] { color: var(--success);\n}\n.summary-delta.negative[data-v-f794256d] { color: var(--error);\n}\n.summary-delta.neutral[data-v-f794256d] { color: var(--muted);\n}\n.diff-view-controls[data-v-f794256d] { margin-left: auto; display: flex; align-items: center; gap: 8px;\n}\n.diff-view-controls label[data-v-f794256d] { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 500;\n}\n.diff-view-controls select[data-v-f794256d] { width: auto; min-height: 26px; padding: 2px 24px 2px 7px; font-size: 11px;\n}\n.diff-layout-buttons[data-v-f794256d] { display: inline-flex;\n}\n.diff-layout-buttons button[data-v-f794256d] { min-height: 26px; padding: 2px 7px; border-radius: 0; font-size: 11px;\n}\n.diff-layout-buttons button[data-v-f794256d]:first-child { border-radius: 4px 0 0 4px;\n}\n.diff-layout-buttons button[data-v-f794256d]:last-child { margin-left: -1px; border-radius: 0 4px 4px 0;\n}\n.diff-layout-buttons button.active[data-v-f794256d] { position: relative; border-color: var(--accent); background: var(--accent-bg); color: var(--accent);\n}\n.unchanged-toggle[data-v-f794256d] { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; font-weight: 400;\n}\n.unchanged-toggle input[data-v-f794256d] { width: auto;\n}\n.context-diff-details[data-v-f794256d] { border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; color: var(--muted); font-size: 12px; background: var(--pane-soft);\n}\n.context-diff-details summary[data-v-f794256d] { cursor: pointer; color: var(--text); font-weight: 650;\n}\n.context-diff-details[open] summary[data-v-f794256d] { margin-bottom: 6px;\n}\n.run-metadata-grid[data-v-f794256d] { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 12px;\n}\n.run-metadata-grid strong[data-v-f794256d] { color: var(--text); overflow-wrap: anywhere;\n}\n.metadata-note[data-v-f794256d] { margin: 7px 0 0; line-height: 1.4;\n}\n.context-diff-block[data-v-f794256d] { display: grid; grid-template-columns: 4px minmax(0, 1fr); border: 1px solid var(--line); border-radius: 6px; background: var(--pane); overflow: hidden;\n}\n.block-gutter[data-v-f794256d] { background: var(--line);\n}\n.context-diff-block.added .block-gutter[data-v-f794256d] { background: var(--success);\n}\n.context-diff-block.removed .block-gutter[data-v-f794256d] { background: var(--error);\n}\n.context-diff-block.modified .block-gutter[data-v-f794256d] { background: var(--warning);\n}\n.block-content[data-v-f794256d] { min-width: 0; padding: 9px 10px 10px;\n}\n.block-head[data-v-f794256d] { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin-bottom: 7px;\n}\n.block-status[data-v-f794256d] { text-transform: uppercase; font-size: 11px; font-weight: 750; letter-spacing: .03em;\n}\n.context-diff-block.added .block-status[data-v-f794256d] { color: var(--success);\n}\n.context-diff-block.removed .block-status[data-v-f794256d] { color: var(--error);\n}\n.context-diff-block.modified .block-status[data-v-f794256d] { color: var(--warning);\n}\n.block-key[data-v-f794256d] { font-weight: 650;\n}\n.block-role[data-v-f794256d] { color: var(--muted); font-size: 12px;\n}\n.block-token-chip[data-v-f794256d] { margin-left: auto; border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; font-size: 12px; background: var(--control-muted);\n}\n.metadata-only-change[data-v-f794256d] { padding: 9px 10px; border: 1px solid color-mix(in srgb, var(--warning) 55%, var(--line)); border-radius: 4px; background: color-mix(in srgb, var(--warning) 10%, var(--pane)); color: var(--text); font-size: 12px; line-height: 1.45;\n}\n.git-diff[data-v-f794256d] { overflow: auto; border: 1px solid var(--line); border-radius: 4px; background: var(--code-bg); font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;\n}\n.git-line[data-v-f794256d] { min-width: max-content; color: var(--code-text);\n}\n.git-diff.unified .git-line[data-v-f794256d] { display: grid; grid-template-columns: 44px 44px 20px minmax(max-content, 1fr);\n}\n.git-line.added[data-v-f794256d] { background: color-mix(in srgb, var(--success) 12%, var(--code-bg));\n}\n.git-line.removed[data-v-f794256d] { background: color-mix(in srgb, var(--error) 12%, var(--code-bg));\n}\n.git-line.blank[data-v-f794256d] { min-height: 19px; background: var(--pane-soft);\n}\n.git-line code[data-v-f794256d] { display: block; min-height: 1.55em; padding: 0 8px; white-space: pre;\n}\n.git-line mark[data-v-f794256d] { border-radius: 2px; background: color-mix(in srgb, currentColor 22%, transparent); color: inherit; font: inherit;\n}\n.line-number[data-v-f794256d] { padding: 0 7px; border-right: 1px solid var(--line); color: var(--muted); text-align: right; user-select: none;\n}\n.line-marker[data-v-f794256d] { text-align: center; user-select: none;\n}\n.git-line.added .line-marker[data-v-f794256d] { color: var(--success);\n}\n.git-line.removed .line-marker[data-v-f794256d] { color: var(--error);\n}\n.git-line.note[data-v-f794256d] { color: var(--muted); font-style: italic;\n}\n.note-side[data-v-f794256d] { color: var(--text); font-style: normal; font-weight: 650;\n}\n.git-line-separator[data-v-f794256d] { min-width: max-content; padding: 1px 12px; border-block: 1px solid var(--line); background: var(--accent-bg); color: var(--muted); text-align: center;\n}\n.split-header[data-v-f794256d] { position: sticky; top: 0; z-index: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 720px; border-bottom: 1px solid var(--line); background: var(--pane); color: var(--muted); font: 600 11px/1.8 system-ui, sans-serif; text-transform: uppercase;\n}\n.split-header span[data-v-f794256d] { padding-left: 52px;\n}\n.split-header span + span[data-v-f794256d] { border-left: 1px solid var(--line);\n}\n.split-line[data-v-f794256d] { display: grid; grid-template-columns: repeat(2, minmax(360px, 1fr)); min-width: 720px;\n}\n.split-line > .git-line[data-v-f794256d] { display: grid; grid-template-columns: 44px 20px minmax(max-content, 1fr);\n}\n.split-line > .git-line + .git-line[data-v-f794256d] { border-left: 1px solid var(--line);\n}\n.split-separator[data-v-f794256d] { min-width: 720px;\n}\n.context-diff-empty[data-v-f794256d] { color: var(--muted); padding: 20px; border: 1px dashed var(--line); border-radius: 6px;\n}\n.context-diff-empty.compact[data-v-f794256d] { padding: 12px;\n}\n.context-diff-error[data-v-f794256d] { padding: 10px; border: 1px solid var(--error); border-radius: 6px; background: var(--error-bg);\n}\n@media (max-width: 1100px) {\n.diff-view-controls[data-v-f794256d] { order: 3; margin-left: 0; width: 100%;\n}\n}\n@media (max-width: 900px) {\n.context-diff-expand[data-v-f794256d] { display: none;\n}\n}\n\n.app-root {\n\theight: 100%;\n\tmin-height: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n.surface-nav {\n\tflex: none;\n\theight: 40px;\n\tpadding: 4px 10px;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 6px;\n\tborder-bottom: 1px solid var(--line);\n\tbackground: var(--pane);\n}\n.surface-brand {\n\tmargin-right: 8px;\n\tfont-weight: 750;\n\tletter-spacing: .02em;\n}\n.surface-nav button {\n\tmin-height: 32px;\n\tborder-color: transparent;\n\tbackground: transparent;\n}\n.surface-nav button.active {\n\tborder-color: var(--accent);\n\tbackground: var(--accent-bg);\n\tcolor: var(--accent);\n}\n.surface-nav-spacer {\n\tflex: 1 1 auto;\n}\n.surface-nav .theme-toggle {\n\tmin-height: 32px;\n\tborder-color: var(--line);\n\tbackground: var(--pane);\n}\n\n/* The global form rule gives every select width:100%; the locale picker in the\n nav bar must hug the right edge instead of stretching across it. */\n.surface-nav .locale-select {\n\tflex: none;\n\twidth: auto;\n\tmin-width: 0;\n\tmin-height: 32px;\n}\n\n/* Keep nav tab labels on one line (zh-CN labels wrapped in narrow headers). */\n.surface-nav button {\n\twhite-space: nowrap;\n}\n.editor-surface {\n\tflex: 1;\n\tmin-height: 0;\n}\n.settings-surface {\n\tflex: 1;\n\tmin-height: 0;\n\tdisplay: flex;\n\tflex-direction: column;\n\tbackground: var(--pane-soft);\n}\n.settings-surface-head {\n\tflex: none;\n\tdisplay: flex;\n\talign-items: center;\n\tgap: 24px;\n\tpadding: 18px 24px;\n\tborder-bottom: 1px solid var(--line);\n\tbackground: var(--pane);\n}\n.settings-surface-head h1 {\n\tmargin: 0;\n\tfont-size: 20px;\n}\n.settings-surface-head p {\n\tmargin: 4px 0 0;\n\tcolor: var(--muted);\n}\n.settings-surface-status {\n\tmargin-left: auto;\n\tcolor: var(--muted);\n\tfont-size: 12px;\n}\n.settings-surface-body {\n\tflex: 1;\n\tmin-height: 0;\n\tdisplay: grid;\n\tgrid-template-columns: minmax(180px, 240px) minmax(0, 1fr);\n}\n.settings-nav {\n\tmin-width: 0;\n\tpadding: 14px 10px;\n\tborder-right: 1px solid var(--line);\n\tbackground: var(--pane);\n}\n.settings-nav button {\n\twidth: 100%;\n\tdisplay: flex;\n\talign-items: center;\n\tjustify-content: flex-start;\n\tmargin-bottom: 6px;\n}\n.settings-nav button.active {\n\tborder-color: var(--accent);\n\tbackground: var(--accent-bg);\n\tcolor: var(--accent);\n}\n.settings-panel {\n\tmin-width: 0;\n\tmin-height: 0;\n\toverflow: auto;\n\tpadding: 20px clamp(16px, 4vw, 48px);\n}\n.settings-panel > .schema-form {\n\twidth: min(100%, 1100px);\n\tmargin: 0 auto;\n}\n.legacy-editor-root {\n\theight: 100%;\n\tdisplay: flex;\n\tflex-direction: column;\n}\n.legacy-editor-root .topbar {\n\tflex: none;\n}\n.editor-surface .shell {\n\tflex: 1;\n\tmin-height: 0;\n\theight: auto;\n}\n@media (max-width: 700px) {\n.surface-nav {\n\t\toverflow-x: auto;\n}\n.surface-nav > * {\n\t\tflex-shrink: 0;\n}\n.surface-nav-spacer {\n\t\tdisplay: none;\n}\n.settings-surface-head {\n\t\talign-items: flex-start;\n\t\tpadding: 14px 16px;\n}\n.settings-surface-status {\n\t\tmargin-left: auto;\n}\n.settings-surface-body {\n\t\tgrid-template-columns: minmax(0, 1fr);\n}\n.settings-nav {\n\t\tdisplay: flex;\n\t\tgap: 6px;\n\t\toverflow-x: auto;\n\t\tpadding: 8px;\n\t\tborder-right: 0;\n\t\tborder-bottom: 1px solid var(--line);\n}\n.settings-nav button {\n\t\twidth: auto;\n\t\tflex: 0 0 auto;\n\t\tmargin: 0;\n}\n.settings-panel {\n\t\tpadding: 14px 10px;\n}\n}\n/*$vite$:1*/";
3
3
  //# sourceMappingURL=client-styles.generated.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"client-styles.generated.js","sourceRoot":"","sources":["../../src/web-editor/client-styles.generated.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAW,+jQAA+jQ,CAAC"}
1
+ {"version":3,"file":"client-styles.generated.js","sourceRoot":"","sources":["../../src/web-editor/client-styles.generated.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,MAAM,CAAC,MAAM,oBAAoB,GAAW,i8nBAAi8nB,CAAC"}
@@ -0,0 +1,41 @@
1
+ import { type UiContributionTabDescriptor, type UiContributionTransport } from "../ui-contribution/contrib-port.ts";
2
+ export interface ContributionServiceOptions {
3
+ discoverTimeoutMs?: number;
4
+ requestTimeoutMs?: number;
5
+ }
6
+ export type ContributionWriteResult = {
7
+ ok: true;
8
+ values?: Record<string, unknown>;
9
+ } | {
10
+ ok: false;
11
+ status: number;
12
+ error: string;
13
+ errors?: Record<string, string>;
14
+ };
15
+ export declare class ContributionService {
16
+ private readonly client;
17
+ private readonly discoverTimeoutMs;
18
+ private readonly requestTimeoutMs;
19
+ private connection?;
20
+ private tabs;
21
+ private discovering?;
22
+ private discoveringGeneration?;
23
+ private unavailableUnsubscribe?;
24
+ private lifecycleGeneration;
25
+ private connectionEpoch;
26
+ private started;
27
+ constructor(transport: UiContributionTransport, options?: ContributionServiceOptions);
28
+ start(): void;
29
+ stop(): Promise<void>;
30
+ listTabs(): Promise<UiContributionTabDescriptor[]>;
31
+ /**
32
+ * Opaque identity for the provider session that produced the current tabs.
33
+ * The browser uses this to invalidate a mounted schema even when a provider
34
+ * restarts quickly enough that polling never observes an empty tab list.
35
+ */
36
+ get providerKey(): string | null;
37
+ writeValues(tabId: string, patch: Record<string, unknown>): Promise<ContributionWriteResult>;
38
+ private ensureConnected;
39
+ private refreshTabs;
40
+ }
41
+ //# sourceMappingURL=contrib-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"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GAAG,IAAI,CAE/B;IAEK,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,uBAAuB,CAAC;YA6BpF,eAAe;YAwBf,WAAW;CAuBzB"}
@@ -0,0 +1,174 @@
1
+ import { UiContributionClient, } from "../ui-contribution/contrib-port.js";
2
+ export class ContributionService {
3
+ client;
4
+ discoverTimeoutMs;
5
+ requestTimeoutMs;
6
+ connection;
7
+ tabs = [];
8
+ discovering;
9
+ discoveringGeneration;
10
+ unavailableUnsubscribe;
11
+ lifecycleGeneration = 0;
12
+ connectionEpoch = 0;
13
+ started = false;
14
+ constructor(transport, options = {}) {
15
+ this.discoverTimeoutMs = options.discoverTimeoutMs ?? 200;
16
+ this.requestTimeoutMs = options.requestTimeoutMs ?? 2_000;
17
+ this.client = new UiContributionClient(transport, {
18
+ discoverSettleMs: 10,
19
+ defaultTimeoutMs: this.requestTimeoutMs,
20
+ });
21
+ }
22
+ start() {
23
+ if (this.started)
24
+ return;
25
+ this.started = true;
26
+ const generation = ++this.lifecycleGeneration;
27
+ this.unavailableUnsubscribe = this.client.onUnavailable(() => {
28
+ this.connection = undefined;
29
+ this.tabs = [];
30
+ });
31
+ void this.ensureConnected(generation)
32
+ .then((connection) => connection ? this.refreshTabs(generation) : undefined)
33
+ .catch(() => {
34
+ if (generation !== this.lifecycleGeneration)
35
+ return;
36
+ this.connection = undefined;
37
+ this.tabs = [];
38
+ });
39
+ }
40
+ async stop() {
41
+ if (!this.started && !this.discovering)
42
+ return;
43
+ this.started = false;
44
+ this.lifecycleGeneration += 1;
45
+ const pendingDiscovery = this.discovering;
46
+ if (this.unavailableUnsubscribe) {
47
+ this.unavailableUnsubscribe();
48
+ this.unavailableUnsubscribe = undefined;
49
+ }
50
+ this.client.disconnect();
51
+ this.connection = undefined;
52
+ this.tabs = [];
53
+ await pendingDiscovery?.catch(() => undefined);
54
+ }
55
+ async listTabs() {
56
+ if (!this.started)
57
+ return [];
58
+ const connection = await this.ensureConnected();
59
+ if (!connection)
60
+ return [];
61
+ await this.refreshTabs();
62
+ return this.tabs;
63
+ }
64
+ /**
65
+ * Opaque identity for the provider session that produced the current tabs.
66
+ * The browser uses this to invalidate a mounted schema even when a provider
67
+ * restarts quickly enough that polling never observes an empty tab list.
68
+ */
69
+ get providerKey() {
70
+ return this.connection ? `connection:${this.connectionEpoch}` : null;
71
+ }
72
+ async writeValues(tabId, patch) {
73
+ if (!this.started)
74
+ return { ok: false, status: 503, error: "No UI contribution provider is available." };
75
+ const connection = await this.ensureConnected();
76
+ if (!connection)
77
+ return { ok: false, status: 503, error: "No UI contribution provider is available." };
78
+ if (this.tabs.length === 0)
79
+ await this.refreshTabs();
80
+ if (!this.connection)
81
+ return { ok: false, status: 503, error: "No UI contribution provider is available." };
82
+ if (!this.tabs.some((tab) => tab.tabId === tabId)) {
83
+ return { ok: false, status: 404, error: `Unknown contribution tab: ${tabId}` };
84
+ }
85
+ const result = await this.client.writeValues(connection, tabId, patch, this.requestTimeoutMs);
86
+ if (!result.ok) {
87
+ return { ok: false, status: 502, error: result.error };
88
+ }
89
+ const response = result.data;
90
+ if (response.ok) {
91
+ const tab = this.tabs.find((candidate) => candidate.tabId === tabId);
92
+ const values = response.values ?? (tab ? mergeFormValues(tab.values, patch) : patch);
93
+ if (tab)
94
+ tab.values = values;
95
+ return { ok: true, values };
96
+ }
97
+ const first = Object.values(response.errors)[0];
98
+ return {
99
+ ok: false,
100
+ status: 400,
101
+ error: first ? `${first} (${Object.keys(response.errors).join(", ")})` : "Contribution values failed validation.",
102
+ errors: response.errors,
103
+ };
104
+ }
105
+ async ensureConnected(generation = this.lifecycleGeneration) {
106
+ if (this.connection)
107
+ return this.connection;
108
+ if (!this.discovering || this.discoveringGeneration !== generation) {
109
+ const discovery = this.client.discover(this.discoverTimeoutMs)
110
+ .then((connection) => {
111
+ if (!this.started || generation !== this.lifecycleGeneration)
112
+ return undefined;
113
+ this.client.connect(connection);
114
+ this.connection = connection;
115
+ this.connectionEpoch += 1;
116
+ return connection;
117
+ })
118
+ .catch(() => undefined)
119
+ .finally(() => {
120
+ if (this.discovering === discovery) {
121
+ this.discovering = undefined;
122
+ this.discoveringGeneration = undefined;
123
+ }
124
+ });
125
+ this.discovering = discovery;
126
+ this.discoveringGeneration = generation;
127
+ }
128
+ return this.discovering;
129
+ }
130
+ async refreshTabs(generation = this.lifecycleGeneration) {
131
+ try {
132
+ if (!this.started || generation !== this.lifecycleGeneration)
133
+ return;
134
+ const connection = this.connection;
135
+ if (!connection) {
136
+ this.tabs = [];
137
+ return;
138
+ }
139
+ const result = await this.client.listContributions(connection, this.requestTimeoutMs);
140
+ if (!this.started || generation !== this.lifecycleGeneration)
141
+ return;
142
+ if (!result.ok) {
143
+ this.tabs = [];
144
+ this.connection = undefined;
145
+ return;
146
+ }
147
+ const response = result.data;
148
+ this.tabs = response.tabs;
149
+ }
150
+ catch {
151
+ if (!this.started || generation !== this.lifecycleGeneration)
152
+ return;
153
+ this.tabs = [];
154
+ this.connection = undefined;
155
+ }
156
+ }
157
+ }
158
+ function mergeFormValues(base, patch) {
159
+ const merged = { ...base };
160
+ for (const [key, value] of Object.entries(patch)) {
161
+ const existing = merged[key];
162
+ if (isPlainObject(existing) && isPlainObject(value)) {
163
+ merged[key] = mergeFormValues(existing, value);
164
+ }
165
+ else {
166
+ merged[key] = value;
167
+ }
168
+ }
169
+ return merged;
170
+ }
171
+ function isPlainObject(value) {
172
+ return !!value && typeof value === "object" && !Array.isArray(value);
173
+ }
174
+ //# sourceMappingURL=contrib-service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contrib-service.js","sourceRoot":"","sources":["../../src/web-editor/contrib-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,oBAAoB,GAKpB,MAAM,oCAAoC,CAAC;AAW5C,MAAM,OAAO,mBAAmB;IACd,MAAM,CAAuB;IAC7B,iBAAiB,CAAS;IAC1B,gBAAgB,CAAS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,CAAC;YACxE,IAAI,CAAC,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;QAC3B,CAAC;QAAC,MAAM,CAAC;YACR,IAAI,CAAC,IAAI,CAAC,OAAO,IAAI,UAAU,KAAK,IAAI,CAAC,mBAAmB;gBAAE,OAAO;YACrE,IAAI,CAAC,IAAI,GAAG,EAAE,CAAC;YACf,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC7B,CAAC;IACF,CAAC;CACD;AAED,SAAS,eAAe,CAAC,IAA6B,EAAE,KAA8B;IACrF,MAAM,MAAM,GAA4B,EAAE,GAAG,IAAI,EAAE,CAAC;IACpD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAClD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,IAAI,aAAa,CAAC,QAAQ,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC;YACrD,MAAM,CAAC,GAAG,CAAC,GAAG,eAAe,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;QAChD,CAAC;aAAM,CAAC;YACP,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACrB,CAAC;IACF,CAAC;IACD,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACpC,OAAO,CAAC,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACtE,CAAC"}
@@ -0,0 +1,28 @@
1
+ /** Presentation-only line diff used by the web editor's git-style diff view. */
2
+ export type LineDiffKind = "same" | "added" | "removed" | "note";
3
+ export interface LineDiffPart {
4
+ text: string;
5
+ changed: boolean;
6
+ }
7
+ export interface LineDiffRow {
8
+ kind: LineDiffKind;
9
+ text: string;
10
+ beforeLine?: number;
11
+ afterLine?: number;
12
+ parts: LineDiffPart[];
13
+ noteSide?: "before" | "after";
14
+ }
15
+ export interface LineDiffSeparator {
16
+ kind: "separator";
17
+ }
18
+ export type LineDiffDisplayRow = LineDiffRow | LineDiffSeparator;
19
+ export interface SplitLineDiffRow {
20
+ kind: "line" | "separator";
21
+ before?: LineDiffRow;
22
+ after?: LineDiffRow;
23
+ }
24
+ export declare function diffTextLines(beforeText: string, afterText: string): LineDiffRow[];
25
+ /** `contextLines = 0` means changed lines only; `null` means the complete file. */
26
+ export declare function filterLineRows(rows: readonly LineDiffRow[], contextLines: number | null): LineDiffDisplayRow[];
27
+ export declare function buildSplitLineRows(rows: readonly LineDiffDisplayRow[]): SplitLineDiffRow[];
28
+ //# sourceMappingURL=line-diff.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-diff.d.ts","sourceRoot":"","sources":["../../src/web-editor/line-diff.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAEhF,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEjE,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,WAAW,WAAW;IAC3B,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;CAC9B;AAED,MAAM,WAAW,iBAAiB;IACjC,IAAI,EAAE,WAAW,CAAC;CAClB;AAED,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG,iBAAiB,CAAC;AAEjE,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,KAAK,CAAC,EAAE,WAAW,CAAC;CACpB;AAMD,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,EAAE,CA4BlF;AAED,mFAAmF;AACnF,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,WAAW,EAAE,EAAE,YAAY,EAAE,MAAM,GAAG,IAAI,GAAG,kBAAkB,EAAE,CAoB9G;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,kBAAkB,EAAE,GAAG,gBAAgB,EAAE,CA4B1F"}
@@ -0,0 +1,216 @@
1
+ /** Presentation-only line diff used by the web editor's git-style diff view. */
2
+ const MAX_LCS_CELLS = 500_000;
3
+ const MAX_INLINE_DIFF_CHARS = 50_000;
4
+ const GRAPHEME_SEGMENTER = new Intl.Segmenter(undefined, { granularity: "grapheme" });
5
+ export function diffTextLines(beforeText, afterText) {
6
+ const before = splitLines(beforeText);
7
+ const after = splitLines(afterText);
8
+ const operations = lineOperations(before, after);
9
+ let beforeLine = 1;
10
+ let afterLine = 1;
11
+ const rows = operations.map((operation) => {
12
+ const row = {
13
+ kind: operation.kind,
14
+ text: operation.text,
15
+ parts: [{ text: operation.text, changed: operation.kind !== "same" }],
16
+ };
17
+ if (operation.kind !== "added")
18
+ row.beforeLine = beforeLine++;
19
+ if (operation.kind !== "removed")
20
+ row.afterLine = afterLine++;
21
+ return row;
22
+ });
23
+ const annotated = annotateInlineChanges(rows);
24
+ const beforeLacksFinalNewline = beforeText.length > 0 && !beforeText.endsWith("\n");
25
+ const afterLacksFinalNewline = afterText.length > 0 && !afterText.endsWith("\n");
26
+ if (beforeLacksFinalNewline !== afterLacksFinalNewline) {
27
+ annotated.push({
28
+ kind: "note",
29
+ text: "No newline at end of file",
30
+ parts: [{ text: "No newline at end of file", changed: false }],
31
+ noteSide: beforeLacksFinalNewline ? "before" : "after",
32
+ });
33
+ }
34
+ return annotated;
35
+ }
36
+ /** `contextLines = 0` means changed lines only; `null` means the complete file. */
37
+ export function filterLineRows(rows, contextLines) {
38
+ if (contextLines === null)
39
+ return [...rows];
40
+ const context = Math.max(0, Math.floor(contextLines));
41
+ const keep = rows.map(() => false);
42
+ for (let index = 0; index < rows.length; index++) {
43
+ if (rows[index].kind === "same")
44
+ continue;
45
+ for (let nearby = Math.max(0, index - context); nearby <= Math.min(rows.length - 1, index + context); nearby++) {
46
+ keep[nearby] = true;
47
+ }
48
+ }
49
+ const result = [];
50
+ let previousKept = -1;
51
+ for (let index = 0; index < rows.length; index++) {
52
+ if (!keep[index])
53
+ continue;
54
+ if (previousKept >= 0 && index > previousKept + 1)
55
+ result.push({ kind: "separator" });
56
+ result.push(rows[index]);
57
+ previousKept = index;
58
+ }
59
+ return result;
60
+ }
61
+ export function buildSplitLineRows(rows) {
62
+ const result = [];
63
+ for (let index = 0; index < rows.length;) {
64
+ const row = rows[index];
65
+ if (row.kind === "separator") {
66
+ result.push({ kind: "separator" });
67
+ index++;
68
+ continue;
69
+ }
70
+ if (row.kind === "same") {
71
+ result.push({ kind: "line", before: row, after: row });
72
+ index++;
73
+ continue;
74
+ }
75
+ const removed = [];
76
+ const added = [];
77
+ while (index < rows.length && rows[index].kind !== "same" && rows[index].kind !== "separator") {
78
+ const changed = rows[index];
79
+ if (changed.kind === "removed" || (changed.kind === "note" && changed.noteSide === "before"))
80
+ removed.push(changed);
81
+ else
82
+ added.push(changed);
83
+ index++;
84
+ }
85
+ for (let pair = 0; pair < Math.max(removed.length, added.length); pair++) {
86
+ result.push({ kind: "line", before: removed[pair], after: added[pair] });
87
+ }
88
+ }
89
+ return result;
90
+ }
91
+ function splitLines(text) {
92
+ if (text === "")
93
+ return [];
94
+ const lines = text.split("\n");
95
+ if (text.endsWith("\n"))
96
+ lines.pop();
97
+ return lines;
98
+ }
99
+ function lineOperations(before, after) {
100
+ let prefix = 0;
101
+ while (prefix < before.length && prefix < after.length && before[prefix] === after[prefix])
102
+ prefix++;
103
+ let suffix = 0;
104
+ while (suffix < before.length - prefix
105
+ && suffix < after.length - prefix
106
+ && before[before.length - suffix - 1] === after[after.length - suffix - 1])
107
+ suffix++;
108
+ const beforeMiddle = before.slice(prefix, before.length - suffix);
109
+ const afterMiddle = after.slice(prefix, after.length - suffix);
110
+ const result = before
111
+ .slice(0, prefix)
112
+ .map((text) => ({ kind: "same", text }));
113
+ result.push(...diffMiddle(beforeMiddle, afterMiddle));
114
+ result.push(...before.slice(before.length - suffix).map((text) => ({ kind: "same", text })));
115
+ return result;
116
+ }
117
+ function diffMiddle(before, after) {
118
+ if (before.length === 0)
119
+ return after.map((text) => ({ kind: "added", text }));
120
+ if (after.length === 0)
121
+ return before.map((text) => ({ kind: "removed", text }));
122
+ if ((before.length + 1) * (after.length + 1) > MAX_LCS_CELLS) {
123
+ return [
124
+ ...before.map((text) => ({ kind: "removed", text })),
125
+ ...after.map((text) => ({ kind: "added", text })),
126
+ ];
127
+ }
128
+ const width = after.length + 1;
129
+ const matrix = new Uint32Array((before.length + 1) * width);
130
+ for (let beforeIndex = before.length - 1; beforeIndex >= 0; beforeIndex--) {
131
+ for (let afterIndex = after.length - 1; afterIndex >= 0; afterIndex--) {
132
+ const offset = beforeIndex * width + afterIndex;
133
+ matrix[offset] = before[beforeIndex] === after[afterIndex]
134
+ ? matrix[(beforeIndex + 1) * width + afterIndex + 1] + 1
135
+ : Math.max(matrix[(beforeIndex + 1) * width + afterIndex], matrix[offset + 1]);
136
+ }
137
+ }
138
+ const result = [];
139
+ let beforeIndex = 0;
140
+ let afterIndex = 0;
141
+ while (beforeIndex < before.length && afterIndex < after.length) {
142
+ if (before[beforeIndex] === after[afterIndex]) {
143
+ result.push({ kind: "same", text: before[beforeIndex] });
144
+ beforeIndex++;
145
+ afterIndex++;
146
+ }
147
+ else if (matrix[(beforeIndex + 1) * width + afterIndex] >= matrix[beforeIndex * width + afterIndex + 1]) {
148
+ result.push({ kind: "removed", text: before[beforeIndex++] });
149
+ }
150
+ else {
151
+ result.push({ kind: "added", text: after[afterIndex++] });
152
+ }
153
+ }
154
+ while (beforeIndex < before.length)
155
+ result.push({ kind: "removed", text: before[beforeIndex++] });
156
+ while (afterIndex < after.length)
157
+ result.push({ kind: "added", text: after[afterIndex++] });
158
+ return result;
159
+ }
160
+ function annotateInlineChanges(rows) {
161
+ const result = rows.map((row) => ({ ...row, parts: [...row.parts] }));
162
+ for (let index = 0; index < result.length;) {
163
+ if (result[index].kind === "same") {
164
+ index++;
165
+ continue;
166
+ }
167
+ const start = index;
168
+ while (index < result.length && result[index].kind !== "same")
169
+ index++;
170
+ const removed = result.slice(start, index).filter((row) => row.kind === "removed");
171
+ const added = result.slice(start, index).filter((row) => row.kind === "added");
172
+ for (let pair = 0; pair < Math.min(removed.length, added.length); pair++) {
173
+ const [beforeParts, afterParts] = inlineParts(removed[pair].text, added[pair].text);
174
+ removed[pair].parts = beforeParts;
175
+ added[pair].parts = afterParts;
176
+ }
177
+ }
178
+ return result;
179
+ }
180
+ function inlineParts(before, after) {
181
+ if (before.length + after.length > MAX_INLINE_DIFF_CHARS) {
182
+ return [
183
+ [{ text: before, changed: true }],
184
+ [{ text: after, changed: true }],
185
+ ];
186
+ }
187
+ const beforeGraphemes = splitGraphemes(before);
188
+ const afterGraphemes = splitGraphemes(after);
189
+ let prefix = 0;
190
+ while (prefix < beforeGraphemes.length
191
+ && prefix < afterGraphemes.length
192
+ && beforeGraphemes[prefix] === afterGraphemes[prefix])
193
+ prefix++;
194
+ let suffix = 0;
195
+ while (suffix < beforeGraphemes.length - prefix
196
+ && suffix < afterGraphemes.length - prefix
197
+ && beforeGraphemes[beforeGraphemes.length - suffix - 1] === afterGraphemes[afterGraphemes.length - suffix - 1])
198
+ suffix++;
199
+ return [
200
+ partsForLine(beforeGraphemes, prefix, suffix),
201
+ partsForLine(afterGraphemes, prefix, suffix),
202
+ ];
203
+ }
204
+ function partsForLine(graphemes, prefix, suffix) {
205
+ const parts = [];
206
+ if (prefix > 0)
207
+ parts.push({ text: graphemes.slice(0, prefix).join(""), changed: false });
208
+ parts.push({ text: graphemes.slice(prefix, graphemes.length - suffix).join(""), changed: true });
209
+ if (suffix > 0)
210
+ parts.push({ text: graphemes.slice(graphemes.length - suffix).join(""), changed: false });
211
+ return parts;
212
+ }
213
+ function splitGraphemes(text) {
214
+ return Array.from(GRAPHEME_SEGMENTER.segment(text), (part) => part.segment);
215
+ }
216
+ //# sourceMappingURL=line-diff.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"line-diff.js","sourceRoot":"","sources":["../../src/web-editor/line-diff.ts"],"names":[],"mappings":"AAAA,gFAAgF;AA8BhF,MAAM,aAAa,GAAG,OAAO,CAAC;AAC9B,MAAM,qBAAqB,GAAG,MAAM,CAAC;AACrC,MAAM,kBAAkB,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC,CAAC;AAEtF,MAAM,UAAU,aAAa,CAAC,UAAkB,EAAE,SAAiB;IAClE,MAAM,MAAM,GAAG,UAAU,CAAC,UAAU,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;IACpC,MAAM,UAAU,GAAG,cAAc,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACjD,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,MAAM,IAAI,GAAkB,UAAU,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE;QACxD,MAAM,GAAG,GAAgB;YACxB,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,IAAI,EAAE,SAAS,CAAC,IAAI;YACpB,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,CAAC,IAAI,EAAE,OAAO,EAAE,SAAS,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;SACrE,CAAC;QACF,IAAI,SAAS,CAAC,IAAI,KAAK,OAAO;YAAE,GAAG,CAAC,UAAU,GAAG,UAAU,EAAE,CAAC;QAC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,SAAS,CAAC,KAAK,CAAC,SAAS,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1G,OAAO,KAAK,CAAC;AACd,CAAC;AAED,SAAS,cAAc,CAAC,IAAY;IACnC,OAAO,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AAC7E,CAAC"}
@@ -1,4 +1,4 @@
1
- export declare function renderEditorHtml(): string;
1
+ export declare function renderEditorHtml(lang?: string): string;
2
2
  export declare function inlineScript(source: string): string;
3
3
  export declare function inlineStyle(source: string): string;
4
4
  //# sourceMappingURL=page.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/web-editor/page.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,IAAI,MAAM,CAezC;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD"}
1
+ {"version":3,"file":"page.d.ts","sourceRoot":"","sources":["../../src/web-editor/page.ts"],"names":[],"mappings":"AAIA,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,MAAa,GAAG,MAAM,CAe5D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAElD"}
@@ -1,9 +1,9 @@
1
1
  import { EDITOR_CLIENT_SCRIPT } from "./client-script.js";
2
2
  import { EDITOR_CLIENT_STYLES } from "./client-styles.js";
3
3
  import { EDITOR_STYLES } from "./styles.js";
4
- export function renderEditorHtml() {
4
+ export function renderEditorHtml(lang = "en") {
5
5
  return String.raw `<!doctype html>
6
- <html lang="en">
6
+ <html lang="${lang}">
7
7
  <head>
8
8
  <meta charset="utf-8">
9
9
  <meta name="viewport" content="width=device-width, initial-scale=1">
@@ -1 +1 @@
1
- {"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/web-editor/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,UAAU,gBAAgB;IAC/B,OAAO,MAAM,CAAC,GAAG,CAAA;;;;;;;SAOT,WAAW,CAAC,GAAG,aAAa,KAAK,oBAAoB,EAAE,CAAC;;;;UAIvD,YAAY,CAAC,oBAAoB,CAAC;;QAEpC,CAAC;AACT,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,MAAc;IAC1C,OAAO,MAAM,CAAC,OAAO,CAAC,aAAa,EAAE,YAAY,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,MAAc;IACzC,OAAO,MAAM,CAAC,OAAO,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC;AAClD,CAAC"}
1
+ {"version":3,"file":"page.js","sourceRoot":"","sources":["../../src/web-editor/page.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,UAAU,gBAAgB,CAAC,OAAe,IAAI;IACnD,OAAO,MAAM,CAAC,GAAG,CAAA;cACJ,IAAI;;;;;;SAMT,WAAW,CAAC,GAAG,aAAa,KAAK,oBAAoB,EAAE,CAAC;;;;UAIvD,YAAY,CAAC,oBAAoB,CAAC;;QAEpC,CAAC;AACT,CAAC;AAED,MAAM,UAAU,YAAY,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