Pop-up dictionary browser extension for language learning. Successor to Yomichan. (PERSONAL FORK)

Move sandbox files (#731)

* Move sandbox files

* Update order

authored by

toasted-nutbread and committed by
GitHub
4fe881d6 81fc2bd6

+50 -50
+11 -11
.eslintrc.json
··· 562 562 "ext/js/core/api-map.js", 563 563 "ext/js/core/extension-error.js", 564 564 "ext/js/core/json.js", 565 - "ext/js/data/sandbox/anki-note-data-creator.js", 565 + "ext/js/data/anki-note-data-creator.js", 566 566 "ext/js/dictionary/dictionary-data-util.js", 567 - "ext/js/display/sandbox/pronunciation-generator.js", 568 - "ext/js/display/sandbox/structured-content-generator.js", 569 - "ext/js/dom/sandbox/css-style-applier.js", 567 + "ext/js/display/pronunciation-generator.js", 568 + "ext/js/display/structured-content-generator.js", 569 + "ext/js/dom/css-style-applier.js", 570 570 "ext/js/language/ja/japanese.js", 571 571 "ext/js/language/text-utilities.js", 572 - "ext/js/templates/sandbox/anki-template-renderer-content-manager.js", 573 - "ext/js/templates/sandbox/anki-template-renderer.js", 574 - "ext/js/templates/sandbox/template-renderer-frame-api.js", 575 - "ext/js/templates/sandbox/template-renderer-frame-main.js", 576 - "ext/js/templates/sandbox/template-renderer-media-provider.js", 577 - "ext/js/templates/sandbox/template-renderer.js" 572 + "ext/js/templates/anki-template-renderer-content-manager.js", 573 + "ext/js/templates/anki-template-renderer.js", 574 + "ext/js/templates/template-renderer-frame-api.js", 575 + "ext/js/templates/template-renderer-frame-main.js", 576 + "ext/js/templates/template-renderer-media-provider.js", 577 + "ext/js/templates/template-renderer.js" 578 578 ], 579 579 "env": { 580 580 "webextensions": false ··· 626 626 "ext/js/core/to-error.js", 627 627 "ext/js/core/utilities.js", 628 628 "ext/js/data/anki-util.js", 629 + "ext/js/data/array-buffer-util.js", 629 630 "ext/js/data/database.js", 630 631 "ext/js/data/json-schema.js", 631 632 "ext/js/data/options-util.js", 632 633 "ext/js/data/permissions-util.js", 633 - "ext/js/data/sandbox/array-buffer-util.js", 634 634 "ext/js/dictionary/dictionary-database.js", 635 635 "ext/js/dom/native-simple-dom-parser.js", 636 636 "ext/js/dom/simple-dom-parser.js",
+2 -2
dev/jsconfig.json
··· 63 63 "../ext/js/data/database.js", 64 64 "../ext/js/data/json-schema.js", 65 65 "../ext/js/general/cache-map.js", 66 - "../ext/js/data/sandbox/anki-note-data-creator.js", 66 + "../ext/js/data/anki-note-data-creator.js", 67 67 "../ext/js/general/cache-map.js", 68 68 "../ext/js/general/regex-util.js", 69 69 "../ext/js/general/text-source-map.js", ··· 71 71 "../ext/js/dictionary/dictionary-importer.js", 72 72 "../ext/js/dictionary/dictionary-database.js", 73 73 "../ext/js/dictionary/dictionary-data-util.js", 74 - "../ext/js/language/sandbox/japanese-util.js", 74 + "../ext/js/language/japanese-util.js", 75 75 "../ext/js/language/translator.js", 76 76 "../ext/js/media/media-util.js", 77 77 "../types/dev/**/*.ts",
+1 -1
docs/templates.md
··· 3 3 ## Helpers 4 4 5 5 Yomitan supports several custom Handlebars helpers for rendering templates. 6 - The source code for these templates can be found [here](../ext/js/templates/sandbox/anki-template-renderer.js). 6 + The source code for these templates can be found [here](../ext/js/templates/anki-template-renderer.js). 7 7 8 8 ### `dumpObject` 9 9
+1 -1
ext/js/background/backend.js
··· 29 29 import {isObjectNotArray} from '../core/object-utilities.js'; 30 30 import {clone, deferPromise, promiseTimeout} from '../core/utilities.js'; 31 31 import {isNoteDataValid} from '../data/anki-util.js'; 32 + import {arrayBufferToBase64} from '../data/array-buffer-util.js'; 32 33 import {OptionsUtil} from '../data/options-util.js'; 33 34 import {getAllPermissions, hasPermissions, hasRequiredPermissionsForOptions} from '../data/permissions-util.js'; 34 - import {arrayBufferToBase64} from '../data/sandbox/array-buffer-util.js'; 35 35 import {DictionaryDatabase} from '../dictionary/dictionary-database.js'; 36 36 import {Environment} from '../extension/environment.js'; 37 37 import {ObjectPropertyAccessor} from '../general/object-property-accessor.js';
+1 -1
ext/js/background/offscreen-proxy.js
··· 18 18 19 19 import {ExtensionError} from '../core/extension-error.js'; 20 20 import {isObjectNotArray} from '../core/object-utilities.js'; 21 - import {base64ToArrayBuffer} from '../data/sandbox/array-buffer-util.js'; 21 + import {base64ToArrayBuffer} from '../data/array-buffer-util.js'; 22 22 23 23 /** 24 24 * This class is responsible for creating and communicating with an offscreen document.
+1 -1
ext/js/background/offscreen.js
··· 18 18 19 19 import {ClipboardReader} from '../comm/clipboard-reader.js'; 20 20 import {createApiMap, invokeApiMapHandler} from '../core/api-map.js'; 21 - import {arrayBufferToBase64} from '../data/sandbox/array-buffer-util.js'; 21 + import {arrayBufferToBase64} from '../data/array-buffer-util.js'; 22 22 import {DictionaryDatabase} from '../dictionary/dictionary-database.js'; 23 23 import {Translator} from '../language/translator.js'; 24 24
+2 -2
ext/js/data/anki-note-builder.js
··· 25 25 /** 26 26 * Initiate an instance of AnkiNoteBuilder. 27 27 * @param {import('anki-note-builder').MinimalApi} api 28 - * @param {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/sandbox/template-renderer.js').TemplateRenderer} templateRenderer 28 + * @param {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/template-renderer.js').TemplateRenderer} templateRenderer 29 29 */ 30 30 constructor(api, templateRenderer) { 31 31 /** @type {import('anki-note-builder').MinimalApi} */ 32 32 this._api = api; 33 33 /** @type {RegExp} */ 34 34 this._markerPattern = cloneFieldMarkerPattern(true); 35 - /** @type {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/sandbox/template-renderer.js').TemplateRenderer} */ 35 + /** @type {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/template-renderer.js').TemplateRenderer} */ 36 36 this._templateRenderer = templateRenderer; 37 37 /** @type {import('anki-note-builder').BatchedRequestGroup[]} */ 38 38 this._batchedRequests = [];
+2 -2
ext/js/data/sandbox/anki-note-data-creator.js ext/js/data/anki-note-data-creator.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {getDisambiguations, getGroupedPronunciations, getPronunciationsOfType, getTermFrequency, groupTermTags} from '../../dictionary/dictionary-data-util.js'; 20 - import {distributeFurigana, distributeFuriganaInflected} from '../../language/ja/japanese.js'; 19 + import {getDisambiguations, getGroupedPronunciations, getPronunciationsOfType, getTermFrequency, groupTermTags} from '../dictionary/dictionary-data-util.js'; 20 + import {distributeFurigana, distributeFuriganaInflected} from '../language/ja/japanese.js'; 21 21 22 22 /** 23 23 * Creates a compatibility representation of the specified data.
ext/js/data/sandbox/array-buffer-util.js ext/js/data/array-buffer-util.js
ext/js/data/sandbox/string-util.js ext/js/data/string-util.js
+1 -1
ext/js/display/display-content-manager.js
··· 17 17 */ 18 18 19 19 import {EventListenerCollection} from '../core/event-listener-collection.js'; 20 - import {base64ToArrayBuffer} from '../data/sandbox/array-buffer-util.js'; 20 + import {base64ToArrayBuffer} from '../data/array-buffer-util.js'; 21 21 22 22 /** 23 23 * The content manager which is used when generating HTML display content.
+2 -2
ext/js/display/display-generator.js
··· 21 21 import {HtmlTemplateCollection} from '../dom/html-template-collection.js'; 22 22 import {distributeFurigana, getKanaMorae, getPitchCategory, isCodePointKanji} from '../language/ja/japanese.js'; 23 23 import {getLanguageFromText} from '../language/text-utilities.js'; 24 - import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from './sandbox/pronunciation-generator.js'; 25 - import {StructuredContentGenerator} from './sandbox/structured-content-generator.js'; 24 + import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from './pronunciation-generator.js'; 25 + import {StructuredContentGenerator} from './structured-content-generator.js'; 26 26 27 27 export class DisplayGenerator { 28 28 /**
+1 -1
ext/js/display/sandbox/pronunciation-generator.js ext/js/display/pronunciation-generator.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {getKanaDiacriticInfo, isMoraPitchHigh} from '../../language/ja/japanese.js'; 19 + import {getKanaDiacriticInfo, isMoraPitchHigh} from '../language/ja/japanese.js'; 20 20 21 21 /** 22 22 * @param {string[]} morae
+3 -3
ext/js/display/sandbox/structured-content-generator.js ext/js/display/structured-content-generator.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {getLanguageFromText} from '../../language/text-utilities.js'; 19 + import {getLanguageFromText} from '../language/text-utilities.js'; 20 20 21 21 export class StructuredContentGenerator { 22 22 /** 23 - * @param {import('../../display/display-content-manager.js').DisplayContentManager|import('../../templates/sandbox/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} contentManager 23 + * @param {import('./display-content-manager.js').DisplayContentManager|import('../templates/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} contentManager 24 24 * @param {Document} document 25 25 */ 26 26 constructor(contentManager, document) { 27 - /** @type {import('../../display/display-content-manager.js').DisplayContentManager|import('../../templates/sandbox/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} */ 27 + /** @type {import('./display-content-manager.js').DisplayContentManager|import('../templates/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} */ 28 28 this._contentManager = contentManager; 29 29 /** @type {Document} */ 30 30 this._document = document;
+1 -1
ext/js/dom/dom-text-scanner.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {readCodePointsBackward, readCodePointsForward} from '../data/sandbox/string-util.js'; 19 + import {readCodePointsBackward, readCodePointsForward} from '../data/string-util.js'; 20 20 21 21 /** 22 22 * A class used to scan text in a document.
+1 -1
ext/js/dom/sandbox/css-style-applier.js ext/js/dom/css-style-applier.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {readResponseJson} from '../../core/json.js'; 19 + import {readResponseJson} from '../core/json.js'; 20 20 21 21 /** 22 22 * This class is used to apply CSS styles to elements using a consistent method
+1 -1
ext/js/dom/text-source-element.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {readCodePointsBackward, readCodePointsForward} from '../data/sandbox/string-util.js'; 19 + import {readCodePointsBackward, readCodePointsForward} from '../data/string-util.js'; 20 20 import {convertMultipleRectZoomCoordinates} from './document-util.js'; 21 21 22 22 /**
+1 -1
ext/js/media/audio-downloader.js
··· 19 19 import {RequestBuilder} from '../background/request-builder.js'; 20 20 import {ExtensionError} from '../core/extension-error.js'; 21 21 import {readResponseJson} from '../core/json.js'; 22 + import {arrayBufferToBase64} from '../data/array-buffer-util.js'; 22 23 import {JsonSchema} from '../data/json-schema.js'; 23 - import {arrayBufferToBase64} from '../data/sandbox/array-buffer-util.js'; 24 24 import {NativeSimpleDOMParser} from '../dom/native-simple-dom-parser.js'; 25 25 import {SimpleDOMParser} from '../dom/simple-dom-parser.js'; 26 26 import {isStringEntirelyKana} from '../language/ja/japanese.js';
+1 -1
ext/js/pages/settings/backup-controller.js
··· 21 21 import {log} from '../../core/log.js'; 22 22 import {isObjectNotArray} from '../../core/object-utilities.js'; 23 23 import {toError} from '../../core/to-error.js'; 24 + import {arrayBufferUtf8Decode} from '../../data/array-buffer-util.js'; 24 25 import {OptionsUtil} from '../../data/options-util.js'; 25 26 import {getAllPermissions} from '../../data/permissions-util.js'; 26 - import {arrayBufferUtf8Decode} from '../../data/sandbox/array-buffer-util.js'; 27 27 import {querySelectorNotNull} from '../../dom/query-selector.js'; 28 28 import {DictionaryController} from './dictionary-controller.js'; 29 29
ext/js/templates/sandbox/anki-template-renderer-content-manager.js ext/js/templates/anki-template-renderer-content-manager.js
+7 -7
ext/js/templates/sandbox/anki-template-renderer.js ext/js/templates/anki-template-renderer.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {Handlebars} from '../../../lib/handlebars.js'; 20 - import {createAnkiNoteData} from '../../data/sandbox/anki-note-data-creator.js'; 21 - import {getPronunciationsOfType, isNonNounVerbOrAdjective} from '../../dictionary/dictionary-data-util.js'; 22 - import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from '../../display/sandbox/pronunciation-generator.js'; 23 - import {StructuredContentGenerator} from '../../display/sandbox/structured-content-generator.js'; 24 - import {CssStyleApplier} from '../../dom/sandbox/css-style-applier.js'; 25 - import {convertHiraganaToKatakana, convertKatakanaToHiragana, distributeFurigana, getKanaMorae, getPitchCategory, isMoraPitchHigh} from '../../language/ja/japanese.js'; 19 + import {Handlebars} from '../../lib/handlebars.js'; 20 + import {createAnkiNoteData} from '../data/anki-note-data-creator.js'; 21 + import {getPronunciationsOfType, isNonNounVerbOrAdjective} from '../dictionary/dictionary-data-util.js'; 22 + import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from '../display/pronunciation-generator.js'; 23 + import {StructuredContentGenerator} from '../display/structured-content-generator.js'; 24 + import {CssStyleApplier} from '../dom/css-style-applier.js'; 25 + import {convertHiraganaToKatakana, convertKatakanaToHiragana, distributeFurigana, getKanaMorae, getPitchCategory, isMoraPitchHigh} from '../language/ja/japanese.js'; 26 26 import {AnkiTemplateRendererContentManager} from './anki-template-renderer-content-manager.js'; 27 27 import {TemplateRendererMediaProvider} from './template-renderer-media-provider.js'; 28 28 import {TemplateRenderer} from './template-renderer.js';
+2 -2
ext/js/templates/sandbox/template-renderer-frame-api.js ext/js/templates/template-renderer-frame-api.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {createApiMap, invokeApiMapHandler} from '../../core/api-map.js'; 20 - import {parseJson} from '../../core/json.js'; 19 + import {createApiMap, invokeApiMapHandler} from '../core/api-map.js'; 20 + import {parseJson} from '../core/json.js'; 21 21 22 22 export class TemplateRendererFrameApi { 23 23 /**
ext/js/templates/sandbox/template-renderer-frame-main.js ext/js/templates/template-renderer-frame-main.js
+1 -1
ext/js/templates/sandbox/template-renderer-media-provider.js ext/js/templates/template-renderer-media-provider.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {Handlebars} from '../../../lib/handlebars.js'; 19 + import {Handlebars} from '../../lib/handlebars.js'; 20 20 21 21 export class TemplateRendererMediaProvider { 22 22 constructor() {
+2 -2
ext/js/templates/sandbox/template-renderer.js ext/js/templates/template-renderer.js
··· 16 16 * along with this program. If not, see <https://www.gnu.org/licenses/>. 17 17 */ 18 18 19 - import {Handlebars} from '../../../lib/handlebars.js'; 20 - import {ExtensionError} from '../../core/extension-error.js'; 19 + import {Handlebars} from '../../lib/handlebars.js'; 20 + import {ExtensionError} from '../core/extension-error.js'; 21 21 22 22 export class TemplateRenderer { 23 23 constructor() {
+1 -1
ext/template-renderer.html
··· 11 11 <link rel="icon" type="image/png" href="/images/icon48.png" sizes="48x48"> 12 12 <link rel="icon" type="image/png" href="/images/icon64.png" sizes="64x64"> 13 13 <link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128"> 14 - <script src="/js/templates/sandbox/template-renderer-frame-main.js" type="module"></script> 14 + <script src="/js/templates/template-renderer-frame-main.js" type="module"></script> 15 15 </head> 16 16 <body> 17 17
+1 -1
test/eslint-config.test.js
··· 90 90 { 91 91 name: 'sandbox', 92 92 paths: [ 93 - 'ext/js/templates/sandbox/template-renderer-frame-main.js' 93 + 'ext/js/templates/template-renderer-frame-main.js' 94 94 ], 95 95 /** @type {import('test/eslint-config').MinimalEslintConfigEnv} */ 96 96 env: {
+1 -1
test/fixtures/anki-template-renderer-test.js
··· 16 16 */ 17 17 18 18 import {vi} from 'vitest'; 19 - import {AnkiTemplateRenderer} from '../../ext/js/templates/sandbox/anki-template-renderer.js'; 19 + import {AnkiTemplateRenderer} from '../../ext/js/templates/anki-template-renderer.js'; 20 20 import {fetch} from '../mocks/common.js'; 21 21 import {createDomTest} from './dom-test.js'; 22 22
+2 -2
test/utilities/anki.js
··· 16 16 */ 17 17 18 18 import {AnkiNoteBuilder} from '../../ext/js/data/anki-note-builder.js'; 19 + import {createAnkiNoteData} from '../../ext/js/data/anki-note-data-creator.js'; 19 20 import {getStandardFieldMarkers} from '../../ext/js/data/anki-template-util.js'; 20 - import {createAnkiNoteData} from '../../ext/js/data/sandbox/anki-note-data-creator.js'; 21 - import {AnkiTemplateRenderer} from '../../ext/js/templates/sandbox/anki-template-renderer.js'; 21 + import {AnkiTemplateRenderer} from '../../ext/js/templates/anki-template-renderer.js'; 22 22 23 23 /** 24 24 * @param {import('dictionary').DictionaryEntryType} type