@webwriter/geogebra 1.1.0 → 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 +280 -124
- package/custom-elements.json +2255 -1259
- package/dist/chunks/af-35CD6HFH.js +12 -0
- package/dist/chunks/am-JMDT5LI7.js +12 -0
- package/dist/chunks/ar-JL4QKYYL.js +12 -0
- package/dist/chunks/az-3SZS6WCY.js +12 -0
- package/dist/chunks/be-C4GWVHR2.js +12 -0
- package/dist/chunks/bg-6QGE5EQ4.js +12 -0
- package/dist/chunks/bn-UM2BV46R.js +12 -0
- package/dist/chunks/bs-XE2PWKCS.js +12 -0
- package/dist/chunks/ca-ZO2BQKPZ.js +12 -0
- package/dist/chunks/ca-balear-GJKWY5R7.js +12 -0
- package/dist/chunks/ca-valencia-CNQYSJSJ.js +12 -0
- package/dist/chunks/chunk-ANJTU3IB.js +203 -0
- package/dist/chunks/chunk-BSUFUO7E.js +65 -0
- package/dist/chunks/chunk-RYZMQM25.js +789 -0
- package/dist/chunks/cnr-MCZGASOD.js +12 -0
- package/dist/chunks/cs-4Q7FRISG.js +12 -0
- package/dist/chunks/cy-7VXG3AYH.js +12 -0
- package/dist/chunks/da-VDMHGBXD.js +12 -0
- package/dist/chunks/de-AT-YM5GCI75.js +12 -0
- package/dist/chunks/de-CH-LQNHTGYT.js +12 -0
- package/dist/chunks/de-GJT7RSHT.js +12 -0
- package/dist/chunks/el-ZVUVWEQ3.js +12 -0
- package/dist/chunks/en-AU-PCIYYC4M.js +12 -0
- package/dist/chunks/en-CA-37T7YUIL.js +12 -0
- package/dist/chunks/en-GB-ZYCA2CIZ.js +12 -0
- package/dist/chunks/en-IN-EPHXLNO6.js +12 -0
- package/dist/chunks/en-US-ECSJ5HDL.js +12 -0
- package/dist/chunks/es-5VBYK2HE.js +12 -0
- package/dist/chunks/et-OFQRRTW6.js +12 -0
- package/dist/chunks/eu-7TNOYFB7.js +12 -0
- package/dist/chunks/fa-KZU6GKWU.js +12 -0
- package/dist/chunks/fi-THJEKJPW.js +12 -0
- package/dist/chunks/fr-MUVVTBQZ.js +12 -0
- package/dist/chunks/ga-UWUVCWOT.js +12 -0
- package/dist/chunks/gl-NHQ52YCN.js +12 -0
- package/dist/chunks/gu-HVDD4QHO.js +12 -0
- package/dist/chunks/ha-2BPTATOZ.js +12 -0
- package/dist/chunks/he-MDESCUHJ.js +12 -0
- package/dist/chunks/hi-C6BGPR4Y.js +12 -0
- package/dist/chunks/hr-77MP3ELT.js +12 -0
- package/dist/chunks/hu-7PRNX6NB.js +12 -0
- package/dist/chunks/hy-R3VEL63L.js +12 -0
- package/dist/chunks/id-O6B2T3Y2.js +12 -0
- package/dist/chunks/is-XLNS5CAZ.js +12 -0
- package/dist/chunks/it-NZODUGUP.js +12 -0
- package/dist/chunks/ja-FFK5WXSB.js +12 -0
- package/dist/chunks/jv-GS3IRAIB.js +12 -0
- package/dist/chunks/ka-NWIJAO54.js +12 -0
- package/dist/chunks/kk-WQFRFG44.js +12 -0
- package/dist/chunks/km-AUKBN3YT.js +12 -0
- package/dist/chunks/kn-PKZFPECM.js +12 -0
- package/dist/chunks/ko-XNGAWKQ4.js +12 -0
- package/dist/chunks/ky-AQTYDJIL.js +12 -0
- package/dist/chunks/la-ERS7V4N4.js +12 -0
- package/dist/chunks/lb-KU3DVPI4.js +12 -0
- package/dist/chunks/locale-codes-TGY5LMYX.js +11 -0
- package/dist/chunks/lt-6RI4HSG3.js +12 -0
- package/dist/chunks/lv-RGIUQVA7.js +12 -0
- package/dist/chunks/mk-JMAYXTCL.js +12 -0
- package/dist/chunks/ml-5ZAIPAYV.js +12 -0
- package/dist/chunks/mn-N2GZBVDP.js +12 -0
- package/dist/chunks/mr-2SRCJIBC.js +12 -0
- package/dist/chunks/ms-WHD5PUQM.js +12 -0
- package/dist/chunks/mt-EXRK5UO6.js +12 -0
- package/dist/chunks/my-D2COGDRI.js +12 -0
- package/dist/chunks/nb-3XNBS2DU.js +12 -0
- package/dist/chunks/ne-PA4KUBGU.js +12 -0
- package/dist/chunks/nl-QMM3PBPM.js +12 -0
- package/dist/chunks/nn-CLFEMF2K.js +12 -0
- package/dist/chunks/no-CV376NZG.js +12 -0
- package/dist/chunks/or-KP7CET7X.js +12 -0
- package/dist/chunks/pa-CH5JYVXT.js +12 -0
- package/dist/chunks/pl-DDW4HT7M.js +12 -0
- package/dist/chunks/pt-BR-CVNA2MRU.js +12 -0
- package/dist/chunks/pt-CRTRYTDJ.js +12 -0
- package/dist/chunks/pt-PT-IZMPF3BY.js +12 -0
- package/dist/chunks/ro-FUOGHWJA.js +12 -0
- package/dist/chunks/ru-KAT4X5EC.js +12 -0
- package/dist/chunks/si-GDAXEOBK.js +12 -0
- package/dist/chunks/sk-CDSK6MY5.js +12 -0
- package/dist/chunks/sl-TFJQYNA4.js +12 -0
- package/dist/chunks/so-TXI6JJPW.js +12 -0
- package/dist/chunks/sq-KMM2QIRU.js +12 -0
- package/dist/chunks/sr-OTZNEL5Z.js +12 -0
- package/dist/chunks/sv-7CANJ6CF.js +12 -0
- package/dist/chunks/sw-5JDMTJ5K.js +12 -0
- package/dist/chunks/ta-HT4SO7PD.js +12 -0
- package/dist/chunks/te-FECCLHOI.js +12 -0
- package/dist/chunks/tg-FJWFJWF2.js +12 -0
- package/dist/chunks/th-JEP434LN.js +12 -0
- package/dist/chunks/tl-GN35ZR2F.js +12 -0
- package/dist/chunks/tr-IPVLQUE4.js +12 -0
- package/dist/chunks/uk-LHWPGFRV.js +12 -0
- package/dist/chunks/ur-7FU4XRAY.js +12 -0
- package/dist/chunks/uz-RO7XCKFE.js +12 -0
- package/dist/chunks/vi-5PHPTVV4.js +12 -0
- package/dist/chunks/zh-Hans-UM7MUEDB.js +12 -0
- package/dist/chunks/zh-Hant-7M2P4G7R.js +12 -0
- package/dist/chunks/zh-LHCPWZN2.js +12 -0
- package/dist/widgets/webwriter-geogebra-3d.js +19 -25827
- package/dist/widgets/webwriter-geogebra-classic.js +18 -25826
- package/dist/widgets/webwriter-geogebra-geometry.js +18 -25826
- package/dist/widgets/webwriter-geogebra-notes.js +18 -25826
- package/dist/widgets/webwriter-geogebra-scientific.js +18 -25826
- package/dist/widgets/webwriter-geogebra.js +20 -25830
- package/editing-config.json +839 -20
- package/lit-localize.json +73 -9
- package/localization/af.xlf +290 -0
- package/localization/am.xlf +290 -0
- package/localization/ar.xlf +271 -6
- package/localization/az.xlf +290 -0
- package/localization/be.xlf +290 -0
- package/localization/bg.xlf +271 -6
- package/localization/bn.xlf +290 -0
- package/localization/bs.xlf +290 -0
- package/localization/ca-balear.xlf +290 -0
- package/localization/ca-valencia.xlf +290 -0
- package/localization/ca.xlf +290 -0
- package/localization/cnr.xlf +290 -0
- package/localization/cs.xlf +271 -6
- package/localization/cy.xlf +290 -0
- package/localization/da.xlf +271 -6
- package/localization/de-AT.xlf +294 -0
- package/localization/de-CH.xlf +294 -0
- package/localization/de.xlf +271 -6
- package/localization/el.xlf +271 -6
- package/localization/es.xlf +271 -6
- package/localization/et.xlf +271 -6
- package/localization/eu.xlf +290 -0
- package/localization/fa.xlf +290 -0
- package/localization/fi.xlf +271 -6
- package/localization/fr.xlf +271 -6
- package/localization/ga.xlf +290 -0
- package/localization/generated/af.ts +16 -0
- package/localization/generated/am.ts +16 -0
- package/localization/generated/ar.ts +6 -12
- package/localization/generated/az.ts +16 -0
- package/localization/generated/be.ts +16 -0
- package/localization/generated/bg.ts +6 -12
- package/localization/generated/bn.ts +16 -0
- package/localization/generated/bs.ts +16 -0
- package/localization/generated/ca-balear.ts +16 -0
- package/localization/generated/ca-valencia.ts +16 -0
- package/localization/generated/ca.ts +16 -0
- package/localization/generated/cnr.ts +16 -0
- package/localization/generated/cs.ts +6 -12
- package/localization/generated/cy.ts +16 -0
- package/localization/generated/da.ts +6 -12
- package/localization/generated/de-AT.ts +16 -0
- package/localization/generated/de-CH.ts +16 -0
- package/localization/generated/de.ts +6 -11
- package/localization/generated/el.ts +6 -12
- package/localization/generated/en-AU.ts +16 -0
- package/localization/generated/en-CA.ts +16 -0
- package/localization/generated/en-GB.ts +16 -0
- package/localization/generated/en-IN.ts +16 -0
- package/localization/generated/en-US.ts +16 -0
- package/localization/generated/es.ts +6 -12
- package/localization/generated/et.ts +6 -12
- package/localization/generated/eu.ts +16 -0
- package/localization/generated/fa.ts +16 -0
- package/localization/generated/fi.ts +6 -12
- package/localization/generated/fr.ts +6 -12
- package/localization/generated/ga.ts +16 -0
- package/localization/generated/gl.ts +16 -0
- package/localization/generated/gu.ts +16 -0
- package/localization/generated/ha.ts +16 -0
- package/localization/generated/he.ts +16 -0
- package/localization/generated/hi.ts +16 -0
- package/localization/generated/hr.ts +16 -0
- package/localization/generated/hu.ts +6 -12
- package/localization/generated/hy.ts +16 -0
- package/localization/generated/id.ts +6 -12
- package/localization/generated/is.ts +16 -0
- package/localization/generated/it.ts +6 -12
- package/localization/generated/ja.ts +6 -12
- package/localization/generated/jv.ts +16 -0
- package/localization/generated/ka.ts +16 -0
- package/localization/generated/kk.ts +16 -0
- package/localization/generated/km.ts +16 -0
- package/localization/generated/kn.ts +16 -0
- package/localization/generated/ko.ts +6 -12
- package/localization/generated/ky.ts +16 -0
- package/localization/generated/la.ts +16 -0
- package/localization/generated/lb.ts +16 -0
- package/localization/generated/locale-codes.ts +211 -0
- package/localization/generated/lt.ts +6 -12
- package/localization/generated/lv.ts +6 -12
- package/localization/generated/mk.ts +16 -0
- package/localization/generated/ml.ts +16 -0
- package/localization/generated/mn.ts +16 -0
- package/localization/generated/mr.ts +16 -0
- package/localization/generated/ms.ts +16 -0
- package/localization/generated/mt.ts +16 -0
- package/localization/generated/my.ts +16 -0
- package/localization/generated/nb.ts +6 -12
- package/localization/generated/ne.ts +16 -0
- package/localization/generated/nl.ts +6 -12
- package/localization/generated/nn.ts +16 -0
- package/localization/generated/no.ts +16 -0
- package/localization/generated/or.ts +16 -0
- package/localization/generated/pa.ts +16 -0
- package/localization/generated/pl.ts +6 -12
- package/localization/generated/pt-BR.ts +6 -12
- package/localization/generated/pt-PT.ts +6 -12
- package/localization/generated/pt.ts +16 -0
- package/localization/generated/ro.ts +6 -12
- package/localization/generated/ru.ts +6 -12
- package/localization/generated/si.ts +16 -0
- package/localization/generated/sk.ts +6 -12
- package/localization/generated/sl.ts +6 -12
- package/localization/generated/so.ts +16 -0
- package/localization/generated/sq.ts +16 -0
- package/localization/generated/sr.ts +16 -0
- package/localization/generated/sv.ts +6 -12
- package/localization/generated/sw.ts +16 -0
- package/localization/generated/ta.ts +16 -0
- package/localization/generated/te.ts +16 -0
- package/localization/generated/tg.ts +16 -0
- package/localization/generated/th.ts +16 -0
- package/localization/generated/tl.ts +16 -0
- package/localization/generated/tr.ts +6 -12
- package/localization/generated/uk.ts +6 -12
- package/localization/generated/ur.ts +16 -0
- package/localization/generated/uz.ts +16 -0
- package/localization/generated/vi.ts +16 -0
- package/localization/generated/zh-Hans.ts +16 -0
- package/localization/generated/zh-Hant.ts +16 -0
- package/localization/generated/zh.ts +16 -0
- package/localization/gl.xlf +290 -0
- package/localization/gu.xlf +290 -0
- package/localization/ha.xlf +290 -0
- package/localization/he.xlf +290 -0
- package/localization/hi.xlf +290 -0
- package/localization/hr.xlf +290 -0
- package/localization/hu.xlf +271 -6
- package/localization/hy.xlf +290 -0
- package/localization/id.xlf +271 -6
- package/localization/is.xlf +290 -0
- package/localization/it.xlf +271 -6
- package/localization/ja.xlf +271 -6
- package/localization/jv.xlf +290 -0
- package/localization/ka.xlf +290 -0
- package/localization/kk.xlf +290 -0
- package/localization/km.xlf +290 -0
- package/localization/kn.xlf +290 -0
- package/localization/ko.xlf +271 -6
- package/localization/ky.xlf +290 -0
- package/localization/la.xlf +290 -0
- package/localization/lb.xlf +290 -0
- package/localization/lt.xlf +271 -6
- package/localization/lv.xlf +271 -6
- package/localization/mk.xlf +290 -0
- package/localization/ml.xlf +290 -0
- package/localization/mn.xlf +290 -0
- package/localization/mr.xlf +290 -0
- package/localization/ms.xlf +290 -0
- package/localization/mt.xlf +290 -0
- package/localization/my.xlf +290 -0
- package/localization/nb.xlf +271 -6
- package/localization/ne.xlf +290 -0
- package/localization/nl.xlf +271 -6
- package/localization/nn.xlf +290 -0
- package/localization/no.xlf +295 -0
- package/localization/or.xlf +290 -0
- package/localization/pa.xlf +290 -0
- package/localization/pl.xlf +271 -6
- package/localization/pt-BR.xlf +271 -6
- package/localization/pt-PT.xlf +271 -6
- package/localization/pt.xlf +295 -0
- package/localization/ro.xlf +271 -6
- package/localization/ru.xlf +271 -6
- package/localization/si.xlf +290 -0
- package/localization/sk.xlf +271 -6
- package/localization/sl.xlf +271 -6
- package/localization/so.xlf +290 -0
- package/localization/sq.xlf +290 -0
- package/localization/sr.xlf +290 -0
- package/localization/sv.xlf +271 -6
- package/localization/sw.xlf +290 -0
- package/localization/ta.xlf +290 -0
- package/localization/te.xlf +290 -0
- package/localization/tg.xlf +290 -0
- package/localization/th.xlf +290 -0
- package/localization/tl.xlf +290 -0
- package/localization/tr.xlf +271 -6
- package/localization/uk.xlf +271 -6
- package/localization/ur.xlf +290 -0
- package/localization/uz.xlf +290 -0
- package/localization/vi.xlf +290 -0
- package/localization/zh-Hans.xlf +295 -0
- package/localization/zh-Hant.xlf +295 -0
- package/localization/zh.xlf +295 -0
- package/package.json +194 -86
- package/src/components/geogebra-app.styles.ts +47 -0
- package/{components → src/components}/geogebra-app.ts +237 -332
- package/src/model/geogebra-api.ts +148 -0
- package/src/model/geogebra-options.ts +72 -0
- package/src/model/geogebra-parameters.ts +53 -0
- package/src/model/ggb-file.ts +30 -0
- package/src/types.d.ts +3 -0
- package/{widgets → src/widgets}/webwriter-geogebra-3d.ts +1 -1
- package/{widgets → src/widgets}/webwriter-geogebra.ts +1 -2
- package/tests/conversions.test.ts +80 -0
- package/tests/data-block.test.ts +72 -0
- package/tests/helpers.ts +48 -0
- package/tests/language.test.ts +49 -0
- package/tests/presentation.test.ts +114 -0
- package/tsconfig.json +3 -7
- package/assets/icons/file-earmark-arrow-up.svg +0 -4
- package/components/geogebra-app.styles.ts +0 -10
- package/components/geogebra-options.styles.ts +0 -37
- package/components/geogebra-options.ts +0 -187
- package/custom.d.ts +0 -180
- package/dist/widgets/webwriter-geogebra-3d.css +0 -444
- package/dist/widgets/webwriter-geogebra-classic.css +0 -444
- package/dist/widgets/webwriter-geogebra-geometry.css +0 -444
- package/dist/widgets/webwriter-geogebra-notes.css +0 -444
- package/dist/widgets/webwriter-geogebra-scientific.css +0 -444
- package/dist/widgets/webwriter-geogebra.css +0 -444
- package/localization/generated/locale-codes.js +0 -83
- package/localization/generated/zh-hans.ts +0 -20
- package/localization/generated/zh-hant.ts +0 -20
- package/localization/zh-hans.xlf +0 -30
- package/localization/zh-hant.xlf +0 -30
- package/widgets/webwriter-geogebra-evaluator.ts +0 -15
- /package/.github/workflows/{main.yml → publish.yml} +0 -0
- /package/localization/pkg/{zh-hans.xliff → zh-Hans.xliff} +0 -0
- /package/localization/pkg/{zh-hant.xliff → zh-Hant.xliff} +0 -0
- /package/localization/snippets/{zh-hans.xliff → zh-Hans.xliff} +0 -0
- /package/localization/snippets/{zh-hant.xliff → zh-Hant.xliff} +0 -0
- /package/{utils → src/model}/boolean-attribute-converter.ts +0 -0
- /package/{widgets → src/widgets}/webwriter-geogebra-classic.ts +0 -0
- /package/{widgets → src/widgets}/webwriter-geogebra-geometry.ts +0 -0
- /package/{widgets → src/widgets}/webwriter-geogebra-notes.ts +0 -0
- /package/{widgets → src/widgets}/webwriter-geogebra-scientific.ts +0 -0
|
@@ -0,0 +1,789 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sourceLocale,
|
|
3
|
+
targetLocales
|
|
4
|
+
} from "./chunk-ANJTU3IB.js";
|
|
5
|
+
import {
|
|
6
|
+
__decorateElement,
|
|
7
|
+
__decoratorMetadata,
|
|
8
|
+
__decoratorStart,
|
|
9
|
+
__glob,
|
|
10
|
+
__privateAdd,
|
|
11
|
+
__privateGet,
|
|
12
|
+
__publicField,
|
|
13
|
+
__runInitializers
|
|
14
|
+
} from "./chunk-BSUFUO7E.js";
|
|
15
|
+
|
|
16
|
+
// src/components/geogebra-app.ts
|
|
17
|
+
import { LitElementWw } from "@webwriter/lit";
|
|
18
|
+
import { localizer } from "@webwriter/lit/localize";
|
|
19
|
+
import { jsonData } from "@webwriter/lit/data";
|
|
20
|
+
import { html, css as css2 } from "lit";
|
|
21
|
+
import { property, state } from "lit/decorators.js";
|
|
22
|
+
import { keyed } from "lit/directives/keyed.js";
|
|
23
|
+
|
|
24
|
+
// src/components/geogebra-app.styles.ts
|
|
25
|
+
import { css } from "lit";
|
|
26
|
+
var geogebraAppStyles = css`
|
|
27
|
+
:host {
|
|
28
|
+
display: block;
|
|
29
|
+
box-sizing: border-box;
|
|
30
|
+
min-width: 300px;
|
|
31
|
+
max-width: 2100px;
|
|
32
|
+
min-height: 18rem;
|
|
33
|
+
color: var(--ww-text-color, inherit);
|
|
34
|
+
font-family: var(--ww-font-family, inherit);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
iframe {
|
|
38
|
+
display: block;
|
|
39
|
+
border: none;
|
|
40
|
+
width: 100%;
|
|
41
|
+
aspect-ratio: 16/9;
|
|
42
|
+
min-height: 18rem;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
iframe:focus-visible {
|
|
46
|
+
outline: 2px solid var(--ww-link-color, currentColor);
|
|
47
|
+
outline-offset: -2px;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.print-note {
|
|
51
|
+
display: none;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media print {
|
|
55
|
+
:host {
|
|
56
|
+
max-width: 100%;
|
|
57
|
+
break-inside: avoid;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.applet:not([data-ready]) iframe {
|
|
61
|
+
display: none;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
.applet:not([data-ready]) .print-note {
|
|
65
|
+
display: block;
|
|
66
|
+
padding: 0.75rem;
|
|
67
|
+
border: 1px solid currentColor;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
`;
|
|
71
|
+
|
|
72
|
+
// src/model/boolean-attribute-converter.ts
|
|
73
|
+
var booleanAttributeConverter = {
|
|
74
|
+
fromAttribute(value) {
|
|
75
|
+
return value === "true";
|
|
76
|
+
},
|
|
77
|
+
toAttribute(value) {
|
|
78
|
+
return value ? "true" : "false";
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
// src/model/geogebra-options.ts
|
|
83
|
+
var geogebraOptions = {
|
|
84
|
+
type: { type: "select", control: "select", label: (widget) => ({ _: widget.msg("Type") }), options: [
|
|
85
|
+
{ value: "classic", label: (widget) => ({ _: widget.msg("Classic") }) },
|
|
86
|
+
{ value: "geometry", label: (widget) => ({ _: widget.msg("Geometry") }) },
|
|
87
|
+
{ value: "3d", label: (widget) => ({ _: widget.msg("3D") }) },
|
|
88
|
+
{ value: "suite", label: (widget) => ({ _: widget.msg("Calculator Suite") }) },
|
|
89
|
+
{ value: "evaluator", label: (widget) => ({ _: widget.msg("Evaluator") }) },
|
|
90
|
+
{ value: "scientific", label: (widget) => ({ _: widget.msg("Scientific") }) },
|
|
91
|
+
{ value: "notes", label: (widget) => ({ _: widget.msg("Notes") }) }
|
|
92
|
+
] },
|
|
93
|
+
borderColor: { type: String, label: (widget) => ({ _: widget.msg("Border color") }) },
|
|
94
|
+
borderRadius: { type: Number, label: (widget) => ({ _: widget.msg("Border radius") }) },
|
|
95
|
+
enableRightClick: { type: Boolean, label: (widget) => ({ _: widget.msg("Enable right click") }) },
|
|
96
|
+
enableLabelDrags: { type: Boolean, label: (widget) => ({ _: widget.msg("Allow dragging labels") }) },
|
|
97
|
+
enableShiftDragZoom: { type: Boolean, label: (widget) => ({ _: widget.msg("Enable Shift-drag zoom") }) },
|
|
98
|
+
showZoomButtons: { type: Boolean, label: (widget) => ({ _: widget.msg("Show zoom buttons") }) },
|
|
99
|
+
errorDialogsActive: { type: Boolean, label: (widget) => ({ _: widget.msg("Show error dialogs") }) },
|
|
100
|
+
showMenuBar: { type: Boolean, label: (widget) => ({ _: widget.msg("Show menu bar") }) },
|
|
101
|
+
showToolBar: { type: Boolean, label: (widget) => ({ _: widget.msg("Show toolbar") }) },
|
|
102
|
+
showToolBarHelp: { type: Boolean, label: (widget) => ({ _: widget.msg("Show toolbar help") }) },
|
|
103
|
+
customToolBar: { type: String, label: (widget) => ({ _: widget.msg("Custom toolbar") }) },
|
|
104
|
+
showAlgebraInput: { type: Boolean, label: (widget) => ({ _: widget.msg("Show algebra input") }) },
|
|
105
|
+
showResetIcon: { type: Boolean, label: (widget) => ({ _: widget.msg("Show reset icon") }) },
|
|
106
|
+
language: { type: String, label: (widget) => ({ _: widget.msg("Language") }) },
|
|
107
|
+
country: { type: String, label: (widget) => ({ _: widget.msg("Country") }) },
|
|
108
|
+
appletId: { type: String, label: (widget) => ({ _: widget.msg("Applet ID") }) },
|
|
109
|
+
allowStyleBar: { type: Boolean, label: (widget) => ({ _: widget.msg("Allow style bar") }) },
|
|
110
|
+
randomize: { type: Boolean, label: (widget) => ({ _: widget.msg("Randomize") }) },
|
|
111
|
+
randomSeed: { type: Number, label: (widget) => ({ _: widget.msg("Random seed") }) },
|
|
112
|
+
useBrowserForJs: { type: Boolean, label: (widget) => ({ _: widget.msg("Use browser for JavaScript") }) },
|
|
113
|
+
showLogging: { type: Boolean, label: (widget) => ({ _: widget.msg("Show log messages") }) },
|
|
114
|
+
capturingThreshold: { type: Number, label: (widget) => ({ _: widget.msg("Point capture threshold") }) },
|
|
115
|
+
enableFileFeatures: { type: Boolean, label: (widget) => ({ _: widget.msg("Enable file features") }) },
|
|
116
|
+
enableUndoRedo: { type: Boolean, label: (widget) => ({ _: widget.msg("Enable undo and redo") }) },
|
|
117
|
+
perspective: { type: String, label: (widget) => ({ _: widget.msg("Perspective") }) },
|
|
118
|
+
enable3d: { type: Boolean, label: (widget) => ({ _: widget.msg("Enable 3D") }) },
|
|
119
|
+
enableCAS: { type: Boolean, label: (widget) => ({ _: widget.msg("Enable CAS") }) },
|
|
120
|
+
algebraInputPosition: { type: "select", label: (widget) => ({ _: widget.msg("Algebra input position") }), options: [
|
|
121
|
+
{ value: "algebra", label: (widget) => ({ _: widget.msg("Algebra") }) },
|
|
122
|
+
{ value: "top", label: (widget) => ({ _: widget.msg("Top") }) },
|
|
123
|
+
{ value: "bottom", label: (widget) => ({ _: widget.msg("Bottom") }) }
|
|
124
|
+
] },
|
|
125
|
+
preventFocus: { type: Boolean, label: (widget) => ({ _: widget.msg("Prevent focus") }) },
|
|
126
|
+
scaleContainerClass: { type: String, label: (widget) => ({ _: widget.msg("Scale container CSS class") }) },
|
|
127
|
+
autoHeight: { type: Boolean, label: (widget) => ({ _: widget.msg("Automatic height") }) },
|
|
128
|
+
allowUpscale: { type: Boolean, label: (widget) => ({ _: widget.msg("Allow upscaling") }) },
|
|
129
|
+
playButton: { type: Boolean, label: (widget) => ({ _: widget.msg("Play button") }) },
|
|
130
|
+
scale: { type: Number, label: (widget) => ({ _: widget.msg("Scale") }) },
|
|
131
|
+
showAnimationButton: { type: Boolean, label: (widget) => ({ _: widget.msg("Show animation button") }) },
|
|
132
|
+
showFullscreenButton: { type: Boolean, label: (widget) => ({ _: widget.msg("Show fullscreen button") }) },
|
|
133
|
+
showSuggestionButtons: { type: Boolean, label: (widget) => ({ _: widget.msg("Show suggestion buttons") }) },
|
|
134
|
+
showStartTooltip: { type: Boolean, label: (widget) => ({ _: widget.msg("Show startup tooltip") }) },
|
|
135
|
+
rounding: { type: String, label: (widget) => ({ _: widget.msg("Rounding") }) },
|
|
136
|
+
buttonShadows: { type: Boolean, label: (widget) => ({ _: widget.msg("Button shadows") }) },
|
|
137
|
+
buttonRounding: { type: Number, label: (widget) => ({ _: widget.msg("Button corner rounding") }) },
|
|
138
|
+
buttonBorderColor: { type: String, label: (widget) => ({ _: widget.msg("Button border color") }) },
|
|
139
|
+
editorBackgroundColor: { type: String, label: (widget) => ({ _: widget.msg("Editor background color") }) },
|
|
140
|
+
editorForegroundColor: { type: String, label: (widget) => ({ _: widget.msg("Editor foreground color") }) },
|
|
141
|
+
textmode: { type: Boolean, label: (widget) => ({ _: widget.msg("Text mode") }) },
|
|
142
|
+
showKeyboardOnFocus: { type: Boolean, label: (widget) => ({ _: widget.msg("Show keyboard on focus") }) },
|
|
143
|
+
keyboardType: { type: "select", label: (widget) => ({ _: widget.msg("Keyboard type") }), options: [
|
|
144
|
+
{ value: "scientific", label: (widget) => ({ _: widget.msg("Scientific") }) },
|
|
145
|
+
{ value: "normal", label: (widget) => ({ _: widget.msg("Normal") }) },
|
|
146
|
+
{ value: "notes", label: (widget) => ({ _: widget.msg("Notes") }) }
|
|
147
|
+
] },
|
|
148
|
+
transparentGraphics: { type: Boolean, label: (widget) => ({ _: widget.msg("Transparent graphics") }) },
|
|
149
|
+
disabledJavaScript: { type: Boolean, label: (widget) => ({ _: widget.msg("Disable JavaScript") }) },
|
|
150
|
+
detachedKeyboardParent: { type: String, label: (widget) => ({ _: widget.msg("Detached keyboard parent") }) }
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
// src/model/geogebra-parameters.ts
|
|
154
|
+
var passThroughParameters = [
|
|
155
|
+
"width",
|
|
156
|
+
"height",
|
|
157
|
+
"borderColor",
|
|
158
|
+
"borderRadius",
|
|
159
|
+
"enableRightClick",
|
|
160
|
+
"enableLabelDrags",
|
|
161
|
+
"enableShiftDragZoom",
|
|
162
|
+
"showZoomButtons",
|
|
163
|
+
"errorDialogsActive",
|
|
164
|
+
"showMenuBar",
|
|
165
|
+
"showToolBar",
|
|
166
|
+
"showToolBarHelp",
|
|
167
|
+
"customToolBar",
|
|
168
|
+
"showAlgebraInput",
|
|
169
|
+
"showResetIcon"
|
|
170
|
+
];
|
|
171
|
+
var passThroughParametersAfterLocale = [
|
|
172
|
+
"allowStyleBar",
|
|
173
|
+
"randomize",
|
|
174
|
+
"randomSeed",
|
|
175
|
+
"useBrowserForJs",
|
|
176
|
+
"showLogging",
|
|
177
|
+
"capturingThreshold",
|
|
178
|
+
"enableFileFeatures",
|
|
179
|
+
"perspective",
|
|
180
|
+
"enable3d",
|
|
181
|
+
"enableCAS",
|
|
182
|
+
"algebraInputPosition",
|
|
183
|
+
"preventFocus",
|
|
184
|
+
"scaleContainerClass",
|
|
185
|
+
"autoHeight",
|
|
186
|
+
"allowUpscale",
|
|
187
|
+
"playButton",
|
|
188
|
+
"scale",
|
|
189
|
+
"showAnimationButton",
|
|
190
|
+
"showFullscreenButton",
|
|
191
|
+
"showSuggestionButtons",
|
|
192
|
+
"showStartTooltip",
|
|
193
|
+
"rounding",
|
|
194
|
+
"buttonShadows",
|
|
195
|
+
"buttonRounding",
|
|
196
|
+
"buttonBorderColor",
|
|
197
|
+
"editorBackgroundColor",
|
|
198
|
+
"editorForegroundColor",
|
|
199
|
+
"textmode",
|
|
200
|
+
"showKeyboardOnFocus",
|
|
201
|
+
"keyboardType",
|
|
202
|
+
"transparentGraphics",
|
|
203
|
+
"disabledJavaScript",
|
|
204
|
+
"detachedKeyboardParent"
|
|
205
|
+
];
|
|
206
|
+
function appletParameters(source, lang, sourceLocale2) {
|
|
207
|
+
let locale;
|
|
208
|
+
try {
|
|
209
|
+
locale = new Intl.Locale(lang.trim() || sourceLocale2);
|
|
210
|
+
} catch (error) {
|
|
211
|
+
if (!(error instanceof RangeError)) throw error;
|
|
212
|
+
locale = new Intl.Locale(sourceLocale2);
|
|
213
|
+
}
|
|
214
|
+
let filename, material_id, ggbBase64;
|
|
215
|
+
const { src, language } = source;
|
|
216
|
+
if (src?.startsWith("data:")) ggbBase64 = src.split(",").at(-1);
|
|
217
|
+
else if (src?.startsWith("ggbid:")) material_id = src.slice("ggbid:".length);
|
|
218
|
+
else if (src) filename = src;
|
|
219
|
+
const pick = (keys) => Object.fromEntries(keys.map((key) => [key, source[key]]));
|
|
220
|
+
return {
|
|
221
|
+
id: source.appletId,
|
|
222
|
+
appName: source.type,
|
|
223
|
+
filename,
|
|
224
|
+
material_id,
|
|
225
|
+
ggbBase64,
|
|
226
|
+
...pick(passThroughParameters),
|
|
227
|
+
language: language ?? locale.language,
|
|
228
|
+
country: source.country ?? (language ? void 0 : locale.region ?? (locale.script ? locale.maximize().region : void 0)),
|
|
229
|
+
...pick(passThroughParametersAfterLocale)
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
// src/model/ggb-file.ts
|
|
234
|
+
var GGB_MEDIA_TYPE = "application/vnd.geogebra.file";
|
|
235
|
+
var ZIP_MAGIC = [80, 75, 3, 4];
|
|
236
|
+
function isGgbArchive(bytes) {
|
|
237
|
+
return bytes.length > ZIP_MAGIC.length && ZIP_MAGIC.every((value, index) => bytes[index] === value);
|
|
238
|
+
}
|
|
239
|
+
function bytesToBase64(bytes) {
|
|
240
|
+
let binary = "";
|
|
241
|
+
for (let index = 0; index < bytes.length; index += 32768) {
|
|
242
|
+
binary += String.fromCharCode(...bytes.subarray(index, index + 32768));
|
|
243
|
+
}
|
|
244
|
+
return btoa(binary);
|
|
245
|
+
}
|
|
246
|
+
function base64ToBytes(base64) {
|
|
247
|
+
const binary = atob(base64);
|
|
248
|
+
const bytes = new Uint8Array(binary.length);
|
|
249
|
+
for (let index = 0; index < binary.length; index++) bytes[index] = binary.charCodeAt(index);
|
|
250
|
+
return bytes;
|
|
251
|
+
}
|
|
252
|
+
var ggbDataUrl = (base64) => `data:${GGB_MEDIA_TYPE};base64,${base64}`;
|
|
253
|
+
function dataUrlPayload(src) {
|
|
254
|
+
return src?.startsWith("data:") ? src.split(",").at(-1) : void 0;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
// import("../../localization/generated/**/*.ts") in src/components/geogebra-app.ts
|
|
258
|
+
var globImport_localization_generated_ts = __glob({
|
|
259
|
+
"../../localization/generated/af.ts": () => import("./af-35CD6HFH.js"),
|
|
260
|
+
"../../localization/generated/am.ts": () => import("./am-JMDT5LI7.js"),
|
|
261
|
+
"../../localization/generated/ar.ts": () => import("./ar-JL4QKYYL.js"),
|
|
262
|
+
"../../localization/generated/az.ts": () => import("./az-3SZS6WCY.js"),
|
|
263
|
+
"../../localization/generated/be.ts": () => import("./be-C4GWVHR2.js"),
|
|
264
|
+
"../../localization/generated/bg.ts": () => import("./bg-6QGE5EQ4.js"),
|
|
265
|
+
"../../localization/generated/bn.ts": () => import("./bn-UM2BV46R.js"),
|
|
266
|
+
"../../localization/generated/bs.ts": () => import("./bs-XE2PWKCS.js"),
|
|
267
|
+
"../../localization/generated/ca-balear.ts": () => import("./ca-balear-GJKWY5R7.js"),
|
|
268
|
+
"../../localization/generated/ca-valencia.ts": () => import("./ca-valencia-CNQYSJSJ.js"),
|
|
269
|
+
"../../localization/generated/ca.ts": () => import("./ca-ZO2BQKPZ.js"),
|
|
270
|
+
"../../localization/generated/cnr.ts": () => import("./cnr-MCZGASOD.js"),
|
|
271
|
+
"../../localization/generated/cs.ts": () => import("./cs-4Q7FRISG.js"),
|
|
272
|
+
"../../localization/generated/cy.ts": () => import("./cy-7VXG3AYH.js"),
|
|
273
|
+
"../../localization/generated/da.ts": () => import("./da-VDMHGBXD.js"),
|
|
274
|
+
"../../localization/generated/de-AT.ts": () => import("./de-AT-YM5GCI75.js"),
|
|
275
|
+
"../../localization/generated/de-CH.ts": () => import("./de-CH-LQNHTGYT.js"),
|
|
276
|
+
"../../localization/generated/de.ts": () => import("./de-GJT7RSHT.js"),
|
|
277
|
+
"../../localization/generated/el.ts": () => import("./el-ZVUVWEQ3.js"),
|
|
278
|
+
"../../localization/generated/en-AU.ts": () => import("./en-AU-PCIYYC4M.js"),
|
|
279
|
+
"../../localization/generated/en-CA.ts": () => import("./en-CA-37T7YUIL.js"),
|
|
280
|
+
"../../localization/generated/en-GB.ts": () => import("./en-GB-ZYCA2CIZ.js"),
|
|
281
|
+
"../../localization/generated/en-IN.ts": () => import("./en-IN-EPHXLNO6.js"),
|
|
282
|
+
"../../localization/generated/en-US.ts": () => import("./en-US-ECSJ5HDL.js"),
|
|
283
|
+
"../../localization/generated/es.ts": () => import("./es-5VBYK2HE.js"),
|
|
284
|
+
"../../localization/generated/et.ts": () => import("./et-OFQRRTW6.js"),
|
|
285
|
+
"../../localization/generated/eu.ts": () => import("./eu-7TNOYFB7.js"),
|
|
286
|
+
"../../localization/generated/fa.ts": () => import("./fa-KZU6GKWU.js"),
|
|
287
|
+
"../../localization/generated/fi.ts": () => import("./fi-THJEKJPW.js"),
|
|
288
|
+
"../../localization/generated/fr.ts": () => import("./fr-MUVVTBQZ.js"),
|
|
289
|
+
"../../localization/generated/ga.ts": () => import("./ga-UWUVCWOT.js"),
|
|
290
|
+
"../../localization/generated/gl.ts": () => import("./gl-NHQ52YCN.js"),
|
|
291
|
+
"../../localization/generated/gu.ts": () => import("./gu-HVDD4QHO.js"),
|
|
292
|
+
"../../localization/generated/ha.ts": () => import("./ha-2BPTATOZ.js"),
|
|
293
|
+
"../../localization/generated/he.ts": () => import("./he-MDESCUHJ.js"),
|
|
294
|
+
"../../localization/generated/hi.ts": () => import("./hi-C6BGPR4Y.js"),
|
|
295
|
+
"../../localization/generated/hr.ts": () => import("./hr-77MP3ELT.js"),
|
|
296
|
+
"../../localization/generated/hu.ts": () => import("./hu-7PRNX6NB.js"),
|
|
297
|
+
"../../localization/generated/hy.ts": () => import("./hy-R3VEL63L.js"),
|
|
298
|
+
"../../localization/generated/id.ts": () => import("./id-O6B2T3Y2.js"),
|
|
299
|
+
"../../localization/generated/is.ts": () => import("./is-XLNS5CAZ.js"),
|
|
300
|
+
"../../localization/generated/it.ts": () => import("./it-NZODUGUP.js"),
|
|
301
|
+
"../../localization/generated/ja.ts": () => import("./ja-FFK5WXSB.js"),
|
|
302
|
+
"../../localization/generated/jv.ts": () => import("./jv-GS3IRAIB.js"),
|
|
303
|
+
"../../localization/generated/ka.ts": () => import("./ka-NWIJAO54.js"),
|
|
304
|
+
"../../localization/generated/kk.ts": () => import("./kk-WQFRFG44.js"),
|
|
305
|
+
"../../localization/generated/km.ts": () => import("./km-AUKBN3YT.js"),
|
|
306
|
+
"../../localization/generated/kn.ts": () => import("./kn-PKZFPECM.js"),
|
|
307
|
+
"../../localization/generated/ko.ts": () => import("./ko-XNGAWKQ4.js"),
|
|
308
|
+
"../../localization/generated/ky.ts": () => import("./ky-AQTYDJIL.js"),
|
|
309
|
+
"../../localization/generated/la.ts": () => import("./la-ERS7V4N4.js"),
|
|
310
|
+
"../../localization/generated/lb.ts": () => import("./lb-KU3DVPI4.js"),
|
|
311
|
+
"../../localization/generated/locale-codes.ts": () => import("./locale-codes-TGY5LMYX.js"),
|
|
312
|
+
"../../localization/generated/lt.ts": () => import("./lt-6RI4HSG3.js"),
|
|
313
|
+
"../../localization/generated/lv.ts": () => import("./lv-RGIUQVA7.js"),
|
|
314
|
+
"../../localization/generated/mk.ts": () => import("./mk-JMAYXTCL.js"),
|
|
315
|
+
"../../localization/generated/ml.ts": () => import("./ml-5ZAIPAYV.js"),
|
|
316
|
+
"../../localization/generated/mn.ts": () => import("./mn-N2GZBVDP.js"),
|
|
317
|
+
"../../localization/generated/mr.ts": () => import("./mr-2SRCJIBC.js"),
|
|
318
|
+
"../../localization/generated/ms.ts": () => import("./ms-WHD5PUQM.js"),
|
|
319
|
+
"../../localization/generated/mt.ts": () => import("./mt-EXRK5UO6.js"),
|
|
320
|
+
"../../localization/generated/my.ts": () => import("./my-D2COGDRI.js"),
|
|
321
|
+
"../../localization/generated/nb.ts": () => import("./nb-3XNBS2DU.js"),
|
|
322
|
+
"../../localization/generated/ne.ts": () => import("./ne-PA4KUBGU.js"),
|
|
323
|
+
"../../localization/generated/nl.ts": () => import("./nl-QMM3PBPM.js"),
|
|
324
|
+
"../../localization/generated/nn.ts": () => import("./nn-CLFEMF2K.js"),
|
|
325
|
+
"../../localization/generated/no.ts": () => import("./no-CV376NZG.js"),
|
|
326
|
+
"../../localization/generated/or.ts": () => import("./or-KP7CET7X.js"),
|
|
327
|
+
"../../localization/generated/pa.ts": () => import("./pa-CH5JYVXT.js"),
|
|
328
|
+
"../../localization/generated/pl.ts": () => import("./pl-DDW4HT7M.js"),
|
|
329
|
+
"../../localization/generated/pt-BR.ts": () => import("./pt-BR-CVNA2MRU.js"),
|
|
330
|
+
"../../localization/generated/pt-PT.ts": () => import("./pt-PT-IZMPF3BY.js"),
|
|
331
|
+
"../../localization/generated/pt.ts": () => import("./pt-CRTRYTDJ.js"),
|
|
332
|
+
"../../localization/generated/ro.ts": () => import("./ro-FUOGHWJA.js"),
|
|
333
|
+
"../../localization/generated/ru.ts": () => import("./ru-KAT4X5EC.js"),
|
|
334
|
+
"../../localization/generated/si.ts": () => import("./si-GDAXEOBK.js"),
|
|
335
|
+
"../../localization/generated/sk.ts": () => import("./sk-CDSK6MY5.js"),
|
|
336
|
+
"../../localization/generated/sl.ts": () => import("./sl-TFJQYNA4.js"),
|
|
337
|
+
"../../localization/generated/so.ts": () => import("./so-TXI6JJPW.js"),
|
|
338
|
+
"../../localization/generated/sq.ts": () => import("./sq-KMM2QIRU.js"),
|
|
339
|
+
"../../localization/generated/sr.ts": () => import("./sr-OTZNEL5Z.js"),
|
|
340
|
+
"../../localization/generated/sv.ts": () => import("./sv-7CANJ6CF.js"),
|
|
341
|
+
"../../localization/generated/sw.ts": () => import("./sw-5JDMTJ5K.js"),
|
|
342
|
+
"../../localization/generated/ta.ts": () => import("./ta-HT4SO7PD.js"),
|
|
343
|
+
"../../localization/generated/te.ts": () => import("./te-FECCLHOI.js"),
|
|
344
|
+
"../../localization/generated/tg.ts": () => import("./tg-FJWFJWF2.js"),
|
|
345
|
+
"../../localization/generated/th.ts": () => import("./th-JEP434LN.js"),
|
|
346
|
+
"../../localization/generated/tl.ts": () => import("./tl-GN35ZR2F.js"),
|
|
347
|
+
"../../localization/generated/tr.ts": () => import("./tr-IPVLQUE4.js"),
|
|
348
|
+
"../../localization/generated/uk.ts": () => import("./uk-LHWPGFRV.js"),
|
|
349
|
+
"../../localization/generated/ur.ts": () => import("./ur-7FU4XRAY.js"),
|
|
350
|
+
"../../localization/generated/uz.ts": () => import("./uz-RO7XCKFE.js"),
|
|
351
|
+
"../../localization/generated/vi.ts": () => import("./vi-5PHPTVV4.js"),
|
|
352
|
+
"../../localization/generated/zh-Hans.ts": () => import("./zh-Hans-UM7MUEDB.js"),
|
|
353
|
+
"../../localization/generated/zh-Hant.ts": () => import("./zh-Hant-7M2P4G7R.js"),
|
|
354
|
+
"../../localization/generated/zh.ts": () => import("./zh-LHCPWZN2.js")
|
|
355
|
+
});
|
|
356
|
+
|
|
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
|
+
]);
|
|
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;
|
|
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: {
|
|
370
|
+
fromAttribute: (value) => value,
|
|
371
|
+
toAttribute: (value) => value?.startsWith("data:") ? null : value
|
|
372
|
+
} })], _borderColor_dec = [property({ type: String, attribute: true, reflect: true })], _borderRadius_dec = [property({ type: Number, attribute: true, reflect: true })], _enableRightClick_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _enableLabelDrags_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _enableShiftDragZoom_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showZoomButtons_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _errorDialogsActive_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showMenuBar_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showToolBar_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showToolBarHelp_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _customToolBar_dec = [property({ type: String, attribute: true, reflect: true })], _showAlgebraInput_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showResetIcon_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _language_dec = [property({ type: String, attribute: true, reflect: true })], _country_dec = [property({ type: String, attribute: true, reflect: true })], _appletId_dec = [property({ type: String, attribute: true, reflect: true })], _allowStyleBar_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _randomize_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _randomSeed_dec = [property({ type: Number, attribute: true, reflect: true })], _useBrowserForJs_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showLogging_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _capturingThreshold_dec = [property({ type: Number, attribute: true, reflect: true })], _enableFileFeatures_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _enableUndoRedo_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _perspective_dec = [property({ type: String, attribute: true, reflect: true })], _enable3d_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _enableCAS_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _algebraInputPosition_dec = [property({ type: String, attribute: true, reflect: true })], _preventFocus_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _scaleContainerClass_dec = [property({ type: String, attribute: true, reflect: true })], _autoHeight_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _allowUpscale_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _playButton_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _scale_dec = [property({ type: Number, attribute: true, reflect: true })], _showAnimationButton_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showFullscreenButton_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showSuggestionButtons_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showStartTooltip_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _rounding_dec = [property({ type: String, attribute: true, reflect: true })], _buttonShadows_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _buttonRounding_dec = [property({ type: Number, attribute: true, reflect: true })], _buttonBorderColor_dec = [property({ type: String, attribute: true, reflect: true })], _editorBackgroundColor_dec = [property({ type: String, attribute: true, reflect: true })], _editorForegroundColor_dec = [property({ type: String, attribute: true, reflect: true })], _textmode_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _showKeyboardOnFocus_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _keyboardType_dec = [property({ type: String, attribute: true, reflect: true })], _transparentGraphics_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _disabledJavaScript_dec = [property({ type: Boolean, attribute: true, reflect: true, converter: booleanAttributeConverter })], _detachedKeyboardParent_dec = [property({ type: String, attribute: true, reflect: true })], _resetKey_dec = [property({ type: Number })], _ready_dec = [state()], _a) {
|
|
373
|
+
constructor() {
|
|
374
|
+
super(...arguments);
|
|
375
|
+
// The labels of the options are computed with msg, so the editor reads them again after a language change.
|
|
376
|
+
__publicField(this, "localize", localizer(this, {
|
|
377
|
+
sourceLocale,
|
|
378
|
+
targetLocales,
|
|
379
|
+
load: (locale) => globImport_localization_generated_ts(`../../localization/generated/${locale}.ts`),
|
|
380
|
+
drawer: true
|
|
381
|
+
}));
|
|
382
|
+
__publicField(this, "msg", this.localize.msg);
|
|
383
|
+
// The embedded construction is the "src" key of the JSON data block.
|
|
384
|
+
__privateAdd(this, _data, jsonData(this, {
|
|
385
|
+
defaults: {},
|
|
386
|
+
changed: ({ src }) => {
|
|
387
|
+
if (typeof src === "string" && src.startsWith("data:")) this.src = src;
|
|
388
|
+
}
|
|
389
|
+
}));
|
|
390
|
+
__privateAdd(this, _ggbStyles, __runInitializers(_init, 8, this, css2`
|
|
391
|
+
.GeoGebraFrame .toolbar .header-open-landscape .center, .GeoGebraFrame .toolbar .header-close-landscape .center {
|
|
392
|
+
top: 0 !important;
|
|
393
|
+
}
|
|
394
|
+
`.cssText)), __runInitializers(_init, 11, this);
|
|
395
|
+
__privateAdd(this, _type, __runInitializers(_init, 12, this, "classic")), __runInitializers(_init, 15, this);
|
|
396
|
+
__privateAdd(this, _width, __runInitializers(_init, 16, this, 800)), __runInitializers(_init, 19, this);
|
|
397
|
+
__privateAdd(this, _height, __runInitializers(_init, 20, this, 450)), __runInitializers(_init, 23, this);
|
|
398
|
+
__privateAdd(this, _src, __runInitializers(_init, 24, this)), __runInitializers(_init, 27, this);
|
|
399
|
+
__privateAdd(this, _borderColor, __runInitializers(_init, 28, this, "gray")), __runInitializers(_init, 31, this);
|
|
400
|
+
__privateAdd(this, _borderRadius, __runInitializers(_init, 32, this, 1)), __runInitializers(_init, 35, this);
|
|
401
|
+
__privateAdd(this, _enableRightClick, __runInitializers(_init, 36, this, true)), __runInitializers(_init, 39, this);
|
|
402
|
+
__privateAdd(this, _enableLabelDrags, __runInitializers(_init, 40, this, true)), __runInitializers(_init, 43, this);
|
|
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);
|
|
405
|
+
__privateAdd(this, _errorDialogsActive, __runInitializers(_init, 52, this, true)), __runInitializers(_init, 55, this);
|
|
406
|
+
__privateAdd(this, _showMenuBar, __runInitializers(_init, 56, this, false)), __runInitializers(_init, 59, this);
|
|
407
|
+
__privateAdd(this, _showToolBar, __runInitializers(_init, 60, this, true)), __runInitializers(_init, 63, this);
|
|
408
|
+
__privateAdd(this, _showToolBarHelp, __runInitializers(_init, 64, this, false)), __runInitializers(_init, 67, this);
|
|
409
|
+
__privateAdd(this, _customToolBar, __runInitializers(_init, 68, this)), __runInitializers(_init, 71, this);
|
|
410
|
+
__privateAdd(this, _showAlgebraInput, __runInitializers(_init, 72, this, true)), __runInitializers(_init, 75, this);
|
|
411
|
+
__privateAdd(this, _showResetIcon, __runInitializers(_init, 76, this, false)), __runInitializers(_init, 79, this);
|
|
412
|
+
__privateAdd(this, _language, __runInitializers(_init, 80, this)), __runInitializers(_init, 83, this);
|
|
413
|
+
__privateAdd(this, _country, __runInitializers(_init, 84, this)), __runInitializers(_init, 87, this);
|
|
414
|
+
__privateAdd(this, _appletId, __runInitializers(_init, 88, this)), __runInitializers(_init, 91, this);
|
|
415
|
+
__privateAdd(this, _allowStyleBar, __runInitializers(_init, 92, this, false)), __runInitializers(_init, 95, this);
|
|
416
|
+
__privateAdd(this, _randomize, __runInitializers(_init, 96, this, true)), __runInitializers(_init, 99, this);
|
|
417
|
+
__privateAdd(this, _randomSeed, __runInitializers(_init, 100, this)), __runInitializers(_init, 103, this);
|
|
418
|
+
__privateAdd(this, _useBrowserForJs, __runInitializers(_init, 104, this, false)), __runInitializers(_init, 107, this);
|
|
419
|
+
__privateAdd(this, _showLogging, __runInitializers(_init, 108, this, false)), __runInitializers(_init, 111, this);
|
|
420
|
+
__privateAdd(this, _capturingThreshold, __runInitializers(_init, 112, this, 3)), __runInitializers(_init, 115, this);
|
|
421
|
+
__privateAdd(this, _enableFileFeatures, __runInitializers(_init, 116, this, true)), __runInitializers(_init, 119, this);
|
|
422
|
+
__privateAdd(this, _enableUndoRedo, __runInitializers(_init, 120, this, true)), __runInitializers(_init, 123, this);
|
|
423
|
+
__privateAdd(this, _perspective, __runInitializers(_init, 124, this)), __runInitializers(_init, 127, this);
|
|
424
|
+
__privateAdd(this, _enable3d, __runInitializers(_init, 128, this)), __runInitializers(_init, 131, this);
|
|
425
|
+
__privateAdd(this, _enableCAS, __runInitializers(_init, 132, this)), __runInitializers(_init, 135, this);
|
|
426
|
+
__privateAdd(this, _algebraInputPosition, __runInitializers(_init, 136, this)), __runInitializers(_init, 139, this);
|
|
427
|
+
__privateAdd(this, _preventFocus, __runInitializers(_init, 140, this, false)), __runInitializers(_init, 143, this);
|
|
428
|
+
__privateAdd(this, _scaleContainerClass, __runInitializers(_init, 144, this)), __runInitializers(_init, 147, this);
|
|
429
|
+
__privateAdd(this, _autoHeight, __runInitializers(_init, 148, this, true)), __runInitializers(_init, 151, this);
|
|
430
|
+
__privateAdd(this, _allowUpscale, __runInitializers(_init, 152, this, false)), __runInitializers(_init, 155, this);
|
|
431
|
+
__privateAdd(this, _playButton, __runInitializers(_init, 156, this, false)), __runInitializers(_init, 159, this);
|
|
432
|
+
__privateAdd(this, _scale, __runInitializers(_init, 160, this, 1)), __runInitializers(_init, 163, this);
|
|
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);
|
|
435
|
+
__privateAdd(this, _showSuggestionButtons, __runInitializers(_init, 172, this, false)), __runInitializers(_init, 175, this);
|
|
436
|
+
__privateAdd(this, _showStartTooltip, __runInitializers(_init, 176, this, false)), __runInitializers(_init, 179, this);
|
|
437
|
+
__privateAdd(this, _rounding, __runInitializers(_init, 180, this)), __runInitializers(_init, 183, this);
|
|
438
|
+
__privateAdd(this, _buttonShadows, __runInitializers(_init, 184, this, false)), __runInitializers(_init, 187, this);
|
|
439
|
+
__privateAdd(this, _buttonRounding, __runInitializers(_init, 188, this, 0.2)), __runInitializers(_init, 191, this);
|
|
440
|
+
__privateAdd(this, _buttonBorderColor, __runInitializers(_init, 192, this)), __runInitializers(_init, 195, this);
|
|
441
|
+
__privateAdd(this, _editorBackgroundColor, __runInitializers(_init, 196, this)), __runInitializers(_init, 199, this);
|
|
442
|
+
__privateAdd(this, _editorForegroundColor, __runInitializers(_init, 200, this)), __runInitializers(_init, 203, this);
|
|
443
|
+
__privateAdd(this, _textmode, __runInitializers(_init, 204, this, false)), __runInitializers(_init, 207, this);
|
|
444
|
+
__privateAdd(this, _showKeyboardOnFocus, __runInitializers(_init, 208, this)), __runInitializers(_init, 211, this);
|
|
445
|
+
__privateAdd(this, _keyboardType, __runInitializers(_init, 212, this)), __runInitializers(_init, 215, this);
|
|
446
|
+
__privateAdd(this, _transparentGraphics, __runInitializers(_init, 216, this, false)), __runInitializers(_init, 219, this);
|
|
447
|
+
__privateAdd(this, _disabledJavaScript, __runInitializers(_init, 220, this, false)), __runInitializers(_init, 223, this);
|
|
448
|
+
__privateAdd(this, _detachedKeyboardParent, __runInitializers(_init, 224, this)), __runInitializers(_init, 227, this);
|
|
449
|
+
__privateAdd(this, _resetKey, __runInitializers(_init, 228, this, 0)), __runInitializers(_init, 231, this);
|
|
450
|
+
// A map of parameter names to their corresponding update functions in the GeoGebra API
|
|
451
|
+
__publicField(this, "paramUpdateMap");
|
|
452
|
+
__publicField(this, "api");
|
|
453
|
+
__publicField(this, "listeners");
|
|
454
|
+
__publicField(this, "srcFrame", 0);
|
|
455
|
+
__privateAdd(this, _ready, __runInitializers(_init, 232, this, false)), __runInitializers(_init, 235, this);
|
|
456
|
+
__publicField(this, "resizer");
|
|
457
|
+
__publicField(this, "resizeFrame", 0);
|
|
458
|
+
__publicField(this, "updatingGgb", false);
|
|
459
|
+
// Serializing the construction is costly and the applet reports every change of a drag, so it runs once per frame.
|
|
460
|
+
__publicField(this, "updateSrc", () => {
|
|
461
|
+
if (this.updatingGgb || !this.api || this.srcFrame) return;
|
|
462
|
+
this.srcFrame = requestAnimationFrame(this.writeSrc);
|
|
463
|
+
});
|
|
464
|
+
__publicField(this, "writeSrc", () => {
|
|
465
|
+
this.srcFrame = 0;
|
|
466
|
+
if (!this.updatingGgb && this.api) {
|
|
467
|
+
this.src = `data:application/vnd.geogebra.file;base64,${this.api.getBase64()}`;
|
|
468
|
+
}
|
|
469
|
+
});
|
|
470
|
+
}
|
|
471
|
+
get ggbProperties() {
|
|
472
|
+
return appletParameters(this, this.lang, sourceLocale);
|
|
473
|
+
}
|
|
474
|
+
connectedCallback() {
|
|
475
|
+
super.connectedCallback();
|
|
476
|
+
this.listeners = new AbortController();
|
|
477
|
+
this.addEventListener("ggb-load", (e) => {
|
|
478
|
+
const api = e.detail.api;
|
|
479
|
+
this.api = api;
|
|
480
|
+
this.ready = true;
|
|
481
|
+
this.observeSize();
|
|
482
|
+
api.registerAddListener(this.updateSrc);
|
|
483
|
+
api.registerClearListener(this.updateSrc);
|
|
484
|
+
api.registerUpdateListener(this.updateSrc);
|
|
485
|
+
api.registerRenameListener(this.updateSrc);
|
|
486
|
+
api.registerRemoveListener(this.updateSrc);
|
|
487
|
+
this.paramUpdateMap = /* @__PURE__ */ new Map([
|
|
488
|
+
["width", api.setWidth],
|
|
489
|
+
["height", api.setHeight],
|
|
490
|
+
["enableRightClick", api.enableRightClick],
|
|
491
|
+
["enableLabelDrags", api.enableLabelDrags],
|
|
492
|
+
["enableShiftDragZoom", api.enableShiftDragZoom],
|
|
493
|
+
["errorDialogsActive", api.setErrorDialogsActive],
|
|
494
|
+
["showToolBar", api.showToolBar],
|
|
495
|
+
["customToolBar", api.setCustomToolBar],
|
|
496
|
+
["showAlgebraInput", api.showAlgebraInput],
|
|
497
|
+
["showResetIcon", api.showResetIcon],
|
|
498
|
+
["perspective", api.setPerspective],
|
|
499
|
+
["enable3d", api.enable3D],
|
|
500
|
+
["enableCAS", api.enableCAS],
|
|
501
|
+
["rounding", api.setRounding]
|
|
502
|
+
]);
|
|
503
|
+
}, { signal: this.listeners.signal });
|
|
504
|
+
}
|
|
505
|
+
disconnectedCallback() {
|
|
506
|
+
super.disconnectedCallback();
|
|
507
|
+
this.listeners?.abort();
|
|
508
|
+
this.resizer?.disconnect();
|
|
509
|
+
this.resizer = void 0;
|
|
510
|
+
cancelAnimationFrame(this.resizeFrame);
|
|
511
|
+
this.resizeFrame = 0;
|
|
512
|
+
this.ready = false;
|
|
513
|
+
if (this.srcFrame) {
|
|
514
|
+
cancelAnimationFrame(this.srcFrame);
|
|
515
|
+
this.writeSrc();
|
|
516
|
+
}
|
|
517
|
+
this.api = void 0;
|
|
518
|
+
}
|
|
519
|
+
updated(changed) {
|
|
520
|
+
super.updated(changed);
|
|
521
|
+
if (changed.has("src")) __privateGet(this, _data).set({ src: this.src?.startsWith("data:") ? this.src : void 0 });
|
|
522
|
+
const api = this.api;
|
|
523
|
+
if (!api) {
|
|
524
|
+
this.resetIFrame();
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
if (this.paramUpdateMap) {
|
|
528
|
+
let needFullReload = false;
|
|
529
|
+
changed.forEach((_, key) => {
|
|
530
|
+
if (!appletSettings.has(key)) return;
|
|
531
|
+
const updateFunc = this.paramUpdateMap?.get(key.toString());
|
|
532
|
+
if (updateFunc) {
|
|
533
|
+
updateFunc.call(api, this[key]);
|
|
534
|
+
} else {
|
|
535
|
+
needFullReload = true;
|
|
536
|
+
}
|
|
537
|
+
});
|
|
538
|
+
if (needFullReload) {
|
|
539
|
+
this.resetIFrame();
|
|
540
|
+
return;
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (!changed.has("src")) {
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
const base64 = this.src?.split(",").at(-1);
|
|
547
|
+
if (this.src && base64 !== api.getBase64()) {
|
|
548
|
+
this.updatingGgb = true;
|
|
549
|
+
api.setBase64(base64 ?? "", () => {
|
|
550
|
+
this.updatingGgb = false;
|
|
551
|
+
});
|
|
552
|
+
} else if (!this.src) {
|
|
553
|
+
this.updatingGgb = true;
|
|
554
|
+
api.setBase64("", () => {
|
|
555
|
+
this.updatingGgb = false;
|
|
556
|
+
});
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
async importConstruction(files) {
|
|
560
|
+
const file = files[0];
|
|
561
|
+
if (!file || !this.isConnected) return;
|
|
562
|
+
this.src = ggbDataUrl(bytesToBase64(new Uint8Array(await file.arrayBuffer())));
|
|
563
|
+
}
|
|
564
|
+
async importGgb(file) {
|
|
565
|
+
const bytes = new Uint8Array(await file.arrayBuffer());
|
|
566
|
+
if (!isGgbArchive(bytes)) throw new Error(this.msg("The file is not a GeoGebra construction (.ggb)."));
|
|
567
|
+
const src = ggbDataUrl(bytesToBase64(bytes));
|
|
568
|
+
return () => {
|
|
569
|
+
this.src = src;
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
exportGgb() {
|
|
573
|
+
const base64 = this.api?.getBase64() || dataUrlPayload(this.src);
|
|
574
|
+
if (!base64) return null;
|
|
575
|
+
return new File([base64ToBytes(base64)], "construction.ggb", { type: GGB_MEDIA_TYPE });
|
|
576
|
+
}
|
|
577
|
+
exportPng() {
|
|
578
|
+
const base64 = this.api?.getPNGBase64(1, false, 72);
|
|
579
|
+
if (!base64) return null;
|
|
580
|
+
return new File([base64ToBytes(base64)], "construction.png", { type: "image/png" });
|
|
581
|
+
}
|
|
582
|
+
exportSvg() {
|
|
583
|
+
const api = this.api;
|
|
584
|
+
if (!api) return null;
|
|
585
|
+
return new Promise((resolve) => {
|
|
586
|
+
const timeout = setTimeout(() => resolve(null), 8e3);
|
|
587
|
+
api.exportSVG((svg) => {
|
|
588
|
+
clearTimeout(timeout);
|
|
589
|
+
resolve(svg ? new File([svg], "construction.svg", { type: "image/svg+xml" }) : null);
|
|
590
|
+
});
|
|
591
|
+
});
|
|
592
|
+
}
|
|
593
|
+
initializeIFrame(iframe) {
|
|
594
|
+
const doc = iframe.contentDocument;
|
|
595
|
+
if (!doc || doc.getElementById("ggb-element")) {
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
doc.body.style.margin = "0";
|
|
599
|
+
if (this.ggbStyles) {
|
|
600
|
+
const style = doc.createElement("style");
|
|
601
|
+
style.textContent = this.ggbStyles;
|
|
602
|
+
doc.head.append(style);
|
|
603
|
+
}
|
|
604
|
+
doc.body.addEventListener("focusin", () => this.dispatchEvent(new FocusEvent("focus", { bubbles: true, composed: true })));
|
|
605
|
+
const ggbEl = doc.createElement("div");
|
|
606
|
+
ggbEl.id = "ggb-element";
|
|
607
|
+
doc.body.append(ggbEl);
|
|
608
|
+
const deployScript = doc.createElement("script");
|
|
609
|
+
deployScript.src = "https://www.geogebra.org/apps/deployggb.js";
|
|
610
|
+
deployScript.addEventListener("load", () => {
|
|
611
|
+
const createScript = doc.createElement("script");
|
|
612
|
+
createScript.textContent = `
|
|
613
|
+
const applet = new GGBApplet({${JSON.stringify(this.ggbProperties).slice(1, -1)}, appletOnLoad: api => document.dispatchEvent(new CustomEvent("ggb-load", {bubbles: true, composed: true, detail: {api}}))})
|
|
614
|
+
applet.inject("ggb-element")
|
|
615
|
+
`;
|
|
616
|
+
doc.addEventListener("ggb-load", (e) => this.dispatchEvent(new CustomEvent("ggb-load", { bubbles: true, composed: true, detail: e.detail })));
|
|
617
|
+
doc.body.append(createScript);
|
|
618
|
+
});
|
|
619
|
+
doc.body.append(deployScript);
|
|
620
|
+
}
|
|
621
|
+
// The applet follows the size of the iframe, which follows the container; one resize per frame avoids loops.
|
|
622
|
+
observeSize() {
|
|
623
|
+
const iframe = this.renderRoot.querySelector("iframe");
|
|
624
|
+
if (!iframe) return;
|
|
625
|
+
this.resizer?.disconnect();
|
|
626
|
+
let last = "";
|
|
627
|
+
this.resizer = new ResizeObserver(() => {
|
|
628
|
+
cancelAnimationFrame(this.resizeFrame);
|
|
629
|
+
this.resizeFrame = requestAnimationFrame(() => {
|
|
630
|
+
const { width, height } = iframe.getBoundingClientRect();
|
|
631
|
+
const size = `${Math.round(width)}x${Math.round(height)}`;
|
|
632
|
+
if (!this.api || !iframe.isConnected || width < 1 || size === last) return;
|
|
633
|
+
last = size;
|
|
634
|
+
this.api.setSize(Math.round(width), Math.round(height));
|
|
635
|
+
});
|
|
636
|
+
});
|
|
637
|
+
this.resizer.observe(iframe);
|
|
638
|
+
}
|
|
639
|
+
focus(options) {
|
|
640
|
+
this.renderRoot.querySelector("iframe")?.focus(options);
|
|
641
|
+
}
|
|
642
|
+
resetIFrame() {
|
|
643
|
+
if (!this.api) {
|
|
644
|
+
return;
|
|
645
|
+
}
|
|
646
|
+
this.api = void 0;
|
|
647
|
+
this.ready = false;
|
|
648
|
+
this.resetKey++;
|
|
649
|
+
}
|
|
650
|
+
render() {
|
|
651
|
+
return html`
|
|
652
|
+
<div class="applet" ?data-ready=${this.ready}>
|
|
653
|
+
${keyed(this.resetKey, html`<iframe id="ggb" part="applet" title=${this.msg("GeoGebra applet")} @load=${(e) => this.initializeIFrame(e.target)}></iframe>`)}
|
|
654
|
+
<p class="print-note">${this.msg("Interactive content: open the document online to use the GeoGebra applet.")}</p>
|
|
655
|
+
</div>
|
|
656
|
+
`;
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
_init = __decoratorStart(_a);
|
|
660
|
+
_data = new WeakMap();
|
|
661
|
+
_ggbStyles = new WeakMap();
|
|
662
|
+
_type = new WeakMap();
|
|
663
|
+
_width = new WeakMap();
|
|
664
|
+
_height = new WeakMap();
|
|
665
|
+
_src = new WeakMap();
|
|
666
|
+
_borderColor = new WeakMap();
|
|
667
|
+
_borderRadius = new WeakMap();
|
|
668
|
+
_enableRightClick = new WeakMap();
|
|
669
|
+
_enableLabelDrags = new WeakMap();
|
|
670
|
+
_enableShiftDragZoom = new WeakMap();
|
|
671
|
+
_showZoomButtons = new WeakMap();
|
|
672
|
+
_errorDialogsActive = new WeakMap();
|
|
673
|
+
_showMenuBar = new WeakMap();
|
|
674
|
+
_showToolBar = new WeakMap();
|
|
675
|
+
_showToolBarHelp = new WeakMap();
|
|
676
|
+
_customToolBar = new WeakMap();
|
|
677
|
+
_showAlgebraInput = new WeakMap();
|
|
678
|
+
_showResetIcon = new WeakMap();
|
|
679
|
+
_language = new WeakMap();
|
|
680
|
+
_country = new WeakMap();
|
|
681
|
+
_appletId = new WeakMap();
|
|
682
|
+
_allowStyleBar = new WeakMap();
|
|
683
|
+
_randomize = new WeakMap();
|
|
684
|
+
_randomSeed = new WeakMap();
|
|
685
|
+
_useBrowserForJs = new WeakMap();
|
|
686
|
+
_showLogging = new WeakMap();
|
|
687
|
+
_capturingThreshold = new WeakMap();
|
|
688
|
+
_enableFileFeatures = new WeakMap();
|
|
689
|
+
_enableUndoRedo = new WeakMap();
|
|
690
|
+
_perspective = new WeakMap();
|
|
691
|
+
_enable3d = new WeakMap();
|
|
692
|
+
_enableCAS = new WeakMap();
|
|
693
|
+
_algebraInputPosition = new WeakMap();
|
|
694
|
+
_preventFocus = new WeakMap();
|
|
695
|
+
_scaleContainerClass = new WeakMap();
|
|
696
|
+
_autoHeight = new WeakMap();
|
|
697
|
+
_allowUpscale = new WeakMap();
|
|
698
|
+
_playButton = new WeakMap();
|
|
699
|
+
_scale = new WeakMap();
|
|
700
|
+
_showAnimationButton = new WeakMap();
|
|
701
|
+
_showFullscreenButton = new WeakMap();
|
|
702
|
+
_showSuggestionButtons = new WeakMap();
|
|
703
|
+
_showStartTooltip = new WeakMap();
|
|
704
|
+
_rounding = new WeakMap();
|
|
705
|
+
_buttonShadows = new WeakMap();
|
|
706
|
+
_buttonRounding = new WeakMap();
|
|
707
|
+
_buttonBorderColor = new WeakMap();
|
|
708
|
+
_editorBackgroundColor = new WeakMap();
|
|
709
|
+
_editorForegroundColor = new WeakMap();
|
|
710
|
+
_textmode = new WeakMap();
|
|
711
|
+
_showKeyboardOnFocus = new WeakMap();
|
|
712
|
+
_keyboardType = new WeakMap();
|
|
713
|
+
_transparentGraphics = new WeakMap();
|
|
714
|
+
_disabledJavaScript = new WeakMap();
|
|
715
|
+
_detachedKeyboardParent = new WeakMap();
|
|
716
|
+
_resetKey = new WeakMap();
|
|
717
|
+
_ready = new WeakMap();
|
|
718
|
+
__decorateElement(_init, 4, "ggbStyles", _ggbStyles_dec, GeogebraApp, _ggbStyles);
|
|
719
|
+
__decorateElement(_init, 4, "type", _type_dec, GeogebraApp, _type);
|
|
720
|
+
__decorateElement(_init, 4, "width", _width_dec, GeogebraApp, _width);
|
|
721
|
+
__decorateElement(_init, 4, "height", _height_dec, GeogebraApp, _height);
|
|
722
|
+
__decorateElement(_init, 4, "src", _src_dec, GeogebraApp, _src);
|
|
723
|
+
__decorateElement(_init, 4, "borderColor", _borderColor_dec, GeogebraApp, _borderColor);
|
|
724
|
+
__decorateElement(_init, 4, "borderRadius", _borderRadius_dec, GeogebraApp, _borderRadius);
|
|
725
|
+
__decorateElement(_init, 4, "enableRightClick", _enableRightClick_dec, GeogebraApp, _enableRightClick);
|
|
726
|
+
__decorateElement(_init, 4, "enableLabelDrags", _enableLabelDrags_dec, GeogebraApp, _enableLabelDrags);
|
|
727
|
+
__decorateElement(_init, 4, "enableShiftDragZoom", _enableShiftDragZoom_dec, GeogebraApp, _enableShiftDragZoom);
|
|
728
|
+
__decorateElement(_init, 4, "showZoomButtons", _showZoomButtons_dec, GeogebraApp, _showZoomButtons);
|
|
729
|
+
__decorateElement(_init, 4, "errorDialogsActive", _errorDialogsActive_dec, GeogebraApp, _errorDialogsActive);
|
|
730
|
+
__decorateElement(_init, 4, "showMenuBar", _showMenuBar_dec, GeogebraApp, _showMenuBar);
|
|
731
|
+
__decorateElement(_init, 4, "showToolBar", _showToolBar_dec, GeogebraApp, _showToolBar);
|
|
732
|
+
__decorateElement(_init, 4, "showToolBarHelp", _showToolBarHelp_dec, GeogebraApp, _showToolBarHelp);
|
|
733
|
+
__decorateElement(_init, 4, "customToolBar", _customToolBar_dec, GeogebraApp, _customToolBar);
|
|
734
|
+
__decorateElement(_init, 4, "showAlgebraInput", _showAlgebraInput_dec, GeogebraApp, _showAlgebraInput);
|
|
735
|
+
__decorateElement(_init, 4, "showResetIcon", _showResetIcon_dec, GeogebraApp, _showResetIcon);
|
|
736
|
+
__decorateElement(_init, 4, "language", _language_dec, GeogebraApp, _language);
|
|
737
|
+
__decorateElement(_init, 4, "country", _country_dec, GeogebraApp, _country);
|
|
738
|
+
__decorateElement(_init, 4, "appletId", _appletId_dec, GeogebraApp, _appletId);
|
|
739
|
+
__decorateElement(_init, 4, "allowStyleBar", _allowStyleBar_dec, GeogebraApp, _allowStyleBar);
|
|
740
|
+
__decorateElement(_init, 4, "randomize", _randomize_dec, GeogebraApp, _randomize);
|
|
741
|
+
__decorateElement(_init, 4, "randomSeed", _randomSeed_dec, GeogebraApp, _randomSeed);
|
|
742
|
+
__decorateElement(_init, 4, "useBrowserForJs", _useBrowserForJs_dec, GeogebraApp, _useBrowserForJs);
|
|
743
|
+
__decorateElement(_init, 4, "showLogging", _showLogging_dec, GeogebraApp, _showLogging);
|
|
744
|
+
__decorateElement(_init, 4, "capturingThreshold", _capturingThreshold_dec, GeogebraApp, _capturingThreshold);
|
|
745
|
+
__decorateElement(_init, 4, "enableFileFeatures", _enableFileFeatures_dec, GeogebraApp, _enableFileFeatures);
|
|
746
|
+
__decorateElement(_init, 4, "enableUndoRedo", _enableUndoRedo_dec, GeogebraApp, _enableUndoRedo);
|
|
747
|
+
__decorateElement(_init, 4, "perspective", _perspective_dec, GeogebraApp, _perspective);
|
|
748
|
+
__decorateElement(_init, 4, "enable3d", _enable3d_dec, GeogebraApp, _enable3d);
|
|
749
|
+
__decorateElement(_init, 4, "enableCAS", _enableCAS_dec, GeogebraApp, _enableCAS);
|
|
750
|
+
__decorateElement(_init, 4, "algebraInputPosition", _algebraInputPosition_dec, GeogebraApp, _algebraInputPosition);
|
|
751
|
+
__decorateElement(_init, 4, "preventFocus", _preventFocus_dec, GeogebraApp, _preventFocus);
|
|
752
|
+
__decorateElement(_init, 4, "scaleContainerClass", _scaleContainerClass_dec, GeogebraApp, _scaleContainerClass);
|
|
753
|
+
__decorateElement(_init, 4, "autoHeight", _autoHeight_dec, GeogebraApp, _autoHeight);
|
|
754
|
+
__decorateElement(_init, 4, "allowUpscale", _allowUpscale_dec, GeogebraApp, _allowUpscale);
|
|
755
|
+
__decorateElement(_init, 4, "playButton", _playButton_dec, GeogebraApp, _playButton);
|
|
756
|
+
__decorateElement(_init, 4, "scale", _scale_dec, GeogebraApp, _scale);
|
|
757
|
+
__decorateElement(_init, 4, "showAnimationButton", _showAnimationButton_dec, GeogebraApp, _showAnimationButton);
|
|
758
|
+
__decorateElement(_init, 4, "showFullscreenButton", _showFullscreenButton_dec, GeogebraApp, _showFullscreenButton);
|
|
759
|
+
__decorateElement(_init, 4, "showSuggestionButtons", _showSuggestionButtons_dec, GeogebraApp, _showSuggestionButtons);
|
|
760
|
+
__decorateElement(_init, 4, "showStartTooltip", _showStartTooltip_dec, GeogebraApp, _showStartTooltip);
|
|
761
|
+
__decorateElement(_init, 4, "rounding", _rounding_dec, GeogebraApp, _rounding);
|
|
762
|
+
__decorateElement(_init, 4, "buttonShadows", _buttonShadows_dec, GeogebraApp, _buttonShadows);
|
|
763
|
+
__decorateElement(_init, 4, "buttonRounding", _buttonRounding_dec, GeogebraApp, _buttonRounding);
|
|
764
|
+
__decorateElement(_init, 4, "buttonBorderColor", _buttonBorderColor_dec, GeogebraApp, _buttonBorderColor);
|
|
765
|
+
__decorateElement(_init, 4, "editorBackgroundColor", _editorBackgroundColor_dec, GeogebraApp, _editorBackgroundColor);
|
|
766
|
+
__decorateElement(_init, 4, "editorForegroundColor", _editorForegroundColor_dec, GeogebraApp, _editorForegroundColor);
|
|
767
|
+
__decorateElement(_init, 4, "textmode", _textmode_dec, GeogebraApp, _textmode);
|
|
768
|
+
__decorateElement(_init, 4, "showKeyboardOnFocus", _showKeyboardOnFocus_dec, GeogebraApp, _showKeyboardOnFocus);
|
|
769
|
+
__decorateElement(_init, 4, "keyboardType", _keyboardType_dec, GeogebraApp, _keyboardType);
|
|
770
|
+
__decorateElement(_init, 4, "transparentGraphics", _transparentGraphics_dec, GeogebraApp, _transparentGraphics);
|
|
771
|
+
__decorateElement(_init, 4, "disabledJavaScript", _disabledJavaScript_dec, GeogebraApp, _disabledJavaScript);
|
|
772
|
+
__decorateElement(_init, 4, "detachedKeyboardParent", _detachedKeyboardParent_dec, GeogebraApp, _detachedKeyboardParent);
|
|
773
|
+
__decorateElement(_init, 4, "resetKey", _resetKey_dec, GeogebraApp, _resetKey);
|
|
774
|
+
__decorateElement(_init, 4, "ready", _ready_dec, GeogebraApp, _ready);
|
|
775
|
+
__decoratorMetadata(_init, GeogebraApp);
|
|
776
|
+
__publicField(GeogebraApp, "styles", geogebraAppStyles);
|
|
777
|
+
__publicField(GeogebraApp, "options", geogebraOptions);
|
|
778
|
+
__publicField(GeogebraApp, "actions", {
|
|
779
|
+
importConstruction: {
|
|
780
|
+
label: (widget) => ({ _: widget.msg("Import construction") }),
|
|
781
|
+
input: { type: "file", accept: ".ggb", multiple: false }
|
|
782
|
+
}
|
|
783
|
+
});
|
|
784
|
+
__publicField(GeogebraApp, "convertFrom", { ".ggb": "importGgb" });
|
|
785
|
+
__publicField(GeogebraApp, "convertTo", { ".ggb": "exportGgb", "image/png": "exportPng", "image/svg+xml": "exportSvg" });
|
|
786
|
+
|
|
787
|
+
export {
|
|
788
|
+
GeogebraApp
|
|
789
|
+
};
|