Skip to content

Commit

Permalink
Move sandbox files (#731)
Browse files Browse the repository at this point in the history
* Move sandbox files

* Update order
  • Loading branch information
toasted-nutbread authored Mar 4, 2024
1 parent 81fc2bd commit 4fe881d
Show file tree
Hide file tree
Showing 29 changed files with 50 additions and 50 deletions.
22 changes: 11 additions & 11 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -562,19 +562,19 @@
"ext/js/core/api-map.js",
"ext/js/core/extension-error.js",
"ext/js/core/json.js",
"ext/js/data/sandbox/anki-note-data-creator.js",
"ext/js/data/anki-note-data-creator.js",
"ext/js/dictionary/dictionary-data-util.js",
"ext/js/display/sandbox/pronunciation-generator.js",
"ext/js/display/sandbox/structured-content-generator.js",
"ext/js/dom/sandbox/css-style-applier.js",
"ext/js/display/pronunciation-generator.js",
"ext/js/display/structured-content-generator.js",
"ext/js/dom/css-style-applier.js",
"ext/js/language/ja/japanese.js",
"ext/js/language/text-utilities.js",
"ext/js/templates/sandbox/anki-template-renderer-content-manager.js",
"ext/js/templates/sandbox/anki-template-renderer.js",
"ext/js/templates/sandbox/template-renderer-frame-api.js",
"ext/js/templates/sandbox/template-renderer-frame-main.js",
"ext/js/templates/sandbox/template-renderer-media-provider.js",
"ext/js/templates/sandbox/template-renderer.js"
"ext/js/templates/anki-template-renderer-content-manager.js",
"ext/js/templates/anki-template-renderer.js",
"ext/js/templates/template-renderer-frame-api.js",
"ext/js/templates/template-renderer-frame-main.js",
"ext/js/templates/template-renderer-media-provider.js",
"ext/js/templates/template-renderer.js"
],
"env": {
"webextensions": false
Expand Down Expand Up @@ -626,11 +626,11 @@
"ext/js/core/to-error.js",
"ext/js/core/utilities.js",
"ext/js/data/anki-util.js",
"ext/js/data/array-buffer-util.js",
"ext/js/data/database.js",
"ext/js/data/json-schema.js",
"ext/js/data/options-util.js",
"ext/js/data/permissions-util.js",
"ext/js/data/sandbox/array-buffer-util.js",
"ext/js/dictionary/dictionary-database.js",
"ext/js/dom/native-simple-dom-parser.js",
"ext/js/dom/simple-dom-parser.js",
Expand Down
4 changes: 2 additions & 2 deletions dev/jsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,15 @@
"../ext/js/data/database.js",
"../ext/js/data/json-schema.js",
"../ext/js/general/cache-map.js",
"../ext/js/data/sandbox/anki-note-data-creator.js",
"../ext/js/data/anki-note-data-creator.js",
"../ext/js/general/cache-map.js",
"../ext/js/general/regex-util.js",
"../ext/js/general/text-source-map.js",
"../ext/js/language/language-transformer.js",
"../ext/js/dictionary/dictionary-importer.js",
"../ext/js/dictionary/dictionary-database.js",
"../ext/js/dictionary/dictionary-data-util.js",
"../ext/js/language/sandbox/japanese-util.js",
"../ext/js/language/japanese-util.js",
"../ext/js/language/translator.js",
"../ext/js/media/media-util.js",
"../types/dev/**/*.ts",
Expand Down
2 changes: 1 addition & 1 deletion docs/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Helpers

Yomitan supports several custom Handlebars helpers for rendering templates.
The source code for these templates can be found [here](../ext/js/templates/sandbox/anki-template-renderer.js).
The source code for these templates can be found [here](../ext/js/templates/anki-template-renderer.js).

### `dumpObject`

Expand Down
2 changes: 1 addition & 1 deletion ext/js/background/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ import {log} from '../core/log.js';
import {isObjectNotArray} from '../core/object-utilities.js';
import {clone, deferPromise, promiseTimeout} from '../core/utilities.js';
import {isNoteDataValid} from '../data/anki-util.js';
import {arrayBufferToBase64} from '../data/array-buffer-util.js';
import {OptionsUtil} from '../data/options-util.js';
import {getAllPermissions, hasPermissions, hasRequiredPermissionsForOptions} from '../data/permissions-util.js';
import {arrayBufferToBase64} from '../data/sandbox/array-buffer-util.js';
import {DictionaryDatabase} from '../dictionary/dictionary-database.js';
import {Environment} from '../extension/environment.js';
import {ObjectPropertyAccessor} from '../general/object-property-accessor.js';
Expand Down
2 changes: 1 addition & 1 deletion ext/js/background/offscreen-proxy.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import {ExtensionError} from '../core/extension-error.js';
import {isObjectNotArray} from '../core/object-utilities.js';
import {base64ToArrayBuffer} from '../data/sandbox/array-buffer-util.js';
import {base64ToArrayBuffer} from '../data/array-buffer-util.js';

/**
* This class is responsible for creating and communicating with an offscreen document.
Expand Down
2 changes: 1 addition & 1 deletion ext/js/background/offscreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

import {ClipboardReader} from '../comm/clipboard-reader.js';
import {createApiMap, invokeApiMapHandler} from '../core/api-map.js';
import {arrayBufferToBase64} from '../data/sandbox/array-buffer-util.js';
import {arrayBufferToBase64} from '../data/array-buffer-util.js';
import {DictionaryDatabase} from '../dictionary/dictionary-database.js';
import {Translator} from '../language/translator.js';

Expand Down
4 changes: 2 additions & 2 deletions ext/js/data/anki-note-builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export class AnkiNoteBuilder {
/**
* Initiate an instance of AnkiNoteBuilder.
* @param {import('anki-note-builder').MinimalApi} api
* @param {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/sandbox/template-renderer.js').TemplateRenderer} templateRenderer
* @param {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/template-renderer.js').TemplateRenderer} templateRenderer
*/
constructor(api, templateRenderer) {
/** @type {import('anki-note-builder').MinimalApi} */
this._api = api;
/** @type {RegExp} */
this._markerPattern = cloneFieldMarkerPattern(true);
/** @type {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/sandbox/template-renderer.js').TemplateRenderer} */
/** @type {import('../templates/template-renderer-proxy.js').TemplateRendererProxy|import('../templates/template-renderer.js').TemplateRenderer} */
this._templateRenderer = templateRenderer;
/** @type {import('anki-note-builder').BatchedRequestGroup[]} */
this._batchedRequests = [];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {getDisambiguations, getGroupedPronunciations, getPronunciationsOfType, getTermFrequency, groupTermTags} from '../../dictionary/dictionary-data-util.js';
import {distributeFurigana, distributeFuriganaInflected} from '../../language/ja/japanese.js';
import {getDisambiguations, getGroupedPronunciations, getPronunciationsOfType, getTermFrequency, groupTermTags} from '../dictionary/dictionary-data-util.js';
import {distributeFurigana, distributeFuriganaInflected} from '../language/ja/japanese.js';

/**
* Creates a compatibility representation of the specified data.
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion ext/js/display/display-content-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
*/

import {EventListenerCollection} from '../core/event-listener-collection.js';
import {base64ToArrayBuffer} from '../data/sandbox/array-buffer-util.js';
import {base64ToArrayBuffer} from '../data/array-buffer-util.js';

/**
* The content manager which is used when generating HTML display content.
Expand Down
4 changes: 2 additions & 2 deletions ext/js/display/display-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ import {getDisambiguations, getGroupedPronunciations, getTermFrequency, groupKan
import {HtmlTemplateCollection} from '../dom/html-template-collection.js';
import {distributeFurigana, getKanaMorae, getPitchCategory, isCodePointKanji} from '../language/ja/japanese.js';
import {getLanguageFromText} from '../language/text-utilities.js';
import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from './sandbox/pronunciation-generator.js';
import {StructuredContentGenerator} from './sandbox/structured-content-generator.js';
import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from './pronunciation-generator.js';
import {StructuredContentGenerator} from './structured-content-generator.js';

export class DisplayGenerator {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {getKanaDiacriticInfo, isMoraPitchHigh} from '../../language/ja/japanese.js';
import {getKanaDiacriticInfo, isMoraPitchHigh} from '../language/ja/japanese.js';

/**
* @param {string[]} morae
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {getLanguageFromText} from '../../language/text-utilities.js';
import {getLanguageFromText} from '../language/text-utilities.js';

export class StructuredContentGenerator {
/**
* @param {import('../../display/display-content-manager.js').DisplayContentManager|import('../../templates/sandbox/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} contentManager
* @param {import('./display-content-manager.js').DisplayContentManager|import('../templates/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} contentManager
* @param {Document} document
*/
constructor(contentManager, document) {
/** @type {import('../../display/display-content-manager.js').DisplayContentManager|import('../../templates/sandbox/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} */
/** @type {import('./display-content-manager.js').DisplayContentManager|import('../templates/anki-template-renderer-content-manager.js').AnkiTemplateRendererContentManager} */
this._contentManager = contentManager;
/** @type {Document} */
this._document = document;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {readResponseJson} from '../../core/json.js';
import {readResponseJson} from '../core/json.js';

/**
* This class is used to apply CSS styles to elements using a consistent method
Expand Down
2 changes: 1 addition & 1 deletion ext/js/dom/dom-text-scanner.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {readCodePointsBackward, readCodePointsForward} from '../data/sandbox/string-util.js';
import {readCodePointsBackward, readCodePointsForward} from '../data/string-util.js';

/**
* A class used to scan text in a document.
Expand Down
2 changes: 1 addition & 1 deletion ext/js/dom/text-source-element.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {readCodePointsBackward, readCodePointsForward} from '../data/sandbox/string-util.js';
import {readCodePointsBackward, readCodePointsForward} from '../data/string-util.js';
import {convertMultipleRectZoomCoordinates} from './document-util.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion ext/js/media/audio-downloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import {RequestBuilder} from '../background/request-builder.js';
import {ExtensionError} from '../core/extension-error.js';
import {readResponseJson} from '../core/json.js';
import {arrayBufferToBase64} from '../data/array-buffer-util.js';
import {JsonSchema} from '../data/json-schema.js';
import {arrayBufferToBase64} from '../data/sandbox/array-buffer-util.js';
import {NativeSimpleDOMParser} from '../dom/native-simple-dom-parser.js';
import {SimpleDOMParser} from '../dom/simple-dom-parser.js';
import {isStringEntirelyKana} from '../language/ja/japanese.js';
Expand Down
2 changes: 1 addition & 1 deletion ext/js/pages/settings/backup-controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ import {parseJson} from '../../core/json.js';
import {log} from '../../core/log.js';
import {isObjectNotArray} from '../../core/object-utilities.js';
import {toError} from '../../core/to-error.js';
import {arrayBufferUtf8Decode} from '../../data/array-buffer-util.js';
import {OptionsUtil} from '../../data/options-util.js';
import {getAllPermissions} from '../../data/permissions-util.js';
import {arrayBufferUtf8Decode} from '../../data/sandbox/array-buffer-util.js';
import {querySelectorNotNull} from '../../dom/query-selector.js';
import {DictionaryController} from './dictionary-controller.js';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {Handlebars} from '../../../lib/handlebars.js';
import {createAnkiNoteData} from '../../data/sandbox/anki-note-data-creator.js';
import {getPronunciationsOfType, isNonNounVerbOrAdjective} from '../../dictionary/dictionary-data-util.js';
import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from '../../display/sandbox/pronunciation-generator.js';
import {StructuredContentGenerator} from '../../display/sandbox/structured-content-generator.js';
import {CssStyleApplier} from '../../dom/sandbox/css-style-applier.js';
import {convertHiraganaToKatakana, convertKatakanaToHiragana, distributeFurigana, getKanaMorae, getPitchCategory, isMoraPitchHigh} from '../../language/ja/japanese.js';
import {Handlebars} from '../../lib/handlebars.js';
import {createAnkiNoteData} from '../data/anki-note-data-creator.js';
import {getPronunciationsOfType, isNonNounVerbOrAdjective} from '../dictionary/dictionary-data-util.js';
import {createPronunciationDownstepPosition, createPronunciationGraph, createPronunciationText} from '../display/pronunciation-generator.js';
import {StructuredContentGenerator} from '../display/structured-content-generator.js';
import {CssStyleApplier} from '../dom/css-style-applier.js';
import {convertHiraganaToKatakana, convertKatakanaToHiragana, distributeFurigana, getKanaMorae, getPitchCategory, isMoraPitchHigh} from '../language/ja/japanese.js';
import {AnkiTemplateRendererContentManager} from './anki-template-renderer-content-manager.js';
import {TemplateRendererMediaProvider} from './template-renderer-media-provider.js';
import {TemplateRenderer} from './template-renderer.js';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {createApiMap, invokeApiMapHandler} from '../../core/api-map.js';
import {parseJson} from '../../core/json.js';
import {createApiMap, invokeApiMapHandler} from '../core/api-map.js';
import {parseJson} from '../core/json.js';

export class TemplateRendererFrameApi {
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {Handlebars} from '../../../lib/handlebars.js';
import {Handlebars} from '../../lib/handlebars.js';

export class TemplateRendererMediaProvider {
constructor() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

import {Handlebars} from '../../../lib/handlebars.js';
import {ExtensionError} from '../../core/extension-error.js';
import {Handlebars} from '../../lib/handlebars.js';
import {ExtensionError} from '../core/extension-error.js';

export class TemplateRenderer {
constructor() {
Expand Down
2 changes: 1 addition & 1 deletion ext/template-renderer.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="icon" type="image/png" href="/images/icon48.png" sizes="48x48">
<link rel="icon" type="image/png" href="/images/icon64.png" sizes="64x64">
<link rel="icon" type="image/png" href="/images/icon128.png" sizes="128x128">
<script src="/js/templates/sandbox/template-renderer-frame-main.js" type="module"></script>
<script src="/js/templates/template-renderer-frame-main.js" type="module"></script>
</head>
<body>

Expand Down
2 changes: 1 addition & 1 deletion test/eslint-config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const targets = [
{
name: 'sandbox',
paths: [
'ext/js/templates/sandbox/template-renderer-frame-main.js'
'ext/js/templates/template-renderer-frame-main.js'
],
/** @type {import('test/eslint-config').MinimalEslintConfigEnv} */
env: {
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/anki-template-renderer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/

import {vi} from 'vitest';
import {AnkiTemplateRenderer} from '../../ext/js/templates/sandbox/anki-template-renderer.js';
import {AnkiTemplateRenderer} from '../../ext/js/templates/anki-template-renderer.js';
import {fetch} from '../mocks/common.js';
import {createDomTest} from './dom-test.js';

Expand Down
4 changes: 2 additions & 2 deletions test/utilities/anki.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@
*/

import {AnkiNoteBuilder} from '../../ext/js/data/anki-note-builder.js';
import {createAnkiNoteData} from '../../ext/js/data/anki-note-data-creator.js';
import {getStandardFieldMarkers} from '../../ext/js/data/anki-template-util.js';
import {createAnkiNoteData} from '../../ext/js/data/sandbox/anki-note-data-creator.js';
import {AnkiTemplateRenderer} from '../../ext/js/templates/sandbox/anki-template-renderer.js';
import {AnkiTemplateRenderer} from '../../ext/js/templates/anki-template-renderer.js';

/**
* @param {import('dictionary').DictionaryEntryType} type
Expand Down

0 comments on commit 4fe881d

Please sign in to comment.