mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 21:05:19 +00:00
build: prevent tsconfig includes sources outside (#2643)
This commit is contained in:
@@ -12,12 +12,13 @@ import { Condition } from '../filter/condition';
|
||||
import { tBoolean, tDate } from '../filter/logical/custom-type';
|
||||
import type {
|
||||
Filter,
|
||||
FilterMatcherDataType,
|
||||
LiteralValue,
|
||||
Ref,
|
||||
VariableMap,
|
||||
} from '../filter/vars';
|
||||
import { filterMatcher, toLiteral } from '../filter/vars';
|
||||
} from '../filter/shared-types';
|
||||
import { toLiteral } from '../filter/shared-types';
|
||||
import type { FilterMatcherDataType } from '../filter/vars';
|
||||
import { filterMatcher } from '../filter/vars';
|
||||
import { filterByFilterList } from '../use-all-page-setting';
|
||||
|
||||
const ref = (name: keyof VariableMap): Ref => {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { Menu, MenuItem } from '../../../ui/menu';
|
||||
import * as styles from './index.css';
|
||||
import { literalMatcher } from './literal-matcher';
|
||||
import type { TFunction, TType } from './logical/typesystem';
|
||||
import type { Filter, Literal } from './vars';
|
||||
import type { Filter, Literal } from './shared-types';
|
||||
import { filterMatcher, VariableSelect, vars } from './vars';
|
||||
|
||||
export const Condition = ({
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import type { Filter, Literal, Ref } from './vars';
|
||||
import type { VariableMap } from './vars';
|
||||
import type { Filter, Literal, Ref, VariableMap } from './shared-types';
|
||||
import { filterMatcher } from './vars';
|
||||
|
||||
const evalRef = (ref: Ref, variableMap: VariableMap) => {
|
||||
|
||||
@@ -3,7 +3,7 @@ import { CloseIcon, PlusIcon } from '@blocksuite/icons';
|
||||
import { Menu } from '../../..';
|
||||
import { Condition } from './condition';
|
||||
import * as styles from './index.css';
|
||||
import type { Filter } from './vars';
|
||||
import type { Filter } from './shared-types';
|
||||
import { CreateFilterMenu } from './vars';
|
||||
export const FilterList = ({
|
||||
value,
|
||||
|
||||
@@ -6,7 +6,7 @@ import { tBoolean, tDate } from './logical/custom-type';
|
||||
import { Matcher } from './logical/matcher';
|
||||
import type { TType } from './logical/typesystem';
|
||||
import { typesystem } from './logical/typesystem';
|
||||
import type { Literal } from './vars';
|
||||
import type { Literal } from './shared-types';
|
||||
|
||||
export const literalMatcher = new Matcher<{
|
||||
render: (props: {
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import { DateTimeIcon, FavoritedIcon } from '@blocksuite/icons';
|
||||
import type { ReactElement } from 'react';
|
||||
|
||||
import { tBoolean, tDate } from './logical/custom-type';
|
||||
import type { TType } from './logical/typesystem';
|
||||
|
||||
export type Ref = {
|
||||
type: 'ref';
|
||||
name: keyof VariableMap;
|
||||
};
|
||||
|
||||
export type Filter = {
|
||||
type: 'filter';
|
||||
left: Ref;
|
||||
funcName: string;
|
||||
args: Literal[];
|
||||
};
|
||||
export type LiteralValue =
|
||||
| number
|
||||
| string
|
||||
| boolean
|
||||
| { [K: string]: LiteralValue }
|
||||
| Array<LiteralValue>;
|
||||
export const toLiteral = (value: LiteralValue): Literal => ({
|
||||
type: 'literal',
|
||||
value,
|
||||
});
|
||||
export type Literal = {
|
||||
type: 'literal';
|
||||
value: LiteralValue;
|
||||
};
|
||||
|
||||
export type FilterVariable = {
|
||||
name: keyof VariableMap;
|
||||
type: TType;
|
||||
icon: ReactElement;
|
||||
};
|
||||
|
||||
export const variableDefineMap = {
|
||||
Created: {
|
||||
type: tDate.create(),
|
||||
icon: <DateTimeIcon />,
|
||||
},
|
||||
Updated: {
|
||||
type: tDate.create(),
|
||||
icon: <DateTimeIcon />,
|
||||
},
|
||||
'Is Favourited': {
|
||||
type: tBoolean.create(),
|
||||
icon: <FavoritedIcon />,
|
||||
},
|
||||
// Imported: {
|
||||
// type: tBoolean.create(),
|
||||
// },
|
||||
// 'Daily Note': {
|
||||
// type: tBoolean.create(),
|
||||
// },
|
||||
} as const;
|
||||
export type VariableMap = {
|
||||
[K in keyof typeof variableDefineMap]: LiteralValue;
|
||||
};
|
||||
export type View = {
|
||||
id: string;
|
||||
name: string;
|
||||
filterList: Filter[];
|
||||
};
|
||||
@@ -1,68 +1,20 @@
|
||||
import { DateTimeIcon, FavoritedIcon } from '@blocksuite/icons';
|
||||
import dayjs from 'dayjs';
|
||||
import type { ReactElement, ReactNode } from 'react';
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
import { MenuItem } from '../../../ui/menu';
|
||||
import * as styles from './index.css';
|
||||
import { tBoolean, tDate } from './logical/custom-type';
|
||||
import { Matcher } from './logical/matcher';
|
||||
import type { TFunction, TType } from './logical/typesystem';
|
||||
import type { TFunction } from './logical/typesystem';
|
||||
import { tFunction, typesystem } from './logical/typesystem';
|
||||
import type {
|
||||
Filter,
|
||||
FilterVariable,
|
||||
LiteralValue,
|
||||
VariableMap,
|
||||
} from './shared-types';
|
||||
import { variableDefineMap } from './shared-types';
|
||||
|
||||
export type Ref = {
|
||||
type: 'ref';
|
||||
name: keyof VariableMap;
|
||||
};
|
||||
|
||||
export type Filter = {
|
||||
type: 'filter';
|
||||
left: Ref;
|
||||
funcName: string;
|
||||
args: Literal[];
|
||||
};
|
||||
export type LiteralValue =
|
||||
| number
|
||||
| string
|
||||
| boolean
|
||||
| { [K: string]: LiteralValue }
|
||||
| Array<LiteralValue>;
|
||||
export const toLiteral = (value: LiteralValue): Literal => ({
|
||||
type: 'literal',
|
||||
value,
|
||||
});
|
||||
export type Literal = {
|
||||
type: 'literal';
|
||||
value: LiteralValue;
|
||||
};
|
||||
|
||||
export type FilterVariable = {
|
||||
name: keyof VariableMap;
|
||||
type: TType;
|
||||
icon: ReactElement;
|
||||
};
|
||||
export const variableDefineMap = {
|
||||
Created: {
|
||||
type: tDate.create(),
|
||||
icon: <DateTimeIcon />,
|
||||
},
|
||||
Updated: {
|
||||
type: tDate.create(),
|
||||
icon: <DateTimeIcon />,
|
||||
},
|
||||
'Is Favourited': {
|
||||
type: tBoolean.create(),
|
||||
icon: <FavoritedIcon />,
|
||||
},
|
||||
// Imported: {
|
||||
// type: tBoolean.create(),
|
||||
// },
|
||||
// 'Daily Note': {
|
||||
// type: tBoolean.create(),
|
||||
// },
|
||||
} as const;
|
||||
export type VariableMap = {
|
||||
[K in keyof typeof variableDefineMap]: LiteralValue;
|
||||
};
|
||||
export const vars: FilterVariable[] = Object.entries(variableDefineMap).map(
|
||||
([key, value]) => ({
|
||||
name: key as keyof VariableMap,
|
||||
|
||||
@@ -8,13 +8,7 @@ import useSWRImmutable from 'swr/immutable';
|
||||
import { NIL } from 'uuid';
|
||||
|
||||
import { evalFilterList } from './filter';
|
||||
import type { Filter, VariableMap } from './filter/vars';
|
||||
|
||||
export type View = {
|
||||
id: string;
|
||||
name: string;
|
||||
filterList: Filter[];
|
||||
};
|
||||
import type { Filter, VariableMap, View } from './filter/shared-types';
|
||||
|
||||
type PersistenceView = View;
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ import { useState } from 'react';
|
||||
|
||||
import { Button, Input, Modal, ModalWrapper } from '../../..';
|
||||
import { FilterList } from '../filter';
|
||||
import type { Filter } from '../filter/vars';
|
||||
import type { View } from '../use-all-page-setting';
|
||||
import type { Filter, View } from '../filter/shared-types';
|
||||
import * as styles from './view-list.css';
|
||||
|
||||
type CreateViewProps = {
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
// eslint-disable-next-line @typescript-eslint/triple-slash-reference
|
||||
/// <reference path="../../../apps/electron/layers/preload/preload.d.ts" />
|
||||
|
||||
export * from './components/list-skeleton';
|
||||
export * from './styles';
|
||||
export * from './ui/breadcrumbs';
|
||||
|
||||
Reference in New Issue
Block a user