@webwriter/geogebra 2.1.1 → 2.2.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.
Files changed (43) hide show
  1. package/README.md +354 -721
  2. package/assets/preview-ar.mp4 +0 -0
  3. package/assets/preview-bn.mp4 +0 -0
  4. package/assets/preview-es.mp4 +0 -0
  5. package/assets/preview-fa.mp4 +0 -0
  6. package/assets/preview-fr.mp4 +0 -0
  7. package/assets/preview-hi.mp4 +0 -0
  8. package/assets/preview-id.mp4 +0 -0
  9. package/assets/preview-it.mp4 +0 -0
  10. package/assets/preview-ja.mp4 +0 -0
  11. package/assets/preview-jv.mp4 +0 -0
  12. package/assets/preview-ko.mp4 +0 -0
  13. package/assets/preview-mr.mp4 +0 -0
  14. package/assets/preview-nl.mp4 +0 -0
  15. package/assets/preview-pl.mp4 +0 -0
  16. package/assets/preview-pt.mp4 +0 -0
  17. package/assets/preview-ru.mp4 +0 -0
  18. package/assets/preview-sw.mp4 +0 -0
  19. package/assets/preview-ta.mp4 +0 -0
  20. package/assets/preview-te.mp4 +0 -0
  21. package/assets/preview-th.mp4 +0 -0
  22. package/assets/preview-tr.mp4 +0 -0
  23. package/assets/preview-ur.mp4 +0 -0
  24. package/assets/preview-vi.mp4 +0 -0
  25. package/assets/preview-zh.mp4 +0 -0
  26. package/custom-elements.json +2189 -3437
  27. package/dist/chunks/{chunk-RYZMQM25.js → chunk-T5C4HMRG.js} +8 -2
  28. package/dist/widgets/webwriter-geogebra-3d.js +1 -3
  29. package/dist/widgets/webwriter-geogebra-classic.js +1 -3
  30. package/dist/widgets/webwriter-geogebra-geometry.js +1 -3
  31. package/dist/widgets/webwriter-geogebra-notes.js +1 -3
  32. package/dist/widgets/webwriter-geogebra-scientific.js +1 -3
  33. package/dist/widgets/webwriter-geogebra.js +1 -3
  34. package/package.json +26 -1
  35. package/schemas/construction.schema.json +14 -0
  36. package/src/components/geogebra-app.ts +100 -58
  37. package/src/widgets/webwriter-geogebra-3d.ts +1 -3
  38. package/src/widgets/webwriter-geogebra-classic.ts +1 -3
  39. package/src/widgets/webwriter-geogebra-geometry.ts +1 -3
  40. package/src/widgets/webwriter-geogebra-notes.ts +1 -3
  41. package/src/widgets/webwriter-geogebra-scientific.ts +1 -3
  42. package/src/widgets/webwriter-geogebra.ts +3 -3
  43. package/tests/presentation.test.ts +6 -0
@@ -401,7 +401,7 @@ var GeogebraApp = class extends (_a = LitElementWw, _ggbStyles_dec = [property({
401
401
  __privateAdd(this, _enableRightClick, __runInitializers(_init, 36, this, true)), __runInitializers(_init, 39, this);
402
402
  __privateAdd(this, _enableLabelDrags, __runInitializers(_init, 40, this, true)), __runInitializers(_init, 43, this);
403
403
  __privateAdd(this, _enableShiftDragZoom, __runInitializers(_init, 44, this, true)), __runInitializers(_init, 47, this);
404
- __privateAdd(this, _showZoomButtons, __runInitializers(_init, 48, this, false)), __runInitializers(_init, 51, this);
404
+ __privateAdd(this, _showZoomButtons, __runInitializers(_init, 48, this, true)), __runInitializers(_init, 51, this);
405
405
  __privateAdd(this, _errorDialogsActive, __runInitializers(_init, 52, this, true)), __runInitializers(_init, 55, this);
406
406
  __privateAdd(this, _showMenuBar, __runInitializers(_init, 56, this, false)), __runInitializers(_init, 59, this);
407
407
  __privateAdd(this, _showToolBar, __runInitializers(_init, 60, this, true)), __runInitializers(_init, 63, this);
@@ -431,7 +431,7 @@ var GeogebraApp = class extends (_a = LitElementWw, _ggbStyles_dec = [property({
431
431
  __privateAdd(this, _playButton, __runInitializers(_init, 156, this, false)), __runInitializers(_init, 159, this);
432
432
  __privateAdd(this, _scale, __runInitializers(_init, 160, this, 1)), __runInitializers(_init, 163, this);
433
433
  __privateAdd(this, _showAnimationButton, __runInitializers(_init, 164, this, false)), __runInitializers(_init, 167, this);
434
- __privateAdd(this, _showFullscreenButton, __runInitializers(_init, 168, this, false)), __runInitializers(_init, 171, this);
434
+ __privateAdd(this, _showFullscreenButton, __runInitializers(_init, 168, this, true)), __runInitializers(_init, 171, this);
435
435
  __privateAdd(this, _showSuggestionButtons, __runInitializers(_init, 172, this, false)), __runInitializers(_init, 175, this);
436
436
  __privateAdd(this, _showStartTooltip, __runInitializers(_init, 176, this, false)), __runInitializers(_init, 179, this);
437
437
  __privateAdd(this, _rounding, __runInitializers(_init, 180, this)), __runInitializers(_init, 183, this);
@@ -556,11 +556,13 @@ var GeogebraApp = class extends (_a = LitElementWw, _ggbStyles_dec = [property({
556
556
  });
557
557
  }
558
558
  }
559
+ /** Replaces the construction with the first of the given .ggb files (the "Import construction" action). */
559
560
  async importConstruction(files) {
560
561
  const file = files[0];
561
562
  if (!file || !this.isConnected) return;
562
563
  this.src = ggbDataUrl(bytesToBase64(new Uint8Array(await file.arrayBuffer())));
563
564
  }
565
+ /** Reads a .ggb file and returns a function that replaces the construction with it; throws for a file that is no zip archive. */
564
566
  async importGgb(file) {
565
567
  const bytes = new Uint8Array(await file.arrayBuffer());
566
568
  if (!isGgbArchive(bytes)) throw new Error(this.msg("The file is not a GeoGebra construction (.ggb)."));
@@ -569,16 +571,19 @@ var GeogebraApp = class extends (_a = LitElementWw, _ggbStyles_dec = [property({
569
571
  this.src = src;
570
572
  };
571
573
  }
574
+ /** The current construction as a .ggb file, or null when there is none. */
572
575
  exportGgb() {
573
576
  const base64 = this.api?.getBase64() || dataUrlPayload(this.src);
574
577
  if (!base64) return null;
575
578
  return new File([base64ToBytes(base64)], "construction.ggb", { type: GGB_MEDIA_TYPE });
576
579
  }
580
+ /** A PNG picture of the graphics view, or null while the applet is not loaded. */
577
581
  exportPng() {
578
582
  const base64 = this.api?.getPNGBase64(1, false, 72);
579
583
  if (!base64) return null;
580
584
  return new File([base64ToBytes(base64)], "construction.png", { type: "image/png" });
581
585
  }
586
+ /** An SVG picture of the graphics view, or null while the applet is not loaded or after 8 seconds without an answer. */
582
587
  exportSvg() {
583
588
  const api = this.api;
584
589
  if (!api) return null;
@@ -636,6 +641,7 @@ var GeogebraApp = class extends (_a = LitElementWw, _ggbStyles_dec = [property({
636
641
  });
637
642
  this.resizer.observe(iframe);
638
643
  }
644
+ /** Focuses the applet's iframe. */
639
645
  focus(options) {
640
646
  this.renderRoot.querySelector("iframe")?.focus(options);
641
647
  }
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GeogebraApp
3
- } from "../chunks/chunk-RYZMQM25.js";
3
+ } from "../chunks/chunk-T5C4HMRG.js";
4
4
  import "../chunks/chunk-ANJTU3IB.js";
5
5
  import {
6
6
  __decorateElement,
@@ -16,8 +16,6 @@ var WebwriterGeogebra3d = class extends (_a = GeogebraApp) {
16
16
  constructor() {
17
17
  super();
18
18
  this.type = "3d";
19
- this.showZoomButtons = true;
20
- this.showFullscreenButton = true;
21
19
  }
22
20
  };
23
21
  _init = __decoratorStart(_a);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GeogebraApp
3
- } from "../chunks/chunk-RYZMQM25.js";
3
+ } from "../chunks/chunk-T5C4HMRG.js";
4
4
  import "../chunks/chunk-ANJTU3IB.js";
5
5
  import {
6
6
  __decorateElement,
@@ -16,8 +16,6 @@ var WebwriterGeogebraClassic = class extends (_a = GeogebraApp) {
16
16
  constructor() {
17
17
  super();
18
18
  this.type = "classic";
19
- this.showZoomButtons = true;
20
- this.showFullscreenButton = true;
21
19
  }
22
20
  };
23
21
  _init = __decoratorStart(_a);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GeogebraApp
3
- } from "../chunks/chunk-RYZMQM25.js";
3
+ } from "../chunks/chunk-T5C4HMRG.js";
4
4
  import "../chunks/chunk-ANJTU3IB.js";
5
5
  import {
6
6
  __decorateElement,
@@ -16,8 +16,6 @@ var WebwriterGeogebraGeometry = class extends (_a = GeogebraApp) {
16
16
  constructor() {
17
17
  super();
18
18
  this.type = "geometry";
19
- this.showZoomButtons = true;
20
- this.showFullscreenButton = true;
21
19
  }
22
20
  };
23
21
  _init = __decoratorStart(_a);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GeogebraApp
3
- } from "../chunks/chunk-RYZMQM25.js";
3
+ } from "../chunks/chunk-T5C4HMRG.js";
4
4
  import "../chunks/chunk-ANJTU3IB.js";
5
5
  import {
6
6
  __decorateElement,
@@ -16,8 +16,6 @@ var WebwriterGeogebraNotes = class extends (_a = GeogebraApp) {
16
16
  constructor() {
17
17
  super();
18
18
  this.type = "notes";
19
- this.showZoomButtons = true;
20
- this.showFullscreenButton = true;
21
19
  }
22
20
  };
23
21
  _init = __decoratorStart(_a);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GeogebraApp
3
- } from "../chunks/chunk-RYZMQM25.js";
3
+ } from "../chunks/chunk-T5C4HMRG.js";
4
4
  import "../chunks/chunk-ANJTU3IB.js";
5
5
  import {
6
6
  __decorateElement,
@@ -16,8 +16,6 @@ var WebwriterGeogebraScientific = class extends (_a = GeogebraApp) {
16
16
  constructor() {
17
17
  super();
18
18
  this.type = "scientific";
19
- this.showZoomButtons = true;
20
- this.showFullscreenButton = true;
21
19
  }
22
20
  };
23
21
  _init = __decoratorStart(_a);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  GeogebraApp
3
- } from "../chunks/chunk-RYZMQM25.js";
3
+ } from "../chunks/chunk-T5C4HMRG.js";
4
4
  import "../chunks/chunk-ANJTU3IB.js";
5
5
  import {
6
6
  __decorateElement,
@@ -17,8 +17,6 @@ var WebwriterGeogebra = class extends (_a = GeogebraApp) {
17
17
  constructor() {
18
18
  super();
19
19
  this.type = "suite";
20
- this.showZoomButtons = true;
21
- this.showFullscreenButton = true;
22
20
  this.enableFileFeatures = false;
23
21
  this.enableUndoRedo = false;
24
22
  this.ggbStyles = css`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webwriter/geogebra",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Use the mathematics learning apps of GeoGebra for algebra and geometry.",
5
5
  "keywords": [
6
6
  "webwriter-widget",
@@ -197,6 +197,31 @@
197
197
  "./icon": "./icon.svg",
198
198
  "./preview": "./assets/preview.mp4",
199
199
  "./preview/de": "./assets/preview-de.mp4",
200
+ "./preview/fr": "./assets/preview-fr.mp4",
201
+ "./preview/nl": "./assets/preview-nl.mp4",
202
+ "./preview/es": "./assets/preview-es.mp4",
203
+ "./preview/pt": "./assets/preview-pt.mp4",
204
+ "./preview/it": "./assets/preview-it.mp4",
205
+ "./preview/ru": "./assets/preview-ru.mp4",
206
+ "./preview/pl": "./assets/preview-pl.mp4",
207
+ "./preview/tr": "./assets/preview-tr.mp4",
208
+ "./preview/id": "./assets/preview-id.mp4",
209
+ "./preview/vi": "./assets/preview-vi.mp4",
210
+ "./preview/zh": "./assets/preview-zh.mp4",
211
+ "./preview/ja": "./assets/preview-ja.mp4",
212
+ "./preview/ko": "./assets/preview-ko.mp4",
213
+ "./preview/sw": "./assets/preview-sw.mp4",
214
+ "./preview/jv": "./assets/preview-jv.mp4",
215
+ "./preview/ar": "./assets/preview-ar.mp4",
216
+ "./preview/fa": "./assets/preview-fa.mp4",
217
+ "./preview/ur": "./assets/preview-ur.mp4",
218
+ "./preview/hi": "./assets/preview-hi.mp4",
219
+ "./preview/bn": "./assets/preview-bn.mp4",
220
+ "./preview/mr": "./assets/preview-mr.mp4",
221
+ "./preview/te": "./assets/preview-te.mp4",
222
+ "./preview/ta": "./assets/preview-ta.mp4",
223
+ "./preview/th": "./assets/preview-th.mp4",
224
+ "./schemas/*": "./schemas/*",
200
225
  "./editing-config.json": "./editing-config.json",
201
226
  "./custom-elements.json": "./custom-elements.json"
202
227
  },
@@ -0,0 +1,14 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://cdn.jsdelivr.net/npm/@webwriter/geogebra@2/schemas/construction.schema.json",
4
+ "title": "GeoGebra construction",
5
+ "description": "The construction as edited in the applet or imported; the widget writes it, never write it by hand. It wins over the src attribute, which the widget then removes.",
6
+ "type": "object",
7
+ "properties": {
8
+ "src": {
9
+ "type": "string",
10
+ "pattern": "^data:[^,]*;base64,",
11
+ "description": "The .ggb file (a zip archive) as a base64 data URL: \"data:application/vnd.geogebra.file;base64,…\". A value that does not start with \"data:\" is ignored."
12
+ }
13
+ }
14
+ }