@jupyterlab/codeeditor 0.18.2 → 0.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +34 -0
- package/package.json +15 -9
- package/lib/editor.js.map +0 -1
- package/lib/factory.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/jsoneditor.js.map +0 -1
- package/lib/mimetype.js.map +0 -1
- package/lib/widget.js.map +0 -1
package/LICENSE
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
Copyright (c) 2015 Project Jupyter Contributors
|
|
2
|
+
All rights reserved.
|
|
3
|
+
|
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
|
6
|
+
|
|
7
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
8
|
+
list of conditions and the following disclaimer.
|
|
9
|
+
|
|
10
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
11
|
+
this list of conditions and the following disclaimer in the documentation
|
|
12
|
+
and/or other materials provided with the distribution.
|
|
13
|
+
|
|
14
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
15
|
+
contributors may be used to endorse or promote products derived from
|
|
16
|
+
this software without specific prior written permission.
|
|
17
|
+
|
|
18
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
19
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
20
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
21
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
22
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
23
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
24
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
25
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
26
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
27
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
28
|
+
|
|
29
|
+
Semver File License
|
|
30
|
+
===================
|
|
31
|
+
|
|
32
|
+
The semver.py file is from https://github.com/podhmo/python-semver
|
|
33
|
+
which is licensed under the "MIT" license. See the semver.py file for details.
|
|
34
|
+
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jupyterlab/codeeditor",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.19.1",
|
|
4
4
|
"description": "JupyterLab - Abstract Code Editor",
|
|
5
5
|
"homepage": "https://github.com/jupyterlab/jupyterlab",
|
|
6
6
|
"bugs": {
|
|
@@ -24,24 +24,30 @@
|
|
|
24
24
|
"url": "https://github.com/jupyterlab/jupyterlab.git"
|
|
25
25
|
},
|
|
26
26
|
"scripts": {
|
|
27
|
-
"build": "tsc",
|
|
27
|
+
"build": "tsc -b",
|
|
28
28
|
"clean": "rimraf lib",
|
|
29
|
+
"docs": "typedoc --options tdoptions.json --theme ../../typedoc-theme src",
|
|
29
30
|
"prepublishOnly": "npm run build",
|
|
30
|
-
"watch": "tsc -
|
|
31
|
+
"watch": "tsc -b --watch"
|
|
31
32
|
},
|
|
32
33
|
"dependencies": {
|
|
33
|
-
"@jupyterlab/coreutils": "^2.1
|
|
34
|
-
"@jupyterlab/observables": "^2.
|
|
34
|
+
"@jupyterlab/coreutils": "^2.2.1",
|
|
35
|
+
"@jupyterlab/observables": "^2.1.1",
|
|
35
36
|
"@phosphor/coreutils": "^1.3.0",
|
|
36
37
|
"@phosphor/disposable": "^1.1.2",
|
|
37
38
|
"@phosphor/messaging": "^1.2.2",
|
|
38
39
|
"@phosphor/signaling": "^1.2.2",
|
|
39
40
|
"@phosphor/widgets": "^1.6.0",
|
|
40
|
-
"react": "~16.4.
|
|
41
|
-
"react-dom": "~16.4.
|
|
41
|
+
"react": "~16.4.2",
|
|
42
|
+
"react-dom": "~16.4.2"
|
|
42
43
|
},
|
|
43
44
|
"devDependencies": {
|
|
44
45
|
"rimraf": "~2.6.2",
|
|
45
|
-
"
|
|
46
|
-
|
|
46
|
+
"typedoc": "~0.12.0",
|
|
47
|
+
"typescript": "~3.1.1"
|
|
48
|
+
},
|
|
49
|
+
"publishConfig": {
|
|
50
|
+
"access": "public"
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "7fc900168981e58051253ecc66a18015a052cd2f"
|
|
47
53
|
}
|
package/lib/editor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"editor.js","sourceRoot":"","sources":["../../../../codeeditor/src/editor.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAM3D,mDAAsD;AAItD,yDAOiC;AAEjC;;;;;;;GAOG;AACH,IAAiB,UAAU,CAmqB1B;AAnqBD,WAAiB,UAAU;IA+EzB;;OAEG;IACU,gCAAqB,GAAoB;QACpD,SAAS,EAAE,EAAE;QACb,WAAW,EAAE,EAAE;QACf,KAAK,EAAE,OAAO;KACf,CAAC;IAwFF;;OAEG;IACH;QACE;;WAEG;QACH,YAAY,OAAwB;YAyF5B,gBAAW,GAAG,KAAK,CAAC;YACpB,qBAAgB,GAAG,IAAI,kBAAM,CAA6B,IAAI,CAAC,CAAC;YAzFtE,OAAO,GAAG,OAAO,IAAI,EAAE,CAAC;YAExB,IAAI,OAAO,CAAC,OAAO,EAAE;gBACnB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;aAChC;iBAAM;gBACL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AW,CAAC;QAC1B,CAAC;QAED;;WAEG;QACH,OAAO;YACL,IAAI,IAAI,CAAC,WAAW,EAAE;gBACpB,OAAO;aACR;YACD,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC;YACxB,kBAAM,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;QACzB,CAAC;QAEO,kBAAkB,CACxB,QAA0B,EAC1B,IAAkC;YAElC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC;gBACzB,IAAI,EAAE,UAAU;gBAChB,QAAQ,EAAE,IAAI,CAAC,QAAkB;gBACjC,QAAQ,EAAE,IAAI,CAAC,QAAkB;aAClC,CAAC,CAAC;QACL,CAAC;KAIF;IA/FY,gBAAK,QA+FjB,CAAA;IAkVD;;OAEG;IACQ,wBAAa,GAAY;QAClC,UAAU,EAAE,IAAI;QAChB,QAAQ,EAAE,IAAI;QACd,UAAU,EAAE,IAAI;QAChB,WAAW,EAAE,KAAK;QAClB,QAAQ,EAAE,IAAI;QACd,cAAc,EAAE,EAAE;QAClB,QAAQ,EAAE,KAAK;QACf,OAAO,EAAE,CAAC;QACV,YAAY,EAAE,IAAI;QAClB,aAAa,EAAE,IAAI;QACnB,mBAAmB,EAAE,IAAI;KAC1B,CAAC;AAkDJ,CAAC,EAnqBgB,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAmqB1B","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { JSONObject } from '@phosphor/coreutils';\n\nimport { IDisposable } from '@phosphor/disposable';\n\nimport { ISignal, Signal } from '@phosphor/signaling';\n\nimport { IChangedArgs } from '@jupyterlab/coreutils';\n\nimport {\n IModelDB,\n ModelDB,\n IObservableValue,\n ObservableValue,\n IObservableMap,\n IObservableString\n} from '@jupyterlab/observables';\n\n/**\n * A namespace for code editors.\n *\n * #### Notes\n * - A code editor is a set of common assumptions which hold for all concrete editors.\n * - Changes in implementations of the code editor should only be caused by changes in concrete editors.\n * - Common JLab services which are based on the code editor should belong to `IEditorServices`.\n */\nexport namespace CodeEditor {\n /**\n * A zero-based position in the editor.\n */\n export interface IPosition extends JSONObject {\n /**\n * The cursor line number.\n */\n readonly line: number;\n\n /**\n * The cursor column number.\n */\n readonly column: number;\n }\n\n /**\n * The dimension of an element.\n */\n export interface IDimension {\n /**\n * The width of an element in pixels.\n */\n readonly width: number;\n\n /**\n * The height of an element in pixels.\n */\n readonly height: number;\n }\n\n /**\n * An interface describing editor state coordinates.\n */\n export interface ICoordinate extends JSONObject, ClientRect {}\n\n /**\n * A range.\n */\n export interface IRange extends JSONObject {\n /**\n * The position of the first character in the current range.\n *\n * #### Notes\n * If this position is greater than [end] then the range is considered\n * to be backward.\n */\n readonly start: IPosition;\n\n /**\n * The position of the last character in the current range.\n *\n * #### Notes\n * If this position is less than [start] then the range is considered\n * to be backward.\n */\n readonly end: IPosition;\n }\n\n /**\n * A selection style.\n */\n export interface ISelectionStyle extends JSONObject {\n /**\n * A class name added to a selection.\n */\n className: string;\n\n /**\n * A display name added to a selection.\n */\n displayName: string;\n\n /**\n * A color for UI elements.\n */\n color: string;\n }\n\n /**\n * The default selection style.\n */\n export const defaultSelectionStyle: ISelectionStyle = {\n className: '',\n displayName: '',\n color: 'black'\n };\n\n /**\n * A text selection.\n */\n export interface ITextSelection extends IRange {\n /**\n * The uuid of the text selection owner.\n */\n readonly uuid: string;\n\n /**\n * The style of this selection.\n */\n readonly style: ISelectionStyle;\n }\n\n /**\n * An interface for a text token, such as a word, keyword, or variable.\n */\n export interface IToken {\n /**\n * The value of the token.\n */\n value: string;\n\n /**\n * The offset of the token in the code editor.\n */\n offset: number;\n\n /**\n * An optional type for the token.\n */\n type?: string;\n }\n\n /**\n * An interface to manage selections by selection owners.\n *\n * #### Definitions\n * - a user code that has an associated uuid is called a selection owner, see `CodeEditor.ISelectionOwner`\n * - a selection belongs to a selection owner only if it is associated with the owner by an uuid, see `CodeEditor.ITextSelection`\n *\n * #### Read access\n * - any user code can observe any selection\n *\n * #### Write access\n * - if a user code is a selection owner then:\n * - it can change selections belonging to it\n * - but it must not change selections belonging to other selection owners\n * - otherwise it must not change any selection\n */\n\n /**\n * An editor model.\n */\n export interface IModel extends IDisposable {\n /**\n * A signal emitted when a property changes.\n */\n mimeTypeChanged: ISignal<IModel, IChangedArgs<string>>;\n\n /**\n * The text stored in the model.\n */\n readonly value: IObservableString;\n\n /**\n * A mime type of the model.\n *\n * #### Notes\n * It is never `null`, the default mime type is `text/plain`.\n */\n mimeType: string;\n\n /**\n * The currently selected code.\n */\n readonly selections: IObservableMap<ITextSelection[]>;\n\n /**\n * The underlying `IModelDB` instance in which model\n * data is stored.\n */\n readonly modelDB: IModelDB;\n }\n\n /**\n * The default implementation of the editor model.\n */\n export class Model implements IModel {\n /**\n * Construct a new Model.\n */\n constructor(options?: Model.IOptions) {\n options = options || {};\n\n if (options.modelDB) {\n this.modelDB = options.modelDB;\n } else {\n this.modelDB = new ModelDB();\n }\n\n let value = this.modelDB.createString('value');\n value.text = value.text || options.value || '';\n\n let mimeType = this.modelDB.createValue('mimeType');\n mimeType.set(options.mimeType || 'text/plain');\n mimeType.changed.connect(this._onMimeTypeChanged, this);\n\n this.modelDB.createMap('selections');\n }\n\n /**\n * The underlying `IModelDB` instance in which model\n * data is stored.\n */\n readonly modelDB: IModelDB;\n\n /**\n * A signal emitted when a mimetype changes.\n */\n get mimeTypeChanged(): ISignal<this, IChangedArgs<string>> {\n return this._mimeTypeChanged;\n }\n\n /**\n * Get the value of the model.\n */\n get value(): IObservableString {\n return this.modelDB.get('value') as IObservableString;\n }\n\n /**\n * Get the selections for the model.\n */\n get selections(): IObservableMap<ITextSelection[]> {\n return this.modelDB.get('selections') as IObservableMap<ITextSelection[]>;\n }\n\n /**\n * A mime type of the model.\n */\n get mimeType(): string {\n return this.modelDB.getValue('mimeType') as string;\n }\n set mimeType(newValue: string) {\n const oldValue = this.mimeType;\n if (oldValue === newValue) {\n return;\n }\n this.modelDB.setValue('mimeType', newValue);\n }\n\n /**\n * Whether the model is disposed.\n */\n get isDisposed(): boolean {\n return this._isDisposed;\n }\n\n /**\n * Dispose of the resources used by the model.\n */\n dispose(): void {\n if (this._isDisposed) {\n return;\n }\n this._isDisposed = true;\n Signal.clearData(this);\n }\n\n private _onMimeTypeChanged(\n mimeType: IObservableValue,\n args: ObservableValue.IChangedArgs\n ): void {\n this._mimeTypeChanged.emit({\n name: 'mimeType',\n oldValue: args.oldValue as string,\n newValue: args.newValue as string\n });\n }\n\n private _isDisposed = false;\n private _mimeTypeChanged = new Signal<this, IChangedArgs<string>>(this);\n }\n\n /**\n * A selection owner.\n */\n export interface ISelectionOwner {\n /**\n * The uuid of this selection owner.\n */\n uuid: string;\n\n /**\n * Returns the primary position of the cursor, never `null`.\n */\n getCursorPosition(): IPosition;\n\n /**\n * Set the primary position of the cursor.\n *\n * @param position - The new primary position.\n *\n * #### Notes\n * This will remove any secondary cursors.\n */\n setCursorPosition(position: IPosition): void;\n\n /**\n * Returns the primary selection, never `null`.\n */\n getSelection(): IRange;\n\n /**\n * Set the primary selection.\n *\n * @param selection - The desired selection range.\n *\n * #### Notes\n * This will remove any secondary cursors.\n */\n setSelection(selection: IRange): void;\n\n /**\n * Gets the selections for all the cursors, never `null` or empty.\n */\n getSelections(): IRange[];\n\n /**\n * Sets the selections for all the cursors.\n *\n * @param selections - The new selections.\n *\n * #### Notes\n * Cursors will be removed or added, as necessary.\n * Passing an empty array resets a cursor position to the start of a\n * document.\n */\n setSelections(selections: IRange[]): void;\n }\n\n /**\n * A keydown handler type.\n *\n * #### Notes\n * Return `true` to prevent the default handling of the event by the\n * editor.\n */\n export type KeydownHandler = (\n instance: IEditor,\n event: KeyboardEvent\n ) => boolean;\n\n /**\n * The location of requested edges.\n */\n export type EdgeLocation = 'top' | 'bottom';\n\n /**\n * A widget that provides a code editor.\n */\n export interface IEditor extends ISelectionOwner, IDisposable {\n /**\n * A signal emitted when either the top or bottom edge is requested.\n */\n readonly edgeRequested: ISignal<IEditor, EdgeLocation>;\n\n /**\n * The default selection style for the editor.\n */\n selectionStyle: CodeEditor.ISelectionStyle;\n\n /**\n * The DOM node that hosts the editor.\n */\n readonly host: HTMLElement;\n\n /**\n * The model used by the editor.\n */\n readonly model: IModel;\n\n /**\n * The height of a line in the editor in pixels.\n */\n readonly lineHeight: number;\n\n /**\n * The widget of a character in the editor in pixels.\n */\n readonly charWidth: number;\n\n /**\n * Get the number of lines in the eidtor.\n */\n readonly lineCount: number;\n\n /**\n * Get a config option for the editor.\n */\n getOption<K extends keyof IConfig>(option: K): IConfig[K];\n\n /**\n * Set a config option for the editor.\n */\n setOption<K extends keyof IConfig>(option: K, value: IConfig[K]): void;\n\n /**\n * Returns the content for the given line number.\n *\n * @param line - The line of interest.\n *\n * @returns The value of the line.\n *\n * #### Notes\n * Lines are 0-based, and accessing a line out of range returns\n * `undefined`.\n */\n getLine(line: number): string | undefined;\n\n /**\n * Find an offset for the given position.\n *\n * @param position - The position of interest.\n *\n * @returns The offset at the position, clamped to the extent of the\n * editor contents.\n */\n getOffsetAt(position: IPosition): number;\n\n /**\n * Find a position for the given offset.\n *\n * @param offset - The offset of interest.\n *\n * @returns The position at the offset, clamped to the extent of the\n * editor contents.\n */\n getPositionAt(offset: number): IPosition | undefined;\n\n /**\n * Undo one edit (if any undo events are stored).\n */\n undo(): void;\n\n /**\n * Redo one undone edit.\n */\n redo(): void;\n\n /**\n * Clear the undo history.\n */\n clearHistory(): void;\n\n /**\n * Brings browser focus to this editor text.\n */\n focus(): void;\n\n /**\n * Test whether the editor has keyboard focus.\n */\n hasFocus(): boolean;\n\n /**\n * Explicitly blur the editor.\n */\n blur(): void;\n\n /**\n * Repaint the editor.\n *\n * #### Notes\n * A repainted editor should fit to its host node.\n */\n refresh(): void;\n\n /**\n * Resize the editor to fit its host node.\n */\n resizeToFit(): void;\n\n /**\n * Add a keydown handler to the editor.\n *\n * @param handler - A keydown handler.\n *\n * @returns A disposable that can be used to remove the handler.\n */\n addKeydownHandler(handler: KeydownHandler): IDisposable;\n\n /**\n * Set the size of the editor.\n *\n * @param size - The desired size.\n *\n * #### Notes\n * Use `null` if the size is unknown.\n */\n setSize(size: IDimension | null): void;\n\n /**\n * Reveals the given position in the editor.\n *\n * @param position - The desired position to reveal.\n */\n revealPosition(position: IPosition): void;\n\n /**\n * Reveals the given selection in the editor.\n *\n * @param position - The desired selection to reveal.\n */\n revealSelection(selection: IRange): void;\n\n /**\n * Get the window coordinates given a cursor position.\n *\n * @param position - The desired position.\n *\n * @returns The coordinates of the position.\n */\n getCoordinateForPosition(position: IPosition): ICoordinate;\n\n /**\n * Get the cursor position given window coordinates.\n *\n * @param coordinate - The desired coordinate.\n *\n * @returns The position of the coordinates, or null if not\n * contained in the editor.\n */\n getPositionForCoordinate(coordinate: ICoordinate): IPosition | null;\n\n /**\n * Inserts a new line at the cursor position and indents it.\n */\n newIndentedLine(): void;\n\n /**\n * Gets the token at a given position.\n */\n getTokenForPosition(position: IPosition): IToken;\n\n /**\n * Gets the list of tokens for the editor model.\n */\n getTokens(): IToken[];\n }\n\n /**\n * A factory used to create a code editor.\n */\n export type Factory = (options: IOptions) => CodeEditor.IEditor;\n\n /**\n * The configuration options for an editor.\n */\n export interface IConfig {\n /**\n * User preferred font family for text editors.\n */\n fontFamily: string | null;\n\n /**\n * User preferred size in pixel of the font used in text editors.\n */\n fontSize: number | null;\n\n /**\n * User preferred text line height, as a multiplier of font size.\n */\n lineHeight: number | null;\n\n /**\n * Whether line numbers should be displayed.\n */\n lineNumbers: boolean;\n\n /**\n * Control the line wrapping of the editor. Possible values are:\n * - \"off\", lines will never wrap.\n * - \"on\", lines will wrap at the viewport border.\n * - \"wordWrapColumn\", lines will wrap at `wordWrapColumn`.\n * - \"bounded\", lines will wrap at minimum between viewport width and wordWrapColumn.\n */\n lineWrap: 'off' | 'on' | 'wordWrapColumn' | 'bounded';\n\n /**\n * Whether the editor is read-only.\n */\n readOnly: boolean;\n\n /**\n * The number of spaces a tab is equal to.\n */\n tabSize: number;\n\n /**\n * Whether to insert spaces when pressing Tab.\n */\n insertSpaces: boolean;\n\n /**\n * Whether to highlight matching brackets when one of them is selected.\n */\n matchBrackets: boolean;\n\n /**\n * Whether to automatically close brackets after opening them.\n */\n autoClosingBrackets: boolean;\n\n /**\n * The column where to break text line.\n */\n wordWrapColumn: number;\n }\n\n /**\n * The default configuration options for an editor.\n */\n export let defaultConfig: IConfig = {\n fontFamily: null,\n fontSize: null,\n lineHeight: null,\n lineNumbers: false,\n lineWrap: 'on',\n wordWrapColumn: 80,\n readOnly: false,\n tabSize: 4,\n insertSpaces: true,\n matchBrackets: true,\n autoClosingBrackets: true\n };\n\n /**\n * The options used to initialize an editor.\n */\n export interface IOptions {\n /**\n * The host widget used by the editor.\n */\n host: HTMLElement;\n\n /**\n * The model used by the editor.\n */\n model: IModel;\n\n /**\n * The desired uuid for the editor.\n */\n uuid?: string;\n\n /**\n * The default selection style for the editor.\n */\n selectionStyle?: Partial<CodeEditor.ISelectionStyle>;\n\n /**\n * The configuration options for the editor.\n */\n config?: Partial<IConfig>;\n }\n\n export namespace Model {\n export interface IOptions {\n /**\n * The initial value of the model.\n */\n value?: string;\n\n /**\n * The mimetype of the model.\n */\n mimeType?: string;\n\n /**\n * An optional modelDB for storing model state.\n */\n modelDB?: IModelDB;\n }\n }\n}\n"]}
|
package/lib/factory.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../codeeditor/src/factory.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { CodeEditor } from './editor';\n\n/**\n * The editor factory service interface.\n */\nexport interface IEditorFactoryService {\n /**\n * Create a new editor for inline code.\n */\n newInlineEditor(options: CodeEditor.IOptions): CodeEditor.IEditor;\n\n /**\n * Create a new editor for a full document.\n */\n newDocumentEditor(options: CodeEditor.IOptions): CodeEditor.IEditor;\n}\n"]}
|
package/lib/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../codeeditor/src/index.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;;;;AAE3D,mDAA4C;AAM5C,8BAA4B;AAE5B,8BAAyB;AACzB,kCAA6B;AAC7B,8BAAyB;AAEzB,gCAA2B;AAE3B,oBAAoB;AACpB;;GAEG;AACU,QAAA,eAAe,GAAG,IAAI,iBAAK,CACtC,wCAAwC,CACzC,CAAC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { Token } from '@phosphor/coreutils';\n\nimport { IEditorFactoryService } from './factory';\n\nimport { IEditorMimeTypeService } from './mimetype';\n\nimport '../style/index.css';\n\nexport * from './editor';\nexport * from './jsoneditor';\nexport * from './widget';\nexport * from './factory';\nexport * from './mimetype';\n\n/* tslint:disable */\n/**\n * Code editor services token.\n */\nexport const IEditorServices = new Token<IEditorServices>(\n '@jupyterlab/codeeditor:IEditorServices'\n);\n/* tslint:enable */\n\n/**\n * Code editor services.\n */\nexport interface IEditorServices {\n /**\n * The code editor factory.\n */\n readonly factoryService: IEditorFactoryService;\n\n /**\n * The editor mime type service.\n */\n readonly mimeTypeService: IEditorMimeTypeService;\n}\n"]}
|
package/lib/jsoneditor.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"jsoneditor.js","sourceRoot":"","sources":["../../../../codeeditor/src/jsoneditor.tsx"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;;;;;;;;AAI3D,mDAA0D;AAI1D,+CAA2C;AAE3C,6CAA+B;AAE/B,oDAAsC;AAEtC,qCAAsC;AAEtC;;GAEG;AACH,MAAM,gBAAgB,GAAG,eAAe,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,GAAG,cAAc,CAAC;AAEnC;;GAEG;AACH,MAAM,UAAU,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,KAAP,OAAO,QA0BhB","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { IObservableJSON } from '@jupyterlab/observables';\n\nimport { JSONExt, JSONObject } from '@phosphor/coreutils';\n\nimport { Message } from '@phosphor/messaging';\n\nimport { Widget } from '@phosphor/widgets';\n\nimport * as React from 'react';\n\nimport * as ReactDOM from 'react-dom';\n\nimport { CodeEditor } from './editor';\n\n/**\n * The class name added to a JSONEditor instance.\n */\nconst JSONEDITOR_CLASS = 'jp-JSONEditor';\n\n/**\n * The class name added when the Metadata editor contains invalid JSON.\n */\nconst ERROR_CLASS = 'jp-mod-error';\n\n/**\n * The class name added to the editor host node.\n */\nconst HOST_CLASS = 'jp-JSONEditor-host';\n\n/**\n * The class name added to the header area.\n */\nconst HEADER_CLASS = 'jp-JSONEditor-header';\n\n/**\n * The class name added to the title node.\n */\nconst TITLE_CLASS = 'jp-JSONEditor-title';\n\n/**\n * The class name added to the collapser node.\n */\nconst COLLAPSER_CLASS = 'jp-JSONEditor-collapser';\n\n/**\n * The class name added to the collapser node that is enabled.\n */\nconst COLLAPSE_ENABLED_CLASS = 'jp-mod-collapse-enabled';\n\n/**\n * The class name added to the revert button.\n */\nconst REVERT_CLASS = 'jp-JSONEditor-revertButton';\n\n/**\n * The class name added to the commit button.\n */\nconst COMMIT_CLASS = 'jp-JSONEditor-commitButton';\n\n/**\n * The class name added to collapsed items.\n */\nconst COLLAPSED_CLASS = 'jp-mod-collapsed';\n\n/**\n * A widget for editing observable JSON.\n */\nexport class JSONEditor extends Widget {\n /**\n * Construct a new JSON editor.\n */\n constructor(options: JSONEditor.IOptions) {\n super();\n\n this.addClass(JSONEDITOR_CLASS);\n ReactDOM.render(Private.createEditorContent(options), this.node);\n\n let host = this.editorHostNode;\n let model = new CodeEditor.Model();\n\n model.value.text = 'No data!';\n model.mimeType = 'application/json';\n model.value.changed.connect(this._onValueChanged, this);\n this.model = model;\n this.editor = options.editorFactory({ host, model });\n this.editor.setOption('readOnly', true);\n this.collapsible = !!options.collapsible;\n }\n\n /**\n * The code editor used by the editor.\n */\n readonly editor: CodeEditor.IEditor;\n\n /**\n * The code editor model used by the editor.\n */\n readonly model: CodeEditor.IModel;\n\n /**\n * Whether the editor is collapsible.\n */\n readonly collapsible: boolean;\n\n /**\n * The title of the editor.\n */\n get editorTitle(): string {\n return this.titleNode.textContent || '';\n }\n set editorTitle(value: string) {\n this.titleNode.textContent = value;\n }\n\n /**\n * Get the editor host node used by the JSON editor.\n */\n get editorHostNode(): HTMLElement {\n return this.node.getElementsByClassName(HOST_CLASS)[0] as HTMLElement;\n }\n\n /**\n * Get the header node used by the JSON editor.\n */\n get headerNode(): HTMLElement {\n return this.node.getElementsByClassName(HEADER_CLASS)[0] as HTMLElement;\n }\n\n /**\n * Get the title node used by the JSON editor.\n */\n get titleNode(): HTMLElement {\n return this.node.getElementsByClassName(TITLE_CLASS)[0] as HTMLElement;\n }\n\n /**\n * Get the collapser node used by the JSON editor.\n */\n get collapserNode(): HTMLElement {\n return this.node.getElementsByClassName(COLLAPSER_CLASS)[0] as HTMLElement;\n }\n\n /**\n * Get the revert button used by the JSON editor.\n */\n get revertButtonNode(): HTMLElement {\n return this.node.getElementsByClassName(REVERT_CLASS)[0] as HTMLElement;\n }\n\n /**\n * Get the commit button used by the JSON editor.\n */\n get commitButtonNode(): HTMLElement {\n return this.node.getElementsByClassName(COMMIT_CLASS)[0] as HTMLElement;\n }\n\n /**\n * The observable source.\n */\n get source(): IObservableJSON | null {\n return this._source;\n }\n set source(value: IObservableJSON | null) {\n if (this._source === value) {\n return;\n }\n if (this._source) {\n this._source.changed.disconnect(this._onSourceChanged, this);\n }\n this._source = value;\n this.editor.setOption('readOnly', value === null);\n if (value) {\n value.changed.connect(this._onSourceChanged, this);\n }\n this._setValue();\n }\n\n /**\n * Get whether the editor is dirty.\n */\n get isDirty(): boolean {\n return this._dataDirty || this._inputDirty;\n }\n\n /**\n * Handle the DOM events for the widget.\n *\n * @param event - The DOM event sent to the widget.\n *\n * #### Notes\n * This method implements the DOM `EventListener` interface and is\n * called in response to events on the notebook panel's node. It should\n * not be called directly by user code.\n */\n handleEvent(event: Event): void {\n switch (event.type) {\n case 'blur':\n this._evtBlur(event as FocusEvent);\n break;\n case 'click':\n this._evtClick(event as MouseEvent);\n break;\n default:\n break;\n }\n }\n\n /**\n * Handle `after-attach` messages for the widget.\n */\n protected onAfterAttach(msg: Message): void {\n let node = this.editorHostNode;\n node.addEventListener('blur', this, true);\n node.addEventListener('click', this, true);\n this.revertButtonNode.hidden = true;\n this.commitButtonNode.hidden = true;\n this.headerNode.addEventListener('click', this);\n if (this.isVisible) {\n this.update();\n }\n }\n\n /**\n * Handle `after-show` messages for the widget.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n }\n\n /**\n * Handle `update-request` messages for the widget.\n */\n protected onUpdateRequest(msg: Message): void {\n this.editor.refresh();\n }\n\n /**\n * Handle `before-detach` messages for the widget.\n */\n protected onBeforeDetach(msg: Message): void {\n let node = this.editorHostNode;\n node.removeEventListener('blur', this, true);\n node.removeEventListener('click', this, true);\n this.headerNode.removeEventListener('click', this);\n }\n\n /**\n * Handle a change to the metadata of the source.\n */\n private _onSourceChanged(\n sender: IObservableJSON,\n args: IObservableJSON.IChangedArgs\n ) {\n if (this._changeGuard) {\n return;\n }\n if (this._inputDirty || this.editor.hasFocus()) {\n this._dataDirty = true;\n return;\n }\n this._setValue();\n }\n\n /**\n * Handle change events.\n */\n private _onValueChanged(): void {\n let valid = true;\n try {\n let value = JSON.parse(this.editor.model.value.text);\n this.removeClass(ERROR_CLASS);\n this._inputDirty =\n !this._changeGuard && !JSONExt.deepEqual(value, this._originalValue);\n } catch (err) {\n this.addClass(ERROR_CLASS);\n this._inputDirty = true;\n valid = false;\n }\n this.revertButtonNode.hidden = !this._inputDirty;\n this.commitButtonNode.hidden = !valid || !this._inputDirty;\n }\n\n /**\n * Handle blur events for the text area.\n */\n private _evtBlur(event: FocusEvent): void {\n // Update the metadata if necessary.\n if (!this._inputDirty && this._dataDirty) {\n this._setValue();\n }\n }\n\n /**\n * Handle click events for the buttons.\n */\n private _evtClick(event: MouseEvent): void {\n let target = event.target as HTMLElement;\n switch (target) {\n case this.revertButtonNode:\n this._setValue();\n break;\n case this.commitButtonNode:\n if (!this.commitButtonNode.hidden && !this.hasClass(ERROR_CLASS)) {\n this._changeGuard = true;\n this._mergeContent();\n this._changeGuard = false;\n this._setValue();\n }\n break;\n case this.titleNode:\n case this.collapserNode:\n if (this.collapsible) {\n let collapser = this.collapserNode;\n if (collapser.classList.contains(COLLAPSED_CLASS)) {\n collapser.classList.remove(COLLAPSED_CLASS);\n this.editorHostNode.classList.remove(COLLAPSED_CLASS);\n } else {\n collapser.classList.add(COLLAPSED_CLASS);\n this.editorHostNode.classList.add(COLLAPSED_CLASS);\n }\n }\n break;\n case this.editorHostNode:\n this.editor.focus();\n break;\n default:\n break;\n }\n }\n\n /**\n * Merge the user content.\n */\n private _mergeContent(): void {\n let model = this.editor.model;\n let current = this._source ? this._source.toJSON() : {};\n let old = this._originalValue;\n let user = JSON.parse(model.value.text) as JSONObject;\n let source = this.source;\n if (!source) {\n return;\n }\n\n // If it is in user and has changed from old, set in current.\n for (let key in user) {\n if (!JSONExt.deepEqual(user[key], old[key] || null)) {\n current[key] = user[key];\n }\n }\n // If it was in old and is not in user, remove from current.\n for (let key in old) {\n if (!(key in user)) {\n delete current[key];\n source.delete(key);\n }\n }\n // Set the values.\n for (let key in current) {\n source.set(key, current[key]);\n }\n }\n\n /**\n * Set the value given the owner contents.\n */\n private _setValue(): void {\n this._dataDirty = false;\n this._inputDirty = false;\n this.revertButtonNode.hidden = true;\n this.commitButtonNode.hidden = true;\n this.removeClass(ERROR_CLASS);\n let model = this.editor.model;\n let content = this._source ? this._source.toJSON() : {};\n this._changeGuard = true;\n if (content === void 0) {\n model.value.text = 'No data!';\n this._originalValue = JSONExt.emptyObject;\n } else {\n let value = JSON.stringify(content, null, 4);\n model.value.text = value;\n this._originalValue = content;\n // Move the cursor to within the brace.\n if (value.length > 1 && value[0] === '{') {\n this.editor.setCursorPosition({ line: 0, column: 1 });\n }\n }\n this.editor.refresh();\n this._changeGuard = false;\n this.commitButtonNode.hidden = true;\n this.revertButtonNode.hidden = true;\n }\n\n private _dataDirty = false;\n private _inputDirty = false;\n private _source: IObservableJSON | null = null;\n private _originalValue = JSONExt.emptyObject;\n private _changeGuard = false;\n}\n\n/**\n * The static namespace JSONEditor class statics.\n */\nexport namespace JSONEditor {\n /**\n * The options used to initialize a json editor.\n */\n export interface IOptions {\n /**\n * The editor factory used by the editor.\n */\n editorFactory: CodeEditor.Factory;\n\n /**\n * The title of the editor. Defaults to an empty string.\n */\n title?: string;\n\n /**\n * Whether the title should be collapsible. Defaults to `false`.\n */\n collapsible?: boolean;\n }\n}\n\n/**\n * The namespace for module private data.\n */\nnamespace Private {\n /**\n * Create the JSON Editor node's content.\n */\n export function createEditorContent(\n options: JSONEditor.IOptions\n ): React.ReactElement<any> {\n const revertTitle = 'Revert changes to data';\n const confirmTitle = 'Commit changes to data';\n const title = options.title || '';\n const collapseClass = options.collapsible\n ? `${COLLAPSER_CLASS} ${COLLAPSE_ENABLED_CLASS}`\n : COLLAPSER_CLASS;\n\n return (\n <React.Fragment>\n <div className={HEADER_CLASS}>\n <span className={TITLE_CLASS}>{title}</span>\n <span className={collapseClass} />\n <span className={REVERT_CLASS} title={revertTitle} />\n <span className={COMMIT_CLASS} title={confirmTitle} />\n </div>\n <div className={HOST_CLASS} />\n </React.Fragment>\n );\n }\n}\n"]}
|
package/lib/mimetype.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mimetype.js","sourceRoot":"","sources":["../../../../codeeditor/src/mimetype.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAiC3D;;GAEG;AACH,IAAiB,sBAAsB,CAKtC;AALD,WAAiB,sBAAsB;IACrC;;OAEG;IACU,sCAAe,GAAW,YAAY,CAAC;AACtD,CAAC,EALgB,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKtC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { nbformat } from '@jupyterlab/coreutils';\n\n/**\n * The mime type service of a code editor.\n */\nexport interface IEditorMimeTypeService {\n /**\n * Get a mime type for the given language info.\n *\n * @param info - The language information.\n *\n * @returns A valid mimetype.\n *\n * #### Notes\n * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.\n */\n getMimeTypeByLanguage(info: nbformat.ILanguageInfoMetadata): string;\n\n /**\n * Get a mime type for the given file path.\n *\n * @param filePath - The full path to the file.\n *\n * @returns A valid mimetype.\n *\n * #### Notes\n * If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.\n */\n getMimeTypeByFilePath(filePath: string): string;\n}\n\n/**\n * A namespace for `IEditorMimeTypeService`.\n */\nexport namespace IEditorMimeTypeService {\n /**\n * The default mime type.\n */\n export const defaultMimeType: string = 'text/plain';\n}\n"]}
|
package/lib/widget.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"widget.js","sourceRoot":"","sources":["../../../../codeeditor/src/widget.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2DAA2D;;AAI3D,+CAA2C;AAI3C;;GAEG;AACH,MAAM,mBAAmB,GAAG,8BAA8B,CAAC;AAE3D;;;GAGG;AACH,MAAM,+BAA+B,GAAG,8BAA8B,CAAC;AAEvE;;GAEG;AACH,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAEpC;;GAEG;AACH,uBAA+B,SAAQ,gBAAM;IAC3C;;OAEG;IACH,YAAY,OAAmC;QAC7C,KAAK,EAAE,CAAC;QACR,MAAM,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;YAC5C,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,OAAO,CAAC,K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AO,EAAE,CAAC;IACxB,CAAC;IAED;;OAEG;IACK,oBAAoB;QAC1B,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC;QAElD,IAAI,KAAK,CAAC,MAAM,KAAK,GAAG,CAAC,MAAM,IAAI,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,EAAE;YAC1D,uBAAuB;YACvB,IAAI,CAAC,QAAQ,CAAC,mBAAmB,CAAC,CAAC;YACnC,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC;SACnD;aAAM;YACL,wBAAwB;YACxB,IAAI,CAAC,WAAW,CAAC,mBAAmB,CAAC,CAAC;YAEtC,IACE,IAAI,CAAC,MAAM;iBACR,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC;iBACjB,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC;iBACpB,KAAK,CAAC,mBAAmB,CAAC,EAC7B;gBACA,IAAI,CAAC,QAAQ,CAAC,+BAA+B,CAAC,CAAC;aAChD;iBAAM;gBACL,IAAI,CAAC,WAAW,CAAC,+BAA+B,CAAC,CAAC;aACnD;SACF;IACH,CAAC;CACF;AA3GD,8CA2GC","sourcesContent":["// Copyright (c) Jupyter Development Team.\n// Distributed under the terms of the Modified BSD License.\n\nimport { Message } from '@phosphor/messaging';\n\nimport { Widget } from '@phosphor/widgets';\n\nimport { CodeEditor } from './';\n\n/**\n * The class name added to an editor widget that has a primary selection.\n */\nconst HAS_SELECTION_CLASS = 'jp-mod-has-primary-selection';\n\n/**\n * The class name added to an editor widget that has a cursor/selection\n * within the whitespace at the beginning of a line\n */\nconst HAS_IN_LEADING_WHITESPACE_CLASS = 'jp-mod-in-leading-whitespace';\n\n/**\n * RegExp to test for leading whitespace\n */\nconst leadingWhitespaceRe = /^\\s+$/;\n\n/**\n * A widget which hosts a code editor.\n */\nexport class CodeEditorWrapper extends Widget {\n /**\n * Construct a new code editor widget.\n */\n constructor(options: CodeEditorWrapper.IOptions) {\n super();\n const editor = (this.editor = options.factory({\n host: this.node,\n model: options.model,\n uuid: options.uuid,\n config: options.config,\n selectionStyle: options.selectionStyle\n }));\n editor.model.selections.changed.connect(this._onSelectionsChanged, this);\n }\n\n /**\n * Get the editor wrapped by the widget.\n */\n readonly editor: CodeEditor.IEditor;\n\n /**\n * Get the model used by the widget.\n */\n get model(): CodeEditor.IModel {\n return this.editor.model;\n }\n\n /**\n * Dispose of the resources held by the widget.\n */\n dispose() {\n if (this.isDisposed) {\n return;\n }\n super.dispose();\n this.editor.dispose();\n }\n\n /**\n * Handle `'activate-request'` messages.\n */\n protected onActivateRequest(msg: Message): void {\n this.editor.focus();\n }\n\n /**\n * A message handler invoked on an `'after-attach'` message.\n */\n protected onAfterAttach(msg: Message): void {\n super.onAfterAttach(msg);\n if (this.isVisible) {\n this.update();\n }\n }\n\n /**\n * A message handler invoked on an `'after-show'` message.\n */\n protected onAfterShow(msg: Message): void {\n this.update();\n }\n\n /**\n * A message handler invoked on a `'resize'` message.\n */\n protected onResize(msg: Widget.ResizeMessage): void {\n if (msg.width >= 0 && msg.height >= 0) {\n this.editor.setSize(msg);\n } else if (this.isVisible) {\n this.editor.resizeToFit();\n }\n }\n\n /**\n * A message handler invoked on an `'update-request'` message.\n */\n protected onUpdateRequest(msg: Message): void {\n this.editor.refresh();\n }\n\n /**\n * Handle a change in model selections.\n */\n private _onSelectionsChanged(): void {\n const { start, end } = this.editor.getSelection();\n\n if (start.column !== end.column || start.line !== end.line) {\n // a selection was made\n this.addClass(HAS_SELECTION_CLASS);\n this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS);\n } else {\n // the cursor was placed\n this.removeClass(HAS_SELECTION_CLASS);\n\n if (\n this.editor\n .getLine(end.line)\n .slice(0, end.column)\n .match(leadingWhitespaceRe)\n ) {\n this.addClass(HAS_IN_LEADING_WHITESPACE_CLASS);\n } else {\n this.removeClass(HAS_IN_LEADING_WHITESPACE_CLASS);\n }\n }\n }\n}\n\n/**\n * The namespace for the `CodeEditorWrapper` statics.\n */\nexport namespace CodeEditorWrapper {\n /**\n * The options used to initialize a code editor widget.\n */\n export interface IOptions {\n /**\n * A code editor factory.\n *\n * #### Notes\n * The widget needs a factory and a model instead of a `CodeEditor.IEditor`\n * object because it needs to provide its own node as the host.\n */\n factory: CodeEditor.Factory;\n\n /**\n * The model used to initialize the code editor.\n */\n model: CodeEditor.IModel;\n\n /**\n * The desired uuid for the editor.\n */\n uuid?: string;\n\n /**\n * The configuration options for the editor.\n */\n config?: Partial<CodeEditor.IConfig>;\n\n /**\n * The default selection style for the editor.\n */\n selectionStyle?: CodeEditor.ISelectionStyle;\n }\n}\n"]}
|