@webwriter/geogebra 2.1.2 → 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.
@@ -38,9 +38,13 @@ declare global {
38
38
  * `image/png` and `image/svg+xml` export the picture of the graphics view; both need the loaded applet and are lossy
39
39
  * (no construction steps, no algebra view). A file that is no zip archive is refused before the widget changes.
40
40
  *
41
+ * @data {schemas/construction.schema.json} - The edited or imported construction.
41
42
  * @part applet - The iframe that holds the GeoGebra applet.
43
+ * @cssprop --ww-text-color - Text color of the widget (the note shown when printing without a loaded applet).
44
+ * @cssprop --ww-font-family - Font of the widget.
45
+ * @cssprop --ww-link-color - Color of the focus ring around the applet.
42
46
  * @fires focus - Fired when the GeoGebra applet gains focus.
43
- * @fires ggb-load - Fired when the GeoGebra API is ready. The event detail contains the API instance.
47
+ * @fires ggb-load - Fired when the GeoGebra applet has loaded; `detail.api` is the applet's GeoGebra API (evalCommand, getBase64, …).
44
48
  */
45
49
  export class GeogebraApp extends LitElementWw {
46
50
  static styles = geogebraAppStyles
@@ -77,7 +81,7 @@ export class GeogebraApp extends LitElementWw {
77
81
  })
78
82
 
79
83
  /**
80
- * Custom CSS styles to apply to the GeoGebra applet.
84
+ * Advanced: CSS text injected into the applet's iframe. It replaces the default rules, which align the app header (and on `<webwriter-geogebra>` also hide undo/redo). Usually leave unset.
81
85
  */
82
86
  @property({type: String})
83
87
  accessor ggbStyles: string = css`
@@ -87,25 +91,25 @@ export class GeogebraApp extends LitElementWw {
87
91
  `.cssText
88
92
 
89
93
  /**
90
- * app name, default: "classic". "graphing" …​ GeoGebra Graphing Calculator "geometry" …​ GeoGebra Geometry "3d" …​ GeoGebra 3D Graphing Calculator "classic" …​ GeoGebra Classic "suite" …​ GeoGebra Calculator Suite "evaluator" …​ Equation Editor "scientific" …​Scientific Calculator "notes" …​ GeoGebra Notes
94
+ * The GeoGebra app. Each tag sets its own (see its description; the listed default is the classic tag's). Set it only to switch apps, e.g. to "evaluator": the equation editor, a math input field.
91
95
  */
92
96
  @property({type: String, attribute: true, reflect: true})
93
97
  accessor type: "classic" | "geometry" | "3d" | "suite" | "evaluator" | "scientific" | "notes" = "classic"
94
98
 
95
99
  /**
96
- * Applet width
100
+ * Initial applet width in pixels. The widget then fits the applet to its container (300 to 2100 px wide, 16:9), so this does not set the displayed size.
97
101
  */
98
102
  @property({type: Number, attribute: true, reflect: true})
99
103
  accessor width: number = 800
100
104
 
101
105
  /**
102
- * Applet height
106
+ * Initial applet height in pixels. Like `width`, it does not set the displayed size (16:9, at least 18rem high).
103
107
  */
104
108
  @property({type: Number, attribute: true, reflect: true})
105
109
  accessor height: number = 450
106
110
 
107
111
  /**
108
- * Source of the GeoGebra file to load (base64-encoded string, material ID prefixed with "ggbid:", or file URL)
112
+ * Construction to load: "ggbid:<id>" for the material at geogebra.org/m/<id>, or the URL of a .ggb file. Leave out for a blank app. Edits and imports go to the data block instead.
109
113
  */
110
114
  @property({type: String, attribute: true, reflect: true, converter: {
111
115
  fromAttribute: (value: string | null) => value,
@@ -114,307 +118,339 @@ export class GeogebraApp extends LitElementWw {
114
118
  accessor src: string | undefined
115
119
 
116
120
  /**
117
- * Color of the border line drawn around the applet panel (as hex rgb string). Default: gray
121
+ * Color of the border line around the applet, e.g. "#cccccc".
118
122
  */
119
123
  @property({type: String, attribute: true, reflect: true})
120
124
  accessor borderColor: string = "gray"
121
125
 
122
126
  /**
123
- * Size of applet's border radius in pixels.
127
+ * Corner radius of the applet border in pixels.
124
128
  */
125
129
  @property({type: Number, attribute: true, reflect: true})
126
130
  accessor borderRadius: number = 1
127
131
 
128
132
  /**
129
- * States whether right clicks should be handled by the applet. Setting this parameter to "false" disables context menus, properties dialogs and right-click-zooming. Default: true. NB also enables/disables some keyboard shortcuts eg Delete and Ctrl + R (recompute all objects). Default: true
133
+ * Whether right-click opens context menus and object properties; "false" also turns off some shortcuts such as Delete.
134
+ * @type {"true" | "false"}
130
135
  */
131
136
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
132
137
  accessor enableRightClick = true
133
138
 
134
139
  /**
135
- * States whether labels can be dragged. Default: true
140
+ * Whether learners can drag object labels.
141
+ * @type {"true" | "false"}
136
142
  */
137
143
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
138
144
  accessor enableLabelDrags = true
139
145
 
140
146
  /**
141
- * States whether the Graphics View(s) should be moveable using Shift mouse drag (or. Ctrl + mouse drag) or zoomable using Shift + mouse wheel (or Ctrl + mouse wheel). Setting this parameter to "false" disables moving and zooming of the drawing pad. Default: true
147
+ * Whether learners can pan (Shift or Ctrl + drag) and zoom (Shift or Ctrl + wheel) the graphics view; "false" turns off moving and zooming the view altogether, so the visible area stays fixed. Hide the zoom buttons too, with `showzoombuttons="false"`.
148
+ * @type {"true" | "false"}
142
149
  */
143
150
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
144
151
  accessor enableShiftDragZoom = true
145
152
 
146
153
  /**
147
- * States whether the zoom in / zoom out / home buttons should be shown in the Graphics View or not. Default: false
154
+ * Whether zoom in, zoom out and home buttons appear in the graphics view.
155
+ * @type {"true" | "false"}
148
156
  */
149
157
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
150
- accessor showZoomButtons = false
158
+ accessor showZoomButtons = true
151
159
 
152
160
  /**
153
- * States whether error dialogs will be shown if an invalid input is entered (using the Input Bar or JavaScript) Default: true
161
+ * Whether invalid input shows an error dialog.
162
+ * @type {"true" | "false"}
154
163
  */
155
164
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
156
165
  accessor errorDialogsActive = true
157
166
 
158
167
  /**
159
- * States whether the menubar of GeoGebra should be shown in the applet. Default: false
168
+ * Whether GeoGebra's menu bar is shown.
169
+ * @type {"true" | "false"}
160
170
  */
161
171
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
162
172
  accessor showMenuBar = false
163
173
 
164
174
  /**
165
- * States whether the toolbar with the construction mode buttons should be shown in the applet. Default: false
175
+ * Whether the toolbar with the construction tools is shown; `customtoolbar` chooses its tools.
176
+ * @type {"true" | "false"}
166
177
  */
167
178
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
168
179
  accessor showToolBar = true
169
180
 
170
181
  /**
171
- * States whether the toolbar help text right to the toolbar buttons should be shown in the applet
182
+ * Whether a help text for the selected tool appears next to the toolbar.
183
+ * @type {"true" | "false"}
172
184
  */
173
185
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
174
186
  accessor showToolBarHelp = false
175
187
 
176
188
  /**
177
- * Sets the toolbar according to a custom toolbar string where the int values are Toolbar Mode Values, `,` adds a separator within a menu, `|` starts a new menu and `||` adds a separator in the toolbar before starting a new menu. This will override the saved toolbar from the .ggb file / base64 string. Custom tools are numbered 100 001, 100 002, etc
189
+ * Tools in the toolbar: GeoGebra tool numbers, spaces between tools of one menu, "|" before the next menu, "," a separator in a menu. "0 | 1 | 15 | 10" gives Move, Point, Segment, Circle. Overrides the file's toolbar.
178
190
  */
179
191
  @property({type: String, attribute: true, reflect: true})
180
192
  accessor customToolBar: string | undefined
181
193
 
182
194
  /**
183
- * States whether the algebra input line (with input field, greek letters and command list) should be shown in the applet. Default: false
195
+ * Whether the input line is shown, where learners type objects and commands such as f(x) = x^2 or Circle(A, 3).
196
+ * @type {"true" | "false"}
184
197
  */
185
198
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
186
199
  accessor showAlgebraInput = true
187
200
 
188
201
  /**
189
- * States whether a small icon (GeoGebra ellipse) should be shown in the upper right corner of the applet. Clicking on this icon resets the applet (i.e. it reloads the file given in the filename parameter). Default: false
202
+ * Whether an icon in the upper right corner resets the applet to the construction it loaded with.
203
+ * @type {"true" | "false"}
190
204
  */
191
205
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
192
206
  accessor showResetIcon = false
193
207
 
194
208
  /**
195
- * ISO language string. GeoGebra tries to set your local language automatically (if it is available among the supported languages, of course). The default language for unsupported languages is English. If you want to specify a certain language manually, please use this parameter.
209
+ * Applet language as an ISO 639-1 code such as "de". Usually leave out: the applet follows the nearest lang attribute, i.e. the document language.
196
210
  */
197
211
  @property({type: String, attribute: true, reflect: true})
198
212
  accessor language: string | undefined
199
213
 
200
214
  /**
201
- * ISO country string. This parameter only makes sense if you use it together with the language parameter.
215
+ * ISO 3166 country code such as "AT" for a regional variant of the language. Left out, it is the region of the document language (none when `language` is set).
202
216
  */
203
217
  @property({type: String, attribute: true, reflect: true})
204
218
  accessor country: string | undefined
205
219
 
206
220
  /**
207
- * This parameter allows you to specify the argument passed to the JavaScript function ggbOnInit(), which is called once the applet is fully initialised. This is useful when you have multiple applets on a page.
221
+ * Id passed to GeoGebra as the applet id (the argument of ggbOnInit). Usually leave out.
208
222
  */
209
223
  @property({type: String, attribute: true, reflect: true})
210
224
  accessor appletId: string | undefined
211
225
 
212
226
  /**
213
- * Determines whether the Style Bar can be shown (or will be shown if just Graphics View 1 is showing). Default: false
227
+ * Whether the style bar (color, line style and label of the selected object) can be shown.
228
+ * @type {"true" | "false"}
214
229
  */
215
230
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
216
231
  accessor allowStyleBar = false
217
232
 
218
233
  /**
219
- * Determines whether random numbers should be randomized on file load. Useful when you want the app to reload in exactly the same state it was saved. Default: true
234
+ * Whether random numbers in the construction are drawn anew on each load; "false" keeps the saved values.
235
+ * @type {"true" | "false"}
220
236
  */
221
237
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
222
238
  accessor randomize = true
223
239
 
224
240
  /**
225
- * Specify seed for random numbers. Note that if you save a state of the app after user interacted with it and try to reload that state with the same randomSeed, you may get a different result. Use randomize for those use-cases.
241
+ * Integer seed for random numbers, so that every load draws the same values.
226
242
  */
227
243
  @property({type: Number, attribute: true, reflect: true})
228
244
  accessor randomSeed: number | undefined
229
245
 
230
246
  /**
231
- * When true, GeoGebra: runs ggbOnInit from HTML, ignores ggbOnInit from file, and ignores JS update scripts of objects in file. When false, GeoGebra: ignores ggbOnInit from HTML (use appletOnLoad parameter of GGBApplet instead), runs ggbOnInit from file, and runs JS update scripts of objects in file. Default: false
247
+ * Advanced: "true" ignores the scripts saved in the construction (ggbOnInit and object update scripts); "false" runs them.
248
+ * @type {"true" | "false"}
232
249
  */
233
250
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
234
251
  accessor useBrowserForJs = false
235
252
 
236
253
  /**
237
- * Determines whether logging is shown in the Browser's console. Default: false
254
+ * Whether GeoGebra writes log messages to the browser console.
255
+ * @type {"true" | "false"}
238
256
  */
239
257
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
240
258
  accessor showLogging = false
241
259
 
242
260
  /**
243
- * Determines the sensitivity of object selection. The default value of 3 is usually fine to select and drag objects both with the mouse and touch. Use larger values (e.g. 4 or 5) to make it easier to select and drag objects. Default: 3
261
+ * How easily pointer and touch select and drag objects; larger values (4 or 5) make it easier.
244
262
  */
245
263
  @property({type: Number, attribute: true, reflect: true})
246
264
  accessor capturingThreshold = 3
247
265
 
248
266
  /**
249
- * Determines whether file saving, file loading, sign in and Options > Save settings are enabled. This argument is ignored when menubar is not showing. Default: true
267
+ * Whether the menu offers saving, opening, sign-in and saving settings; matters only with `showmenubar`. `<webwriter-geogebra>` defaults to "false".
268
+ * @type {"true" | "false"}
250
269
  */
251
270
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
252
271
  accessor enableFileFeatures = true
253
272
 
254
273
  /**
255
- * Determines whether Undo and Redo icons are shown. This argument is ignored when toolbar is not showing. Default: true
274
+ * No effect yet: the widget does not pass it to GeoGebra. Undo and redo show with the toolbar, except on `<webwriter-geogebra>`, whose `ggbstyles` hide them.
275
+ * @type {"true" | "false"}
256
276
  */
257
277
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
258
278
  accessor enableUndoRedo = true
259
279
 
260
280
  /**
261
- * For values see SetPerspective_Command in the GeoGebra Manual. Just for a blank start ie shouldn't be used with material_id, filename or ggbBase64 parameters
281
+ * Views of a blank app (without `src`), as GeoGebra perspective letters: A algebra, G graphics, D graphics 2, T 3D graphics, S spreadsheet, C CAS, B probability, L construction protocol; e.g. "AG".
262
282
  */
263
283
  @property({type: String, attribute: true, reflect: true})
264
284
  accessor perspective: string | undefined
265
285
 
266
286
  /**
267
- * Whether 3D should be enabled (for exam mode).
287
+ * Whether 3D graphics are available; "false" removes them, e.g. for a test. Left out, the app decides.
288
+ * @type {"true" | "false"}
268
289
  */
269
290
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
270
291
  accessor enable3d: boolean | undefined
271
292
 
272
293
  /**
273
- * Whether CAS should be enabled (for exam mode).
294
+ * Whether the CAS (symbolic algebra: Solve, Factor, …) is available; "false" turns it off, e.g. for a test. Left out, the app decides.
295
+ * @type {"true" | "false"}
274
296
  */
275
297
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
276
298
  accessor enableCAS: boolean | undefined
277
299
 
278
300
  /**
279
- * Determines whether input bar should be shown in algebra, on top of the applet or under the applet. When left empty (default), the position depends on file.
301
+ * Where the input line appears: "algebra" inside the algebra view, "top" or "bottom" of the applet. Left out, the construction decides.
280
302
  */
281
303
  @property({type: String, attribute: true, reflect: true})
282
304
  accessor algebraInputPosition: "algebra" | "top" | "bottom" | undefined
283
305
 
284
306
  /**
285
- * When set to true, this prevents the applet from getting focus automatically at the start. Default: false
307
+ * Whether the applet must not take the focus when it starts.
308
+ * @type {"true" | "false"}
286
309
  */
287
310
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
288
311
  accessor preventFocus = false
289
312
 
290
313
  /**
291
- * Name of CSS class that is used as container; applet will scale to fit into the container.
314
+ * GeoGebra's scaling container (a CSS class). Leave out: the widget already fits the applet to its container.
292
315
  */
293
316
  @property({type: String, attribute: true, reflect: true})
294
317
  accessor scaleContainerClass: string | undefined
295
318
 
296
319
  /**
297
- * `true` to restrict the width of the applet and compute height automatically, add autoHeight: true. `false` if you want the applet to be restricted by both width and height of the container
320
+ * Only with `scalecontainerclass`: whether GeoGebra computes the height from the width.
321
+ * @type {"true" | "false"}
298
322
  */
299
323
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
300
324
  accessor autoHeight = true
301
325
 
302
326
  /**
303
- * Determines whether automatic scaling may scale the applet up. Default: false
327
+ * Only with `scalecontainerclass`: whether GeoGebra may scale the applet up.
328
+ * @type {"true" | "false"}
304
329
  */
305
330
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
306
331
  accessor allowUpscale = false
307
332
 
308
333
  /**
309
- * Determines whether a preview image and a play button should be rendered in place of the applet. Pushing the play button initializes the applet. Default: false
334
+ * Whether a preview image with a play button stands in for the applet until a learner clicks it.
335
+ * @type {"true" | "false"}
310
336
  */
311
337
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
312
338
  accessor playButton = false
313
339
 
314
340
  /**
315
- * Ratio by which the applet should be scaled (eg. 2 makes the applet 2 times bigger, including all texts and UI elements). Default: 1
341
+ * Scale factor of the whole applet, texts and buttons included; 2 doubles it.
316
342
  */
317
343
  @property({type: Number, attribute: true, reflect: true})
318
344
  accessor scale = 1
319
345
 
320
346
  /**
321
- * Whether animation button should be visible
347
+ * Whether a play/pause button for animations (e.g. animated sliders) is shown in the graphics view.
348
+ * @type {"true" | "false"}
322
349
  */
323
350
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
324
351
  accessor showAnimationButton = false
325
352
 
326
353
  /**
327
- * Whether fullscreen button should be visible
354
+ * Whether a fullscreen button is shown.
355
+ * @type {"true" | "false"}
328
356
  */
329
357
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
330
- accessor showFullscreenButton = false
358
+ accessor showFullscreenButton = true
331
359
 
332
360
  /**
333
- * Whether suggestion buttons (special points, solve) in Algebra View should be visible
361
+ * Whether suggestion buttons (special points, solve) appear in the algebra view.
362
+ * @type {"true" | "false"}
334
363
  */
335
364
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
336
365
  accessor showSuggestionButtons = false
337
366
 
338
367
  /**
339
- * Whether "Welcome" tooltip should be shown
368
+ * Whether GeoGebra's welcome tooltip appears at the start.
369
+ * @type {"true" | "false"}
340
370
  */
341
371
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
342
372
  accessor showStartTooltip = false
343
373
 
344
374
  /**
345
- * String composed of number of decimal places and flags — valid flags are "s" for significant digits and "r" for rational numbers. Hence "10" means 10 decimal places, "10s" stands for 10 significant digits.
375
+ * Displayed precision: decimal places, or significant digits with "s" ("2" rounds to 2 decimal places, "4s" to 4 significant digits). Left out, the construction decides.
346
376
  */
347
377
  @property({type: String, attribute: true, reflect: true})
348
378
  accessor rounding: string | undefined
349
379
 
350
380
  /**
351
- * Whether buttons should have shadow
381
+ * Whether buttons in the graphics view have shadows.
382
+ * @type {"true" | "false"}
352
383
  */
353
384
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
354
385
  accessor buttonShadows = false
355
386
 
356
387
  /**
357
- * Relative radius of button's rounded border. The border radius in pixels is buttonRounding * height /2, where height is the height of the button. Default: 0.2
388
+ * Corner radius of buttons in the graphics view, relative to half their height (radius = value × height / 2).
358
389
  */
359
390
  @property({type: Number, attribute: true, reflect: true})
360
391
  accessor buttonRounding = 0.2
361
392
 
362
393
  /**
363
- * Border color of buttons on the graphics view. Default is black, if the button background is white, otherwise one shade darker than the background color
394
+ * Border color of buttons in the graphics view, e.g. "#000000". Left out: black on white buttons, otherwise a shade darker than the button.
364
395
  */
365
396
  @property({type: String, attribute: true, reflect: true})
366
397
  accessor buttonBorderColor: string | undefined
367
398
 
368
399
  /**
369
- * Background color of the evaluator app
400
+ * Background color of the equation editor (type "evaluator" only), e.g. "#ffffff".
370
401
  */
371
402
  @property({type: String, attribute: true, reflect: true})
372
403
  accessor editorBackgroundColor: string | undefined
373
404
 
374
405
  /**
375
- * Foreground (text) color of the equation editor (appname = "evaluator")
406
+ * Text color of the equation editor (type "evaluator" only), e.g. "#000000".
376
407
  */
377
408
  @property({type: String, attribute: true, reflect: true})
378
409
  accessor editorForegroundColor: string | undefined
379
410
 
380
411
  /**
381
- * Whether editor is in text mode or not (appname = "evaluator"). Default: false
412
+ * Whether the equation editor (type "evaluator") starts in text mode.
413
+ * @type {"true" | "false"}
382
414
  */
383
415
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
384
416
  accessor textmode = false
385
417
 
386
418
  /**
387
- * Whether to show keyboard when input is focused. When set to true, keyboard is always shown, for false it never appears, for auto it's shown unless closed by user. Default: true in evaluator app, auto in other apps
419
+ * Whether the on-screen keyboard opens when an input is focused: "true" always, "false" never. Left out: always in the equation editor, otherwise until the learner closes it.
420
+ * @type {"true" | "false"}
388
421
  */
389
422
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
390
423
  accessor showKeyboardOnFocus: boolean | undefined
391
424
 
392
425
  /**
393
- * Which keyboard is shown for equation editor (appname = "evaluator")
426
+ * On-screen keyboard of the equation editor (type "evaluator"): "scientific", "normal" or "notes".
394
427
  */
395
428
  @property({type: String, attribute: true, reflect: true})
396
429
  accessor keyboardType: "scientific" | "normal" | "notes" | undefined
397
430
 
398
431
  /**
399
- * Whether the Graphics View and Graphics View 2 should be transparent
432
+ * Whether the graphics views have a transparent background.
433
+ * @type {"true" | "false"}
400
434
  */
401
435
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
402
436
  accessor transparentGraphics = false
403
437
 
404
438
  /**
405
- * Whether running JavaScript from material files is disabled or not.
439
+ * Whether JavaScript saved in the construction is blocked.
440
+ * @type {"true" | "false"}
406
441
  */
407
442
  @property({type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter})
408
443
  accessor disabledJavaScript = false
409
444
 
410
445
  /**
411
- * When set, the keyboard should be attached to the first element in DOM that fits the selector.
446
+ * CSS selector of an element to hold the on-screen keyboard. Leave out: the applet runs in the widget's own iframe.
412
447
  */
413
448
  @property({type: String, attribute: true, reflect: true})
414
449
  accessor detachedKeyboardParent: string | undefined
415
450
 
416
451
  /**
417
452
  * Used to force reset of the applet. Increment this property to reset the applet.
453
+ * @internal
418
454
  */
419
455
  @property({type: Number})
420
456
  protected accessor resetKey: number = 0
@@ -534,12 +570,14 @@ export class GeogebraApp extends LitElementWw {
534
570
  }
535
571
  }
536
572
 
573
+ /** Replaces the construction with the first of the given .ggb files (the "Import construction" action). */
537
574
  async importConstruction(files: File[]) {
538
575
  const file = files[0]
539
576
  if (!file || !this.isConnected) return
540
577
  this.src = ggbDataUrl(bytesToBase64(new Uint8Array(await file.arrayBuffer())))
541
578
  }
542
579
 
580
+ /** Reads a .ggb file and returns a function that replaces the construction with it; throws for a file that is no zip archive. */
543
581
  async importGgb(file: File) {
544
582
  const bytes = new Uint8Array(await file.arrayBuffer())
545
583
  if (!isGgbArchive(bytes)) throw new Error(this.msg("The file is not a GeoGebra construction (.ggb)."))
@@ -547,18 +585,21 @@ export class GeogebraApp extends LitElementWw {
547
585
  return () => { this.src = src }
548
586
  }
549
587
 
588
+ /** The current construction as a .ggb file, or null when there is none. */
550
589
  exportGgb() {
551
590
  const base64 = this.api?.getBase64() || dataUrlPayload(this.src)
552
591
  if (!base64) return null
553
592
  return new File([base64ToBytes(base64) as BlobPart], "construction.ggb", {type: GGB_MEDIA_TYPE})
554
593
  }
555
594
 
595
+ /** A PNG picture of the graphics view, or null while the applet is not loaded. */
556
596
  exportPng() {
557
597
  const base64 = this.api?.getPNGBase64(1, false, 72)
558
598
  if (!base64) return null
559
599
  return new File([base64ToBytes(base64) as BlobPart], "construction.png", {type: "image/png"})
560
600
  }
561
601
 
602
+ /** An SVG picture of the graphics view, or null while the applet is not loaded or after 8 seconds without an answer. */
562
603
  exportSvg() {
563
604
  const api = this.api
564
605
  if (!api) return null
@@ -632,6 +673,7 @@ export class GeogebraApp extends LitElementWw {
632
673
  this.resizer.observe(iframe)
633
674
  }
634
675
 
676
+ /** Focuses the applet's iframe. */
635
677
  focus(options?: FocusOptions) {
636
678
  this.renderRoot.querySelector("iframe")?.focus(options)
637
679
  }
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
2
2
  import { GeogebraApp } from "../components/geogebra-app"
3
3
 
4
4
  /**
5
- * A GeoGebra 3D Graphing Calculator widget.
5
+ * GeoGebra 3D Graphing Calculator (type "3d"): plot surfaces, planes, solids and points in space and rotate the view; use it for spatial geometry and functions of two variables. Load a construction with `src` or leave it out for an empty 3D view.
6
6
  */
7
7
  @customElement("webwriter-geogebra-3d")
8
8
  export class WebwriterGeogebra3d extends GeogebraApp {
9
9
  constructor() {
10
10
  super()
11
11
  this.type = "3d" as const
12
- this.showZoomButtons = true
13
- this.showFullscreenButton = true
14
12
  }
15
13
  }
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
2
2
  import { GeogebraApp } from "../components/geogebra-app"
3
3
 
4
4
  /**
5
- * A GeoGebra Classic widget.
5
+ * GeoGebra Classic (type "classic"): the full app with algebra, graphics, spreadsheet and CAS views; use it to pick the views of a blank app (`perspective`), for graphs with an algebra view, or for a material whose app you do not know. Load a construction with `src` or leave it out for a blank app.
6
6
  */
7
7
  @customElement("webwriter-geogebra-classic")
8
8
  export class WebwriterGeogebraClassic extends GeogebraApp {
9
9
  constructor() {
10
10
  super()
11
11
  this.type = "classic" as const
12
- this.showZoomButtons = true
13
- this.showFullscreenButton = true
14
12
  }
15
13
  }
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
2
2
  import { GeogebraApp } from "../components/geogebra-app"
3
3
 
4
4
  /**
5
- * A GeoGebra Geometry widget.
5
+ * GeoGebra Geometry (type "geometry"): ruler-and-compass constructions with points, lines, circles, polygons and angles; use it for tasks such as constructing a perpendicular bisector. Load a construction with `src` or leave it out for a blank sheet.
6
6
  */
7
7
  @customElement("webwriter-geogebra-geometry")
8
8
  export class WebwriterGeogebraGeometry extends GeogebraApp {
9
9
  constructor() {
10
10
  super()
11
11
  this.type = "geometry" as const
12
- this.showZoomButtons = true
13
- this.showFullscreenButton = true
14
12
  }
15
13
  }
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
2
2
  import { GeogebraApp } from "../components/geogebra-app"
3
3
 
4
4
  /**
5
- * A GeoGebra Notes widget.
5
+ * GeoGebra Notes (type "notes"): a whiteboard with pen, shapes, text and math input; use it for sketches, handwritten solutions and free notes. Load a saved board with `src` or leave it out for an empty board.
6
6
  */
7
7
  @customElement("webwriter-geogebra-notes")
8
8
  export class WebwriterGeogebraNotes extends GeogebraApp {
9
9
  constructor() {
10
10
  super()
11
11
  this.type = "notes" as const
12
- this.showZoomButtons = true
13
- this.showFullscreenButton = true
14
12
  }
15
13
  }
@@ -2,14 +2,12 @@ import {customElement} from "lit/decorators.js"
2
2
  import { GeogebraApp } from "../components/geogebra-app"
3
3
 
4
4
  /**
5
- * A GeoGebra Scientific Calculator widget.
5
+ * GeoGebra Scientific Calculator (type "scientific"): a calculator for fractions, powers, roots, trigonometry and logarithms; use it when learners need a calculator but no graphs or constructions. It is normally used without `src`.
6
6
  */
7
7
  @customElement("webwriter-geogebra-scientific")
8
8
  export class WebwriterGeogebraScientific extends GeogebraApp {
9
9
  constructor() {
10
10
  super()
11
11
  this.type = "scientific" as const
12
- this.showZoomButtons = true
13
- this.showFullscreenButton = true
14
12
  }
15
13
  }
@@ -3,15 +3,15 @@ import {customElement} from "lit/decorators.js"
3
3
  import { GeogebraApp } from "../components/geogebra-app"
4
4
 
5
5
  /**
6
- * A GeoGebra Calculator Suite widget.
6
+ * GeoGebra Calculator Suite (type "suite"): learners switch between GeoGebra's graphing, geometry, 3D and CAS calculators in one applet; use it for open exploration. Load a construction with `src` or leave it out for a blank app.
7
+ *
8
+ * Unlike the other tags, it has no undo and redo buttons (its `ggbstyles` hide them) and `enablefilefeatures` defaults to "false".
7
9
  */
8
10
  @customElement("webwriter-geogebra")
9
11
  export class WebwriterGeogebra extends GeogebraApp {
10
12
  constructor() {
11
13
  super()
12
14
  this.type = "suite" as const
13
- this.showZoomButtons = true
14
- this.showFullscreenButton = true
15
15
  this.enableFileFeatures = false
16
16
  this.enableUndoRedo = false
17
17
 
@@ -75,6 +75,12 @@ describe("presentation", function () {
75
75
  assert.isTrue(await until(() => widget.shadowRoot.querySelector("iframe") !== frame));
76
76
  });
77
77
 
78
+ it("shows the zoom and fullscreen buttons unless an attribute turns them off", async function () {
79
+ const widget = await mountIn(`<webwriter-geogebra-classic showfullscreenbutton="false"></webwriter-geogebra-classic>`, "webwriter-geogebra-classic");
80
+ assert.isTrue(widget.ggbProperties.showZoomButtons);
81
+ assert.isFalse(widget.ggbProperties.showFullscreenButton);
82
+ });
83
+
78
84
  it("sizes the applet to the container at 300 and 2100 px", async function () {
79
85
  this.timeout(15000);
80
86
  const widget = await mountIn(`<div style="width: 300px"><webwriter-geogebra-classic></webwriter-geogebra-classic></div>`, "webwriter-geogebra-classic");