@blocksuite/global
Advanced tools
Comparing version 0.4.0-20230115125610-fb61886 to 0.4.0-20230116190618-0dc5fd3
@@ -23,3 +23,3 @@ export const SYS_KEYS = new Set(['id', 'flavour', 'children']); | ||
if (a && b) { | ||
if (!Object.is(a, b)) { | ||
if (!Object.is(val, expected)) { | ||
throw new Error('val is not same as expected'); | ||
@@ -26,0 +26,0 @@ } |
@@ -28,2 +28,71 @@ declare module 'quill' { | ||
import { TextType } from '@blocksuite/store'; | ||
interface SchemaMeta { | ||
/** | ||
* color of the tag | ||
*/ | ||
color: `#${string}`; | ||
/** | ||
* width of a column | ||
*/ | ||
width: number; // px | ||
/** | ||
* whether this display in the table | ||
*/ | ||
hide: boolean; | ||
} | ||
// Threat this type as a column type | ||
interface BaseTagSchema<BaseValue = unknown> { | ||
/** | ||
* each instance of tag type has its own unique uuid | ||
*/ | ||
id: string; | ||
type: string; | ||
/** | ||
* column name | ||
*/ | ||
name: string; | ||
meta: SchemaMeta; | ||
/** | ||
* this value is just for hold the `BaseValue`, | ||
* don't use this value in the runtime. | ||
*/ | ||
__$TYPE_HOLDER$__?: BaseValue; | ||
} | ||
interface TextTagSchema extends BaseTagSchema<string> { | ||
type: 'text'; | ||
} | ||
interface NumberTagSchema extends BaseTagSchema<number> { | ||
type: 'number'; | ||
decimal: number; | ||
} | ||
interface SelectTagSchema<Selection extends string = string> | ||
extends BaseTagSchema<string> { | ||
type: 'select'; | ||
selection: Selection[]; | ||
} | ||
interface RichTextTagSchema extends BaseTagSchema<TextType> { | ||
type: 'rich-text'; | ||
} | ||
type TagSchema = | ||
| SelectTagSchema | ||
| NumberTagSchema | ||
| TextTagSchema | ||
| RichTextTagSchema; | ||
// threat this type as row type | ||
interface BlockTag<Schema extends TagSchema = TagSchema> { | ||
type: Schema['id']; | ||
value: Schema extends BaseTagSchema<infer U> | ||
? U | ||
: Type extends BlockColumnType | ||
? undefined | ||
: never; | ||
} | ||
interface IBaseBlockProps { | ||
@@ -30,0 +99,0 @@ flavour: string; |
{ | ||
"name": "@blocksuite/global", | ||
"version": "0.4.0-20230115125610-fb61886", | ||
"version": "0.4.0-20230116190618-0dc5fd3", | ||
"types": "./index.d.ts", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -47,3 +47,3 @@ export const SYS_KEYS = new Set(['id', 'flavour', 'children']); | ||
if (a && b) { | ||
if (!Object.is(a, b)) { | ||
if (!Object.is(val, expected)) { | ||
throw new Error('val is not same as expected'); | ||
@@ -50,0 +50,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
56170
308