feat: Produce an archematics plugin that works in Firefox #38

Merged
glen merged 3 commits from first_plugin into main 2023-10-05 06:19:14 +00:00
43 changed files with 164418 additions and 102 deletions

1
.gitignore vendored
View File

@ -2,6 +2,7 @@
tsbuild tsbuild
jsbuild jsbuild
public/js public/js
extension
# Editor backups # Editor backups
*~ *~

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 B

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
$wnd.webSimple.runAsyncCallback2('wqb(2080,1,EFh);_.dd=function(){};K4g(Tc)(2);\n//# sourceURL=webSimple-2.js\n')

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,23 @@
function webSimple(){var H='bootstrap',I='begin',J='gwt.codesvr.webSimple=',K='gwt.codesvr=',L='webSimple',M='startup',N='DUMMY',O=0,P=1,Q='iframe',R='position:absolute; width:0; height:0; border:none; left: -1000px;',S=' top: -1000px;',T='Chrome',U='CSS1Compat',V='<!doctype html>',W='',X='<html><head><\/head><body><\/body><\/html>',Y='undefined',Z='readystatechange',$=10,_='script',ab='javascript',bb='Failed to load ',cb='moduleStartup',db='scriptTagAdded',eb='moduleRequested',fb='meta',gb='name',hb='webSimple::',ib='::',jb='gwt:property',kb='content',lb='=',mb='gwt:onPropertyErrorFn',nb='Bad handler "',ob='" for "gwt:onPropertyErrorFn"',pb='gwt:onLoadErrorFn',qb='" for "gwt:onLoadErrorFn"',rb='#',sb='?',tb='/',ub='img',vb='clear.cache.gif',wb='baseUrl',xb='webSimple.nocache.js',yb='base',zb='//',Ab='selectingPermutation',Bb='webSimple.devmode.js',Cb='5F2C6F84737382D2A3B062804F6250CE',Db=':',Eb='.cache.js',Fb='loadExternalRefs',Gb='end';var n=window;var o=document;q(H,I);function p(){var a=n.location.search;return a.indexOf(J)!=-1||a.indexOf(K)!=-1}
function q(a,b){if(n.__gwtStatsEvent){n.__gwtStatsEvent({moduleName:L,sessionId:n.__gwtStatsSessionId,subSystem:M,evtGroup:a,millis:(new Date).getTime(),type:b})}}
webSimple.__sendStats=q;webSimple.__moduleName=L;webSimple.__errFn=null;webSimple.__moduleBase=N;webSimple.__softPermutationId=O;webSimple.__computePropValue=null;webSimple.__getPropMap=null;webSimple.__installRunAsyncCode=function(){};webSimple.__gwtStartLoadingFragment=function(){return null};webSimple.__gwt_isKnownPropertyValue=function(){return false};webSimple.__gwt_getMetaProperty=function(){return null};var r=null;var s=n.__gwt_activeModules=n.__gwt_activeModules||{};s[L]={moduleName:L};webSimple.__moduleStartupDone=function(e){var f=s[L].bindings;s[L].bindings=function(){var a=f?f():{};var b=e[webSimple.__softPermutationId];for(var c=O;c<b.length;c++){var d=b[c];a[d[O]]=d[P]}return a}};var t;function u(){v();return t}
function v(){if(t){return}var a=o.createElement(Q);a.id=L;a.style.cssText=R+S;a.tabIndex=-1;o.body.appendChild(a);t=a.contentWindow.document;if(navigator.userAgent.indexOf(T)==-1){t.open();var b=document.compatMode==U?V:W;t.write(b+X);t.close()}}
function w(f){function g(a){function b(){if(typeof o.readyState==Y){return typeof o.body!=Y&&o.body!=null}return /loaded|complete/.test(o.readyState)}
var c=b();if(c){a();return}function d(){if(!c){if(!b()){return}c=true;a();if(o.removeEventListener){o.removeEventListener(Z,d,false)}if(e){clearInterval(e)}}}
if(o.addEventListener){o.addEventListener(Z,d,false)}var e=setInterval(function(){d()},$)}
function h(a){var b=u();var c=b.body;var d=b.createElement(_);d.language=ab;d.crossOrigin=W;d.src=a;if(webSimple.__errFn){d.onerror=function(){webSimple.__errFn(L,new Error(bb+a))}}c.appendChild(d);q(cb,db)}
q(cb,eb);g(function(){h(f)})}
webSimple.__startLoadingFragment=function(a){return C(a)};webSimple.__installRunAsyncCode=function(a){var b=u();var c=b.body;var d=b.createElement(_);d.language=ab;d.text=a;c.appendChild(d);c.removeChild(d)};function A(){var c={};var d;var e;var f=o.getElementsByTagName(fb);for(var g=O,h=f.length;g<h;++g){var i=f[g],j=i.getAttribute(gb),k;if(j){j=j.replace(hb,W);if(j.indexOf(ib)>=O){continue}if(j==jb){k=i.getAttribute(kb);if(k){var l,m=k.indexOf(lb);if(m>=O){j=k.substring(O,m);l=k.substring(m+P)}else{j=k;l=W}c[j]=l}}else if(j==mb){k=i.getAttribute(kb);if(k){try{d=eval(k)}catch(a){alert(nb+k+ob)}}}else if(j==pb){k=i.getAttribute(kb);if(k){try{e=eval(k)}catch(a){alert(nb+k+qb)}}}}}__gwt_getMetaProperty=function(a){var b=c[a];return b==null?null:b};r=d;webSimple.__errFn=e}
function B(){function e(a){var b=a.lastIndexOf(rb);if(b==-1){b=a.length}var c=a.indexOf(sb);if(c==-1){c=a.length}var d=a.lastIndexOf(tb,Math.min(c,b));return d>=O?a.substring(O,d+P):W}
function f(a){if(a.match(/^\w+:\/\//)){}else{var b=o.createElement(ub);b.src=a+vb;a=e(b.src)}return a}
function g(){var a=__gwt_getMetaProperty(wb);if(a!=null){return a}return W}
function h(){var a=o.getElementsByTagName(_);for(var b=O;b<a.length;++b){if(a[b].src.indexOf(xb)!=-1){return e(a[b].src)}}return W}
function i(){var a=o.getElementsByTagName(yb);if(a.length>O){return a[a.length-P].href}return W}
function j(){var a=o.location;return a.href==a.protocol+zb+a.host+a.pathname+a.search+a.hash}
var k=g();if(k==W){k=h()}if(k==W){k=i()}if(k==W&&j()){k=e(o.location.href)}k=f(k);return k}
function C(a){if(a.match(/^\//)){return a}if(a.match(/^[a-zA-Z]+:\/\//)){return a}return webSimple.__moduleBase+a}
function D(){var f=[];var g=O;var h=[];var i=[];function j(a){var b=i[a](),c=h[a];if(b in c){return b}var d=[];for(var e in c){d[c[e]]=e}if(r){r(a,d,b)}throw null}
__gwt_isKnownPropertyValue=function(a,b){return b in h[a]};webSimple.__getPropMap=function(){var a={};for(var b in h){if(h.hasOwnProperty(b)){a[b]=j(b)}}return a};webSimple.__computePropValue=j;n.__gwt_activeModules[L].bindings=webSimple.__getPropMap;q(H,Ab);if(p()){return C(Bb)}var k;try{k=Cb;var l=k.indexOf(Db);if(l!=-1){g=parseInt(k.substring(l+P),$);k=k.substring(O,l)}}catch(a){}webSimple.__softPermutationId=g;return C(k+Eb)}
function F(){if(!n.__gwt_stylesLoaded){n.__gwt_stylesLoaded={}}q(Fb,I);q(Fb,Gb)}
A();webSimple.__moduleBase=B();s[L].moduleBase=webSimple.__moduleBase;var G=D();F();q(H,Gb);w(G);return true}
webSimple.succeeded=webSimple();

File diff suppressed because one or more lines are too long

11
etc/deps/README.txt Normal file
View File

@ -0,0 +1,11 @@
# GeoGebra Math Apps
Solve math problems, graph functions, create geometric constructions, do statistics and calculus, save and share your results. All of that in your browser using [GeoGebra Graphing Calculator](http://www.geogebra.org/graphing), [GeoGebra Classic](http://www.geogebra.org/classic) and [other apps](https://www.geogebra.org/download).
# Embedding Math Apps in your website
With our JavaScript library it's easy to embed GeoGebra in any website, please see the following documentation
- https://wiki.geogebra.org/en/Reference:Math_Apps_Embedding -- how to embed and customize the Apps
- https://wiki.geogebra.org/en/Reference:JavaScript -- JavaScript API to interact with the Apps
- https://www.github.com/geogebra/math-apps-examples -- examples of Math Apps embedded in HTML you can clone and play with
# License
You are free to copy, distribute and transmit GeoGebra for non-commercial purposes. For details see https://www.geogebra.org/license

View File

@ -1,6 +1,6 @@
// Hack to move GGBApplet into the global namespace // Hack to move GGBApplet into the global namespace
// (since we are getting it from a script) // (since we are getting it from a script)
import {GGBApplet as moduleGGBApplet} from './geogebra/entry.ts' import {GGBApplet as moduleGGBApplet} from './geotypes/entry.ts'
declare global { declare global {
class GGBApplet extends moduleGGBApplet { class GGBApplet extends moduleGGBApplet {
} }

10716
etc/deps/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,942 @@
/* X_ITE v8.12.5 */(() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ({
/***/ 355:
/***/ ((module) => {
module.exports = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("lib/jquery");
/***/ })
/******/ });
/************************************************************************/
/******/ // The module cache
/******/ var __webpack_module_cache__ = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
/******/ var cachedModule = __webpack_module_cache__[moduleId];
/******/ if (cachedModule !== undefined) {
/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
/******/ // no module.id needed
/******/ // no module.loaded needed
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
/******/ () => (module['default']) :
/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
/******/ __webpack_require__.d = (exports, definition) => {
/******/ for(var key in definition) {
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
/******/ }
/******/ }
/******/ };
/******/ })();
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
var __webpack_exports__ = {};
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
// UNUSED EXPORTS: default
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Components\")"
const Components_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Components");
var Components_default = /*#__PURE__*/__webpack_require__.n(Components_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DBaseNode\")"
const X3DBaseNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Base/X3DBaseNode");
var X3DBaseNode_default = /*#__PURE__*/__webpack_require__.n(X3DBaseNode_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DFieldDefinition\")"
const X3DFieldDefinition_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Base/X3DFieldDefinition");
var X3DFieldDefinition_default = /*#__PURE__*/__webpack_require__.n(X3DFieldDefinition_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/FieldDefinitionArray\")"
const FieldDefinitionArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Base/FieldDefinitionArray");
var FieldDefinitionArray_default = /*#__PURE__*/__webpack_require__.n(FieldDefinitionArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DField\")"
const X3DField_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Base/X3DField");
var X3DField_default = /*#__PURE__*/__webpack_require__.n(X3DField_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DArrayField\")"
const X3DArrayField_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Base/X3DArrayField");
var X3DArrayField_default = /*#__PURE__*/__webpack_require__.n(X3DArrayField_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Fields\")"
const Fields_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Fields");
var Fields_default = /*#__PURE__*/__webpack_require__.n(Fields_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Browser/X3DBrowser\")"
const X3DBrowser_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Browser/X3DBrowser");
var X3DBrowser_default = /*#__PURE__*/__webpack_require__.n(X3DBrowser_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/ComponentInfo\")"
const ComponentInfo_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/ComponentInfo");
var ComponentInfo_default = /*#__PURE__*/__webpack_require__.n(ComponentInfo_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/ComponentInfoArray\")"
const ComponentInfoArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/ComponentInfoArray");
var ComponentInfoArray_default = /*#__PURE__*/__webpack_require__.n(ComponentInfoArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/ProfileInfo\")"
const ProfileInfo_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/ProfileInfo");
var ProfileInfo_default = /*#__PURE__*/__webpack_require__.n(ProfileInfo_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/ProfileInfoArray\")"
const ProfileInfoArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/ProfileInfoArray");
var ProfileInfoArray_default = /*#__PURE__*/__webpack_require__.n(ProfileInfoArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/ConcreteNodesArray\")"
const ConcreteNodesArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/ConcreteNodesArray");
var ConcreteNodesArray_default = /*#__PURE__*/__webpack_require__.n(ConcreteNodesArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/AbstractNodesArray\")"
const AbstractNodesArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/AbstractNodesArray");
var AbstractNodesArray_default = /*#__PURE__*/__webpack_require__.n(AbstractNodesArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/UnitInfo\")"
const UnitInfo_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/UnitInfo");
var UnitInfo_default = /*#__PURE__*/__webpack_require__.n(UnitInfo_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Configuration/UnitInfoArray\")"
const UnitInfoArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Configuration/UnitInfoArray");
var UnitInfoArray_default = /*#__PURE__*/__webpack_require__.n(UnitInfoArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Execution/NamedNodesArray\")"
const NamedNodesArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Execution/NamedNodesArray");
var NamedNodesArray_default = /*#__PURE__*/__webpack_require__.n(NamedNodesArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Execution/ImportedNodesArray\")"
const ImportedNodesArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Execution/ImportedNodesArray");
var ImportedNodesArray_default = /*#__PURE__*/__webpack_require__.n(ImportedNodesArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Execution/X3DImportedNode\")"
const X3DImportedNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Execution/X3DImportedNode");
var X3DImportedNode_default = /*#__PURE__*/__webpack_require__.n(X3DImportedNode_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Execution/ExportedNodesArray\")"
const ExportedNodesArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Execution/ExportedNodesArray");
var ExportedNodesArray_default = /*#__PURE__*/__webpack_require__.n(ExportedNodesArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Execution/X3DExportedNode\")"
const X3DExportedNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Execution/X3DExportedNode");
var X3DExportedNode_default = /*#__PURE__*/__webpack_require__.n(X3DExportedNode_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Execution/X3DExecutionContext\")"
const X3DExecutionContext_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Execution/X3DExecutionContext");
var X3DExecutionContext_default = /*#__PURE__*/__webpack_require__.n(X3DExecutionContext_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Execution/X3DScene\")"
const X3DScene_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Execution/X3DScene");
var X3DScene_default = /*#__PURE__*/__webpack_require__.n(X3DScene_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Prototype/ExternProtoDeclarationArray\")"
const ExternProtoDeclarationArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Prototype/ExternProtoDeclarationArray");
var ExternProtoDeclarationArray_default = /*#__PURE__*/__webpack_require__.n(ExternProtoDeclarationArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Prototype/ProtoDeclarationArray\")"
const ProtoDeclarationArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Prototype/ProtoDeclarationArray");
var ProtoDeclarationArray_default = /*#__PURE__*/__webpack_require__.n(ProtoDeclarationArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Prototype/X3DExternProtoDeclaration\")"
const X3DExternProtoDeclaration_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Prototype/X3DExternProtoDeclaration");
var X3DExternProtoDeclaration_default = /*#__PURE__*/__webpack_require__.n(X3DExternProtoDeclaration_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Prototype/X3DProtoDeclaration\")"
const X3DProtoDeclaration_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Prototype/X3DProtoDeclaration");
var X3DProtoDeclaration_default = /*#__PURE__*/__webpack_require__.n(X3DProtoDeclaration_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Prototype/X3DProtoDeclarationNode\")"
const X3DProtoDeclarationNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Prototype/X3DProtoDeclarationNode");
var X3DProtoDeclarationNode_default = /*#__PURE__*/__webpack_require__.n(X3DProtoDeclarationNode_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Routing/RouteArray\")"
const RouteArray_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Routing/RouteArray");
var RouteArray_default = /*#__PURE__*/__webpack_require__.n(RouteArray_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Routing/X3DRoute\")"
const X3DRoute_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Routing/X3DRoute");
var X3DRoute_default = /*#__PURE__*/__webpack_require__.n(X3DRoute_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Namespace\")"
const Namespace_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Namespace");
var Namespace_default = /*#__PURE__*/__webpack_require__.n(Namespace_namespaceObject);
;// CONCATENATED MODULE: ./src/x_ite/Browser/Scripting/evaluate.js
/*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the X_ITE Project.
*
* X_ITE is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
function evaluate (thisArg, globalObject, sourceText)
{
return new Function (/* js */ `with (arguments [0])
{
return eval ((() =>
{
const sourceText = arguments [1];
delete arguments [0];
delete arguments [1];
arguments .length = 0;
return sourceText;
})
());
}`)
.call (thisArg, globalObject, sourceText);
}
const __default__ = evaluate;
;
Namespace_default().add ("evaluate", "x_ite/Browser/Scripting/evaluate", __default__);
/* harmony default export */ const Scripting_evaluate = (__default__);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Components/Core/X3DChildNode\")"
const X3DChildNode_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Components/Core/X3DChildNode");
var X3DChildNode_default = /*#__PURE__*/__webpack_require__.n(X3DChildNode_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Components/Networking/X3DUrlObject\")"
const X3DUrlObject_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Components/Networking/X3DUrlObject");
var X3DUrlObject_default = /*#__PURE__*/__webpack_require__.n(X3DUrlObject_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Base/X3DConstants\")"
const X3DConstants_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Base/X3DConstants");
var X3DConstants_default = /*#__PURE__*/__webpack_require__.n(X3DConstants_namespaceObject);
;// CONCATENATED MODULE: ./src/x_ite/Components/Scripting/X3DScriptNode.js
/*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the X_ITE Project.
*
* X_ITE is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
function X3DScriptNode (executionContext)
{
X3DChildNode_default().call (this, executionContext);
X3DUrlObject_default().call (this, executionContext);
this .addType ((X3DConstants_default()).X3DScriptNode);
}
Object .assign (Object .setPrototypeOf (X3DScriptNode .prototype, (X3DChildNode_default()).prototype),
(X3DUrlObject_default()).prototype,
{
initialize ()
{
X3DChildNode_default().prototype .initialize .call (this);
X3DUrlObject_default().prototype .initialize .call (this);
},
dispose ()
{
X3DUrlObject_default().prototype .dispose .call (this);
X3DChildNode_default().prototype .dispose .call (this);
},
});
Object .defineProperties (X3DScriptNode,
{
typeName:
{
value: "X3DScriptNode",
enumerable: true,
},
componentName:
{
value: "Scripting",
enumerable: true,
},
});
const X3DScriptNode_default_ = X3DScriptNode;
;
Namespace_default().add ("X3DScriptNode", "x_ite/Components/Scripting/X3DScriptNode", X3DScriptNode_default_);
/* harmony default export */ const Scripting_X3DScriptNode = (X3DScriptNode_default_);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/InputOutput/FileLoader\")"
const FileLoader_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/InputOutput/FileLoader");
var FileLoader_default = /*#__PURE__*/__webpack_require__.n(FileLoader_namespaceObject);
;// CONCATENATED MODULE: external "window [Symbol .for (\"X_ITE.X3D\")] .require (\"x_ite/Fields/SFNodeCache\")"
const SFNodeCache_namespaceObject = window [Symbol .for ("X_ITE.X3D-8.12.5")] .require ("x_ite/Fields/SFNodeCache");
var SFNodeCache_default = /*#__PURE__*/__webpack_require__.n(SFNodeCache_namespaceObject);
;// CONCATENATED MODULE: ./src/x_ite/Components/Scripting/Script.js
/* provided dependency */ var $ = __webpack_require__(355);
/*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the X_ITE Project.
*
* X_ITE is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
function Script (executionContext)
{
Scripting_X3DScriptNode .call (this, executionContext);
this .addType ((X3DConstants_default()).Script);
}
Object .assign (Object .setPrototypeOf (Script .prototype, Scripting_X3DScriptNode .prototype),
{
initialize ()
{
Scripting_X3DScriptNode .prototype .initialize .call (this);
this .requestImmediateLoad () .catch (Function .prototype);
},
getExtendedEventHandling ()
{
return false;
},
canUserDefinedFields ()
{
return true;
},
addUserDefinedField (accessType, name, field)
{
Scripting_X3DScriptNode .prototype .addUserDefinedField .call (this, accessType, name, field);
if (!this .isInitialized ())
return;
this .setLoadState ((X3DConstants_default()).NOT_STARTED_STATE);
this .requestImmediateLoad () .catch (Function .prototype);
},
removeUserDefinedField (name)
{
this .getUserDefinedFields () .get (name) ?.removeInterest ("set_field__", this);
Scripting_X3DScriptNode .prototype .removeUserDefinedField .call (this, name);
if (!this .isInitialized ())
return;
this .setLoadState ((X3DConstants_default()).NOT_STARTED_STATE);
this .requestImmediateLoad () .catch (Function .prototype);
},
getSourceText ()
{
return this ._url;
},
unloadData ()
{
this .initialize__ ("");
},
loadData ()
{
new (FileLoader_default()) (this) .loadDocument (this ._url, (data) =>
{
if (data === null)
{
// No URL could be loaded.
this .setLoadState ((X3DConstants_default()).FAILED_STATE);
}
else
{
this .initialize__ ($.decodeText (data));
this .setLoadState ((X3DConstants_default()).COMPLETE_STATE);
}
});
},
createGlobalObject ()
{
const browser = this .getBrowser ();
function SFNode (vrmlSyntax)
{
const nodes = browser .createVrmlFromString (vrmlSyntax);
if (nodes .length && nodes [0])
return nodes [0];
throw new Error ("SFNode.new: invalid argument.");
}
SFNode .prototype = (Fields_default()).SFNode .prototype;
const globalObject =
{
NULL: { value: null },
FALSE: { value: false },
TRUE: { value: true },
print: { value: browser .println .bind (browser) },
trace: { value: browser .println .bind (browser) },
Browser: { value: browser },
X3DConstants: { value: (X3DConstants_default()) },
X3DBrowser: { value: (X3DBrowser_default()) },
X3DExecutionContext: { value: (X3DExecutionContext_default()) },
X3DScene: { value: (X3DScene_default()) },
ComponentInfo: { value: (ComponentInfo_default()) },
ComponentInfoArray: { value: (ComponentInfoArray_default()) },
ProfileInfo: { value: (ProfileInfo_default()) },
ProfileInfoArray: { value: (ProfileInfoArray_default()) },
ConcreteNodesArray: { value: (ConcreteNodesArray_default()) }, // non-standard
AbstractNodesArray: { value: (AbstractNodesArray_default()) }, // non-standard
UnitInfo: { value: (UnitInfo_default()) },
UnitInfoArray: { value: (UnitInfoArray_default()) },
NamedNodesArray: { value: (NamedNodesArray_default()) }, // non-standard
ImportedNodesArray: { value: (ImportedNodesArray_default()) }, // non-standard
X3DImportedNode: { value: (X3DImportedNode_default()) }, // non-standard
ExportedNodesArray: { value: (ExportedNodesArray_default()) }, // non-standard
X3DExportedNode: { value: (X3DExportedNode_default()) }, // non-standard
ExternProtoDeclarationArray: { value: (ExternProtoDeclarationArray_default()) },
ProtoDeclarationArray: { value: (ProtoDeclarationArray_default()) },
X3DExternProtoDeclaration: { value: (X3DExternProtoDeclaration_default()) },
X3DProtoDeclaration: { value: (X3DProtoDeclaration_default()) },
X3DProtoDeclarationNode: { value: (X3DProtoDeclarationNode_default()) }, // non-standard
RouteArray: { value: (RouteArray_default()) },
X3DRoute: { value: (X3DRoute_default()) },
X3DBaseNode: { value: (X3DBaseNode_default()) }, // non-standard
X3DFieldDefinition: { value: (X3DFieldDefinition_default()) },
FieldDefinitionArray: { value: (FieldDefinitionArray_default()) },
X3DField: { value: (X3DField_default()) },
X3DArrayField: { value: (X3DArrayField_default()) },
SFColor: { value: (Fields_default()).SFColor },
SFColorRGBA: { value: (Fields_default()).SFColorRGBA },
SFImage: { value: (Fields_default()).SFImage },
SFMatrix3d: { value: (Fields_default()).SFMatrix3d },
SFMatrix3f: { value: (Fields_default()).SFMatrix3f },
SFMatrix4d: { value: (Fields_default()).SFMatrix4d },
SFMatrix4f: { value: (Fields_default()).SFMatrix4f },
SFNode: { value: SFNode },
SFRotation: { value: (Fields_default()).SFRotation },
SFString: { value: (Fields_default()).SFString },
SFVec2d: { value: (Fields_default()).SFVec2d },
SFVec2f: { value: (Fields_default()).SFVec2f },
SFVec3d: { value: (Fields_default()).SFVec3d },
SFVec3f: { value: (Fields_default()).SFVec3f },
SFVec4d: { value: (Fields_default()).SFVec4d },
SFVec4f: { value: (Fields_default()).SFVec4f },
VrmlMatrix: { value: (Fields_default()).VrmlMatrix },
MFBool: { value: (Fields_default()).MFBool },
MFColor: { value: (Fields_default()).MFColor },
MFColorRGBA: { value: (Fields_default()).MFColorRGBA },
MFDouble: { value: (Fields_default()).MFDouble },
MFFloat: { value: (Fields_default()).MFFloat },
MFImage: { value: (Fields_default()).MFImage },
MFInt32: { value: (Fields_default()).MFInt32 },
MFMatrix3d: { value: (Fields_default()).MFMatrix3d },
MFMatrix3f: { value: (Fields_default()).MFMatrix3f },
MFMatrix4d: { value: (Fields_default()).MFMatrix4d },
MFMatrix4f: { value: (Fields_default()).MFMatrix4f },
MFNode: { value: (Fields_default()).MFNode },
MFRotation: { value: (Fields_default()).MFRotation },
MFString: { value: (Fields_default()).MFString },
MFTime: { value: (Fields_default()).MFTime },
MFVec2d: { value: (Fields_default()).MFVec2d },
MFVec2f: { value: (Fields_default()).MFVec2f },
MFVec3d: { value: (Fields_default()).MFVec3d },
MFVec3f: { value: (Fields_default()).MFVec3f },
MFVec4d: { value: (Fields_default()).MFVec4d },
MFVec4f: { value: (Fields_default()).MFVec4f },
};
for (const field of this .getUserDefinedFields ())
{
const name = field .getName ();
if (field .getAccessType () === (X3DConstants_default()).inputOnly)
continue;
if (!(name in globalObject))
{
globalObject [name] =
{
get: field .valueOf .bind (field),
set: field .setValue .bind (field),
};
}
if (field .getAccessType () === (X3DConstants_default()).inputOutput)
{
globalObject [name + "_changed"] =
{
get: field .valueOf .bind (field),
set: field .setValue .bind (field),
};
}
}
return Object .create (Object .prototype, globalObject);
},
createContext (sourceText)
{
try
{
const callbacks = ["initialize", "prepareEvents", "eventsProcessed", "shutdown"];
for (const field of this .getUserDefinedFields ())
{
switch (field .getAccessType ())
{
case (X3DConstants_default()).inputOnly:
callbacks .push (field .getName ());
break;
case (X3DConstants_default()).inputOutput:
callbacks .push ("set_" + field .getName ());
break;
}
}
sourceText += ";\n[" + callbacks .map (c => `typeof ${c} !== "undefined" ? ${c} : undefined`) .join (",") + "];";
const
result = this .evaluate (sourceText),
context = new Map ();
for (let i = 0; i < callbacks .length; ++ i)
context .set (callbacks [i], result [i]);
return context;
}
catch (error)
{
this .setError ("while evaluating script source", error);
return new Map ();
}
},
evaluate (sourceText)
{
const browser = this .getBrowser ();
try
{
browser .getScriptStack () .push (this);
if (!this .globalObject)
this .globalObject = this .createGlobalObject ();
return Scripting_evaluate (SFNodeCache_default().get (this), this .globalObject, sourceText);
}
finally
{
browser .getScriptStack () .pop ();
}
},
initialize__ (sourceText)
{
this .disconnect ();
const browser = this .getBrowser ();
// Create context.
this .globalObject = this .createGlobalObject ();
this .context = this .createContext (sourceText);
// Connect shutdown.
const shutdown = this .context .get ("shutdown");
if (typeof shutdown === "function")
$(window) .on ("unload.Script" + this .getId (), this .call__ .bind (this, shutdown, "shutdown"));
// Connect prepareEvents.
const prepareEvents = this .context .get ("prepareEvents");
if (typeof prepareEvents === "function")
browser .prepareEvents () .addInterest ("call__", this, prepareEvents, "prepareEvents");
// Connect eventsProcessed.
const eventsProcessed = this .context .get ("eventsProcessed");
if (typeof eventsProcessed === "function")
this .addInterest ("call__", this, eventsProcessed, "eventsProcessed");
// Connect fields.
for (const field of this .getUserDefinedFields ())
{
switch (field .getAccessType ())
{
case (X3DConstants_default()).inputOnly:
{
const callback = this .context .get (field .getName ());
if (typeof callback === "function")
field .addInterest ("set_field__", this, callback);
break;
}
case (X3DConstants_default()).inputOutput:
{
const callback = this .context .get ("set_" + field .getName ());
if (typeof callback === "function")
field .addInterest ("set_field__", this, callback);
break;
}
}
}
// Call initialize function.
const initialize = this .context .get ("initialize");
if (typeof initialize === "function")
this .call__ (initialize, "initialize");
},
call__ (callback, name)
{
const browser = this .getBrowser ();
browser .getScriptStack () .push (this);
try
{
callback .call (SFNodeCache_default().get (this), browser .getCurrentTime ());
}
catch (error)
{
this .setError (`in function '${name}'`, error);
}
browser .getScriptStack () .pop ();
},
set_field__ (callback, field)
{
const browser = this .getBrowser ();
field .setTainted (true);
browser .getScriptStack () .push (this);
try
{
callback .call (SFNodeCache_default().get (this), field .valueOf (), browser .getCurrentTime ());
}
catch (error)
{
this .setError ("in function '" + field .getName () + "'", error);
}
browser .getScriptStack () .pop ();
field .setTainted (false);
},
setError (reason, error)
{
console .error ("JavaScript Error in Script '" + this .getName () + "', " + reason + "\nworld url is '" + this .getExecutionContext () .getWorldURL () + "':");
console .error (error);
},
disconnect ()
{
// Call shutdown.
const shutdown = this .context ?.get ("shutdown");
if (typeof shutdown === "function")
this .call__ (shutdown, "shutdown");
// Disconnect shutdown.
$(window) .off (".Script" + this .getId ());
// Disconnect prepareEvents.
this .getBrowser () .prepareEvents () .removeInterest ("call__", this);
// Disconnect eventsProcessed.
this .removeInterest ("call__", this);
// Disconnect fields.
for (const field of this .getUserDefinedFields ())
field .removeInterest ("set_field__", this);
},
dispose ()
{
this .disconnect ();
Scripting_X3DScriptNode .prototype .dispose .call (this);
},
});
Object .defineProperties (Script,
{
typeName:
{
value: "Script",
enumerable: true,
},
componentName:
{
value: "Scripting",
enumerable: true,
},
containerField:
{
value: "children",
enumerable: true,
},
specificationRange:
{
value: Object .freeze (["2.0", "Infinity"]),
enumerable: true,
},
fieldDefinitions:
{
value: new (FieldDefinitionArray_default()) ([
new (X3DFieldDefinition_default()) ((X3DConstants_default()).inputOutput, "metadata", new (Fields_default()).SFNode ()),
new (X3DFieldDefinition_default()) ((X3DConstants_default()).inputOutput, "description", new (Fields_default()).SFString ()),
new (X3DFieldDefinition_default()) ((X3DConstants_default()).inputOutput, "load", new (Fields_default()).SFBool (true)),
new (X3DFieldDefinition_default()) ((X3DConstants_default()).inputOutput, "url", new (Fields_default()).MFString ()),
new (X3DFieldDefinition_default()) ((X3DConstants_default()).inputOutput, "autoRefresh", new (Fields_default()).SFTime ()),
new (X3DFieldDefinition_default()) ((X3DConstants_default()).inputOutput, "autoRefreshTimeLimit", new (Fields_default()).SFTime (3600)),
new (X3DFieldDefinition_default()) ((X3DConstants_default()).initializeOnly, "directOutput", new (Fields_default()).SFBool ()),
new (X3DFieldDefinition_default()) ((X3DConstants_default()).initializeOnly, "mustEvaluate", new (Fields_default()).SFBool ()),
]),
enumerable: true,
},
});
const Script_default_ = Script;
;
Namespace_default().add ("Script", "x_ite/Components/Scripting/Script", Script_default_);
/* harmony default export */ const Scripting_Script = (Script_default_);
;// CONCATENATED MODULE: ./src/assets/components/Scripting.js
/*******************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright create3000, Scheffelstraße 31a, Leipzig, Germany 2011 - 2022.
*
* All rights reserved. Holger Seelig <holger.seelig@yahoo.de>.
*
* The copyright notice above does not evidence any actual of intended
* publication of such source code, and is an unpublished work by create3000.
* This material contains CONFIDENTIAL INFORMATION that is the property of
* create3000.
*
* No permission is granted to copy, distribute, or create derivative works from
* the contents of this software, in whole or in part, without the prior written
* permission of create3000.
*
* NON-MILITARY USE ONLY
*
* All create3000 software are effectively free software with a non-military use
* restriction. It is free. Well commented source is provided. You may reuse the
* source in any way you please with the exception anything that uses it must be
* marked to indicate is contains 'non-military use only' components.
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* Copyright 2011 - 2022, Holger Seelig <holger.seelig@yahoo.de>.
*
* This file is part of the X_ITE Project.
*
* X_ITE is free software: you can redistribute it and/or modify it under the
* terms of the GNU General Public License version 3 only, as published by the
* Free Software Foundation.
*
* X_ITE is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License version 3 for more
* details (a copy is included in the LICENSE file that accompanied this code).
*
* You should have received a copy of the GNU General Public License version 3
* along with X_ITE. If not, see <https://www.gnu.org/licenses/gpl.html> for a
* copy of the GPLv3 License.
*
* For Silvio, Joy and Adi.
*
******************************************************************************/
Components_default().add ({
name: "Scripting",
concreteNodes:
[
Scripting_Script,
],
abstractNodes:
[
Scripting_X3DScriptNode,
],
});
const Scripting_default_ = undefined;
;
Namespace_default().add ("Scripting", "assets/components/Scripting", Scripting_default_);
/* harmony default export */ const Scripting = ((/* unused pure expression or super */ null && (Scripting_default_)));
})();
/******/ })()
;

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

1
etc/deps/x_ite/x_ite.css Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,8 +1,4 @@
declare module 'https://create3000.github.io/code/x_ite/latest/x_ite.mjs' { declare const X3D: X3D;
// This compilation-only file was replicated from the x_ite GitHub repository
// https://github.com/create3000/x_ite
// compliant with the GPL License, under which it was released.
const X3D: X3D;
export default X3D; export default X3D;
export interface X3D { export interface X3D {
(callback?: () => void, fallback?: (error: Error) => void): Promise<void>; (callback?: () => void, fallback?: (error: Error) => void): Promise<void>;
@ -355,7 +351,7 @@ export interface X3DRoute {
type FieldCallback = (value: unknown) => void type FieldCallback = (value: unknown) => void
class X3DField { declare class X3DField {
equals(other: X3DField): boolean; equals(other: X3DField): boolean;
assign(other: X3DField): void; assign(other: X3DField): void;
setValue(value: unknown): void; setValue(value: unknown): void;
@ -2098,4 +2094,3 @@ export interface X3DConstants {
X3DViewportNode: 82; X3DViewportNode: 82;
X3DWorld: 3; X3DWorld: 3;
} }
}

121559
etc/deps/x_ite/x_ite.mjs Normal file

File diff suppressed because it is too large Load Diff

42
etc/manifest.json Normal file
View File

@ -0,0 +1,42 @@
{
"manifest_version": 3,
"name": "archematics",
"version": "0.1",
"description": "unearths mathematical treasures lost in the web.",
"content_scripts": [
{
"matches": ["*://*/*"],
"js": ["giveAwrl.js"]
},
{
"matches": ["*://*/*"],
"js": ["adapptext.js"],
"run_at": "document_start"
}
],
"options_ui": {
"page": "options.html",
"browser_style": false
},
"web_accessible_resources": [{
"matches": ["<all_urls>"],
"resources": [
"deps/x_ite/x_ite.mjs",
"deps/x_ite/x_ite.css",
"deps/x_ite/assets/components/Scripting.js",
"deps/x_ite/assets/components/Text.js",
"adapptlet.js",
"adapptypes.js",
"options.js",
"deps/GeoGebra/deployggb.js",
"deps/GeoGebra/HTML5/5.0/webSimple/5F2C6F84737382D2A3B062804F6250CE.cache.js",
"deps/GeoGebra/HTML5/5.0/webSimple/webSimple.nocache.js",
"deps/GeoGebra/HTML5/5.0/webSimple/clear.cache.gif",
"deps/GeoGebra/HTML5/5.0/webSimple/deferredjs/*",
"deps/GeoGebra/HTML5/5.0/css/bundles/simple-bundle.css"
]
}],
"permissions": ["storage"]
}

19
etc/options.html Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<h3>Debugging</h3>
Trace the following to the JavaScript console:
<h4>Java Geometry Applets</h4>
<label for="commands">Commands executed</label>
<input type="checkbox" id="commands">
<label for="color">Colors assigned</label>
<input type="checkbox" id="color">
<script src="options.js" type="module"></script>
</body>
</html>

View File

@ -1,6 +1,6 @@
{ {
name: 'archematics', name: 'archematics',
version: '0.0.1', version: '0.1.0',
description: 'Uncovering lost digital mathematical treasures', description: 'Uncovering lost digital mathematical treasures',
scripts: { scripts: {
test: 'echo "Error: no test specified" && exit 1', test: 'echo "Error: no test specified" && exit 1',
@ -14,11 +14,12 @@
// Use the Typescript compiler to create the final .js files: // Use the Typescript compiler to create the final .js files:
build_js: 'tsc && mkdir -p public/js && cp -r jsbuild/* public/js', build_js: 'tsc && mkdir -p public/js && cp -r jsbuild/* public/js',
build_deps: 'bash tools/copyDeps.bash public/js/deps', build_deps: 'bash tools/copyDeps.bash public/js/deps',
build_plugin: 'bash tools/makePlugin.bash extension',
build: 'pnpm --sequential /build_/', build: 'pnpm --sequential /build_/',
start: 'node public/js', start: 'node public/js',
go: 'pnpm --sequential "/build|start/"', go: 'pnpm --sequential "/build|start/"',
serve: 'pnpm build && http-server', serve: 'pnpm build && http-server',
clean: 'rm -rf tsbuild jsbuild public/js', clean: 'rm -rf tsbuild jsbuild public/js extension',
}, },
packageManager: 'pnpm', packageManager: 'pnpm',
keywords: [ keywords: [
@ -34,8 +35,10 @@
}, },
devDependencies: { devDependencies: {
'@danielx/civet': '^0.6.39', '@danielx/civet': '^0.6.39',
'@types/firefox-webext-browser': '^111.0.2',
'@types/jquery': '^3.5.19', '@types/jquery': '^3.5.19',
'http-server': '^14.1.1', 'http-server': '^14.1.1',
rollup: '^3.29.3',
typescript: '^5.2.2', typescript: '^5.2.2',
}, },
dependencies: { dependencies: {

View File

@ -16,12 +16,18 @@ devDependencies:
'@danielx/civet': '@danielx/civet':
specifier: ^0.6.39 specifier: ^0.6.39
version: 0.6.39(typescript@5.2.2) version: 0.6.39(typescript@5.2.2)
'@types/firefox-webext-browser':
specifier: ^111.0.2
version: 111.0.2
'@types/jquery': '@types/jquery':
specifier: ^3.5.19 specifier: ^3.5.19
version: 3.5.19 version: 3.5.19
http-server: http-server:
specifier: ^14.1.1 specifier: ^14.1.1
version: 14.1.1 version: 14.1.1
rollup:
specifier: ^3.29.3
version: 3.29.3
typescript: typescript:
specifier: ^5.2.2 specifier: ^5.2.2
version: 5.2.2 version: 5.2.2
@ -66,6 +72,10 @@ packages:
'@jridgewell/sourcemap-codec': 1.4.15 '@jridgewell/sourcemap-codec': 1.4.15
dev: true dev: true
/@types/firefox-webext-browser@111.0.2:
resolution: {integrity: sha512-NS7izfYOnQI/Opf3YdZSKkI5Ox89SqEffJHK2zfGY2BYEVuWuM6pSwDRglGl4W0SM84oUQfvLyYH4X6EQZAJ2w==}
dev: true
/@types/jquery@3.5.19: /@types/jquery@3.5.19:
resolution: {integrity: sha512-KFbmk+dXfphHGuVCmlopgcNRCegN/21mkeoD4BzuJhVH0SJW3Uo2mLuAwb6oqTNV79EsRp6J7yC1BbKymjpx/g==} resolution: {integrity: sha512-KFbmk+dXfphHGuVCmlopgcNRCegN/21mkeoD4BzuJhVH0SJW3Uo2mLuAwb6oqTNV79EsRp6J7yC1BbKymjpx/g==}
dependencies: dependencies:
@ -428,6 +438,14 @@ packages:
resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==} resolution: {integrity: sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==}
dev: true dev: true
/rollup@3.29.3:
resolution: {integrity: sha512-T7du6Hum8jOkSWetjRgbwpM6Sy0nECYrYRSmZjayFcOddtKJWU4d17AC3HNUk7HRuqy4p+G7aEZclSHytqUmEg==}
engines: {node: '>=14.18.0', npm: '>=8.0.0'}
hasBin: true
optionalDependencies:
fsevents: 2.3.3
dev: true
/safe-buffer@5.1.2: /safe-buffer@5.1.2:
resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==} resolution: {integrity: sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==}
dev: true dev: true

View File

@ -10,6 +10,7 @@
<li> <a href="inscribed-equilateral.html">Before</a> </li> <li> <a href="inscribed-equilateral.html">Before</a> </li>
<li> <a href="inscribed-revived.html">Revived</a> </li> <li> <a href="inscribed-revived.html">Revived</a> </li>
<li> <a href="inscribed-modified.html">After</a> </li> <li> <a href="inscribed-modified.html">After</a> </li>
<li> <a href="jelts/book1/joyceDefI2.html">Book I Def 2</a> </li>
</ul> </ul>
<h2>WRL Files</h2> <h2>WRL Files</h2>
<ul><li> <a href="wrl_2.html">Target two</a></li> <ul><li> <a href="wrl_2.html">Target two</a></li>

File diff suppressed because one or more lines are too long

51
src/adapptext.civet Normal file
View File

@ -0,0 +1,51 @@
{AppletDescription, AdapParams, params, flags, ConfigType} from ./adapptypes.ts
// (At least some of) Joyce's pages have inline scripts that remove their
// own applet nodes, so we have to watch for them as they are added. Hence,
// this script runs at document_start, and watches for applets being added,
// setting up the joyceApplets structure as it goes
joyceApplets: AppletDescription[] := []
obs := new MutationObserver (mutationList) =>
for each change of mutationList
for each newGenericNode of change.addedNodes
newNode := (newGenericNode as HTMLElement)
newParent := (change.target as HTMLElement)
unless newNode.tagName is 'APPLET' then continue
unless newNode.getAttribute('code') is 'Geometry' then continue
id .= newParent.getAttribute 'id'
unless id
id = 'joyceApplet' + joyceApplets.length
newParent.setAttribute 'id', id
joyceApplets.push {
html: newNode.outerHTML,
params(newNode.children),
id,
width: parseInt(newNode.getAttribute('width') ?? '200'),
height: parseInt(newNode.getAttribute('height') ?? '200') }
config := childList: true, subtree: true
obs.observe document.documentElement, config
function addScriptTag(url: string, module = false)
return new Promise (resolve, reject) =>
script := document.createElement 'script'
script.addEventListener 'load', resolve
script.addEventListener 'error', reject
script.src = url
if module then script.type = 'module'
document.head.appendChild script
document.addEventListener "DOMContentLoaded", async =>
finalJoyceApplet := document.querySelector "applet[code='Geometry']"
if joyceApplets.length or finalJoyceApplet
config := await browser.storage.local.get(flags) as ConfigType
adapParams: AdapParams := {
codebase: browser.runtime.getURL('deps/GeoGebra/HTML5/5.0/webSimple'),
config,
joyceApplets }
// @ts-ignore
window.wrappedJSObject.adapParams = cloneInto(adapParams, window)
addScriptTag(browser.runtime.getURL 'deps/GeoGebra/deployggb.js').then =>
addScriptTag browser.runtime.getURL('adapptlet.js'), true

View File

@ -1,18 +1,12 @@
import https://code.jquery.com/jquery-3.7.1.js import ./deps/jquery.js
import type {AppletObject} from ./deps/geogebra/api.ts import type {AppletObject} from ./deps/geotypes/api.ts
import {AppletDescription, AdapParams, params} from ./adapptypes.ts
colorsea from ./deps/colorsea.js colorsea from ./deps/colorsea.js
type AppletDescription
html: string
children: HTMLCollection
id: string
width: number
height: number
joyceApplets: AppletDescription[] := [] joyceApplets: AppletDescription[] := []
$('applet[code="Geometry"]').before (i, html) -> $('applet[code="Geometry"]').before (i, html) ->
id := `joyceApplet${i}` id := `joyceApplet${i}`
joyceApplets.push { html, this.children, id, joyceApplets.push { html, params(this.children), id,
width: parseInt(this.getAttribute('width') ?? '200'), width: parseInt(this.getAttribute('width') ?? '200'),
height: parseInt(this.getAttribute('height') ?? '200') } height: parseInt(this.getAttribute('height') ?? '200') }
`<div id="${id}"></div>` `<div id="${id}"></div>`
@ -41,8 +35,8 @@ type Description
// with the otherName property: // with the otherName property:
type JoyceElements = Record<AnyName, Description> type JoyceElements = Record<AnyName, Description>
jQuery.getScript 'https://www.geogebra.org/apps/deployggb.js', => function postApplets(jApplets: AppletDescription[], codebase = '')
for each jApp of joyceApplets for each jApp of jApplets
params := { params := {
appName: 'classic', appName: 'classic',
-enableRightClick, -enableRightClick,
@ -52,15 +46,36 @@ jQuery.getScript 'https://www.geogebra.org/apps/deployggb.js', =>
appletOnLoad: (api: AppletObject) => appletOnLoad: (api: AppletObject) =>
elements: JoyceElements := {} elements: JoyceElements := {}
backgroundRGB := [255, 255, 255] as RGB backgroundRGB := [255, 255, 255] as RGB
for child of jApp.children for name, value in jApp.params
dispatchJcommand api, child, elements, backgroundRGB dispatchJcommand api, name, value, elements, backgroundRGB
api.setCoordSystem -10, 10 + jApp.width, -10, 10 + jApp.height api.setCoordSystem -10, 10 + jApp.width, -10, 10 + jApp.height
api.setAxesVisible false, false api.setAxesVisible false, false
api.setGridVisible false api.setGridVisible false
} as const } as const
geoApp := new GGBApplet params geoApp := new GGBApplet params
if codebase then geoApp.setHTML5Codebase codebase
geoApp.inject jApp.id geoApp.inject jApp.id
adapParams: AdapParams :=
typeof GGBApplet is 'undefined'
? {loader: 'https://www.geogebra.org/apps/deployggb.js', joyceApplets: []}
: ((window as any).adapParams as AdapParams)
// Always use the final joyceApplets if there are any:
if joyceApplets.length
adapParams.joyceApplets = joyceApplets
if adapParams.joyceApplets.length
if adapParams.loader
jQuery.getScript adapParams.loader, =>
postApplets adapParams.joyceApplets
else
postApplets adapParams.joyceApplets, adapParams.codebase
/* That's all of the actions of this script. All of the remainder is
* implementation.
*/
type DimParts = [string[], string[], string[]] // Gives GeoNames type DimParts = [string[], string[], string[]] // Gives GeoNames
// or expressions for 0-, 1-, and 2-dimensional parts for coloring // or expressions for 0-, 1-, and 2-dimensional parts for coloring
@ -92,42 +107,39 @@ type XYZ = RGB
// present in that applet // present in that applet
function dispatchJcommand( function dispatchJcommand(
api: AppletObject, api: AppletObject,
param: Element, name: string,
value: string,
elements: JoyceElements elements: JoyceElements
backgroundRGB: RGB): void backgroundRGB: RGB): void
val := param.getAttribute 'value' switch name
unless val return
attr := param.getAttribute 'name'
switch attr
'background' 'background'
backgroundHex := `#${val}` newback := joyce2rgb value, backgroundRGB
api.setGraphicsOptions 1, bgColor: backgroundHex if adapParams.config?.commands
newback := colorsea(backgroundHex).rgb() console.log 'Setting background to', value, 'interpreted as',
newback
for i of [0..2] for i of [0..2]
backgroundRGB[i] = newback[i] backgroundRGB[i] = newback[i]
api.setGraphicsOptions 1, bgColor: colorsea(backgroundRGB).hex()
'title' 'title'
if adapParams.config?.commands
console.log 'Setting title to', value
api.evalCommand `TitlePoint = Corner(1,1) api.evalCommand `TitlePoint = Corner(1,1)
Text("${val}", TitlePoint + (2,5))` Text("${value}", TitlePoint + (2,5))`
/e\[\d+\]/ /e\[\d+\]/
num := parseInt(attr.slice(2)) num := parseInt(name.slice(2))
{commands, callbacks, parts} := jToG val, elements, num, backgroundRGB {commands, callbacks, parts} :=
jToG value, elements, num, backgroundRGB
if commands.length if commands.length
lastTried .= 0 lastTried .= 0
if commands.filter((&)).every (cmd) => if commands.filter((&)).every (cmd) =>
api.evalCommand(cmd) and ++lastTried api.evalCommand(cmd) and ++lastTried
callbacks.forEach &(api, parts) callbacks.forEach &(api, parts)
else console.log else console.warn
`Geogebra command '${commands[lastTried]}' `Geogebra command '${commands[lastTried]}'
(part of translation of '${val}') (part of translation of '${value}')
failed.` failed.`
else console.log `Could not parse command '${val}'` else console.warn `Could not parse command '${value}'`
else console.log `Unkown param ${param}` else console.warn `Unkown param ${name} = ${value}`
// function myListener(...args: unknown[]) {
// console.log 'In my listener with', args
// }
// window.myListener = myListener
// Parses a Joyce element-creating command, extending the elements // Parses a Joyce element-creating command, extending the elements
// by side effect: // by side effect:
@ -137,9 +149,12 @@ function jToG(
index: number, index: number,
backgroundRGB: RGB): Commander backgroundRGB: RGB): Commander
[jname, klass, method, data, ...colors] := jCom.split ';' [jname, klass, method, data, ...colors] := jCom.split ';'
if adapParams.config?.commands
console.log 'Defining', jname, 'as a', klass, 'constructed by',
method, 'from', data, 'colored as', colors
cmdr .= freshCommander() cmdr .= freshCommander()
unless klass in classHandler unless klass in classHandler
console.log `Unknown entity class ${klass}` console.warn `Unknown entity class ${klass}`
return cmdr return cmdr
assertJoyceClass klass // shouldn't need to do that :-/ assertJoyceClass klass // shouldn't need to do that :-/
name := if /^\p{L}\w*$/u.test jname then jname else geoname jname, elements name := if /^\p{L}\w*$/u.test jname then jname else geoname jname, elements
@ -151,7 +166,7 @@ function jToG(
(args.scalar ?= []).push scalar (args.scalar ?= []).push scalar
continue continue
unless jdep in elements unless jdep in elements
console.log `Reference to unknown geometric entity ${jdep} in $jCom}` console.warn `Reference to unknown geometric entity ${jdep} in $jCom}`
return cmdr return cmdr
usesCaptions.push jdep usesCaptions.push jdep
{klass: depKlass, otherName: depGeo, ends} := elements[jdep] {klass: depKlass, otherName: depGeo, ends} := elements[jdep]
@ -175,7 +190,7 @@ function jToG(
else // we have to decorate else // we have to decorate
dimension .= cmdr.parts.findLastIndex .includes name dimension .= cmdr.parts.findLastIndex .includes name
cmdr.callbacks.push (api: AppletObject, parts: DimParts) => cmdr.callbacks.push (api: AppletObject, parts: DimParts) =>
trace := false // e.g., klass is 'polygon' trace := adapParams.config?.color
// Operate in order faces, lines, point, caption so that // Operate in order faces, lines, point, caption so that
// we can adjust components after setting overall color, etc. // we can adjust components after setting overall color, etc.
@ -202,7 +217,7 @@ function jToG(
// Lines default to black: // Lines default to black:
if invisible colors[2] if invisible colors[2]
for each line of parts[1] for each line of parts[1]
unless line in elements if line is name or line not in elements
console.log 'Hiding line', line if trace console.log 'Hiding line', line if trace
api.setVisible line, false api.setVisible line, false
else else
@ -213,11 +228,12 @@ function jToG(
api.setColor line, ...lineRGB api.setColor line, ...lineRGB
// Now color the points: // Now color the points:
console.log 'Considering point colors for', name if trace
if invisible colors[1] if invisible colors[1]
// Hide all the dim-0 elements that are not their own independent // Hide all the dim-0 elements that are not distinct independent
// items: // items:
for each point of parts[0] for each point of parts[0]
unless point in elements if point is name or point not in elements
console.log 'Hiding point', point if trace console.log 'Hiding point', point if trace
api.setVisible point, false api.setVisible point, false
else if dimension is 0 or colors[1] // Need to color the points else if dimension is 0 or colors[1] // Need to color the points
@ -335,7 +351,7 @@ function joyce2rgb(cname: string, backgroundRGB?: RGB): RGB
[H,S,B] := cname.split(',').map (s) => parseInt s [H,S,B] := cname.split(',').map (s) => parseInt s
colorsea.hsv(H, S, B).rgb() colorsea.hsv(H, S, B).rgb()
else else
console.log 'Could not parse color:', cname console.warn 'Could not parse color:', cname
[128, 128, 128] [128, 128, 128]
function pointDefaultRGB(name: string, method: string): RGB function pointDefaultRGB(name: string, method: string): RGB
@ -485,8 +501,7 @@ classHandler: Record<JoyceClass, ClassHandler> :=
auxiliaries.push ...[1..4].map (n) => aux + n auxiliaries.push ...[1..4].map (n) => aux + n
unless madeSegment unless madeSegment
commands.push `${name} = Segment(${ends[0]},${ends[1]})` commands.push `${name} = Segment(${ends[0]},${ends[1]})`
callbacks.push (api: AppletObject) => callbacks.push (api: AppletObject) => api.setLabelVisible name, true
api.setLabelVisible name, true
parts[0].push ...ends parts[0].push ...ends
circle: (name, method, args) => circle: (name, method, args) =>
@ -522,9 +537,9 @@ classHandler: Record<JoyceClass, ClassHandler> :=
api.renameObject obj, newObj api.renameObject obj, newObj
switch api.getObjectType newObj switch api.getObjectType newObj
'segment' 'segment'
parts[1].push newObj moreParts[1].push newObj
'point' 'point'
parts[0].push newObj moreParts[0].push newObj
api.setVisible newObj, false api.setVisible newObj, false
/triangle|quadrilateral/ /triangle|quadrilateral/
pt := args.subpoints pt := args.subpoints
@ -539,9 +554,42 @@ classHandler: Record<JoyceClass, ClassHandler> :=
if obj is name continue if obj is name continue
newObj := 'GeoAux' + index + obj newObj := 'GeoAux' + index + obj
api.renameObject obj, newObj api.renameObject obj, newObj
parts[1].push newObj moreParts[1].push newObj
sector: (name, method, args, index) =>
return := freshCommander()
return.value.ends = ['', '']
{commands, callbacks, parts, auxiliaries, ends} := return.value
aux := name + 'aUx'
parts[2].push name
switch method
'sector'
unless args.subpoints?.length is 3 return
parts[0].push ...args.subpoints
[center, end, start] := args.subpoints
ends[0] = start
ends[1] = end
parms := center + ', ' + start + ', ' + end
commands.push
`${name} = CircularSector(${parms})`
`${aux}1 = CircularArc(${parms})`
parts[1].push aux + 1
callbacks.push (api: AppletObject) =>
api.setLineThickness name, 1
// The rest of this function is a weird roundabout way to make
// the lines of the sector have zero opacity.
// I got it from
// https://www.reddit.com/r/geogebra/comments/12cbr85/setlineopacity_command/
// I don't really understand how/why it works, but it seems to
// So that's good enough for me
xml := api.getXML name
xml.replace(/opacity="\d+"/, 'opacity="0"')
api.evalXML(xml)
// This last step is especially confusing... I think
// evaluating the modified XML created a sort of second
// copy of the entity, and so we have to hide the original one
api.setVisible name, false
sector: (name, method, args) => freshCommander()
plane: (name, method, args) => freshCommander() plane: (name, method, args) => freshCommander()
sphere: (name, method, args) => freshCommander() sphere: (name, method, args) => freshCommander()
polyhedron: (name, method, args) => freshCommander() polyhedron: (name, method, args) => freshCommander()

25
src/adapptypes.civet Normal file
View File

@ -0,0 +1,25 @@
export const flags = ['commands', 'color'] as const
export type FlagType = (typeof flags)[number]
export type ConfigType = Partial<Record<FlagType, boolean>>
export type AppletDescription
html: string
params: Record<string, string>
id: string
width: number
height: number
export type AdapParams
codebase?: string
loader?: string
config?: ConfigType
joyceApplets: AppletDescription[]
export function params(kids: HTMLCollection): Record<string, string>
return.value: Record<string, string> := {}
for each kid of kids
unless kid.tagName is 'PARAM' then continue
name := kid.getAttribute 'name'
value := kid.getAttribute 'value'
unless name and value then continue
return.value[name] = value

View File

@ -1,20 +1,21 @@
import https://code.jquery.com/jquery-3.7.1.js import ./deps/jquery.js
X3D from https://create3000.github.io/code/x_ite/latest/x_ite.mjs
{convert} from ./deps/vrml1to97/index.js {convert} from ./deps/vrml1to97/index.js
knownExtensions := /[.](?:wrl|x3d|gltf|glb|obj|stl|ply)$/ knownExtensions := /[.](?:wrl|x3d|gltf|glb|obj|stl|ply)$/
certainlyHandled := certainlyHandled :=
knownExtensions.source.slice(0, -2).split('wrl|')[1].split '|' knownExtensions.source.slice(0, -2).split('wrl|')[1].split '|'
function makeBrowser(url: string) function makeBrowser(url: string, width: string, height: string)
x_ite_rel := 'deps/x_ite/x_ite.mjs'
x_ite_url .= './' + x_ite_rel
unless typeof browser is 'undefined'
if browser?.runtime?.getURL
x_ite_url = browser.runtime.getURL x_ite_rel
const { default: X3D } = await import x_ite_url
canvas := X3D.createBrowser() canvas := X3D.createBrowser()
// Fix up css: smaller browser, but we can see the world info // Fix up css: smaller browser, but we can see the world info
$(canvas).css $(canvas).css {width, height, overflow: 'visible', 'vertical-align': 'top'}
width: '150px'
height: '150px'
overflow: 'visible'
'vertical-align': 'top'
x_ite_shadow := canvas.shadowRoot x_ite_shadow := canvas.shadowRoot
if x_ite_shadow if x_ite_shadow
x_ite_style := x_ite_shadow.querySelector 'link' x_ite_style := x_ite_shadow.querySelector 'link'
@ -30,8 +31,8 @@ function makeBrowser(url: string)
$(x_ite_browser).css overflow: 'visible' $(x_ite_browser).css overflow: 'visible'
// Now get the browser and load the requested VRML, converting if need be // Now get the browser and load the requested VRML, converting if need be
browser := X3D.getBrowser canvas browser3D := X3D.getBrowser canvas
browser.setBrowserOption 'StraightenHorizon', false browser3D.setBrowserOption 'StraightenHorizon', false
if certainlyHandled.some((ext) => url.includes ext) if certainlyHandled.some((ext) => url.includes ext)
canvas.setAttribute 'src', url canvas.setAttribute 'src', url
@ -41,31 +42,62 @@ function makeBrowser(url: string)
text .= await response.text() text .= await response.text()
if /#\s*VRML\s*V?1[.]/i.test text if /#\s*VRML\s*V?1[.]/i.test text
text = convert text text = convert text
browser.baseURL = url browser3D.baseURL = url
scene := await browser.createX3DFromString text scene := await browser3D.createX3DFromString text
browser.replaceWorld scene browser3D.replaceWorld scene
canvas canvas
// Put eye icons after all of the eligible links // Put eye icons after all of the eligible links
links := $('a').filter -> knownExtensions.test @.getAttribute('href') ?? '' links := $('a').filter -> knownExtensions.test @.getAttribute('href') ?? ''
links.after -> links.after ->
newSpan := $('<span>👁</span>') newSpan := $('<span>👁</span>')
newSpan.css 'overflow', 'visible'
floatLike := this.lastElementChild as HTMLElement
float .= ''
if floatLike
float = (floatLike.getAttribute('align') ?? '')
or floatLike.style.getPropertyValue 'float'
or window.getComputedStyle(floatLike).getPropertyValue 'float'
switch float
/left/i
float = 'left'
newSpan.css {float, position: 'relative'}
/right/i
float = 'right'
newSpan.css {float, position: 'relative'}
else float = ''
newSpan.hover newSpan.hover
(-> $(@).css 'background-color', 'lightblue'), (-> $(@).css 'background-color', 'lightblue'),
(-> $(@).css 'background-color', 'inherit') (-> $(@).css 'background-color', 'inherit')
newSpan.on 'click', @, newSpan.on 'click', @,
(e) => (e) =>
eye := e.target eye := e.target
state .= eye.getAttribute 'data' state .= eye.getAttribute 'data'
unless state unless state
state = 'off' state = 'off'
url := e.data.getAttribute('href') ?? '' url := e.data.getAttribute('href') ?? ''
$(eye).after await makeBrowser url overImg := floatLike and floatLike.tagName is 'IMG'
if state is 'off' width := overImg ? ($(floatLike).width() + 'px') : '150px'
eye.setAttribute 'data', 'on' height := overImg ? ($(floatLike).height() + 'px') : '150px'
$(eye).css 'text-decoration', 'line-through 3px' canvas := await makeBrowser url, width, height
$(eye.nextSibling as Element).show() if float
else canvas.style.float = float
eye.setAttribute 'data', 'off' if overImg
$(eye).css 'text-decoration', 'none' canvas.style.position = 'absolute'
$(eye.nextSibling as Element).hide() imgSty := window.getComputedStyle floatLike
canvas.style.marginTop = imgSty.getPropertyValue 'margin-top'
canvas.style.marginLeft = imgSty.getPropertyValue 'margin-left'
canvas.style.marginRight = imgSty.getPropertyValue 'margin-right'
if float is 'right'
canvas.style.left = $(eye).width() + 'px'
else
canvas.style.right = $(eye).width() + 'px'
$(eye).append canvas
if state is 'off'
eye.setAttribute 'data', 'on'
$(eye).css 'text-decoration', 'line-through 3px'
$(eye.lastElementChild as Element).show()
else
eye.setAttribute 'data', 'off'
$(eye).css 'text-decoration', 'none'
$(eye.lastElementChild as Element).hide()

View File

@ -1,4 +0,0 @@
console.log """
Hello, world --
This is the beginning of something!
"""

16
src/options.civet Normal file
View File

@ -0,0 +1,16 @@
import {flags} from ./adapptypes.ts
console.log('arrived')
boxes := ['commands', 'color']
cache := await browser.storage.local.get boxes
console.log('Found', cache)
for each box of boxes
checkbox := document.getElementById(box) as HTMLInputElement
unless checkbox then continue
checkbox.checked = cache[box] ?? false
document.body.addEventListener 'click', (event) ->
elt := event.target as HTMLInputElement
unless elt.tagName is 'INPUT' and elt.type is 'checkbox' then return
browser.storage.local.set [elt.id]: elt.checked

View File

@ -1,5 +1,8 @@
# Takes one parameter, the destination directory # Takes one parameter, the destination directory
mkdir -p $1 mkdir -p $1
cp etc/deps/jquery.js $1
cp -r etc/deps/x_ite $1
cp -r etc/deps/geotypes $1
cp -rL node_modules/vrml1to97/{deps,vrml1to97,streamToString.js} $1 cp -rL node_modules/vrml1to97/{deps,vrml1to97,streamToString.js} $1
cp -rL node_modules/colorsea/dist/index.esm.js $1/colorsea.js cp -rL node_modules/colorsea/dist/index.esm.js $1/colorsea.js
cp -rL node_modules/colorsea/dist/index.d.ts $1/colorsea.d.ts cp -rL node_modules/colorsea/dist/index.d.ts $1/colorsea.d.ts

View File

@ -1,16 +1,23 @@
mkdir -p etc/deps/geogebra mkdir -p etc/deps/geotypes
mkdir etc/deps/x_ite mkdir -p etc/deps/x_ite/assets/components
mkdir etc/deps/x_ite/assets/images
cp etc/geogebraPreamble.txt etc/deps/geogebra/api.ts curl 'https://download.geogebra.org/installers/5.0/geogebra-math-apps-bundle-5-0-803-0.zip' --output etc/deps/geo.zip
curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/api.ts' >> etc/deps/geogebra/api.ts unzip -d etc/deps etc/deps/geo.zip
rm etc/deps/geo.zip
cp etc/geogebraPreamble.txt etc/deps/geotypes/api.ts
curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/api.ts' >> etc/deps/geotypes/api.ts
cp etc/geogebraPreamble.txt etc/deps/geotypes/entry.ts
curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/entry.ts' >> etc/deps/geotypes/entry.ts
cp etc/geogebraPreamble.txt etc/deps/geotypes/params.ts
curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/params.ts' >> etc/deps/geotypes/params.ts
cp etc/geogebraPreamble.txt etc/deps/geogebra/entry.ts curl 'https://code.jquery.com/jquery-3.7.1.js' > etc/deps/jquery.js
curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/entry.ts' >> etc/deps/geogebra/entry.ts
cp etc/geogebraPreamble.txt etc/deps/geogebra/params.ts curl 'https://create3000.github.io/code/x_ite/latest/x_ite.mjs' > etc/deps/x_ite/x_ite.mjs
curl 'https://raw.githubusercontent.com/netless-io/netless-app/master/packages/app-geogebra/src/types/params.ts' >> etc/deps/geogebra/params.ts curl 'https://create3000.github.io/code/x_ite/latest/x_ite.css' > etc/deps/x_ite/x_ite.css
curl 'https://create3000.github.io/code/x_ite/latest/assets/components/Scripting.js' > etc/deps/x_ite/assets/components/Scripting.js
curl 'https://create3000.github.io/code/x_ite/latest/assets/components/Text.js' > etc/deps/x_ite/assets/components/Text.js
curl 'https://create3000.github.io/code/x_ite/latest/assets/images/logo.128.png' > etc/deps/x_ite/assets/images/logo.128.png
curl 'https://raw.githubusercontent.com/create3000/x_ite/development/dist/x_ite.d.ts' > etc/deps/x_ite/x_ite.d.ts.tmp curl 'https://raw.githubusercontent.com/create3000/x_ite/development/dist/x_ite.d.ts' > etc/deps/x_ite/x_ite.d.mts
sed -i -e 's/declare//g' etc/deps/x_ite/x_ite.d.ts.tmp
cat etc/x_itePreamble.txt etc/deps/x_ite/x_ite.d.ts.tmp etc/x_itePostamble.txt > etc/deps/x_ite/x_ite.d.ts
rm etc/deps/x_ite/x_ite.d.ts.tmp

13
tools/makePlugin.bash Normal file
View File

@ -0,0 +1,13 @@
# Takes one parameter, the destination directory
mkdir -p $1/deps/x_ite/assets/images
mkdir -p $1/deps/x_ite/assets/components
cp etc/manifest.json etc/options.html $1
cp etc/deps/x_ite/x_ite.css $1/deps/x_ite
cp etc/deps/x_ite/assets/images/logo.128.png $1/deps/x_ite/assets/images
cp etc/deps/x_ite/x_ite.mjs $1/deps/x_ite
cp etc/deps/x_ite/assets/components/* $1/deps/x_ite/assets/components
cp -r etc/deps/GeoGebra $1/deps
npx rollup public/js/giveAwrl.js --dir extension
npx rollup public/js/adapptlet.js --file extension/adapptlet.js
npx rollup public/js/adapptext.js --file extension/adapptext.js
cp public/js/options.js public/js/adapptypes.js extension