New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@haprompt/hashtag

Package Overview
Dependencies
Maintainers
2
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@haprompt/hashtag - npm Package Compare versions

Comparing version
0.12.0
to
0.12.6
+85
HapromptHashtag.dev.js
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
var utils = require('@haprompt/utils');
var haprompt = require('haprompt');
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
/** @noInheritDoc */
class HashtagNode extends haprompt.TextNode {
static getType() {
return 'hashtag';
}
static clone(node) {
return new HashtagNode(node.__text, node.__key);
}
constructor(text, key) {
super(text, key);
}
createDOM(config) {
const element = super.createDOM(config);
utils.addClassNamesToElement(element, config.theme.hashtag);
return element;
}
static importJSON(serializedNode) {
const node = $createHashtagNode(serializedNode.text);
node.setFormat(serializedNode.format);
node.setDetail(serializedNode.detail);
node.setMode(serializedNode.mode);
node.setStyle(serializedNode.style);
return node;
}
exportJSON() {
return { ...super.exportJSON(),
type: 'hashtag'
};
}
canInsertTextBefore() {
return false;
}
isTextEntity() {
return true;
}
}
/**
* Generates a HashtagNode, which is a string following the format of a # followed by some text, eg. #haprompt.
* @param text - The text used inside the HashtagNode.
* @returns - The HashtagNode with the embedded text.
*/
function $createHashtagNode(text = '') {
return haprompt.$applyNodeReplacement(new HashtagNode(text));
}
/**
* Determines if node is a HashtagNode.
* @param node - The node to be checked.
* @returns true if node is a HashtagNode, false otherwise.
*/
function $isHashtagNode(node) {
return node instanceof HashtagNode;
}
exports.$createHashtagNode = $createHashtagNode;
exports.$isHashtagNode = $isHashtagNode;
exports.HashtagNode = HashtagNode;

Sorry, the diff of this file is not supported yet

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';var c=require("@haprompt/utils"),d=require("haprompt");
class e extends d.TextNode{static getType(){return"hashtag"}static clone(a){return new e(a.__text,a.__key)}constructor(a,b){super(a,b)}createDOM(a){let b=super.createDOM(a);c.addClassNamesToElement(b,a.theme.hashtag);return b}static importJSON(a){let b=f(a.text);b.setFormat(a.format);b.setDetail(a.detail);b.setMode(a.mode);b.setStyle(a.style);return b}exportJSON(){return{...super.exportJSON(),type:"hashtag"}}canInsertTextBefore(){return!1}isTextEntity(){return!0}}
function f(a=""){return d.$applyNodeReplacement(new e(a))}exports.$createHashtagNode=f;exports.$isHashtagNode=function(a){return a instanceof e};exports.HashtagNode=e
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import type { EditorConfig, HapromptNode, NodeKey, SerializedTextNode } from 'haprompt';
import { TextNode } from 'haprompt';
/** @noInheritDoc */
export declare class HashtagNode extends TextNode {
static getType(): string;
static clone(node: HashtagNode): HashtagNode;
constructor(text: string, key?: NodeKey);
createDOM(config: EditorConfig): HTMLElement;
static importJSON(serializedNode: SerializedTextNode): HashtagNode;
exportJSON(): SerializedTextNode;
canInsertTextBefore(): boolean;
isTextEntity(): true;
}
/**
* Generates a HashtagNode, which is a string following the format of a # followed by some text, eg. #haprompt.
* @param text - The text used inside the HashtagNode.
* @returns - The HashtagNode with the embedded text.
*/
export declare function $createHashtagNode(text?: string): HashtagNode;
/**
* Determines if node is a HashtagNode.
* @param node - The node to be checked.
* @returns true if node is a HashtagNode, false otherwise.
*/
export declare function $isHashtagNode(node: HapromptNode | null | undefined): node is HashtagNode;
/** @module @haprompt/hashtag */
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import { $createHashtagNode, $isHashtagNode, HashtagNode } from './HapromptHashtagNode';
export { $createHashtagNode, $isHashtagNode, HashtagNode };
MIT License
Copyright (c) Meta Platforms, Inc. and affiliates.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
+3
-5

@@ -6,7 +6,5 @@ /**

* LICENSE file in the root directory of this source tree.
*
*/
'use strict';
module.exports = require('./dist/HapromptHashtag.js');
'use strict'
const HapromptHashtag = process.env.NODE_ENV === 'development' ? require('./HapromptHashtag.dev.js') : require('./HapromptHashtag.prod.js')
module.exports = HapromptHashtag;

@@ -11,9 +11,9 @@ {

"license": "MIT",
"version": "0.12.0",
"version": "0.12.6",
"main": "HapromptHashtag.js",
"peerDependencies": {
"haprompt": "0.12.0"
"haprompt": "0.12.6"
},
"dependencies": {
"@haprompt/utils": "0.12.0"
"@haprompt/utils": "0.12.6"
},

@@ -20,0 +20,0 @@ "repository": {

Sorry, the diff of this file is not supported yet

/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import {$createHashtagNode} from '@haprompt/hashtag';
import {initializeUnitTest} from 'haprompt/src/__tests__/utils';
describe('HapromptHashtagNode tests', () => {
initializeUnitTest((testEnv) => {
test('HashtagNode.exportJSON() should return and object conforming to the expected schema', () => {
const {editor} = testEnv;
editor.update(() => {
const node = $createHashtagNode('therickestrickofall');
// If you broke this test, you changed the public interface of a
// serialized Haprompt Core Node. Please ensure the correct adapter
// logic is in place in the corresponding importJSON method
// to accomodate these changes.
expect(node.exportJSON()).toStrictEqual({
detail: 0,
format: 0,
mode: 'normal',
style: '',
text: 'therickestrickofall',
type: 'hashtag',
version: 1,
});
});
});
});
});
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import type {
EditorConfig,
HapromptNode,
NodeKey,
SerializedTextNode,
} from 'haprompt';
import {addClassNamesToElement} from '@haprompt/utils';
import {$applyNodeReplacement, TextNode} from 'haprompt';
/** @noInheritDoc */
export class HashtagNode extends TextNode {
static getType(): string {
return 'hashtag';
}
static clone(node: HashtagNode): HashtagNode {
return new HashtagNode(node.__text, node.__key);
}
constructor(text: string, key?: NodeKey) {
super(text, key);
}
createDOM(config: EditorConfig): HTMLElement {
const element = super.createDOM(config);
addClassNamesToElement(element, config.theme.hashtag);
return element;
}
static importJSON(serializedNode: SerializedTextNode): HashtagNode {
const node = $createHashtagNode(serializedNode.text);
node.setFormat(serializedNode.format);
node.setDetail(serializedNode.detail);
node.setMode(serializedNode.mode);
node.setStyle(serializedNode.style);
return node;
}
exportJSON(): SerializedTextNode {
return {
...super.exportJSON(),
type: 'hashtag',
};
}
canInsertTextBefore(): boolean {
return false;
}
isTextEntity(): true {
return true;
}
}
/**
* Generates a HashtagNode, which is a string following the format of a # followed by some text, eg. #haprompt.
* @param text - The text used inside the HashtagNode.
* @returns - The HashtagNode with the embedded text.
*/
export function $createHashtagNode(text = ''): HashtagNode {
return $applyNodeReplacement(new HashtagNode(text));
}
/**
* Determines if node is a HashtagNode.
* @param node - The node to be checked.
* @returns true if node is a HashtagNode, false otherwise.
*/
export function $isHashtagNode(
node: HapromptNode | null | undefined,
): node is HashtagNode {
return node instanceof HashtagNode;
}
/** @module @haprompt/hashtag */
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
*/
import {
$createHashtagNode,
$isHashtagNode,
HashtagNode,
} from './HapromptHashtagNode';
export {$createHashtagNode, $isHashtagNode, HashtagNode};