@blocksuite/virgo
Advanced tools
Comparing version 0.4.0-alpha.0 to 0.4.0-alpha.2
@@ -13,2 +13,9 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
function virgoTextStyles(props) { | ||
let textDecorations = ''; | ||
if (props.underline) { | ||
textDecorations += 'underline'; | ||
} | ||
if (props.strikethrough) { | ||
textDecorations += ' line-through'; | ||
} | ||
return styleMap({ | ||
@@ -18,3 +25,3 @@ 'white-space': 'break-spaces', | ||
'font-style': props.italic ? 'italic' : 'normal', | ||
'text-decoration': props.underline ? 'underline' : 'none', | ||
'text-decoration': textDecorations.length > 0 ? textDecorations : 'none', | ||
}); | ||
@@ -35,2 +42,4 @@ } | ||
unitText.delta = this.delta; | ||
// we need to avoid \n appearing before and after the span element, which will | ||
// cause the unexpected space | ||
return html `<span | ||
@@ -37,0 +46,0 @@ data-virgo-element="true" |
export * from './virgo-line.js'; | ||
export * from './virgo-unit-text.js'; | ||
export * from './base-text.js'; | ||
export * from './optional/inline-code.js'; | ||
//# sourceMappingURL=index.d.ts.map |
export * from './virgo-line.js'; | ||
export * from './virgo-unit-text.js'; | ||
export * from './base-text.js'; | ||
// optional elements | ||
export * from './optional/inline-code.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
export * from './Editor.js'; | ||
export * from './virgo.js'; | ||
export * from './constant.js'; | ||
@@ -3,0 +3,0 @@ export * from './types.js'; |
/// <reference types="@blocksuite/global" /> | ||
export * from './Editor.js'; | ||
export * from './virgo.js'; | ||
export * from './constant.js'; | ||
@@ -4,0 +4,0 @@ export * from './types.js'; |
import type { BaseText } from './components/base-text.js'; | ||
import type { InlineCode, InlineCodeAttributes } from './components/optional/inline-code.js'; | ||
export interface BaseArrtiubtes { | ||
@@ -12,4 +13,4 @@ type: 'base'; | ||
} | ||
export type BaseTextElement = BaseText; | ||
export type BaseTextAttributes = BaseArrtiubtes | LineBreakAttributes; | ||
export type BaseTextElement = BaseText | InlineCode; | ||
export type BaseTextAttributes = BaseArrtiubtes | LineBreakAttributes | InlineCodeAttributes; | ||
export interface CustomTypes { | ||
@@ -16,0 +17,0 @@ [key: string]: unknown; |
import type { DeltaInsert } from '../types.js'; | ||
/** | ||
* convert a delta insert array to chunks, each chunk is a line | ||
*/ | ||
export declare function deltaInsersToChunks(delta: DeltaInsert[]): DeltaInsert[][]; | ||
//# sourceMappingURL=convert.d.ts.map |
@@ -0,1 +1,4 @@ | ||
/** | ||
* convert a delta insert array to chunks, each chunk is a line | ||
*/ | ||
export function deltaInsersToChunks(delta) { | ||
@@ -2,0 +5,0 @@ if (delta.length === 0) { |
import type { DeltaInsert, TextElement } from '../types.js'; | ||
/** | ||
* a default render function for text element | ||
*/ | ||
export declare function baseRenderElement(delta: DeltaInsert): TextElement; | ||
//# sourceMappingURL=render.d.ts.map |
import { BaseText } from '../components/base-text.js'; | ||
/** | ||
* a default render function for text element | ||
*/ | ||
export function baseRenderElement(delta) { | ||
@@ -3,0 +6,0 @@ switch (delta.attributes.type) { |
{ | ||
"name": "@blocksuite/virgo", | ||
"version": "0.4.0-alpha.0", | ||
"version": "0.4.0-alpha.2", | ||
"description": "A micro editor.", | ||
@@ -26,10 +26,8 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@blocksuite/global": "0.4.0-alpha.1" | ||
"@blocksuite/global": "0.4.0-alpha.2" | ||
}, | ||
"scripts": { | ||
"build": "tsc", | ||
"test:e2e": "playwright test", | ||
"test": "pnpm test:e2e" | ||
"build": "tsc" | ||
}, | ||
"types": "dist/index.d.ts" | ||
} |
@@ -9,2 +9,10 @@ import { LitElement, html } from 'lit'; | ||
function virgoTextStyles(props: BaseArrtiubtes): ReturnType<typeof styleMap> { | ||
let textDecorations = ''; | ||
if (props.underline) { | ||
textDecorations += 'underline'; | ||
} | ||
if (props.strikethrough) { | ||
textDecorations += ' line-through'; | ||
} | ||
return styleMap({ | ||
@@ -14,3 +22,3 @@ 'white-space': 'break-spaces', | ||
'font-style': props.italic ? 'italic' : 'normal', | ||
'text-decoration': props.underline ? 'underline' : 'none', | ||
'text-decoration': textDecorations.length > 0 ? textDecorations : 'none', | ||
}); | ||
@@ -33,2 +41,4 @@ } | ||
// we need to avoid \n appearing before and after the span element, which will | ||
// cause the unexpected space | ||
return html`<span | ||
@@ -35,0 +45,0 @@ data-virgo-element="true" |
export * from './virgo-line.js'; | ||
export * from './virgo-unit-text.js'; | ||
export * from './base-text.js'; | ||
// optional elements | ||
export * from './optional/inline-code.js'; |
/// <reference types="@blocksuite/global" /> | ||
export * from './Editor.js'; | ||
export * from './virgo.js'; | ||
export * from './constant.js'; | ||
@@ -4,0 +4,0 @@ export * from './types.js'; |
import type { BaseText } from './components/base-text.js'; | ||
import type { | ||
InlineCode, | ||
InlineCodeAttributes, | ||
} from './components/optional/inline-code.js'; | ||
@@ -15,4 +19,7 @@ export interface BaseArrtiubtes { | ||
export type BaseTextElement = BaseText; | ||
export type BaseTextAttributes = BaseArrtiubtes | LineBreakAttributes; | ||
export type BaseTextElement = BaseText | InlineCode; | ||
export type BaseTextAttributes = | ||
| BaseArrtiubtes | ||
| LineBreakAttributes | ||
| InlineCodeAttributes; | ||
@@ -19,0 +26,0 @@ export interface CustomTypes { |
import type { DeltaInsert } from '../types.js'; | ||
/** | ||
* convert a delta insert array to chunks, each chunk is a line | ||
*/ | ||
export function deltaInsersToChunks(delta: DeltaInsert[]): DeltaInsert[][] { | ||
@@ -4,0 +7,0 @@ if (delta.length === 0) { |
import { BaseText } from '../components/base-text.js'; | ||
import type { BaseArrtiubtes, DeltaInsert, TextElement } from '../types.js'; | ||
/** | ||
* a default render function for text element | ||
*/ | ||
export function baseRenderElement(delta: DeltaInsert): TextElement { | ||
@@ -5,0 +8,0 @@ switch (delta.attributes.type) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
1997
161029
64
1
+ Added@blocksuite/global@0.4.0-alpha.2(transitive)
+ Addedzod@3.24.2(transitive)
- Removed@blocksuite/global@0.4.0-alpha.1(transitive)