@alpaca-editor/core 1.0.4073 → 1.0.4074
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/editor/Editor.js +3 -3
- package/dist/editor/Editor.js.map +1 -1
- package/dist/editor/client/{EditorClient.d.ts → EditorShell.d.ts} +1 -19
- package/dist/editor/client/{EditorClient.js → EditorShell.js} +55 -572
- package/dist/editor/client/EditorShell.js.map +1 -0
- package/dist/editor/client/editContext.d.ts +2 -1
- package/dist/editor/client/hooks/useEditorUrlSync.d.ts +18 -0
- package/dist/editor/client/hooks/useEditorUrlSync.js +56 -0
- package/dist/editor/client/hooks/useEditorUrlSync.js.map +1 -0
- package/dist/editor/client/hooks/useEditorWebSocket.d.ts +11 -0
- package/dist/editor/client/hooks/useEditorWebSocket.js +70 -0
- package/dist/editor/client/hooks/useEditorWebSocket.js.map +1 -0
- package/dist/editor/client/hooks/useGlobalEditorEvents.d.ts +4 -0
- package/dist/editor/client/hooks/useGlobalEditorEvents.js +15 -0
- package/dist/editor/client/hooks/useGlobalEditorEvents.js.map +1 -0
- package/dist/editor/client/hooks/useMediaQuery.d.ts +1 -0
- package/dist/editor/client/hooks/useMediaQuery.js +19 -0
- package/dist/editor/client/hooks/useMediaQuery.js.map +1 -0
- package/dist/editor/client/hooks/useMediaSelector.d.ts +12 -0
- package/dist/editor/client/hooks/useMediaSelector.js +30 -0
- package/dist/editor/client/hooks/useMediaSelector.js.map +1 -0
- package/dist/editor/client/hooks/useQuota.d.ts +29 -0
- package/dist/editor/client/hooks/useQuota.js +53 -0
- package/dist/editor/client/hooks/useQuota.js.map +1 -0
- package/dist/editor/client/hooks/useSocketMessageHandler.d.ts +34 -0
- package/dist/editor/client/hooks/useSocketMessageHandler.js +191 -0
- package/dist/editor/client/hooks/useSocketMessageHandler.js.map +1 -0
- package/dist/editor/client/hooks/useWorkbox.d.ts +9 -0
- package/dist/editor/client/hooks/useWorkbox.js +53 -0
- package/dist/editor/client/hooks/useWorkbox.js.map +1 -0
- package/dist/editor/client/ui/EditorChrome.d.ts +12 -0
- package/dist/editor/client/ui/EditorChrome.js +23 -0
- package/dist/editor/client/ui/EditorChrome.js.map +1 -0
- package/dist/editor/client/ui/FullscreenControls.d.ts +7 -0
- package/dist/editor/client/ui/FullscreenControls.js +21 -0
- package/dist/editor/client/ui/FullscreenControls.js.map +1 -0
- package/dist/editor/control-center/WebSocketMessages.js.map +1 -1
- package/dist/editor/page-editor-chrome/FieldActionIndicator.d.ts +1 -1
- package/dist/revision.d.ts +2 -2
- package/dist/revision.js +2 -2
- package/package.json +1 -1
- package/src/editor/Editor.tsx +14 -5
- package/src/editor/client/{EditorClient.tsx → EditorShell.tsx} +78 -789
- package/src/editor/client/editContext.ts +3 -3
- package/src/editor/client/hooks/useEditorUrlSync.ts +83 -0
- package/src/editor/client/hooks/useEditorWebSocket.ts +101 -0
- package/src/editor/client/hooks/useGlobalEditorEvents.ts +18 -0
- package/src/editor/client/hooks/useMediaQuery.ts +21 -0
- package/src/editor/client/hooks/useMediaSelector.ts +48 -0
- package/src/editor/client/hooks/useQuota.ts +81 -0
- package/src/editor/client/hooks/useSocketMessageHandler.ts +285 -0
- package/src/editor/client/hooks/useWorkbox.ts +67 -0
- package/src/editor/client/ui/EditorChrome.tsx +76 -0
- package/src/editor/client/ui/FullscreenControls.tsx +58 -0
- package/src/editor/control-center/WebSocketMessages.tsx +1 -2
- package/src/editor/page-editor-chrome/FieldActionIndicator.tsx +1 -1
- package/src/revision.ts +2 -2
- package/dist/editor/client/EditorClient.js.map +0 -1
package/dist/editor/Editor.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { EditorShell } from "./client/EditorShell";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
5
|
import { getUserInfo } from "./services/editService";
|
|
6
|
-
import { getSystemStatus, getEditorSettings, saveUserPreferences } from "./services/systemService";
|
|
6
|
+
import { getSystemStatus, getEditorSettings, saveUserPreferences, } from "./services/systemService";
|
|
7
7
|
import uuid from "react-uuid";
|
|
8
8
|
import { getConfiguration } from "../config/config";
|
|
9
9
|
export function Editor({ configure, className, page, children, }) {
|
|
@@ -50,7 +50,7 @@ export function Editor({ configure, className, page, children, }) {
|
|
|
50
50
|
}
|
|
51
51
|
if (!config)
|
|
52
52
|
return null;
|
|
53
|
-
return (_jsx(
|
|
53
|
+
return (_jsx(EditorShell, { configuration: config, className: className, item: page, sessionId: sessionId, userInfo: userInfo, userPreferences: userInfo.preferences, editorSettings: editorSettings, setUserPreferences: (preferences) => {
|
|
54
54
|
const newPreferences = { ...userInfo.preferences, ...preferences };
|
|
55
55
|
saveUserPreferences(newPreferences);
|
|
56
56
|
setUserInfo({ ...userInfo, preferences: newPreferences });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../src/editor/Editor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"Editor.js","sourceRoot":"","sources":["../../src/editor/Editor.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAQ5C,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,0BAA0B,CAAC;AAClC,OAAO,IAAI,MAAM,YAAY,CAAC;AAC9B,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,UAAU,MAAM,CAAC,EACrB,SAAS,EACT,SAAS,EACT,IAAI,EACJ,QAAQ,GAST;IACC,MAAM,CAAC,MAAM,EAA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CAAC;AACJ,CAAC"}
|
|
@@ -19,24 +19,6 @@ export type InsertingState = {
|
|
|
19
19
|
positionElement: Element;
|
|
20
20
|
positionAnchor: "left" | "right" | "top" | "bottom";
|
|
21
21
|
};
|
|
22
|
-
export type QuotaUsage = {
|
|
23
|
-
totalTokens: number;
|
|
24
|
-
totalImages: number;
|
|
25
|
-
dailyTokens: number;
|
|
26
|
-
dailyImages: number;
|
|
27
|
-
};
|
|
28
|
-
export type QuotaLimits = {
|
|
29
|
-
totalTokens: number;
|
|
30
|
-
dailyTokens: number;
|
|
31
|
-
monthlyTokens: number;
|
|
32
|
-
totalImages: number;
|
|
33
|
-
dailyImages: number;
|
|
34
|
-
monthlyImages: number;
|
|
35
|
-
};
|
|
36
|
-
export type QuotaInfo = {
|
|
37
|
-
usage: QuotaUsage;
|
|
38
|
-
limits: QuotaLimits;
|
|
39
|
-
};
|
|
40
22
|
export type WebSocketMessage = {
|
|
41
23
|
id: string;
|
|
42
24
|
timestamp: string;
|
|
@@ -44,7 +26,7 @@ export type WebSocketMessage = {
|
|
|
44
26
|
payload: any;
|
|
45
27
|
rawMessage: string;
|
|
46
28
|
};
|
|
47
|
-
export declare function
|
|
29
|
+
export declare function EditorShell({ configuration, className, item: loadItemDescriptor, sessionId, userInfo, userPreferences, editorSettings, setUserPreferences, children, }: {
|
|
48
30
|
configuration: EditorConfiguration;
|
|
49
31
|
className?: string;
|
|
50
32
|
item?: ItemDescriptor;
|