@olonjs/core 1.1.12 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +17 -0
- package/dist/olonjs-core-runtime.js +47 -39
- package/dist/olonjs-core.js +229 -219
- package/dist/olonjs-core.umd.cjs +27 -27
- package/dist/runtime.d.ts +17 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -227,6 +227,14 @@ declare function buildPageManifest(input: BuildPageContractInput): OlonJsPageMan
|
|
|
227
227
|
|
|
228
228
|
export declare function buildPageManifestHref(slug: string): string;
|
|
229
229
|
|
|
230
|
+
/**
|
|
231
|
+
* Builds the request body for `POST /save-stream`. Stays on the legacy
|
|
232
|
+
* single-file shape (`{ path, content, message }`) when no additional files
|
|
233
|
+
* are provided, so existing callers are unaffected. Switches to the `files[]`
|
|
234
|
+
* bundle shape (primary path/content + additionalFiles) otherwise.
|
|
235
|
+
*/
|
|
236
|
+
export declare function buildSaveStreamRequestBody(input: StartCloudSaveStreamInput): Record<string, unknown>;
|
|
237
|
+
|
|
230
238
|
declare function buildSelectionPath(root: HTMLElement, sectionEl: HTMLElement): SelectionPath;
|
|
231
239
|
|
|
232
240
|
declare function buildSiteManifest({ pages, schemas, submissionSchemas, siteConfig, }: BuildSiteManifestInput): OlonJsSiteManifestIndex;
|
|
@@ -923,6 +931,11 @@ declare interface RuntimeResolutionResult {
|
|
|
923
931
|
collectionContext: CollectionResolutionContext | null;
|
|
924
932
|
}
|
|
925
933
|
|
|
934
|
+
declare interface SaveStreamBundleFile {
|
|
935
|
+
path: string;
|
|
936
|
+
content: unknown;
|
|
937
|
+
}
|
|
938
|
+
|
|
926
939
|
declare interface SaveStreamDoneEvent {
|
|
927
940
|
deployUrl?: string;
|
|
928
941
|
commitSha?: string;
|
|
@@ -1006,6 +1019,10 @@ declare interface StartCloudSaveStreamInput {
|
|
|
1006
1019
|
path: string;
|
|
1007
1020
|
content: unknown;
|
|
1008
1021
|
message?: string;
|
|
1022
|
+
/** Additional repo files committed atomically alongside the primary path/content (e.g. site.json, menu.json). */
|
|
1023
|
+
additionalFiles?: SaveStreamBundleFile[];
|
|
1024
|
+
/** Declares which global scopes changed, mirroring the server's ERR_*_CONFIG_REQUIRED validation. */
|
|
1025
|
+
changedScopes?: Array<'page' | 'site' | 'menu'>;
|
|
1009
1026
|
signal?: AbortSignal;
|
|
1010
1027
|
onStep: (event: SaveStreamStepEvent) => void;
|
|
1011
1028
|
onLog?: (event: SaveStreamLogEvent) => void;
|
|
@@ -683,7 +683,7 @@ function Se(e, t) {
|
|
|
683
683
|
const s = n.replace(/^\/+/, "");
|
|
684
684
|
return `${r}${s}`;
|
|
685
685
|
}
|
|
686
|
-
const dt = Oe({}),
|
|
686
|
+
const dt = Oe({}), zo = () => _e(dt);
|
|
687
687
|
class ir extends ot {
|
|
688
688
|
constructor(t) {
|
|
689
689
|
super(t), this.state = { hasError: !1, error: null };
|
|
@@ -4399,10 +4399,10 @@ function ko(e) {
|
|
|
4399
4399
|
/* @__PURE__ */ u.jsx(xe, { path: "*", element: /* @__PURE__ */ u.jsx(e.NotFoundComponent, {}) })
|
|
4400
4400
|
] });
|
|
4401
4401
|
}
|
|
4402
|
-
function
|
|
4402
|
+
function No({ config: e }) {
|
|
4403
4403
|
return /* @__PURE__ */ u.jsx(cr, { config: e, routesBuilder: ko });
|
|
4404
4404
|
}
|
|
4405
|
-
function
|
|
4405
|
+
function Io(e) {
|
|
4406
4406
|
const t = Rt(e.pages, e.slug);
|
|
4407
4407
|
if (!t) return null;
|
|
4408
4408
|
const o = at(
|
|
@@ -4431,7 +4431,7 @@ function No(e) {
|
|
|
4431
4431
|
collectionContext: r.collectionContext
|
|
4432
4432
|
};
|
|
4433
4433
|
}
|
|
4434
|
-
const jo = /\.(jpg|jpeg|png|gif|svg|pdf|webp|mp4|webm|ogg)$/i, So = /^[a-zA-Z][a-zA-Z\d+\-.]*:/, Co = (e) => So.test(e),
|
|
4434
|
+
const jo = /\.(jpg|jpeg|png|gif|svg|pdf|webp|mp4|webm|ogg)$/i, So = /^[a-zA-Z][a-zA-Z\d+\-.]*:/, Co = (e) => So.test(e), $o = (e, t = "default", o = "/") => {
|
|
4435
4435
|
const r = e.trim();
|
|
4436
4436
|
if (!r || Co(r) || r.startsWith("#"))
|
|
4437
4437
|
return r;
|
|
@@ -4441,7 +4441,7 @@ const jo = /\.(jpg|jpeg|png|gif|svg|pdf|webp|mp4|webm|ogg)$/i, So = /^[a-zA-Z][a
|
|
|
4441
4441
|
return Se(r.startsWith("/") ? r : `/${r}`, o);
|
|
4442
4442
|
const s = r.replace(/^\//, "");
|
|
4443
4443
|
return Se(`/assets/${t}/${s}`, o);
|
|
4444
|
-
},
|
|
4444
|
+
}, Mo = {
|
|
4445
4445
|
UPDATE_DRAFTS: "jsonpages:update-drafts",
|
|
4446
4446
|
SYNC_SELECTION: "jsonpages:sync-selection",
|
|
4447
4447
|
SECTION_SELECT: "jsonpages:section-select",
|
|
@@ -4453,30 +4453,41 @@ const jo = /\.(jpg|jpeg|png|gif|svg|pdf|webp|mp4|webm|ogg)$/i, So = /^[a-zA-Z][a
|
|
|
4453
4453
|
STAGE_READY: "jsonpages:stage-ready",
|
|
4454
4454
|
WEBMCP_TOOL_CALL: "olonjs:webmcp:tool-call",
|
|
4455
4455
|
WEBMCP_TOOL_RESULT: "olonjs:webmcp:tool-result"
|
|
4456
|
-
},
|
|
4456
|
+
}, Lo = I.object({
|
|
4457
4457
|
url: I.string(),
|
|
4458
4458
|
alt: I.string().optional()
|
|
4459
|
-
}).describe("ui:image-picker"),
|
|
4459
|
+
}).describe("ui:image-picker"), Do = I.object({
|
|
4460
4460
|
id: I.string().optional(),
|
|
4461
4461
|
anchorId: I.string().optional().describe("ui:text")
|
|
4462
|
-
}), Do = I.object({
|
|
4463
|
-
id: I.string().optional()
|
|
4464
4462
|
}), Fo = I.object({
|
|
4465
|
-
id: I.string()
|
|
4463
|
+
id: I.string().optional()
|
|
4466
4464
|
}), Wo = I.object({
|
|
4465
|
+
id: I.string()
|
|
4466
|
+
}), Bo = I.object({
|
|
4467
4467
|
paddingTop: I.enum(["none", "sm", "md", "lg", "xl", "2xl"]).default("md").describe("ui:select"),
|
|
4468
4468
|
paddingBottom: I.enum(["none", "sm", "md", "lg", "xl", "2xl"]).default("md").describe("ui:select"),
|
|
4469
4469
|
theme: I.enum(["dark", "light", "accent"]).default("dark").describe("ui:select"),
|
|
4470
4470
|
container: I.enum(["boxed", "fluid"]).default("boxed").describe("ui:select")
|
|
4471
|
-
}),
|
|
4471
|
+
}), Uo = I.object({
|
|
4472
4472
|
id: I.string().optional(),
|
|
4473
4473
|
label: I.string().describe("ui:text"),
|
|
4474
4474
|
href: I.string().describe("ui:text"),
|
|
4475
4475
|
variant: I.enum(["primary", "secondary", "accent"]).default("primary").describe("ui:select")
|
|
4476
|
-
}),
|
|
4476
|
+
}), Go = I.object({
|
|
4477
4477
|
recipientEmail: I.string().optional().describe("ui:text")
|
|
4478
4478
|
});
|
|
4479
4479
|
function Eo(e) {
|
|
4480
|
+
return e.additionalFiles && e.additionalFiles.length > 0 ? {
|
|
4481
|
+
files: [{ path: e.path, content: e.content }, ...e.additionalFiles],
|
|
4482
|
+
...e.changedScopes ? { changedScopes: e.changedScopes } : {},
|
|
4483
|
+
message: e.message
|
|
4484
|
+
} : {
|
|
4485
|
+
path: e.path,
|
|
4486
|
+
content: e.content,
|
|
4487
|
+
message: e.message
|
|
4488
|
+
};
|
|
4489
|
+
}
|
|
4490
|
+
function To(e) {
|
|
4480
4491
|
const t = e.split(`
|
|
4481
4492
|
`).map((n) => n.trimEnd()).filter((n) => n.length > 0);
|
|
4482
4493
|
if (t.length === 0) return null;
|
|
@@ -4492,7 +4503,7 @@ function Eo(e) {
|
|
|
4492
4503
|
return { event: o, data: r.join(`
|
|
4493
4504
|
`) };
|
|
4494
4505
|
}
|
|
4495
|
-
async function
|
|
4506
|
+
async function Vo(e) {
|
|
4496
4507
|
var a;
|
|
4497
4508
|
const t = await fetch(`${e.apiBaseUrl}/save-stream`, {
|
|
4498
4509
|
method: "POST",
|
|
@@ -4500,11 +4511,7 @@ async function Go(e) {
|
|
|
4500
4511
|
"Content-Type": "application/json",
|
|
4501
4512
|
Authorization: `Bearer ${e.apiKey}`
|
|
4502
4513
|
},
|
|
4503
|
-
body: JSON.stringify(
|
|
4504
|
-
path: e.path,
|
|
4505
|
-
content: e.content,
|
|
4506
|
-
message: e.message
|
|
4507
|
-
}),
|
|
4514
|
+
body: JSON.stringify(Eo(e)),
|
|
4508
4515
|
signal: e.signal
|
|
4509
4516
|
});
|
|
4510
4517
|
if (!t.ok || !t.body) {
|
|
@@ -4521,7 +4528,7 @@ async function Go(e) {
|
|
|
4521
4528
|
`);
|
|
4522
4529
|
n = l ? "" : d.pop() ?? "";
|
|
4523
4530
|
for (const g of d) {
|
|
4524
|
-
const h =
|
|
4531
|
+
const h = To(g);
|
|
4525
4532
|
if (h && h.data) {
|
|
4526
4533
|
if (h.event === "step") {
|
|
4527
4534
|
const b = JSON.parse(h.data);
|
|
@@ -4543,7 +4550,7 @@ async function Go(e) {
|
|
|
4543
4550
|
if (!s)
|
|
4544
4551
|
throw new Error("Cloud save stream ended before completion.");
|
|
4545
4552
|
}
|
|
4546
|
-
const
|
|
4553
|
+
const Jo = [
|
|
4547
4554
|
{
|
|
4548
4555
|
id: "commit",
|
|
4549
4556
|
label: "Commit",
|
|
@@ -4580,40 +4587,41 @@ const Vo = [
|
|
|
4580
4587
|
glyph: "✦",
|
|
4581
4588
|
duration: 1600
|
|
4582
4589
|
}
|
|
4583
|
-
],
|
|
4584
|
-
function
|
|
4585
|
-
return _e(
|
|
4590
|
+
], Ro = { status: "idle", message: "" }, Ao = Oe({});
|
|
4591
|
+
function Yo(e) {
|
|
4592
|
+
return _e(Ao)[e] ?? Ro;
|
|
4586
4593
|
}
|
|
4587
4594
|
export {
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4595
|
+
Fo as BaseArrayItem,
|
|
4596
|
+
Wo as BaseCollectionItem,
|
|
4597
|
+
Do as BaseSectionData,
|
|
4598
|
+
Bo as BaseSectionSettingsSchema,
|
|
4592
4599
|
rr as ConfigProvider,
|
|
4593
|
-
|
|
4594
|
-
|
|
4600
|
+
Uo as CtaSchema,
|
|
4601
|
+
Jo as DEPLOY_STEPS,
|
|
4595
4602
|
tr as DefaultNotFound,
|
|
4596
4603
|
dt as IconRegistryContext,
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4604
|
+
Lo as ImageSelectionSchema,
|
|
4605
|
+
Ao as OlonFormsContext,
|
|
4606
|
+
No as OlonJSEngine,
|
|
4600
4607
|
bo as PageRenderer,
|
|
4601
|
-
|
|
4608
|
+
Mo as STUDIO_EVENTS,
|
|
4602
4609
|
Te as SectionRenderer,
|
|
4603
4610
|
dr as StudioProvider,
|
|
4604
4611
|
yo as ThemeLoader,
|
|
4605
|
-
|
|
4612
|
+
Go as WithFormRecipient,
|
|
4613
|
+
Eo as buildSaveStreamRequestBody,
|
|
4606
4614
|
sr as buildThemeVariableMap,
|
|
4607
4615
|
Le as cn,
|
|
4608
4616
|
$e as normalizeBasePath,
|
|
4609
|
-
|
|
4610
|
-
|
|
4617
|
+
$o as resolveAssetUrl,
|
|
4618
|
+
Io as resolvePublicPageDocument,
|
|
4611
4619
|
De as resolveRuntimeConfig,
|
|
4612
|
-
|
|
4620
|
+
Vo as startCloudSaveStream,
|
|
4613
4621
|
ct as themeManager,
|
|
4614
4622
|
or as useConfig,
|
|
4615
|
-
|
|
4616
|
-
|
|
4623
|
+
Yo as useFormState,
|
|
4624
|
+
zo as useIconRegistry,
|
|
4617
4625
|
ur as useStudio,
|
|
4618
4626
|
Se as withBasePath
|
|
4619
4627
|
};
|