@promptbook/components 0.112.0-104 → 0.112.0-106
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/esm/index.es.js +49 -23
- package/esm/index.es.js.map +1 -1
- package/esm/src/book-components/BookEditor/BookEditor.d.ts +5 -4
- package/esm/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
- package/esm/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
- package/esm/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
- package/esm/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +6 -0
- package/esm/src/version.d.ts +1 -1
- package/package.json +1 -1
- package/umd/index.umd.js +49 -23
- package/umd/index.umd.js.map +1 -1
- package/umd/src/book-components/BookEditor/BookEditor.d.ts +5 -4
- package/umd/src/book-components/BookEditor/BookEditorTheme.d.ts +24 -0
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLanguage.d.ts +1 -6
- package/umd/src/book-components/BookEditor/useBookEditorMonacoLifecycle.d.ts +1 -4
- package/umd/src/book-components/BookEditor/useBookEditorMonacoStyles.d.ts +2 -1
- package/umd/src/cli/cli-commands/agent-folder/agentProjectPaths.d.ts +6 -0
- package/umd/src/version.d.ts +1 -1
package/esm/index.es.js
CHANGED
|
@@ -42,7 +42,7 @@ const BOOK_LANGUAGE_VERSION = '2.0.0';
|
|
|
42
42
|
* @generated
|
|
43
43
|
* @see https://github.com/webgptorg/promptbook
|
|
44
44
|
*/
|
|
45
|
-
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-
|
|
45
|
+
const PROMPTBOOK_ENGINE_VERSION = '0.112.0-106';
|
|
46
46
|
/**
|
|
47
47
|
* TODO: string_promptbook_version should be constrained to the all versions of Promptbook engine
|
|
48
48
|
* Note: [💞] Ignore a discrepancy between file name and entity name
|
|
@@ -5561,10 +5561,7 @@ function sampleContinuousOctopusSurfacePoint(options, latitude, longitude) {
|
|
|
5561
5561
|
Math.max(0, Math.cos(effectiveLongitude)) * 0.1 +
|
|
5562
5562
|
lowerBlend * tentacleInfluence.core * (0.1 + tentacleInfluence.depthScale * 0.06) -
|
|
5563
5563
|
Math.max(0, -Math.cos(effectiveLongitude)) * 0.05;
|
|
5564
|
-
const tentacleTubeRadius = lowerBlend *
|
|
5565
|
-
tentacleInfluence.core *
|
|
5566
|
-
(0.11 + tipBlend * 0.06 + tentacleInfluence.widthScale * 0.025) *
|
|
5567
|
-
radiusX;
|
|
5564
|
+
const tentacleTubeRadius = lowerBlend * tentacleInfluence.core * (0.11 + tipBlend * 0.06 + tentacleInfluence.widthScale * 0.025) * radiusX;
|
|
5568
5565
|
const planarRadiusX = cosineLatitude * radiusX * horizontalScale + tentacleTubeRadius;
|
|
5569
5566
|
const planarRadiusZ = cosineLatitude * radiusZ * depthScale + tentacleTubeRadius * 0.72;
|
|
5570
5567
|
const lowerDrop = lowerBlend *
|
|
@@ -5575,8 +5572,7 @@ function sampleContinuousOctopusSurfacePoint(options, latitude, longitude) {
|
|
|
5575
5572
|
tentacleInfluence.lengthScale * 0.22 +
|
|
5576
5573
|
(morphologyProfile.tentacles.flowLengthScale - 1) * 0.08));
|
|
5577
5574
|
return {
|
|
5578
|
-
x: Math.sin(effectiveLongitude) * planarRadiusX +
|
|
5579
|
-
tentacleWave * radiusX * (0.052 + tipBlend * 0.05),
|
|
5575
|
+
x: Math.sin(effectiveLongitude) * planarRadiusX + tentacleWave * radiusX * (0.052 + tipBlend * 0.05),
|
|
5580
5576
|
y: Math.sin(latitude) * radiusY * (1 + upperBlend * 0.12) -
|
|
5581
5577
|
upperBlend * radiusY * 0.1 +
|
|
5582
5578
|
lowerDrop +
|
|
@@ -5650,8 +5646,11 @@ function resolveContinuousTentacleInfluence(options, longitude) {
|
|
|
5650
5646
|
*/
|
|
5651
5647
|
function resolveContinuousLobeWave(options, longitude) {
|
|
5652
5648
|
const { morphologyProfile, animationPhase, timeMs } = options;
|
|
5653
|
-
return (Math.cos(longitude * OCTOPUS_TENTACLE_COUNT +
|
|
5654
|
-
|
|
5649
|
+
return ((Math.cos(longitude * OCTOPUS_TENTACLE_COUNT +
|
|
5650
|
+
animationPhase +
|
|
5651
|
+
timeMs / (980 + morphologyProfile.body.lobeCount * 18)) +
|
|
5652
|
+
1) /
|
|
5653
|
+
2);
|
|
5655
5654
|
}
|
|
5656
5655
|
/**
|
|
5657
5656
|
* Resolves one base fill tone for a patch on the continuous octopus mesh.
|
|
@@ -5715,8 +5714,7 @@ function drawProjectedSurfaceCurrents(options) {
|
|
|
5715
5714
|
for (let sampleIndex = 0; sampleIndex < 8; sampleIndex++) {
|
|
5716
5715
|
const progress = sampleIndex / 7;
|
|
5717
5716
|
const latitude = -0.46 + progress * 0.74;
|
|
5718
|
-
const longitude = baseLongitude +
|
|
5719
|
-
Math.sin(timeMs / 1160 + animationPhase + currentIndex * 0.7 + progress * 2) * 0.035;
|
|
5717
|
+
const longitude = baseLongitude + Math.sin(timeMs / 1160 + animationPhase + currentIndex * 0.7 + progress * 2) * 0.035;
|
|
5720
5718
|
const scenePoint = transformScenePoint(sampleContinuousOctopusSurfacePoint(surfaceOptions, latitude, longitude), center, rotationX, rotationY);
|
|
5721
5719
|
if (scenePoint.z > center.z - size * 0.016) {
|
|
5722
5720
|
projectedPoints.push(projectScenePoint(scenePoint, size, sceneCenterX, sceneCenterY));
|
|
@@ -23391,6 +23389,30 @@ const BookEditorMonacoConstants = {
|
|
|
23391
23389
|
DIAGNOSTIC_MARKER_OWNER: 'book-editor-diagnostics',
|
|
23392
23390
|
};
|
|
23393
23391
|
|
|
23392
|
+
/**
|
|
23393
|
+
* Theme used for the actual notebook editor surface.
|
|
23394
|
+
*
|
|
23395
|
+
* The host application can still pass its resolved app theme, but book sources
|
|
23396
|
+
* are intentionally rendered as light paper in both light and dark app modes.
|
|
23397
|
+
*
|
|
23398
|
+
* @private internal constant of `BookEditor`
|
|
23399
|
+
*/
|
|
23400
|
+
const BOOK_EDITOR_RENDER_THEME = 'LIGHT';
|
|
23401
|
+
/**
|
|
23402
|
+
* Resolves an app-level theme into the visual theme used by `<BookEditor/>`.
|
|
23403
|
+
*
|
|
23404
|
+
* @param hostTheme - Resolved theme from the embedding application.
|
|
23405
|
+
* @returns Light theme used by the Book editor surface.
|
|
23406
|
+
*
|
|
23407
|
+
* @private internal utility of `BookEditor`
|
|
23408
|
+
*/
|
|
23409
|
+
function resolveBookEditorRenderTheme(hostTheme = BOOK_EDITOR_RENDER_THEME) {
|
|
23410
|
+
if (hostTheme === 'DARK') {
|
|
23411
|
+
return BOOK_EDITOR_RENDER_THEME;
|
|
23412
|
+
}
|
|
23413
|
+
return hostTheme;
|
|
23414
|
+
}
|
|
23415
|
+
|
|
23394
23416
|
/**
|
|
23395
23417
|
* Gets a commitment definition by its type
|
|
23396
23418
|
*
|
|
@@ -24400,19 +24422,20 @@ function createNoteLikeBodyRules(token, commitmentTransitionRules) {
|
|
|
24400
24422
|
*
|
|
24401
24423
|
* @private function of BookEditorMonaco
|
|
24402
24424
|
*/
|
|
24403
|
-
function ensureBookEditorMonacoLanguage(monaco, theme =
|
|
24425
|
+
function ensureBookEditorMonacoLanguage(monaco, theme = BOOK_EDITOR_RENDER_THEME) {
|
|
24426
|
+
const renderedTheme = resolveBookEditorRenderTheme(theme);
|
|
24404
24427
|
const monacoWithLanguageState = monaco;
|
|
24405
24428
|
if (monacoWithLanguageState[BOOK_EDITOR_LANGUAGE_INITIALIZED_FLAG]) {
|
|
24406
|
-
if (monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] !==
|
|
24407
|
-
applyBookEditorMonacoTheme(monaco,
|
|
24408
|
-
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] =
|
|
24429
|
+
if (monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] !== renderedTheme) {
|
|
24430
|
+
applyBookEditorMonacoTheme(monaco, renderedTheme);
|
|
24431
|
+
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = renderedTheme;
|
|
24409
24432
|
return;
|
|
24410
24433
|
}
|
|
24411
24434
|
monaco.editor.setTheme(BookEditorMonacoConstants.BOOK_THEME_ID);
|
|
24412
24435
|
return;
|
|
24413
24436
|
}
|
|
24414
24437
|
monacoWithLanguageState[BOOK_EDITOR_LANGUAGE_INITIALIZED_FLAG] = true;
|
|
24415
|
-
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] =
|
|
24438
|
+
monacoWithLanguageState[BOOK_EDITOR_THEME_MODE_FLAG] = renderedTheme;
|
|
24416
24439
|
monaco.languages.register({ id: BookEditorMonacoConstants.BOOK_LANGUAGE_ID });
|
|
24417
24440
|
const commitmentDefinitions = getAllCommitmentDefinitions();
|
|
24418
24441
|
const commitmentTypes = [...new Set(commitmentDefinitions.map(({ type }) => type))];
|
|
@@ -24522,7 +24545,7 @@ function ensureBookEditorMonacoLanguage(monaco, theme = 'LIGHT') {
|
|
|
24522
24545
|
return { links };
|
|
24523
24546
|
},
|
|
24524
24547
|
});
|
|
24525
|
-
applyBookEditorMonacoTheme(monaco,
|
|
24548
|
+
applyBookEditorMonacoTheme(monaco, renderedTheme);
|
|
24526
24549
|
}
|
|
24527
24550
|
/**
|
|
24528
24551
|
* Ensures the mounted Monaco editor model uses Book language and Book theme.
|
|
@@ -24535,8 +24558,9 @@ function ensureBookEditorMonacoLanguage(monaco, theme = 'LIGHT') {
|
|
|
24535
24558
|
* @private function of BookEditorMonaco
|
|
24536
24559
|
*/
|
|
24537
24560
|
function ensureBookEditorMonacoLanguageForEditor(props) {
|
|
24538
|
-
const { monaco, monacoEditor, theme =
|
|
24539
|
-
|
|
24561
|
+
const { monaco, monacoEditor, theme = BOOK_EDITOR_RENDER_THEME } = props;
|
|
24562
|
+
const renderedTheme = resolveBookEditorRenderTheme(theme);
|
|
24563
|
+
ensureBookEditorMonacoLanguage(monaco, renderedTheme);
|
|
24540
24564
|
const model = monacoEditor.getModel();
|
|
24541
24565
|
if (!model) {
|
|
24542
24566
|
return;
|
|
@@ -25768,7 +25792,8 @@ function createBookEditorMonacoOptions({ isReadonly, translations, scaledFontSiz
|
|
|
25768
25792
|
* @private Internal component used by `BookEditor`
|
|
25769
25793
|
*/
|
|
25770
25794
|
function BookEditorMonaco(props) {
|
|
25771
|
-
const { value, onChange, diagnostics, isReadonly, theme =
|
|
25795
|
+
const { value, onChange, diagnostics, isReadonly, theme: hostTheme = BOOK_EDITOR_RENDER_THEME, translations, onFileUpload, isUploadButtonShown, isCameraButtonShown, isDownloadButtonShown, isAboutButtonShown = true, isFullscreenButtonShown = true, onFullscreenClick, isFullscreen, zoom = 1, monacoModelPath, hoistedMenuItems, } = props;
|
|
25796
|
+
const theme = resolveBookEditorRenderTheme(hostTheme);
|
|
25772
25797
|
const zoomLevel = zoom;
|
|
25773
25798
|
const { scaledLineHeight, scaledContentPaddingLeft, scaledVerticalLineLeft, scaledFontSize, scaledScrollbarSize } = createBookEditorMonacoScale(zoomLevel);
|
|
25774
25799
|
const monaco = useMonaco();
|
|
@@ -25857,15 +25882,16 @@ const DEFAULT_BOOK_EDITOR_HEIGHT = countLines(DEFAULT_BOOK) * 30 + 20;
|
|
|
25857
25882
|
* @public exported from `@promptbook/components`
|
|
25858
25883
|
*/
|
|
25859
25884
|
function BookEditor(props) {
|
|
25860
|
-
const { agentSource, className, style, theme =
|
|
25885
|
+
const { agentSource, className, style, theme: hostTheme = BOOK_EDITOR_RENDER_THEME, zoom = 1, value, onChange, diagnostics, onFileUpload, isVerbose = DEFAULT_IS_VERBOSE, isBorderRadiusDisabled = false, isReadonly = false, translations, isUploadButtonShown = true, isCameraButtonShown, isDownloadButtonShown = true, isAboutButtonShown = true, isFullscreenButtonShown = true, sync, monacoModelPath, hoistedMenuItems, } = props;
|
|
25861
25886
|
const [isFullscreen, setIsFullscreen] = useState(false);
|
|
25887
|
+
const renderedTheme = resolveBookEditorRenderTheme(hostTheme);
|
|
25862
25888
|
/**
|
|
25863
25889
|
* Toggles fullscreen mode for the editor.
|
|
25864
25890
|
*/
|
|
25865
25891
|
const handleFullscreenToggle = () => {
|
|
25866
25892
|
setIsFullscreen(!isFullscreen);
|
|
25867
25893
|
};
|
|
25868
|
-
const editorContent = (jsx("div", { "data-book-component": "BookEditor", "data-book-editor-theme":
|
|
25894
|
+
const editorContent = (jsx("div", { "data-book-component": "BookEditor", "data-book-editor-theme": renderedTheme.toLowerCase(), className: classNames(styles$d.BookEditor, isVerbose && styles$d.isVerbose, styles$d.bookEditorWrapper, isBorderRadiusDisabled && styles$d.isBorderRadiusDisabled, isFullscreen && styles$d.fullscreen, className), style: isFullscreen
|
|
25869
25895
|
? style
|
|
25870
25896
|
: {
|
|
25871
25897
|
...(style || {}),
|
|
@@ -25876,7 +25902,7 @@ function BookEditor(props) {
|
|
|
25876
25902
|
? `${props.height}px`
|
|
25877
25903
|
: props.height || `${DEFAULT_BOOK_EDITOR_HEIGHT}px`,
|
|
25878
25904
|
}),
|
|
25879
|
-
}, children: jsx(BookEditorMonaco, { value: agentSource || value, onChange: onChange, diagnostics: diagnostics, onFileUpload: onFileUpload, isVerbose: isVerbose, isBorderRadiusDisabled: isBorderRadiusDisabled, isReadonly: isReadonly, translations: translations, isUploadButtonShown: isUploadButtonShown, isCameraButtonShown: isCameraButtonShown, isDownloadButtonShown: isDownloadButtonShown, isAboutButtonShown: isAboutButtonShown, isFullscreenButtonShown: isFullscreenButtonShown, onFullscreenClick: handleFullscreenToggle, isFullscreen: isFullscreen, sync: sync, zoom: zoom, monacoModelPath: monacoModelPath, hoistedMenuItems: hoistedMenuItems, theme:
|
|
25905
|
+
}, children: jsx(BookEditorMonaco, { value: agentSource || value, onChange: onChange, diagnostics: diagnostics, onFileUpload: onFileUpload, isVerbose: isVerbose, isBorderRadiusDisabled: isBorderRadiusDisabled, isReadonly: isReadonly, translations: translations, isUploadButtonShown: isUploadButtonShown, isCameraButtonShown: isCameraButtonShown, isDownloadButtonShown: isDownloadButtonShown, isAboutButtonShown: isAboutButtonShown, isFullscreenButtonShown: isFullscreenButtonShown, onFullscreenClick: handleFullscreenToggle, isFullscreen: isFullscreen, sync: sync, zoom: zoom, monacoModelPath: monacoModelPath, hoistedMenuItems: hoistedMenuItems, theme: renderedTheme }) }));
|
|
25880
25906
|
return isFullscreen && typeof document !== 'undefined' ? createPortal(editorContent, document.body) : editorContent;
|
|
25881
25907
|
}
|
|
25882
25908
|
|