@open-slide/core 2.3.1 → 2.4.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.
- package/dist/{build-8lRsgsO4.js → build-D7GwYl8d.js} +1 -1
- package/dist/cli/bin.js +4 -4
- package/dist/{config-CDrYgaEj.d.ts → config-CfhtJxQH.d.ts} +1 -1
- package/dist/{config-D2Mq1vSW.js → config-D4uPk_tM.js} +383 -138
- package/dist/{dev-BvefEp1Q.js → dev-DyCDMbHB.js} +10 -10
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -1
- package/dist/locale/index.d.ts +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/{preview-D8ognobz.js → preview-DjIFvt0K.js} +1 -1
- package/dist/{types-DFK02XVv.d.ts → types-ZfArJF0d.d.ts} +21 -13
- package/dist/{update-BivdNgL3.js → update-BKhRM7o4.js} +30 -3
- package/dist/vite/index.d.ts +1 -1
- package/dist/vite/index.js +1 -1
- package/dist/{zh-tw-B1pkKQsc.js → zh-tw-D7LfGVmA.js} +220 -65
- package/package.json +5 -6
- package/src/agent/provider.ts +8 -1
- package/src/agent/types.ts +17 -2
- package/src/app/app.tsx +2 -0
- package/src/app/components/agent/agent-markdown.tsx +3 -6
- package/src/app/components/agent/agent-panel.tsx +36 -258
- package/src/app/components/agent/agent-presence.tsx +1 -1
- package/src/app/components/agent/composer.tsx +52 -24
- package/src/app/components/agent/effort-slider.tsx +172 -0
- package/src/app/components/agent/model-menu.tsx +170 -0
- package/src/app/components/agent/permission-menu.tsx +88 -0
- package/src/app/components/agent/transcript.tsx +23 -31
- package/src/app/components/command/home-command-menu.tsx +4 -1
- package/src/app/components/command/slide-command-menu.tsx +4 -1
- package/src/app/components/export-progress-toast.tsx +3 -1
- package/src/app/components/inspector/asset-picker-dialog.tsx +1 -1
- package/src/app/components/inspector/comment-layer.tsx +3 -3
- package/src/app/components/inspector/inline-text-editor.tsx +1 -12
- package/src/app/components/inspector/inspect-overlay.tsx +9 -1
- package/src/app/components/inspector/inspector-panel.tsx +8 -35
- package/src/app/components/inspector/inspector-provider.tsx +177 -36
- package/src/app/components/inspector/page-panel.tsx +270 -0
- package/src/app/components/language-toggle.tsx +13 -11
- package/src/app/components/note-markdown.test.tsx +12 -6
- package/src/app/components/note-markdown.tsx +16 -21
- package/src/app/components/overview-grid.tsx +3 -3
- package/src/app/components/panel/editor-sidebar.tsx +43 -8
- package/src/app/components/panel/panel-shell.tsx +9 -5
- package/src/app/components/panel/save-card.tsx +1 -1
- package/src/app/components/player.tsx +105 -23
- package/src/app/components/present/curtain.tsx +52 -0
- package/src/app/components/present/last-slide-hint.tsx +36 -0
- package/src/app/components/sidebar/folder-item.tsx +4 -1
- package/src/app/components/sidebar/sidebar.tsx +11 -8
- package/src/app/components/slide-canvas.tsx +1 -1
- package/src/app/components/style-panel/design-provider.tsx +48 -11
- package/src/app/components/style-panel/use-design.ts +6 -1
- package/src/app/components/theme-toggle.tsx +16 -22
- package/src/app/components/thumbnail-rail.tsx +69 -50
- package/src/app/components/ui/context-menu.tsx +9 -10
- package/src/app/components/ui/dialog.tsx +2 -4
- package/src/app/components/ui/dropdown-menu.tsx +9 -10
- package/src/app/components/ui/popover.tsx +1 -1
- package/src/app/components/ui/select.tsx +2 -2
- package/src/app/components/ui/sonner.tsx +2 -2
- package/src/app/index.html +7 -0
- package/src/app/lib/agent/use-agent.ts +131 -37
- package/src/app/lib/desktop-host.ts +31 -0
- package/src/app/lib/desktop-routes.test.ts +54 -0
- package/src/app/lib/desktop-routes.ts +22 -0
- package/src/app/lib/desktop.ts +106 -0
- package/src/app/lib/export-pdf.ts +15 -7
- package/src/app/lib/inspector/color.ts +51 -0
- package/src/app/lib/inspector/fiber.ts +6 -0
- package/src/app/lib/inspector/use-editor.ts +2 -1
- package/src/app/lib/inspector/use-notes.test.ts +209 -0
- package/src/app/lib/inspector/use-notes.ts +331 -57
- package/src/app/lib/inspector/use-visual-editor.ts +9 -1
- package/src/app/lib/locale-store.ts +14 -2
- package/src/app/lib/note-markdown.test.ts +69 -5
- package/src/app/lib/note-markdown.ts +97 -22
- package/src/app/lib/transition.test.ts +84 -1
- package/src/app/lib/transition.ts +43 -0
- package/src/app/lib/unsaved.test.ts +253 -0
- package/src/app/lib/unsaved.ts +155 -0
- package/src/app/routes/home.tsx +14 -6
- package/src/app/routes/slide.tsx +184 -130
- package/src/app/styles.css +421 -1
- package/src/locale/en.ts +41 -15
- package/src/locale/es.ts +41 -17
- package/src/locale/ja.ts +41 -15
- package/src/locale/types.ts +20 -14
- package/src/locale/zh-cn.ts +41 -14
- package/src/locale/zh-tw.ts +41 -14
|
@@ -1,18 +1,23 @@
|
|
|
1
|
+
import { H as isSupervised, U as listeningMessage, W as listeningPort, z as DEV_SUPERVISED_ENV } from "./update-BKhRM7o4.js";
|
|
1
2
|
import { a as printUrls, i as printShortcutsHint, n as formatError, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
-
import {
|
|
3
|
+
import { t as createViteConfig } from "./config-D4uPk_tM.js";
|
|
3
4
|
import path from "node:path";
|
|
4
5
|
import { existsSync } from "node:fs";
|
|
5
6
|
import { fork } from "node:child_process";
|
|
6
7
|
import { createServer, mergeConfig } from "vite";
|
|
7
8
|
//#region src/cli/dev.ts
|
|
8
9
|
async function dev(opts = {}) {
|
|
9
|
-
if (
|
|
10
|
+
if (isSupervised()) {
|
|
10
11
|
await startServer(opts);
|
|
11
12
|
return;
|
|
12
13
|
}
|
|
13
14
|
supervise(opts);
|
|
14
15
|
}
|
|
15
16
|
async function startServer(opts) {
|
|
17
|
+
let server;
|
|
18
|
+
process.once("disconnect", () => {
|
|
19
|
+
Promise.resolve(server?.close()).finally(() => process.exit(0));
|
|
20
|
+
});
|
|
16
21
|
const base = await createViteConfig({ userCwd: process.cwd() });
|
|
17
22
|
const config = mergeConfig(base, {
|
|
18
23
|
customLogger: createCliLogger(),
|
|
@@ -22,7 +27,7 @@ async function startServer(opts) {
|
|
|
22
27
|
...opts.open !== void 0 ? { open: opts.open } : {}
|
|
23
28
|
}
|
|
24
29
|
});
|
|
25
|
-
|
|
30
|
+
server = await createServer(config);
|
|
26
31
|
await server.listen();
|
|
27
32
|
printHeader(startupDuration());
|
|
28
33
|
printUrls(server.resolvedUrls, opts.host);
|
|
@@ -31,10 +36,7 @@ async function startServer(opts) {
|
|
|
31
36
|
server.bindCLIShortcuts({ customShortcuts: devShortcuts(opts) });
|
|
32
37
|
}
|
|
33
38
|
const address = server.httpServer?.address();
|
|
34
|
-
if (process.send && address && typeof address === "object") process.send(
|
|
35
|
-
type: "open-slide:listening",
|
|
36
|
-
port: address.port
|
|
37
|
-
});
|
|
39
|
+
if (process.send && address && typeof address === "object") process.send(listeningMessage(address.port));
|
|
38
40
|
}
|
|
39
41
|
function devShortcuts(opts) {
|
|
40
42
|
const showUrls = (server) => {
|
|
@@ -79,9 +81,7 @@ function supervise(opts) {
|
|
|
79
81
|
process.exit(1);
|
|
80
82
|
});
|
|
81
83
|
child.on("message", (message) => {
|
|
82
|
-
|
|
83
|
-
const { type, port: reportedPort } = message;
|
|
84
|
-
if (type === "open-slide:listening" && typeof reportedPort === "number") port = reportedPort;
|
|
84
|
+
port = listeningPort(message) ?? port;
|
|
85
85
|
});
|
|
86
86
|
child.on("exit", (code, signal) => {
|
|
87
87
|
if (shuttingDown) process.exit(0);
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as Plural, t as Locale } from "./types-
|
|
2
|
-
import { n as OpenSlideConfig, t as OpenSlideAgentConfig } from "./config-
|
|
1
|
+
import { n as Plural, t as Locale } from "./types-ZfArJF0d.js";
|
|
2
|
+
import { n as OpenSlideConfig, t as OpenSlideAgentConfig } from "./config-CfhtJxQH.js";
|
|
3
3
|
import { CSSProperties, ComponentType, HTMLAttributes, PropsWithChildren, ReactNode } from "react";
|
|
4
4
|
//#region src/app/components/image-placeholder.d.ts
|
|
5
5
|
type ImagePlaceholderProps = {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "./zh-tw-
|
|
1
|
+
import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "./zh-tw-D7LfGVmA.js";
|
|
2
2
|
import { n as defaultDesign, r as designToCssVars, t as cssVarsToString } from "./design-Cpqx7SJs.js";
|
|
3
3
|
import { Children, cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useLayoutEffect, useRef, useState, useSyncExternalStore } from "react";
|
|
4
4
|
import { toast } from "sonner";
|
|
@@ -111,6 +111,14 @@ function subscribe(listener) {
|
|
|
111
111
|
function getSnapshot() {
|
|
112
112
|
return current;
|
|
113
113
|
}
|
|
114
|
+
function apply(next) {
|
|
115
|
+
if (next === current) return;
|
|
116
|
+
current = next;
|
|
117
|
+
for (const listener of listeners) listener();
|
|
118
|
+
}
|
|
119
|
+
if (typeof window !== "undefined") window.addEventListener("storage", (e) => {
|
|
120
|
+
if (e.key === STORAGE_KEY || e.key === null) apply(readStored());
|
|
121
|
+
});
|
|
114
122
|
function useLocaleValue() {
|
|
115
123
|
return useSyncExternalStore(subscribe, getSnapshot, getSnapshot);
|
|
116
124
|
}
|
package/dist/locale/index.d.ts
CHANGED
package/dist/locale/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "../zh-tw-
|
|
1
|
+
import { a as en, i as es, n as zhCN, r as ja, t as zhTW } from "../zh-tw-D7LfGVmA.js";
|
|
2
2
|
//#region src/locale/format.ts
|
|
3
3
|
function format(template, vars) {
|
|
4
4
|
return template.replace(/\{(\w+)\}/g, (m, key) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as printUrls, i as printShortcutsHint, o as shortcutsEnabled, r as printHeader, s as startupDuration, t as createCliLogger } from "./cli/bin.js";
|
|
2
|
-
import { t as createViteConfig } from "./config-
|
|
2
|
+
import { t as createViteConfig } from "./config-D4uPk_tM.js";
|
|
3
3
|
import { mergeConfig, preview as preview$1 } from "vite";
|
|
4
4
|
//#region src/cli/preview.ts
|
|
5
5
|
async function preview(opts = {}) {
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
//#region src/agent/types.d.ts
|
|
2
2
|
declare const AGENT_EFFORTS: readonly ['minimal', 'low', 'medium', 'high', 'xhigh', 'max'];
|
|
3
3
|
type AgentEffort = (typeof AGENT_EFFORTS)[number];
|
|
4
|
+
declare const AGENT_PERMISSION_MODES: readonly ['supervised', 'acceptEdits', 'auto', 'fullAccess'];
|
|
5
|
+
type AgentPermissionMode = (typeof AGENT_PERMISSION_MODES)[number];
|
|
4
6
|
//#endregion
|
|
5
7
|
//#region src/locale/types.d.ts
|
|
6
8
|
type Plural = {
|
|
@@ -106,10 +108,6 @@ type Locale = {
|
|
|
106
108
|
resizeSidePanel: string;
|
|
107
109
|
home: string;
|
|
108
110
|
backToHome: string;
|
|
109
|
-
agentConnected: string;
|
|
110
|
-
agentConnectedTooltip: string;
|
|
111
|
-
agentDisconnected: string;
|
|
112
|
-
agentDisconnectedTooltip: string;
|
|
113
111
|
download: string;
|
|
114
112
|
copyLink: string;
|
|
115
113
|
moreActions: string;
|
|
@@ -181,6 +179,7 @@ type Locale = {
|
|
|
181
179
|
helpAria: string;
|
|
182
180
|
exitAria: string;
|
|
183
181
|
elapsedTime: string;
|
|
182
|
+
lastSlideHint: string;
|
|
184
183
|
helpEyebrow: string;
|
|
185
184
|
helpTitle: string;
|
|
186
185
|
shortcutNext: string;
|
|
@@ -206,7 +205,6 @@ type Locale = {
|
|
|
206
205
|
previewMode: string;
|
|
207
206
|
closeFormatPanel: string;
|
|
208
207
|
editText: string;
|
|
209
|
-
emptySelectionTitle: string;
|
|
210
208
|
emptySelectionHint: string;
|
|
211
209
|
textSelectionHint: string;
|
|
212
210
|
elementText: string;
|
|
@@ -216,6 +214,17 @@ type Locale = {
|
|
|
216
214
|
rotateHandle: string;
|
|
217
215
|
resizeHandle: string;
|
|
218
216
|
arrangeSection: string;
|
|
217
|
+
pageLabel: string;
|
|
218
|
+
pageBackground: string;
|
|
219
|
+
pageBackgroundTheme: string;
|
|
220
|
+
pageBackgroundShared: string;
|
|
221
|
+
pageBackgroundComplex: string;
|
|
222
|
+
pageTransition: string;
|
|
223
|
+
pageTransitionInherited: string;
|
|
224
|
+
pageSteps: string;
|
|
225
|
+
pageStepsCount: Plural;
|
|
226
|
+
pageNone: string;
|
|
227
|
+
transitionKinds: Record<'fade' | 'slide' | 'zoom' | 'wipe' | 'morph' | 'custom', string>;
|
|
219
228
|
selectionCount: string;
|
|
220
229
|
positionLabel: string;
|
|
221
230
|
positionX: string;
|
|
@@ -481,6 +490,7 @@ type Locale = {
|
|
|
481
490
|
/** template: "Processing page {current} of {total}" */
|
|
482
491
|
processing: string;
|
|
483
492
|
printing: string;
|
|
493
|
+
saving: string;
|
|
484
494
|
done: string;
|
|
485
495
|
};
|
|
486
496
|
pptxToast: {
|
|
@@ -567,9 +577,6 @@ type Locale = {
|
|
|
567
577
|
};
|
|
568
578
|
agent: {
|
|
569
579
|
title: string;
|
|
570
|
-
beta: string;
|
|
571
|
-
betaTitle: string;
|
|
572
|
-
betaHint: string;
|
|
573
580
|
open: string;
|
|
574
581
|
openTitle: string;
|
|
575
582
|
close: string;
|
|
@@ -616,12 +623,11 @@ type Locale = {
|
|
|
616
623
|
deny: string;
|
|
617
624
|
allowed: string;
|
|
618
625
|
denied: string;
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
626
|
+
permissionMode: string;
|
|
627
|
+
permissionModes: Record<AgentPermissionMode, string>;
|
|
628
|
+
permissionHints: Record<AgentPermissionMode, string>;
|
|
629
|
+
permissionHintsCodex: Record<AgentPermissionMode, string>;
|
|
623
630
|
/** template: "{seconds}s" */
|
|
624
|
-
resultSeconds: string;
|
|
625
631
|
errorEyebrow: string;
|
|
626
632
|
statusLoading: string;
|
|
627
633
|
disabled: string;
|
|
@@ -664,6 +670,8 @@ type Locale = {
|
|
|
664
670
|
modelDefault: string;
|
|
665
671
|
reasoning: string;
|
|
666
672
|
effortAuto: string;
|
|
673
|
+
effortFaster: string;
|
|
674
|
+
effortSmarter: string;
|
|
667
675
|
efforts: Record<AgentEffort, string>;
|
|
668
676
|
/** template: "{provider} is editing" */
|
|
669
677
|
presenceEditing: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
2
|
import { spawn } from "node:child_process";
|
|
3
3
|
import fs from "node:fs/promises";
|
|
4
|
+
import { createHash, randomUUID } from "node:crypto";
|
|
4
5
|
import { parse } from "@babel/parser";
|
|
5
|
-
import { randomUUID } from "node:crypto";
|
|
6
6
|
//#region src/http/request-guard.ts
|
|
7
7
|
function headerValue(req, name) {
|
|
8
8
|
const raw = req.headers[name.toLowerCase()];
|
|
@@ -70,6 +70,27 @@ function isLoopbackRequest(req) {
|
|
|
70
70
|
return address === "::1" || address.startsWith("127.") || address.startsWith("::ffff:127.");
|
|
71
71
|
}
|
|
72
72
|
//#endregion
|
|
73
|
+
//#region src/supervision.ts
|
|
74
|
+
const DEV_SUPERVISED_ENV = "OPEN_SLIDE_DEV_SUPERVISED";
|
|
75
|
+
const MANAGED_CORE_ENV = "OPEN_SLIDE_MANAGED_CORE";
|
|
76
|
+
const CACHE_DIR_ENV = "OPEN_SLIDE_CACHE_DIR";
|
|
77
|
+
const AGENT_MODULES_ENV = "OPEN_SLIDE_AGENT_MODULES";
|
|
78
|
+
const SHUTDOWN_GRACE_MS = 3e3;
|
|
79
|
+
const isSupervised = () => process.env[DEV_SUPERVISED_ENV] === "1";
|
|
80
|
+
const isManagedCore = () => process.env[MANAGED_CORE_ENV] === "1";
|
|
81
|
+
const LISTENING_TYPE = "open-slide:listening";
|
|
82
|
+
function listeningMessage(port) {
|
|
83
|
+
return {
|
|
84
|
+
type: LISTENING_TYPE,
|
|
85
|
+
port
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
function listeningPort(message) {
|
|
89
|
+
if (typeof message !== "object" || message === null) return null;
|
|
90
|
+
const { type, port } = message;
|
|
91
|
+
return type === LISTENING_TYPE && typeof port === "number" ? port : null;
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
73
94
|
//#region src/editing/slide-ops.ts
|
|
74
95
|
const SLIDE_ID_RE = /^[a-z0-9_-]+$/i;
|
|
75
96
|
/**
|
|
@@ -463,6 +484,11 @@ function findDefaultExportArray(source) {
|
|
|
463
484
|
}
|
|
464
485
|
return null;
|
|
465
486
|
}
|
|
487
|
+
function pageLayoutOfSource(source) {
|
|
488
|
+
const found = findDefaultExportArray(source);
|
|
489
|
+
const pages = found ? found.elements.map((el) => source.slice(el.start, el.end)) : null;
|
|
490
|
+
return createHash("sha1").update(JSON.stringify(pages)).digest("hex").slice(0, 16);
|
|
491
|
+
}
|
|
466
492
|
/**
|
|
467
493
|
* Rewrite `export default [...]` so its elements appear in the requested order.
|
|
468
494
|
*
|
|
@@ -999,7 +1025,7 @@ async function updatePackage(ctx) {
|
|
|
999
1025
|
function registerUpdateRoutes(server, ctx) {
|
|
1000
1026
|
server.middlewares.use("/__update-check", async (req, res, next) => {
|
|
1001
1027
|
if ((req.method ?? "GET") !== "GET") return next();
|
|
1002
|
-
const latest = await fetchLatest(Date.now());
|
|
1028
|
+
const latest = isManagedCore() ? null : await fetchLatest(Date.now());
|
|
1003
1029
|
const result = {
|
|
1004
1030
|
current: ctx.coreVersion,
|
|
1005
1031
|
latest,
|
|
@@ -1012,6 +1038,7 @@ function registerUpdateRoutes(server, ctx) {
|
|
|
1012
1038
|
if ((req.method ?? "GET") !== "POST") return next();
|
|
1013
1039
|
const guard = validateMutationRequest(req);
|
|
1014
1040
|
if (!guard.ok) return json(res, guard.status, { error: guard.error });
|
|
1041
|
+
if (isManagedCore()) return json(res, 409, { error: "open-slide is updated by the app that runs it." });
|
|
1015
1042
|
try {
|
|
1016
1043
|
updateInFlight ??= updatePackage(ctx).finally(() => {
|
|
1017
1044
|
updateInFlight = null;
|
|
@@ -1023,4 +1050,4 @@ function registerUpdateRoutes(server, ctx) {
|
|
|
1023
1050
|
});
|
|
1024
1051
|
}
|
|
1025
1052
|
//#endregion
|
|
1026
|
-
export {
|
|
1053
|
+
export { reorderDefaultExportPagesInSource as A, SHUTDOWN_GRACE_MS as B, duplicatePageInDefaultExportInSource as C, removeNotesElementInSource as D, readMetaTitleInSource as E, updateMetaTitleInSource as F, isLoopbackRequest as G, isSupervised as H, validateSlideName as I, validateMutationRequest as K, AGENT_MODULES_ENV as L, resolveSlideEntry as M, rmSlideDir as N, removePageFromDefaultExportInSource as O, slugifyTitle as P, CACHE_DIR_ENV as R, duplicateNotesElementInSource as S, pageLayoutOfSource as T, listeningMessage as U, isManagedCore as V, listeningPort as W, writeManifest as _, json as a, SLIDE_ID_RE as b, readSlideSource as c, foldersManifestPath as d, newFolderId as f, validateReorder as g, validateName as h, BodyTooLargeError as i, reorderNotesArrayInSource as j, renameSlideDir as k, resolveSlideEntryPath as l, validateIcon as m, registerUpdateRoutes as n, makeContext as o, readManifest as p, runCommand as r, readBody as s, detectPackageManager as t, FOLDER_ID_RE as u, shortId as v, duplicateSlideDir as w, createBlankSlideDir as x, BLANK_SLIDE_TITLE as y, DEV_SUPERVISED_ENV as z };
|
package/dist/vite/index.d.ts
CHANGED
package/dist/vite/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as createViteConfig } from "../config-
|
|
1
|
+
import { t as createViteConfig } from "../config-D4uPk_tM.js";
|
|
2
2
|
export { createViteConfig };
|