@jxsuite/studio 2.4.2 → 3.0.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 (82) hide show
  1. package/dist/chunks/{cf-settings-g5fbf2zp.js → cf-settings-zj2cj1ar.js} +6 -3
  2. package/dist/chunks/{content-source-k9724vcv.js → content-source-7fy9qrm0.js} +10 -9
  3. package/dist/chunks/{convert-to-repeater-k10dvcc7.js → convert-to-repeater-6vvx96n2.js} +9 -8
  4. package/dist/chunks/{extension-sections-0ada0xcw.js → extension-sections-kwzvpemr.js} +13 -12
  5. package/dist/chunks/{files-yew27sn9.js → files-xcybanxe.js} +14 -13
  6. package/dist/chunks/{format-host-wewba4nq.js → format-host-8fr3545e.js} +2 -2
  7. package/dist/chunks/{git-panel-2dh1aw50.js → git-panel-g01d93vc.js} +9 -8
  8. package/dist/chunks/{layers-panel-qnsghwwd.js → layers-panel-27essgkc.js} +12 -11
  9. package/dist/chunks/{publish-panel-a0pdft5w.js → publish-panel-09sy2bab.js} +8 -7
  10. package/dist/chunks/{quick-search-9avyc4pc.js → quick-search-sefb61v8.js} +15 -14
  11. package/dist/chunks/{right-panel-kcnhtc5j.js → right-panel-9r32jd5j.js} +11 -10
  12. package/dist/chunks/{studio-aweyr4v1.js → studio-2x9zbxmx.js} +2 -2
  13. package/dist/chunks/{studio-ef8t53vc.js → studio-3dkcd4c5.js} +3 -3
  14. package/dist/chunks/{studio-hb7c46jy.js → studio-5efrtn1m.js} +9 -7
  15. package/dist/chunks/{studio-v1va0vhd.js → studio-6z5eyjwn.js} +24 -25
  16. package/dist/chunks/{studio-ke244pam.js → studio-7p35254k.js} +33 -11
  17. package/dist/chunks/{studio-f5yyvqxv.js → studio-8ezdegcx.js} +13 -11
  18. package/dist/chunks/{studio-cz2j1c0g.js → studio-a0yp7syn.js} +55 -18
  19. package/dist/chunks/{studio-26sv44br.js → studio-dc8s8heb.js} +34 -23
  20. package/dist/chunks/{studio-jnakhg87.js → studio-g5gdqnyd.js} +4 -4
  21. package/dist/chunks/{studio-rqemfhz6.js → studio-hcxzyk3x.js} +2 -2
  22. package/dist/chunks/{studio-ws6ef6js.js → studio-hj2se583.js} +12 -10
  23. package/dist/chunks/{studio-pyrw8h0w.js → studio-j595e748.js} +407 -167
  24. package/dist/chunks/{studio-dgj7gq44.js → studio-k4jvjcfx.js} +4 -4
  25. package/dist/chunks/studio-kfpek536.js +28 -0
  26. package/dist/chunks/{studio-sccge2wf.js → studio-p5dja96s.js} +2 -2
  27. package/dist/chunks/{studio-0b6fs05q.js → studio-pkp61mh8.js} +5 -5
  28. package/dist/chunks/studio-qpfq7xhm.js +1802 -0
  29. package/dist/chunks/{studio-ra7ar50f.js → studio-r5xbtctf.js} +51 -1565
  30. package/dist/chunks/{studio-v2c5pmjj.js → studio-rh1cnamv.js} +17 -15
  31. package/dist/chunks/{studio-28xc8ws4.js → studio-ry1vz5sv.js} +10 -8
  32. package/dist/chunks/{studio-hyn3vhwr.js → studio-xntfdy1x.js} +5 -5
  33. package/dist/iframe-entry.js +344 -26
  34. package/dist/studio.js +374 -248
  35. package/package.json +9 -9
  36. package/src/browse/library-layouts.ts +3 -3
  37. package/src/browse/library-pane.ts +2 -2
  38. package/src/browse/library-preview.ts +19 -3
  39. package/src/canvas/asset-refs.ts +119 -0
  40. package/src/canvas/asset-resolve.ts +256 -0
  41. package/src/canvas/canvas-live-render.ts +23 -15
  42. package/src/canvas/iframe-entry.ts +1 -0
  43. package/src/canvas/iframe-host.ts +4 -0
  44. package/src/canvas/iframe-protocol.ts +9 -0
  45. package/src/canvas/iframe-render.ts +28 -10
  46. package/src/canvas/site-style-css.ts +2 -6
  47. package/src/editor/file-drop-action.ts +2 -1
  48. package/src/files/files.ts +2 -2
  49. package/src/files/media-paths.ts +37 -14
  50. package/src/files/media-upload.ts +47 -6
  51. package/src/grid/grid-idle.ts +45 -0
  52. package/src/grid/grid-view.ts +21 -0
  53. package/src/grid/schema-columns.ts +2 -1
  54. package/src/grid/sources/content-source.ts +24 -3
  55. package/src/new-project/import-tab.ts +3 -2
  56. package/src/panels/ai-chat/composer.ts +30 -13
  57. package/src/panels/frontmatter-fields.ts +6 -2
  58. package/src/panels/properties-panel.ts +8 -2
  59. package/src/panels/seo-modal.ts +5 -6
  60. package/src/panels/signals-panel.ts +2 -1
  61. package/src/platforms/cloud.ts +75 -5
  62. package/src/platforms/devserver.ts +5 -1
  63. package/src/services/ai-models.ts +101 -11
  64. package/src/services/ai-settings.ts +69 -71
  65. package/src/services/cf-settings.ts +19 -37
  66. package/src/services/document-assistant.ts +4 -3
  67. package/src/services/idle.ts +6 -1
  68. package/src/services/settings/definitions.ts +164 -0
  69. package/src/services/settings/kernel.ts +335 -0
  70. package/src/services/settings/write-queue.ts +116 -0
  71. package/src/settings/preferences-accounts.ts +6 -19
  72. package/src/settings/preferences-keymap.ts +8 -18
  73. package/src/settings/schema-field-ui.ts +2 -2
  74. package/src/shell.ts +6 -14
  75. package/src/studio.ts +32 -1
  76. package/src/types.ts +61 -3
  77. package/src/ui/ai-credentials-form.ts +52 -27
  78. package/src/ui/media-picker.ts +6 -11
  79. package/src/utils/studio-utils.ts +45 -3
  80. package/dist/chunks/studio-a7pzveq1.js +0 -110
  81. package/src/canvas/content-assets.ts +0 -263
  82. package/src/services/settings-store.ts +0 -99
@@ -19,14 +19,13 @@ import {
19
19
  renderOperandEditor,
20
20
  resolveContextPointer,
21
21
  slotMode
22
- } from "./studio-ef8t53vc.js";
22
+ } from "./studio-3dkcd4c5.js";
23
23
  import {
24
24
  live
25
25
  } from "./studio-c31yb4t6.js";
26
26
  import {
27
27
  IMAGE_EXTENSIONS,
28
28
  MEDIA_EXTENSIONS,
29
- UPLOAD_ACCEPT,
30
29
  baseName,
31
30
  codeService,
32
31
  extensionOf,
@@ -35,15 +34,16 @@ import {
35
34
  loadUsages,
36
35
  mediaKind,
37
36
  mediaSiteUrl,
38
- normalizeProjectPath,
39
37
  peekUsages,
40
38
  pluginSchemaCache,
39
+ previewFileSrc,
41
40
  retryUsages,
42
41
  setLintMarkers,
42
+ uploadAccept,
43
43
  uploadAssets,
44
44
  usageFiles,
45
45
  usageHeadline
46
- } from "./studio-cz2j1c0g.js";
46
+ } from "./studio-a0yp7syn.js";
47
47
  import {
48
48
  attachInstruction,
49
49
  canvasModeOfTab,
@@ -54,7 +54,7 @@ import {
54
54
  evaluateExpression,
55
55
  extractInstruction,
56
56
  isMutating,
57
- loopbackAssetSrc,
57
+ normalizeProjectPath,
58
58
  openPageAction,
59
59
  previewAssetSrc,
60
60
  pureSchemeOf,
@@ -64,7 +64,7 @@ import {
64
64
  requestCanvasEval,
65
65
  staleSelectionMessage,
66
66
  tabOfPane
67
- } from "./studio-pyrw8h0w.js";
67
+ } from "./studio-j595e748.js";
68
68
  import {
69
69
  BUFFER_COMMIT,
70
70
  NAVIGATOR_STATEMENTS_REGION,
@@ -84,7 +84,6 @@ import {
84
84
  cancelBufferWrites,
85
85
  commitBufferWrites,
86
86
  detachTab,
87
- effect,
88
87
  enumArg,
89
88
  enumProperty,
90
89
  friendlyNameToVar,
@@ -95,6 +94,7 @@ import {
95
94
  getLayerSlot,
96
95
  inferInputType,
97
96
  insertIntoPane,
97
+ isMediaFormat,
98
98
  kebabToLabel,
99
99
  localeLabel,
100
100
  monacoTheme,
@@ -106,7 +106,6 @@ import {
106
106
  mutateUpdateProp,
107
107
  mutateUpdateProperty,
108
108
  mutateUpdateStyle,
109
- notify,
110
109
  optionalStringArg,
111
110
  paneById,
112
111
  parseCemType,
@@ -116,20 +115,18 @@ import {
116
115
  primarySelection,
117
116
  promoteTab,
118
117
  setBottomTab,
119
- shallowRef,
120
118
  shell,
121
119
  sidePane,
122
120
  stringArg,
123
121
  stringProperty,
124
122
  tabIsLive,
125
- toRaw,
126
123
  transactDoc,
127
124
  translationPathFor,
128
125
  unifyValues,
129
126
  varDisplayName,
130
127
  view,
131
128
  workspace
132
- } from "./studio-ra7ar50f.js";
129
+ } from "./studio-r5xbtctf.js";
133
130
  import {
134
131
  classMap,
135
132
  ifDefined
@@ -167,12 +164,18 @@ import {
167
164
  renderOnly,
168
165
  updateUi
169
166
  } from "./studio-cjm7fdjf.js";
167
+ import {
168
+ effect,
169
+ notify,
170
+ shallowRef,
171
+ toRaw
172
+ } from "./studio-qpfq7xhm.js";
170
173
  import {
171
174
  getExtensions,
172
175
  loadExtensions,
173
176
  loadMonaco,
174
177
  mountStillWanted
175
- } from "./studio-rqemfhz6.js";
178
+ } from "./studio-hcxzyk3x.js";
176
179
  import {
177
180
  getPlatform
178
181
  } from "./studio-sas7mt3k.js";
@@ -914,7 +917,7 @@ function renderMediaPickerPopover() {
914
917
  <sp-menu-item value=${m.path}>
915
918
  ${m.isImage ? html`<img
916
919
  slot="icon"
917
- src=${loopbackAssetSrc(m.path)}
920
+ src=${previewFileSrc(m.file)}
918
921
  alt=""
919
922
  style="width:24px;height:24px;object-fit:cover;border-radius:var(--spectrum-corner-radius-75, 2px)"
920
923
  @load=${(e) => noteImageSize(m.file, e.target)}
@@ -983,7 +986,7 @@ function pickAndUpload(onCommit) {
983
986
  const input = document.createElement("input");
984
987
  input.type = "file";
985
988
  input.multiple = true;
986
- input.accept = UPLOAD_ACCEPT;
989
+ input.accept = uploadAccept();
987
990
  input.addEventListener("change", () => {
988
991
  if (input.files?.length) {
989
992
  uploadAndAssign(input.files, onCommit);
@@ -997,11 +1000,7 @@ function renderMediaPicker(prop, value, onCommit) {
997
1000
  const isImage = IMAGE_EXTENSIONS.has(extensionOf(currentValue));
998
1001
  return html`
999
1002
  <div class="media-picker">
1000
- ${isImage && currentValue ? html`<img
1001
- class="media-picker-thumb"
1002
- src=${loopbackAssetSrc(previewAssetSrc(currentValue))}
1003
- alt=""
1004
- />` : nothing}
1003
+ ${isImage && currentValue ? html`<img class="media-picker-thumb" src=${previewAssetSrc(currentValue)} alt="" />` : nothing}
1005
1004
  <sp-textfield
1006
1005
  size="s"
1007
1006
  placeholder="/image.jpg"
@@ -4788,7 +4787,7 @@ function renderComponentPropsFieldsTemplate(node, path, mapSignals, navigateToCo
4788
4787
  const literalDefault = boundRef ? defaultAsString(defs[boundRef.startsWith("#/state/") ? boundRef.slice(8) : boundRef]) || undefined : undefined;
4789
4788
  let debounce;
4790
4789
  let widgetTpl;
4791
- if (prop.format === "image") {
4790
+ if (isMediaFormat(prop.format)) {
4792
4791
  widgetTpl = renderMediaPicker(prop.name, staticVal, onChange);
4793
4792
  } else if (prop.format === "color") {
4794
4793
  widgetTpl = renderColorSelector(prop.name, staticVal, onChange);
@@ -5128,10 +5127,10 @@ function renderUsagesSection(tagName, componentPath) {
5128
5127
  `;
5129
5128
  }
5130
5129
  function openUsage(path) {
5131
- import("./files-yew27sn9.js").then((m) => m.openFileInTab(path));
5130
+ import("./files-xcybanxe.js").then((m) => m.openFileInTab(path));
5132
5131
  }
5133
5132
  function showLogicTab() {
5134
- import("./right-panel-kcnhtc5j.js").then((m) => m.setInspectorTab("events"));
5133
+ import("./right-panel-9r32jd5j.js").then((m) => m.setInspectorTab("events"));
5135
5134
  }
5136
5135
  function renderPropertiesPanelTemplate(ctx) {
5137
5136
  const tab = activeTab.value;
@@ -6433,7 +6432,7 @@ function renderSignalEditorTemplate(S, name, defArg, ctx) {
6433
6432
  fields = html`
6434
6433
  ${pickerRow("Type", ["string", "integer", "number", "boolean", "array", "object"], def.type || "string", (v) => transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { type: v })))}
6435
6434
  ${def.type === "string" || !def.type ? pickerRow("Format", ["", "image", "date", "color"], def.format || "", (v) => transactDoc(activeTab.value, (t) => mutateUpdateDef(t, name, { format: v || undefined }))) : nothing}
6436
- ${def.format === "image" ? renderFieldRow({
6435
+ ${isMediaFormat(def.format) ? renderFieldRow({
6437
6436
  hasValue: false,
6438
6437
  label: "Default",
6439
6438
  prop: "Default",
@@ -6999,5 +6998,5 @@ function registerSignalsCommands(registry) {
6999
6998
 
7000
6999
  export { isSchemeQuery, schemeOfQuery, parseMediaEntries, DERIVE_PRESETS, PRESET_LABELS, declaredMedia, installDerivationEffects, presetRefusal, deriveRefusal, pinRefusal, derivationCommands, invalidateMediaCache, renderMediaPicker, spTextField, spTextArea, spNumberField, unwrapSignal, dataTypeLabel, registerDataExplorerCommands, registerDataPanel, livePreviewExpression, closeFunctionEditor, logicTarget, revealLogicPanel, openLogicTarget, registerLogicPanel, registerFormulaEditorCommands, JxColorPopover, isColorPopoverOpen, css_meta_default, initCssData, getCssInitialMap, allConditionsPass, autoOpenSections, getLonghands, expandShorthand, compressShorthand, expandBorderSide, compressBorderSide, widgetForType2 as widgetForType, renderStatementEditor, mapSignalsFor, bindableSignalNames, defaultAsString, invalidatePageRouteCache, renderPropertiesPanelTemplate, isInspectorSectionOpen, setInspectorSection, inspectorCommands, registerInspectorCommands, defCategory, defBadgeLabel, isCustomElementDoc, collectCssParts, renderSignalsTemplate, registerSignalsCommands };
7001
7000
 
7002
- //# debugId=9BF36A7266D05ECB64756E2164756E21
7003
- //# sourceMappingURL=studio-v1va0vhd.js.map
7001
+ //# debugId=DE799258A5C20B8564756E2164756E21
7002
+ //# sourceMappingURL=studio-6z5eyjwn.js.map
@@ -8,27 +8,25 @@ import {
8
8
  activityIdleBlockers,
9
9
  beginActivity,
10
10
  showProgressModal
11
- } from "./studio-28xc8ws4.js";
11
+ } from "./studio-ry1vz5sv.js";
12
12
  import {
13
13
  canvasIdleBlockers,
14
14
  canvasPointAt,
15
15
  registerPanel,
16
16
  renderEmptyState,
17
17
  revealCanvasPath
18
- } from "./studio-pyrw8h0w.js";
18
+ } from "./studio-j595e748.js";
19
19
  import {
20
20
  activeTab,
21
21
  collabState,
22
22
  errorMessage,
23
23
  flushAllCollab,
24
- notify,
25
- now,
26
24
  overlayIdleBlockers,
27
25
  shell,
28
26
  showConfirmDialog,
29
27
  showDialog,
30
28
  showPromptDialog
31
- } from "./studio-ra7ar50f.js";
29
+ } from "./studio-r5xbtctf.js";
32
30
  import {
33
31
  ref,
34
32
  repeat
@@ -44,9 +42,13 @@ import {
44
42
  renderOnly,
45
43
  rendersInFlight
46
44
  } from "./studio-cjm7fdjf.js";
45
+ import {
46
+ notify,
47
+ now
48
+ } from "./studio-qpfq7xhm.js";
47
49
  import {
48
50
  formatForPath
49
- } from "./studio-rqemfhz6.js";
51
+ } from "./studio-hcxzyk3x.js";
50
52
  import {
51
53
  getPlatform,
52
54
  hasPlatform,
@@ -346,7 +348,7 @@ async function createGithubRepository({ projectName }) {
346
348
  });
347
349
  return false;
348
350
  }
349
- const { refreshGitStatus } = await import("./git-panel-2dh1aw50.js");
351
+ const { refreshGitStatus } = await import("./git-panel-g01d93vc.js");
350
352
  await refreshGitStatus();
351
353
  activity.done(repo.html_url);
352
354
  notify.success(`Repository created: ${repo.html_url}`, { key: "github.repo" });
@@ -376,6 +378,25 @@ function seedProjectList(entries) {
376
378
  cache = entries;
377
379
  }
378
380
 
381
+ // src/grid/grid-idle.ts
382
+ var liveGrids = new Set;
383
+ function registerGridProbe(probe) {
384
+ liveGrids.add(probe);
385
+ return () => liveGrids.delete(probe);
386
+ }
387
+ function gridIdleBlockers() {
388
+ const blockers = [];
389
+ for (const probe of liveGrids) {
390
+ try {
391
+ const reason = probe();
392
+ if (reason) {
393
+ blockers.push(reason);
394
+ }
395
+ } catch {}
396
+ }
397
+ return blockers;
398
+ }
399
+
379
400
  // src/services/idle.ts
380
401
  var QUIET_FRAMES = 2;
381
402
  var DEFAULT_IDLE_TIMEOUT_MS = 1e4;
@@ -413,7 +434,8 @@ function defaultIdleSources() {
413
434
  name: "platform"
414
435
  },
415
436
  { blockers: overlayIdleBlockers, name: "overlay" },
416
- { blockers: activityIdleBlockers, name: "activity" }
437
+ { blockers: activityIdleBlockers, name: "activity" },
438
+ { blockers: gridIdleBlockers, name: "grid" }
417
439
  ];
418
440
  }
419
441
  function idleBlockers(sources = defaultIdleSources()) {
@@ -1781,7 +1803,7 @@ function registerGitPanel() {
1781
1803
  });
1782
1804
  }
1783
1805
 
1784
- export { hydrateProjectList, getProjectList, shouldInstallAutomation, installAutomationHook, stripRange, isComparable, isUpgrade, maybePromptJxsuiteUpdate, autoSyncProjectOnOpen, githubTokenStored, githubTokenLocation, clearGithubToken, refreshGitStatus, cloneRepository, platformSupportsClone, readGitDiff, loadDiffForLens, initRepository, pushCurrentBranch, signInToGithub, renderGitPanel, relativeDate, sourceControlCommands, registerSourceControlCommands, cleanupGitPanel, registerGitPanel };
1806
+ export { hydrateProjectList, getProjectList, registerGridProbe, shouldInstallAutomation, installAutomationHook, stripRange, isComparable, isUpgrade, maybePromptJxsuiteUpdate, autoSyncProjectOnOpen, githubTokenStored, githubTokenLocation, clearGithubToken, refreshGitStatus, cloneRepository, platformSupportsClone, readGitDiff, loadDiffForLens, initRepository, pushCurrentBranch, signInToGithub, renderGitPanel, relativeDate, sourceControlCommands, registerSourceControlCommands, cleanupGitPanel, registerGitPanel };
1785
1807
 
1786
- //# debugId=6DB34F497D8C14B864756E2164756E21
1787
- //# sourceMappingURL=studio-ke244pam.js.map
1808
+ //# debugId=377D6D9A57EC225664756E2164756E21
1809
+ //# sourceMappingURL=studio-7p35254k.js.map
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  INSPECTOR_TABS,
3
3
  selectStylebookTag
4
- } from "./studio-hyn3vhwr.js";
4
+ } from "./studio-xntfdy1x.js";
5
5
  import {
6
6
  allConditionsPass,
7
7
  autoOpenSections,
@@ -28,7 +28,7 @@ import {
28
28
  setInspectorSection,
29
29
  spTextField,
30
30
  widgetForType
31
- } from "./studio-v1va0vhd.js";
31
+ } from "./studio-6z5eyjwn.js";
32
32
  import {
33
33
  createPanelScheduler
34
34
  } from "./studio-8jpzqk5s.js";
@@ -44,7 +44,7 @@ import {
44
44
  renderStaticKvRow,
45
45
  slotMode,
46
46
  switchSlotMode
47
- } from "./studio-ef8t53vc.js";
47
+ } from "./studio-3dkcd4c5.js";
48
48
  import {
49
49
  live
50
50
  } from "./studio-c31yb4t6.js";
@@ -52,21 +52,19 @@ import {
52
52
  loadUsages,
53
53
  peekUsages,
54
54
  usageFiles
55
- } from "./studio-cz2j1c0g.js";
55
+ } from "./studio-a0yp7syn.js";
56
56
  import {
57
57
  clickAnythingTo,
58
58
  mediaDisplayName,
59
59
  openPageAction,
60
60
  renderEmptyState,
61
61
  staleSelectionMessage
62
- } from "./studio-pyrw8h0w.js";
62
+ } from "./studio-j595e748.js";
63
63
  import {
64
64
  DEFAULT_INSPECTOR_TAB,
65
65
  REGION_ATTR,
66
66
  activeRegistry,
67
67
  activeTab,
68
- effect,
69
- effectScope,
70
68
  getEffectiveMedia,
71
69
  getEffectiveStyle,
72
70
  inferInputType,
@@ -86,13 +84,12 @@ import {
86
84
  mutateUpdateStyle,
87
85
  primarySelection,
88
86
  propLabel,
89
- reactive,
90
87
  shell,
91
88
  showPromptDialog,
92
89
  stringArg,
93
90
  transactDoc,
94
91
  unifyValues
95
- } from "./studio-ra7ar50f.js";
92
+ } from "./studio-r5xbtctf.js";
96
93
  import {
97
94
  classMap,
98
95
  ifDefined
@@ -121,6 +118,11 @@ import {
121
118
  rightPanel,
122
119
  updateUi
123
120
  } from "./studio-cjm7fdjf.js";
121
+ import {
122
+ effect,
123
+ effectScope,
124
+ reactive
125
+ } from "./studio-qpfq7xhm.js";
124
126
 
125
127
  // src/panels/events-panel.ts
126
128
  var EVENT_NAMES = [
@@ -1813,5 +1815,5 @@ function _doRender() {
1813
1815
 
1814
1816
  export { registerStyleCommands, mount, unmount, render2 as render, inspectorTab, setInspectorTab };
1815
1817
 
1816
- //# debugId=515A6CAE86AEF1C564756E2164756E21
1817
- //# sourceMappingURL=studio-f5yyvqxv.js.map
1818
+ //# debugId=7DAED945C4B605E264756E2164756E21
1819
+ //# sourceMappingURL=studio-8ezdegcx.js.map
@@ -1,20 +1,28 @@
1
1
  import {
2
- contentMountFor
3
- } from "./studio-pyrw8h0w.js";
2
+ PUBLIC_DIR,
3
+ contentMountFor,
4
+ encodeProjectPath,
5
+ hostAssetDeclarations,
6
+ loopbackAssetSrc,
7
+ normalizeProjectPath,
8
+ projectLocales
9
+ } from "./studio-j595e748.js";
4
10
  import {
5
11
  activeTab,
6
- errorMessage,
7
- notify
8
- } from "./studio-ra7ar50f.js";
12
+ errorMessage
13
+ } from "./studio-r5xbtctf.js";
9
14
  import {
10
15
  getNodeAtPath,
11
16
  isJsonObject,
12
17
  paramNames,
13
18
  projectState
14
19
  } from "./studio-cjm7fdjf.js";
20
+ import {
21
+ notify
22
+ } from "./studio-qpfq7xhm.js";
15
23
  import {
16
24
  loadedMonaco
17
- } from "./studio-rqemfhz6.js";
25
+ } from "./studio-hcxzyk3x.js";
18
26
  import {
19
27
  getPlatform,
20
28
  hasPlatform
@@ -145,7 +153,17 @@ var MEDIA_EXTENSIONS = new Set([
145
153
  ".ttf",
146
154
  ".otf"
147
155
  ]);
148
- var UPLOAD_ACCEPT = [
156
+ function formatBytes(bytes) {
157
+ const units = ["B", "KB", "MB", "GB"];
158
+ let value = bytes;
159
+ let unit = 0;
160
+ while (value >= 1024 && unit < units.length - 1) {
161
+ value /= 1024;
162
+ unit += 1;
163
+ }
164
+ return `${unit === 0 ? value : Number(value.toFixed(1))} ${units[unit]}`;
165
+ }
166
+ var DEFAULT_ACCEPT = [
149
167
  "image/*",
150
168
  "video/*",
151
169
  "audio/*",
@@ -156,6 +174,10 @@ var UPLOAD_ACCEPT = [
156
174
  ".ttf",
157
175
  ".otf"
158
176
  ].join(",");
177
+ function uploadAccept() {
178
+ const declared = hasPlatform() ? getPlatform().assetCapabilities?.accept : undefined;
179
+ return declared ?? DEFAULT_ACCEPT;
180
+ }
159
181
  function extensionOf(name) {
160
182
  const dot = name.lastIndexOf(".");
161
183
  return dot > 0 ? name.slice(dot).toLowerCase() : "";
@@ -242,18 +264,26 @@ async function uploadAssets(files, opts = {}) {
242
264
  } catch {
243
265
  taken = new Set;
244
266
  }
267
+ const maxBytes = hasPlatform() ? getPlatform().assetCapabilities?.maxUploadBytes : undefined;
245
268
  const uploaded = [];
246
269
  for (const file of list) {
270
+ if (maxBytes !== undefined && file.size > maxBytes) {
271
+ notify.error(`${file.name} is too large.`, {
272
+ detail: `This backend accepts at most ${formatBytes(maxBytes)}; that file is ${formatBytes(file.size)}.`,
273
+ source: "Media"
274
+ });
275
+ continue;
276
+ }
247
277
  const name = uniqueName(file.name, taken);
248
278
  taken.add(name);
249
- const path = joinDir(dir, name);
279
+ const requested = joinDir(dir, name);
250
280
  try {
251
- await platform.uploadFile(path, file);
281
+ const { path } = await platform.uploadFile(requested, file);
252
282
  uploaded.push({ kind: mediaKind(file), name, path, ref: assetRef(path) });
253
283
  } catch (error) {
254
284
  notify.error(`Could not upload ${file.name}.`, {
255
285
  detail: errorMessage(error),
256
- path,
286
+ path: requested,
257
287
  source: "Media"
258
288
  });
259
289
  }
@@ -358,10 +388,6 @@ function getFunctionArgs(editing, document) {
358
388
  }
359
389
 
360
390
  // src/files/media-paths.ts
361
- var PUBLIC_DIR = "public";
362
- function normalizeProjectPath(path) {
363
- return path.replaceAll("\\", "/").replace(/^\.\//, "").replace(/^\/+/, "").replace(/\/+$/, "");
364
- }
365
391
  function baseName(path) {
366
392
  const normalized = normalizeProjectPath(path);
367
393
  const slash = normalized.lastIndexOf("/");
@@ -372,7 +398,7 @@ function contentSections() {
372
398
  return content ?? null;
373
399
  }
374
400
  function mountOf(path) {
375
- return contentMountFor(path, contentSections());
401
+ return contentMountFor(path, contentSections(), projectLocales());
376
402
  }
377
403
  function mountedPath(path, mount) {
378
404
  const prefix = normalizeProjectPath(mount.urlPrefix);
@@ -404,8 +430,19 @@ function authoredRefTargets(path) {
404
430
  }
405
431
  return targets;
406
432
  }
433
+ function previewFileSrc(path) {
434
+ const normalized = normalizeProjectPath(path);
435
+ if (normalized === "") {
436
+ return path;
437
+ }
438
+ const { space, fileBaseUrl } = hostAssetDeclarations();
439
+ if (space === "repo") {
440
+ return `${fileBaseUrl}${encodeProjectPath(normalized)}`;
441
+ }
442
+ return loopbackAssetSrc(mediaSiteUrl(normalized));
443
+ }
407
444
 
408
- export { usagesSupported, peekUsages, loadUsages, retryUsages, invalidateUsages, usageHeadline, usageWarning, usageFiles, IMAGE_EXTENSIONS, MEDIA_EXTENSIONS, UPLOAD_ACCEPT, extensionOf, isImage, isMediaFile, mediaKind, setMediaChangedHandler, uploadAssets, normalizeProjectPath, baseName, mediaSiteUrl, authoredRefTargets, codeService, pluginSchemaCache, fetchPluginSchema, setLintMarkers, getFunctionArgs };
445
+ export { usagesSupported, peekUsages, loadUsages, retryUsages, invalidateUsages, usageHeadline, usageWarning, usageFiles, IMAGE_EXTENSIONS, MEDIA_EXTENSIONS, uploadAccept, extensionOf, isImage, isMediaFile, mediaKind, setMediaChangedHandler, uploadAssets, baseName, mediaSiteUrl, authoredRefTargets, previewFileSrc, codeService, pluginSchemaCache, fetchPluginSchema, setLintMarkers, getFunctionArgs };
409
446
 
410
- //# debugId=058163B6A8C10B5864756E2164756E21
411
- //# sourceMappingURL=studio-cz2j1c0g.js.map
447
+ //# debugId=453431DCD360BB2764756E2164756E21
448
+ //# sourceMappingURL=studio-a0yp7syn.js.map
@@ -16,19 +16,19 @@ import {
16
16
  isMediaFile,
17
17
  loadUsages,
18
18
  usageWarning
19
- } from "./studio-cz2j1c0g.js";
19
+ } from "./studio-a0yp7syn.js";
20
20
  import {
21
21
  showProgressModal
22
- } from "./studio-28xc8ws4.js";
22
+ } from "./studio-ry1vz5sv.js";
23
23
  import {
24
24
  deployStatusItem
25
- } from "./studio-aweyr4v1.js";
25
+ } from "./studio-2x9zbxmx.js";
26
26
  import {
27
27
  derivationOfPane,
28
28
  flushCanvasEdits,
29
29
  rectOf,
30
30
  tabOfPane
31
- } from "./studio-pyrw8h0w.js";
31
+ } from "./studio-j595e748.js";
32
32
  import {
33
33
  EDITOR_KIND_LABELS,
34
34
  PRIMARY_PANE,
@@ -37,24 +37,16 @@ import {
37
37
  collabReadOnly,
38
38
  collabSave,
39
39
  collabState,
40
- effect,
41
- effectScope,
42
40
  errorMessage,
43
- notify,
44
- now,
45
- onScopeDispose,
41
+ isMediaFormat,
46
42
  paneRegion,
47
43
  primarySelection,
48
- problemCount,
49
- problems,
50
- reactive,
51
44
  renderPopover,
52
45
  setHistoryDelegate,
53
46
  shell,
54
47
  showConfirmDialog,
55
- toRaw,
56
48
  workspace
57
- } from "./studio-ra7ar50f.js";
49
+ } from "./studio-r5xbtctf.js";
58
50
  import {
59
51
  ref,
60
52
  repeat
@@ -73,6 +65,17 @@ import {
73
65
  projectState,
74
66
  statusbarEl
75
67
  } from "./studio-cjm7fdjf.js";
68
+ import {
69
+ effect,
70
+ effectScope,
71
+ notify,
72
+ now,
73
+ onScopeDispose,
74
+ problemCount,
75
+ problems,
76
+ reactive,
77
+ toRaw
78
+ } from "./studio-qpfq7xhm.js";
76
79
  import {
77
80
  defaultContentFormat,
78
81
  documentExtensions,
@@ -83,7 +86,7 @@ import {
83
86
  loadFormats,
84
87
  noFormatError,
85
88
  splitFormatDocument
86
- } from "./studio-rqemfhz6.js";
89
+ } from "./studio-hcxzyk3x.js";
87
90
  import {
88
91
  getPlatform
89
92
  } from "./studio-sas7mt3k.js";
@@ -1229,7 +1232,7 @@ function kindForProp(prop) {
1229
1232
  return "enum";
1230
1233
  }
1231
1234
  const format = prop.type === "array" ? undefined : prop.format;
1232
- if (format === "image") {
1235
+ if (isMediaFormat(format)) {
1233
1236
  return "image";
1234
1237
  }
1235
1238
  if (format === "date" || format === "date-time") {
@@ -14985,18 +14988,26 @@ function buildEntryFileSource(opts) {
14985
14988
  const files = await opts.list();
14986
14989
  entries.clear();
14987
14990
  columnsCache = null;
14988
- await mapLimit(files, 8, async (path2) => {
14991
+ const loaded = await mapLimit(files, 8, async (path2) => {
14989
14992
  try {
14990
14993
  const text8 = await platform.readFile(path2);
14991
14994
  const parsed = await parseSourceForPath(path2, text8);
14992
- entries.set(path2, {
14995
+ return {
14993
14996
  document: parsed.document,
14994
14997
  formatName: parsed.format.name,
14995
14998
  frontmatter: parsed.frontmatter ?? {},
14996
14999
  rawText: text8
14997
- });
14998
- } catch {}
15000
+ };
15001
+ } catch {
15002
+ return null;
15003
+ }
14999
15004
  });
15005
+ for (const [index, path2] of files.entries()) {
15006
+ const record = loaded[index];
15007
+ if (record) {
15008
+ entries.set(path2, record);
15009
+ }
15010
+ }
15000
15011
  })();
15001
15012
  return loadPromise;
15002
15013
  };
@@ -15128,7 +15139,7 @@ function buildEntryFileSource(opts) {
15128
15139
  await writeEntry(path2, entry, patches);
15129
15140
  outcome(true);
15130
15141
  if (openTab2) {
15131
- const { reloadFileInTab } = await import("./files-yew27sn9.js");
15142
+ const { reloadFileInTab } = await import("./files-xcybanxe.js");
15132
15143
  reloadFileInTab(path2);
15133
15144
  }
15134
15145
  } catch (error) {
@@ -15292,5 +15303,5 @@ function createPagesSource() {
15292
15303
 
15293
15304
  export { markLocalMutation, isRecentLocal, startFsSync, cellValuesEqual, makeGridTabId, parseGridTabId, gridTabLabel, columnsFromSchema, inferColumnsFromRows, coerceCellInput, cellToText, ROW_KEY_FIELD, getGridController, createGridController, DRAFT_FIELD, DRAFT_MEANING, isDraftEntry, hasDraftAxis, setIncludeDrafts, attachJumpBarHost, mountJumpBar, buildMessageWithContext, clearMarkdownCache, beginTurn, recordWrite, endTurn, writesForTurn, renderChatHeader, renderMessageList, renderSessionsList, renderStatusbar, mountStatusbar, mediaTypeEssence, parseSourceForPath, saveFile, exportFile, serializeDocument, confirmFileDelete, renamePromptMessage, PATH_FIELD, collectionInfo, collectionDirs, listCollectionEntryIds, reloadDraftAwareGrids, createCollectionSource, createPagesSource };
15294
15305
 
15295
- //# debugId=43284A78BBF6BE9864756E2164756E21
15296
- //# sourceMappingURL=studio-26sv44br.js.map
15306
+ //# debugId=01953C232FDA3BDC64756E2164756E21
15307
+ //# sourceMappingURL=studio-dc8s8heb.js.map
@@ -3,7 +3,7 @@ import {
3
3
  getRecentProjects,
4
4
  openFileInTab,
5
5
  trackRecentFile
6
- } from "./studio-v2c5pmjj.js";
6
+ } from "./studio-rh1cnamv.js";
7
7
  import {
8
8
  live
9
9
  } from "./studio-c31yb4t6.js";
@@ -11,7 +11,7 @@ import {
11
11
  activeRegistry,
12
12
  activeTab,
13
13
  getLayerSlot
14
- } from "./studio-ra7ar50f.js";
14
+ } from "./studio-r5xbtctf.js";
15
15
  import {
16
16
  classMap
17
17
  } from "./studio-twsafr1e.js";
@@ -32,7 +32,7 @@ import {
32
32
  documentExtensions,
33
33
  formatByExtension,
34
34
  loadFormats
35
- } from "./studio-rqemfhz6.js";
35
+ } from "./studio-hcxzyk3x.js";
36
36
  import {
37
37
  getPlatform
38
38
  } from "./studio-sas7mt3k.js";
@@ -656,4 +656,4 @@ function renderOverlay() {
656
656
  export { PALETTE_MODES, modeSpec, resolvePaletteMode, fuzzyScore, rankBy, paletteArgs, getRecentCommands, initQuickSearch, openQuickSearch, closeQuickSearch, isQuickSearchOpen };
657
657
 
658
658
  //# debugId=D01DE0145FC9DB1664756E2164756E21
659
- //# sourceMappingURL=studio-jnakhg87.js.map
659
+ //# sourceMappingURL=studio-g5gdqnyd.js.map
@@ -110,7 +110,7 @@ async function shareProjectSchemas(platform) {
110
110
  }
111
111
  function refreshExtensionUi(platform) {
112
112
  shareProjectSchemas(platform);
113
- import("./extension-sections-0ada0xcw.js").then(({ syncExtensionSettingsSections }) => syncExtensionSettingsSections()).catch(() => {});
113
+ import("./extension-sections-kwzvpemr.js").then(({ syncExtensionSettingsSections }) => syncExtensionSettingsSections()).catch(() => {});
114
114
  }
115
115
  function getFormats() {
116
116
  return _formats;
@@ -225,4 +225,4 @@ function splitFormatDocument(format, doc) {
225
225
  export { loadMonaco, loadedMonaco, mountStillWanted, loadFormats, refreshFormats, setFormats, loadExtensions, getExtensions, setExtensions, refreshExtensionUi, getFormats, formatByExtension, formatByName, noFormatError, formatForPath, documentExtensions, defaultContentFormat, formatParse, formatSerialize, splitFormatDocument };
226
226
 
227
227
  //# debugId=7A0A51B7AA10806664756E2164756E21
228
- //# sourceMappingURL=studio-rqemfhz6.js.map
228
+ //# sourceMappingURL=studio-hcxzyk3x.js.map