@webwriter/geogebra 2.0.1 → 2.0.2
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/README.md +2 -2
- package/dist/chunks/{chunk-ACU6XINJ.js → chunk-RYZMQM25.js} +11 -3
- package/dist/widgets/webwriter-geogebra-3d.js +1 -1
- package/dist/widgets/webwriter-geogebra-classic.js +1 -1
- package/dist/widgets/webwriter-geogebra-geometry.js +1 -1
- package/dist/widgets/webwriter-geogebra-notes.js +1 -1
- package/dist/widgets/webwriter-geogebra-scientific.js +1 -1
- package/dist/widgets/webwriter-geogebra.js +1 -1
- package/package.json +1 -1
- package/src/components/geogebra-app.ts +10 -4
- package/tests/presentation.test.ts +35 -1
package/README.md
CHANGED
|
@@ -355,6 +355,16 @@ var globImport_localization_generated_ts = __glob({
|
|
|
355
355
|
});
|
|
356
356
|
|
|
357
357
|
// src/components/geogebra-app.ts
|
|
358
|
+
var appletSettings = /* @__PURE__ */ new Set([
|
|
359
|
+
...passThroughParameters,
|
|
360
|
+
...passThroughParametersAfterLocale,
|
|
361
|
+
"appletId",
|
|
362
|
+
"type",
|
|
363
|
+
"lang",
|
|
364
|
+
"language",
|
|
365
|
+
"country",
|
|
366
|
+
"ggbStyles"
|
|
367
|
+
]);
|
|
358
368
|
var _ready_dec, _resetKey_dec, _detachedKeyboardParent_dec, _disabledJavaScript_dec, _transparentGraphics_dec, _keyboardType_dec, _showKeyboardOnFocus_dec, _textmode_dec, _editorForegroundColor_dec, _editorBackgroundColor_dec, _buttonBorderColor_dec, _buttonRounding_dec, _buttonShadows_dec, _rounding_dec, _showStartTooltip_dec, _showSuggestionButtons_dec, _showFullscreenButton_dec, _showAnimationButton_dec, _scale_dec, _playButton_dec, _allowUpscale_dec, _autoHeight_dec, _scaleContainerClass_dec, _preventFocus_dec, _algebraInputPosition_dec, _enableCAS_dec, _enable3d_dec, _perspective_dec, _enableUndoRedo_dec, _enableFileFeatures_dec, _capturingThreshold_dec, _showLogging_dec, _useBrowserForJs_dec, _randomSeed_dec, _randomize_dec, _allowStyleBar_dec, _appletId_dec, _country_dec, _language_dec, _showResetIcon_dec, _showAlgebraInput_dec, _customToolBar_dec, _showToolBarHelp_dec, _showToolBar_dec, _showMenuBar_dec, _errorDialogsActive_dec, _showZoomButtons_dec, _enableShiftDragZoom_dec, _enableLabelDrags_dec, _enableRightClick_dec, _borderRadius_dec, _borderColor_dec, _src_dec, _height_dec, _width_dec, _type_dec, _ggbStyles_dec, _a, _data, _init, _ggbStyles, _type, _width, _height, _src, _borderColor, _borderRadius, _enableRightClick, _enableLabelDrags, _enableShiftDragZoom, _showZoomButtons, _errorDialogsActive, _showMenuBar, _showToolBar, _showToolBarHelp, _customToolBar, _showAlgebraInput, _showResetIcon, _language, _country, _appletId, _allowStyleBar, _randomize, _randomSeed, _useBrowserForJs, _showLogging, _capturingThreshold, _enableFileFeatures, _enableUndoRedo, _perspective, _enable3d, _enableCAS, _algebraInputPosition, _preventFocus, _scaleContainerClass, _autoHeight, _allowUpscale, _playButton, _scale, _showAnimationButton, _showFullscreenButton, _showSuggestionButtons, _showStartTooltip, _rounding, _buttonShadows, _buttonRounding, _buttonBorderColor, _editorBackgroundColor, _editorForegroundColor, _textmode, _showKeyboardOnFocus, _keyboardType, _transparentGraphics, _disabledJavaScript, _detachedKeyboardParent, _resetKey, _ready;
|
|
359
369
|
var GeogebraApp = class extends (_a = LitElementWw, _ggbStyles_dec = [property({ type: String })], _type_dec = [property({ type: String, attribute: true, reflect: true })], _width_dec = [property({ type: Number, attribute: true, reflect: true })], _height_dec = [property({ type: Number, attribute: true, reflect: true })], _src_dec = [property({ type: String, attribute: true, reflect: true, converter: {
|
|
360
370
|
fromAttribute: (value) => value,
|
|
@@ -517,9 +527,7 @@ var GeogebraApp = class extends (_a = LitElementWw, _ggbStyles_dec = [property({
|
|
|
517
527
|
if (this.paramUpdateMap) {
|
|
518
528
|
let needFullReload = false;
|
|
519
529
|
changed.forEach((_, key) => {
|
|
520
|
-
if (key
|
|
521
|
-
return;
|
|
522
|
-
}
|
|
530
|
+
if (!appletSettings.has(key)) return;
|
|
523
531
|
const updateFunc = this.paramUpdateMap?.get(key.toString());
|
|
524
532
|
if (updateFunc) {
|
|
525
533
|
updateFunc.call(api, this[key]);
|
package/package.json
CHANGED
|
@@ -11,9 +11,15 @@ import {geogebraAppStyles} from "./geogebra-app.styles"
|
|
|
11
11
|
import { booleanAttributeConverter } from "../model/boolean-attribute-converter"
|
|
12
12
|
import type { GeogebraAPI } from "../model/geogebra-api"
|
|
13
13
|
import { geogebraOptions } from "../model/geogebra-options"
|
|
14
|
-
import { appletParameters } from "../model/geogebra-parameters"
|
|
14
|
+
import { appletParameters, passThroughParameters, passThroughParametersAfterLocale } from "../model/geogebra-parameters"
|
|
15
15
|
import { base64ToBytes, bytesToBase64, dataUrlPayload, ggbDataUrl, GGB_MEDIA_TYPE, isGgbArchive } from "../model/ggb-file"
|
|
16
16
|
|
|
17
|
+
const appletSettings = new Set<PropertyKey>([
|
|
18
|
+
...passThroughParameters,
|
|
19
|
+
...passThroughParametersAfterLocale,
|
|
20
|
+
"appletId", "type", "lang", "language", "country", "ggbStyles",
|
|
21
|
+
])
|
|
22
|
+
|
|
17
23
|
export type { GeogebraAPI }
|
|
18
24
|
|
|
19
25
|
declare global {
|
|
@@ -493,9 +499,9 @@ export class GeogebraApp extends LitElementWw {
|
|
|
493
499
|
let needFullReload = false
|
|
494
500
|
|
|
495
501
|
changed.forEach((_, key) => {
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
502
|
+
// Saving a construction changes WebWriter's reactive data property. Only applet
|
|
503
|
+
// settings can require reinitialization. Construction changes are handled below.
|
|
504
|
+
if (!appletSettings.has(key)) return
|
|
499
505
|
const updateFunc = this.paramUpdateMap?.get(key.toString())
|
|
500
506
|
if(updateFunc) {
|
|
501
507
|
updateFunc.call(api, this[key as keyof this] as never)
|
|
@@ -3,7 +3,7 @@ import "mocha/mocha.js";
|
|
|
3
3
|
import { assert } from "chai";
|
|
4
4
|
import { getMochaConfig } from "@webwriter/build/test";
|
|
5
5
|
import "../src/widgets/webwriter-geogebra-classic";
|
|
6
|
-
import { mountIn, unmountAll, until, wait } from "./helpers";
|
|
6
|
+
import { SRC_A, dataBlock, mountIn, unmountAll, until, wait } from "./helpers";
|
|
7
7
|
|
|
8
8
|
mocha.setup(getMochaConfig());
|
|
9
9
|
|
|
@@ -41,6 +41,40 @@ describe("presentation", function () {
|
|
|
41
41
|
});
|
|
42
42
|
const connect = (widget: any, api: unknown) => widget.dispatchEvent(new CustomEvent("ggb-load", {detail: {api}}));
|
|
43
43
|
|
|
44
|
+
it("keeps the applet mounted when a construction edit is saved", async function () {
|
|
45
|
+
const widget = await mountIn(`<webwriter-geogebra-classic></webwriter-geogebra-classic>`, "webwriter-geogebra-classic");
|
|
46
|
+
const frame = widget.shadowRoot.querySelector("iframe");
|
|
47
|
+
let constructionEdited: (() => void) | undefined;
|
|
48
|
+
const api = Object.assign(fakeApi([]), {
|
|
49
|
+
registerUpdateListener: (callback: () => void) => { constructionEdited = callback; },
|
|
50
|
+
getBase64: () => SRC_A.split(",")[1],
|
|
51
|
+
setBase64: () => assert.fail("the saved construction is already loaded"),
|
|
52
|
+
});
|
|
53
|
+
connect(widget, api);
|
|
54
|
+
|
|
55
|
+
constructionEdited!();
|
|
56
|
+
assert.isTrue(await until(() => JSON.parse(dataBlock(widget)?.textContent ?? "{}").src === SRC_A));
|
|
57
|
+
await widget.updateComplete;
|
|
58
|
+
assert.strictEqual(widget.shadowRoot.querySelector("iframe"), frame);
|
|
59
|
+
assert.isTrue(widget.shadowRoot.querySelector(".applet").hasAttribute("data-ready"));
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("updates live options and rebuilds for initialization settings", async function () {
|
|
63
|
+
const widget = await mountIn(`<webwriter-geogebra-classic></webwriter-geogebra-classic>`, "webwriter-geogebra-classic");
|
|
64
|
+
const frame = widget.shadowRoot.querySelector("iframe");
|
|
65
|
+
const toolbarChanges: boolean[] = [];
|
|
66
|
+
connect(widget, Object.assign(fakeApi([]), {
|
|
67
|
+
showToolBar: (visible: boolean) => toolbarChanges.push(visible),
|
|
68
|
+
}));
|
|
69
|
+
widget.showToolBar = false;
|
|
70
|
+
await widget.updateComplete;
|
|
71
|
+
|
|
72
|
+
assert.deepEqual(toolbarChanges, [false]);
|
|
73
|
+
assert.strictEqual(widget.shadowRoot.querySelector("iframe"), frame);
|
|
74
|
+
widget.showMenuBar = true;
|
|
75
|
+
assert.isTrue(await until(() => widget.shadowRoot.querySelector("iframe") !== frame));
|
|
76
|
+
});
|
|
77
|
+
|
|
44
78
|
it("sizes the applet to the container at 300 and 2100 px", async function () {
|
|
45
79
|
this.timeout(15000);
|
|
46
80
|
const widget = await mountIn(`<div style="width: 300px"><webwriter-geogebra-classic></webwriter-geogebra-classic></div>`, "webwriter-geogebra-classic");
|