Skip to content

Commit

Permalink
deploy: 5979369
Browse files Browse the repository at this point in the history
  • Loading branch information
nwalters512 committed Nov 15, 2024
1 parent 6df538f commit c2387c6
Show file tree
Hide file tree
Showing 129 changed files with 8,367 additions and 20,209 deletions.
16 changes: 8 additions & 8 deletions docs/plugins/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -114,27 +114,27 @@ <h4 id="tom-selectpopularjs">tom-select.popular.js</h4>
<h4 id="tom-selectbasejs">tom-select.base.js</h4>
<p>If you don't need any plugins, or want to load plugins individually, use <code>tom-select.base.js</code>.</p>
<p>Add plugins to your project by including their js files and calling <code>TomSelect.define</code>.</p>
<pre class="language-js"><code class="language-js"><span class="token keyword">import</span> TomSelect <span class="token keyword">from</span> <span class="token string">'tom-select/dist/js/tom-select.base.js'</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> TomSelect_remove_button <span class="token keyword">from</span> <span class="token string">'tom-select/dist/js/plugins/remove_button.js'</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> TomSelect_dropdown_header <span class="token keyword">from</span> <span class="token string">'tom-select/dist/js/plugins/dropdown_header.js'</span><span class="token punctuation">;</span>
<pre class="language-js"><code class="language-js"><span class="token keyword">import</span> TomSelect <span class="token keyword">from</span> <span class="token string">'tom-select/base'</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> TomSelect_remove_button <span class="token keyword">from</span> <span class="token string">'tom-select/plugins/remove_button.js'</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> TomSelect_dropdown_header <span class="token keyword">from</span> <span class="token string">'tom-select/dropdown_header.js'</span><span class="token punctuation">;</span>

TomSelect<span class="token punctuation">.</span><span class="token function">define</span><span class="token punctuation">(</span><span class="token string">'remove_button'</span><span class="token punctuation">,</span> TomSelect_remove_button<span class="token punctuation">)</span><span class="token punctuation">;</span>
TomSelect<span class="token punctuation">.</span><span class="token function">define</span><span class="token punctuation">(</span><span class="token string">'dropdown_header'</span><span class="token punctuation">,</span> TomSelect_dropdown_header<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
<p>Alternatively you can <code>require</code> plugins directly if your build tool supports it.</p>
<pre class="language-js"><code class="language-js"><span class="token keyword">import</span> TomSelect <span class="token keyword">from</span> <span class="token string">'tom-select/dist/js/tom-select.base.js'</span><span class="token punctuation">;</span>
<pre class="language-js"><code class="language-js"><span class="token keyword">import</span> TomSelect <span class="token keyword">from</span> <span class="token string">'tom-select/base'</span><span class="token punctuation">;</span>

TomSelect<span class="token punctuation">.</span><span class="token function">define</span><span class="token punctuation">(</span><span class="token string">'remove_button'</span><span class="token punctuation">,</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'tom-select/dist/js/plugins/remove_button.js'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
TomSelect<span class="token punctuation">.</span><span class="token function">define</span><span class="token punctuation">(</span><span class="token string">'dropdown_header'</span><span class="token punctuation">,</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'tom-select/dist/js/plugins/dropdown_header.js'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
TomSelect<span class="token punctuation">.</span><span class="token function">define</span><span class="token punctuation">(</span><span class="token string">'remove_button'</span><span class="token punctuation">,</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'tom-select/plugins/remove_button.js'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
TomSelect<span class="token punctuation">.</span><span class="token function">define</span><span class="token punctuation">(</span><span class="token string">'dropdown_header'</span><span class="token punctuation">,</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">'tom-select/plugins/dropdown_header.js'</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre>
<h4 id="tom-selectcustomjs">tom-select.custom.js</h4>
<p>Use NPM to hand-pick plugins and create <code>/build/js/tom-select.custom.js</code></p>
<p>Use NPM to hand-pick plugins and create <code>/dist/js/tom-select.custom.js</code></p>
<pre class="language-shell"><code class="language-shell"><span class="token comment"># clone the repo</span>
<span class="token function">git</span> clone https://github.com/orchidjs/tom-select.git
<span class="token builtin class-name">cd</span> tom-select

<span class="token comment"># install dev dependencies</span>
<span class="token function">npm</span> <span class="token function">install</span>

<span class="token comment"># create /build/js/tom-select.custom.js</span>
<span class="token comment"># create /dist/js/tom-select.custom.js</span>
<span class="token function">npm</span> run build -- <span class="token parameter variable">--plugins</span><span class="token operator">=</span>remove_button,restore_on_backspace</code></pre>
<h2 id="creating-plugins">Creating Plugins</h2>
<p><strong>A few notes:</strong></p>
Expand Down
12 changes: 12 additions & 0 deletions esm/constants.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export declare const KEY_A = 65;
export declare const KEY_RETURN = 13;
export declare const KEY_ESC = 27;
export declare const KEY_LEFT = 37;
export declare const KEY_UP = 38;
export declare const KEY_RIGHT = 39;
export declare const KEY_DOWN = 40;
export declare const KEY_BACKSPACE = 8;
export declare const KEY_DELETE = 46;
export declare const KEY_TAB = 9;
export declare const IS_MAC: boolean;
export declare const KEY_SHORTCUT: string;
13 changes: 13 additions & 0 deletions esm/constants.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions esm/constants.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions esm/contrib/highlight.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* highlight v3 | MIT license | Johann Burkard <[email protected]>
* Highlights arbitrary terms in a node.
*
* - Modified by Marshal <[email protected]> 2011-6-24 (added regex)
* - Modified by Brian Reavis <[email protected]> 2012-8-27 (cleanup)
*/
export declare const highlight: (element: HTMLElement, regex: string | RegExp) => void;
/**
* removeHighlight fn copied from highlight v5 and
* edited to remove with(), pass js strict mode, and use without jquery
*/
export declare const removeHighlight: (el: HTMLElement) => void;
64 changes: 64 additions & 0 deletions esm/contrib/highlight.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions esm/contrib/highlight.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions esm/contrib/microevent.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/**
* MicroEvent - to make any js object an event emitter
*
* - pure javascript - server compatible, browser compatible
* - dont rely on the browser doms
* - super simple - you get it immediatly, no mistery, no magic involved
*
* @author Jerome Etienne (https://github.com/jeromeetienne)
*/
type TCallback = (...args: any) => any;
export default class MicroEvent {
_events: {
[key: string]: TCallback[];
};
constructor();
on(events: string, fct: TCallback): void;
off(events: string, fct: TCallback): void;
trigger(events: string, ...args: any): void;
}
export {};
61 changes: 61 additions & 0 deletions esm/contrib/microevent.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions esm/contrib/microevent.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

71 changes: 71 additions & 0 deletions esm/contrib/microplugin.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/**
* microplugin.js
* Copyright (c) 2013 Brian Reavis & contributors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the License at:
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
* ANY KIND, either express or implied. See the License for the specific language
* governing permissions and limitations under the License.
*
* @author Brian Reavis <[email protected]>
*/
type TSettings = {
[key: string]: any;
};
type TPlugins = {
names: string[];
settings: TSettings;
requested: {
[key: string]: boolean;
};
loaded: {
[key: string]: any;
};
};
export type TPluginItem = {
name: string;
options: {};
};
export type TPluginHash = {
[key: string]: {};
};
export default function MicroPlugin(Interface: any): {
new (): {
[x: string]: any;
plugins: TPlugins;
/**
* Initializes the listed plugins (with options).
* Acceptable formats:
*
* List (without options):
* ['a', 'b', 'c']
*
* List (with options):
* [{'name': 'a', options: {}}, {'name': 'b', options: {}}]
*
* Hash (with options):
* {'a': { ... }, 'b': { ... }, 'c': { ... }}
*
* @param {array|object} plugins
*/
initializePlugins(plugins: string[] | TPluginItem[] | TPluginHash): void;
loadPlugin(name: string): void;
/**
* Initializes a plugin.
*
*/
require(name: string): any;
};
[x: string]: any;
/**
* Registers a plugin.
*
* @param {function} fn
*/
define(name: string, fn: (this: any, settings: TSettings) => any): void;
};
export {};
Loading

0 comments on commit c2387c6

Please sign in to comment.