From 0f8357e692aa5d22c0cdbc2faffe8d43f7343890 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 23 Oct 2022 14:17:10 +0200 Subject: [PATCH 01/20] feat(snippet): create query to retrieve public snippets --- apps/core/src/resources/resolvers.ts | 4 +- .../snippets/queries/all-snippets.ts | 5 - .../snippets/queries/public-snippets.ts | 19 ++ .../src/resources/snippets/schema.graphql.ts | 14 +- apps/core/src/types/graphql.d.ts | 256 ++++++++++++++---- .../domain/src/snippets/snippet.service.ts | 32 ++- 6 files changed, 261 insertions(+), 69 deletions(-) delete mode 100644 apps/core/src/resources/snippets/queries/all-snippets.ts create mode 100644 apps/core/src/resources/snippets/queries/public-snippets.ts diff --git a/apps/core/src/resources/resolvers.ts b/apps/core/src/resources/resolvers.ts index e51d498b..745def1d 100644 --- a/apps/core/src/resources/resolvers.ts +++ b/apps/core/src/resources/resolvers.ts @@ -10,9 +10,9 @@ import { subscribeToNewsletter } from './newsletter/mutations/subscribe'; import { createSnippet } from './snippets/mutations/create-snippet'; import { deleteSnippet } from './snippets/mutations/delete-snippet'; import { updateSnippet } from './snippets/mutations/update-snippet'; -import { allSnippets } from './snippets/queries/all-snippets'; import { findSnippet } from './snippets/queries/find-snippet'; import { mySnippets } from './snippets/queries/my-snippets'; +import { publicSnippets } from './snippets/queries/public-snippets'; import { dateScalar } from './types/date'; import { loginUser } from './users/mutations/login-user'; import { logoutUser } from './users/mutations/logout-user'; @@ -46,7 +46,6 @@ const resolvers: Resolvers = { updateSnippet, }, Query: { - allSnippets, authenticatedUser, findFolder, findSnippet, @@ -55,6 +54,7 @@ const resolvers: Resolvers = { listFolders, mySnippets, ping: () => 'pong', + publicSnippets, }, Snippet: { folder: (snippet, _args, context) => { diff --git a/apps/core/src/resources/snippets/queries/all-snippets.ts b/apps/core/src/resources/snippets/queries/all-snippets.ts deleted file mode 100644 index 9f0b8746..00000000 --- a/apps/core/src/resources/snippets/queries/all-snippets.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { QueryResolvers } from '../../../types/graphql'; - -export const allSnippets: QueryResolvers['allSnippets'] = (_parent, _args, context) => { - return context.db.snippet.findPublicSnippet(); -}; diff --git a/apps/core/src/resources/snippets/queries/public-snippets.ts b/apps/core/src/resources/snippets/queries/public-snippets.ts new file mode 100644 index 00000000..9be0fd31 --- /dev/null +++ b/apps/core/src/resources/snippets/queries/public-snippets.ts @@ -0,0 +1,19 @@ +import { QueryResolvers } from '../../../types/graphql'; + +export const publicSnippets: QueryResolvers['publicSnippets'] = async (_parent, input, context) => { + const { + args: { itemPerPage, nextToken }, + } = input; + + const result = await context.db.snippet.findPublicSnippet({ + cursor: nextToken, + itemPerPage: itemPerPage ?? 10, + }); + + return { + hasMore: result.hasMore, + itemPerPage, + items: result.items, + nextToken: result.nextCursor, + }; +}; diff --git a/apps/core/src/resources/snippets/schema.graphql.ts b/apps/core/src/resources/snippets/schema.graphql.ts index 1d7a88f4..1f6f261e 100644 --- a/apps/core/src/resources/snippets/schema.graphql.ts +++ b/apps/core/src/resources/snippets/schema.graphql.ts @@ -6,6 +6,13 @@ export default gql` paths: [Folder!]! } + type PublicSnippetsResult { + items: [Snippet!]! + hasMore: Boolean! + itemPerPage: Int + nextToken: String + } + input CreateSnippetInput { folderId: String! name: String! @@ -27,6 +34,11 @@ export default gql` theme: String! } + input PublicSnippetsArgs { + nextToken: String + itemPerPage: Int + } + extend type Mutation { createSnippet(input: CreateSnippetInput!): Snippet! updateSnippet(id: ID!, input: UpdateSnippetInput!): Snippet! @@ -34,7 +46,7 @@ export default gql` } extend type Query { - allSnippets: [Snippet!]! + publicSnippets(args: PublicSnippetsArgs!): PublicSnippetsResult! mySnippets: [Snippet!]! findSnippet(snippetId: String!): SnippetInfo! } diff --git a/apps/core/src/types/graphql.d.ts b/apps/core/src/types/graphql.d.ts index b2760795..51d2f192 100644 --- a/apps/core/src/types/graphql.d.ts +++ b/apps/core/src/types/graphql.d.ts @@ -10,7 +10,7 @@ export type ResolverFn = ( parent: TParent, args: TArgs, context: TContext, - info?: GraphQLResolveInfo + info?: GraphQLResolveInfo, ) => Promise | TResult; export type Omit = Pick>; @@ -80,49 +80,40 @@ export type Mutation = { updateSnippet: Snippet; }; - export type MutationCreateFolderArgs = { input: CreateFolderInput; }; - export type MutationCreateSnippetArgs = { input: CreateSnippetInput; }; - export type MutationDeleteFoldersArgs = { folderIds: Array; }; - export type MutationDeleteSnippetArgs = { id: Scalars['ID']; }; - export type MutationLoginUserArgs = { email: Scalars['String']; password: Scalars['String']; }; - export type MutationSignupUserArgs = { input: SignupUserInput; }; - export type MutationSubscribeToNewsletterArgs = { email: Scalars['String']; }; - export type MutationUpdateFolderArgs = { id: Scalars['ID']; input: UpdateFolderInput; }; - export type MutationUpdateSnippetArgs = { id: Scalars['ID']; input: UpdateSnippetInput; @@ -131,13 +122,25 @@ export type MutationUpdateSnippetArgs = { export const OauthProvider = { Github: 'github', Stackoverflow: 'stackoverflow', - Twitter: 'twitter' + Twitter: 'twitter', } as const; export type OauthProvider = typeof OauthProvider[keyof typeof OauthProvider]; +export type PublicSnippetsArgs = { + itemPerPage?: InputMaybe; + nextToken?: InputMaybe; +}; + +export type PublicSnippetsResult = { + __typename?: 'PublicSnippetsResult'; + hasMore: Scalars['Boolean']; + itemPerPage?: Maybe; + items: Array; + nextToken?: Maybe; +}; + export type Query = { __typename?: 'Query'; - allSnippets: Array; authenticatedUser: User; findFolder: Folder; findSnippet: SnippetInfo; @@ -148,28 +151,29 @@ export type Query = { mySnippets: Array; /** @deprecated https://stackoverflow.com/questions/59868942/graphql-a-schema-must-have-a-query-operation-defined */ ping?: Maybe; + publicSnippets: PublicSnippetsResult; }; - export type QueryFindFolderArgs = { folderId: Scalars['String']; }; - export type QueryFindSnippetArgs = { snippetId: Scalars['String']; }; - export type QueryListDirectoryArgs = { folderId: Scalars['String']; }; - export type QueryListFoldersArgs = { folderId?: InputMaybe; }; +export type QueryPublicSnippetsArgs = { + args: PublicSnippetsArgs; +}; + export type Result = { __typename?: 'Result'; message: Scalars['String']; @@ -187,7 +191,7 @@ export type Role = { export const RoleName = { Admin: 'admin', - User: 'user' + User: 'user', } as const; export type RoleName = typeof RoleName[keyof typeof RoleName]; @@ -227,7 +231,7 @@ export type SnippetInfo = { export const SnippetVisibility = { Private: 'private', - Public: 'public' + Public: 'public', } as const; export type SnippetVisibility = typeof SnippetVisibility[keyof typeof SnippetVisibility]; @@ -262,28 +266,27 @@ export type User = { username?: Maybe; }; - - export type ResolverTypeWrapper = Promise | T; - export type ResolverWithResolve = { resolve: ResolverFn; }; -export type Resolver = ResolverFn | ResolverWithResolve; +export type Resolver = + | ResolverFn + | ResolverWithResolve; export type SubscriptionSubscribeFn = ( parent: TParent, args: TArgs, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => AsyncIterable | Promise>; export type SubscriptionResolveFn = ( parent: TParent, args: TArgs, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => TResult | Promise; export interface SubscriptionSubscriberObject { @@ -307,10 +310,14 @@ export type SubscriptionResolver = ( parent: TParent, context: TContext, - info: GraphQLResolveInfo + info: GraphQLResolveInfo, ) => Maybe | Promise>; -export type IsTypeOfResolverFn = (obj: T, context: TContext, info: GraphQLResolveInfo) => boolean | Promise; +export type IsTypeOfResolverFn = ( + obj: T, + context: TContext, + info: GraphQLResolveInfo, +) => boolean | Promise; export type NextResolverFn = () => Promise; @@ -319,7 +326,7 @@ export type DirectiveResolverFn TResult | Promise; /** Mapping between all available schema types and the resolvers types */ @@ -328,13 +335,23 @@ export type ResolversTypes = { CreateFolderInput: CreateFolderInput; CreateSnippetInput: CreateSnippetInput; Date: ResolverTypeWrapper; - Directory: ResolverTypeWrapper & { folders: Array, paths: Array, snippets: Array }>; + Directory: ResolverTypeWrapper< + Omit & { + folders: Array; + paths: Array; + snippets: Array; + } + >; Folder: ResolverTypeWrapper; ID: ResolverTypeWrapper; Int: ResolverTypeWrapper; LoginResult: ResolverTypeWrapper; Mutation: ResolverTypeWrapper<{}>; OauthProvider: OauthProvider; + PublicSnippetsArgs: PublicSnippetsArgs; + PublicSnippetsResult: ResolverTypeWrapper< + Omit & { items: Array } + >; Query: ResolverTypeWrapper<{}>; Result: ResolverTypeWrapper; Role: ResolverTypeWrapper; @@ -342,7 +359,12 @@ export type ResolversTypes = { SignupUserInput: SignupUserInput; SignupUserResult: ResolverTypeWrapper; Snippet: ResolverTypeWrapper; - SnippetInfo: ResolverTypeWrapper & { paths: Array, snippet: ResolversTypes['Snippet'] }>; + SnippetInfo: ResolverTypeWrapper< + Omit & { + paths: Array; + snippet: ResolversTypes['Snippet']; + } + >; SnippetVisibility: SnippetVisibility; String: ResolverTypeWrapper; UpdateFolderInput: UpdateFolderInput; @@ -356,19 +378,28 @@ export type ResolversParentTypes = { CreateFolderInput: CreateFolderInput; CreateSnippetInput: CreateSnippetInput; Date: Scalars['Date']; - Directory: Omit & { folders: Array, paths: Array, snippets: Array }; + Directory: Omit & { + folders: Array; + paths: Array; + snippets: Array; + }; Folder: Folder; ID: Scalars['ID']; Int: Scalars['Int']; LoginResult: LoginResult; Mutation: {}; + PublicSnippetsArgs: PublicSnippetsArgs; + PublicSnippetsResult: Omit & { items: Array }; Query: {}; Result: Result; Role: Role; SignupUserInput: SignupUserInput; SignupUserResult: SignupUserResult; Snippet: Snippet; - SnippetInfo: Omit & { paths: Array, snippet: ResolversParentTypes['Snippet'] }; + SnippetInfo: Omit & { + paths: Array; + snippet: ResolversParentTypes['Snippet']; + }; String: Scalars['String']; UpdateFolderInput: UpdateFolderInput; UpdateSnippetInput: UpdateSnippetInput; @@ -379,14 +410,20 @@ export interface DateScalarConfig extends GraphQLScalarTypeConfig = { +export type DirectoryResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['Directory'] = ResolversParentTypes['Directory'], +> = { folders?: Resolver, ParentType, ContextType>; paths?: Resolver, ParentType, ContextType>; snippets?: Resolver, ParentType, ContextType>; __isTypeOf?: IsTypeOfResolverFn; }; -export type FolderResolvers = { +export type FolderResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['Folder'] = ResolversParentTypes['Folder'], +> = { createdAt?: Resolver; id?: Resolver; isFavorite?: Resolver; @@ -399,42 +436,133 @@ export type FolderResolvers; }; -export type LoginResultResolvers = { +export type LoginResultResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['LoginResult'] = ResolversParentTypes['LoginResult'], +> = { token?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }; -export type MutationResolvers = { - createFolder?: Resolver>; - createSnippet?: Resolver>; - deleteFolders?: Resolver>; - deleteSnippet?: Resolver>; - loginUser?: Resolver>; +export type MutationResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['Mutation'] = ResolversParentTypes['Mutation'], +> = { + createFolder?: Resolver< + ResolversTypes['Folder'], + ParentType, + ContextType, + RequireFields + >; + createSnippet?: Resolver< + ResolversTypes['Snippet'], + ParentType, + ContextType, + RequireFields + >; + deleteFolders?: Resolver< + ResolversTypes['Boolean'], + ParentType, + ContextType, + RequireFields + >; + deleteSnippet?: Resolver< + ResolversTypes['Boolean'], + ParentType, + ContextType, + RequireFields + >; + loginUser?: Resolver< + ResolversTypes['LoginResult'], + ParentType, + ContextType, + RequireFields + >; logoutUser?: Resolver; - signupUser?: Resolver>; - subscribeToNewsletter?: Resolver>; - updateFolder?: Resolver>; - updateSnippet?: Resolver>; + signupUser?: Resolver< + ResolversTypes['SignupUserResult'], + ParentType, + ContextType, + RequireFields + >; + subscribeToNewsletter?: Resolver< + ResolversTypes['Result'], + ParentType, + ContextType, + RequireFields + >; + updateFolder?: Resolver< + ResolversTypes['Folder'], + ParentType, + ContextType, + RequireFields + >; + updateSnippet?: Resolver< + ResolversTypes['Snippet'], + ParentType, + ContextType, + RequireFields + >; +}; + +export type PublicSnippetsResultResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['PublicSnippetsResult'] = ResolversParentTypes['PublicSnippetsResult'], +> = { + hasMore?: Resolver; + itemPerPage?: Resolver, ParentType, ContextType>; + items?: Resolver, ParentType, ContextType>; + nextToken?: Resolver, ParentType, ContextType>; + __isTypeOf?: IsTypeOfResolverFn; }; -export type QueryResolvers = { - allSnippets?: Resolver, ParentType, ContextType>; +export type QueryResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['Query'] = ResolversParentTypes['Query'], +> = { authenticatedUser?: Resolver; - findFolder?: Resolver>; - findSnippet?: Resolver>; + findFolder?: Resolver< + ResolversTypes['Folder'], + ParentType, + ContextType, + RequireFields + >; + findSnippet?: Resolver< + ResolversTypes['SnippetInfo'], + ParentType, + ContextType, + RequireFields + >; hello?: Resolver; - listDirectory?: Resolver, ParentType, ContextType, RequireFields>; + listDirectory?: Resolver< + Maybe, + ParentType, + ContextType, + RequireFields + >; listFolders?: Resolver, ParentType, ContextType, Partial>; mySnippets?: Resolver, ParentType, ContextType>; ping?: Resolver, ParentType, ContextType>; -}; - -export type ResultResolvers = { + publicSnippets?: Resolver< + ResolversTypes['PublicSnippetsResult'], + ParentType, + ContextType, + RequireFields + >; +}; + +export type ResultResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['Result'] = ResolversParentTypes['Result'], +> = { message?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }; -export type RoleResolvers = { +export type RoleResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['Role'] = ResolversParentTypes['Role'], +> = { createdAt?: Resolver; description?: Resolver, ParentType, ContextType>; id?: Resolver; @@ -444,12 +572,18 @@ export type RoleResolvers; }; -export type SignupUserResultResolvers = { +export type SignupUserResultResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['SignupUserResult'] = ResolversParentTypes['SignupUserResult'], +> = { message?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }; -export type SnippetResolvers = { +export type SnippetResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['Snippet'] = ResolversParentTypes['Snippet'], +> = { content?: Resolver; createdAt?: Resolver; description?: Resolver, ParentType, ContextType>; @@ -466,13 +600,19 @@ export type SnippetResolvers; }; -export type SnippetInfoResolvers = { +export type SnippetInfoResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['SnippetInfo'] = ResolversParentTypes['SnippetInfo'], +> = { paths?: Resolver, ParentType, ContextType>; snippet?: Resolver; __isTypeOf?: IsTypeOfResolverFn; }; -export type UserResolvers = { +export type UserResolvers< + ContextType = AppContext, + ParentType extends ResolversParentTypes['User'] = ResolversParentTypes['User'], +> = { createdAt?: Resolver; email?: Resolver; folders?: Resolver, ParentType, ContextType>; @@ -495,6 +635,7 @@ export type Resolvers = { Folder?: FolderResolvers; LoginResult?: LoginResultResolvers; Mutation?: MutationResolvers; + PublicSnippetsResult?: PublicSnippetsResultResolvers; Query?: QueryResolvers; Result?: ResultResolvers; Role?: RoleResolvers; @@ -503,4 +644,3 @@ export type Resolvers = { SnippetInfo?: SnippetInfoResolvers; User?: UserResolvers; }; - diff --git a/packages/domain/src/snippets/snippet.service.ts b/packages/domain/src/snippets/snippet.service.ts index 7c61d106..d9c2ccc0 100644 --- a/packages/domain/src/snippets/snippet.service.ts +++ b/packages/domain/src/snippets/snippet.service.ts @@ -5,6 +5,8 @@ import CreateSnippetDto from './dtos/create-snippet-dto'; import DeleteSnippetDto from './dtos/delete-snippet-dto'; import UpdateSnippetDto from './dtos/update-snippet-dto'; +const MAX_ITEM_PER_PAGE = 50; + export default class SnippetService { async create(createSnippetDto: CreateSnippetDto): Promise { const isSnippetExist = await this.isSnippetExistInFolder(createSnippetDto.folderId, createSnippetDto.name); @@ -56,11 +58,35 @@ export default class SnippetService { }); } - async findPublicSnippet(): Promise { - return dbClient.snippet.findMany({ + async findPublicSnippet(args: { + cursor?: string | null; + itemPerPage: number; + }): Promise<{ hasMore: boolean; items: Snippet[]; nextCursor: string | null }> { + const { cursor, itemPerPage } = args; + + const limit = Math.min(MAX_ITEM_PER_PAGE, itemPerPage); + + // If the use has 20 we fetch 21 which help to know if there still more in the table + const limitPlusOne = limit + 1; + + const snippets = await dbClient.snippet.findMany({ orderBy: { createdAt: 'desc' }, - where: { visibility: 'public' }, + take: limitPlusOne, + where: { + createdAt: cursor + ? { + lt: new Date(parseInt(cursor, 10)), + } + : undefined, + visibility: 'public', + }, }); + + return { + hasMore: snippets.length === limitPlusOne, + items: snippets.slice(0, limit), + nextCursor: snippets.length > 0 ? snippets[snippets.length - 1].createdAt.getTime().toString() : null, + }; } async delete(deleteSnippetDto: DeleteSnippetDto): Promise { From a3208507d73d1357e5601088dc82e4d6ebd4ab1c Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 11:48:12 +0100 Subject: [PATCH 02/20] feat(snippet): browse snippets --- apps/core/src/resources/resolvers.ts | 2 + apps/core/src/resources/schema.graphql.ts | 1 + .../queries/resolvers/short-content.ts | 10 + apps/core/src/types/graphql.d.ts | 2 + .../shiki/languages/abap.tmLanguage.json | 10 +- .../languages/actionscript-3.tmLanguage.json | 2 +- .../shiki/languages/astro.tmLanguage.json | 433 +- .../shiki/languages/ballerina.tmLanguage.json | 56 +- .../shiki/languages/bicep.tmLanguage.json | 95 +- .../shiki/languages/blade.tmLanguage.json | 3867 +++++++++++++++++ .../assets/shiki/languages/c.tmLanguage.json | 1082 +++-- .../shiki/languages/cadence.tmLanguage.json | 738 ++++ .../shiki/languages/clarity.tmLanguage.json | 869 ++++ .../shiki/languages/cmake.tmLanguage.json | 139 + .../shiki/languages/cobol.tmLanguage.json | 51 +- .../shiki/languages/cpp-macro.tmLanguage.json | 81 +- .../shiki/languages/cpp.tmLanguage.json | 203 +- .../shiki/languages/csharp.tmLanguage.json | 8 +- .../shiki/languages/css.tmLanguage.json | 10 +- .../shiki/languages/dart.tmLanguage.json | 11 +- .../shiki/languages/fsharp.tmLanguage.json | 34 +- .../shiki/languages/gherkin.tmLanguage.json | 2 +- .../shiki/languages/glsl.tmLanguage.json | 58 + .../shiki/languages/hack.tmLanguage.json | 2 +- .../shiki/languages/haml.tmLanguage.json | 10 + .../languages/javascript.tmLanguage.json | 123 +- .../shiki/languages/jsx.tmLanguage.json | 123 +- .../shiki/languages/julia.tmLanguage.json | 6 +- .../shiki/languages/jupyter.tmLanguage.json | 9 - .../shiki/languages/latex.tmLanguage.json | 603 ++- .../shiki/languages/liquid.tmLanguage.json | 929 ++++ .../shiki/languages/lua.tmLanguage.json | 46 +- .../shiki/languages/make.tmLanguage.json | 20 +- .../shiki/languages/markdown.tmLanguage.json | 113 +- .../shiki/languages/marko.tmLanguage.json | 1438 +++--- .../shiki/languages/mermaid.tmLanguage.json | 1235 ++++++ .../languages/objective-c.tmLanguage.json | 409 +- .../languages/objective-cpp.tmLanguage.json | 409 +- .../shiki/languages/php.tmLanguage.json | 408 +- .../shiki/languages/prisma.tmLanguage.json | 1 + .../assets/shiki/languages/r.tmLanguage.json | 4 +- .../shiki/languages/rst.tmLanguage.json | 733 ++++ .../shiki/languages/scala.tmLanguage.json | 12 +- .../languages/shellscript.tmLanguage.json | 66 +- .../shiki/languages/solidity.tmLanguage.json | 53 +- .../shiki/languages/sql.tmLanguage.json | 26 +- .../shiki/languages/swift.tmLanguage.json | 42 +- .../shiki/languages/tex.tmLanguage.json | 4 +- .../shiki/languages/tsx.tmLanguage.json | 123 +- .../languages/typescript.tmLanguage.json | 123 +- .../assets/shiki/themes/css-variables.json | 2 +- .../public/assets/shiki/themes/dark-plus.json | 4 +- .../assets/shiki/themes/dracula-soft.json | 4 +- .../public/assets/shiki/themes/dracula.json | 4 +- .../shiki/themes/github-dark-dimmed.json | 136 +- .../assets/shiki/themes/github-dark.json | 136 +- .../assets/shiki/themes/github-light.json | 127 +- .../public/assets/shiki/themes/hc_light.json | 563 +++ .../assets/shiki/themes/light-plus.json | 5 +- .../assets/shiki/themes/material-darker.json | 24 + .../assets/shiki/themes/material-default.json | 24 + .../assets/shiki/themes/material-lighter.json | 24 + .../assets/shiki/themes/material-ocean.json | 24 + .../shiki/themes/material-palenight.json | 24 + .../public/assets/shiki/themes/monokai.json | 2 +- .../assets/shiki/themes/one-dark-pro.json | 46 +- .../assets/shiki/themes/rose-pine-dawn.json | 88 +- .../assets/shiki/themes/rose-pine-moon.json | 46 +- .../public/assets/shiki/themes/rose-pine.json | 46 +- .../assets/shiki/themes/solarized-dark.json | 20 +- .../assets/shiki/themes/solarized-light.json | 30 +- .../assets/shiki/themes/vitesse-dark.json | 425 +- .../assets/shiki/themes/vitesse-light.json | 333 +- .../components/snippets/public-snippet.tsx | 64 + apps/web/src/containers/private/browse.tsx | 24 +- apps/web/src/pages/app/browse.tsx | 41 +- .../domain/src/snippets/snippet.service.ts | 7 +- packages/front/index.tsx | 5 + .../snippets/form/create-snippet.tsx | 13 +- .../snippets/form/editor/hooks/use-editor.ts | 22 +- .../src/components/link/external-link.tsx | 1 + packages/front/src/graphql/generated.ts | 173 +- packages/front/src/graphql/index.ts | 3 +- .../snippets/queries/public-snippets.ts | 47 + packages/front/src/hooks/index.ts | 3 +- .../front/src/hooks/use-code-highlighter.ts | 1 - packages/front/src/services/index.ts | 3 + .../src/services/snippets/public-snippets.ts | 48 + packages/front/src/typings/queries.ts | 23 + packages/front/src/utils/constants.ts | 2 + 90 files changed, 14560 insertions(+), 2891 deletions(-) create mode 100644 apps/core/src/resources/snippets/queries/resolvers/short-content.ts create mode 100644 apps/web/public/assets/shiki/languages/blade.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/languages/cadence.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/languages/clarity.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/languages/cmake.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/languages/glsl.tmLanguage.json delete mode 100644 apps/web/public/assets/shiki/languages/jupyter.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/languages/liquid.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/languages/mermaid.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/languages/rst.tmLanguage.json create mode 100644 apps/web/public/assets/shiki/themes/hc_light.json create mode 100644 apps/web/src/components/snippets/public-snippet.tsx create mode 100644 packages/front/src/graphql/snippets/queries/public-snippets.ts create mode 100644 packages/front/src/services/snippets/public-snippets.ts diff --git a/apps/core/src/resources/resolvers.ts b/apps/core/src/resources/resolvers.ts index 745def1d..830d2404 100644 --- a/apps/core/src/resources/resolvers.ts +++ b/apps/core/src/resources/resolvers.ts @@ -13,6 +13,7 @@ import { updateSnippet } from './snippets/mutations/update-snippet'; import { findSnippet } from './snippets/queries/find-snippet'; import { mySnippets } from './snippets/queries/my-snippets'; import { publicSnippets } from './snippets/queries/public-snippets'; +import { shortContentResolver } from './snippets/queries/resolvers/short-content'; import { dateScalar } from './types/date'; import { loginUser } from './users/mutations/login-user'; import { logoutUser } from './users/mutations/logout-user'; @@ -60,6 +61,7 @@ const resolvers: Resolvers = { folder: (snippet, _args, context) => { return context.db.folder.findById(snippet.folderId); }, + shortContent: shortContentResolver, user: (snippet, _args, context) => { return context.db.user.findById(snippet.userId); }, diff --git a/apps/core/src/resources/schema.graphql.ts b/apps/core/src/resources/schema.graphql.ts index 815f7878..c119dcb7 100644 --- a/apps/core/src/resources/schema.graphql.ts +++ b/apps/core/src/resources/schema.graphql.ts @@ -60,6 +60,7 @@ export default gql` id: ID! name: String! content: String! + shortContent: String! language: String! lineHighlight: String size: Int! diff --git a/apps/core/src/resources/snippets/queries/resolvers/short-content.ts b/apps/core/src/resources/snippets/queries/resolvers/short-content.ts new file mode 100644 index 00000000..10cf5a7f --- /dev/null +++ b/apps/core/src/resources/snippets/queries/resolvers/short-content.ts @@ -0,0 +1,10 @@ +import { Snippet } from '../../../../types/graphql'; + +const MAX_CONTENT_LINES = 10; + +export const shortContentResolver = async (snippet: Snippet): Promise => { + const contentAsArray = snippet.content.split('\n'); + const maxItem = Math.min(MAX_CONTENT_LINES, contentAsArray.length); + + return contentAsArray.slice(0, maxItem).join('\n'); +}; diff --git a/apps/core/src/types/graphql.d.ts b/apps/core/src/types/graphql.d.ts index 51d2f192..8beb6ef2 100644 --- a/apps/core/src/types/graphql.d.ts +++ b/apps/core/src/types/graphql.d.ts @@ -216,6 +216,7 @@ export type Snippet = { language: Scalars['String']; lineHighlight?: Maybe; name: Scalars['String']; + shortContent: Scalars['String']; size: Scalars['Int']; theme: Scalars['String']; updatedAt: Scalars['Date']; @@ -592,6 +593,7 @@ export type SnippetResolvers< language?: Resolver; lineHighlight?: Resolver, ParentType, ContextType>; name?: Resolver; + shortContent?: Resolver; size?: Resolver; theme?: Resolver; updatedAt?: Resolver; diff --git a/apps/web/public/assets/shiki/languages/abap.tmLanguage.json b/apps/web/public/assets/shiki/languages/abap.tmLanguage.json index b6593483..f1f6fae6 100644 --- a/apps/web/public/assets/shiki/languages/abap.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/abap.tmLanguage.json @@ -135,7 +135,7 @@ "end": "\\s*\\.\\s*\\n?", "patterns": [ { - "match": "(?ix)(?<=^|\\s)(BY\\s+DATABASE(\\s+PROCEDURE|\\s+FUNCTION))(?=\\s+|\\.)", + "match": "(?ix)(?<=^|\\s)(BY\\s+DATABASE(\\s+PROCEDURE|\\s+FUNCTION|\\s+GRAPH\\s+WORKSPACE))(?=\\s+|\\.)", "name": "storage.modifier.method.abap" }, { @@ -147,11 +147,11 @@ "name": "storage.modifier.method.abap" }, { - "match": "(?ix)(?<=^|\\s)(LANGUAGE\\s+SQLSCRIPT)(?=\\s+|\\.)", + "match": "(?ix)(?<=^|\\s)(LANGUAGE\\s+(SQLSCRIPT|SQL|GRAPH))(?=\\s+|\\.)", "name": "storage.modifier.method.abap" }, { - "match": "(?ix)(?<=\\s)(USING)\\s+([a-z_\\/][a-z_0-9\\/]*)+(?=\\s+|\\.)", + "match": "(?ix)(?<=\\s)(USING)\\s+([a-z_\\/][a-z_0-9\\/=\\>]*)+(?=\\s+|\\.)", "captures": { "1": { "name": "storage.modifier.method.abap" @@ -264,7 +264,7 @@ "name": "keyword.control.simple.abap" }, "comparison_operator": { - "match": "(?i)(?<=\\s)(<|>|<\\=|>\\=|\\=|<>|eq|ne|lt|le|gt|ge|cs|cp)(?=\\s)", + "match": "(?i)(?<=\\s)(<|>|<\\=|>\\=|\\=|<>|eq|ne|lt|le|gt|ge|cs|cp|co|cn|ca|na|ns|np|byte-co|byte-cn|byte-ca|byte-na|byte-cs|byte-ns|o|z|m)(?=\\s)", "name": "keyword.control.simple.abap" }, "control_keywords": { @@ -306,7 +306,7 @@ } }, "main_keywords": { - "match": "(?ix)(?<=^|\\s)(\n\t abstract|access|add|add-corresponding|adjacent|alias|aliases|all|append|appending|ascending|as|assert|assign|assigned|assigning|association|authority-check|\n\t back|badi|base|begin|between|binary|blanks|block|bound|break-point|by|byte|\n\t call|calling|cast|changing|check|checkbox|class-data|class-events|class-method|class-methods|class-pool|clear|close|cnt|collect|commit|comment|cond|character|\n\t corresponding|communication|comparing|component|compute|concatenate|condense|constants|conv|count|\n\t controls|convert|create|currency|\n\t data|descending|default|define|deferred|delete|describe|destination|detail|display|divide|divide-corresponding|display-mode|distinct|duplicates|\n\t deleting|\n\t editor-call|empty|end|endexec|endfunction|ending|endmodule|end-of-definition|end-of-page|end-of-selection|end-test-injection|end-test-seam|exit-command|extension|\n\t endprovide|endselect|endtry|endwhile|enum|event|events|excluding|exec|exit|export|\n\t exporting|extract|exception|exceptions|\n\t field-symbols|field-groups|field|first|fetch|fields|format|frame|free|from|function|find|for|found|function-pool|\n\t generate|get|group|\n\t handle|handler|hide|hashed|header|help-request|\n\t include|import|importing|index|infotypes|initial|initialization|\n\t\t\t\t\tid|implemented|ignoring|is|in|inner|interface|interfaces|interface-pool|intervals|init|input|insert|instance|into|\n\t\t\t\t\tjoin|\n\t\t\tkey|\n\t language|left-justified|leave|like|line|lines|line-count|line-size|list-processing|load|local|log-point|length|left|leading|lower|\n\t matchcode|memory|method|mesh|message|message-id|methods|mode|modify|module|move|move-corresponding|multiply|multiply-corresponding|match|modif|\n\t\t\tnew|new-line|new-page|new-section|next|no|no-display|no-gap|no-gaps|no-sign|no-zero|non-unique|number|\n\t occurrence|object|obligatory|of|output|overlay|optional|others|occurrences|occurs|offset|options|\n\t pack|parameter|parameters|partially|perform|pf-status|places|position|print-control|private|privileged|program|protected|provide|public|put|\n\t radiobutton\\s+group|raising|range|ranges|receive|receiving|redefinition|reduce|reference|refresh|regex|reject|results|requested|\n\t ref|replace|report|reserve|respecting|restore|result\\s+xml|return|returning|right|right-justified|rollback|read|read-only|rp-provide-from-last|run|\n\t scan|screen|scroll|search|select|select-options|selection-screen|set|stamp|state|source|subkey|\n\t seconds|separated|set|shift|single|skip|sort|sorted|split|standard|stamp|starting|start-of-selection|sum|subtract-corresponding|statics|step|stop|structure|submatches|submit|subtract|summary|supplied|suppress|section|syntax-check|syntax-trace|system-call|switch|\n\t tables|table|task|testing|test-seam|test-injection|textpool|then|time|times|title|titlebar|to|top-of-page|trailing|transaction|transfer|transformation|translate|transporting|types|type|type-pool|type-pools|\n\t unassign|unique|uline|union|unpack|until|update|upper|using|user-command|\n\t value|value-request|\n\t wait|when|while|window|write|where|with|work|\n\t\txml)(?=\\s|\\.|:|,)", + "match": "(?ix)(?<=^|\\s)(\n\t abstract|access|add|add-corresponding|adjacent|alias|aliases|all|amdp|append|appending|ascending|as|assert|assign|assigned|assigning|association|authority-check|\n\t back|badi|base|begin|between|binary|blanks|block|bound|break-point|by|by\\s+database|byte|\n\t call|calling|cast|casting|cds\\s+session|changing|check|checkbox|class-data|class-events|class-method|class-methods|class-pool|cleanup|clear|client|clients|close|cnt|collect|commit|comment|cond|character|\n\t corresponding|communication|comparing|component|components|compute|concatenate|condense|constants|conv|count|\n\t controls|convert|create|currency|current|\n\t data|database|ddl|decimals|default|define|deferred|delete|descending|describe|destination|detail|display|divide|divide-corresponding|display-mode|distinct|duplicates|\n\t deleting|\n\t editor-call|empty|end|endenhancement|endexec|endfunction|ending|endmodule|end-of-definition|end-of-page|end-of-selection|end-test-injection|end-test-seam|exit-command|extension|\n\t endprovide|endselect|entries|endtry|endwhile|enhancement|enum|event|events|excluding|exec|exit|export|\n\t exporting|extract|exception|exceptions|\n\t field-symbols|field-groups|field|first|fetch|fields|format|frame|free|from|function|find|for|found|function-pool|\n\t generate|get|group|\n\t handle|handler|hide|hashed|header|help-request|\n\t include|import|importing|index|infotypes|initial|initialization|\n\t\tid|implemented|ignoring|is|in|inner|interface|interfaces|interface-pool|intervals|init|input|insert|instance|into|\n\t\tjoin|\n\t\tkey|\n\t language|language\\s+graph|language\\s+sql|left-justified|leave|let|like|line|lines|line-count|line-size|listbox|list-processing|load|local|log-point|length|left|leading|lower|\n\t matchcode|memory|method|mesh|message|message-id|methods|mode|modify|module|move|move-corresponding|multiply|multiply-corresponding|match|modif|\n\t\tnew|new-line|new-page|new-section|next|no|no-display|no-gap|no-gaps|no-sign|no-zero|non-unique|number|\n\t occurrence|object|obligatory|of|order|output|overlay|optional|others|occurrences|occurs|offset|options|\n\t pack|parameter|parameters|partially|perform|pf-status|places|position|preferred|primary|print-control|private|privileged|program|protected|provide|public|pushbutton|put|\n\t radiobutton\\s+group|raising|range|ranges|receive|receiving|redefinition|reduce|reference|refresh|regex|reject|results|requested|\n\t ref|replace|report|required|reserve|respecting|restore|result\\s+xml|result\\s+\\(|return|returning|right|right-justified|rollback|read|read-only|rp-provide-from-last|run|\n\t scan|screen|scroll|search|select|select-options|selection-screen|set|stamp|state|source|subkey|\n\t seconds|selection-table|separated|set|shift|single|skip|sort|sorted|split|stable|standard|stamp|starting|start-of-selection|sum|subscreen|subtract-corresponding|statics|step|stop|structure|submatches|submit|subtract|summary|supplied|suppress|section|syntax-check|syntax-trace|system-call|switch|\n\t tabbed|tables|table|task|testing|test-seam|test-injection|textpool|then|time|times|title|titlebar|to|top-of-page|trailing|transaction|transfer|transformation|translate|transporting|types|type|type-pool|type-pools|\n\t unassign|unique|uline|union|unpack|until|update|upper|using|user-command|\n\t value|value-request|visible|\n\t wait|when|while|window|write|where|with|work|workspace|\n\t\txml)(?=\\s|\\.|:|,)", "name": "keyword.control.simple.abap" }, "text_symbols": { diff --git a/apps/web/public/assets/shiki/languages/actionscript-3.tmLanguage.json b/apps/web/public/assets/shiki/languages/actionscript-3.tmLanguage.json index 5e0209e8..80585518 100644 --- a/apps/web/public/assets/shiki/languages/actionscript-3.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/actionscript-3.tmLanguage.json @@ -572,7 +572,7 @@ ] }, "method": { - "begin": "(?x) (^|\\s+) ((\\w+)\\s+)? ((\\w+)\\s+)? ((\\w+)\\s+)? (\\w+) (?=\\s+\\bfunction\\b)", + "begin": "(?x) (^|\\s+) ((\\w+)\\s+)? ((\\w+)\\s+)? ((\\w+)\\s+)? ((\\w+)\\s+)? (?=\\bfunction\\b)", "beginCaptures": { "3": { "name": "storage.modifier.actionscript.3" diff --git a/apps/web/public/assets/shiki/languages/astro.tmLanguage.json b/apps/web/public/assets/shiki/languages/astro.tmLanguage.json index fa4621d2..b89c5a3a 100644 --- a/apps/web/public/assets/shiki/languages/astro.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/astro.tmLanguage.json @@ -5,11 +5,8 @@ "foldingStopMarker": "(?x)\n(\n|^(?!.*?$\n|<\\?(?:php)?.*\\bend(if|for(each)?|while)\\b\n|\\{\\{?/(if|foreach|capture|literal|foreach|php|section|strip)\n|^[^{]*\\}\n)", "keyEquivalent": "^~H", "name": "astro", - "scopeName": "text.html.astro", + "scopeName": "source.astro", "patterns": [ - { - "include": "#astro:markdown" - }, { "include": "#astro:expressions" }, @@ -26,7 +23,10 @@ "include": "#astro:fragment" }, { - "include": "#astro:lang" + "include": "#astro:lang-scripts" + }, + { + "include": "#astro:lang-styles" }, { "include": "#astro:component" @@ -65,25 +65,64 @@ ] }, "astro:component": { - "name": "meta.tag.component.astro", - "begin": "(]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)\\b", - "beginCaptures": { - "1": { - "name": "punctuation.definition.tag.begin.astro" - }, - "2": { - "name": "entity.name.tag.astro support.class.component.astro" - } - }, - "end": "(/?>)", - "endCaptures": { - "1": { - "name": "punctuation.definition.tag.end.astro" - } - }, "patterns": [ { - "include": "#astro:attribute" + "name": "meta.tag.component.astro astro.component.raw", + "begin": "(<)([$A-Z_][^/?!\\s<>]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)(.+is:raw.*?)(>)", + "end": "(]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)(?=\\s|/?>)(>)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.astro" + }, + "2": { + "name": "entity.name.tag.astro support.class.component.astro" + }, + "3": { + "patterns": [ + { + "include": "#astro:attribute" + } + ] + }, + "4": { + "name": "punctuation.definition.tag.end.astro" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.astro" + }, + "2": { + "name": "entity.name.tag.astro support.class.component.astro" + }, + "3": { + "name": "punctuation.definition.tag.end.astro" + } + }, + "contentName": "source.unknown" + }, + { + "name": "meta.tag.component.astro", + "begin": "(]*|[^/?!\\s<>.]+\\.[^/?!\\s<>]+)\\b", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.astro" + }, + "2": { + "name": "entity.name.tag.astro support.class.component.astro" + } + }, + "end": "(/?>)", + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.end.astro" + } + }, + "patterns": [ + { + "include": "#astro:attribute" + } + ] } ] }, @@ -102,35 +141,26 @@ } } }, - "astro:lang": { - "begin": "(<)(?:(S(?i:cript|tyle))|((?i:script|style)))(?![\\w:-])", + "astro:lang-scripts": { + "begin": "(<)(script)", + "end": "()|(/>)", "beginCaptures": { - "0": { - "name": "meta.tag.metadata.$2$3.start.html" - }, "1": { "name": "punctuation.definition.tag.begin.html" }, "2": { - "name": "entity.name.tag.astro support.class.component.astro" - }, - "3": { "name": "entity.name.tag.html" } }, - "end": "()", "endCaptures": { - "0": { - "name": "meta.tag.metadata.$2$3.end.html" - }, "1": { "name": "punctuation.definition.tag.begin.html" }, "2": { - "name": "entity.name.tag.astro support.class.component.astro" + "name": "entity.name.tag.html" }, "3": { - "name": "entity.name.tag.html" + "name": "punctuation.definition.tag.end.html" }, "4": { "name": "punctuation.definition.tag.end.html" @@ -138,124 +168,271 @@ }, "patterns": [ { - "begin": "\\G", - "end": "(>)", - "endCaptures": { - "1": { - "name": "punctuation.definition.tag.end.html" + "comment": "Treat script tag with application/ld+json as JSON. This needs to be higher than is:raw since it's a very possible situation to have is:raw on a JSON script tag", + "begin": "\\G(?=\\s*[^>]*?type\\s*=\\s*(['\"]|)(?i:application/ld\\+json)\\1)", + "end": "(?=)", + "patterns": [ + { + "begin": "(?<=>)(?!]*?type\\s*=\\s*(['\"]|)(?i:module|(?:text/javascript|text/partytown|application/node|application/javascript))\\1)", + "end": "(?=)", "patterns": [ { - "include": "#astro:attribute" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=]*?type\\s*=\\s*(['\"]|)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.css" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=]*?lang\\s*=\\s*(['\"]|)(?i:jsx?|javascript)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.js" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=]*?lang\\s*=\\s*(['\"]|)(?i:ts|typescript)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.css.less" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=]*?lang\\s*=\\s*(['\"]|)(?i:tsx)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.sass" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=)(?!]*>)(?!\\G)", - "end": "(?=)|(/>)", + "beginCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.html" + }, + "2": { + "name": "entity.name.tag.html" + } + }, + "endCaptures": { + "1": { + "name": "punctuation.definition.tag.begin.html" + }, + "2": { + "name": "entity.name.tag.html" + }, + "3": { + "name": "punctuation.definition.tag.end.html" + }, + "4": { + "name": "punctuation.definition.tag.end.html" + } + }, + "patterns": [ + { + "begin": "\\G(?=\\s*[^>]*?lang\\s*=\\s*(['\"]|)(?i:css)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.stylus" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=]*?lang\\s*=\\s*(['\"]|)(?i:less)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.ts" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=]*?lang\\s*=\\s*(['\"]|)(?i:sass)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.tsx" + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=]*?lang\\s*=\\s*(['\"]|)(?i:scss)\\1)", + "end": "(?=)", "patterns": [ { - "include": "source.js" + "begin": "(?<=>)(?!]*?lang\\s*=\\s*(['\"]|)(?i:styl(?:us)?)\\1)", + "end": "(?=)", + "patterns": [ + { + "begin": "(?<=>)(?!]*>)(?!\\G)", - "end": "(?=)(?!)|>", + "endCaptures": { + "0": { + "name": "punctuation.definition.tag.end.html" + } + }, + "patterns": [ + { + "include": "#astro:attribute" + } + ] + }, "html:comment": { "name": "comment.block.html", "begin": ")", + "beginCaptures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "match": "\\%%.*", + "name": "comment" + }, + { + "comment": "(Graph Link Text)?(Graph Link)(Entity To)?(Edge/Shape)?(Text)?(Edge/Shape)?", + "match": "(\\s*(?:\"[^\"]+\")|(?:[\\($&%\\^/#.,?!;:*+<>_\\'\\\\\\w\\s]*))?\\s*(-?-[-\\>]\\|?|=?=[=\\>]|(?:\\.-|-\\.)-?\\>?|\\|)(\\s*[-\\w]+\\b)(\\[|\\(+|\\>|\\{)?(\\s*[-\\w]+\\b)?(\\]|\\)+|\\})?", + "captures": { + "1": { + "name": "string" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "variable" + }, + "4": { + "name": "keyword.control.mermaid" + }, + "5": { + "name": "string" + }, + "6": { + "name": "keyword.control.mermaid" + } + } + }, + { + "comment": "(Entity To)(Edge/Shape)?(Text)?(Edge/Shape)?", + "match": "(\\s*[-\\w]+\\b)(\\[|\\(+|\\>|\\{)?(\\s*[-\\w]+\\b)?(\\]|\\)+|\\})?", + "captures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "string" + }, + "4": { + "name": "keyword.control.mermaid" + } + } + } + ], + "end": "$" + }, + { + "comment": "(Entity)(Edge/Shape)(Text)(Edge/Shape)", + "begin": "(\\b[-\\w]+\\b\\s*)(\\[|\\(+|\\>|\\{|\\(\\()(\\s*(?:\"[^\"]+\")|(?:[$&%\\^/#.,?!;:*+<>_\\'\\\\\\w\\s]*))(\\]|\\)+|\\}|\\)\\))", + "beginCaptures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "string" + }, + "4": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "comment": "(Entity)(Edge/Shape)(Text)(Edge/Shape)", + "match": "(\\s*\\b[-\\w]+\\b\\s*)(\\[|\\(+|\\>|\\{)(\\s*[\"\\($&%\\^/#.,?!;:*+=<>\\'\\\\\\-\\w\\s]*)(\\]|\\)+|\\})", + "captures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "string" + }, + "4": { + "name": "keyword.control.mermaid" + } + } + }, + { + "comment": "(Graph Link)(Graph Link Text)(Graph Link)(Entity)(Edge/Shape)(Text)(Edge/Shape)", + "match": "(\\s*-?-[-\\>]\\|?|=?=[=\\>]|(?:\\.-|-\\.)-?\\>?)(\\s*[-\\w\\s]+\\b)?(-?-[-\\>]\\|?|=?=[=\\>]|(?:\\.-|-\\.)-?\\>?|\\|)?(\\s*\\b[-\\w]+\\b\\s*)(\\[|\\(+|\\>|\\{)(\\s*[\"\\($&%\\^/#.,?!;:*+=<>\\'\\\\\\-\\w\\s]*)?(\\]|\\)+|\\})", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "string" + }, + "3": { + "name": "keyword.control.mermaid" + }, + "4": { + "name": "variable" + }, + "5": { + "name": "keyword.control.mermaid" + }, + "6": { + "name": "string" + }, + "7": { + "name": "keyword.control.mermaid" + } + } + } + ], + "end": "$" + }, + { + "match": "(\\b[-\\w]+\\b\\s*)", + "name": "variable" + }, + { + "comment": "(Class)(Node(s))(ClassName)", + "match": "\\s*(class)\\s+(\\b[-,\\w]+)\\s+(\\b\\w+\\b)", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "variable" + }, + "3": { + "name": "string" + } + } + }, + { + "comment": "(ClassDef)(ClassName)(Styles)", + "match": "\\s*(classDef)\\s+(\\b\\w+\\b)\\s+(\\b[-,:;#\\w]+)", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "variable" + }, + "3": { + "name": "string" + } + } + }, + { + "comment": "(Click)(Entity)(Link)?(Tooltip)", + "match": "\\s*(click)\\s+(\\b[-\\w]+\\b\\s*)(\\b\\w+\\b)?\\s(\"*.*\")", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "variable" + }, + "3": { + "name": "variable" + }, + "4": { + "name": "string" + } + } + } + ], + "end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)" + }, + { + "comment": "Pie Chart", + "begin": "^\\s*(pie)", + "beginCaptures": { + "1": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "match": "\\%%.*", + "name": "comment" + }, + { + "match": "(title)\\s+(\\s*[\"\\(\\)$&%\\^/#.,?!;:*+=<>\\'\\\\\\-\\w\\s]*)", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "string" + } + } + }, + { + "begin": "\\s(.*)(:)", + "beginCaptures": { + "1": { + "name": "string" + }, + "2": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "match": "\\%%.*", + "name": "comment" + } + ], + "end": "$" + } + ], + "end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)" + }, + { + "comment": "Sequence Diagram", + "begin": "^\\s*(sequenceDiagram)", + "beginCaptures": { + "1": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "match": "(\\%%|#).*", + "name": "comment" + }, + { + "comment": "(title)(title text)", + "match": "(title)\\s*(:)?\\s+(\\s*[\"\\(\\)$&%\\^/#.,?!:*+=<>\\'\\\\\\-\\w\\s]*)", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "string" + } + } + }, + { + "comment": "(participant)(Actor)(as)?(Label)?", + "match": "\\s*(participant|actor)\\s+((?:(?! as )[\"\\(\\)$&%\\^/#.?!*=<>\\'\\\\\\w\\s])+)\\s*(as)?\\s([\"\\(\\)$&%\\^/#.,?!*=<>\\'\\\\\\w\\s]+)?", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "variable" + }, + "3": { + "name": "keyword.control.mermaid" + }, + "4": { + "name": "string" + } + } + }, + { + "comment": "(activate/deactivate)(Actor)", + "match": "\\s*((?:de)?activate)\\s+(\\b[\"\\(\\)$&%\\^/#.?!*=<>\\'\\\\\\w\\s]+\\b\\s*)", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "variable" + } + } + }, + { + "comment": "(Note)(direction)(Actor)(,)?(Actor)?(:)(Message)", + "match": "\\s*(Note)\\s+((?:left|right)\\sof|over)\\s+(\\b[\"\\(\\)$&%\\^/#.?!*=<>\\'\\\\\\w\\s]+\\b\\s*)(,)?(\\b[\"\\(\\)$&%\\^/#.?!*=<>\\'\\\\\\w\\s]+\\b\\s*)?(:)(?:\\s+([^;#]*))?", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "entity.name.function.mermaid" + }, + "3": { + "name": "variable" + }, + "4": { + "name": "keyword.control.mermaid" + }, + "5": { + "name": "variable" + }, + "6": { + "name": "keyword.control.mermaid" + }, + "7": { + "name": "string" + } + } + }, + { + "comment": "(loop)(loop text)", + "match": "\\s*(loop)(?:\\s+([^;#]*))?", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "string" + } + } + }, + { + "comment": "(end)", + "match": "\\s*(end)", + "captures": { + "1": { + "name": "keyword.control.mermaid" + } + } + }, + { + "comment": "(alt/else/opt/par/and/autonumber)(text)", + "match": "\\s*(alt|else|opt|par|and|rect|autonumber)(?:\\s+([^#;]*))?", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "string" + } + } + }, + { + "comment": "(Actor)(Arrow)(Actor)(:)(Message)", + "match": "\\s*(\\b[\"\\(\\)$&%\\^/#.?!*=<>\\'\\\\\\w\\s]+\\b)\\s*(-?-(?:\\>|x|\\))\\>?[+-]?)\\s*([\"\\(\\)$&%\\^/#.?!*=<>\\'\\\\\\w\\s]+\\b)\\s*(:)\\s*([^;#]*)", + "captures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "variable" + }, + "4": { + "name": "keyword.control.mermaid" + }, + "5": { + "name": "string" + } + } + } + ], + "end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)" + }, + { + "comment": "State Diagram", + "begin": "^\\s*(stateDiagram)", + "beginCaptures": { + "1": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "match": "\\%%.*", + "name": "comment" + }, + { + "comment": "}", + "match": "\\s+(})\\s+", + "captures": { + "1": { + "name": "keyword.control.mermaid" + } + } + }, + { + "comment": "--", + "match": "\\s+(--)\\s+", + "captures": { + "1": { + "name": "keyword.control.mermaid" + } + } + }, + { + "comment": "(state)", + "match": "^\\s*([\\w-]+)$", + "name": "variable" + }, + { + "comment": "(state) : (description)", + "match": "([\\w-]+)\\s+(:)\\s+(\\s*[-\\w\\s]+\\b)", + "captures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "string" + } + } + }, + { + "comment": "state", + "begin": "(state)", + "beginCaptures": { + "1": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "comment": "\"(description)\" as (state)", + "match": "\\s+(\"[-\\w\\s]+\\b\")\\s+(as)\\s+([\\w-]+)", + "captures": { + "1": { + "name": "string" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "variable" + } + } + }, + { + "comment": "(state name) {", + "match": "\\s+([\\w-]+)\\s+({)", + "captures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + } + } + }, + { + "comment": "(state name) <>", + "match": "\\s+([\\w-]+)\\s+(<<(?:fork|join)>>)", + "captures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + } + } + } + ], + "end": "$" + }, + { + "comment": "(state) -->", + "begin": "([\\w-]+)\\s+(-->)", + "beginCaptures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + } + }, + "patterns": [ + { + "comment": "(state) (:)? (transition text)?", + "match": "\\s+([\\w-]+)\\s*(:)?\\s*(\\s*[-\\w\\s]+\\b)?", + "captures": { + "1": { + "name": "variable" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "string" + } + } + }, + { + "comment": "[*] (:)? (transition text)?", + "match": "(\\[\\*\\])\\s*(:)?\\s*(\\s*[-\\w\\s]+\\b)?", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "string" + } + } + } + ], + "end": "$" + }, + { + "comment": "[*] --> (state) (:)? (transition text)?", + "match": "(\\[\\*\\])\\s+(-->)\\s+([\\w-]+)\\s*(:)?\\s*(\\s*[-\\w\\s]+\\b)?", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "keyword.control.mermaid" + }, + "3": { + "name": "variable" + }, + "4": { + "name": "keyword.control.mermaid" + }, + "5": { + "name": "string" + } + } + }, + { + "comment": "note left|right of (state name)", + "match": "(note (?:left|right) of)\\s+([\\w-]+)\\s+(:)\\s*(\\s*[-\\w\\s]+\\b)", + "captures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "variable" + }, + "3": { + "name": "keyword.control.mermaid" + }, + "4": { + "name": "string" + } + } + }, + { + "comment": "note left|right of (state name) (note text) end note", + "begin": "(note (?:left|right) of)\\s+([\\w-]+)(.|\\n)", + "beginCaptures": { + "1": { + "name": "keyword.control.mermaid" + }, + "2": { + "name": "variable" + } + }, + "contentName": "string", + "end": "(end note)", + "endCaptures": { + "1": { + "name": "keyword.control.mermaid" + } + } + } + ], + "end": "(^|\\G)(?=\\s*[`~]{3,}\\s*$)" + } + ] + } + }, + "scopeName": "source.mermaid", + "name": "mermaid" +} diff --git a/apps/web/public/assets/shiki/languages/objective-c.tmLanguage.json b/apps/web/public/assets/shiki/languages/objective-c.tmLanguage.json index 3ea2c90d..aa53580b 100644 --- a/apps/web/public/assets/shiki/languages/objective-c.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/objective-c.tmLanguage.json @@ -1,14 +1,112 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/syntaxes/objc.tmLanguage.json", + "This file has been converted from https://github.com/jeff-hykin/better-objc-syntax/blob/master/autogenerated/objc.tmLanguage.json", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/0ef79f098ed80ce5a86be4ed40f99ebcdbac4895", + "version": "https://github.com/jeff-hykin/better-objc-syntax/commit/119b75fb1f4d3e8726fa62588e3b935e0b719294", "name": "objective-c", "scopeName": "source.objc", "patterns": [ { + "include": "#anonymous_pattern_1" + }, + { + "include": "#anonymous_pattern_2" + }, + { + "include": "#anonymous_pattern_3" + }, + { + "include": "#anonymous_pattern_4" + }, + { + "include": "#anonymous_pattern_5" + }, + { + "include": "#apple_foundation_functional_macros" + }, + { + "include": "#anonymous_pattern_7" + }, + { + "include": "#anonymous_pattern_8" + }, + { + "include": "#anonymous_pattern_9" + }, + { + "include": "#anonymous_pattern_10" + }, + { + "include": "#anonymous_pattern_11" + }, + { + "include": "#anonymous_pattern_12" + }, + { + "include": "#anonymous_pattern_13" + }, + { + "include": "#anonymous_pattern_14" + }, + { + "include": "#anonymous_pattern_15" + }, + { + "include": "#anonymous_pattern_16" + }, + { + "include": "#anonymous_pattern_17" + }, + { + "include": "#anonymous_pattern_18" + }, + { + "include": "#anonymous_pattern_19" + }, + { + "include": "#anonymous_pattern_20" + }, + { + "include": "#anonymous_pattern_21" + }, + { + "include": "#anonymous_pattern_22" + }, + { + "include": "#anonymous_pattern_23" + }, + { + "include": "#anonymous_pattern_24" + }, + { + "include": "#anonymous_pattern_25" + }, + { + "include": "#anonymous_pattern_26" + }, + { + "include": "#anonymous_pattern_27" + }, + { + "include": "#anonymous_pattern_28" + }, + { + "include": "#anonymous_pattern_29" + }, + { + "include": "#anonymous_pattern_30" + }, + { + "include": "#bracketed_content" + }, + { + "include": "#c_lang" + } + ], + "repository": { + "anonymous_pattern_1": { "begin": "((@)(interface|protocol))(?!.+;)\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*((:)(?:\\s*)([A-Za-z][A-Za-z0-9]*))?(\\s|\\n)?", "captures": { "1": { @@ -42,105 +140,7 @@ } ] }, - { - "begin": "((@)(implementation))\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*(?::\\s*([A-Za-z][A-Za-z0-9]*))?", - "captures": { - "1": { - "name": "storage.type.objc" - }, - "2": { - "name": "punctuation.definition.storage.type.objc" - }, - "4": { - "name": "entity.name.type.objc" - }, - "5": { - "name": "entity.other.inherited-class.objc" - } - }, - "contentName": "meta.scope.implementation.objc", - "end": "((@)end)\\b", - "name": "meta.implementation.objc", - "patterns": [ - { - "include": "#implementation_innards" - } - ] - }, - { - "begin": "@\"", - "beginCaptures": { - "0": { - "name": "punctuation.definition.string.begin.objc" - } - }, - "end": "\"", - "endCaptures": { - "0": { - "name": "punctuation.definition.string.end.objc" - } - }, - "name": "string.quoted.double.objc", - "patterns": [ - { - "include": "#string_escaped_char" - }, - { - "match": "(?x)%\n\t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n\t\t\t\t\t\t[#0\\- +']* # flags\n\t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n\t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n\t\t\t\t\t\t[@] # conversion type\n\t\t\t\t\t", - "name": "constant.other.placeholder.objc" - }, - { - "include": "#string_placeholder" - } - ] - }, - { - "begin": "\\b(id)\\s*(?=<)", - "beginCaptures": { - "1": { - "name": "storage.type.objc" - } - }, - "end": "(?<=>)", - "name": "meta.id-with-protocol.objc", - "patterns": [ - { - "include": "#protocol_list" - } - ] - }, - { - "match": "\\b(NS_DURING|NS_HANDLER|NS_ENDHANDLER)\\b", - "name": "keyword.control.macro.objc" - }, - { - "captures": { - "1": { - "name": "punctuation.definition.keyword.objc" - } - }, - "match": "(@)(try|catch|finally|throw)\\b", - "name": "keyword.control.exception.objc" - }, - { - "captures": { - "1": { - "name": "punctuation.definition.keyword.objc" - } - }, - "match": "(@)(synchronized)\\b", - "name": "keyword.control.synchronize.objc" - }, - { - "captures": { - "1": { - "name": "punctuation.definition.keyword.objc" - } - }, - "match": "(@)(required|optional)\\b", - "name": "keyword.control.protocol-specification.objc" - }, - { + "anonymous_pattern_10": { "captures": { "1": { "name": "punctuation.definition.keyword.objc" @@ -149,15 +149,15 @@ "match": "(@)(defs|encode)\\b", "name": "keyword.other.objc" }, - { + "anonymous_pattern_11": { "match": "\\bid\\b", "name": "storage.type.id.objc" }, - { + "anonymous_pattern_12": { "match": "\\b(IBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class|instancetype)\\b", "name": "storage.type.objc" }, - { + "anonymous_pattern_13": { "captures": { "1": { "name": "punctuation.definition.storage.type.objc" @@ -166,7 +166,7 @@ "match": "(@)(class|protocol)\\b", "name": "storage.type.objc" }, - { + "anonymous_pattern_14": { "begin": "((@)selector)\\s*(\\()", "beginCaptures": { "1": { @@ -199,7 +199,7 @@ } ] }, - { + "anonymous_pattern_15": { "captures": { "1": { "name": "punctuation.definition.storage.modifier.objc" @@ -208,15 +208,15 @@ "match": "(@)(synchronized|public|package|private|protected)\\b", "name": "storage.modifier.objc" }, - { + "anonymous_pattern_16": { "match": "\\b(YES|NO|Nil|nil)\\b", "name": "constant.language.objc" }, - { + "anonymous_pattern_17": { "match": "\\bNSApp\\b", "name": "support.variable.foundation.objc" }, - { + "anonymous_pattern_18": { "captures": { "1": { "name": "punctuation.whitespace.support.function.cocoa.leopard.objc" @@ -227,7 +227,7 @@ }, "match": "(\\s*)\\b(NS(Rect(ToCGRect|FromCGRect)|MakeCollectable|S(tringFromProtocol|ize(ToCGSize|FromCGSize))|Draw(NinePartImage|ThreePartImage)|P(oint(ToCGPoint|FromCGPoint)|rotocolFromString)|EventMaskFromType|Value))\\b" }, - { + "anonymous_pattern_19": { "captures": { "1": { "name": "punctuation.whitespace.support.function.leading.cocoa.objc" @@ -238,58 +238,171 @@ }, "match": "(\\s*)\\b(NS(R(ound(DownToMultipleOfPageSize|UpToMultipleOfPageSize)|un(CriticalAlertPanel(RelativeToWindow)?|InformationalAlertPanel(RelativeToWindow)?|AlertPanel(RelativeToWindow)?)|e(set(MapTable|HashTable)|c(ycleZone|t(Clip(List)?|F(ill(UsingOperation|List(UsingOperation|With(Grays|Colors(UsingOperation)?))?)?|romString))|ordAllocationEvent)|turnAddress|leaseAlertPanel|a(dPixel|l(MemoryAvailable|locateCollectable))|gisterServicesProvider)|angeFromString)|Get(SizeAndAlignment|CriticalAlertPanel|InformationalAlertPanel|UncaughtExceptionHandler|FileType(s)?|WindowServerMemory|AlertPanel)|M(i(n(X|Y)|d(X|Y))|ouseInRect|a(p(Remove|Get|Member|Insert(IfAbsent|KnownAbsent)?)|ke(R(ect|ange)|Size|Point)|x(Range|X|Y)))|B(itsPer(SampleFromDepth|PixelFromDepth)|e(stDepth|ep|gin(CriticalAlertSheet|InformationalAlertSheet|AlertSheet)))|S(ho(uldRetainWithZone|w(sServicesMenuItem|AnimationEffect))|tringFrom(R(ect|ange)|MapTable|S(ize|elector)|HashTable|Class|Point)|izeFromString|e(t(ShowsServicesMenuItem|ZoneName|UncaughtExceptionHandler|FocusRingStyle)|lectorFromString|archPathForDirectoriesInDomains)|wap(Big(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|Short|Host(ShortTo(Big|Little)|IntTo(Big|Little)|DoubleTo(Big|Little)|FloatTo(Big|Little)|Long(To(Big|Little)|LongTo(Big|Little)))|Int|Double|Float|L(ittle(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|ong(Long)?)))|H(ighlightRect|o(stByteOrder|meDirectory(ForUser)?)|eight|ash(Remove|Get|Insert(IfAbsent|KnownAbsent)?)|FSType(CodeFromFileType|OfFile))|N(umberOfColorComponents|ext(MapEnumeratorPair|HashEnumeratorItem))|C(o(n(tainsRect|vert(GlyphsToPackedGlyphs|Swapped(DoubleToHost|FloatToHost)|Host(DoubleToSwapped|FloatToSwapped)))|unt(MapTable|HashTable|Frames|Windows(ForContext)?)|py(M(emoryPages|apTableWithZone)|Bits|HashTableWithZone|Object)|lorSpaceFromDepth|mpare(MapTables|HashTables))|lassFromString|reate(MapTable(WithZone)?|HashTable(WithZone)?|Zone|File(namePboardType|ContentsPboardType)))|TemporaryDirectory|I(s(ControllerMarker|EmptyRect|FreedObject)|n(setRect|crementExtraRefCount|te(r(sect(sRect|ionR(ect|ange))|faceStyleForKey)|gralRect)))|Zone(Realloc|Malloc|Name|Calloc|Fr(omPointer|ee))|O(penStepRootDirectory|ffsetRect)|D(i(sableScreenUpdates|videRect)|ottedFrameRect|e(c(imal(Round|Multiply|S(tring|ubtract)|Normalize|Co(py|mpa(ct|re))|IsNotANumber|Divide|Power|Add)|rementExtraRefCountWasZero)|faultMallocZone|allocate(MemoryPages|Object))|raw(Gr(oove|ayBezel)|B(itmap|utton)|ColorTiledRects|TiledRects|DarkBezel|W(hiteBezel|indowBackground)|LightBezel))|U(serName|n(ionR(ect|ange)|registerServicesProvider)|pdateDynamicServices)|Java(Bundle(Setup|Cleanup)|Setup(VirtualMachine)?|Needs(ToLoadClasses|VirtualMachine)|ClassesF(orBundle|romPath)|ObjectNamedInPath|ProvidesClasses)|P(oint(InRect|FromString)|erformService|lanarFromDepth|ageSize)|E(n(d(MapTableEnumeration|HashTableEnumeration)|umerate(MapTable|HashTable)|ableScreenUpdates)|qual(R(ects|anges)|Sizes|Points)|raseRect|xtraRefCount)|F(ileTypeForHFSTypeCode|ullUserName|r(ee(MapTable|HashTable)|ame(Rect(WithWidth(UsingOperation)?)?|Address)))|Wi(ndowList(ForContext)?|dth)|Lo(cationInRange|g(v|PageSize)?)|A(ccessibility(R(oleDescription(ForUIElement)?|aiseBadArgumentException)|Unignored(Children(ForOnlyChild)?|Descendant|Ancestor)|PostNotification|ActionDescription)|pplication(Main|Load)|vailableWindowDepths|ll(MapTable(Values|Keys)|HashTableObjects|ocate(MemoryPages|Collectable|Object)))))\\b" }, - { + "anonymous_pattern_2": { + "begin": "((@)(implementation))\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*(?::\\s*([A-Za-z][A-Za-z0-9]*))?", + "captures": { + "1": { + "name": "storage.type.objc" + }, + "2": { + "name": "punctuation.definition.storage.type.objc" + }, + "4": { + "name": "entity.name.type.objc" + }, + "5": { + "name": "entity.other.inherited-class.objc" + } + }, + "contentName": "meta.scope.implementation.objc", + "end": "((@)end)\\b", + "name": "meta.implementation.objc", + "patterns": [ + { + "include": "#implementation_innards" + } + ] + }, + "anonymous_pattern_20": { "match": "\\bNS(RuleEditor|G(arbageCollector|radient)|MapTable|HashTable|Co(ndition|llectionView(Item)?)|T(oolbarItemGroup|extInputClient|r(eeNode|ackingArea))|InvocationOperation|Operation(Queue)?|D(ictionaryController|ockTile)|P(ointer(Functions|Array)|athC(o(ntrol(Delegate)?|mponentCell)|ell(Delegate)?)|r(intPanelAccessorizing|edicateEditor(RowTemplate)?))|ViewController|FastEnumeration|Animat(ionContext|ablePropertyContainer))\\b", "name": "support.class.cocoa.leopard.objc" }, - { + "anonymous_pattern_21": { "match": "\\bNS(R(u(nLoop|ler(Marker|View))|e(sponder|cursiveLock|lativeSpecifier)|an(domSpecifier|geSpecifier))|G(etCommand|lyph(Generator|Storage|Info)|raphicsContext)|XML(Node|D(ocument|TD(Node)?)|Parser|Element)|M(iddleSpecifier|ov(ie(View)?|eCommand)|utable(S(tring|et)|C(haracterSet|opying)|IndexSet|D(ictionary|ata)|URLRequest|ParagraphStyle|A(ttributedString|rray))|e(ssagePort(NameServer)?|nu(Item(Cell)?|View)?|t(hodSignature|adata(Item|Query(ResultGroup|AttributeValueTuple)?)))|a(ch(BootstrapServer|Port)|trix))|B(itmapImageRep|ox|u(ndle|tton(Cell)?)|ezierPath|rowser(Cell)?)|S(hadow|c(anner|r(ipt(SuiteRegistry|C(o(ercionHandler|mmand(Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(er|View)|een))|t(epper(Cell)?|atus(Bar|Item)|r(ing|eam))|imple(HorizontalTypesetter|CString)|o(cketPort(NameServer)?|und|rtDescriptor)|p(e(cifierTest|ech(Recognizer|Synthesizer)|ll(Server|Checker))|litView)|e(cureTextField(Cell)?|t(Command)?|archField(Cell)?|rializer|gmentedC(ontrol|ell))|lider(Cell)?|avePanel)|H(ost|TTP(Cookie(Storage)?|URLResponse)|elpManager)|N(ib(Con(nector|trolConnector)|OutletConnector)?|otification(Center|Queue)?|u(ll|mber(Formatter)?)|etService(Browser)?|ameSpecifier)|C(ha(ngeSpelling|racterSet)|o(n(stantString|nection|trol(ler)?|ditionLock)|d(ing|er)|unt(Command|edSet)|pying|lor(Space|P(ick(ing(Custom|Default)|er)|anel)|Well|List)?|m(p(oundPredicate|arisonPredicate)|boBox(Cell)?))|u(stomImageRep|rsor)|IImageRep|ell|l(ipView|o(seCommand|neCommand)|assDescription)|a(ched(ImageRep|URLResponse)|lendar(Date)?)|reateCommand)|T(hread|ypesetter|ime(Zone|r)|o(olbar(Item(Validations)?)?|kenField(Cell)?)|ext(Block|Storage|Container|Tab(le(Block)?)?|Input|View|Field(Cell)?|List|Attachment(Cell)?)?|a(sk|b(le(Header(Cell|View)|Column|View)|View(Item)?))|reeController)|I(n(dex(S(pecifier|et)|Path)|put(Manager|S(tream|erv(iceProvider|er(MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(Rep|Cell|View)?)|O(ut(putStream|lineView)|pen(GL(Context|Pixel(Buffer|Format)|View)|Panel)|bj(CTypeSerializationCallBack|ect(Controller)?))|D(i(st(antObject(Request)?|ributed(NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(Controller)?|e(serializer|cimalNumber(Behaviors|Handler)?|leteCommand)|at(e(Components|Picker(Cell)?|Formatter)?|a)|ra(wer|ggingInfo))|U(ser(InterfaceValidations|Defaults(Controller)?)|RL(Re(sponse|quest)|Handle(Client)?|C(onnection|ache|redential(Storage)?)|Download(Delegate)?|Prot(ocol(Client)?|ectionSpace)|AuthenticationChallenge(Sender)?)?|n(iqueIDSpecifier|doManager|archiver))|P(ipe|o(sitionalSpecifier|pUpButton(Cell)?|rt(Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(steboard|nel|ragraphStyle|geLayout)|r(int(Info|er|Operation|Panel)|o(cessInfo|tocolChecker|perty(Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(numerator|vent|PSImageRep|rror|x(ception|istsCommand|pression))|V(iew(Animation)?|al(idated(ToobarItem|UserInterfaceItem)|ue(Transformer)?))|Keyed(Unarchiver|Archiver)|Qui(ckDrawView|tCommand)|F(ile(Manager|Handle|Wrapper)|o(nt(Manager|Descriptor|Panel)?|rm(Cell|atter)))|W(hoseSpecifier|indow(Controller)?|orkspace)|L(o(c(k(ing)?|ale)|gicalTest)|evelIndicator(Cell)?|ayoutManager)|A(ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(ication|e(Script|Event(Manager|Descriptor)))|ffineTransform|lert|r(chiver|ray(Controller)?)))\\b", "name": "support.class.cocoa.objc" }, - { + "anonymous_pattern_22": { "match": "\\bNS(R(oundingMode|ule(Editor(RowType|NestingMode)|rOrientation)|e(questUserAttentionType|lativePosition))|G(lyphInscription|radientDrawingOptions)|XML(NodeKind|D(ocumentContentKind|TDNodeKind)|ParserError)|M(ultibyteGlyphPacking|apTableOptions)|B(itmapFormat|oxType|ezierPathElement|ackgroundStyle|rowserDropOperation)|S(tr(ing(CompareOptions|DrawingOptions|EncodingConversionOptions)|eam(Status|Event))|p(eechBoundary|litViewDividerStyle)|e(archPathD(irectory|omainMask)|gmentS(tyle|witchTracking))|liderType|aveOptions)|H(TTPCookieAcceptPolicy|ashTableOptions)|N(otification(SuspensionBehavior|Coalescing)|umberFormatter(RoundingMode|Behavior|Style|PadPosition)|etService(sError|Options))|C(haracterCollection|o(lor(RenderingIntent|SpaceModel|PanelMode)|mp(oundPredicateType|arisonPredicateModifier))|ellStateValue|al(culationError|endarUnit))|T(ypesetterControlCharacterAction|imeZoneNameStyle|e(stComparisonOperation|xt(Block(Dimension|V(erticalAlignment|alueType)|Layer)|TableLayoutAlgorithm|FieldBezelStyle))|ableView(SelectionHighlightStyle|ColumnAutoresizingStyle)|rackingAreaOptions)|I(n(sertionPosition|te(rfaceStyle|ger))|mage(RepLoadStatus|Scaling|CacheMode|FrameStyle|LoadStatus|Alignment))|Ope(nGLPixelFormatAttribute|rationQueuePriority)|Date(Picker(Mode|Style)|Formatter(Behavior|Style))|U(RL(RequestCachePolicy|HandleStatus|C(acheStoragePolicy|redentialPersistence))|Integer)|P(o(stingStyle|int(ingDeviceType|erFunctionsOptions)|pUpArrowPosition)|athStyle|r(int(ing(Orientation|PaginationMode)|erTableStatus|PanelOptions)|opertyList(MutabilityOptions|Format)|edicateOperatorType))|ExpressionType|KeyValue(SetMutationKind|Change)|QTMovieLoopMode|F(indPanel(SubstringMatchType|Action)|o(nt(RenderingMode|FamilyClass)|cusRingPlacement))|W(hoseSubelementIdentifier|ind(ingRule|ow(B(utton|ackingLocation)|SharingType|CollectionBehavior)))|L(ine(MovementDirection|SweepDirection|CapStyle|JoinStyle)|evelIndicatorStyle)|Animation(BlockingMode|Curve))\\b", "name": "support.type.cocoa.leopard.objc" }, - { + "anonymous_pattern_23": { "match": "\\bC(I(Sampler|Co(ntext|lor)|Image(Accumulator)?|PlugIn(Registration)?|Vector|Kernel|Filter(Generator|Shape)?)|A(Renderer|MediaTiming(Function)?|BasicAnimation|ScrollLayer|Constraint(LayoutManager)?|T(iledLayer|extLayer|rans(ition|action))|OpenGLLayer|PropertyAnimation|KeyframeAnimation|Layer|A(nimation(Group)?|ction)))\\b", "name": "support.class.quartz.objc" }, - { + "anonymous_pattern_24": { "match": "\\bC(G(Float|Point|Size|Rect)|IFormat|AConstraintAttribute)\\b", "name": "support.type.quartz.objc" }, - { + "anonymous_pattern_25": { "match": "\\bNS(R(ect(Edge)?|ange)|G(lyph(Relation|LayoutMode)?|radientType)|M(odalSession|a(trixMode|p(Table|Enumerator)))|B(itmapImageFileType|orderType|uttonType|ezelStyle|ackingStoreType|rowserColumnResizingType)|S(cr(oll(er(Part|Arrow)|ArrowPosition)|eenAuxiliaryOpaque)|tringEncoding|ize|ocketNativeHandle|election(Granularity|Direction|Affinity)|wapped(Double|Float)|aveOperationType)|Ha(sh(Table|Enumerator)|ndler(2)?)|C(o(ntrol(Size|Tint)|mp(ositingOperation|arisonResult))|ell(State|Type|ImagePosition|Attribute))|T(hreadPrivate|ypesetterGlyphInfo|i(ckMarkPosition|tlePosition|meInterval)|o(ol(TipTag|bar(SizeMode|DisplayMode))|kenStyle)|IFFCompression|ext(TabType|Alignment)|ab(State|leViewDropOperation|ViewType)|rackingRectTag)|ImageInterpolation|Zone|OpenGL(ContextAuxiliary|PixelFormatAuxiliary)|D(ocumentChangeType|atePickerElementFlags|ra(werState|gOperation))|UsableScrollerParts|P(oint|r(intingPageOrder|ogressIndicator(Style|Th(ickness|readInfo))))|EventType|KeyValueObservingOptions|Fo(nt(SymbolicTraits|TraitMask|Action)|cusRingType)|W(indow(OrderingMode|Depth)|orkspace(IconCreationOptions|LaunchOptions)|ritingDirection)|L(ineBreakMode|ayout(Status|Direction))|A(nimation(Progress|Effect)|ppl(ication(TerminateReply|DelegateReply|PrintReply)|eEventManagerSuspensionID)|ffineTransformStruct|lertStyle))\\b", "name": "support.type.cocoa.objc" }, - { + "anonymous_pattern_26": { "match": "\\bNS(NotFound|Ordered(Ascending|Descending|Same))\\b", "name": "support.constant.cocoa.objc" }, - { + "anonymous_pattern_27": { "match": "\\bNS(MenuDidBeginTracking|ViewDidUpdateTrackingAreas)?Notification\\b", "name": "support.constant.notification.cocoa.leopard.objc" }, - { + "anonymous_pattern_28": { "match": "\\bNS(Menu(Did(RemoveItem|SendAction|ChangeItem|EndTracking|AddItem)|WillSendAction)|S(ystemColorsDidChange|plitView(DidResizeSubviews|WillResizeSubviews))|C(o(nt(extHelpModeDid(Deactivate|Activate)|rolT(intDidChange|extDid(BeginEditing|Change|EndEditing)))|lor(PanelColorDidChange|ListDidChange)|mboBox(Selection(IsChanging|DidChange)|Will(Dismiss|PopUp)))|lassDescriptionNeededForClass)|T(oolbar(DidRemoveItem|WillAddItem)|ext(Storage(DidProcessEditing|WillProcessEditing)|Did(BeginEditing|Change|EndEditing)|View(DidChange(Selection|TypingAttributes)|WillChangeNotifyingTextView))|ableView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)))|ImageRepRegistryDidChange|OutlineView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)|Item(Did(Collapse|Expand)|Will(Collapse|Expand)))|Drawer(Did(Close|Open)|Will(Close|Open))|PopUpButton(CellWillPopUp|WillPopUp)|View(GlobalFrameDidChange|BoundsDidChange|F(ocusDidChange|rameDidChange))|FontSetChanged|W(indow(Did(Resi(ze|gn(Main|Key))|M(iniaturize|ove)|Become(Main|Key)|ChangeScreen(|Profile)|Deminiaturize|Update|E(ndSheet|xpose))|Will(M(iniaturize|ove)|BeginSheet|Close))|orkspace(SessionDid(ResignActive|BecomeActive)|Did(Mount|TerminateApplication|Unmount|PerformFileOperation|Wake|LaunchApplication)|Will(Sleep|Unmount|PowerOff|LaunchApplication)))|A(ntialiasThresholdChanged|ppl(ication(Did(ResignActive|BecomeActive|Hide|ChangeScreenParameters|U(nhide|pdate)|FinishLaunching)|Will(ResignActive|BecomeActive|Hide|Terminate|U(nhide|pdate)|FinishLaunching))|eEventManagerWillProcessFirstEvent)))Notification\\b", "name": "support.constant.notification.cocoa.objc" }, - { + "anonymous_pattern_29": { "match": "\\bNS(RuleEditor(RowType(Simple|Compound)|NestingMode(Si(ngle|mple)|Compound|List))|GradientDraws(BeforeStartingLocation|AfterEndingLocation)|M(inusSetExpressionType|a(chPortDeallocate(ReceiveRight|SendRight|None)|pTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality)))|B(oxCustom|undleExecutableArchitecture(X86|I386|PPC(64)?)|etweenPredicateOperatorType|ackgroundStyle(Raised|Dark|L(ight|owered)))|S(tring(DrawingTruncatesLastVisibleLine|EncodingConversion(ExternalRepresentation|AllowLossy))|ubqueryExpressionType|p(e(ech(SentenceBoundary|ImmediateBoundary|WordBoundary)|llingState(GrammarFlag|SpellingFlag))|litViewDividerStyleThi(n|ck))|e(rvice(RequestTimedOutError|M(iscellaneousError|alformedServiceDictionaryError)|InvalidPasteboardDataError|ErrorM(inimum|aximum)|Application(NotFoundError|LaunchFailedError))|gmentStyle(Round(Rect|ed)|SmallSquare|Capsule|Textured(Rounded|Square)|Automatic)))|H(UDWindowMask|ashTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality))|N(oModeColorPanel|etServiceNoAutoRename)|C(hangeRedone|o(ntainsPredicateOperatorType|l(orRenderingIntent(RelativeColorimetric|Saturation|Default|Perceptual|AbsoluteColorimetric)|lectorDisabledOption))|ellHit(None|ContentArea|TrackableArea|EditableTextArea))|T(imeZoneNameStyle(S(hort(Standard|DaylightSaving)|tandard)|DaylightSaving)|extFieldDatePickerStyle|ableViewSelectionHighlightStyle(Regular|SourceList)|racking(Mouse(Moved|EnteredAndExited)|CursorUpdate|InVisibleRect|EnabledDuringMouseDrag|A(ssumeInside|ctive(In(KeyWindow|ActiveApp)|WhenFirstResponder|Always))))|I(n(tersectSetExpressionType|dexedColorSpaceModel)|mageScale(None|Proportionally(Down|UpOrDown)|AxesIndependently))|Ope(nGLPFAAllowOfflineRenderers|rationQueue(DefaultMaxConcurrentOperationCount|Priority(High|Normal|Very(High|Low)|Low)))|D(iacriticInsensitiveSearch|ownloadsDirectory)|U(nionSetExpressionType|TF(16(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)|32(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)))|P(ointerFunctions(Ma(chVirtualMemory|llocMemory)|Str(ongMemory|uctPersonality)|C(StringPersonality|opyIn)|IntegerPersonality|ZeroingWeakMemory|O(paque(Memory|Personality)|bjectP(ointerPersonality|ersonality)))|at(hStyle(Standard|NavigationBar|PopUp)|ternColorSpaceModel)|rintPanelShows(Scaling|Copies|Orientation|P(a(perSize|ge(Range|SetupAccessory))|review)))|Executable(RuntimeMismatchError|NotLoadableError|ErrorM(inimum|aximum)|L(inkError|oadError)|ArchitectureMismatchError)|KeyValueObservingOption(Initial|Prior)|F(i(ndPanelSubstringMatchType(StartsWith|Contains|EndsWith|FullWord)|leRead(TooLargeError|UnknownStringEncodingError))|orcedOrderingSearch)|Wi(ndow(BackingLocation(MainMemory|Default|VideoMemory)|Sharing(Read(Only|Write)|None)|CollectionBehavior(MoveToActiveSpace|CanJoinAllSpaces|Default))|dthInsensitiveSearch)|AggregateExpressionType)\\b", "name": "support.constant.cocoa.leopard.objc" }, - { + "anonymous_pattern_3": { + "begin": "@\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objc" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objc" + } + }, + "name": "string.quoted.double.objc", + "patterns": [ + { + "include": "#string_escaped_char" + }, + { + "match": "(?x)%\n\t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n\t\t\t\t\t\t[#0\\- +']* # flags\n\t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n\t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n\t\t\t\t\t\t[@] # conversion type\n\t\t\t\t\t", + "name": "constant.other.placeholder.objc" + }, + { + "include": "#string_placeholder" + } + ] + }, + "anonymous_pattern_30": { "match": "\\bNS(R(GB(ModeColorPanel|ColorSpaceModel)|ight(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey)|ound(RectBezelStyle|Bankers|ed(BezelStyle|TokenStyle|DisclosureBezelStyle)|Down|Up|Plain|Line(CapStyle|JoinStyle))|un(StoppedResponse|ContinuesResponse|AbortedResponse)|e(s(izableWindowMask|et(CursorRectsRunLoopOrdering|FunctionKey))|ce(ssedBezelStyle|iver(sCantHandleCommandScriptError|EvaluationScriptError))|turnTextMovement|doFunctionKey|quiredArgumentsMissingScriptError|l(evancyLevelIndicatorStyle|ative(Before|After))|gular(SquareBezelStyle|ControlSize)|moveTraitFontAction)|a(n(domSubelement|geDateMode)|tingLevelIndicatorStyle|dio(ModeMatrix|Button)))|G(IFFileType|lyph(Below|Inscribe(B(elow|ase)|Over(strike|Below)|Above)|Layout(WithPrevious|A(tAPoint|gainstAPoint))|A(ttribute(BidiLevel|Soft|Inscribe|Elastic)|bove))|r(ooveBorder|eaterThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|a(y(ModeColorPanel|ColorSpaceModel)|dient(None|Con(cave(Strong|Weak)|vex(Strong|Weak)))|phiteControlTint)))|XML(N(o(tationDeclarationKind|de(CompactEmptyElement|IsCDATA|OptionsNone|Use(SingleQuotes|DoubleQuotes)|Pre(serve(NamespaceOrder|C(haracterReferences|DATA)|DTD|Prefixes|E(ntities|mptyElements)|Quotes|Whitespace|A(ttributeOrder|ll))|ttyPrint)|ExpandEmptyElement))|amespaceKind)|CommentKind|TextKind|InvalidKind|D(ocument(X(MLKind|HTMLKind|Include)|HTMLKind|T(idy(XML|HTML)|extKind)|IncludeContentTypeDeclaration|Validate|Kind)|TDKind)|P(arser(GTRequiredError|XMLDeclNot(StartedError|FinishedError)|Mi(splaced(XMLDeclarationError|CDATAEndStringError)|xedContentDeclNot(StartedError|FinishedError))|S(t(andaloneValueError|ringNot(StartedError|ClosedError))|paceRequiredError|eparatorRequiredError)|N(MTOKENRequiredError|o(t(ationNot(StartedError|FinishedError)|WellBalancedError)|DTDError)|amespaceDeclarationError|AMERequiredError)|C(haracterRef(In(DTDError|PrologError|EpilogError)|AtEOFError)|o(nditionalSectionNot(StartedError|FinishedError)|mment(NotFinishedError|ContainsDoubleHyphenError))|DATANotFinishedError)|TagNameMismatchError|In(ternalError|valid(HexCharacterRefError|C(haracter(RefError|InEntityError|Error)|onditionalSectionError)|DecimalCharacterRefError|URIError|Encoding(NameError|Error)))|OutOfMemoryError|D(ocumentStartError|elegateAbortedParseError|OCTYPEDeclNotFinishedError)|U(RI(RequiredError|FragmentError)|n(declaredEntityError|parsedEntityError|knownEncodingError|finishedTagError))|P(CDATARequiredError|ublicIdentifierRequiredError|arsedEntityRef(MissingSemiError|NoNameError|In(Internal(SubsetError|Error)|PrologError|EpilogError)|AtEOFError)|r(ocessingInstructionNot(StartedError|FinishedError)|ematureDocumentEndError))|E(n(codingNotSupportedError|tity(Ref(In(DTDError|PrologError|EpilogError)|erence(MissingSemiError|WithoutNameError)|LoopError|AtEOFError)|BoundaryError|Not(StartedError|FinishedError)|Is(ParameterError|ExternalError)|ValueRequiredError))|qualExpectedError|lementContentDeclNot(StartedError|FinishedError)|xt(ernalS(tandaloneEntityError|ubsetNotFinishedError)|raContentError)|mptyDocumentError)|L(iteralNot(StartedError|FinishedError)|T(RequiredError|SlashRequiredError)|essThanSymbolInAttributeError)|Attribute(RedefinedError|HasNoValueError|Not(StartedError|FinishedError)|ListNot(StartedError|FinishedError)))|rocessingInstructionKind)|E(ntity(GeneralKind|DeclarationKind|UnparsedKind|P(ar(sedKind|ameterKind)|redefined))|lement(Declaration(MixedKind|UndefinedKind|E(lementKind|mptyKind)|Kind|AnyKind)|Kind))|Attribute(N(MToken(sKind|Kind)|otationKind)|CDATAKind|ID(Ref(sKind|Kind)|Kind)|DeclarationKind|En(tit(yKind|iesKind)|umerationKind)|Kind))|M(i(n(XEdge|iaturizableWindowMask|YEdge|uteCalendarUnit)|terLineJoinStyle|ddleSubelement|xedState)|o(nthCalendarUnit|deSwitchFunctionKey|use(Moved(Mask)?|E(ntered(Mask)?|ventSubtype|xited(Mask)?))|veToBezierPathElement|mentary(ChangeButton|Push(Button|InButton)|Light(Button)?))|enuFunctionKey|a(c(intoshInterfaceStyle|OSRomanStringEncoding)|tchesPredicateOperatorType|ppedRead|x(XEdge|YEdge))|ACHOperatingSystem)|B(MPFileType|o(ttomTabsBezelBorder|ldFontMask|rderlessWindowMask|x(Se(condary|parator)|OldStyle|Primary))|uttLineCapStyle|e(zelBorder|velLineJoinStyle|low(Bottom|Top)|gin(sWith(Comparison|PredicateOperatorType)|FunctionKey))|lueControlTint|ack(spaceCharacter|tabTextMovement|ingStore(Retained|Buffered|Nonretained)|TabCharacter|wardsSearch|groundTab)|r(owser(NoColumnResizing|UserColumnResizing|AutoColumnResizing)|eakFunctionKey))|S(h(ift(JISStringEncoding|KeyMask)|ow(ControlGlyphs|InvisibleGlyphs)|adowlessSquareBezelStyle)|y(s(ReqFunctionKey|tem(D(omainMask|efined(Mask)?)|FunctionKey))|mbolStringEncoding)|c(a(nnedOption|le(None|ToFit|Proportionally))|r(oll(er(NoPart|Increment(Page|Line|Arrow)|Decrement(Page|Line|Arrow)|Knob(Slot)?|Arrows(M(inEnd|axEnd)|None|DefaultSetting))|Wheel(Mask)?|LockFunctionKey)|eenChangedEventType))|t(opFunctionKey|r(ingDrawing(OneShot|DisableScreenFontSubstitution|Uses(DeviceMetrics|FontLeading|LineFragmentOrigin))|eam(Status(Reading|NotOpen|Closed|Open(ing)?|Error|Writing|AtEnd)|Event(Has(BytesAvailable|SpaceAvailable)|None|OpenCompleted|E(ndEncountered|rrorOccurred)))))|i(ngle(DateMode|UnderlineStyle)|ze(DownFontAction|UpFontAction))|olarisOperatingSystem|unOSOperatingSystem|pecialPageOrder|e(condCalendarUnit|lect(By(Character|Paragraph|Word)|i(ng(Next|Previous)|onAffinity(Downstream|Upstream))|edTab|FunctionKey)|gmentSwitchTracking(Momentary|Select(One|Any)))|quareLineCapStyle|witchButton|ave(ToOperation|Op(tions(Yes|No|Ask)|eration)|AsOperation)|mall(SquareBezelStyle|C(ontrolSize|apsFontMask)|IconButtonBezelStyle))|H(ighlightModeMatrix|SBModeColorPanel|o(ur(Minute(SecondDatePickerElementFlag|DatePickerElementFlag)|CalendarUnit)|rizontalRuler|meFunctionKey)|TTPCookieAcceptPolicy(Never|OnlyFromMainDocumentDomain|Always)|e(lp(ButtonBezelStyle|KeyMask|FunctionKey)|avierFontAction)|PUXOperatingSystem)|Year(MonthDa(yDatePickerElementFlag|tePickerElementFlag)|CalendarUnit)|N(o(n(StandardCharacterSetFontMask|ZeroWindingRule|activatingPanelMask|LossyASCIIStringEncoding)|Border|t(ification(SuspensionBehavior(Hold|Coalesce|D(eliverImmediately|rop))|NoCoalescing|CoalescingOn(Sender|Name)|DeliverImmediately|PostToAllSessions)|PredicateType|EqualToPredicateOperatorType)|S(cr(iptError|ollerParts)|ubelement|pecifierError)|CellMask|T(itle|opLevelContainersSpecifierError|abs(BezelBorder|NoBorder|LineBorder))|I(nterfaceStyle|mage)|UnderlineStyle|FontChangeAction)|u(ll(Glyph|CellType)|m(eric(Search|PadKeyMask)|berFormatter(Round(Half(Down|Up|Even)|Ceiling|Down|Up|Floor)|Behavior(10|Default)|S(cientificStyle|pellOutStyle)|NoStyle|CurrencyStyle|DecimalStyle|P(ercentStyle|ad(Before(Suffix|Prefix)|After(Suffix|Prefix))))))|e(t(Services(BadArgumentError|NotFoundError|C(ollisionError|ancelledError)|TimeoutError|InvalidError|UnknownError|ActivityInProgress)|workDomainMask)|wlineCharacter|xt(StepInterfaceStyle|FunctionKey))|EXTSTEPStringEncoding|a(t(iveShortGlyphPacking|uralTextAlignment)|rrowFontMask))|C(hange(ReadOtherContents|GrayCell(Mask)?|BackgroundCell(Mask)?|Cleared|Done|Undone|Autosaved)|MYK(ModeColorPanel|ColorSpaceModel)|ircular(BezelStyle|Slider)|o(n(stantValueExpressionType|t(inuousCapacityLevelIndicatorStyle|entsCellMask|ain(sComparison|erSpecifierError)|rol(Glyph|KeyMask))|densedFontMask)|lor(Panel(RGBModeMask|GrayModeMask|HSBModeMask|C(MYKModeMask|olorListModeMask|ustomPaletteModeMask|rayonModeMask)|WheelModeMask|AllModesMask)|ListModeColorPanel)|reServiceDirectory|m(p(osite(XOR|Source(In|O(ut|ver)|Atop)|Highlight|C(opy|lear)|Destination(In|O(ut|ver)|Atop)|Plus(Darker|Lighter))|ressedFontMask)|mandKeyMask))|u(stom(SelectorPredicateOperatorType|PaletteModeColorPanel)|r(sor(Update(Mask)?|PointingDevice)|veToBezierPathElement))|e(nterT(extAlignment|abStopType)|ll(State|H(ighlighted|as(Image(Horizontal|OnLeftOrBottom)|OverlappingImage))|ChangesContents|Is(Bordered|InsetButton)|Disabled|Editable|LightsBy(Gray|Background|Contents)|AllowsMixedState))|l(ipPagination|o(s(ePathBezierPathElement|ableWindowMask)|ckAndCalendarDatePickerStyle)|ear(ControlTint|DisplayFunctionKey|LineFunctionKey))|a(seInsensitive(Search|PredicateOption)|n(notCreateScriptCommandError|cel(Button|TextMovement))|chesDirectory|lculation(NoError|Overflow|DivideByZero|Underflow|LossOfPrecision)|rriageReturnCharacter)|r(itical(Request|AlertStyle)|ayonModeColorPanel))|T(hick(SquareBezelStyle|erSquareBezelStyle)|ypesetter(Behavior|HorizontalTabAction|ContainerBreakAction|ZeroAdvancementAction|OriginalBehavior|ParagraphBreakAction|WhitespaceAction|L(ineBreakAction|atestBehavior))|i(ckMark(Right|Below|Left|Above)|tledWindowMask|meZoneDatePickerElementFlag)|o(olbarItemVisibilityPriority(Standard|High|User|Low)|pTabsBezelBorder|ggleButton)|IFF(Compression(N(one|EXT)|CCITTFAX(3|4)|OldJPEG|JPEG|PackBits|LZW)|FileType)|e(rminate(Now|Cancel|Later)|xt(Read(InapplicableDocumentTypeError|WriteErrorM(inimum|aximum))|Block(M(i(nimum(Height|Width)|ddleAlignment)|a(rgin|ximum(Height|Width)))|B(o(ttomAlignment|rder)|aselineAlignment)|Height|TopAlignment|P(ercentageValueType|adding)|Width|AbsoluteValueType)|StorageEdited(Characters|Attributes)|CellType|ured(RoundedBezelStyle|BackgroundWindowMask|SquareBezelStyle)|Table(FixedLayoutAlgorithm|AutomaticLayoutAlgorithm)|Field(RoundedBezel|SquareBezel|AndStepperDatePickerStyle)|WriteInapplicableDocumentTypeError|ListPrependEnclosingMarker))|woByteGlyphPacking|ab(Character|TextMovement|le(tP(oint(Mask|EventSubtype)?|roximity(Mask|EventSubtype)?)|Column(NoResizing|UserResizingMask|AutoresizingMask)|View(ReverseSequentialColumnAutoresizingStyle|GridNone|S(olid(HorizontalGridLineMask|VerticalGridLineMask)|equentialColumnAutoresizingStyle)|NoColumnAutoresizing|UniformColumnAutoresizingStyle|FirstColumnOnlyAutoresizingStyle|LastColumnOnlyAutoresizingStyle)))|rackModeMatrix)|I(n(sert(CharFunctionKey|FunctionKey|LineFunctionKey)|t(Type|ernalS(criptError|pecifierError))|dexSubelement|validIndexSpecifierError|formational(Request|AlertStyle)|PredicateOperatorType)|talicFontMask|SO(2022JPStringEncoding|Latin(1StringEncoding|2StringEncoding))|dentityMappingCharacterCollection|llegalTextMovement|mage(R(ight|ep(MatchesDevice|LoadStatus(ReadingHeader|Completed|InvalidData|Un(expectedEOF|knownType)|WillNeedAllData)))|Below|C(ellType|ache(BySize|Never|Default|Always))|Interpolation(High|None|Default|Low)|O(nly|verlaps)|Frame(Gr(oove|ayBezel)|Button|None|Photo)|L(oadStatus(ReadError|C(ompleted|ancelled)|InvalidData|UnexpectedEOF)|eft)|A(lign(Right|Bottom(Right|Left)?|Center|Top(Right|Left)?|Left)|bove)))|O(n(State|eByteGlyphPacking|OffButton|lyScrollerArrows)|ther(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|TextMovement)|SF1OperatingSystem|pe(n(GL(GO(Re(setLibrary|tainRenderers)|ClearFormatCache|FormatCacheSize)|PFA(R(obust|endererID)|M(inimumPolicy|ulti(sample|Screen)|PSafe|aximumPolicy)|BackingStore|S(creenMask|te(ncilSize|reo)|ingleRenderer|upersample|ample(s|Buffers|Alpha))|NoRecovery|C(o(lor(Size|Float)|mpliant)|losestPolicy)|OffScreen|D(oubleBuffer|epthSize)|PixelBuffer|VirtualScreenCount|FullScreen|Window|A(cc(umSize|elerated)|ux(Buffers|DepthStencil)|l(phaSize|lRenderers))))|StepUnicodeReservedBase)|rationNotSupportedForKeyS(criptError|pecifierError))|ffState|KButton|rPredicateType|bjC(B(itfield|oolType)|S(hortType|tr(ingType|uctType)|electorType)|NoType|CharType|ObjectType|DoubleType|UnionType|PointerType|VoidType|FloatType|Long(Type|longType)|ArrayType))|D(i(s(c(losureBezelStyle|reteCapacityLevelIndicatorStyle)|playWindowRunLoopOrdering)|acriticInsensitivePredicateOption|rect(Selection|PredicateModifier))|o(c(ModalWindowMask|ument(Directory|ationDirectory))|ubleType|wn(TextMovement|ArrowFunctionKey))|e(s(cendingPageOrder|ktopDirectory)|cimalTabStopType|v(ice(NColorSpaceModel|IndependentModifierFlagsMask)|eloper(Directory|ApplicationDirectory))|fault(ControlTint|TokenStyle)|lete(Char(acter|FunctionKey)|FunctionKey|LineFunctionKey)|moApplicationDirectory)|a(yCalendarUnit|teFormatter(MediumStyle|Behavior(10|Default)|ShortStyle|NoStyle|FullStyle|LongStyle))|ra(wer(Clos(ingState|edState)|Open(ingState|State))|gOperation(Generic|Move|None|Copy|Delete|Private|Every|Link|All)))|U(ser(CancelledError|D(irectory|omainMask)|FunctionKey)|RL(Handle(NotLoaded|Load(Succeeded|InProgress|Failed))|CredentialPersistence(None|Permanent|ForSession))|n(scaledWindowMask|cachedRead|i(codeStringEncoding|talicFontMask|fiedTitleAndToolbarWindowMask)|d(o(CloseGroupingRunLoopOrdering|FunctionKey)|e(finedDateComponent|rline(Style(Single|None|Thick|Double)|Pattern(Solid|D(ot|ash(Dot(Dot)?)?)))))|known(ColorSpaceModel|P(ointingDevice|ageOrder)|KeyS(criptError|pecifierError))|boldFontMask)|tilityWindowMask|TF8StringEncoding|p(dateWindowsRunLoopOrdering|TextMovement|ArrowFunctionKey))|J(ustifiedTextAlignment|PEG(2000FileType|FileType)|apaneseEUC(GlyphPacking|StringEncoding))|P(o(s(t(Now|erFontMask|WhenIdle|ASAP)|iti(on(Replace|Be(fore|ginning)|End|After)|ve(IntType|DoubleType|FloatType)))|pUp(NoArrow|ArrowAt(Bottom|Center))|werOffEventType|rtraitOrientation)|NGFileType|ush(InCell(Mask)?|OnPushOffButton)|e(n(TipMask|UpperSideMask|PointingDevice|LowerSideMask)|riodic(Mask)?)|P(S(caleField|tatus(Title|Field)|aveButton)|N(ote(Title|Field)|ame(Title|Field))|CopiesField|TitleField|ImageButton|OptionsButton|P(a(perFeedButton|ge(Range(To|From)|ChoiceMatrix))|reviewButton)|LayoutButton)|lainTextTokenStyle|a(useFunctionKey|ragraphSeparatorCharacter|ge(DownFunctionKey|UpFunctionKey))|r(int(ing(ReplyLater|Success|Cancelled|Failure)|ScreenFunctionKey|erTable(NotFound|OK|Error)|FunctionKey)|o(p(ertyList(XMLFormat|MutableContainers(AndLeaves)?|BinaryFormat|Immutable|OpenStepFormat)|rietaryStringEncoding)|gressIndicator(BarStyle|SpinningStyle|Preferred(SmallThickness|Thickness|LargeThickness|AquaThickness)))|e(ssedTab|vFunctionKey))|L(HeightForm|CancelButton|TitleField|ImageButton|O(KButton|rientationMatrix)|UnitsButton|PaperNameButton|WidthForm))|E(n(terCharacter|d(sWith(Comparison|PredicateOperatorType)|FunctionKey))|v(e(nOddWindingRule|rySubelement)|aluatedObjectExpressionType)|qualTo(Comparison|PredicateOperatorType)|ra(serPointingDevice|CalendarUnit|DatePickerElementFlag)|x(clude(10|QuickDrawElementsIconCreationOption)|pandedFontMask|ecuteFunctionKey))|V(i(ew(M(in(XMargin|YMargin)|ax(XMargin|YMargin))|HeightSizable|NotSizable|WidthSizable)|aPanelFontAction)|erticalRuler|a(lidationErrorM(inimum|aximum)|riableExpressionType))|Key(SpecifierEvaluationScriptError|Down(Mask)?|Up(Mask)?|PathExpressionType|Value(MinusSetMutation|SetSetMutation|Change(Re(placement|moval)|Setting|Insertion)|IntersectSetMutation|ObservingOption(New|Old)|UnionSetMutation|ValidationError))|QTMovie(NormalPlayback|Looping(BackAndForthPlayback|Playback))|F(1(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|7FunctionKey|i(nd(PanelAction(Replace(A(ndFind|ll(InSelection)?))?|S(howFindPanel|e(tFindString|lectAll(InSelection)?))|Next|Previous)|FunctionKey)|tPagination|le(Read(No(SuchFileError|PermissionError)|CorruptFileError|In(validFileNameError|applicableStringEncodingError)|Un(supportedSchemeError|knownError))|HandlingPanel(CancelButton|OKButton)|NoSuchFileError|ErrorM(inimum|aximum)|Write(NoPermissionError|In(validFileNameError|applicableStringEncodingError)|OutOfSpaceError|Un(supportedSchemeError|knownError))|LockingError)|xedPitchFontMask)|2(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|o(nt(Mo(noSpaceTrait|dernSerifsClass)|BoldTrait|S(ymbolicClass|criptsClass|labSerifsClass|ansSerifClass)|C(o(ndensedTrait|llectionApplicationOnlyMask)|larendonSerifsClass)|TransitionalSerifsClass|I(ntegerAdvancementsRenderingMode|talicTrait)|O(ldStyleSerifsClass|rnamentalsClass)|DefaultRenderingMode|U(nknownClass|IOptimizedTrait)|Panel(S(hadowEffectModeMask|t(andardModesMask|rikethroughEffectModeMask)|izeModeMask)|CollectionModeMask|TextColorEffectModeMask|DocumentColorEffectModeMask|UnderlineEffectModeMask|FaceModeMask|All(ModesMask|EffectsModeMask))|ExpandedTrait|VerticalTrait|F(amilyClassMask|reeformSerifsClass)|Antialiased(RenderingMode|IntegerAdvancementsRenderingMode))|cusRing(Below|Type(None|Default|Exterior)|Only|Above)|urByteGlyphPacking|rm(attingError(M(inimum|aximum))?|FeedCharacter))|8FunctionKey|unction(ExpressionType|KeyMask)|3(1FunctionKey|2FunctionKey|3FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey)|9FunctionKey|4FunctionKey|P(RevertButton|S(ize(Title|Field)|etButton)|CurrentField|Preview(Button|Field))|l(oat(ingPointSamplesBitmapFormat|Type)|agsChanged(Mask)?)|axButton|5FunctionKey|6FunctionKey)|W(heelModeColorPanel|indow(s(NTOperatingSystem|CP125(1StringEncoding|2StringEncoding|3StringEncoding|4StringEncoding|0StringEncoding)|95(InterfaceStyle|OperatingSystem))|M(iniaturizeButton|ovedEventType)|Below|CloseButton|ToolbarButton|ZoomButton|Out|DocumentIconButton|ExposedEventType|Above)|orkspaceLaunch(NewInstance|InhibitingBackgroundOnly|Default|PreferringClassic|WithoutA(ctivation|ddingToRecents)|A(sync|nd(Hide(Others)?|Print)|llowingClassicStartup))|eek(day(CalendarUnit|OrdinalCalendarUnit)|CalendarUnit)|a(ntsBidiLevels|rningAlertStyle)|r(itingDirection(RightToLeft|Natural|LeftToRight)|apCalendarComponents))|L(i(stModeMatrix|ne(Moves(Right|Down|Up|Left)|B(order|reakBy(C(harWrapping|lipping)|Truncating(Middle|Head|Tail)|WordWrapping))|S(eparatorCharacter|weep(Right|Down|Up|Left))|ToBezierPathElement|DoesntMove|arSlider)|teralSearch|kePredicateOperatorType|ghterFontAction|braryDirectory)|ocalDomainMask|e(ssThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|ft(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey))|a(yout(RightToLeft|NotDone|CantFit|OutOfGlyphs|Done|LeftToRight)|ndscapeOrientation)|ABColorSpaceModel)|A(sc(iiWithDoubleByteEUCGlyphPacking|endingPageOrder)|n(y(Type|PredicateModifier|EventMask)|choredSearch|imation(Blocking|Nonblocking(Threaded)?|E(ffect(DisappearingItemDefault|Poof)|ase(In(Out)?|Out))|Linear)|dPredicateType)|t(Bottom|tachmentCharacter|omicWrite|Top)|SCIIStringEncoding|d(obe(GB1CharacterCollection|CNS1CharacterCollection|Japan(1CharacterCollection|2CharacterCollection)|Korea1CharacterCollection)|dTraitFontAction|minApplicationDirectory)|uto(saveOperation|Pagination)|pp(lication(SupportDirectory|D(irectory|e(fined(Mask)?|legateReply(Success|Cancel|Failure)|activatedEventType))|ActivatedEventType)|KitDefined(Mask)?)|l(ternateKeyMask|pha(ShiftKeyMask|NonpremultipliedBitmapFormat|FirstBitmapFormat)|ert(SecondButtonReturn|ThirdButtonReturn|OtherReturn|DefaultReturn|ErrorReturn|FirstButtonReturn|AlternateReturn)|l(ScrollerParts|DomainsMask|PredicateModifier|LibrariesDirectory|ApplicationsDirectory))|rgument(sWrongScriptError|EvaluationScriptError)|bove(Bottom|Top)|WTEventType))\\b", "name": "support.constant.cocoa.objc" }, - { - "include": "#bracketed_content" + "anonymous_pattern_4": { + "begin": "\\b(id)\\s*(?=<)", + "beginCaptures": { + "1": { + "name": "storage.type.objc" + } + }, + "end": "(?<=>)", + "name": "meta.id-with-protocol.objc", + "patterns": [ + { + "include": "#protocol_list" + } + ] + }, + "anonymous_pattern_5": { + "match": "\\b(NS_DURING|NS_HANDLER|NS_ENDHANDLER)\\b", + "name": "keyword.control.macro.objc" + }, + "anonymous_pattern_7": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(try|catch|finally|throw)\\b", + "name": "keyword.control.exception.objc" + }, + "anonymous_pattern_8": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(synchronized)\\b", + "name": "keyword.control.synchronize.objc" + }, + "anonymous_pattern_9": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objc" + } + }, + "match": "(@)(required|optional)\\b", + "name": "keyword.control.protocol-specification.objc" + }, + "apple_foundation_functional_macros": { + "begin": "(\\b(?:API_AVAILABLE|API_DEPRECATED|API_UNAVAILABLE|NS_AVAILABLE|NS_AVAILABLE_MAC|NS_AVAILABLE_IOS|NS_DEPRECATED|NS_DEPRECATED_MAC|NS_DEPRECATED_IOS|NS_SWIFT_NAME))(?:(?:\\s)+)?(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "entity.name.function.preprocessor.apple-foundation.objc" + }, + "2": { + "name": "punctuation.section.macro.arguments.begin.bracket.round.apple-foundation.objc" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.macro.arguments.end.bracket.round.apple-foundation.objc" + } + }, + "name": "meta.preprocessor.macro.callable.apple-foundation.objc", + "patterns": [ + { + "include": "#c_lang" + } + ] }, - { - "include": "#c_lang" - } - ], - "repository": { "bracketed_content": { "begin": "\\[", "beginCaptures": { @@ -2721,7 +2834,15 @@ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t))[a-zA-Z_]\\w*\\b(?!\\())", "captures": { "1": { - "name": "variable.other.object.access.objc" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objc" @@ -2741,7 +2862,15 @@ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", "captures": { "1": { - "name": "variable.other.object.access.objc" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objc" @@ -2763,7 +2892,15 @@ "begin": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()", "beginCaptures": { "1": { - "name": "variable.other.object.access.objc" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objc" @@ -2783,7 +2920,15 @@ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", "captures": { "1": { - "name": "variable.other.object.access.objc" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objc", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objc" diff --git a/apps/web/public/assets/shiki/languages/objective-cpp.tmLanguage.json b/apps/web/public/assets/shiki/languages/objective-cpp.tmLanguage.json index fea07cdb..4471b8d7 100644 --- a/apps/web/public/assets/shiki/languages/objective-cpp.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/objective-cpp.tmLanguage.json @@ -1,10 +1,10 @@ { "information_for_contributors": [ - "This file has been converted from https://github.com/jeff-hykin/cpp-textmate-grammar/blob/master/syntaxes/objcpp.tmLanguage.json", + "This file has been converted from https://github.com/jeff-hykin/better-objcpp-syntax/blob/master/autogenerated/objcpp.tmLanguage.json", "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/jeff-hykin/cpp-textmate-grammar/commit/0ef79f098ed80ce5a86be4ed40f99ebcdbac4895", + "version": "https://github.com/jeff-hykin/better-objcpp-syntax/commit/5a7eb15eee382dd5aa388bc04fdb60a0d2128e14", "name": "objective-cpp", "scopeName": "source.objcpp", "patterns": [ @@ -12,6 +12,104 @@ "include": "#cpp_lang" }, { + "include": "#anonymous_pattern_1" + }, + { + "include": "#anonymous_pattern_2" + }, + { + "include": "#anonymous_pattern_3" + }, + { + "include": "#anonymous_pattern_4" + }, + { + "include": "#anonymous_pattern_5" + }, + { + "include": "#apple_foundation_functional_macros" + }, + { + "include": "#anonymous_pattern_7" + }, + { + "include": "#anonymous_pattern_8" + }, + { + "include": "#anonymous_pattern_9" + }, + { + "include": "#anonymous_pattern_10" + }, + { + "include": "#anonymous_pattern_11" + }, + { + "include": "#anonymous_pattern_12" + }, + { + "include": "#anonymous_pattern_13" + }, + { + "include": "#anonymous_pattern_14" + }, + { + "include": "#anonymous_pattern_15" + }, + { + "include": "#anonymous_pattern_16" + }, + { + "include": "#anonymous_pattern_17" + }, + { + "include": "#anonymous_pattern_18" + }, + { + "include": "#anonymous_pattern_19" + }, + { + "include": "#anonymous_pattern_20" + }, + { + "include": "#anonymous_pattern_21" + }, + { + "include": "#anonymous_pattern_22" + }, + { + "include": "#anonymous_pattern_23" + }, + { + "include": "#anonymous_pattern_24" + }, + { + "include": "#anonymous_pattern_25" + }, + { + "include": "#anonymous_pattern_26" + }, + { + "include": "#anonymous_pattern_27" + }, + { + "include": "#anonymous_pattern_28" + }, + { + "include": "#anonymous_pattern_29" + }, + { + "include": "#anonymous_pattern_30" + }, + { + "include": "#bracketed_content" + }, + { + "include": "#c_lang" + } + ], + "repository": { + "anonymous_pattern_1": { "begin": "((@)(interface|protocol))(?!.+;)\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*((:)(?:\\s*)([A-Za-z][A-Za-z0-9]*))?(\\s|\\n)?", "captures": { "1": { @@ -45,105 +143,7 @@ } ] }, - { - "begin": "((@)(implementation))\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*(?::\\s*([A-Za-z][A-Za-z0-9]*))?", - "captures": { - "1": { - "name": "storage.type.objcpp" - }, - "2": { - "name": "punctuation.definition.storage.type.objcpp" - }, - "4": { - "name": "entity.name.type.objcpp" - }, - "5": { - "name": "entity.other.inherited-class.objcpp" - } - }, - "contentName": "meta.scope.implementation.objcpp", - "end": "((@)end)\\b", - "name": "meta.implementation.objcpp", - "patterns": [ - { - "include": "#implementation_innards" - } - ] - }, - { - "begin": "@\"", - "beginCaptures": { - "0": { - "name": "punctuation.definition.string.begin.objcpp" - } - }, - "end": "\"", - "endCaptures": { - "0": { - "name": "punctuation.definition.string.end.objcpp" - } - }, - "name": "string.quoted.double.objcpp", - "patterns": [ - { - "include": "#string_escaped_char" - }, - { - "match": "(?x)%\n\t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n\t\t\t\t\t\t[#0\\- +']* # flags\n\t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n\t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n\t\t\t\t\t\t[@] # conversion type\n\t\t\t\t\t", - "name": "constant.other.placeholder.objcpp" - }, - { - "include": "#string_placeholder" - } - ] - }, - { - "begin": "\\b(id)\\s*(?=<)", - "beginCaptures": { - "1": { - "name": "storage.type.objcpp" - } - }, - "end": "(?<=>)", - "name": "meta.id-with-protocol.objcpp", - "patterns": [ - { - "include": "#protocol_list" - } - ] - }, - { - "match": "\\b(NS_DURING|NS_HANDLER|NS_ENDHANDLER)\\b", - "name": "keyword.control.macro.objcpp" - }, - { - "captures": { - "1": { - "name": "punctuation.definition.keyword.objcpp" - } - }, - "match": "(@)(try|catch|finally|throw)\\b", - "name": "keyword.control.exception.objcpp" - }, - { - "captures": { - "1": { - "name": "punctuation.definition.keyword.objcpp" - } - }, - "match": "(@)(synchronized)\\b", - "name": "keyword.control.synchronize.objcpp" - }, - { - "captures": { - "1": { - "name": "punctuation.definition.keyword.objcpp" - } - }, - "match": "(@)(required|optional)\\b", - "name": "keyword.control.protocol-specification.objcpp" - }, - { + "anonymous_pattern_10": { "captures": { "1": { "name": "punctuation.definition.keyword.objcpp" @@ -152,15 +152,15 @@ "match": "(@)(defs|encode)\\b", "name": "keyword.other.objcpp" }, - { + "anonymous_pattern_11": { "match": "\\bid\\b", "name": "storage.type.id.objcpp" }, - { + "anonymous_pattern_12": { "match": "\\b(IBOutlet|IBAction|BOOL|SEL|id|unichar|IMP|Class|instancetype)\\b", "name": "storage.type.objcpp" }, - { + "anonymous_pattern_13": { "captures": { "1": { "name": "punctuation.definition.storage.type.objcpp" @@ -169,7 +169,7 @@ "match": "(@)(class|protocol)\\b", "name": "storage.type.objcpp" }, - { + "anonymous_pattern_14": { "begin": "((@)selector)\\s*(\\()", "beginCaptures": { "1": { @@ -202,7 +202,7 @@ } ] }, - { + "anonymous_pattern_15": { "captures": { "1": { "name": "punctuation.definition.storage.modifier.objcpp" @@ -211,15 +211,15 @@ "match": "(@)(synchronized|public|package|private|protected)\\b", "name": "storage.modifier.objcpp" }, - { + "anonymous_pattern_16": { "match": "\\b(YES|NO|Nil|nil)\\b", "name": "constant.language.objcpp" }, - { + "anonymous_pattern_17": { "match": "\\bNSApp\\b", "name": "support.variable.foundation.objcpp" }, - { + "anonymous_pattern_18": { "captures": { "1": { "name": "punctuation.whitespace.support.function.cocoa.leopard.objcpp" @@ -230,7 +230,7 @@ }, "match": "(\\s*)\\b(NS(Rect(ToCGRect|FromCGRect)|MakeCollectable|S(tringFromProtocol|ize(ToCGSize|FromCGSize))|Draw(NinePartImage|ThreePartImage)|P(oint(ToCGPoint|FromCGPoint)|rotocolFromString)|EventMaskFromType|Value))\\b" }, - { + "anonymous_pattern_19": { "captures": { "1": { "name": "punctuation.whitespace.support.function.leading.cocoa.objcpp" @@ -241,58 +241,171 @@ }, "match": "(\\s*)\\b(NS(R(ound(DownToMultipleOfPageSize|UpToMultipleOfPageSize)|un(CriticalAlertPanel(RelativeToWindow)?|InformationalAlertPanel(RelativeToWindow)?|AlertPanel(RelativeToWindow)?)|e(set(MapTable|HashTable)|c(ycleZone|t(Clip(List)?|F(ill(UsingOperation|List(UsingOperation|With(Grays|Colors(UsingOperation)?))?)?|romString))|ordAllocationEvent)|turnAddress|leaseAlertPanel|a(dPixel|l(MemoryAvailable|locateCollectable))|gisterServicesProvider)|angeFromString)|Get(SizeAndAlignment|CriticalAlertPanel|InformationalAlertPanel|UncaughtExceptionHandler|FileType(s)?|WindowServerMemory|AlertPanel)|M(i(n(X|Y)|d(X|Y))|ouseInRect|a(p(Remove|Get|Member|Insert(IfAbsent|KnownAbsent)?)|ke(R(ect|ange)|Size|Point)|x(Range|X|Y)))|B(itsPer(SampleFromDepth|PixelFromDepth)|e(stDepth|ep|gin(CriticalAlertSheet|InformationalAlertSheet|AlertSheet)))|S(ho(uldRetainWithZone|w(sServicesMenuItem|AnimationEffect))|tringFrom(R(ect|ange)|MapTable|S(ize|elector)|HashTable|Class|Point)|izeFromString|e(t(ShowsServicesMenuItem|ZoneName|UncaughtExceptionHandler|FocusRingStyle)|lectorFromString|archPathForDirectoriesInDomains)|wap(Big(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|Short|Host(ShortTo(Big|Little)|IntTo(Big|Little)|DoubleTo(Big|Little)|FloatTo(Big|Little)|Long(To(Big|Little)|LongTo(Big|Little)))|Int|Double|Float|L(ittle(ShortToHost|IntToHost|DoubleToHost|FloatToHost|Long(ToHost|LongToHost))|ong(Long)?)))|H(ighlightRect|o(stByteOrder|meDirectory(ForUser)?)|eight|ash(Remove|Get|Insert(IfAbsent|KnownAbsent)?)|FSType(CodeFromFileType|OfFile))|N(umberOfColorComponents|ext(MapEnumeratorPair|HashEnumeratorItem))|C(o(n(tainsRect|vert(GlyphsToPackedGlyphs|Swapped(DoubleToHost|FloatToHost)|Host(DoubleToSwapped|FloatToSwapped)))|unt(MapTable|HashTable|Frames|Windows(ForContext)?)|py(M(emoryPages|apTableWithZone)|Bits|HashTableWithZone|Object)|lorSpaceFromDepth|mpare(MapTables|HashTables))|lassFromString|reate(MapTable(WithZone)?|HashTable(WithZone)?|Zone|File(namePboardType|ContentsPboardType)))|TemporaryDirectory|I(s(ControllerMarker|EmptyRect|FreedObject)|n(setRect|crementExtraRefCount|te(r(sect(sRect|ionR(ect|ange))|faceStyleForKey)|gralRect)))|Zone(Realloc|Malloc|Name|Calloc|Fr(omPointer|ee))|O(penStepRootDirectory|ffsetRect)|D(i(sableScreenUpdates|videRect)|ottedFrameRect|e(c(imal(Round|Multiply|S(tring|ubtract)|Normalize|Co(py|mpa(ct|re))|IsNotANumber|Divide|Power|Add)|rementExtraRefCountWasZero)|faultMallocZone|allocate(MemoryPages|Object))|raw(Gr(oove|ayBezel)|B(itmap|utton)|ColorTiledRects|TiledRects|DarkBezel|W(hiteBezel|indowBackground)|LightBezel))|U(serName|n(ionR(ect|ange)|registerServicesProvider)|pdateDynamicServices)|Java(Bundle(Setup|Cleanup)|Setup(VirtualMachine)?|Needs(ToLoadClasses|VirtualMachine)|ClassesF(orBundle|romPath)|ObjectNamedInPath|ProvidesClasses)|P(oint(InRect|FromString)|erformService|lanarFromDepth|ageSize)|E(n(d(MapTableEnumeration|HashTableEnumeration)|umerate(MapTable|HashTable)|ableScreenUpdates)|qual(R(ects|anges)|Sizes|Points)|raseRect|xtraRefCount)|F(ileTypeForHFSTypeCode|ullUserName|r(ee(MapTable|HashTable)|ame(Rect(WithWidth(UsingOperation)?)?|Address)))|Wi(ndowList(ForContext)?|dth)|Lo(cationInRange|g(v|PageSize)?)|A(ccessibility(R(oleDescription(ForUIElement)?|aiseBadArgumentException)|Unignored(Children(ForOnlyChild)?|Descendant|Ancestor)|PostNotification|ActionDescription)|pplication(Main|Load)|vailableWindowDepths|ll(MapTable(Values|Keys)|HashTableObjects|ocate(MemoryPages|Collectable|Object)))))\\b" }, - { + "anonymous_pattern_2": { + "begin": "((@)(implementation))\\s+([A-Za-z_][A-Za-z0-9_]*)\\s*(?::\\s*([A-Za-z][A-Za-z0-9]*))?", + "captures": { + "1": { + "name": "storage.type.objcpp" + }, + "2": { + "name": "punctuation.definition.storage.type.objcpp" + }, + "4": { + "name": "entity.name.type.objcpp" + }, + "5": { + "name": "entity.other.inherited-class.objcpp" + } + }, + "contentName": "meta.scope.implementation.objcpp", + "end": "((@)end)\\b", + "name": "meta.implementation.objcpp", + "patterns": [ + { + "include": "#implementation_innards" + } + ] + }, + "anonymous_pattern_20": { "match": "\\bNS(RuleEditor|G(arbageCollector|radient)|MapTable|HashTable|Co(ndition|llectionView(Item)?)|T(oolbarItemGroup|extInputClient|r(eeNode|ackingArea))|InvocationOperation|Operation(Queue)?|D(ictionaryController|ockTile)|P(ointer(Functions|Array)|athC(o(ntrol(Delegate)?|mponentCell)|ell(Delegate)?)|r(intPanelAccessorizing|edicateEditor(RowTemplate)?))|ViewController|FastEnumeration|Animat(ionContext|ablePropertyContainer))\\b", "name": "support.class.cocoa.leopard.objcpp" }, - { + "anonymous_pattern_21": { "match": "\\bNS(R(u(nLoop|ler(Marker|View))|e(sponder|cursiveLock|lativeSpecifier)|an(domSpecifier|geSpecifier))|G(etCommand|lyph(Generator|Storage|Info)|raphicsContext)|XML(Node|D(ocument|TD(Node)?)|Parser|Element)|M(iddleSpecifier|ov(ie(View)?|eCommand)|utable(S(tring|et)|C(haracterSet|opying)|IndexSet|D(ictionary|ata)|URLRequest|ParagraphStyle|A(ttributedString|rray))|e(ssagePort(NameServer)?|nu(Item(Cell)?|View)?|t(hodSignature|adata(Item|Query(ResultGroup|AttributeValueTuple)?)))|a(ch(BootstrapServer|Port)|trix))|B(itmapImageRep|ox|u(ndle|tton(Cell)?)|ezierPath|rowser(Cell)?)|S(hadow|c(anner|r(ipt(SuiteRegistry|C(o(ercionHandler|mmand(Description)?)|lassDescription)|ObjectSpecifier|ExecutionContext|WhoseTest)|oll(er|View)|een))|t(epper(Cell)?|atus(Bar|Item)|r(ing|eam))|imple(HorizontalTypesetter|CString)|o(cketPort(NameServer)?|und|rtDescriptor)|p(e(cifierTest|ech(Recognizer|Synthesizer)|ll(Server|Checker))|litView)|e(cureTextField(Cell)?|t(Command)?|archField(Cell)?|rializer|gmentedC(ontrol|ell))|lider(Cell)?|avePanel)|H(ost|TTP(Cookie(Storage)?|URLResponse)|elpManager)|N(ib(Con(nector|trolConnector)|OutletConnector)?|otification(Center|Queue)?|u(ll|mber(Formatter)?)|etService(Browser)?|ameSpecifier)|C(ha(ngeSpelling|racterSet)|o(n(stantString|nection|trol(ler)?|ditionLock)|d(ing|er)|unt(Command|edSet)|pying|lor(Space|P(ick(ing(Custom|Default)|er)|anel)|Well|List)?|m(p(oundPredicate|arisonPredicate)|boBox(Cell)?))|u(stomImageRep|rsor)|IImageRep|ell|l(ipView|o(seCommand|neCommand)|assDescription)|a(ched(ImageRep|URLResponse)|lendar(Date)?)|reateCommand)|T(hread|ypesetter|ime(Zone|r)|o(olbar(Item(Validations)?)?|kenField(Cell)?)|ext(Block|Storage|Container|Tab(le(Block)?)?|Input|View|Field(Cell)?|List|Attachment(Cell)?)?|a(sk|b(le(Header(Cell|View)|Column|View)|View(Item)?))|reeController)|I(n(dex(S(pecifier|et)|Path)|put(Manager|S(tream|erv(iceProvider|er(MouseTracker)?)))|vocation)|gnoreMisspelledWords|mage(Rep|Cell|View)?)|O(ut(putStream|lineView)|pen(GL(Context|Pixel(Buffer|Format)|View)|Panel)|bj(CTypeSerializationCallBack|ect(Controller)?))|D(i(st(antObject(Request)?|ributed(NotificationCenter|Lock))|ctionary|rectoryEnumerator)|ocument(Controller)?|e(serializer|cimalNumber(Behaviors|Handler)?|leteCommand)|at(e(Components|Picker(Cell)?|Formatter)?|a)|ra(wer|ggingInfo))|U(ser(InterfaceValidations|Defaults(Controller)?)|RL(Re(sponse|quest)|Handle(Client)?|C(onnection|ache|redential(Storage)?)|Download(Delegate)?|Prot(ocol(Client)?|ectionSpace)|AuthenticationChallenge(Sender)?)?|n(iqueIDSpecifier|doManager|archiver))|P(ipe|o(sitionalSpecifier|pUpButton(Cell)?|rt(Message|NameServer|Coder)?)|ICTImageRep|ersistentDocument|DFImageRep|a(steboard|nel|ragraphStyle|geLayout)|r(int(Info|er|Operation|Panel)|o(cessInfo|tocolChecker|perty(Specifier|ListSerialization)|gressIndicator|xy)|edicate))|E(numerator|vent|PSImageRep|rror|x(ception|istsCommand|pression))|V(iew(Animation)?|al(idated(ToobarItem|UserInterfaceItem)|ue(Transformer)?))|Keyed(Unarchiver|Archiver)|Qui(ckDrawView|tCommand)|F(ile(Manager|Handle|Wrapper)|o(nt(Manager|Descriptor|Panel)?|rm(Cell|atter)))|W(hoseSpecifier|indow(Controller)?|orkspace)|L(o(c(k(ing)?|ale)|gicalTest)|evelIndicator(Cell)?|ayoutManager)|A(ssertionHandler|nimation|ctionCell|ttributedString|utoreleasePool|TSTypesetter|ppl(ication|e(Script|Event(Manager|Descriptor)))|ffineTransform|lert|r(chiver|ray(Controller)?)))\\b", "name": "support.class.cocoa.objcpp" }, - { + "anonymous_pattern_22": { "match": "\\bNS(R(oundingMode|ule(Editor(RowType|NestingMode)|rOrientation)|e(questUserAttentionType|lativePosition))|G(lyphInscription|radientDrawingOptions)|XML(NodeKind|D(ocumentContentKind|TDNodeKind)|ParserError)|M(ultibyteGlyphPacking|apTableOptions)|B(itmapFormat|oxType|ezierPathElement|ackgroundStyle|rowserDropOperation)|S(tr(ing(CompareOptions|DrawingOptions|EncodingConversionOptions)|eam(Status|Event))|p(eechBoundary|litViewDividerStyle)|e(archPathD(irectory|omainMask)|gmentS(tyle|witchTracking))|liderType|aveOptions)|H(TTPCookieAcceptPolicy|ashTableOptions)|N(otification(SuspensionBehavior|Coalescing)|umberFormatter(RoundingMode|Behavior|Style|PadPosition)|etService(sError|Options))|C(haracterCollection|o(lor(RenderingIntent|SpaceModel|PanelMode)|mp(oundPredicateType|arisonPredicateModifier))|ellStateValue|al(culationError|endarUnit))|T(ypesetterControlCharacterAction|imeZoneNameStyle|e(stComparisonOperation|xt(Block(Dimension|V(erticalAlignment|alueType)|Layer)|TableLayoutAlgorithm|FieldBezelStyle))|ableView(SelectionHighlightStyle|ColumnAutoresizingStyle)|rackingAreaOptions)|I(n(sertionPosition|te(rfaceStyle|ger))|mage(RepLoadStatus|Scaling|CacheMode|FrameStyle|LoadStatus|Alignment))|Ope(nGLPixelFormatAttribute|rationQueuePriority)|Date(Picker(Mode|Style)|Formatter(Behavior|Style))|U(RL(RequestCachePolicy|HandleStatus|C(acheStoragePolicy|redentialPersistence))|Integer)|P(o(stingStyle|int(ingDeviceType|erFunctionsOptions)|pUpArrowPosition)|athStyle|r(int(ing(Orientation|PaginationMode)|erTableStatus|PanelOptions)|opertyList(MutabilityOptions|Format)|edicateOperatorType))|ExpressionType|KeyValue(SetMutationKind|Change)|QTMovieLoopMode|F(indPanel(SubstringMatchType|Action)|o(nt(RenderingMode|FamilyClass)|cusRingPlacement))|W(hoseSubelementIdentifier|ind(ingRule|ow(B(utton|ackingLocation)|SharingType|CollectionBehavior)))|L(ine(MovementDirection|SweepDirection|CapStyle|JoinStyle)|evelIndicatorStyle)|Animation(BlockingMode|Curve))\\b", "name": "support.type.cocoa.leopard.objcpp" }, - { + "anonymous_pattern_23": { "match": "\\bC(I(Sampler|Co(ntext|lor)|Image(Accumulator)?|PlugIn(Registration)?|Vector|Kernel|Filter(Generator|Shape)?)|A(Renderer|MediaTiming(Function)?|BasicAnimation|ScrollLayer|Constraint(LayoutManager)?|T(iledLayer|extLayer|rans(ition|action))|OpenGLLayer|PropertyAnimation|KeyframeAnimation|Layer|A(nimation(Group)?|ction)))\\b", "name": "support.class.quartz.objcpp" }, - { + "anonymous_pattern_24": { "match": "\\bC(G(Float|Point|Size|Rect)|IFormat|AConstraintAttribute)\\b", "name": "support.type.quartz.objcpp" }, - { + "anonymous_pattern_25": { "match": "\\bNS(R(ect(Edge)?|ange)|G(lyph(Relation|LayoutMode)?|radientType)|M(odalSession|a(trixMode|p(Table|Enumerator)))|B(itmapImageFileType|orderType|uttonType|ezelStyle|ackingStoreType|rowserColumnResizingType)|S(cr(oll(er(Part|Arrow)|ArrowPosition)|eenAuxiliaryOpaque)|tringEncoding|ize|ocketNativeHandle|election(Granularity|Direction|Affinity)|wapped(Double|Float)|aveOperationType)|Ha(sh(Table|Enumerator)|ndler(2)?)|C(o(ntrol(Size|Tint)|mp(ositingOperation|arisonResult))|ell(State|Type|ImagePosition|Attribute))|T(hreadPrivate|ypesetterGlyphInfo|i(ckMarkPosition|tlePosition|meInterval)|o(ol(TipTag|bar(SizeMode|DisplayMode))|kenStyle)|IFFCompression|ext(TabType|Alignment)|ab(State|leViewDropOperation|ViewType)|rackingRectTag)|ImageInterpolation|Zone|OpenGL(ContextAuxiliary|PixelFormatAuxiliary)|D(ocumentChangeType|atePickerElementFlags|ra(werState|gOperation))|UsableScrollerParts|P(oint|r(intingPageOrder|ogressIndicator(Style|Th(ickness|readInfo))))|EventType|KeyValueObservingOptions|Fo(nt(SymbolicTraits|TraitMask|Action)|cusRingType)|W(indow(OrderingMode|Depth)|orkspace(IconCreationOptions|LaunchOptions)|ritingDirection)|L(ineBreakMode|ayout(Status|Direction))|A(nimation(Progress|Effect)|ppl(ication(TerminateReply|DelegateReply|PrintReply)|eEventManagerSuspensionID)|ffineTransformStruct|lertStyle))\\b", "name": "support.type.cocoa.objcpp" }, - { + "anonymous_pattern_26": { "match": "\\bNS(NotFound|Ordered(Ascending|Descending|Same))\\b", "name": "support.constant.cocoa.objcpp" }, - { + "anonymous_pattern_27": { "match": "\\bNS(MenuDidBeginTracking|ViewDidUpdateTrackingAreas)?Notification\\b", "name": "support.constant.notification.cocoa.leopard.objcpp" }, - { + "anonymous_pattern_28": { "match": "\\bNS(Menu(Did(RemoveItem|SendAction|ChangeItem|EndTracking|AddItem)|WillSendAction)|S(ystemColorsDidChange|plitView(DidResizeSubviews|WillResizeSubviews))|C(o(nt(extHelpModeDid(Deactivate|Activate)|rolT(intDidChange|extDid(BeginEditing|Change|EndEditing)))|lor(PanelColorDidChange|ListDidChange)|mboBox(Selection(IsChanging|DidChange)|Will(Dismiss|PopUp)))|lassDescriptionNeededForClass)|T(oolbar(DidRemoveItem|WillAddItem)|ext(Storage(DidProcessEditing|WillProcessEditing)|Did(BeginEditing|Change|EndEditing)|View(DidChange(Selection|TypingAttributes)|WillChangeNotifyingTextView))|ableView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)))|ImageRepRegistryDidChange|OutlineView(Selection(IsChanging|DidChange)|ColumnDid(Resize|Move)|Item(Did(Collapse|Expand)|Will(Collapse|Expand)))|Drawer(Did(Close|Open)|Will(Close|Open))|PopUpButton(CellWillPopUp|WillPopUp)|View(GlobalFrameDidChange|BoundsDidChange|F(ocusDidChange|rameDidChange))|FontSetChanged|W(indow(Did(Resi(ze|gn(Main|Key))|M(iniaturize|ove)|Become(Main|Key)|ChangeScreen(|Profile)|Deminiaturize|Update|E(ndSheet|xpose))|Will(M(iniaturize|ove)|BeginSheet|Close))|orkspace(SessionDid(ResignActive|BecomeActive)|Did(Mount|TerminateApplication|Unmount|PerformFileOperation|Wake|LaunchApplication)|Will(Sleep|Unmount|PowerOff|LaunchApplication)))|A(ntialiasThresholdChanged|ppl(ication(Did(ResignActive|BecomeActive|Hide|ChangeScreenParameters|U(nhide|pdate)|FinishLaunching)|Will(ResignActive|BecomeActive|Hide|Terminate|U(nhide|pdate)|FinishLaunching))|eEventManagerWillProcessFirstEvent)))Notification\\b", "name": "support.constant.notification.cocoa.objcpp" }, - { + "anonymous_pattern_29": { "match": "\\bNS(RuleEditor(RowType(Simple|Compound)|NestingMode(Si(ngle|mple)|Compound|List))|GradientDraws(BeforeStartingLocation|AfterEndingLocation)|M(inusSetExpressionType|a(chPortDeallocate(ReceiveRight|SendRight|None)|pTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality)))|B(oxCustom|undleExecutableArchitecture(X86|I386|PPC(64)?)|etweenPredicateOperatorType|ackgroundStyle(Raised|Dark|L(ight|owered)))|S(tring(DrawingTruncatesLastVisibleLine|EncodingConversion(ExternalRepresentation|AllowLossy))|ubqueryExpressionType|p(e(ech(SentenceBoundary|ImmediateBoundary|WordBoundary)|llingState(GrammarFlag|SpellingFlag))|litViewDividerStyleThi(n|ck))|e(rvice(RequestTimedOutError|M(iscellaneousError|alformedServiceDictionaryError)|InvalidPasteboardDataError|ErrorM(inimum|aximum)|Application(NotFoundError|LaunchFailedError))|gmentStyle(Round(Rect|ed)|SmallSquare|Capsule|Textured(Rounded|Square)|Automatic)))|H(UDWindowMask|ashTable(StrongMemory|CopyIn|ZeroingWeakMemory|ObjectPointerPersonality))|N(oModeColorPanel|etServiceNoAutoRename)|C(hangeRedone|o(ntainsPredicateOperatorType|l(orRenderingIntent(RelativeColorimetric|Saturation|Default|Perceptual|AbsoluteColorimetric)|lectorDisabledOption))|ellHit(None|ContentArea|TrackableArea|EditableTextArea))|T(imeZoneNameStyle(S(hort(Standard|DaylightSaving)|tandard)|DaylightSaving)|extFieldDatePickerStyle|ableViewSelectionHighlightStyle(Regular|SourceList)|racking(Mouse(Moved|EnteredAndExited)|CursorUpdate|InVisibleRect|EnabledDuringMouseDrag|A(ssumeInside|ctive(In(KeyWindow|ActiveApp)|WhenFirstResponder|Always))))|I(n(tersectSetExpressionType|dexedColorSpaceModel)|mageScale(None|Proportionally(Down|UpOrDown)|AxesIndependently))|Ope(nGLPFAAllowOfflineRenderers|rationQueue(DefaultMaxConcurrentOperationCount|Priority(High|Normal|Very(High|Low)|Low)))|D(iacriticInsensitiveSearch|ownloadsDirectory)|U(nionSetExpressionType|TF(16(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)|32(BigEndianStringEncoding|StringEncoding|LittleEndianStringEncoding)))|P(ointerFunctions(Ma(chVirtualMemory|llocMemory)|Str(ongMemory|uctPersonality)|C(StringPersonality|opyIn)|IntegerPersonality|ZeroingWeakMemory|O(paque(Memory|Personality)|bjectP(ointerPersonality|ersonality)))|at(hStyle(Standard|NavigationBar|PopUp)|ternColorSpaceModel)|rintPanelShows(Scaling|Copies|Orientation|P(a(perSize|ge(Range|SetupAccessory))|review)))|Executable(RuntimeMismatchError|NotLoadableError|ErrorM(inimum|aximum)|L(inkError|oadError)|ArchitectureMismatchError)|KeyValueObservingOption(Initial|Prior)|F(i(ndPanelSubstringMatchType(StartsWith|Contains|EndsWith|FullWord)|leRead(TooLargeError|UnknownStringEncodingError))|orcedOrderingSearch)|Wi(ndow(BackingLocation(MainMemory|Default|VideoMemory)|Sharing(Read(Only|Write)|None)|CollectionBehavior(MoveToActiveSpace|CanJoinAllSpaces|Default))|dthInsensitiveSearch)|AggregateExpressionType)\\b", "name": "support.constant.cocoa.leopard.objcpp" }, - { + "anonymous_pattern_3": { + "begin": "@\"", + "beginCaptures": { + "0": { + "name": "punctuation.definition.string.begin.objcpp" + } + }, + "end": "\"", + "endCaptures": { + "0": { + "name": "punctuation.definition.string.end.objcpp" + } + }, + "name": "string.quoted.double.objcpp", + "patterns": [ + { + "include": "#string_escaped_char" + }, + { + "match": "(?x)%\n\t\t\t\t\t\t(\\d+\\$)? # field (argument #)\n\t\t\t\t\t\t[#0\\- +']* # flags\n\t\t\t\t\t\t((-?\\d+)|\\*(-?\\d+\\$)?)? # minimum field width\n\t\t\t\t\t\t(\\.((-?\\d+)|\\*(-?\\d+\\$)?)?)? # precision\n\t\t\t\t\t\t[@] # conversion type\n\t\t\t\t\t", + "name": "constant.other.placeholder.objcpp" + }, + { + "include": "#string_placeholder" + } + ] + }, + "anonymous_pattern_30": { "match": "\\bNS(R(GB(ModeColorPanel|ColorSpaceModel)|ight(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey)|ound(RectBezelStyle|Bankers|ed(BezelStyle|TokenStyle|DisclosureBezelStyle)|Down|Up|Plain|Line(CapStyle|JoinStyle))|un(StoppedResponse|ContinuesResponse|AbortedResponse)|e(s(izableWindowMask|et(CursorRectsRunLoopOrdering|FunctionKey))|ce(ssedBezelStyle|iver(sCantHandleCommandScriptError|EvaluationScriptError))|turnTextMovement|doFunctionKey|quiredArgumentsMissingScriptError|l(evancyLevelIndicatorStyle|ative(Before|After))|gular(SquareBezelStyle|ControlSize)|moveTraitFontAction)|a(n(domSubelement|geDateMode)|tingLevelIndicatorStyle|dio(ModeMatrix|Button)))|G(IFFileType|lyph(Below|Inscribe(B(elow|ase)|Over(strike|Below)|Above)|Layout(WithPrevious|A(tAPoint|gainstAPoint))|A(ttribute(BidiLevel|Soft|Inscribe|Elastic)|bove))|r(ooveBorder|eaterThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|a(y(ModeColorPanel|ColorSpaceModel)|dient(None|Con(cave(Strong|Weak)|vex(Strong|Weak)))|phiteControlTint)))|XML(N(o(tationDeclarationKind|de(CompactEmptyElement|IsCDATA|OptionsNone|Use(SingleQuotes|DoubleQuotes)|Pre(serve(NamespaceOrder|C(haracterReferences|DATA)|DTD|Prefixes|E(ntities|mptyElements)|Quotes|Whitespace|A(ttributeOrder|ll))|ttyPrint)|ExpandEmptyElement))|amespaceKind)|CommentKind|TextKind|InvalidKind|D(ocument(X(MLKind|HTMLKind|Include)|HTMLKind|T(idy(XML|HTML)|extKind)|IncludeContentTypeDeclaration|Validate|Kind)|TDKind)|P(arser(GTRequiredError|XMLDeclNot(StartedError|FinishedError)|Mi(splaced(XMLDeclarationError|CDATAEndStringError)|xedContentDeclNot(StartedError|FinishedError))|S(t(andaloneValueError|ringNot(StartedError|ClosedError))|paceRequiredError|eparatorRequiredError)|N(MTOKENRequiredError|o(t(ationNot(StartedError|FinishedError)|WellBalancedError)|DTDError)|amespaceDeclarationError|AMERequiredError)|C(haracterRef(In(DTDError|PrologError|EpilogError)|AtEOFError)|o(nditionalSectionNot(StartedError|FinishedError)|mment(NotFinishedError|ContainsDoubleHyphenError))|DATANotFinishedError)|TagNameMismatchError|In(ternalError|valid(HexCharacterRefError|C(haracter(RefError|InEntityError|Error)|onditionalSectionError)|DecimalCharacterRefError|URIError|Encoding(NameError|Error)))|OutOfMemoryError|D(ocumentStartError|elegateAbortedParseError|OCTYPEDeclNotFinishedError)|U(RI(RequiredError|FragmentError)|n(declaredEntityError|parsedEntityError|knownEncodingError|finishedTagError))|P(CDATARequiredError|ublicIdentifierRequiredError|arsedEntityRef(MissingSemiError|NoNameError|In(Internal(SubsetError|Error)|PrologError|EpilogError)|AtEOFError)|r(ocessingInstructionNot(StartedError|FinishedError)|ematureDocumentEndError))|E(n(codingNotSupportedError|tity(Ref(In(DTDError|PrologError|EpilogError)|erence(MissingSemiError|WithoutNameError)|LoopError|AtEOFError)|BoundaryError|Not(StartedError|FinishedError)|Is(ParameterError|ExternalError)|ValueRequiredError))|qualExpectedError|lementContentDeclNot(StartedError|FinishedError)|xt(ernalS(tandaloneEntityError|ubsetNotFinishedError)|raContentError)|mptyDocumentError)|L(iteralNot(StartedError|FinishedError)|T(RequiredError|SlashRequiredError)|essThanSymbolInAttributeError)|Attribute(RedefinedError|HasNoValueError|Not(StartedError|FinishedError)|ListNot(StartedError|FinishedError)))|rocessingInstructionKind)|E(ntity(GeneralKind|DeclarationKind|UnparsedKind|P(ar(sedKind|ameterKind)|redefined))|lement(Declaration(MixedKind|UndefinedKind|E(lementKind|mptyKind)|Kind|AnyKind)|Kind))|Attribute(N(MToken(sKind|Kind)|otationKind)|CDATAKind|ID(Ref(sKind|Kind)|Kind)|DeclarationKind|En(tit(yKind|iesKind)|umerationKind)|Kind))|M(i(n(XEdge|iaturizableWindowMask|YEdge|uteCalendarUnit)|terLineJoinStyle|ddleSubelement|xedState)|o(nthCalendarUnit|deSwitchFunctionKey|use(Moved(Mask)?|E(ntered(Mask)?|ventSubtype|xited(Mask)?))|veToBezierPathElement|mentary(ChangeButton|Push(Button|InButton)|Light(Button)?))|enuFunctionKey|a(c(intoshInterfaceStyle|OSRomanStringEncoding)|tchesPredicateOperatorType|ppedRead|x(XEdge|YEdge))|ACHOperatingSystem)|B(MPFileType|o(ttomTabsBezelBorder|ldFontMask|rderlessWindowMask|x(Se(condary|parator)|OldStyle|Primary))|uttLineCapStyle|e(zelBorder|velLineJoinStyle|low(Bottom|Top)|gin(sWith(Comparison|PredicateOperatorType)|FunctionKey))|lueControlTint|ack(spaceCharacter|tabTextMovement|ingStore(Retained|Buffered|Nonretained)|TabCharacter|wardsSearch|groundTab)|r(owser(NoColumnResizing|UserColumnResizing|AutoColumnResizing)|eakFunctionKey))|S(h(ift(JISStringEncoding|KeyMask)|ow(ControlGlyphs|InvisibleGlyphs)|adowlessSquareBezelStyle)|y(s(ReqFunctionKey|tem(D(omainMask|efined(Mask)?)|FunctionKey))|mbolStringEncoding)|c(a(nnedOption|le(None|ToFit|Proportionally))|r(oll(er(NoPart|Increment(Page|Line|Arrow)|Decrement(Page|Line|Arrow)|Knob(Slot)?|Arrows(M(inEnd|axEnd)|None|DefaultSetting))|Wheel(Mask)?|LockFunctionKey)|eenChangedEventType))|t(opFunctionKey|r(ingDrawing(OneShot|DisableScreenFontSubstitution|Uses(DeviceMetrics|FontLeading|LineFragmentOrigin))|eam(Status(Reading|NotOpen|Closed|Open(ing)?|Error|Writing|AtEnd)|Event(Has(BytesAvailable|SpaceAvailable)|None|OpenCompleted|E(ndEncountered|rrorOccurred)))))|i(ngle(DateMode|UnderlineStyle)|ze(DownFontAction|UpFontAction))|olarisOperatingSystem|unOSOperatingSystem|pecialPageOrder|e(condCalendarUnit|lect(By(Character|Paragraph|Word)|i(ng(Next|Previous)|onAffinity(Downstream|Upstream))|edTab|FunctionKey)|gmentSwitchTracking(Momentary|Select(One|Any)))|quareLineCapStyle|witchButton|ave(ToOperation|Op(tions(Yes|No|Ask)|eration)|AsOperation)|mall(SquareBezelStyle|C(ontrolSize|apsFontMask)|IconButtonBezelStyle))|H(ighlightModeMatrix|SBModeColorPanel|o(ur(Minute(SecondDatePickerElementFlag|DatePickerElementFlag)|CalendarUnit)|rizontalRuler|meFunctionKey)|TTPCookieAcceptPolicy(Never|OnlyFromMainDocumentDomain|Always)|e(lp(ButtonBezelStyle|KeyMask|FunctionKey)|avierFontAction)|PUXOperatingSystem)|Year(MonthDa(yDatePickerElementFlag|tePickerElementFlag)|CalendarUnit)|N(o(n(StandardCharacterSetFontMask|ZeroWindingRule|activatingPanelMask|LossyASCIIStringEncoding)|Border|t(ification(SuspensionBehavior(Hold|Coalesce|D(eliverImmediately|rop))|NoCoalescing|CoalescingOn(Sender|Name)|DeliverImmediately|PostToAllSessions)|PredicateType|EqualToPredicateOperatorType)|S(cr(iptError|ollerParts)|ubelement|pecifierError)|CellMask|T(itle|opLevelContainersSpecifierError|abs(BezelBorder|NoBorder|LineBorder))|I(nterfaceStyle|mage)|UnderlineStyle|FontChangeAction)|u(ll(Glyph|CellType)|m(eric(Search|PadKeyMask)|berFormatter(Round(Half(Down|Up|Even)|Ceiling|Down|Up|Floor)|Behavior(10|Default)|S(cientificStyle|pellOutStyle)|NoStyle|CurrencyStyle|DecimalStyle|P(ercentStyle|ad(Before(Suffix|Prefix)|After(Suffix|Prefix))))))|e(t(Services(BadArgumentError|NotFoundError|C(ollisionError|ancelledError)|TimeoutError|InvalidError|UnknownError|ActivityInProgress)|workDomainMask)|wlineCharacter|xt(StepInterfaceStyle|FunctionKey))|EXTSTEPStringEncoding|a(t(iveShortGlyphPacking|uralTextAlignment)|rrowFontMask))|C(hange(ReadOtherContents|GrayCell(Mask)?|BackgroundCell(Mask)?|Cleared|Done|Undone|Autosaved)|MYK(ModeColorPanel|ColorSpaceModel)|ircular(BezelStyle|Slider)|o(n(stantValueExpressionType|t(inuousCapacityLevelIndicatorStyle|entsCellMask|ain(sComparison|erSpecifierError)|rol(Glyph|KeyMask))|densedFontMask)|lor(Panel(RGBModeMask|GrayModeMask|HSBModeMask|C(MYKModeMask|olorListModeMask|ustomPaletteModeMask|rayonModeMask)|WheelModeMask|AllModesMask)|ListModeColorPanel)|reServiceDirectory|m(p(osite(XOR|Source(In|O(ut|ver)|Atop)|Highlight|C(opy|lear)|Destination(In|O(ut|ver)|Atop)|Plus(Darker|Lighter))|ressedFontMask)|mandKeyMask))|u(stom(SelectorPredicateOperatorType|PaletteModeColorPanel)|r(sor(Update(Mask)?|PointingDevice)|veToBezierPathElement))|e(nterT(extAlignment|abStopType)|ll(State|H(ighlighted|as(Image(Horizontal|OnLeftOrBottom)|OverlappingImage))|ChangesContents|Is(Bordered|InsetButton)|Disabled|Editable|LightsBy(Gray|Background|Contents)|AllowsMixedState))|l(ipPagination|o(s(ePathBezierPathElement|ableWindowMask)|ckAndCalendarDatePickerStyle)|ear(ControlTint|DisplayFunctionKey|LineFunctionKey))|a(seInsensitive(Search|PredicateOption)|n(notCreateScriptCommandError|cel(Button|TextMovement))|chesDirectory|lculation(NoError|Overflow|DivideByZero|Underflow|LossOfPrecision)|rriageReturnCharacter)|r(itical(Request|AlertStyle)|ayonModeColorPanel))|T(hick(SquareBezelStyle|erSquareBezelStyle)|ypesetter(Behavior|HorizontalTabAction|ContainerBreakAction|ZeroAdvancementAction|OriginalBehavior|ParagraphBreakAction|WhitespaceAction|L(ineBreakAction|atestBehavior))|i(ckMark(Right|Below|Left|Above)|tledWindowMask|meZoneDatePickerElementFlag)|o(olbarItemVisibilityPriority(Standard|High|User|Low)|pTabsBezelBorder|ggleButton)|IFF(Compression(N(one|EXT)|CCITTFAX(3|4)|OldJPEG|JPEG|PackBits|LZW)|FileType)|e(rminate(Now|Cancel|Later)|xt(Read(InapplicableDocumentTypeError|WriteErrorM(inimum|aximum))|Block(M(i(nimum(Height|Width)|ddleAlignment)|a(rgin|ximum(Height|Width)))|B(o(ttomAlignment|rder)|aselineAlignment)|Height|TopAlignment|P(ercentageValueType|adding)|Width|AbsoluteValueType)|StorageEdited(Characters|Attributes)|CellType|ured(RoundedBezelStyle|BackgroundWindowMask|SquareBezelStyle)|Table(FixedLayoutAlgorithm|AutomaticLayoutAlgorithm)|Field(RoundedBezel|SquareBezel|AndStepperDatePickerStyle)|WriteInapplicableDocumentTypeError|ListPrependEnclosingMarker))|woByteGlyphPacking|ab(Character|TextMovement|le(tP(oint(Mask|EventSubtype)?|roximity(Mask|EventSubtype)?)|Column(NoResizing|UserResizingMask|AutoresizingMask)|View(ReverseSequentialColumnAutoresizingStyle|GridNone|S(olid(HorizontalGridLineMask|VerticalGridLineMask)|equentialColumnAutoresizingStyle)|NoColumnAutoresizing|UniformColumnAutoresizingStyle|FirstColumnOnlyAutoresizingStyle|LastColumnOnlyAutoresizingStyle)))|rackModeMatrix)|I(n(sert(CharFunctionKey|FunctionKey|LineFunctionKey)|t(Type|ernalS(criptError|pecifierError))|dexSubelement|validIndexSpecifierError|formational(Request|AlertStyle)|PredicateOperatorType)|talicFontMask|SO(2022JPStringEncoding|Latin(1StringEncoding|2StringEncoding))|dentityMappingCharacterCollection|llegalTextMovement|mage(R(ight|ep(MatchesDevice|LoadStatus(ReadingHeader|Completed|InvalidData|Un(expectedEOF|knownType)|WillNeedAllData)))|Below|C(ellType|ache(BySize|Never|Default|Always))|Interpolation(High|None|Default|Low)|O(nly|verlaps)|Frame(Gr(oove|ayBezel)|Button|None|Photo)|L(oadStatus(ReadError|C(ompleted|ancelled)|InvalidData|UnexpectedEOF)|eft)|A(lign(Right|Bottom(Right|Left)?|Center|Top(Right|Left)?|Left)|bove)))|O(n(State|eByteGlyphPacking|OffButton|lyScrollerArrows)|ther(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|TextMovement)|SF1OperatingSystem|pe(n(GL(GO(Re(setLibrary|tainRenderers)|ClearFormatCache|FormatCacheSize)|PFA(R(obust|endererID)|M(inimumPolicy|ulti(sample|Screen)|PSafe|aximumPolicy)|BackingStore|S(creenMask|te(ncilSize|reo)|ingleRenderer|upersample|ample(s|Buffers|Alpha))|NoRecovery|C(o(lor(Size|Float)|mpliant)|losestPolicy)|OffScreen|D(oubleBuffer|epthSize)|PixelBuffer|VirtualScreenCount|FullScreen|Window|A(cc(umSize|elerated)|ux(Buffers|DepthStencil)|l(phaSize|lRenderers))))|StepUnicodeReservedBase)|rationNotSupportedForKeyS(criptError|pecifierError))|ffState|KButton|rPredicateType|bjC(B(itfield|oolType)|S(hortType|tr(ingType|uctType)|electorType)|NoType|CharType|ObjectType|DoubleType|UnionType|PointerType|VoidType|FloatType|Long(Type|longType)|ArrayType))|D(i(s(c(losureBezelStyle|reteCapacityLevelIndicatorStyle)|playWindowRunLoopOrdering)|acriticInsensitivePredicateOption|rect(Selection|PredicateModifier))|o(c(ModalWindowMask|ument(Directory|ationDirectory))|ubleType|wn(TextMovement|ArrowFunctionKey))|e(s(cendingPageOrder|ktopDirectory)|cimalTabStopType|v(ice(NColorSpaceModel|IndependentModifierFlagsMask)|eloper(Directory|ApplicationDirectory))|fault(ControlTint|TokenStyle)|lete(Char(acter|FunctionKey)|FunctionKey|LineFunctionKey)|moApplicationDirectory)|a(yCalendarUnit|teFormatter(MediumStyle|Behavior(10|Default)|ShortStyle|NoStyle|FullStyle|LongStyle))|ra(wer(Clos(ingState|edState)|Open(ingState|State))|gOperation(Generic|Move|None|Copy|Delete|Private|Every|Link|All)))|U(ser(CancelledError|D(irectory|omainMask)|FunctionKey)|RL(Handle(NotLoaded|Load(Succeeded|InProgress|Failed))|CredentialPersistence(None|Permanent|ForSession))|n(scaledWindowMask|cachedRead|i(codeStringEncoding|talicFontMask|fiedTitleAndToolbarWindowMask)|d(o(CloseGroupingRunLoopOrdering|FunctionKey)|e(finedDateComponent|rline(Style(Single|None|Thick|Double)|Pattern(Solid|D(ot|ash(Dot(Dot)?)?)))))|known(ColorSpaceModel|P(ointingDevice|ageOrder)|KeyS(criptError|pecifierError))|boldFontMask)|tilityWindowMask|TF8StringEncoding|p(dateWindowsRunLoopOrdering|TextMovement|ArrowFunctionKey))|J(ustifiedTextAlignment|PEG(2000FileType|FileType)|apaneseEUC(GlyphPacking|StringEncoding))|P(o(s(t(Now|erFontMask|WhenIdle|ASAP)|iti(on(Replace|Be(fore|ginning)|End|After)|ve(IntType|DoubleType|FloatType)))|pUp(NoArrow|ArrowAt(Bottom|Center))|werOffEventType|rtraitOrientation)|NGFileType|ush(InCell(Mask)?|OnPushOffButton)|e(n(TipMask|UpperSideMask|PointingDevice|LowerSideMask)|riodic(Mask)?)|P(S(caleField|tatus(Title|Field)|aveButton)|N(ote(Title|Field)|ame(Title|Field))|CopiesField|TitleField|ImageButton|OptionsButton|P(a(perFeedButton|ge(Range(To|From)|ChoiceMatrix))|reviewButton)|LayoutButton)|lainTextTokenStyle|a(useFunctionKey|ragraphSeparatorCharacter|ge(DownFunctionKey|UpFunctionKey))|r(int(ing(ReplyLater|Success|Cancelled|Failure)|ScreenFunctionKey|erTable(NotFound|OK|Error)|FunctionKey)|o(p(ertyList(XMLFormat|MutableContainers(AndLeaves)?|BinaryFormat|Immutable|OpenStepFormat)|rietaryStringEncoding)|gressIndicator(BarStyle|SpinningStyle|Preferred(SmallThickness|Thickness|LargeThickness|AquaThickness)))|e(ssedTab|vFunctionKey))|L(HeightForm|CancelButton|TitleField|ImageButton|O(KButton|rientationMatrix)|UnitsButton|PaperNameButton|WidthForm))|E(n(terCharacter|d(sWith(Comparison|PredicateOperatorType)|FunctionKey))|v(e(nOddWindingRule|rySubelement)|aluatedObjectExpressionType)|qualTo(Comparison|PredicateOperatorType)|ra(serPointingDevice|CalendarUnit|DatePickerElementFlag)|x(clude(10|QuickDrawElementsIconCreationOption)|pandedFontMask|ecuteFunctionKey))|V(i(ew(M(in(XMargin|YMargin)|ax(XMargin|YMargin))|HeightSizable|NotSizable|WidthSizable)|aPanelFontAction)|erticalRuler|a(lidationErrorM(inimum|aximum)|riableExpressionType))|Key(SpecifierEvaluationScriptError|Down(Mask)?|Up(Mask)?|PathExpressionType|Value(MinusSetMutation|SetSetMutation|Change(Re(placement|moval)|Setting|Insertion)|IntersectSetMutation|ObservingOption(New|Old)|UnionSetMutation|ValidationError))|QTMovie(NormalPlayback|Looping(BackAndForthPlayback|Playback))|F(1(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|7FunctionKey|i(nd(PanelAction(Replace(A(ndFind|ll(InSelection)?))?|S(howFindPanel|e(tFindString|lectAll(InSelection)?))|Next|Previous)|FunctionKey)|tPagination|le(Read(No(SuchFileError|PermissionError)|CorruptFileError|In(validFileNameError|applicableStringEncodingError)|Un(supportedSchemeError|knownError))|HandlingPanel(CancelButton|OKButton)|NoSuchFileError|ErrorM(inimum|aximum)|Write(NoPermissionError|In(validFileNameError|applicableStringEncodingError)|OutOfSpaceError|Un(supportedSchemeError|knownError))|LockingError)|xedPitchFontMask)|2(1FunctionKey|7FunctionKey|2FunctionKey|8FunctionKey|3FunctionKey|9FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey|6FunctionKey)|o(nt(Mo(noSpaceTrait|dernSerifsClass)|BoldTrait|S(ymbolicClass|criptsClass|labSerifsClass|ansSerifClass)|C(o(ndensedTrait|llectionApplicationOnlyMask)|larendonSerifsClass)|TransitionalSerifsClass|I(ntegerAdvancementsRenderingMode|talicTrait)|O(ldStyleSerifsClass|rnamentalsClass)|DefaultRenderingMode|U(nknownClass|IOptimizedTrait)|Panel(S(hadowEffectModeMask|t(andardModesMask|rikethroughEffectModeMask)|izeModeMask)|CollectionModeMask|TextColorEffectModeMask|DocumentColorEffectModeMask|UnderlineEffectModeMask|FaceModeMask|All(ModesMask|EffectsModeMask))|ExpandedTrait|VerticalTrait|F(amilyClassMask|reeformSerifsClass)|Antialiased(RenderingMode|IntegerAdvancementsRenderingMode))|cusRing(Below|Type(None|Default|Exterior)|Only|Above)|urByteGlyphPacking|rm(attingError(M(inimum|aximum))?|FeedCharacter))|8FunctionKey|unction(ExpressionType|KeyMask)|3(1FunctionKey|2FunctionKey|3FunctionKey|4FunctionKey|5FunctionKey|FunctionKey|0FunctionKey)|9FunctionKey|4FunctionKey|P(RevertButton|S(ize(Title|Field)|etButton)|CurrentField|Preview(Button|Field))|l(oat(ingPointSamplesBitmapFormat|Type)|agsChanged(Mask)?)|axButton|5FunctionKey|6FunctionKey)|W(heelModeColorPanel|indow(s(NTOperatingSystem|CP125(1StringEncoding|2StringEncoding|3StringEncoding|4StringEncoding|0StringEncoding)|95(InterfaceStyle|OperatingSystem))|M(iniaturizeButton|ovedEventType)|Below|CloseButton|ToolbarButton|ZoomButton|Out|DocumentIconButton|ExposedEventType|Above)|orkspaceLaunch(NewInstance|InhibitingBackgroundOnly|Default|PreferringClassic|WithoutA(ctivation|ddingToRecents)|A(sync|nd(Hide(Others)?|Print)|llowingClassicStartup))|eek(day(CalendarUnit|OrdinalCalendarUnit)|CalendarUnit)|a(ntsBidiLevels|rningAlertStyle)|r(itingDirection(RightToLeft|Natural|LeftToRight)|apCalendarComponents))|L(i(stModeMatrix|ne(Moves(Right|Down|Up|Left)|B(order|reakBy(C(harWrapping|lipping)|Truncating(Middle|Head|Tail)|WordWrapping))|S(eparatorCharacter|weep(Right|Down|Up|Left))|ToBezierPathElement|DoesntMove|arSlider)|teralSearch|kePredicateOperatorType|ghterFontAction|braryDirectory)|ocalDomainMask|e(ssThan(Comparison|OrEqualTo(Comparison|PredicateOperatorType)|PredicateOperatorType)|ft(Mouse(D(own(Mask)?|ragged(Mask)?)|Up(Mask)?)|T(ext(Movement|Alignment)|ab(sBezelBorder|StopType))|ArrowFunctionKey))|a(yout(RightToLeft|NotDone|CantFit|OutOfGlyphs|Done|LeftToRight)|ndscapeOrientation)|ABColorSpaceModel)|A(sc(iiWithDoubleByteEUCGlyphPacking|endingPageOrder)|n(y(Type|PredicateModifier|EventMask)|choredSearch|imation(Blocking|Nonblocking(Threaded)?|E(ffect(DisappearingItemDefault|Poof)|ase(In(Out)?|Out))|Linear)|dPredicateType)|t(Bottom|tachmentCharacter|omicWrite|Top)|SCIIStringEncoding|d(obe(GB1CharacterCollection|CNS1CharacterCollection|Japan(1CharacterCollection|2CharacterCollection)|Korea1CharacterCollection)|dTraitFontAction|minApplicationDirectory)|uto(saveOperation|Pagination)|pp(lication(SupportDirectory|D(irectory|e(fined(Mask)?|legateReply(Success|Cancel|Failure)|activatedEventType))|ActivatedEventType)|KitDefined(Mask)?)|l(ternateKeyMask|pha(ShiftKeyMask|NonpremultipliedBitmapFormat|FirstBitmapFormat)|ert(SecondButtonReturn|ThirdButtonReturn|OtherReturn|DefaultReturn|ErrorReturn|FirstButtonReturn|AlternateReturn)|l(ScrollerParts|DomainsMask|PredicateModifier|LibrariesDirectory|ApplicationsDirectory))|rgument(sWrongScriptError|EvaluationScriptError)|bove(Bottom|Top)|WTEventType))\\b", "name": "support.constant.cocoa.objcpp" }, - { - "include": "#bracketed_content" + "anonymous_pattern_4": { + "begin": "\\b(id)\\s*(?=<)", + "beginCaptures": { + "1": { + "name": "storage.type.objcpp" + } + }, + "end": "(?<=>)", + "name": "meta.id-with-protocol.objcpp", + "patterns": [ + { + "include": "#protocol_list" + } + ] + }, + "anonymous_pattern_5": { + "match": "\\b(NS_DURING|NS_HANDLER|NS_ENDHANDLER)\\b", + "name": "keyword.control.macro.objcpp" + }, + "anonymous_pattern_7": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "(@)(try|catch|finally|throw)\\b", + "name": "keyword.control.exception.objcpp" + }, + "anonymous_pattern_8": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "(@)(synchronized)\\b", + "name": "keyword.control.synchronize.objcpp" + }, + "anonymous_pattern_9": { + "captures": { + "1": { + "name": "punctuation.definition.keyword.objcpp" + } + }, + "match": "(@)(required|optional)\\b", + "name": "keyword.control.protocol-specification.objcpp" + }, + "apple_foundation_functional_macros": { + "begin": "(\\b(?:API_AVAILABLE|API_DEPRECATED|API_UNAVAILABLE|NS_AVAILABLE|NS_AVAILABLE_MAC|NS_AVAILABLE_IOS|NS_DEPRECATED|NS_DEPRECATED_MAC|NS_DEPRECATED_IOS|NS_SWIFT_NAME))(?:(?:\\s)+)?(\\()", + "end": "\\)", + "beginCaptures": { + "1": { + "name": "entity.name.function.preprocessor.apple-foundation.objcpp" + }, + "2": { + "name": "punctuation.section.macro.arguments.begin.bracket.round.apple-foundation.objcpp" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.macro.arguments.end.bracket.round.apple-foundation.objcpp" + } + }, + "name": "meta.preprocessor.macro.callable.apple-foundation.objcpp", + "patterns": [ + { + "include": "#c_lang" + } + ] }, - { - "include": "#c_lang" - } - ], - "repository": { "bracketed_content": { "begin": "\\[", "beginCaptures": { @@ -2724,7 +2837,15 @@ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*(\\b(?!(?:void|char|short|int|signed|unsigned|long|float|double|bool|_Bool|_Complex|_Imaginary|u_char|u_short|u_int|u_long|ushort|uint|u_quad_t|quad_t|qaddr_t|caddr_t|daddr_t|div_t|dev_t|fixpt_t|blkcnt_t|blksize_t|gid_t|in_addr_t|in_port_t|ino_t|key_t|mode_t|nlink_t|id_t|pid_t|off_t|segsz_t|swblk_t|uid_t|id_t|clock_t|size_t|ssize_t|time_t|useconds_t|suseconds_t|pthread_attr_t|pthread_cond_t|pthread_condattr_t|pthread_mutex_t|pthread_mutexattr_t|pthread_once_t|pthread_rwlock_t|pthread_rwlockattr_t|pthread_t|pthread_key_t|int8_t|int16_t|int32_t|int64_t|uint8_t|uint16_t|uint32_t|uint64_t|int_least8_t|int_least16_t|int_least32_t|int_least64_t|uint_least8_t|uint_least16_t|uint_least32_t|uint_least64_t|int_fast8_t|int_fast16_t|int_fast32_t|int_fast64_t|uint_fast8_t|uint_fast16_t|uint_fast32_t|uint_fast64_t|intptr_t|uintptr_t|intmax_t|intmax_t|uintmax_t|uintmax_t|memory_order|atomic_bool|atomic_char|atomic_schar|atomic_uchar|atomic_short|atomic_ushort|atomic_int|atomic_uint|atomic_long|atomic_ulong|atomic_llong|atomic_ullong|atomic_char16_t|atomic_char32_t|atomic_wchar_t|atomic_int_least8_t|atomic_uint_least8_t|atomic_int_least16_t|atomic_uint_least16_t|atomic_int_least32_t|atomic_uint_least32_t|atomic_int_least64_t|atomic_uint_least64_t|atomic_int_fast8_t|atomic_uint_fast8_t|atomic_int_fast16_t|atomic_uint_fast16_t|atomic_int_fast32_t|atomic_uint_fast32_t|atomic_int_fast64_t|atomic_uint_fast64_t|atomic_intptr_t|atomic_uintptr_t|atomic_size_t|atomic_ptrdiff_t|atomic_intmax_t|atomic_uintmax_t))[a-zA-Z_]\\w*\\b(?!\\())", "captures": { "1": { - "name": "variable.other.object.access.objcpp" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objcpp" @@ -2744,7 +2865,15 @@ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", "captures": { "1": { - "name": "variable.other.object.access.objcpp" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objcpp" @@ -2766,7 +2895,15 @@ "begin": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))((?:[a-zA-Z_]\\w*\\s*(?-mix:(?:(?:\\.\\*|\\.))|(?:(?:->\\*|->)))\\s*)*)\\s*([a-zA-Z_]\\w*)(\\()", "beginCaptures": { "1": { - "name": "variable.other.object.access.objcpp" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objcpp" @@ -2786,7 +2923,15 @@ "match": "((?:[a-zA-Z_]\\w*|(?<=\\]|\\)))\\s*)(?:((?:\\.\\*|\\.))|((?:->\\*|->)))", "captures": { "1": { - "name": "variable.other.object.access.objcpp" + "patterns": [ + { + "include": "#special_variables" + }, + { + "name": "variable.other.object.access.objcpp", + "match": "(.+)" + } + ] }, "2": { "name": "punctuation.separator.dot-access.objcpp" diff --git a/apps/web/public/assets/shiki/languages/php.tmLanguage.json b/apps/web/public/assets/shiki/languages/php.tmLanguage.json index 1de57b8d..77ee94a8 100644 --- a/apps/web/public/assets/shiki/languages/php.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/php.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/atom/language-php/commit/ff64523c94c014d68f5dec189b05557649c5872a", + "version": "https://github.com/atom/language-php/commit/eb28b8aea1214dcbc732f3d9b9ed20c089c648bd", "scopeName": "source.php", "patterns": [ { @@ -13,62 +13,6 @@ { "include": "#comments" }, - { - "begin": "(?i)^\\s*(interface)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*(extends)?\\s*", - "beginCaptures": { - "1": { - "name": "storage.type.interface.php" - }, - "2": { - "name": "entity.name.type.interface.php" - }, - "3": { - "name": "storage.modifier.extends.php" - } - }, - "end": "(?i)((?:[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*\\s*,\\s*)*)([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?\\s*(?:(?={)|$)", - "endCaptures": { - "1": { - "patterns": [ - { - "match": "(?i)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*", - "name": "entity.other.inherited-class.php" - }, - { - "match": ",", - "name": "punctuation.separator.classes.php" - } - ] - }, - "2": { - "name": "entity.other.inherited-class.php" - } - }, - "name": "meta.interface.php", - "patterns": [ - { - "include": "#namespace" - } - ] - }, - { - "begin": "(?i)^\\s*(trait)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", - "beginCaptures": { - "1": { - "name": "storage.type.trait.php" - }, - "2": { - "name": "entity.name.type.trait.php" - } - }, - "end": "(?={)", - "name": "meta.trait.php", - "patterns": [ - { - "include": "#comments" - } - ] - }, { "match": "(?i)(?:^|(?<=<\\?php))\\s*(namespace)\\s+([a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)(?=\\s*;)", "name": "meta.namespace.php", @@ -233,123 +177,214 @@ ] }, { - "begin": "(?ix)\n(?:\n \\b(?:(abstract|final)\\s+)?(class)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\n |\\b(new)\\b\\s*(\\#\\[.*\\])?\\s*\\b(class)\\b # anonymous class\n)", + "begin": "(?ix)\n\\b(trait)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", "beginCaptures": { "1": { - "name": "storage.modifier.${1:/downcase}.php" + "name": "storage.type.trait.php" }, "2": { - "name": "storage.type.class.php" + "name": "entity.name.type.trait.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.trait.end.bracket.curly.php" + } + }, + "name": "meta.trait.php", + "patterns": [ + { + "include": "#comments" }, - "3": { - "name": "entity.name.type.class.php" + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.trait.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "contentName": "meta.trait.body.php", + "patterns": [ + { + "include": "$self" + } + ] + } + ] + }, + { + "begin": "(?ix)\n\\b(interface)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "beginCaptures": { + "1": { + "name": "storage.type.interface.php" }, - "4": { - "name": "keyword.other.new.php" + "2": { + "name": "entity.name.type.interface.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.interface.end.bracket.curly.php" + } + }, + "name": "meta.interface.php", + "patterns": [ + { + "include": "#comments" }, - "5": { + { + "include": "#interface-extends" + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.definition.interface.begin.bracket.curly.php" + } + }, + "end": "(?=}|\\?>)", + "contentName": "meta.interface.body.php", "patterns": [ { - "include": "#attribute" + "include": "#class-constant" + }, + { + "include": "$self" } ] + } + ] + }, + { + "begin": "(?ix)\n\\b(enum)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\n(?: \\s* (:) \\s* (int | string) \\b )?", + "beginCaptures": { + "1": { + "name": "storage.type.enum.php" }, - "6": { - "name": "storage.type.class.php" + "2": { + "name": "entity.name.type.enum.php" + }, + "3": { + "name": "keyword.operator.return-value.php" + }, + "4": { + "name": "keyword.other.type.php" } }, "end": "}|(?=\\?>)", "endCaptures": { "0": { - "name": "punctuation.definition.class.end.bracket.curly.php" + "name": "punctuation.definition.enum.end.bracket.curly.php" } }, - "name": "meta.class.php", + "name": "meta.enum.php", "patterns": [ { "include": "#comments" }, { - "begin": "(?i)(extends)\\s+", + "include": "#class-implements" + }, + { + "begin": "{", "beginCaptures": { - "1": { - "name": "storage.modifier.extends.php" + "0": { + "name": "punctuation.definition.enum.begin.bracket.curly.php" } }, - "contentName": "meta.other.inherited-class.php", - "end": "(?i)(?=[^a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", + "end": "(?=}|\\?>)", + "contentName": "meta.enum.body.php", "patterns": [ { - "begin": "(?i)(?=\\\\?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*\\\\)", - "end": "(?i)([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?(?=[^a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", - "endCaptures": { + "match": "(?i)\\b(case)\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)", + "captures": { "1": { - "name": "entity.other.inherited-class.php" - } - }, - "patterns": [ - { - "include": "#namespace" + "name": "storage.modifier.php" + }, + "2": { + "name": "constant.enum.php" } - ] + } }, { - "include": "#class-builtin" + "include": "#class-constant" }, { - "include": "#namespace" - }, + "include": "$self" + } + ] + } + ] + }, + { + "begin": "(?ix)\n(?:\n \\b(?:(abstract|final)\\s+)?(class)\\s+([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\n |\\b(new)\\b\\s*(\\#\\[.*\\])?\\s*\\b(class)\\b # anonymous class\n)", + "beginCaptures": { + "1": { + "name": "storage.modifier.${1:/downcase}.php" + }, + "2": { + "name": "storage.type.class.php" + }, + "3": { + "name": "entity.name.type.class.php" + }, + "4": { + "name": "keyword.other.new.php" + }, + "5": { + "patterns": [ { - "match": "(?i)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*", - "name": "entity.other.inherited-class.php" + "include": "#attribute" } ] }, + "6": { + "name": "storage.type.class.php" + } + }, + "end": "}|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.class.end.bracket.curly.php" + } + }, + "name": "meta.class.php", + "patterns": [ { - "begin": "(?i)(implements)\\s+", + "begin": "(?<=class)\\s*(\\()", "beginCaptures": { "1": { - "name": "storage.modifier.implements.php" + "name": "punctuation.definition.arguments.begin.bracket.round.php" } }, - "end": "(?i)(?=[;{])", + "end": "\\)|(?=\\?>)", + "endCaptures": { + "0": { + "name": "punctuation.definition.arguments.end.bracket.round.php" + } + }, + "name": "meta.function-call.php", "patterns": [ { - "include": "#comments" + "include": "#named-arguments" }, { - "begin": "(?i)(?=[a-z0-9_\\x{7f}-\\x{10ffff}\\\\]+)", - "contentName": "meta.other.inherited-class.php", - "end": "(?i)(?:\\s*(?:,|(?=[^a-z0-9_\\x{7f}-\\x{10ffff}\\\\\\s]))\\s*)", - "patterns": [ - { - "begin": "(?i)(?=\\\\?[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*\\\\)", - "end": "(?i)([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)?(?=[^a-z0-9_\\x{7f}-\\x{10ffff}\\\\])", - "endCaptures": { - "1": { - "name": "entity.other.inherited-class.php" - } - }, - "patterns": [ - { - "include": "#namespace" - } - ] - }, - { - "include": "#class-builtin" - }, - { - "include": "#namespace" - }, - { - "match": "(?i)[a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*", - "name": "entity.other.inherited-class.php" - } - ] + "include": "$self" } ] }, + { + "include": "#comments" + }, + { + "include": "#class-extends" + }, + { + "include": "#class-implements" + }, { "begin": "{", "beginCaptures": { @@ -360,6 +395,9 @@ "end": "(?=}|\\?>)", "contentName": "meta.class.body.php", "patterns": [ + { + "include": "#class-constant" + }, { "include": "$self" } @@ -382,7 +420,7 @@ } }, { - "match": "(?x)\n\\s* # FIXME: Removing this causes specs to fail. Investigate.\n\\b(\n break|case|continue|declare|default|die|do|\n else(if)?|end(declare|for(each)?|if|switch|while)|exit|\n for(each)?|if|return|switch|use|while|yield\n)\\b", + "match": "(?x)\n\\b(\n break|case|continue|declare|default|die|do|\n else(if)?|end(declare|for(each)?|if|switch|while)|exit|\n for(each)?|if|return|switch|use|while|yield\n)\\b", "captures": { "1": { "name": "keyword.control.${1:/downcase}.php" @@ -853,7 +891,7 @@ "name": "storage.type.php" }, { - "match": "(?i)\\b(global|abstract|const|extends|implements|final|private|protected|public|static)\\b", + "match": "(?i)\\b(global|abstract|const|final|private|protected|public|static)\\b", "name": "storage.modifier.php" }, { @@ -975,7 +1013,7 @@ "name": "entity.name.goto-label.php" } }, - "match": "(?i)^\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*)\\s*:(?!:)" + "match": "(?i)^\\s*([a-z_\\x{7f}-\\x{10ffff}][a-z0-9_\\x{7f}-\\x{10ffff}]*(?" + }, + { + "match": "{[`*]+}" + }, + { + "match": "\\([`*]+\\)" + }, + { + "match": "\\[[`*]+\\]" + }, + { + "match": "\"[`*]+\"" + } + ] + }, + "table": { + "begin": "^\\s*\\+[=+-]+\\+\\s*$", + "end": "^(?![+|])", + "beginCaptures": { + "0": { + "name": "keyword.control.table" + } + }, + "patterns": [ + { + "match": "[=+|-]", + "name": "keyword.control.table" + } + ] + }, + "simple-table": { + "match": "^[=\\s]+$", + "name": "keyword.control.table" + }, + "ref": { + "begin": "(:ref:)`", + "end": "`|^\\s*$", + "name": "entity.name.tag", + "beginCaptures": { + "1": { + "name": "keyword.control" + } + }, + "patterns": [ + { + "match": "<.*?>", + "name": "markup.underline.link" + } + ] + }, + "reference": { + "match": "[\\w-]*[a-zA-Z\\d-]__?\\b", + "name": "entity.name.tag" + }, + "macro": { + "match": "\\|[^\\|]+\\|", + "name": "entity.name.tag" + }, + "literal": { + "match": "(:\\S+:)(`.*?`\\\\?)", + "captures": { + "1": { + "name": "keyword.control" + }, + "2": { + "name": "entity.name.tag" + } + } + }, + "monospaced": { + "begin": "(?<=[\\s\"'(\\[{<]|^)``[^\\s`]", + "end": "``|^\\s*$", + "name": "string.interpolated" + }, + "citation": { + "begin": "(?<=[\\s\"'(\\[{<]|^)`[^\\s`]", + "end": "`_{,2}|^\\s*$", + "name": "entity.name.tag", + "applyEndPatternLast": 0 + }, + "bold": { + "begin": "(?<=[\\s\"'(\\[{<]|^)\\*{2}[^\\s*]", + "end": "\\*{2}|^\\s*$", + "name": "markup.bold" + }, + "italic": { + "begin": "(?<=[\\s\"'(\\[{<]|^)\\*[^\\s*]", + "end": "\\*|^\\s*$", + "name": "markup.italic" + }, + "escaped": { + "match": "\\\\.", + "name": "constant.character.escape" + }, + "list": { + "match": "^\\s*(\\d+\\.|\\* -|[a-zA-Z#]\\.|[iIvVxXmMcC]+\\.|\\(\\d+\\)|\\d+\\)|[*+-])\\s+", + "name": "keyword.control" + }, + "line-block": { + "match": "^\\|\\s+", + "name": "keyword.control" + }, + "raw-html": { + "begin": "^(\\s*)(\\.{2}\\s+raw\\s*::)\\s+(html)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "3": { + "name": "variable.parameter.html" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "text.html.derivative" + } + ] + }, + "anchor": { + "match": "^\\.{2}\\s+(_[^:]+:)\\s*", + "name": "entity.name.tag.anchor" + }, + "replace-include": { + "match": "^\\s*(\\.{2})\\s+(\\|[^\\|]+\\|)\\s+(replace::)", + "captures": { + "1": { + "name": "keyword.control" + }, + "2": { + "name": "entity.name.tag" + }, + "3": { + "name": "keyword.control" + } + } + }, + "footnote": { + "match": "^\\s*\\.{2}\\s+\\[(?:[\\w\\.-]+|[#*]|#\\w+)\\]\\s+", + "name": "entity.name.tag" + }, + "footnote-ref": { + "match": "\\[(?:[\\w\\.-]+|[#*])\\]_", + "name": "entity.name.tag" + }, + "substitution": { + "match": "^\\.{2}\\s*\\|([^|]+)\\|", + "name": "entity.name.tag" + }, + "options-list": { + "match": "^((?:-\\w|--[\\w-]+|/\\w+)(?:,? ?[\\w-]+)*)(?: |\\t|$)", + "name": "variable.parameter" + }, + "blocks": { + "patterns": [ + { + "include": "#domains" + }, + { + "include": "#doctest" + }, + { + "include": "#code-block-cpp" + }, + { + "include": "#code-block-py" + }, + { + "include": "#code-block-console" + }, + { + "include": "#code-block-javascript" + }, + { + "include": "#code-block-yaml" + }, + { + "include": "#code-block-cmake" + }, + { + "include": "#code-block-kconfig" + }, + { + "include": "#code-block-ruby" + }, + { + "include": "#code-block-dts" + }, + { + "include": "#code-block" + }, + { + "include": "#doctest-block" + }, + { + "include": "#raw-html" + }, + { + "include": "#block" + }, + { + "include": "#literal-block" + }, + { + "include": "#block-comment" + } + ] + }, + "block-comment": { + "begin": "^(\\s*)\\.{2}", + "while": "^\\1(?=\\s)|^\\s*$", + "name": "comment.block" + }, + "literal-block": { + "begin": "^(\\s*)(.*)(::)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "patterns": [ + { + "include": "#inline-markup" + } + ] + }, + "3": { + "name": "keyword.control" + } + } + }, + "block": { + "begin": "^(\\s*)(\\.{2}\\s+\\S+::)(.*)", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "3": { + "name": "variable" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "#body" + } + ] + }, + "block-param": { + "patterns": [ + { + "match": "(:param\\s+(.+?):)(?:\\s|$)", + "captures": { + "1": { + "name": "keyword.control" + }, + "2": { + "name": "variable.parameter" + } + } + }, + { + "match": "(:.+?:)(?:$|\\s+(.*))", + "captures": { + "1": { + "name": "keyword.control" + }, + "2": { + "patterns": [ + { + "match": "\\b(0x[a-fA-F\\d]+|\\d+)\\b", + "name": "constant.numeric" + }, + { + "include": "#inline-markup" + } + ] + } + } + } + ] + }, + "domains": { + "patterns": [ + { + "include": "#domain-cpp" + }, + { + "include": "#domain-py" + }, + { + "include": "#domain-auto" + }, + { + "include": "#domain-js" + } + ] + }, + "domain-cpp": { + "begin": "^(\\s*)(\\.{2}\\s+(?:cpp|c):(?:class|struct|function|member|var|type|enum|enum-struct|enum-class|enumerator|union|concept)::)\\s*(?:(@\\w+)|(.*))", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "3": { + "name": "entity.name.tag" + }, + "4": { + "patterns": [ + { + "include": "source.cpp" + } + ] + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "#body" + } + ] + }, + "domain-py": { + "begin": "^(\\s*)(\\.{2}\\s+py:(?:module|function|data|exception|class|attribute|property|method|staticmethod|classmethod|decorator|decoratormethod)::)\\s*(.*)", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "3": { + "patterns": [ + { + "include": "source.python" + } + ] + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "#body" + } + ] + }, + "domain-auto": { + "begin": "^(\\s*)(\\.{2}\\s+auto(?:class|module|exception|function|decorator|data|method|attribute|property)::)\\s*(.*)", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control.py" + }, + "3": { + "patterns": [ + { + "include": "source.python" + } + ] + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "#body" + } + ] + }, + "domain-js": { + "begin": "^(\\s*)(\\.{2}\\s+js:\\w+::)\\s*(.*)", + "end": "^(?!\\1[ \\t]|$)", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "3": { + "patterns": [ + { + "include": "source.js" + } + ] + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "#body" + } + ] + }, + "doctest": { + "begin": "^(>>>)\\s*(.*)", + "end": "^\\s*$", + "beginCaptures": { + "1": { + "name": "keyword.control" + }, + "2": { + "patterns": [ + { + "include": "source.python" + } + ] + } + } + }, + "code-block-cpp": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(c|c\\+\\+|cpp|C|C\\+\\+|CPP|Cpp)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.cpp" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.cpp" + } + ] + }, + "code-block-console": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(console|shell|bash)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.console" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.shell" + } + ] + }, + "code-block-py": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(python)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.py" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.python" + } + ] + }, + "code-block-javascript": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(javascript)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.js" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.js" + } + ] + }, + "code-block-yaml": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(ya?ml)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.yaml" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.yaml" + } + ] + }, + "code-block-cmake": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(cmake)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.cmake" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.cmake" + } + ] + }, + "code-block-kconfig": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*([kK]config)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.kconfig" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.kconfig" + } + ] + }, + "code-block-ruby": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(ruby)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.ruby" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.ruby" + } + ] + }, + "code-block-dts": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)\\s*(dts|DTS|devicetree)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + }, + "4": { + "name": "variable.parameter.codeblock.dts" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.dts" + } + ] + }, + "code-block": { + "begin": "^(\\s*)(\\.{2}\\s+(code|code-block)::)", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + } + }, + "patterns": [ + { + "include": "#block-param" + } + ] + }, + "doctest-block": { + "begin": "^(\\s*)(\\.{2}\\s+doctest::)\\s*$", + "while": "^\\1(?=\\s)|^\\s*$", + "beginCaptures": { + "2": { + "name": "keyword.control" + } + }, + "patterns": [ + { + "include": "#block-param" + }, + { + "include": "source.python" + } + ] + } + }, + "name": "rst" +} diff --git a/apps/web/public/assets/shiki/languages/scala.tmLanguage.json b/apps/web/public/assets/shiki/languages/scala.tmLanguage.json index 663ce0f3..eb65bf0e 100644 --- a/apps/web/public/assets/shiki/languages/scala.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/scala.tmLanguage.json @@ -603,6 +603,14 @@ } } }, + { + "match": "\\b(catch|finally|try)\\b", + "name": "keyword.control.exception.scala" + }, + { + "match": "^\\s*(end)\\s+(try)(?=\\s*(//.*|/\\*(?!.*\\*/\\s*\\S.*).*)?$)", + "name": "keyword.control.exception.end.scala" + }, { "match": "^\\s*(end)\\s+(`[^`]+`|(?:[A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}][A-Z\\p{Lt}\\p{Lu}_a-z\\$\\p{Lo}\\p{Nl}\\p{Ll}0-9]*(?:(?<=_)[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+)?|[!#%&*+\\-\\/:<>=?@^|~\\p{Sm}\\p{So}]+))?(?=\\s*(//.*|/\\*(?!.*\\*/\\s*\\S.*).*)?$)", "captures": { @@ -614,10 +622,6 @@ } } }, - { - "match": "\\b(catch|finally|try)\\b", - "name": "keyword.control.exception.scala" - }, { "match": "(==?|!=|<=|>=|<>|<|>)", "name": "keyword.operator.comparison.scala" diff --git a/apps/web/public/assets/shiki/languages/shellscript.tmLanguage.json b/apps/web/public/assets/shiki/languages/shellscript.tmLanguage.json index a8635c89..a8d489eb 100644 --- a/apps/web/public/assets/shiki/languages/shellscript.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/shellscript.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/atom/language-shellscript/commit/4c3711edbe8eac6f501976893976b1ac6a043d50", + "version": "https://github.com/atom/language-shellscript/commit/4f8d7bb5cc4d1643674551683df10fe552dd5a6f", "name": "shellscript", "scopeName": "source.shell", "patterns": [ @@ -624,7 +624,7 @@ ] }, { - "begin": "(<<)-\\s*(\"|'|)\\s*\\\\?([^;&<\\s]+)\\2", + "begin": "(<<)-\\s*(\"|')\\s*\\\\?([^;&<\\s]+)\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -642,7 +642,7 @@ "name": "string.unquoted.heredoc.no-indent.shell" }, { - "begin": "(<<)\\s*(\"|'|)\\s*\\\\?([^;&<\\s]+)\\2", + "begin": "(<<)\\s*(\"|')\\s*\\\\?([^;&<\\s]+)\\2", "beginCaptures": { "1": { "name": "keyword.operator.heredoc.shell" @@ -658,6 +658,66 @@ } }, "name": "string.unquoted.heredoc.shell" + }, + { + "begin": "(<<)-\\s*\\\\?([^;&<\\s]+)", + "beginCaptures": { + "1": { + "name": "keyword.operator.heredoc.shell" + }, + "2": { + "name": "keyword.control.heredoc-token.shell" + } + }, + "end": "^\\t*(\\2)(?=\\s|;|&|$)", + "endCaptures": { + "1": { + "name": "keyword.control.heredoc-token.shell" + } + }, + "name": "string.unquoted.heredoc.expanded.no-indent.shell", + "patterns": [ + { + "match": "\\\\[\\$`\\\\\\n]", + "name": "constant.character.escape.shell" + }, + { + "include": "#variable" + }, + { + "include": "#interpolation" + } + ] + }, + { + "begin": "(<<)\\s*\\\\?([^;&<\\s]+)", + "beginCaptures": { + "1": { + "name": "keyword.operator.heredoc.shell" + }, + "2": { + "name": "keyword.control.heredoc-token.shell" + } + }, + "end": "^(\\2)(?=\\s|;|&|$)", + "endCaptures": { + "1": { + "name": "keyword.control.heredoc-token.shell" + } + }, + "name": "string.unquoted.heredoc.expanded.shell", + "patterns": [ + { + "match": "\\\\[\\$`\\\\\\n]", + "name": "constant.character.escape.shell" + }, + { + "include": "#variable" + }, + { + "include": "#interpolation" + } + ] } ] }, diff --git a/apps/web/public/assets/shiki/languages/solidity.tmLanguage.json b/apps/web/public/assets/shiki/languages/solidity.tmLanguage.json index ad408644..93bfbcdf 100644 --- a/apps/web/public/assets/shiki/languages/solidity.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/solidity.tmLanguage.json @@ -120,8 +120,15 @@ } }, "natspec-tag-return": { - "match": "(@return)\\b", - "name": "storage.type.return.natspec" + "match": "(@return)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.return.natspec" + }, + "3": { + "name": "variable.other.natspec" + } + } }, "comment": { "patterns": [ @@ -177,7 +184,7 @@ ] }, "operator-logic": { - "match": "(==|<(?!<)|<=|>(?!>)|>=|\\&\\&|\\|\\||\\:(?!=)|\\?)", + "match": "(==|\\!=|<(?!<)|<=|>(?!>)|>=|\\&\\&|\\|\\||\\:(?!=)|\\?|\\!)", "name": "keyword.operator.logic" }, "operator-mapping": { @@ -652,17 +659,6 @@ }, "declaration-contract": { "patterns": [ - { - "match": "\\b(contract)\\b\\s+(\\w+)\\b\\s*(?=\\{)", - "captures": { - "1": { - "name": "storage.type.contract" - }, - "2": { - "name": "entity.name.type.contract" - } - } - }, { "begin": "\\b(contract)\\b\\s+(\\w+)\\b\\s+\\b(is)\\b\\s+", "end": "(?=\\{)", @@ -683,22 +679,22 @@ "name": "entity.name.type.contract.extend" } ] - } - ] - }, - "declaration-interface": { - "patterns": [ + }, { - "match": "\\b(interface)\\b\\s+(\\w+)\\b\\s*(?=\\{)", + "match": "\\b(contract)(\\s+([A-Za-z_]\\w*))?\\b", "captures": { "1": { - "name": "storage.type.interface" + "name": "storage.type.contract" }, "2": { - "name": "entity.name.type.interface" + "name": "entity.name.type.contract" } } - }, + } + ] + }, + "declaration-interface": { + "patterns": [ { "begin": "\\b(interface)\\b\\s+(\\w+)\\b\\s+\\b(is)\\b\\s+", "end": "(?=\\{)", @@ -719,6 +715,17 @@ "name": "entity.name.type.interface.extend" } ] + }, + { + "match": "\\b(interface)(\\s+([A-Za-z_]\\w*))?\\b", + "captures": { + "1": { + "name": "storage.type.interface" + }, + "2": { + "name": "entity.name.type.interface" + } + } } ] }, diff --git a/apps/web/public/assets/shiki/languages/sql.tmLanguage.json b/apps/web/public/assets/shiki/languages/sql.tmLanguage.json index 7d0421ed..1d58511a 100644 --- a/apps/web/public/assets/shiki/languages/sql.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/sql.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/microsoft/vscode-mssql/commit/c98518dd7418ddfb6f35676e14cf12791b0a235d", + "version": "https://github.com/microsoft/vscode-mssql/commit/b8b58864526c048002b7c3964bdac8aac3713bd9", "name": "sql", "scopeName": "source.sql", "patterns": [ @@ -191,7 +191,7 @@ "name": "keyword.operator.concatenator.sql" }, { - "match": "(?i)\\b(avg|checksum_agg|count|count_big|grouping|grouping_id|max|min|sum|stdev|stdevp|var|varp)\\b", + "match": "(?i)\\b(aggregate|approx_count_distinct|avg|checksum_agg|count|count_big|grouping|grouping_id|max|min|sum|stdev|stdevp|var|varp)\\b", "name": "support.function.aggregate.sql" }, { @@ -202,14 +202,26 @@ "match": "(?i)\\b(cast|convert|parse|try_cast|try_convert|try_parse)\\b", "name": "support.function.conversion.sql" }, + { + "match": "(?i)\\b(collationproperty|tertiary_weights)\\b", + "name": "support.function.collation.sql" + }, + { + "match": "(?i)\\b(asymkey_id|asymkeyproperty|certproperty|cert_id|crypt_gen_random|decryptbyasymkey|decryptbycert|decryptbykey|decryptbykeyautoasymkey|decryptbykeyautocert|decryptbypassphrase|encryptbyasymkey|encryptbycert|encryptbykey|encryptbypassphrase|hashbytes|is_objectsigned|key_guid|key_id|key_name|signbyasymkey|signbycert|symkeyproperty|verifysignedbycert|verifysignedbyasymkey)\\b", + "name": "support.function.cryptographic.sql" + }, { "match": "(?i)\\b(cursor_status)\\b", "name": "support.function.cursor.sql" }, { - "match": "(?i)\\b(sysdatetime|sysdatetimeoffset|sysutcdatetime|current_time(stamp)?|getdate|getutcdate|datename|datepart|day|month|year|datefromparts|datetime2fromparts|datetimefromparts|datetimeoffsetfromparts|smalldatetimefromparts|timefromparts|datediff|dateadd|eomonth|switchoffset|todatetimeoffset|isdate)\\b", + "match": "(?i)\\b(sysdatetime|sysdatetimeoffset|sysutcdatetime|current_time(stamp)?|getdate|getutcdate|datename|datepart|day|month|year|datefromparts|datetime2fromparts|datetimefromparts|datetimeoffsetfromparts|smalldatetimefromparts|timefromparts|datediff|dateadd|eomonth|switchoffset|todatetimeoffset|isdate|date_bucket)\\b", "name": "support.function.datetime.sql" }, + { + "match": "(?i)\\b(datalength|ident_current|ident_incr|ident_seed|identity|sql_variant_property)\\b", + "name": "support.function.datatype.sql" + }, { "match": "(?i)\\b(coalesce|nullif)\\b", "name": "support.function.expression.sql" @@ -219,7 +231,11 @@ "name": "support.function.globalvar.sql" }, { - "match": "(?i)\\b(choose|iif)\\b", + "match": "(?i)\\b(json|isjson|json_object|json_array|json_value|json_query|json_modify|json_path_exists)\\b", + "name": "support.function.json.sql" + }, + { + "match": "(?i)\\b(choose|iif|greatest|least)\\b", "name": "support.function.logical.sql" }, { @@ -235,7 +251,7 @@ "name": "support.function.ranking.sql" }, { - "match": "(?i)\\b(opendatasource|openrowset|openquery|openxml)\\b", + "match": "(?i)\\b(generate_series|opendatasource|openjson|openrowset|openquery|openxml|predict|string_split)\\b", "name": "support.function.rowset.sql" }, { diff --git a/apps/web/public/assets/shiki/languages/swift.tmLanguage.json b/apps/web/public/assets/shiki/languages/swift.tmLanguage.json index 81e5e9dc..0081b141 100644 --- a/apps/web/public/assets/shiki/languages/swift.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/swift.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/textmate/swift.tmbundle/commit/8c7672d74c1baa4e6944a05ac6c57a623532f18b", + "version": "https://github.com/textmate/swift.tmbundle/commit/7a35637eb70aef3114b091c4ff6fbf6a2faa881b", "name": "swift", "scopeName": "source.swift", "comment": "See swift.tmbundle/grammar-test.swift for test cases.", @@ -109,7 +109,7 @@ "name": "invalid.illegal.character-not-allowed-here.swift" } }, - "match": "(?:(\\*)|\\b(deprecated|unavailable)\\b)\\s*(.*?)(?=[,)])" + "match": "(?:(\\*)|\\b(deprecated|unavailable|noasync)\\b)\\s*(.*?)(?=[,)])" } ] }, @@ -818,7 +818,11 @@ "name": "keyword.operator.type.opaque.swift" }, { - "match": "\\binout\\b", + "match": "\\bany\\b", + "name": "keyword.operator.type.existential.swift" + }, + { + "match": "\\b(?:inout|isolated)\\b", "name": "storage.modifier.swift" }, { @@ -986,19 +990,22 @@ ] }, "function": { - "begin": "(?x)\n\t\t\t\t\t\t\\b\n\t\t\t\t\t\t(func)\n\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)\n\t\t\t\t\t\t | (?:\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?\t\t\t\t\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\\g\n\t\t\t\t\t\t\t\t\t | (?\t\t\t\t\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t\t\t[\\x{0300}-\\x{036F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)*\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t | ( \\. ( \\g | \\g | \\. )+ )\t\t\t# Dot operators\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t(?=\\(|<)\n\t\t\t\t\t", + "begin": "(?x)\n\t\t\t\t\t\t\\b\n\t\t\t\t\t\t(?:(nonisolated)\\s+)?\n\t\t\t\t\t\t(func)\n\t\t\t\t\t\t\\s+\n\t\t\t\t\t\t(\n\t\t\t\t\t\t\t(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)\n\t\t\t\t\t\t | (?:\n\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t(?\t\t\t\t\t\t\t\t# operator-head\n\t\t\t\t\t\t\t\t\t\t[/=\\-+!*%<>&|^~?]\n\t\t\t\t\t\t\t\t\t | [\\x{00A1}-\\x{00A7}]\n\t\t\t\t\t\t\t\t\t | [\\x{00A9}\\x{00AB}]\n\t\t\t\t\t\t\t\t\t | [\\x{00AC}\\x{00AE}]\n\t\t\t\t\t\t\t\t\t | [\\x{00B0}-\\x{00B1}\\x{00B6}\\x{00BB}\\x{00BF}\\x{00D7}\\x{00F7}]\n\t\t\t\t\t\t\t\t\t | [\\x{2016}-\\x{2017}\\x{2020}-\\x{2027}]\n\t\t\t\t\t\t\t\t\t | [\\x{2030}-\\x{203E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2041}-\\x{2053}]\n\t\t\t\t\t\t\t\t\t | [\\x{2055}-\\x{205E}]\n\t\t\t\t\t\t\t\t\t | [\\x{2190}-\\x{23FF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2500}-\\x{2775}]\n\t\t\t\t\t\t\t\t\t | [\\x{2794}-\\x{2BFF}]\n\t\t\t\t\t\t\t\t\t | [\\x{2E00}-\\x{2E7F}]\n\t\t\t\t\t\t\t\t\t | [\\x{3001}-\\x{3003}]\n\t\t\t\t\t\t\t\t\t | [\\x{3008}-\\x{3030}]\n\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t(\n\t\t\t\t\t\t\t\t\t\t\\g\n\t\t\t\t\t\t\t\t\t | (?\t\t\t\t\t\t\t\t# operator-character\n\t\t\t\t\t\t\t\t\t\t\t[\\x{0300}-\\x{036F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{1DC0}-\\x{1DFF}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{20D0}-\\x{20FF}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{FE00}-\\x{FE0F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{FE20}-\\x{FE2F}]\n\t\t\t\t\t\t\t\t\t\t | [\\x{E0100}-\\x{E01EF}]\n\t\t\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\t\t)*\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t | ( \\. ( \\g | \\g | \\. )+ )\t\t\t# Dot operators\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t)\n\t\t\t\t\t\t\\s*\n\t\t\t\t\t\t(?=\\(|<)\n\t\t\t\t\t", "beginCaptures": { "1": { - "name": "storage.type.function.swift" + "name": "storage.modifier.swift" }, "2": { - "name": "entity.name.function.swift" + "name": "storage.type.function.swift" }, "3": { - "name": "punctuation.definition.identifier.swift" + "name": "entity.name.function.swift" }, "4": { "name": "punctuation.definition.identifier.swift" + }, + "5": { + "name": "punctuation.definition.identifier.swift" } }, "end": "(?<=\\})|$(?# functions in protocol declarations or generated interfaces have no body)", @@ -2253,9 +2260,12 @@ ] }, "typed-variable-declaration": { - "begin": "(?x)\n\t\t\t\t\t\t\\b(let|var)\\b\\s+\n\t\t\t\t\t\t(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)\\s*\n\t\t\t\t\t\t:\n\t\t\t\t\t", + "begin": "(?x)\n\t\t\t\t\t\t\\b(?:(async)\\s+)?(let|var)\\b\\s+\n\t\t\t\t\t\t(?`?)[\\p{L}_][\\p{L}_\\p{N}\\p{M}]*(\\k)\\s*\n\t\t\t\t\t\t:\n\t\t\t\t\t", "beginCaptures": { "1": { + "name": "keyword.control.async.swift" + }, + "2": { "name": "keyword.other.declaration-specifier.swift" } }, @@ -2641,7 +2651,21 @@ "match": "(?\\]\\)\\.\\|]|\\\\[{}|]|\\\\[lr]?[Vv]ert|\\\\[lr]angle|\\\\\\|)", + "match": "\\\\(left|right|((big|bigg|Big|Bigg)[lr]?))([\\(\\[\\<\\>\\]\\)\\.\\|]|\\\\[{}|]|\\\\[lr]?[Vv]ert|\\\\[lr]angle)", "name": "punctuation.math.bracket.pair.big.tex" }, { diff --git a/apps/web/public/assets/shiki/languages/tsx.tmLanguage.json b/apps/web/public/assets/shiki/languages/tsx.tmLanguage.json index dbce87c6..40ca8c4e 100644 --- a/apps/web/public/assets/shiki/languages/tsx.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/tsx.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/56b7270f094b036256774702e3b7f96490981190", + "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/0dfae8cc4807fecfbf8f1add095d9817df824c95", "name": "tsx", "scopeName": "source.tsx", "patterns": [ @@ -2271,11 +2271,47 @@ "name": "keyword.control.from.tsx", "match": "\\bfrom\\b" }, + { + "include": "#import-export-assert-clause" + }, { "include": "#import-export-clause" } ] }, + "import-export-assert-clause": { + "begin": "(?\\s*$)", + "begin": "^(///)\\s*(?=<(reference|amd-dependency|amd-module)(\\s+(path|types|no-default-lib|lib|name|resolution-mode)\\s*=\\s*((\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`)))+\\s*/>\\s*$)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.tsx" @@ -5123,7 +5128,7 @@ "patterns": [ { "name": "entity.other.attribute-name.directive.tsx", - "match": "path|types|no-default-lib|lib|name" + "match": "path|types|no-default-lib|lib|name|resolution-mode" }, { "name": "keyword.operator.assignment.tsx", diff --git a/apps/web/public/assets/shiki/languages/typescript.tmLanguage.json b/apps/web/public/assets/shiki/languages/typescript.tmLanguage.json index 4e0e30e0..4ca0b649 100644 --- a/apps/web/public/assets/shiki/languages/typescript.tmLanguage.json +++ b/apps/web/public/assets/shiki/languages/typescript.tmLanguage.json @@ -4,7 +4,7 @@ "If you want to provide a fix or improvement, please create a pull request against the original repository.", "Once accepted there, we are happy to receive an update request." ], - "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/56b7270f094b036256774702e3b7f96490981190", + "version": "https://github.com/microsoft/TypeScript-TmLanguage/commit/0dfae8cc4807fecfbf8f1add095d9817df824c95", "name": "typescript", "scopeName": "source.ts", "patterns": [ @@ -2268,11 +2268,47 @@ "name": "keyword.control.from.ts", "match": "\\bfrom\\b" }, + { + "include": "#import-export-assert-clause" + }, { "include": "#import-export-clause" } ] }, + "import-export-assert-clause": { + "begin": "(?\\s*$)", + "begin": "^(///)\\s*(?=<(reference|amd-dependency|amd-module)(\\s+(path|types|no-default-lib|lib|name|resolution-mode)\\s*=\\s*((\\'([^\\'\\\\]|\\\\.)*\\')|(\\\"([^\\\"\\\\]|\\\\.)*\\\")|(\\`([^\\`\\\\]|\\\\.)*\\`)))+\\s*/>\\s*$)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.ts" @@ -5172,7 +5177,7 @@ "patterns": [ { "name": "entity.other.attribute-name.directive.ts", - "match": "path|types|no-default-lib|lib|name" + "match": "path|types|no-default-lib|lib|name|resolution-mode" }, { "name": "keyword.operator.assignment.ts", diff --git a/apps/web/public/assets/shiki/themes/css-variables.json b/apps/web/public/assets/shiki/themes/css-variables.json index d46297a3..b6ba2a30 100644 --- a/apps/web/public/assets/shiki/themes/css-variables.json +++ b/apps/web/public/assets/shiki/themes/css-variables.json @@ -1,6 +1,6 @@ { "name": "css-variables", - "type": "light", + "type": "css", "colors": { "editor.foreground": "#000001", "editor.background": "#000002" diff --git a/apps/web/public/assets/shiki/themes/dark-plus.json b/apps/web/public/assets/shiki/themes/dark-plus.json index 44c07efa..dd99cd27 100644 --- a/apps/web/public/assets/shiki/themes/dark-plus.json +++ b/apps/web/public/assets/shiki/themes/dark-plus.json @@ -8,7 +8,7 @@ } }, { - "scope": ["meta.embedded", "source.groovy.embedded"], + "scope": ["meta.embedded", "source.groovy.embedded", "string meta.image.inline.markdown"], "settings": { "foreground": "#D4D4D4" } @@ -551,7 +551,7 @@ "activityBarBadge.background": "#007ACC", "sideBarTitle.foreground": "#BBBBBB", "input.placeholderForeground": "#A6A6A6", - "menu.background": "#252526", + "menu.background": "#303031", "menu.foreground": "#CCCCCC", "statusBarItem.remoteForeground": "#FFF", "statusBarItem.remoteBackground": "#16825D", diff --git a/apps/web/public/assets/shiki/themes/dracula-soft.json b/apps/web/public/assets/shiki/themes/dracula-soft.json index e1355fb3..cefc87c7 100644 --- a/apps/web/public/assets/shiki/themes/dracula-soft.json +++ b/apps/web/public/assets/shiki/themes/dracula-soft.json @@ -125,7 +125,7 @@ "editorLineNumber.foreground": "#7b7f8b", "editor.selectionBackground": "#44475A", "editor.selectionHighlightBackground": "#424450", - "editor.foldBackground": "#262626", + "editor.foldBackground": "#21222C80", "editor.wordHighlightBackground": "#8BE9FD50", "editor.wordHighlightStrongBackground": "#50FA7B50", "editor.findMatchBackground": "#FFB86C80", @@ -694,6 +694,7 @@ "punctuation.definition.type.end", "punctuation.section.scope.begin", "punctuation.section.scope.end", + "punctuation.terminator.expression.php", "storage.type.generic.java", "string.template meta.brace", "string.template punctuation.accessor" @@ -920,7 +921,6 @@ "name": "Destructuring / aliasing reference name (LHS)", "scope": [ "meta.import variable.other.readwrite", - "meta.object-binding-pattern-variable variable.object.property", "meta.variable.assignment.destructured.object.coffee variable" ], "settings": { diff --git a/apps/web/public/assets/shiki/themes/dracula.json b/apps/web/public/assets/shiki/themes/dracula.json index 3aeca7f3..b9de3bb7 100644 --- a/apps/web/public/assets/shiki/themes/dracula.json +++ b/apps/web/public/assets/shiki/themes/dracula.json @@ -125,7 +125,7 @@ "editorLineNumber.foreground": "#6272A4", "editor.selectionBackground": "#44475A", "editor.selectionHighlightBackground": "#424450", - "editor.foldBackground": "#21222C", + "editor.foldBackground": "#21222C80", "editor.wordHighlightBackground": "#8BE9FD50", "editor.wordHighlightStrongBackground": "#50FA7B50", "editor.findMatchBackground": "#FFB86C80", @@ -694,6 +694,7 @@ "punctuation.definition.type.end", "punctuation.section.scope.begin", "punctuation.section.scope.end", + "punctuation.terminator.expression.php", "storage.type.generic.java", "string.template meta.brace", "string.template punctuation.accessor" @@ -920,7 +921,6 @@ "name": "Destructuring / aliasing reference name (LHS)", "scope": [ "meta.import variable.other.readwrite", - "meta.object-binding-pattern-variable variable.object.property", "meta.variable.assignment.destructured.object.coffee variable" ], "settings": { diff --git a/apps/web/public/assets/shiki/themes/github-dark-dimmed.json b/apps/web/public/assets/shiki/themes/github-dark-dimmed.json index 6a02e4df..ca580374 100644 --- a/apps/web/public/assets/shiki/themes/github-dark-dimmed.json +++ b/apps/web/public/assets/shiki/themes/github-dark-dimmed.json @@ -12,6 +12,8 @@ "textCodeBlock.background": "#636e7b66", "textPreformat.foreground": "#768390", "textSeparator.foreground": "#373e47", + "icon.foreground": "#768390", + "keybindingLabel.foreground": "#adbac7", "button.background": "#347d39", "button.foreground": "#ffffff", "button.hoverBackground": "#46954a", @@ -76,10 +78,16 @@ "statusBar.foreground": "#768390", "statusBar.background": "#22272e", "statusBar.border": "#444c56", + "statusBar.focusBorder": "#316dca80", "statusBar.noFolderBackground": "#22272e", - "statusBar.debuggingBackground": "#c93c37", "statusBar.debuggingForeground": "#cdd9e5", - "statusBarItem.prominentBackground": "#2d333b", + "statusBar.debuggingBackground": "#c93c37", + "statusBarItem.prominentBackground": "#636e7b66", + "statusBarItem.remoteForeground": "#adbac7", + "statusBarItem.remoteBackground": "#444c56", + "statusBarItem.hoverBackground": "#adbac714", + "statusBarItem.activeBackground": "#adbac71f", + "statusBarItem.focusBorder": "#316dca", "editorGroupHeader.tabsBackground": "#1c2128", "editorGroupHeader.tabsBorder": "#444c56", "editorGroup.border": "#444c56", @@ -103,17 +111,15 @@ "editorWidget.background": "#2d333b", "editor.foldBackground": "#636e7b1a", "editor.lineHighlightBackground": "#636e7b1a", - "editorLineNumber.foreground": "#768390", + "editorLineNumber.foreground": "#636e7b", "editorLineNumber.activeForeground": "#adbac7", - "editorIndentGuide.background": "#373e47", - "editorIndentGuide.activeBackground": "#444c56", + "editorIndentGuide.background": "#adbac71f", + "editorIndentGuide.activeBackground": "#adbac73d", "editorWhitespace.foreground": "#545d68", "editorCursor.foreground": "#539bf5", "editor.findMatchBackground": "#966600", "editor.findMatchHighlightBackground": "#eac55f80", "editor.linkedEditingBackground": "#539bf512", - "editor.inactiveSelectionBackground": "#539bf512", - "editor.selectionBackground": "#539bf533", "editor.selectionHighlightBackground": "#57ab5a40", "editor.wordHighlightBackground": "#636e7b80", "editor.wordHighlightBorder": "#636e7b99", @@ -121,11 +127,19 @@ "editor.wordHighlightStrongBorder": "#636e7b99", "editorBracketMatch.background": "#57ab5a40", "editorBracketMatch.border": "#57ab5a99", + "editorInlayHint.background": "#76839033", + "editorInlayHint.foreground": "#768390", + "editorInlayHint.typeBackground": "#76839033", + "editorInlayHint.typeForeground": "#768390", + "editorInlayHint.paramBackground": "#76839033", + "editorInlayHint.paramForeground": "#768390", "editorGutter.modifiedBackground": "#ae7c1466", "editorGutter.addedBackground": "#46954a66", "editorGutter.deletedBackground": "#e5534b66", - "diffEditor.insertedTextBackground": "#46954a26", - "diffEditor.removedTextBackground": "#e5534b26", + "diffEditor.insertedLineBackground": "#347d3933", + "diffEditor.insertedTextBackground": "#347d394d", + "diffEditor.removedLineBackground": "#c93c3733", + "diffEditor.removedTextBackground": "#c93c374d", "scrollbar.shadow": "#545d6833", "scrollbarSlider.background": "#636e7b33", "scrollbarSlider.hoverBackground": "#636e7b45", @@ -137,7 +151,63 @@ "panelTitle.activeForeground": "#adbac7", "panelTitle.inactiveForeground": "#768390", "panelInput.border": "#444c56", - "terminal.foreground": "#768390", + "debugIcon.breakpointForeground": "#e5534b", + "debugConsole.infoForeground": "#768390", + "debugConsole.warningForeground": "#c69026", + "debugConsole.errorForeground": "#ff938a", + "debugConsole.sourceForeground": "#daaa3f", + "debugConsoleInputIcon.foreground": "#b083f0", + "debugTokenExpression.name": "#6cb6ff", + "debugTokenExpression.value": "#96d0ff", + "debugTokenExpression.string": "#96d0ff", + "debugTokenExpression.boolean": "#6bc46d", + "debugTokenExpression.number": "#6bc46d", + "debugTokenExpression.error": "#ff938a", + "symbolIcon.arrayForeground": "#e0823d", + "symbolIcon.booleanForeground": "#539bf5", + "symbolIcon.classForeground": "#e0823d", + "symbolIcon.colorForeground": "#6cb6ff", + "symbolIcon.constructorForeground": "#dcbdfb", + "symbolIcon.enumeratorForeground": "#e0823d", + "symbolIcon.enumeratorMemberForeground": "#539bf5", + "symbolIcon.eventForeground": "#636e7b", + "symbolIcon.fieldForeground": "#e0823d", + "symbolIcon.fileForeground": "#c69026", + "symbolIcon.folderForeground": "#c69026", + "symbolIcon.functionForeground": "#b083f0", + "symbolIcon.interfaceForeground": "#e0823d", + "symbolIcon.keyForeground": "#539bf5", + "symbolIcon.keywordForeground": "#f47067", + "symbolIcon.methodForeground": "#b083f0", + "symbolIcon.moduleForeground": "#f47067", + "symbolIcon.namespaceForeground": "#f47067", + "symbolIcon.nullForeground": "#539bf5", + "symbolIcon.numberForeground": "#57ab5a", + "symbolIcon.objectForeground": "#e0823d", + "symbolIcon.operatorForeground": "#6cb6ff", + "symbolIcon.packageForeground": "#e0823d", + "symbolIcon.propertyForeground": "#e0823d", + "symbolIcon.referenceForeground": "#539bf5", + "symbolIcon.snippetForeground": "#539bf5", + "symbolIcon.stringForeground": "#6cb6ff", + "symbolIcon.structForeground": "#e0823d", + "symbolIcon.textForeground": "#6cb6ff", + "symbolIcon.typeParameterForeground": "#6cb6ff", + "symbolIcon.unitForeground": "#539bf5", + "symbolIcon.variableForeground": "#e0823d", + "symbolIcon.constantForeground": [ + "#b4f1b4", + "#8ddb8c", + "#6bc46d", + "#57ab5a", + "#46954a", + "#347d39", + "#2b6a30", + "#245829", + "#1b4721", + "#113417" + ], + "terminal.foreground": "#adbac7", "terminal.ansiBlack": "#545d68", "terminal.ansiRed": "#f47067", "terminal.ansiGreen": "#57ab5a", @@ -154,6 +224,13 @@ "terminal.ansiBrightMagenta": "#dcbdfb", "terminal.ansiBrightCyan": "#56d4dd", "terminal.ansiBrightWhite": "#cdd9e5", + "editorBracketHighlight.foreground1": "#6cb6ff", + "editorBracketHighlight.foreground2": "#6bc46d", + "editorBracketHighlight.foreground3": "#daaa3f", + "editorBracketHighlight.foreground4": "#ff938a", + "editorBracketHighlight.foreground5": "#fc8dc7", + "editorBracketHighlight.foreground6": "#dcbdfb", + "editorBracketHighlight.unexpectedBracket.foreground": "#768390", "gitDecoration.addedResourceForeground": "#57ab5a", "gitDecoration.modifiedResourceForeground": "#c69026", "gitDecoration.deletedResourceForeground": "#e5534b", @@ -186,6 +263,7 @@ "constant", "entity.name.constant", "variable.other.constant", + "variable.other.enummember", "variable.language", "entity" ], @@ -244,11 +322,7 @@ } }, { - "scope": [ - "string", - "punctuation.definition.string", - "string punctuation.section.embedded source" - ], + "scope": ["string", "string punctuation.section.embedded source"], "settings": { "foreground": "#96d0ff" } @@ -320,12 +394,6 @@ "foreground": "#ff938a" } }, - { - "scope": "string source", - "settings": { - "foreground": "#adbac7" - } - }, { "scope": "string variable", "settings": { @@ -368,6 +436,12 @@ "foreground": "#6cb6ff" } }, + { + "scope": "support.type.property-name.json", + "settings": { + "foreground": "#8ddb8c" + } + }, { "scope": "meta.module-reference", "settings": { @@ -408,7 +482,19 @@ } }, { - "scope": "markup.raw", + "scope": ["markup.underline"], + "settings": { + "fontStyle": "underline" + } + }, + { + "scope": ["markup.strikethrough"], + "settings": { + "fontStyle": "strikethrough" + } + }, + { + "scope": "markup.inline.raw", "settings": { "foreground": "#6cb6ff" } @@ -420,6 +506,12 @@ "foreground": "#ff938a" } }, + { + "scope": ["punctuation.section.embedded"], + "settings": { + "foreground": "#f47067" + } + }, { "scope": ["markup.inserted", "meta.diff.header.to-file", "punctuation.definition.inserted"], "settings": { diff --git a/apps/web/public/assets/shiki/themes/github-dark.json b/apps/web/public/assets/shiki/themes/github-dark.json index 11041c2d..542a3d0c 100644 --- a/apps/web/public/assets/shiki/themes/github-dark.json +++ b/apps/web/public/assets/shiki/themes/github-dark.json @@ -12,6 +12,8 @@ "textCodeBlock.background": "#6e768166", "textPreformat.foreground": "#8b949e", "textSeparator.foreground": "#21262d", + "icon.foreground": "#8b949e", + "keybindingLabel.foreground": "#c9d1d9", "button.background": "#238636", "button.foreground": "#ffffff", "button.hoverBackground": "#2ea043", @@ -76,10 +78,16 @@ "statusBar.foreground": "#8b949e", "statusBar.background": "#0d1117", "statusBar.border": "#30363d", + "statusBar.focusBorder": "#1f6feb80", "statusBar.noFolderBackground": "#0d1117", - "statusBar.debuggingBackground": "#da3633", "statusBar.debuggingForeground": "#f0f6fc", - "statusBarItem.prominentBackground": "#161b22", + "statusBar.debuggingBackground": "#da3633", + "statusBarItem.prominentBackground": "#6e768166", + "statusBarItem.remoteForeground": "#c9d1d9", + "statusBarItem.remoteBackground": "#30363d", + "statusBarItem.hoverBackground": "#c9d1d914", + "statusBarItem.activeBackground": "#c9d1d91f", + "statusBarItem.focusBorder": "#1f6feb", "editorGroupHeader.tabsBackground": "#010409", "editorGroupHeader.tabsBorder": "#30363d", "editorGroup.border": "#30363d", @@ -103,17 +111,15 @@ "editorWidget.background": "#161b22", "editor.foldBackground": "#6e76811a", "editor.lineHighlightBackground": "#6e76811a", - "editorLineNumber.foreground": "#8b949e", + "editorLineNumber.foreground": "#6e7681", "editorLineNumber.activeForeground": "#c9d1d9", - "editorIndentGuide.background": "#21262d", - "editorIndentGuide.activeBackground": "#30363d", + "editorIndentGuide.background": "#c9d1d91f", + "editorIndentGuide.activeBackground": "#c9d1d93d", "editorWhitespace.foreground": "#484f58", "editorCursor.foreground": "#58a6ff", "editor.findMatchBackground": "#9e6a03", "editor.findMatchHighlightBackground": "#f2cc6080", "editor.linkedEditingBackground": "#58a6ff12", - "editor.inactiveSelectionBackground": "#58a6ff12", - "editor.selectionBackground": "#58a6ff33", "editor.selectionHighlightBackground": "#3fb95040", "editor.wordHighlightBackground": "#6e768180", "editor.wordHighlightBorder": "#6e768199", @@ -121,11 +127,19 @@ "editor.wordHighlightStrongBorder": "#6e768199", "editorBracketMatch.background": "#3fb95040", "editorBracketMatch.border": "#3fb95099", + "editorInlayHint.background": "#8b949e33", + "editorInlayHint.foreground": "#8b949e", + "editorInlayHint.typeBackground": "#8b949e33", + "editorInlayHint.typeForeground": "#8b949e", + "editorInlayHint.paramBackground": "#8b949e33", + "editorInlayHint.paramForeground": "#8b949e", "editorGutter.modifiedBackground": "#bb800966", "editorGutter.addedBackground": "#2ea04366", "editorGutter.deletedBackground": "#f8514966", - "diffEditor.insertedTextBackground": "#2ea04326", - "diffEditor.removedTextBackground": "#f8514926", + "diffEditor.insertedLineBackground": "#23863633", + "diffEditor.insertedTextBackground": "#2386364d", + "diffEditor.removedLineBackground": "#da363333", + "diffEditor.removedTextBackground": "#da36334d", "scrollbar.shadow": "#484f5833", "scrollbarSlider.background": "#6e768133", "scrollbarSlider.hoverBackground": "#6e768145", @@ -137,7 +151,63 @@ "panelTitle.activeForeground": "#c9d1d9", "panelTitle.inactiveForeground": "#8b949e", "panelInput.border": "#30363d", - "terminal.foreground": "#8b949e", + "debugIcon.breakpointForeground": "#f85149", + "debugConsole.infoForeground": "#8b949e", + "debugConsole.warningForeground": "#d29922", + "debugConsole.errorForeground": "#ffa198", + "debugConsole.sourceForeground": "#e3b341", + "debugConsoleInputIcon.foreground": "#bc8cff", + "debugTokenExpression.name": "#79c0ff", + "debugTokenExpression.value": "#a5d6ff", + "debugTokenExpression.string": "#a5d6ff", + "debugTokenExpression.boolean": "#56d364", + "debugTokenExpression.number": "#56d364", + "debugTokenExpression.error": "#ffa198", + "symbolIcon.arrayForeground": "#f0883e", + "symbolIcon.booleanForeground": "#58a6ff", + "symbolIcon.classForeground": "#f0883e", + "symbolIcon.colorForeground": "#79c0ff", + "symbolIcon.constructorForeground": "#d2a8ff", + "symbolIcon.enumeratorForeground": "#f0883e", + "symbolIcon.enumeratorMemberForeground": "#58a6ff", + "symbolIcon.eventForeground": "#6e7681", + "symbolIcon.fieldForeground": "#f0883e", + "symbolIcon.fileForeground": "#d29922", + "symbolIcon.folderForeground": "#d29922", + "symbolIcon.functionForeground": "#bc8cff", + "symbolIcon.interfaceForeground": "#f0883e", + "symbolIcon.keyForeground": "#58a6ff", + "symbolIcon.keywordForeground": "#ff7b72", + "symbolIcon.methodForeground": "#bc8cff", + "symbolIcon.moduleForeground": "#ff7b72", + "symbolIcon.namespaceForeground": "#ff7b72", + "symbolIcon.nullForeground": "#58a6ff", + "symbolIcon.numberForeground": "#3fb950", + "symbolIcon.objectForeground": "#f0883e", + "symbolIcon.operatorForeground": "#79c0ff", + "symbolIcon.packageForeground": "#f0883e", + "symbolIcon.propertyForeground": "#f0883e", + "symbolIcon.referenceForeground": "#58a6ff", + "symbolIcon.snippetForeground": "#58a6ff", + "symbolIcon.stringForeground": "#79c0ff", + "symbolIcon.structForeground": "#f0883e", + "symbolIcon.textForeground": "#79c0ff", + "symbolIcon.typeParameterForeground": "#79c0ff", + "symbolIcon.unitForeground": "#58a6ff", + "symbolIcon.variableForeground": "#f0883e", + "symbolIcon.constantForeground": [ + "#aff5b4", + "#7ee787", + "#56d364", + "#3fb950", + "#2ea043", + "#238636", + "#196c2e", + "#0f5323", + "#033a16", + "#04260f" + ], + "terminal.foreground": "#c9d1d9", "terminal.ansiBlack": "#484f58", "terminal.ansiRed": "#ff7b72", "terminal.ansiGreen": "#3fb950", @@ -154,6 +224,13 @@ "terminal.ansiBrightMagenta": "#d2a8ff", "terminal.ansiBrightCyan": "#56d4dd", "terminal.ansiBrightWhite": "#f0f6fc", + "editorBracketHighlight.foreground1": "#79c0ff", + "editorBracketHighlight.foreground2": "#56d364", + "editorBracketHighlight.foreground3": "#e3b341", + "editorBracketHighlight.foreground4": "#ffa198", + "editorBracketHighlight.foreground5": "#ff9bce", + "editorBracketHighlight.foreground6": "#d2a8ff", + "editorBracketHighlight.unexpectedBracket.foreground": "#8b949e", "gitDecoration.addedResourceForeground": "#3fb950", "gitDecoration.modifiedResourceForeground": "#d29922", "gitDecoration.deletedResourceForeground": "#f85149", @@ -186,6 +263,7 @@ "constant", "entity.name.constant", "variable.other.constant", + "variable.other.enummember", "variable.language", "entity" ], @@ -244,11 +322,7 @@ } }, { - "scope": [ - "string", - "punctuation.definition.string", - "string punctuation.section.embedded source" - ], + "scope": ["string", "string punctuation.section.embedded source"], "settings": { "foreground": "#a5d6ff" } @@ -320,12 +394,6 @@ "foreground": "#ffa198" } }, - { - "scope": "string source", - "settings": { - "foreground": "#c9d1d9" - } - }, { "scope": "string variable", "settings": { @@ -368,6 +436,12 @@ "foreground": "#79c0ff" } }, + { + "scope": "support.type.property-name.json", + "settings": { + "foreground": "#7ee787" + } + }, { "scope": "meta.module-reference", "settings": { @@ -408,7 +482,19 @@ } }, { - "scope": "markup.raw", + "scope": ["markup.underline"], + "settings": { + "fontStyle": "underline" + } + }, + { + "scope": ["markup.strikethrough"], + "settings": { + "fontStyle": "strikethrough" + } + }, + { + "scope": "markup.inline.raw", "settings": { "foreground": "#79c0ff" } @@ -420,6 +506,12 @@ "foreground": "#ffa198" } }, + { + "scope": ["punctuation.section.embedded"], + "settings": { + "foreground": "#ff7b72" + } + }, { "scope": ["markup.inserted", "meta.diff.header.to-file", "punctuation.definition.inserted"], "settings": { diff --git a/apps/web/public/assets/shiki/themes/github-light.json b/apps/web/public/assets/shiki/themes/github-light.json index 341ef2b5..f8829d75 100644 --- a/apps/web/public/assets/shiki/themes/github-light.json +++ b/apps/web/public/assets/shiki/themes/github-light.json @@ -12,6 +12,8 @@ "textCodeBlock.background": "#afb8c133", "textPreformat.foreground": "#57606a", "textSeparator.foreground": "#d8dee4", + "icon.foreground": "#57606a", + "keybindingLabel.foreground": "#24292f", "button.background": "#2da44e", "button.foreground": "#ffffff", "button.hoverBackground": "#2c974b", @@ -76,10 +78,16 @@ "statusBar.foreground": "#57606a", "statusBar.background": "#ffffff", "statusBar.border": "#d0d7de", + "statusBar.focusBorder": "#0969da80", "statusBar.noFolderBackground": "#ffffff", - "statusBar.debuggingBackground": "#cf222e", "statusBar.debuggingForeground": "#ffffff", - "statusBarItem.prominentBackground": "#f6f8fa", + "statusBar.debuggingBackground": "#cf222e", + "statusBarItem.prominentBackground": "#afb8c133", + "statusBarItem.remoteForeground": "#24292f", + "statusBarItem.remoteBackground": "#eaeef2", + "statusBarItem.hoverBackground": "#24292f14", + "statusBarItem.activeBackground": "#24292f1f", + "statusBarItem.focusBorder": "#0969da", "editorGroupHeader.tabsBackground": "#f6f8fa", "editorGroupHeader.tabsBorder": "#d0d7de", "editorGroup.border": "#d0d7de", @@ -103,17 +111,15 @@ "editorWidget.background": "#ffffff", "editor.foldBackground": "#6e77811a", "editor.lineHighlightBackground": "#eaeef280", - "editorLineNumber.foreground": "#57606a", + "editorLineNumber.foreground": "#8c959f", "editorLineNumber.activeForeground": "#24292f", - "editorIndentGuide.background": "#d8dee4", - "editorIndentGuide.activeBackground": "#d0d7de", - "editorWhitespace.foreground": "#6e7781", + "editorIndentGuide.background": "#24292f1f", + "editorIndentGuide.activeBackground": "#24292f3d", + "editorWhitespace.foreground": "#afb8c1", "editorCursor.foreground": "#0969da", "editor.findMatchBackground": "#bf8700", "editor.findMatchHighlightBackground": "#fae17d80", "editor.linkedEditingBackground": "#0969da12", - "editor.inactiveSelectionBackground": "#0969da12", - "editor.selectionBackground": "#0969da33", "editor.selectionHighlightBackground": "#4ac26b40", "editor.wordHighlightBackground": "#eaeef280", "editor.wordHighlightBorder": "#afb8c199", @@ -121,11 +127,19 @@ "editor.wordHighlightStrongBorder": "#afb8c199", "editorBracketMatch.background": "#4ac26b40", "editorBracketMatch.border": "#4ac26b99", + "editorInlayHint.background": "#afb8c133", + "editorInlayHint.foreground": "#57606a", + "editorInlayHint.typeBackground": "#afb8c133", + "editorInlayHint.typeForeground": "#57606a", + "editorInlayHint.paramBackground": "#afb8c133", + "editorInlayHint.paramForeground": "#57606a", "editorGutter.modifiedBackground": "#d4a72c66", "editorGutter.addedBackground": "#4ac26b66", "editorGutter.deletedBackground": "#ff818266", - "diffEditor.insertedTextBackground": "#dafbe1", - "diffEditor.removedTextBackground": "#ffebe9", + "diffEditor.insertedLineBackground": "#aceebb4d", + "diffEditor.insertedTextBackground": "#6fdd8b66", + "diffEditor.removedLineBackground": "#ffcecb4d", + "diffEditor.removedTextBackground": "#ffaba866", "scrollbar.shadow": "#6e778133", "scrollbarSlider.background": "#8c959f33", "scrollbarSlider.hoverBackground": "#8c959f45", @@ -137,7 +151,52 @@ "panelTitle.activeForeground": "#24292f", "panelTitle.inactiveForeground": "#57606a", "panelInput.border": "#d0d7de", - "terminal.foreground": "#57606a", + "debugIcon.breakpointForeground": "#cf222e", + "debugConsole.infoForeground": "#57606a", + "debugConsole.warningForeground": "#7d4e00", + "debugConsole.errorForeground": "#cf222e", + "debugConsole.sourceForeground": "#9a6700", + "debugConsoleInputIcon.foreground": "#6639ba", + "debugTokenExpression.name": "#0550ae", + "debugTokenExpression.value": "#0a3069", + "debugTokenExpression.string": "#0a3069", + "debugTokenExpression.boolean": "#116329", + "debugTokenExpression.number": "#116329", + "debugTokenExpression.error": "#a40e26", + "symbolIcon.arrayForeground": "#953800", + "symbolIcon.booleanForeground": "#0550ae", + "symbolIcon.classForeground": "#953800", + "symbolIcon.colorForeground": "#0a3069", + "symbolIcon.constructorForeground": "#3e1f79", + "symbolIcon.enumeratorForeground": "#953800", + "symbolIcon.enumeratorMemberForeground": "#0550ae", + "symbolIcon.eventForeground": "#57606a", + "symbolIcon.fieldForeground": "#953800", + "symbolIcon.fileForeground": "#7d4e00", + "symbolIcon.folderForeground": "#7d4e00", + "symbolIcon.functionForeground": "#6639ba", + "symbolIcon.interfaceForeground": "#953800", + "symbolIcon.keyForeground": "#0550ae", + "symbolIcon.keywordForeground": "#a40e26", + "symbolIcon.methodForeground": "#6639ba", + "symbolIcon.moduleForeground": "#a40e26", + "symbolIcon.namespaceForeground": "#a40e26", + "symbolIcon.nullForeground": "#0550ae", + "symbolIcon.numberForeground": "#116329", + "symbolIcon.objectForeground": "#953800", + "symbolIcon.operatorForeground": "#0a3069", + "symbolIcon.packageForeground": "#953800", + "symbolIcon.propertyForeground": "#953800", + "symbolIcon.referenceForeground": "#0550ae", + "symbolIcon.snippetForeground": "#0550ae", + "symbolIcon.stringForeground": "#0a3069", + "symbolIcon.structForeground": "#953800", + "symbolIcon.textForeground": "#0a3069", + "symbolIcon.typeParameterForeground": "#0a3069", + "symbolIcon.unitForeground": "#0550ae", + "symbolIcon.variableForeground": "#953800", + "symbolIcon.constantForeground": "#116329", + "terminal.foreground": "#24292f", "terminal.ansiBlack": "#24292f", "terminal.ansiRed": "#cf222e", "terminal.ansiGreen": "#116329", @@ -154,6 +213,13 @@ "terminal.ansiBrightMagenta": "#a475f9", "terminal.ansiBrightCyan": "#3192aa", "terminal.ansiBrightWhite": "#8c959f", + "editorBracketHighlight.foreground1": "#0969da", + "editorBracketHighlight.foreground2": "#1a7f37", + "editorBracketHighlight.foreground3": "#9a6700", + "editorBracketHighlight.foreground4": "#cf222e", + "editorBracketHighlight.foreground5": "#bf3989", + "editorBracketHighlight.foreground6": "#8250df", + "editorBracketHighlight.unexpectedBracket.foreground": "#57606a", "gitDecoration.addedResourceForeground": "#1a7f37", "gitDecoration.modifiedResourceForeground": "#9a6700", "gitDecoration.deletedResourceForeground": "#cf222e", @@ -182,6 +248,7 @@ "constant", "entity.name.constant", "variable.other.constant", + "variable.other.enummember", "variable.language", "entity" ], @@ -240,11 +307,7 @@ } }, { - "scope": [ - "string", - "punctuation.definition.string", - "string punctuation.section.embedded source" - ], + "scope": ["string", "string punctuation.section.embedded source"], "settings": { "foreground": "#0a3069" } @@ -316,12 +379,6 @@ "foreground": "#82071e" } }, - { - "scope": "string source", - "settings": { - "foreground": "#24292f" - } - }, { "scope": "string variable", "settings": { @@ -364,6 +421,12 @@ "foreground": "#0550ae" } }, + { + "scope": "support.type.property-name.json", + "settings": { + "foreground": "#116329" + } + }, { "scope": "meta.module-reference", "settings": { @@ -404,7 +467,19 @@ } }, { - "scope": "markup.raw", + "scope": ["markup.underline"], + "settings": { + "fontStyle": "underline" + } + }, + { + "scope": ["markup.strikethrough"], + "settings": { + "fontStyle": "strikethrough" + } + }, + { + "scope": "markup.inline.raw", "settings": { "foreground": "#0550ae" } @@ -416,6 +491,12 @@ "foreground": "#82071e" } }, + { + "scope": ["punctuation.section.embedded"], + "settings": { + "foreground": "#cf222e" + } + }, { "scope": ["markup.inserted", "meta.diff.header.to-file", "punctuation.definition.inserted"], "settings": { diff --git a/apps/web/public/assets/shiki/themes/hc_light.json b/apps/web/public/assets/shiki/themes/hc_light.json new file mode 100644 index 00000000..62a92bd7 --- /dev/null +++ b/apps/web/public/assets/shiki/themes/hc_light.json @@ -0,0 +1,563 @@ +{ + "$schema": "vscode://schemas/color-theme", + "name": "hc_light", + "tokenColors": [ + { + "scope": ["meta.embedded", "source.groovy.embedded"], + "settings": { + "foreground": "#292929" + } + }, + { + "scope": "emphasis", + "settings": { + "fontStyle": "italic" + } + }, + { + "scope": "strong", + "settings": { + "fontStyle": "bold" + } + }, + { + "scope": "meta.diff.header", + "settings": { + "foreground": "#062F4A" + } + }, + { + "scope": "comment", + "settings": { + "foreground": "#515151" + } + }, + { + "scope": "constant.language", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": [ + "constant.numeric", + "variable.other.enummember", + "keyword.operator.plus.exponent", + "keyword.operator.minus.exponent" + ], + "settings": { + "foreground": "#096d48" + } + }, + { + "scope": "constant.regexp", + "settings": { + "foreground": "#811F3F" + } + }, + { + "scope": "entity.name.tag", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "entity.name.selector", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "entity.other.attribute-name", + "settings": { + "foreground": "#264F78" + } + }, + { + "scope": [ + "entity.other.attribute-name.class.css", + "entity.other.attribute-name.class.mixin.css", + "entity.other.attribute-name.id.css", + "entity.other.attribute-name.parent-selector.css", + "entity.other.attribute-name.pseudo-class.css", + "entity.other.attribute-name.pseudo-element.css", + "source.css.less entity.other.attribute-name.id", + "entity.other.attribute-name.scss" + ], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "invalid", + "settings": { + "foreground": "#B5200D" + } + }, + { + "scope": "markup.underline", + "settings": { + "fontStyle": "underline" + } + }, + { + "scope": "markup.bold", + "settings": { + "foreground": "#000080", + "fontStyle": "bold" + } + }, + { + "scope": "markup.heading", + "settings": { + "foreground": "#0F4A85", + "fontStyle": "bold" + } + }, + { + "scope": "markup.italic", + "settings": { + "fontStyle": "italic" + } + }, + { + "scope": "markup.strikethrough", + "settings": { + "fontStyle": "strikethrough" + } + }, + { + "scope": "markup.inserted", + "settings": { + "foreground": "#096d48" + } + }, + { + "scope": "markup.deleted", + "settings": { + "foreground": "#5A5A5A" + } + }, + { + "scope": "markup.changed", + "settings": { + "foreground": "#0451A5" + } + }, + { + "scope": [ + "punctuation.definition.quote.begin.markdown", + "punctuation.definition.list.begin.markdown" + ], + "settings": { + "foreground": "#0451A5" + } + }, + { + "scope": "markup.inline.raw", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "punctuation.definition.tag", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": ["meta.preprocessor", "entity.name.function.preprocessor"], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "meta.preprocessor.string", + "settings": { + "foreground": "#b5200d" + } + }, + { + "scope": "meta.preprocessor.numeric", + "settings": { + "foreground": "#096d48" + } + }, + { + "scope": "meta.structure.dictionary.key.python", + "settings": { + "foreground": "#0451A5" + } + }, + { + "scope": "storage", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "storage.type", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": ["storage.modifier", "keyword.operator.noexcept"], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": ["string", "meta.embedded.assembly"], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": [ + "string.comment.buffered.block.pug", + "string.quoted.pug", + "string.interpolated.pug", + "string.unquoted.plain.in.yaml", + "string.unquoted.plain.out.yaml", + "string.unquoted.block.yaml", + "string.quoted.single.yaml", + "string.quoted.double.xml", + "string.quoted.single.xml", + "string.unquoted.cdata.xml", + "string.quoted.double.html", + "string.quoted.single.html", + "string.unquoted.html", + "string.quoted.single.handlebars", + "string.quoted.double.handlebars" + ], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "string.regexp", + "settings": { + "foreground": "#811F3F" + } + }, + { + "scope": [ + "punctuation.definition.template-expression.begin", + "punctuation.definition.template-expression.end", + "punctuation.section.embedded" + ], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": ["meta.template.expression"], + "settings": { + "foreground": "#000000" + } + }, + { + "scope": [ + "support.constant.property-value", + "support.constant.font-name", + "support.constant.media-type", + "support.constant.media", + "constant.other.color.rgb-value", + "constant.other.rgb-value", + "support.constant.color" + ], + "settings": { + "foreground": "#0451A5" + } + }, + { + "scope": [ + "support.type.vendored.property-name", + "support.type.property-name", + "variable.css", + "variable.scss", + "variable.other.less", + "source.coffee.embedded" + ], + "settings": { + "foreground": "#264F78" + } + }, + { + "scope": ["support.type.property-name.json"], + "settings": { + "foreground": "#0451A5" + } + }, + { + "scope": "keyword", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "keyword.control", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "keyword.operator", + "settings": { + "foreground": "#000000" + } + }, + { + "scope": [ + "keyword.operator.new", + "keyword.operator.expression", + "keyword.operator.cast", + "keyword.operator.sizeof", + "keyword.operator.alignof", + "keyword.operator.typeid", + "keyword.operator.alignas", + "keyword.operator.instanceof", + "keyword.operator.logical.python", + "keyword.operator.wordlike" + ], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "keyword.other.unit", + "settings": { + "foreground": "#096d48" + } + }, + { + "scope": ["punctuation.section.embedded.begin.php", "punctuation.section.embedded.end.php"], + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "support.function.git-rebase", + "settings": { + "foreground": "#0451A5" + } + }, + { + "scope": "constant.sha.git-rebase", + "settings": { + "foreground": "#096d48" + } + }, + { + "scope": [ + "storage.modifier.import.java", + "variable.language.wildcard.java", + "storage.modifier.package.java" + ], + "settings": { + "foreground": "#000000" + } + }, + { + "scope": "variable.language", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": [ + "entity.name.function", + "support.function", + "support.constant.handlebars", + "source.powershell variable.other.member", + "entity.name.operator.custom-literal" + ], + "settings": { + "foreground": "#5e2cbc" + } + }, + { + "scope": [ + "support.class", + "support.type", + "entity.name.type", + "entity.name.namespace", + "entity.other.attribute", + "entity.name.scope-resolution", + "entity.name.class", + "storage.type.numeric.go", + "storage.type.byte.go", + "storage.type.boolean.go", + "storage.type.string.go", + "storage.type.uintptr.go", + "storage.type.error.go", + "storage.type.rune.go", + "storage.type.cs", + "storage.type.generic.cs", + "storage.type.modifier.cs", + "storage.type.variable.cs", + "storage.type.annotation.java", + "storage.type.generic.java", + "storage.type.java", + "storage.type.object.array.java", + "storage.type.primitive.array.java", + "storage.type.primitive.java", + "storage.type.token.java", + "storage.type.groovy", + "storage.type.annotation.groovy", + "storage.type.parameters.groovy", + "storage.type.generic.groovy", + "storage.type.object.array.groovy", + "storage.type.primitive.array.groovy", + "storage.type.primitive.groovy" + ], + "settings": { + "foreground": "#185E73" + } + }, + { + "scope": [ + "meta.type.cast.expr", + "meta.type.new.expr", + "support.constant.math", + "support.constant.dom", + "support.constant.json", + "entity.other.inherited-class" + ], + "settings": { + "foreground": "#185E73" + } + }, + { + "scope": [ + "keyword.control", + "source.cpp keyword.operator.new", + "source.cpp keyword.operator.delete", + "keyword.other.using", + "keyword.other.operator", + "entity.name.operator" + ], + "settings": { + "foreground": "#b5200d" + } + }, + { + "scope": [ + "variable", + "meta.definition.variable.name", + "support.variable", + "entity.name.variable", + "constant.other.placeholder" + ], + "settings": { + "foreground": "#001080" + } + }, + { + "scope": ["variable.other.constant", "variable.other.enummember"], + "settings": { + "foreground": "#02715D" + } + }, + { + "scope": ["meta.object-literal.key"], + "settings": { + "foreground": "#001080" + } + }, + { + "scope": [ + "support.constant.property-value", + "support.constant.font-name", + "support.constant.media-type", + "support.constant.media", + "constant.other.color.rgb-value", + "constant.other.rgb-value", + "support.constant.color" + ], + "settings": { + "foreground": "#0451A5" + } + }, + { + "scope": [ + "punctuation.definition.group.regexp", + "punctuation.definition.group.assertion.regexp", + "punctuation.definition.character-class.regexp", + "punctuation.character.set.begin.regexp", + "punctuation.character.set.end.regexp", + "keyword.operator.negation.regexp", + "support.other.parenthesis.regexp" + ], + "settings": { + "foreground": "#D16969" + } + }, + { + "scope": [ + "constant.character.character-class.regexp", + "constant.other.character-class.set.regexp", + "constant.other.character-class.regexp", + "constant.character.set.regexp" + ], + "settings": { + "foreground": "#811F3F" + } + }, + { + "scope": "keyword.operator.quantifier.regexp", + "settings": { + "foreground": "#000000" + } + }, + { + "scope": ["keyword.operator.or.regexp", "keyword.control.anchor.regexp"], + "settings": { + "foreground": "#EE0000" + } + }, + { + "scope": "constant.character", + "settings": { + "foreground": "#0F4A85" + } + }, + { + "scope": "constant.character.escape", + "settings": { + "foreground": "#EE0000" + } + }, + { + "scope": "entity.name.label", + "settings": { + "foreground": "#000000" + } + }, + { + "scope": "token.info-token", + "settings": { + "foreground": "#316BCD" + } + }, + { + "scope": "token.warn-token", + "settings": { + "foreground": "#CD9731" + } + }, + { + "scope": "token.error-token", + "settings": { + "foreground": "#CD3131" + } + }, + { + "scope": "token.debug-token", + "settings": { + "foreground": "#800080" + } + } + ] +} diff --git a/apps/web/public/assets/shiki/themes/light-plus.json b/apps/web/public/assets/shiki/themes/light-plus.json index 04beecaa..062234d6 100644 --- a/apps/web/public/assets/shiki/themes/light-plus.json +++ b/apps/web/public/assets/shiki/themes/light-plus.json @@ -8,7 +8,7 @@ } }, { - "scope": ["meta.embedded", "source.groovy.embedded"], + "scope": ["meta.embedded", "source.groovy.embedded", "string meta.image.inline.markdown"], "settings": { "foreground": "#000000ff" } @@ -587,6 +587,7 @@ "notebook.cellBorderColor": "#E8E8E8", "notebook.selectedCellBackground": "#c8ddf150", "statusBarItem.errorBackground": "#c72e0f", - "list.activeSelectionIconForeground": "#FFF" + "list.activeSelectionIconForeground": "#FFF", + "list.focusAndSelectionOutline": "#90C2F9" } } diff --git a/apps/web/public/assets/shiki/themes/material-darker.json b/apps/web/public/assets/shiki/themes/material-darker.json index 26c44b2b..3444bafb 100644 --- a/apps/web/public/assets/shiki/themes/material-darker.json +++ b/apps/web/public/assets/shiki/themes/material-darker.json @@ -472,6 +472,28 @@ "fontStyle": "italic" } }, + { + "name": "Parameter", + "scope": ["variable.parameter"], + "settings": { + "fontStyle": "italic" + } + }, + { + "name": "Python - Self Parameter", + "scope": ["variable.parameter.function.language.special.self.python"], + "settings": { + "foreground": "#f07178", + "fontStyle": "italic" + } + }, + { + "name": "Python - Format Placeholder", + "scope": ["constant.character.format.placeholder.other.python"], + "settings": { + "foreground": "#F78C6C" + } + }, { "name": "Markdown - Blockquote", "scope": ["markup.quote"], @@ -707,6 +729,8 @@ "tab.unfocusedActiveForeground": "#EEFFFF", "editorWidget.resizeBorder": "#80CBC4", "editorWidget.border": "#80CBC4", + "notebook.focusedCellBorder": "#80CBC4", + "notebook.inactiveFocusedCellBorder": "#80CBC450", "statusBar.border": "#21212160", "statusBar.foreground": "#616161", "editorBracketMatch.border": "#FFCC0050", diff --git a/apps/web/public/assets/shiki/themes/material-default.json b/apps/web/public/assets/shiki/themes/material-default.json index 05f6551d..842d79f8 100644 --- a/apps/web/public/assets/shiki/themes/material-default.json +++ b/apps/web/public/assets/shiki/themes/material-default.json @@ -472,6 +472,28 @@ "fontStyle": "italic" } }, + { + "name": "Parameter", + "scope": ["variable.parameter"], + "settings": { + "fontStyle": "italic" + } + }, + { + "name": "Python - Self Parameter", + "scope": ["variable.parameter.function.language.special.self.python"], + "settings": { + "foreground": "#f07178", + "fontStyle": "italic" + } + }, + { + "name": "Python - Format Placeholder", + "scope": ["constant.character.format.placeholder.other.python"], + "settings": { + "foreground": "#F78C6C" + } + }, { "name": "Markdown - Blockquote", "scope": ["markup.quote"], @@ -707,6 +729,8 @@ "tab.unfocusedActiveForeground": "#EEFFFF", "editorWidget.resizeBorder": "#80CBC4", "editorWidget.border": "#80CBC4", + "notebook.focusedCellBorder": "#80CBC4", + "notebook.inactiveFocusedCellBorder": "#80CBC450", "statusBar.border": "#26323860", "statusBar.foreground": "#546E7A", "editorBracketMatch.border": "#FFCC0050", diff --git a/apps/web/public/assets/shiki/themes/material-lighter.json b/apps/web/public/assets/shiki/themes/material-lighter.json index 94dbab01..e79f812a 100644 --- a/apps/web/public/assets/shiki/themes/material-lighter.json +++ b/apps/web/public/assets/shiki/themes/material-lighter.json @@ -472,6 +472,28 @@ "fontStyle": "italic" } }, + { + "name": "Parameter", + "scope": ["variable.parameter"], + "settings": { + "fontStyle": "italic" + } + }, + { + "name": "Python - Self Parameter", + "scope": ["variable.parameter.function.language.special.self.python"], + "settings": { + "foreground": "#E53935", + "fontStyle": "italic" + } + }, + { + "name": "Python - Format Placeholder", + "scope": ["constant.character.format.placeholder.other.python"], + "settings": { + "foreground": "#F76D47" + } + }, { "name": "Markdown - Blockquote", "scope": ["markup.quote"], @@ -707,6 +729,8 @@ "tab.unfocusedActiveForeground": "#90A4AE", "editorWidget.resizeBorder": "#80CBC4", "editorWidget.border": "#80CBC4", + "notebook.focusedCellBorder": "#80CBC4", + "notebook.inactiveFocusedCellBorder": "#80CBC450", "statusBar.border": "#FAFAFA60", "statusBar.foreground": "#7E939E", "editorBracketMatch.border": "#27272750", diff --git a/apps/web/public/assets/shiki/themes/material-ocean.json b/apps/web/public/assets/shiki/themes/material-ocean.json index 626e6c91..a2688166 100644 --- a/apps/web/public/assets/shiki/themes/material-ocean.json +++ b/apps/web/public/assets/shiki/themes/material-ocean.json @@ -472,6 +472,28 @@ "fontStyle": "italic" } }, + { + "name": "Parameter", + "scope": ["variable.parameter"], + "settings": { + "fontStyle": "italic" + } + }, + { + "name": "Python - Self Parameter", + "scope": ["variable.parameter.function.language.special.self.python"], + "settings": { + "foreground": "#f07178", + "fontStyle": "italic" + } + }, + { + "name": "Python - Format Placeholder", + "scope": ["constant.character.format.placeholder.other.python"], + "settings": { + "foreground": "#F78C6C" + } + }, { "name": "Markdown - Blockquote", "scope": ["markup.quote"], @@ -707,6 +729,8 @@ "tab.unfocusedActiveForeground": "#A6ACCD", "editorWidget.resizeBorder": "#80CBC4", "editorWidget.border": "#80CBC4", + "notebook.focusedCellBorder": "#80CBC4", + "notebook.inactiveFocusedCellBorder": "#80CBC450", "statusBar.border": "#0F111A60", "statusBar.foreground": "#4B526D", "editorBracketMatch.border": "#FFCC0050", diff --git a/apps/web/public/assets/shiki/themes/material-palenight.json b/apps/web/public/assets/shiki/themes/material-palenight.json index db1d111e..2f9e713e 100644 --- a/apps/web/public/assets/shiki/themes/material-palenight.json +++ b/apps/web/public/assets/shiki/themes/material-palenight.json @@ -472,6 +472,28 @@ "fontStyle": "italic" } }, + { + "name": "Parameter", + "scope": ["variable.parameter"], + "settings": { + "fontStyle": "italic" + } + }, + { + "name": "Python - Self Parameter", + "scope": ["variable.parameter.function.language.special.self.python"], + "settings": { + "foreground": "#f07178", + "fontStyle": "italic" + } + }, + { + "name": "Python - Format Placeholder", + "scope": ["constant.character.format.placeholder.other.python"], + "settings": { + "foreground": "#F78C6C" + } + }, { "name": "Markdown - Blockquote", "scope": ["markup.quote"], @@ -707,6 +729,8 @@ "tab.unfocusedActiveForeground": "#A6ACCD", "editorWidget.resizeBorder": "#80CBC4", "editorWidget.border": "#80CBC4", + "notebook.focusedCellBorder": "#80CBC4", + "notebook.inactiveFocusedCellBorder": "#80CBC450", "statusBar.border": "#292D3E60", "statusBar.foreground": "#676E95", "editorBracketMatch.border": "#FFCC0050", diff --git a/apps/web/public/assets/shiki/themes/monokai.json b/apps/web/public/assets/shiki/themes/monokai.json index 6545254e..fe7a8c56 100644 --- a/apps/web/public/assets/shiki/themes/monokai.json +++ b/apps/web/public/assets/shiki/themes/monokai.json @@ -102,7 +102,7 @@ } }, { - "scope": ["meta.embedded", "source.groovy.embedded"], + "scope": ["meta.embedded", "source.groovy.embedded", "string meta.image.inline.markdown"], "settings": { "foreground": "#F8F8F2" } diff --git a/apps/web/public/assets/shiki/themes/one-dark-pro.json b/apps/web/public/assets/shiki/themes/one-dark-pro.json index 0f7cb273..9c1f76a6 100644 --- a/apps/web/public/assets/shiki/themes/one-dark-pro.json +++ b/apps/web/public/assets/shiki/themes/one-dark-pro.json @@ -806,7 +806,6 @@ "name": "Attribute IDs", "scope": "entity.other.attribute-name.id", "settings": { - "fontStyle": "normal", "foreground": "#61afef" } }, @@ -814,7 +813,6 @@ "name": "Attribute class", "scope": "entity.other.attribute-name.class.css", "settings": { - "fontStyle": "normal", "foreground": "#d19a66" } }, @@ -1018,13 +1016,6 @@ "foreground": "#56b6c2" } }, - { - "name": "Escape Characters", - "scope": "constant.character.escape", - "settings": { - "foreground": "#56b6c2" - } - }, { "name": "Embedded", "scope": "punctuation.section.embedded, variable.interpolation", @@ -1053,6 +1044,12 @@ "foreground": "#abb2bf" } }, + { + "scope": "invalid.illegal.unrecognized-tag.html", + "settings": { + "foreground": "#e06c75" + } + }, { "name": "Broken", "scope": "invalid.broken", @@ -1067,6 +1064,13 @@ "foreground": "#ffffff" } }, + { + "name": "html Deprecated", + "scope": "invalid.deprecated.entity.other.attribute-name.html", + "settings": { + "foreground": "#d19a66" + } + }, { "name": "Unimplemented", "scope": "invalid.unimplemented", @@ -1747,8 +1751,8 @@ "name": "Comments", "scope": "comment, punctuation.definition.comment", "settings": { - "fontStyle": "italic", - "foreground": "#7f848e" + "foreground": "#7f848e", + "fontStyle": "italic" } }, { @@ -1869,7 +1873,7 @@ { "scope": ["constant.character.escape"], "settings": { - "foreground": "#e5c07b" + "foreground": "#56b6c2" } }, { @@ -1927,6 +1931,9 @@ "editor.findMatchBorder": "#457dff", "editor.findMatchHighlightBackground": "#6199ff2f", "editor.foreground": "#abb2bf", + "editorBracketHighlight.foreground1": "#d19a66", + "editorBracketHighlight.foreground2": "#c678dd", + "editorBracketHighlight.foreground3": "#56b6c2", "editorHoverWidget.highlightForeground": "#61afef", "editorInlayHint.foreground": "#abb2bf", "editorInlayHint.background": "#2c313c", @@ -1945,7 +1952,6 @@ "editor.wordHighlightBorder": "#7f848e", "editor.wordHighlightStrongBackground": "#abb2bf26", "editor.wordHighlightStrongBorder": "#7f848e", - "editorActiveLineNumber.foreground": "#737984", "editorBracketMatch.background": "#515a6b", "editorBracketMatch.border": "#515a6b", "editorCursor.background": "#ffffffc9", @@ -1965,18 +1971,19 @@ "editorSuggestWidget.border": "#181a1f", "editorSuggestWidget.selectedBackground": "#2c313a", "editorWarning.foreground": "#d19a66", - "editorWhitespace.foreground": "#3b4048", + "editorWhitespace.foreground": "#ffffff1d", "editorWidget.background": "#21252b", "focusBorder": "#3e4452", "gitDecoration.ignoredResourceForeground": "#636b78", "input.background": "#1d1f23", + "input.foreground": "#abb2bf", "list.activeSelectionBackground": "#2c313a", "list.activeSelectionForeground": "#d7dae0", "list.focusBackground": "#323842", "list.focusForeground": "#f0f0f0", "list.highlightForeground": "#c5c5c5", "list.hoverBackground": "#2c313a", - "list.hoverForeground": "#fff", + "list.hoverForeground": "#abb2bf", "list.inactiveSelectionBackground": "#323842", "list.inactiveSelectionForeground": "#d7dae0", "list.warningForeground": "#d19a66", @@ -2002,14 +2009,14 @@ "sideBarSectionHeader.foreground": "#abb2bf", "statusBar.background": "#21252b", "statusBar.debuggingBackground": "#cc6633", - "statusBar.debuggingBorder": "#66017a", + "statusBar.debuggingBorder": "#ff000000", "statusBar.debuggingForeground": "#ffffff", "statusBar.foreground": "#9da5b4", "statusBar.noFolderBackground": "#21252b", - "statusBarItem.hoverBackground": "#2c313a", "statusBarItem.remoteBackground": "#4d78cc", "statusBarItem.remoteForeground": "#f8fafd", "tab.activeBackground": "#282c34", + "tab.activeBorder": "#b4b4b4", "tab.activeForeground": "#dcdcdc", "tab.border": "#181a1f", "tab.hoverBackground": "#323842", @@ -2023,13 +2030,13 @@ "terminal.ansiBrightGreen": "#a5e075", "terminal.ansiBrightMagenta": "#de73ff", "terminal.ansiBrightRed": "#ff616e", - "terminal.ansiBrightWhite": "#d7dae0", + "terminal.ansiBrightWhite": "#e6e6e6", "terminal.ansiBrightYellow": "#f0a45d", "terminal.ansiCyan": "#42b3c2", "terminal.ansiGreen": "#8cc265", "terminal.ansiMagenta": "#c162de", "terminal.ansiRed": "#e05561", - "terminal.ansiWhite": "#e6e6e6", + "terminal.ansiWhite": "#d7dae0", "terminal.ansiYellow": "#d18f52", "terminal.background": "#282c34", "terminal.border": "#3e4452", @@ -2043,6 +2050,7 @@ "titleBar.activeForeground": "#9da5b4", "titleBar.inactiveBackground": "#21252b", "titleBar.inactiveForeground": "#6b717d", + "tree.indentGuidesStroke": "#ffffff1d", "walkThrough.embeddedEditorBackground": "#2e3440", "welcomePage.buttonHoverBackground": "#404754" } diff --git a/apps/web/public/assets/shiki/themes/rose-pine-dawn.json b/apps/web/public/assets/shiki/themes/rose-pine-dawn.json index 3efa369d..8c9b8758 100644 --- a/apps/web/public/assets/shiki/themes/rose-pine-dawn.json +++ b/apps/web/public/assets/shiki/themes/rose-pine-dawn.json @@ -4,7 +4,7 @@ "colors": { "activityBar.activeBorder": "#575279", "activityBar.background": "#faf4ed", - "activityBar.dropBorder": "#f2e9de", + "activityBar.dropBorder": "#f2e9e1", "activityBar.foreground": "#575279", "activityBar.inactiveForeground": "#797593", "activityBarBadge.background": "#d7827e", @@ -24,7 +24,7 @@ "button.hoverBackground": "#d7827ee6", "button.secondaryBackground": "#fffaf3", "button.secondaryForeground": "#575279", - "button.secondaryHoverBackground": "#f2e9de", + "button.secondaryHoverBackground": "#f2e9e1", "charts.blue": "#56949f", "charts.foreground": "#575279", "charts.green": "#286983", @@ -54,14 +54,14 @@ "debugIcon.stepOverForeground": "#797593", "debugIcon.stopForeground": "#b4637a", "debugToolBar.background": "#fffaf3", - "debugToolBar.border": "#f2e9de", + "debugToolBar.border": "#f2e9e1", "descriptionForeground": "#797593", - "diffEditor.border": "#f2e9de", + "diffEditor.border": "#f2e9e1", "diffEditor.diagonalFill": "#6e6a8626", - "diffEditor.insertedTextBackground": "#56949f14", - "diffEditor.insertedTextBorder": "#56949f80", - "diffEditor.removedTextBackground": "#b4637a14", - "diffEditor.removedTextBorder": "#b4637a80", + "diffEditor.insertedTextBackground": "#56949f26", + "diffEditor.removedTextBackground": "#b4637a26", + "diffEditorOverview.insertedForeground": "#56949f80", + "diffEditorOverview.removedForeground": "#b4637a80", "dropdown.background": "#fffaf3", "dropdown.border": "#6e6a8614", "dropdown.foreground": "#575279", @@ -146,13 +146,13 @@ "editorHoverWidget.statusBarBackground": "#0000", "editorIndentGuide.activeBackground": "#9893a5", "editorIndentGuide.background": "#6e6a8626", - "editorInfo.border": "#f2e9de", + "editorInfo.border": "#f2e9e1", "editorInfo.foreground": "#56949f", - "editorInlayHint.background": "#f2e9de", + "editorInlayHint.background": "#f2e9e1", "editorInlayHint.foreground": "#797593", - "editorInlayHint.parameterBackground": "#f2e9de", + "editorInlayHint.parameterBackground": "#f2e9e1", "editorInlayHint.parameterForeground": "#907aa9", - "editorInlayHint.typeBackground": "#f2e9de", + "editorInlayHint.typeBackground": "#f2e9e1", "editorInlayHint.typeForeground": "#56949f", "editorLightBulb.foreground": "#286983", "editorLightBulbAutoFix.foreground": "#d7827e", @@ -196,7 +196,7 @@ "editorWarning.foreground": "#ea9d34", "editorWhitespace.foreground": "#9893a5", "editorWidget.background": "#fffaf3", - "editorWidget.border": "#f2e9de", + "editorWidget.border": "#f2e9e1", "editorWidget.foreground": "#797593", "editorWidget.resizeBorder": "#9893a5", "errorForeground": "#b4637a", @@ -220,27 +220,27 @@ "gitDecoration.submoduleResourceForeground": "#ea9d34", "gitDecoration.untrackedResourceForeground": "#ea9d34", "icon.foreground": "#797593", - "input.background": "#f2e9de80", + "input.background": "#f2e9e180", "input.border": "#6e6a8614", "input.foreground": "#575279", "input.placeholderForeground": "#797593", "inputOption.activeBackground": "#d7827e", "inputOption.activeBorder": "#0000", "inputOption.activeForeground": "#faf4ed", - "inputValidation.errorBackground": "#0000", - "inputValidation.errorBorder": "#0000", + "inputValidation.errorBackground": "#fffaf3", + "inputValidation.errorBorder": "#6e6a8626", "inputValidation.errorForeground": "#b4637a", - "inputValidation.infoBackground": "#0000", - "inputValidation.infoBorder": "#0000", + "inputValidation.infoBackground": "#fffaf3", + "inputValidation.infoBorder": "#6e6a8626", "inputValidation.infoForeground": "#56949f", - "inputValidation.warningBackground": "#0000", - "inputValidation.warningBorder": "#0000", + "inputValidation.warningBackground": "#fffaf3", + "inputValidation.warningBorder": "#6e6a8626", "inputValidation.warningForeground": "#56949f80", - "keybindingLabel.background": "#f2e9de", + "keybindingLabel.background": "#f2e9e1", "keybindingLabel.border": "#6e6a8626", "keybindingLabel.bottomBorder": "#6e6a8626", "keybindingLabel.foreground": "#907aa9", - "keybindingTable.headerBackground": "#f2e9de", + "keybindingTable.headerBackground": "#f2e9e1", "keybindingTable.rowsBackground": "#fffaf3", "list.activeSelectionBackground": "#6e6a8614", "list.activeSelectionForeground": "#575279", @@ -264,18 +264,18 @@ "list.warningForeground": "#ea9d34", "listFilterWidget.background": "#fffaf3", "listFilterWidget.noMatchesOutline": "#b4637a", - "listFilterWidget.outline": "#f2e9de", + "listFilterWidget.outline": "#f2e9e1", "menu.background": "#fffaf3", "menu.border": "#6e6a860d", "menu.foreground": "#575279", "menu.selectionBackground": "#6e6a8614", - "menu.selectionBorder": "#f2e9de", + "menu.selectionBorder": "#f2e9e1", "menu.selectionForeground": "#575279", - "menu.separatorBackground": "#575279", + "menu.separatorBackground": "#6e6a8626", "menubar.selectionBackground": "#6e6a8614", "menubar.selectionBorder": "#6e6a860d", "menubar.selectionForeground": "#575279", - "merge.border": "#f2e9de", + "merge.border": "#f2e9e1", "merge.commonContentBackground": "#6e6a8614", "merge.commonHeaderBackground": "#6e6a8614", "merge.currentContentBackground": "#ea9d3480", @@ -306,7 +306,7 @@ "notificationToast.border": "#6e6a8614", "panel.background": "#fffaf3", "panel.border": "#0000", - "panel.dropBorder": "#f2e9de", + "panel.dropBorder": "#f2e9e1", "panelInput.border": "#fffaf3", "panelSection.dropBackground": "#6e6a8614", "panelSectionHeader.background": "#fffaf3", @@ -314,7 +314,7 @@ "panelTitle.activeBorder": "#6e6a8626", "panelTitle.activeForeground": "#575279", "panelTitle.inactiveForeground": "#797593", - "peekView.border": "#f2e9de", + "peekView.border": "#f2e9e1", "peekViewEditor.background": "#fffaf3", "peekViewEditor.matchHighlightBackground": "#6e6a8626", "peekViewResult.background": "#fffaf3", @@ -323,7 +323,7 @@ "peekViewResult.matchHighlightBackground": "#6e6a8626", "peekViewResult.selectionBackground": "#6e6a8614", "peekViewResult.selectionForeground": "#575279", - "peekViewTitle.background": "#f2e9de", + "peekViewTitle.background": "#f2e9e1", "peekViewTitleDescription.foreground": "#797593", "pickerGroup.border": "#6e6a8626", "pickerGroup.foreground": "#907aa9", @@ -338,9 +338,9 @@ "quickInputList.focusForeground": "#575279", "quickInputList.focusIconForeground": "#575279", "scrollbar.shadow": "#0000", - "scrollbarSlider.activeBackground": "#6e6a8626", - "scrollbarSlider.background": "#6e6a860d", - "scrollbarSlider.hoverBackground": "#6e6a8614", + "scrollbarSlider.activeBackground": "#28698380", + "scrollbarSlider.background": "#6e6a8614", + "scrollbarSlider.hoverBackground": "#6e6a8626", "searchEditor.findMatchBackground": "#6e6a8614", "selection.background": "#6e6a8626", "settings.focusedRowBackground": "#fffaf3", @@ -361,7 +361,7 @@ "statusBar.noFolderForeground": "#797593", "statusBarItem.activeBackground": "#6e6a8626", "statusBarItem.hoverBackground": "#6e6a8614", - "statusBarItem.prominentBackground": "#f2e9de", + "statusBarItem.prominentBackground": "#f2e9e1", "statusBarItem.prominentForeground": "#575279", "statusBarItem.prominentHoverBackground": "#6e6a8614", "statusBarItem.remoteBackground": "#faf4ed", @@ -413,7 +413,7 @@ "tab.unfocusedHoverBackground": "#0000", "tab.unfocusedInactiveBackground": "#0000", "tab.unfocusedInactiveModifiedBorder": "#56949f80", - "terminal.ansiBlack": "#f2e9de", + "terminal.ansiBlack": "#f2e9e1", "terminal.ansiBlue": "#56949f", "terminal.ansiBrightBlack": "#797593", "terminal.ansiBrightBlue": "#56949f", @@ -452,7 +452,7 @@ "walkThrough.embeddedEditorBackground": "#faf4ed", "welcomePage.background": "#faf4ed", "welcomePage.buttonBackground": "#fffaf3", - "welcomePage.buttonHoverBackground": "#f2e9de", + "welcomePage.buttonHoverBackground": "#f2e9e1", "widget.shadow": "#f2e9de4d", "window.activeBorder": "#fffaf3", "window.inactiveBorder": "#fffaf3" @@ -519,6 +519,24 @@ "foreground": "#286983" } }, + { + "scope": ["markup.inserted.diff"], + "settings": { + "foreground": "#56949f" + } + }, + { + "scope": ["markup.deleted.diff"], + "settings": { + "foreground": "#b4637a" + } + }, + { + "scope": ["meta.diff.range"], + "settings": { + "foreground": "#907aa9" + } + }, { "scope": ["meta.tag", "meta.brace"], "settings": { diff --git a/apps/web/public/assets/shiki/themes/rose-pine-moon.json b/apps/web/public/assets/shiki/themes/rose-pine-moon.json index 2ed25d4e..26eddfc2 100644 --- a/apps/web/public/assets/shiki/themes/rose-pine-moon.json +++ b/apps/web/public/assets/shiki/themes/rose-pine-moon.json @@ -58,10 +58,10 @@ "descriptionForeground": "#908caa", "diffEditor.border": "#393552", "diffEditor.diagonalFill": "#817c9c4d", - "diffEditor.insertedTextBackground": "#9ccfd814", - "diffEditor.insertedTextBorder": "#9ccfd880", - "diffEditor.removedTextBackground": "#eb6f9214", - "diffEditor.removedTextBorder": "#eb6f9280", + "diffEditor.insertedTextBackground": "#9ccfd826", + "diffEditor.removedTextBackground": "#eb6f9226", + "diffEditorOverview.insertedForeground": "#9ccfd880", + "diffEditorOverview.removedForeground": "#eb6f9280", "dropdown.background": "#2a273f", "dropdown.border": "#817c9c26", "dropdown.foreground": "#e0def4", @@ -227,14 +227,14 @@ "inputOption.activeBackground": "#ea9a97", "inputOption.activeBorder": "#0000", "inputOption.activeForeground": "#232136", - "inputValidation.errorBackground": "#0000", - "inputValidation.errorBorder": "#0000", + "inputValidation.errorBackground": "#2a273f", + "inputValidation.errorBorder": "#817c9c4d", "inputValidation.errorForeground": "#eb6f92", - "inputValidation.infoBackground": "#0000", - "inputValidation.infoBorder": "#0000", + "inputValidation.infoBackground": "#2a273f", + "inputValidation.infoBorder": "#817c9c4d", "inputValidation.infoForeground": "#9ccfd8", - "inputValidation.warningBackground": "#0000", - "inputValidation.warningBorder": "#0000", + "inputValidation.warningBackground": "#2a273f", + "inputValidation.warningBorder": "#817c9c4d", "inputValidation.warningForeground": "#9ccfd880", "keybindingLabel.background": "#393552", "keybindingLabel.border": "#817c9c4d", @@ -271,7 +271,7 @@ "menu.selectionBackground": "#817c9c26", "menu.selectionBorder": "#393552", "menu.selectionForeground": "#e0def4", - "menu.separatorBackground": "#e0def4", + "menu.separatorBackground": "#817c9c4d", "menubar.selectionBackground": "#817c9c26", "menubar.selectionBorder": "#817c9c14", "menubar.selectionForeground": "#e0def4", @@ -338,9 +338,9 @@ "quickInputList.focusForeground": "#e0def4", "quickInputList.focusIconForeground": "#e0def4", "scrollbar.shadow": "#0000", - "scrollbarSlider.activeBackground": "#817c9c4d", - "scrollbarSlider.background": "#817c9c14", - "scrollbarSlider.hoverBackground": "#817c9c26", + "scrollbarSlider.activeBackground": "#3e8fb080", + "scrollbarSlider.background": "#817c9c26", + "scrollbarSlider.hoverBackground": "#817c9c4d", "searchEditor.findMatchBackground": "#817c9c26", "selection.background": "#817c9c4d", "settings.focusedRowBackground": "#2a273f", @@ -519,6 +519,24 @@ "foreground": "#3e8fb0" } }, + { + "scope": ["markup.inserted.diff"], + "settings": { + "foreground": "#9ccfd8" + } + }, + { + "scope": ["markup.deleted.diff"], + "settings": { + "foreground": "#eb6f92" + } + }, + { + "scope": ["meta.diff.range"], + "settings": { + "foreground": "#c4a7e7" + } + }, { "scope": ["meta.tag", "meta.brace"], "settings": { diff --git a/apps/web/public/assets/shiki/themes/rose-pine.json b/apps/web/public/assets/shiki/themes/rose-pine.json index 890c0f8f..e1ac3944 100644 --- a/apps/web/public/assets/shiki/themes/rose-pine.json +++ b/apps/web/public/assets/shiki/themes/rose-pine.json @@ -58,10 +58,10 @@ "descriptionForeground": "#908caa", "diffEditor.border": "#26233a", "diffEditor.diagonalFill": "#6e6a8666", - "diffEditor.insertedTextBackground": "#9ccfd814", - "diffEditor.insertedTextBorder": "#9ccfd880", - "diffEditor.removedTextBackground": "#eb6f9214", - "diffEditor.removedTextBorder": "#eb6f9280", + "diffEditor.insertedTextBackground": "#9ccfd826", + "diffEditor.removedTextBackground": "#eb6f9226", + "diffEditorOverview.insertedForeground": "#9ccfd880", + "diffEditorOverview.removedForeground": "#eb6f9280", "dropdown.background": "#1f1d2e", "dropdown.border": "#6e6a8633", "dropdown.foreground": "#e0def4", @@ -227,14 +227,14 @@ "inputOption.activeBackground": "#ebbcba", "inputOption.activeBorder": "#0000", "inputOption.activeForeground": "#191724", - "inputValidation.errorBackground": "#0000", - "inputValidation.errorBorder": "#0000", + "inputValidation.errorBackground": "#1f1d2e", + "inputValidation.errorBorder": "#6e6a8666", "inputValidation.errorForeground": "#eb6f92", - "inputValidation.infoBackground": "#0000", - "inputValidation.infoBorder": "#0000", + "inputValidation.infoBackground": "#1f1d2e", + "inputValidation.infoBorder": "#6e6a8666", "inputValidation.infoForeground": "#9ccfd8", - "inputValidation.warningBackground": "#0000", - "inputValidation.warningBorder": "#0000", + "inputValidation.warningBackground": "#1f1d2e", + "inputValidation.warningBorder": "#6e6a8666", "inputValidation.warningForeground": "#9ccfd880", "keybindingLabel.background": "#26233a", "keybindingLabel.border": "#6e6a8666", @@ -271,7 +271,7 @@ "menu.selectionBackground": "#6e6a8633", "menu.selectionBorder": "#26233a", "menu.selectionForeground": "#e0def4", - "menu.separatorBackground": "#e0def4", + "menu.separatorBackground": "#6e6a8666", "menubar.selectionBackground": "#6e6a8633", "menubar.selectionBorder": "#6e6a861a", "menubar.selectionForeground": "#e0def4", @@ -338,9 +338,9 @@ "quickInputList.focusForeground": "#e0def4", "quickInputList.focusIconForeground": "#e0def4", "scrollbar.shadow": "#0000", - "scrollbarSlider.activeBackground": "#6e6a8666", - "scrollbarSlider.background": "#6e6a861a", - "scrollbarSlider.hoverBackground": "#6e6a8633", + "scrollbarSlider.activeBackground": "#31748f80", + "scrollbarSlider.background": "#6e6a8633", + "scrollbarSlider.hoverBackground": "#6e6a8666", "searchEditor.findMatchBackground": "#6e6a8633", "selection.background": "#6e6a8666", "settings.focusedRowBackground": "#1f1d2e", @@ -519,6 +519,24 @@ "foreground": "#31748f" } }, + { + "scope": ["markup.inserted.diff"], + "settings": { + "foreground": "#9ccfd8" + } + }, + { + "scope": ["markup.deleted.diff"], + "settings": { + "foreground": "#eb6f92" + } + }, + { + "scope": ["meta.diff.range"], + "settings": { + "foreground": "#c4a7e7" + } + }, { "scope": ["meta.tag", "meta.brace"], "settings": { diff --git a/apps/web/public/assets/shiki/themes/solarized-dark.json b/apps/web/public/assets/shiki/themes/solarized-dark.json index f47b0fc0..17630be1 100644 --- a/apps/web/public/assets/shiki/themes/solarized-dark.json +++ b/apps/web/public/assets/shiki/themes/solarized-dark.json @@ -7,7 +7,7 @@ } }, { - "scope": ["meta.embedded", "source.groovy.embedded"], + "scope": ["meta.embedded", "source.groovy.embedded", "string meta.image.inline.markdown"], "settings": { "foreground": "#839496" } @@ -31,7 +31,7 @@ "name": "Regexp", "scope": "string.regexp", "settings": { - "foreground": "#D30102" + "foreground": "#DC322F" } }, { @@ -94,7 +94,7 @@ "name": "Embedded code markers", "scope": ["punctuation.section.embedded.begin", "punctuation.section.embedded.end"], "settings": { - "foreground": "#D30102" + "foreground": "#DC322F" } }, { @@ -162,12 +162,12 @@ "name": "Continuation", "scope": "punctuation.separator.continuation", "settings": { - "foreground": "#D30102" + "foreground": "#DC322F" } }, { "name": "Library constant", - "scope": "support.constant", + "scope": ["support.constant", "support.variable"], "settings": {} }, { @@ -193,7 +193,7 @@ "name": "Invalid", "scope": "invalid", "settings": { - "foreground": "#D30102" + "foreground": "#DC322F" } }, { @@ -201,7 +201,7 @@ "scope": ["meta.diff", "meta.diff.header"], "settings": { "fontStyle": "italic", - "foreground": "#E0EDDD" + "foreground": "#268BD2" } }, { @@ -209,7 +209,7 @@ "scope": "markup.deleted", "settings": { "fontStyle": "", - "foreground": "#dc322f" + "foreground": "#DC322F" } }, { @@ -217,14 +217,14 @@ "scope": "markup.changed", "settings": { "fontStyle": "", - "foreground": "#cb4b16" + "foreground": "#CB4B16" } }, { "name": "diff: inserted", "scope": "markup.inserted", "settings": { - "foreground": "#219186" + "foreground": "#859900" } }, { diff --git a/apps/web/public/assets/shiki/themes/solarized-light.json b/apps/web/public/assets/shiki/themes/solarized-light.json index 5c92870c..c55d2938 100644 --- a/apps/web/public/assets/shiki/themes/solarized-light.json +++ b/apps/web/public/assets/shiki/themes/solarized-light.json @@ -7,7 +7,7 @@ } }, { - "scope": ["meta.embedded", "source.groovy.embedded"], + "scope": ["meta.embedded", "source.groovy.embedded", "string meta.image.inline.markdown"], "settings": { "foreground": "#657B83" } @@ -31,7 +31,7 @@ "name": "Regexp", "scope": "string.regexp", "settings": { - "foreground": "#D30102" + "foreground": "#DC322F" } }, { @@ -72,7 +72,8 @@ "entity.name.scope-resolution" ], "settings": { - "foreground": "#268BD2" + "fontStyle": "", + "foreground": "#CB4B16" } }, { @@ -93,7 +94,7 @@ "name": "Embedded code markers", "scope": ["punctuation.section.embedded.begin", "punctuation.section.embedded.end"], "settings": { - "foreground": "#D30102" + "foreground": "#DC322F" } }, { @@ -107,7 +108,7 @@ "name": "Support.construct", "scope": ["support.function.construct", "keyword.other.new"], "settings": { - "foreground": "#D30102" + "foreground": "#CB4B16" } }, { @@ -120,7 +121,9 @@ { "name": "Inherited class", "scope": "entity.other.inherited-class", - "settings": {} + "settings": { + "foreground": "#6C71C4" + } }, { "name": "Function argument", @@ -136,7 +139,7 @@ }, { "name": "Tag start/end", - "scope": ["punctuation.definition.tag.begin", "punctuation.definition.tag.end"], + "scope": "punctuation.definition.tag", "settings": { "foreground": "#93A1A1" } @@ -159,7 +162,7 @@ "name": "Continuation", "scope": "punctuation.separator.continuation", "settings": { - "foreground": "#D30102" + "foreground": "#DC322F" } }, { @@ -190,7 +193,7 @@ "name": "Invalid", "scope": "invalid", "settings": { - "foreground": "#cd3131" + "foreground": "#DC322F" } }, { @@ -198,7 +201,7 @@ "scope": ["meta.diff", "meta.diff.header"], "settings": { "fontStyle": "italic", - "foreground": "#268bd2" + "foreground": "#268BD2" } }, { @@ -206,7 +209,7 @@ "scope": "markup.deleted", "settings": { "fontStyle": "", - "foreground": "#dc322f" + "foreground": "#DC322F" } }, { @@ -214,14 +217,14 @@ "scope": "markup.changed", "settings": { "fontStyle": "", - "foreground": "#cb4b16" + "foreground": "#CB4B16" } }, { "name": "diff: inserted", "scope": "markup.inserted", "settings": { - "foreground": "#219186" + "foreground": "#859900" } }, { @@ -373,6 +376,7 @@ "terminal.ansiBrightMagenta": "#6c71c4", "terminal.ansiBrightCyan": "#93a1a1", "terminal.ansiBrightWhite": "#fdf6e3", + "terminal.background": "#FDF6E3", "walkThrough.embeddedEditorBackground": "#00000014" }, "semanticHighlighting": true diff --git a/apps/web/public/assets/shiki/themes/vitesse-dark.json b/apps/web/public/assets/shiki/themes/vitesse-dark.json index 468b4786..f395041a 100644 --- a/apps/web/public/assets/shiki/themes/vitesse-dark.json +++ b/apps/web/public/assets/shiki/themes/vitesse-dark.json @@ -3,13 +3,13 @@ "base": "vs-dark", "colors": { "focusBorder": "#00000000", - "foreground": "#dbd7ca", + "foreground": "#dbd7caee", "descriptionForeground": "#dedcd590", "errorForeground": "#cb7676", "textLink.foreground": "#4d9375", "textLink.activeForeground": "#4d9375", "textBlockQuote.background": "#121212", - "textBlockQuote.border": "#181818", + "textBlockQuote.border": "#191919", "textCodeBlock.background": "#121212", "textPreformat.foreground": "#d1d5da", "textSeparator.foreground": "#586069", @@ -17,15 +17,16 @@ "button.foreground": "#121212", "button.hoverBackground": "#4d9375", "checkbox.background": "#181818", - "checkbox.border": "#111", + "checkbox.border": "#2f363d", "dropdown.background": "#121212", - "dropdown.border": "#181818", - "dropdown.foreground": "#dbd7ca", + "dropdown.border": "#191919", + "dropdown.foreground": "#dbd7caee", "dropdown.listBackground": "#181818", "input.background": "#181818", - "input.border": "#181818", - "input.foreground": "#dbd7ca", + "input.border": "#191919", + "input.foreground": "#dbd7caee", "input.placeholderForeground": "#dedcd590", + "inputOption.activeBackground": "#dedcd530", "badge.foreground": "#121212", "badge.background": "#dedcd590", "progressBar.background": "#4d9375", @@ -34,70 +35,70 @@ "titleBar.inactiveForeground": "#959da5", "titleBar.inactiveBackground": "#121212", "titleBar.border": "#181818", - "activityBar.foreground": "#dbd7ca", + "activityBar.foreground": "#dbd7caee", "activityBar.inactiveForeground": "#dedcd530", "activityBar.background": "#121212", "activityBarBadge.foreground": "#121212", "activityBarBadge.background": "#bfbaaa", "activityBar.activeBorder": "#4d9375", - "activityBar.border": "#181818", + "activityBar.border": "#191919", "sideBar.foreground": "#bfbaaa", "sideBar.background": "#121212", - "sideBar.border": "#181818", - "sideBarTitle.foreground": "#dbd7ca", - "sideBarSectionHeader.foreground": "#dbd7ca", + "sideBar.border": "#191919", + "sideBarTitle.foreground": "#dbd7caee", + "sideBarSectionHeader.foreground": "#dbd7caee", "sideBarSectionHeader.background": "#121212", - "sideBarSectionHeader.border": "#181818", - "list.hoverForeground": "#dbd7ca", - "list.inactiveSelectionForeground": "#dbd7ca", - "list.activeSelectionForeground": "#dbd7ca", + "sideBarSectionHeader.border": "#191919", + "list.hoverForeground": "#dbd7caee", + "list.inactiveSelectionForeground": "#dbd7caee", + "list.activeSelectionForeground": "#dbd7caee", "list.hoverBackground": "#181818", - "list.inactiveSelectionBackground": "#121212", + "list.inactiveSelectionBackground": "#181818", "list.activeSelectionBackground": "#181818", "list.inactiveFocusBackground": "#121212", "list.focusBackground": "#181818", "tree.indentGuidesStroke": "#2f363d", "notificationCenterHeader.foreground": "#959da5", "notificationCenterHeader.background": "#121212", - "notifications.foreground": "#dbd7ca", + "notifications.foreground": "#dbd7caee", "notifications.background": "#121212", - "notifications.border": "#181818", + "notifications.border": "#191919", "notificationsErrorIcon.foreground": "#cb7676", "notificationsWarningIcon.foreground": "#d4976c", "notificationsInfoIcon.foreground": "#6394bf", "pickerGroup.border": "#444d56", - "pickerGroup.foreground": "#dbd7ca", + "pickerGroup.foreground": "#dbd7caee", "quickInput.background": "#121212", - "quickInput.foreground": "#dbd7ca", + "quickInput.foreground": "#dbd7caee", "statusBar.foreground": "#bfbaaa", "statusBar.background": "#121212", - "statusBar.border": "#181818", + "statusBar.border": "#191919", "statusBar.noFolderBackground": "#121212", "statusBar.debuggingBackground": "#181818", "statusBar.debuggingForeground": "#bfbaaa", "statusBarItem.prominentBackground": "#181818", "editorGroupHeader.tabsBackground": "#121212", - "editorGroupHeader.tabsBorder": "#181818", - "editorGroup.border": "#181818", - "tab.activeForeground": "#dbd7ca", + "editorGroupHeader.tabsBorder": "#191919", + "editorGroup.border": "#191919", + "tab.activeForeground": "#dbd7caee", "tab.inactiveForeground": "#959da5", "tab.inactiveBackground": "#121212", "tab.activeBackground": "#121212", "tab.hoverBackground": "#181818", "tab.unfocusedHoverBackground": "#121212", - "tab.border": "#181818", - "tab.unfocusedActiveBorderTop": "#181818", - "tab.activeBorder": "#181818", - "tab.unfocusedActiveBorder": "#181818", + "tab.border": "#191919", + "tab.unfocusedActiveBorderTop": "#191919", + "tab.activeBorder": "#191919", + "tab.unfocusedActiveBorder": "#191919", "tab.activeBorderTop": "#dedcd590", "breadcrumb.foreground": "#959da5", - "breadcrumb.focusForeground": "#dbd7ca", - "breadcrumb.activeSelectionForeground": "#d1d5da", + "breadcrumb.focusForeground": "#dbd7caee", + "breadcrumb.activeSelectionForeground": "#eeeeee15", "breadcrumbPicker.background": "#121212", - "editor.foreground": "#dbd7ca", + "editor.foreground": "#dbd7caee", "editor.background": "#121212", "editorWidget.background": "#121212", - "editor.foldBackground": "#121212", + "editor.foldBackground": "#eeeeee10", "editor.lineHighlightBackground": "#181818", "editorLineNumber.foreground": "#dedcd530", "editorLineNumber.activeForeground": "#bfbaaa", @@ -106,9 +107,9 @@ "editorWhitespace.foreground": "#ffffff15", "editor.findMatchBackground": "#e6cc7722", "editor.findMatchHighlightBackground": "#e6cc7744", - "editor.inactiveSelectionBackground": "#eeeeee10", - "editor.selectionBackground": "#eeeeee10", - "editor.selectionHighlightBackground": "#eeeeee15", + "editor.inactiveSelectionBackground": "#eeeeee08", + "editor.selectionBackground": "#eeeeee15", + "editor.selectionHighlightBackground": "#eeeeee08", "editor.wordHighlightBackground": "#1c6b4805", "editor.wordHighlightStrongBackground": "#1c6b4810", "editorBracketMatch.background": "#4d937520", @@ -120,17 +121,18 @@ "scrollbarSlider.activeBackground": "#dedcd530", "editorOverviewRuler.border": "#111", "panel.background": "#121212", - "panel.border": "#181818", + "panel.border": "#191919", "panelTitle.activeBorder": "#4d9375", - "panelTitle.activeForeground": "#dbd7ca", + "panelTitle.activeForeground": "#dbd7caee", "panelTitle.inactiveForeground": "#959da5", "panelInput.border": "#2f363d", - "terminal.foreground": "#dbd7ca", + "terminal.foreground": "#dbd7caee", + "terminal.selectionBackground": "#eeeeee15", "terminal.ansiBrightBlack": "#777777", "terminal.ansiBrightBlue": "#6394bf", "terminal.ansiBrightCyan": "#5eaab5", "terminal.ansiBrightGreen": "#4d9375", - "terminal.ansiBrightMagenta": "#db889a", + "terminal.ansiBrightMagenta": "#d9739f", "terminal.ansiBrightRed": "#cb7676", "terminal.ansiBrightWhite": "#ffffff", "terminal.ansiBrightYellow": "#e6cc77", @@ -138,9 +140,9 @@ "terminal.ansiBlue": "#6394bf", "terminal.ansiCyan": "#5eaab5", "terminal.ansiGreen": "#4d9375", - "terminal.ansiMagenta": "#db889a", + "terminal.ansiMagenta": "#d9739f", "terminal.ansiRed": "#cb7676", - "terminal.ansiWhite": "#ffffff", + "terminal.ansiWhite": "#dbd7caee", "terminal.ansiYellow": "#e6cc77", "gitDecoration.addedResourceForeground": "#4d9375", "gitDecoration.modifiedResourceForeground": "#6394bf", @@ -155,9 +157,9 @@ "editorBracketHighlight.foreground1": "#5eaab5", "editorBracketHighlight.foreground2": "#4d9375", "editorBracketHighlight.foreground3": "#d4976c", - "editorBracketHighlight.foreground4": "#db889a", + "editorBracketHighlight.foreground4": "#d9739f", "editorBracketHighlight.foreground5": "#e6cc77", - "editorBracketHighlight.foreground6": "#429988", + "editorBracketHighlight.foreground6": "#6394bf", "debugToolBar.background": "#121212", "editor.stackFrameHighlightBackground": "#a707", "editor.focusedStackFrameHighlightBackground": "#b808", @@ -165,7 +167,7 @@ "peekViewResult.matchHighlightBackground": "#ffd33d33", "peekViewEditor.background": "#121212", "peekViewResult.background": "#121212", - "settings.headerForeground": "#dbd7ca", + "settings.headerForeground": "#dbd7caee", "settings.modifiedItemIndicator": "#4d9375", "welcomePage.buttonBackground": "#2f363d", "welcomePage.buttonHoverBackground": "#444d56", @@ -177,78 +179,97 @@ "editorInfo.foreground": "#6394bf", "editorHint.foreground": "#4d9375", "editorGutter.commentRangeForeground": "#dedcd530", - "editorGutter.foldingControlForeground": "#dedcd590" + "editorGutter.foldingControlForeground": "#dedcd590", + "editorInlayHint.foreground": "#666666", + "editorInlayHint.background": "#00000000" }, "semanticHighlighting": true, "semanticTokenColors": { "namespace": "#db889a", - "interface": "#67b893", - "class": "#5eaab5" + "property": "#b8a965", + "interface": "#5DA994", + "type": "#5DA994", + "class": "#6893BF" }, "tokenColors": [ { "scope": ["comment", "punctuation.definition.comment", "string.comment"], "settings": { - "foreground": "#758575" + "foreground": "#758575dd" } }, { "scope": [ - "punctuation", - "delimiter", "delimiter.bracket", - "meta.tag.inline.any.html", + "delimiter", + "invalid.illegal.character-not-allowed-here.html", + "keyword.operator.assignment", + "keyword.operator.assignment", + "keyword.operator.rest", + "keyword.operator.spread", + "keyword.operator.type.annotation", + "meta.brace", "meta.tag.block.any.html", - "meta.brace" + "meta.tag.inline.any.html", + "meta.tag.structure.input.void.html", + "meta.type.annotation", + "storage.type.function.arrow", + "keyword.operator.type", + "punctuation" ], "settings": { - "foreground": "#858585" + "foreground": "#666666" } }, { "scope": [ "constant", "entity.name.constant", - "variable.other.constant", "variable.language", "meta.definition.variable" ], "settings": { - "foreground": "#d4976c" + "foreground": "#c99076" } }, { "scope": ["entity", "entity.name"], "settings": { - "foreground": "#a1b567" + "foreground": "#80a665" } }, { "scope": "variable.parameter.function", "settings": { - "foreground": "#dbd7ca" + "foreground": "#dbd7caee" } }, { "scope": ["entity.name.tag", "tag.html"], "settings": { - "foreground": "#429988" + "foreground": "#4d9375" } }, { "scope": "entity.name.function", "settings": { - "foreground": "#a1b567" + "foreground": "#80a665" } }, { - "scope": "keyword", + "scope": ["keyword", "storage.type.class.jsdoc"], "settings": { "foreground": "#4d9375" } }, { - "scope": ["storage", "storage.type"], + "scope": [ + "storage", + "storage.type", + "support.type.builtin", + "constant.language.undefined", + "constant.language.null" + ], "settings": { "foreground": "#cb7676" } @@ -256,41 +277,64 @@ { "scope": ["storage.modifier.package", "storage.modifier.import", "storage.type.java"], "settings": { - "foreground": "#dbd7ca" + "foreground": "#dbd7caee" } }, { - "scope": [ - "string", - "punctuation.definition.string", - "string punctuation.section.embedded source", - "attribute.value" - ], + "scope": ["string", "string punctuation.section.embedded source", "attribute.value"], "settings": { "foreground": "#c98a7d" } }, + { + "scope": ["punctuation.definition.string"], + "settings": { + "foreground": "#c98a7daa" + } + }, + { + "scope": ["punctuation.support.type.property-name"], + "settings": { + "foreground": "#b8a965aa" + } + }, { "scope": "support", "settings": { - "foreground": "#e0a569" + "foreground": "#b8a965" } }, { "scope": [ + "property", "meta.property-name", - "entity.other.attribute-name", "meta.object-literal.key", + "entity.name.tag.yaml", "attribute.name" ], "settings": { - "foreground": "#e0a569" + "foreground": "#b8a965" + } + }, + { + "scope": [ + "entity.other.attribute-name", + "invalid.deprecated.entity.other.attribute-name.html" + ], + "settings": { + "foreground": "#bd976a" } }, { "scope": ["variable", "identifier"], "settings": { - "foreground": "#b8a965" + "foreground": "#bd976a" + } + }, + { + "scope": ["support.type.primitive", "entity.name.type"], + "settings": { + "foreground": "#5da9a7" } }, { @@ -300,7 +344,7 @@ } }, { - "scope": "keyword.operator", + "scope": ["keyword.operator", "meta.var.expr.ts"], "settings": { "foreground": "#cb7676" } @@ -351,7 +395,7 @@ { "scope": "string source", "settings": { - "foreground": "#dbd7ca" + "foreground": "#dbd7caee" } }, { @@ -384,21 +428,15 @@ } }, { - "scope": "support.constant", + "scope": ["support.constant"], "settings": { - "foreground": "#d4976c" - } - }, - { - "scope": "support.variable", - "settings": { - "foreground": "#429988" + "foreground": "#c99076" } }, { "scope": ["constant.numeric", "number"], "settings": { - "foreground": "#6394bf" + "foreground": "#4C9A91" } }, { @@ -408,7 +446,7 @@ } }, { - "scope": "constant.language.boolean", + "scope": ["constant.language.boolean", "constant.language"], "settings": { "foreground": "#4d9375" } @@ -435,21 +473,21 @@ { "scope": "markup.quote", "settings": { - "foreground": "#4d9375" + "foreground": "#5DA994" } }, { "scope": "markup.italic", "settings": { "fontStyle": "italic", - "foreground": "#dbd7ca" + "foreground": "#dbd7caee" } }, { "scope": "markup.bold", "settings": { "fontStyle": "bold", - "foreground": "#dbd7ca" + "foreground": "#dbd7caee" } }, { @@ -552,95 +590,147 @@ { "scope": ["type.identifier"], "settings": { - "foreground": "#5eaab5" + "foreground": "#6893BF" + } + }, + { + "scope": ["entity.other.attribute-name.html.vue"], + "settings": { + "foreground": "#80a665" + } + }, + { + "scope": ["invalid.illegal.unrecognized-tag.html"], + "settings": { + "fontStyle": "normal" } } ], "rules": [ { "token": "comment", - "foreground": "758575" + "foreground": "758575dd" }, { "token": "punctuation.definition.comment", - "foreground": "758575" + "foreground": "758575dd" }, { "token": "string.comment", - "foreground": "758575" + "foreground": "758575dd" }, { - "token": "punctuation", - "foreground": "858585" + "token": "delimiter.bracket", + "foreground": "666666" }, { "token": "delimiter", - "foreground": "858585" + "foreground": "666666" }, { - "token": "delimiter.bracket", - "foreground": "858585" + "token": "invalid.illegal.character-not-allowed-here.html", + "foreground": "666666" }, { - "token": "meta.tag.inline.any.html", - "foreground": "858585" + "token": "keyword.operator.assignment", + "foreground": "666666" }, { - "token": "meta.tag.block.any.html", - "foreground": "858585" + "token": "keyword.operator.assignment", + "foreground": "666666" + }, + { + "token": "keyword.operator.rest", + "foreground": "666666" + }, + { + "token": "keyword.operator.spread", + "foreground": "666666" + }, + { + "token": "keyword.operator.type.annotation", + "foreground": "666666" }, { "token": "meta.brace", - "foreground": "858585" + "foreground": "666666" }, { - "token": "constant", - "foreground": "d4976c" + "token": "meta.tag.block.any.html", + "foreground": "666666" }, { - "token": "entity.name.constant", - "foreground": "d4976c" + "token": "meta.tag.inline.any.html", + "foreground": "666666" }, { - "token": "variable.other.constant", - "foreground": "d4976c" + "token": "meta.tag.structure.input.void.html", + "foreground": "666666" + }, + { + "token": "meta.type.annotation", + "foreground": "666666" + }, + { + "token": "storage.type.function.arrow", + "foreground": "666666" + }, + { + "token": "keyword.operator.type", + "foreground": "666666" + }, + { + "token": "punctuation", + "foreground": "666666" + }, + { + "token": "constant", + "foreground": "c99076" + }, + { + "token": "entity.name.constant", + "foreground": "c99076" }, { "token": "variable.language", - "foreground": "d4976c" + "foreground": "c99076" }, { "token": "meta.definition.variable", - "foreground": "d4976c" + "foreground": "c99076" }, { "token": "entity", - "foreground": "a1b567" + "foreground": "80a665" }, { "token": "entity.name", - "foreground": "a1b567" + "foreground": "80a665" }, { "token": "variable.parameter.function", - "foreground": "dbd7ca" + "foreground": "dbd7caee" }, { "token": "entity.name.tag", - "foreground": "429988" + "foreground": "4d9375" }, { "token": "tag.html", - "foreground": "429988" + "foreground": "4d9375" }, { "token": "entity.name.function", - "foreground": "a1b567" + "foreground": "80a665" }, { "token": "keyword", "foreground": "4d9375" }, + { + "token": "storage.type.class.jsdoc", + "foreground": "4d9375" + }, { "token": "storage", "foreground": "cb7676" @@ -649,26 +739,34 @@ "token": "storage.type", "foreground": "cb7676" }, + { + "token": "support.type.builtin", + "foreground": "cb7676" + }, + { + "token": "constant.language.undefined", + "foreground": "cb7676" + }, + { + "token": "constant.language.null", + "foreground": "cb7676" + }, { "token": "storage.modifier.package", - "foreground": "dbd7ca" + "foreground": "dbd7caee" }, { "token": "storage.modifier.import", - "foreground": "dbd7ca" + "foreground": "dbd7caee" }, { "token": "storage.type.java", - "foreground": "dbd7ca" + "foreground": "dbd7caee" }, { "token": "string", "foreground": "c98a7d" }, - { - "token": "punctuation.definition.string", - "foreground": "c98a7d" - }, { "token": "string punctuation.section.embedded source", "foreground": "c98a7d" @@ -677,33 +775,61 @@ "token": "attribute.value", "foreground": "c98a7d" }, + { + "token": "punctuation.definition.string", + "foreground": "c98a7daa" + }, + { + "token": "punctuation.support.type.property-name", + "foreground": "b8a965aa" + }, { "token": "support", - "foreground": "e0a569" + "foreground": "b8a965" }, { - "token": "meta.property-name", - "foreground": "e0a569" + "token": "property", + "foreground": "b8a965" }, { - "token": "entity.other.attribute-name", - "foreground": "e0a569" + "token": "meta.property-name", + "foreground": "b8a965" }, { "token": "meta.object-literal.key", - "foreground": "e0a569" + "foreground": "b8a965" + }, + { + "token": "entity.name.tag.yaml", + "foreground": "b8a965" }, { "token": "attribute.name", - "foreground": "e0a569" + "foreground": "b8a965" + }, + { + "token": "entity.other.attribute-name", + "foreground": "bd976a" + }, + { + "token": "invalid.deprecated.entity.other.attribute-name.html", + "foreground": "bd976a" }, { "token": "variable", - "foreground": "b8a965" + "foreground": "bd976a" }, { "token": "identifier", - "foreground": "b8a965" + "foreground": "bd976a" + }, + { + "token": "support.type.primitive", + "foreground": "5da9a7" + }, + { + "token": "entity.name.type", + "foreground": "5da9a7" }, { "token": "namespace", @@ -713,6 +839,10 @@ "token": "keyword.operator", "foreground": "cb7676" }, + { + "token": "meta.var.expr.ts", + "foreground": "cb7676" + }, { "token": "invalid.broken", "foreground": "fdaeb7" @@ -739,7 +869,7 @@ }, { "token": "string source", - "foreground": "dbd7ca" + "foreground": "dbd7caee" }, { "token": "string variable", @@ -775,19 +905,15 @@ }, { "token": "support.constant", - "foreground": "d4976c" - }, - { - "token": "support.variable", - "foreground": "429988" + "foreground": "c99076" }, { "token": "constant.numeric", - "foreground": "6394bf" + "foreground": "4C9A91" }, { "token": "number", - "foreground": "6394bf" + "foreground": "4C9A91" }, { "token": "keyword.other.unit", @@ -797,6 +923,10 @@ "token": "constant.language.boolean", "foreground": "4d9375" }, + { + "token": "constant.language", + "foreground": "4d9375" + }, { "token": "meta.module-reference", "foreground": "4d9375" @@ -815,15 +945,15 @@ }, { "token": "markup.quote", - "foreground": "4d9375" + "foreground": "5DA994" }, { "token": "markup.italic", - "foreground": "dbd7ca" + "foreground": "dbd7caee" }, { "token": "markup.bold", - "foreground": "dbd7ca" + "foreground": "dbd7caee" }, { "token": "markup.raw", @@ -935,7 +1065,14 @@ }, { "token": "type.identifier", - "foreground": "5eaab5" + "foreground": "6893BF" + }, + { + "token": "entity.other.attribute-name.html.vue", + "foreground": "80a665" + }, + { + "token": "invalid.illegal.unrecognized-tag.html" } ] } diff --git a/apps/web/public/assets/shiki/themes/vitesse-light.json b/apps/web/public/assets/shiki/themes/vitesse-light.json index 0dddaeb5..70a979c7 100644 --- a/apps/web/public/assets/shiki/themes/vitesse-light.json +++ b/apps/web/public/assets/shiki/themes/vitesse-light.json @@ -26,6 +26,7 @@ "input.border": "#f0f0f0", "input.foreground": "#393a34", "input.placeholderForeground": "#393a3490", + "inputOption.activeBackground": "#393a3450", "badge.foreground": "#ffffff", "badge.background": "#393a3490", "progressBar.background": "#1c6b48", @@ -52,7 +53,7 @@ "list.inactiveSelectionForeground": "#393a34", "list.activeSelectionForeground": "#393a34", "list.hoverBackground": "#f5f5f5", - "list.inactiveSelectionBackground": "#ffffff", + "list.inactiveSelectionBackground": "#f5f5f5", "list.activeSelectionBackground": "#f5f5f5", "list.inactiveFocusBackground": "#ffffff", "list.focusBackground": "#f5f5f5", @@ -92,12 +93,12 @@ "tab.activeBorderTop": "#393a3490", "breadcrumb.foreground": "#6a737d", "breadcrumb.focusForeground": "#393a34", - "breadcrumb.activeSelectionForeground": "#586069", + "breadcrumb.activeSelectionForeground": "#22222215", "breadcrumbPicker.background": "#ffffff", "editor.foreground": "#393a34", "editor.background": "#ffffff", "editorWidget.background": "#ffffff", - "editor.foldBackground": "#ffffff", + "editor.foldBackground": "#22222210", "editor.lineHighlightBackground": "#f5f5f5", "editorLineNumber.foreground": "#393a3450", "editorLineNumber.activeForeground": "#4e4f47", @@ -106,9 +107,9 @@ "editorWhitespace.foreground": "#00000015", "editor.findMatchBackground": "#e6cc7744", "editor.findMatchHighlightBackground": "#e6cc7766", - "editor.inactiveSelectionBackground": "#22222210", - "editor.selectionBackground": "#22222210", - "editor.selectionHighlightBackground": "#22222215", + "editor.inactiveSelectionBackground": "#22222208", + "editor.selectionBackground": "#22222215", + "editor.selectionHighlightBackground": "#22222208", "editor.wordHighlightBackground": "#1c6b4805", "editor.wordHighlightStrongBackground": "#1c6b4810", "editorBracketMatch.background": "#1c6b4820", @@ -126,23 +127,24 @@ "panelTitle.inactiveForeground": "#6a737d", "panelInput.border": "#e1e4e8", "terminal.foreground": "#393a34", + "terminal.selectionBackground": "#22222215", "terminal.ansiBrightBlack": "#aaaaaa", "terminal.ansiBrightBlue": "#296aa3", "terminal.ansiBrightCyan": "#2993a3", - "terminal.ansiBrightGreen": "#1c6b48", - "terminal.ansiBrightMagenta": "#b05a78", + "terminal.ansiBrightGreen": "#1e754f", + "terminal.ansiBrightMagenta": "#a13865", "terminal.ansiBrightRed": "#ab5959", - "terminal.ansiBrightWhite": "#dbd7ca", + "terminal.ansiBrightWhite": "#dddddd", "terminal.ansiBrightYellow": "#bda437", "terminal.ansiBlack": "#121212", "terminal.ansiBlue": "#296aa3", "terminal.ansiCyan": "#2993a3", - "terminal.ansiGreen": "#1c6b48", - "terminal.ansiMagenta": "#b05a78", + "terminal.ansiGreen": "#1e754f", + "terminal.ansiMagenta": "#a13865", "terminal.ansiRed": "#ab5959", - "terminal.ansiWhite": "#dbd7ca", + "terminal.ansiWhite": "#dbd7caee", "terminal.ansiYellow": "#bda437", - "gitDecoration.addedResourceForeground": "#1c6b48", + "gitDecoration.addedResourceForeground": "#1e754f", "gitDecoration.modifiedResourceForeground": "#296aa3", "gitDecoration.deletedResourceForeground": "#ab5959", "gitDecoration.untrackedResourceForeground": "#2993a3", @@ -150,14 +152,14 @@ "gitDecoration.conflictingResourceForeground": "#a65e2b", "gitDecoration.submoduleResourceForeground": "#393a3490", "editorGutter.modifiedBackground": "#296aa3", - "editorGutter.addedBackground": "#1c6b48", + "editorGutter.addedBackground": "#1e754f", "editorGutter.deletedBackground": "#ab5959", "editorBracketHighlight.foreground1": "#2993a3", - "editorBracketHighlight.foreground2": "#1c6b48", + "editorBracketHighlight.foreground2": "#1e754f", "editorBracketHighlight.foreground3": "#a65e2b", - "editorBracketHighlight.foreground4": "#b05a78", + "editorBracketHighlight.foreground4": "#a13865", "editorBracketHighlight.foreground5": "#bda437", - "editorBracketHighlight.foreground6": "#2f8a89", + "editorBracketHighlight.foreground6": "#296aa3", "debugToolBar.background": "#ffffff", "editor.stackFrameHighlightBackground": "#fffbdd", "editor.focusedStackFrameHighlightBackground": "#fff5b1", @@ -173,15 +175,19 @@ "editorError.foreground": "#ab5959", "editorWarning.foreground": "#a65e2b", "editorInfo.foreground": "#296aa3", - "editorHint.foreground": "#1c6b48", + "editorHint.foreground": "#1e754f", "editorGutter.commentRangeForeground": "#393a3450", - "editorGutter.foldingControlForeground": "#393a3490" + "editorGutter.foldingControlForeground": "#393a3490", + "editorInlayHint.foreground": "#999999", + "editorInlayHint.background": "#00000000" }, "semanticHighlighting": true, "semanticTokenColors": { "namespace": "#b05a78", - "interface": "#2e8f63", - "class": "#2993a3" + "property": "#998418", + "interface": "#2e8f82", + "type": "#2e8f82", + "class": "#5a6aa6" }, "tokenColors": [ { @@ -192,22 +198,31 @@ }, { "scope": [ - "punctuation", - "delimiter", "delimiter.bracket", - "meta.tag.inline.any.html", + "delimiter", + "invalid.illegal.character-not-allowed-here.html", + "keyword.operator.assignment", + "keyword.operator.assignment", + "keyword.operator.rest", + "keyword.operator.spread", + "keyword.operator.type.annotation", + "meta.brace", "meta.tag.block.any.html", - "meta.brace" + "meta.tag.inline.any.html", + "meta.tag.structure.input.void.html", + "meta.type.annotation", + "storage.type.function.arrow", + "keyword.operator.type", + "punctuation" ], "settings": { - "foreground": "#8e8f8b" + "foreground": "#999999" } }, { "scope": [ "constant", "entity.name.constant", - "variable.other.constant", "variable.language", "meta.definition.variable" ], @@ -218,7 +233,7 @@ { "scope": ["entity", "entity.name"], "settings": { - "foreground": "#6c7834" + "foreground": "#59873a" } }, { @@ -230,23 +245,29 @@ { "scope": ["entity.name.tag", "tag.html"], "settings": { - "foreground": "#2f8a89" + "foreground": "#1e754f" } }, { "scope": "entity.name.function", "settings": { - "foreground": "#6c7834" + "foreground": "#59873a" } }, { - "scope": "keyword", + "scope": ["keyword", "storage.type.class.jsdoc"], "settings": { - "foreground": "#1c6b48" + "foreground": "#1e754f" } }, { - "scope": ["storage", "storage.type"], + "scope": [ + "storage", + "storage.type", + "support.type.builtin", + "constant.language.undefined", + "constant.language.null" + ], "settings": { "foreground": "#ab5959" } @@ -258,37 +279,60 @@ } }, { - "scope": [ - "string", - "punctuation.definition.string", - "string punctuation.section.embedded source", - "attribute.value" - ], + "scope": ["string", "string punctuation.section.embedded source", "attribute.value"], "settings": { "foreground": "#b56959" } }, + { + "scope": ["punctuation.definition.string"], + "settings": { + "foreground": "#b56959aa" + } + }, + { + "scope": ["punctuation.support.type.property-name"], + "settings": { + "foreground": "#998418aa" + } + }, { "scope": "support", "settings": { - "foreground": "#b58451" + "foreground": "#998418" } }, { "scope": [ + "property", "meta.property-name", - "entity.other.attribute-name", "meta.object-literal.key", + "entity.name.tag.yaml", "attribute.name" ], "settings": { - "foreground": "#b58451" + "foreground": "#998418" + } + }, + { + "scope": [ + "entity.other.attribute-name", + "invalid.deprecated.entity.other.attribute-name.html" + ], + "settings": { + "foreground": "#b07d48" } }, { "scope": ["variable", "identifier"], "settings": { - "foreground": "#8c862b" + "foreground": "#b07d48" + } + }, + { + "scope": ["support.type.primitive", "entity.name.type"], + "settings": { + "foreground": "#2e808f" } }, { @@ -298,7 +342,7 @@ } }, { - "scope": "keyword.operator", + "scope": ["keyword.operator", "meta.var.expr.ts"], "settings": { "foreground": "#ab5959" } @@ -382,21 +426,15 @@ } }, { - "scope": "support.constant", + "scope": ["support.constant"], "settings": { "foreground": "#a65e2b" } }, - { - "scope": "support.variable", - "settings": { - "foreground": "#2f8a89" - } - }, { "scope": ["constant.numeric", "number"], "settings": { - "foreground": "#296aa3" + "foreground": "#2f798a" } }, { @@ -406,9 +444,9 @@ } }, { - "scope": "constant.language.boolean", + "scope": ["constant.language.boolean", "constant.language"], "settings": { - "foreground": "#1c6b48" + "foreground": "#1e754f" } }, { @@ -433,7 +471,7 @@ { "scope": "markup.quote", "settings": { - "foreground": "#1c6b48" + "foreground": "#2e8f82" } }, { @@ -550,7 +588,19 @@ { "scope": ["type.identifier"], "settings": { - "foreground": "#2993a3" + "foreground": "#5a6aa6" + } + }, + { + "scope": ["entity.other.attribute-name.html.vue"], + "settings": { + "foreground": "#59873a" + } + }, + { + "scope": ["invalid.illegal.unrecognized-tag.html"], + "settings": { + "fontStyle": "normal" } } ], @@ -568,39 +618,75 @@ "foreground": "a0ada0" }, { - "token": "punctuation", - "foreground": "8e8f8b" + "token": "delimiter.bracket", + "foreground": "999999" }, { "token": "delimiter", - "foreground": "8e8f8b" + "foreground": "999999" }, { - "token": "delimiter.bracket", - "foreground": "8e8f8b" + "token": "invalid.illegal.character-not-allowed-here.html", + "foreground": "999999" }, { - "token": "meta.tag.inline.any.html", - "foreground": "8e8f8b" + "token": "keyword.operator.assignment", + "foreground": "999999" }, { - "token": "meta.tag.block.any.html", - "foreground": "8e8f8b" + "token": "keyword.operator.assignment", + "foreground": "999999" + }, + { + "token": "keyword.operator.rest", + "foreground": "999999" + }, + { + "token": "keyword.operator.spread", + "foreground": "999999" + }, + { + "token": "keyword.operator.type.annotation", + "foreground": "999999" }, { "token": "meta.brace", - "foreground": "8e8f8b" + "foreground": "999999" }, { - "token": "constant", - "foreground": "a65e2b" + "token": "meta.tag.block.any.html", + "foreground": "999999" }, { - "token": "entity.name.constant", + "token": "meta.tag.inline.any.html", + "foreground": "999999" + }, + { + "token": "meta.tag.structure.input.void.html", + "foreground": "999999" + }, + { + "token": "meta.type.annotation", + "foreground": "999999" + }, + { + "token": "storage.type.function.arrow", + "foreground": "999999" + }, + { + "token": "keyword.operator.type", + "foreground": "999999" + }, + { + "token": "punctuation", + "foreground": "999999" + }, + { + "token": "constant", "foreground": "a65e2b" }, { - "token": "variable.other.constant", + "token": "entity.name.constant", "foreground": "a65e2b" }, { @@ -613,11 +699,11 @@ }, { "token": "entity", - "foreground": "6c7834" + "foreground": "59873a" }, { "token": "entity.name", - "foreground": "6c7834" + "foreground": "59873a" }, { "token": "variable.parameter.function", @@ -625,19 +711,23 @@ }, { "token": "entity.name.tag", - "foreground": "2f8a89" + "foreground": "1e754f" }, { "token": "tag.html", - "foreground": "2f8a89" + "foreground": "1e754f" }, { "token": "entity.name.function", - "foreground": "6c7834" + "foreground": "59873a" }, { "token": "keyword", - "foreground": "1c6b48" + "foreground": "1e754f" + }, + { + "token": "storage.type.class.jsdoc", + "foreground": "1e754f" }, { "token": "storage", @@ -647,6 +737,18 @@ "token": "storage.type", "foreground": "ab5959" }, + { + "token": "support.type.builtin", + "foreground": "ab5959" + }, + { + "token": "constant.language.undefined", + "foreground": "ab5959" + }, + { + "token": "constant.language.null", + "foreground": "ab5959" + }, { "token": "storage.modifier.package", "foreground": "393a34" @@ -663,10 +765,6 @@ "token": "string", "foreground": "b56959" }, - { - "token": "punctuation.definition.string", - "foreground": "b56959" - }, { "token": "string punctuation.section.embedded source", "foreground": "b56959" @@ -675,33 +773,61 @@ "token": "attribute.value", "foreground": "b56959" }, + { + "token": "punctuation.definition.string", + "foreground": "b56959aa" + }, + { + "token": "punctuation.support.type.property-name", + "foreground": "998418aa" + }, { "token": "support", - "foreground": "b58451" + "foreground": "998418" }, { - "token": "meta.property-name", - "foreground": "b58451" + "token": "property", + "foreground": "998418" }, { - "token": "entity.other.attribute-name", - "foreground": "b58451" + "token": "meta.property-name", + "foreground": "998418" }, { "token": "meta.object-literal.key", - "foreground": "b58451" + "foreground": "998418" + }, + { + "token": "entity.name.tag.yaml", + "foreground": "998418" }, { "token": "attribute.name", - "foreground": "b58451" + "foreground": "998418" + }, + { + "token": "entity.other.attribute-name", + "foreground": "b07d48" + }, + { + "token": "invalid.deprecated.entity.other.attribute-name.html", + "foreground": "b07d48" }, { "token": "variable", - "foreground": "8c862b" + "foreground": "b07d48" }, { "token": "identifier", - "foreground": "8c862b" + "foreground": "b07d48" + }, + { + "token": "support.type.primitive", + "foreground": "2e808f" + }, + { + "token": "entity.name.type", + "foreground": "2e808f" }, { "token": "namespace", @@ -711,6 +837,10 @@ "token": "keyword.operator", "foreground": "ab5959" }, + { + "token": "meta.var.expr.ts", + "foreground": "ab5959" + }, { "token": "invalid.broken", "foreground": "b31d28" @@ -775,17 +905,13 @@ "token": "support.constant", "foreground": "a65e2b" }, - { - "token": "support.variable", - "foreground": "2f8a89" - }, { "token": "constant.numeric", - "foreground": "296aa3" + "foreground": "2f798a" }, { "token": "number", - "foreground": "296aa3" + "foreground": "2f798a" }, { "token": "keyword.other.unit", @@ -793,7 +919,11 @@ }, { "token": "constant.language.boolean", - "foreground": "1c6b48" + "foreground": "1e754f" + }, + { + "token": "constant.language", + "foreground": "1e754f" }, { "token": "meta.module-reference", @@ -813,7 +943,7 @@ }, { "token": "markup.quote", - "foreground": "1c6b48" + "foreground": "2e8f82" }, { "token": "markup.italic", @@ -933,7 +1063,14 @@ }, { "token": "type.identifier", - "foreground": "2993a3" + "foreground": "5a6aa6" + }, + { + "token": "entity.other.attribute-name.html.vue", + "foreground": "59873a" + }, + { + "token": "invalid.illegal.unrecognized-tag.html" } ] } diff --git a/apps/web/src/components/snippets/public-snippet.tsx b/apps/web/src/components/snippets/public-snippet.tsx new file mode 100644 index 00000000..b275e258 --- /dev/null +++ b/apps/web/src/components/snippets/public-snippet.tsx @@ -0,0 +1,64 @@ +import { Highlighter, Link, PublicSnippetResult, UserAvatar } from '@sharingan/front'; +import { useEditor } from '@sharingan/front/src/components/directory/snippets/form/editor/hooks/use-editor'; + +type Props = { + highlighter?: Highlighter; + snippet: PublicSnippetResult['items'][number]; +}; + +export const PublicSnippet = ({ highlighter, snippet }: Props) => { + const { highlightSnippet } = useEditor(); + const { user } = snippet; + + const htmlCode = highlightSnippet({ + code: snippet.content, + highlighter, + language: snippet.language, + lineHighlight: snippet.lineHighLight, + theme: snippet.theme, + }); + + return ( +
+
+
+
+ + + + + +
+
+
+ + {user.username} + {' '} + /{' '} + + {snippet.name} + +
+
{snippet.createdAt}
+
+
+
+ +
+
+
{snippet.description}
+
+

+      
+
+ ); +}; diff --git a/apps/web/src/containers/private/browse.tsx b/apps/web/src/containers/private/browse.tsx index 68af964a..75866410 100644 --- a/apps/web/src/containers/private/browse.tsx +++ b/apps/web/src/containers/private/browse.tsx @@ -1,8 +1,20 @@ +import { PublicSnippetResult, useCodeHighlighter } from '@sharingan/front'; import { NextSeo } from 'next-seo'; import Layout from '@/components/layout/private/layout'; +import { PublicSnippet } from '@/components/snippets/public-snippet'; + +type Props = { + data: PublicSnippetResult; +}; + +const Browse = ({ data }: Props) => { + const { highlighter } = useCodeHighlighter(); + + console.log(data); + + const snippets = data.items; -const Browse = () => { return ( @@ -13,12 +25,14 @@ const Browse = () => {
-
- {/* Replace with your content */} +
-
+
+ {snippets.map((snippet) => ( + + ))} +
- {/* /End replace */}
diff --git a/apps/web/src/pages/app/browse.tsx b/apps/web/src/pages/app/browse.tsx index 575edc09..24bd3d40 100644 --- a/apps/web/src/pages/app/browse.tsx +++ b/apps/web/src/pages/app/browse.tsx @@ -1,9 +1,44 @@ -import type { NextPage } from 'next'; +import { + PublicSnippetResult, + SNIPPET_ITEM_PER_PAGE, + findPublicSnippetsQuery, + formatPublicSnippetsResult, +} from '@sharingan/front'; +import type { GetServerSidePropsContext, NextPage } from 'next'; import Browse from '@/containers/private/browse'; +import { addApolloState, initializeApollo } from '@/utils/apollo-client'; -const BrowsePage: NextPage = () => { - return ; +type Props = { + data: PublicSnippetResult; +}; + +const BrowsePage: NextPage = ({ data }: Props) => { + return ; +}; + +export const getServerSideProps = async (context: GetServerSidePropsContext) => { + const apolloClient = initializeApollo({ context }); + + try { + const queryResult = await apolloClient.query({ + query: findPublicSnippetsQuery, + variables: { args: { itemPerPage: SNIPPET_ITEM_PER_PAGE } }, + }); + + return addApolloState(apolloClient, { + props: { + data: formatPublicSnippetsResult(queryResult.data), + }, + }); + } catch (err) { + // TODO send to sentry + console.log(err); + + return { + props: {}, + }; + } }; export default BrowsePage; diff --git a/packages/domain/src/snippets/snippet.service.ts b/packages/domain/src/snippets/snippet.service.ts index d9c2ccc0..13377519 100644 --- a/packages/domain/src/snippets/snippet.service.ts +++ b/packages/domain/src/snippets/snippet.service.ts @@ -82,10 +82,13 @@ export default class SnippetService { }, }); + const hasMore = snippets.length === limitPlusOne; + const nextCursor = snippets.length > 0 ? snippets[snippets.length - 1].createdAt.getTime().toString() : null; + return { - hasMore: snippets.length === limitPlusOne, + hasMore, items: snippets.slice(0, limit), - nextCursor: snippets.length > 0 ? snippets[snippets.length - 1].createdAt.getTime().toString() : null, + nextCursor: hasMore ? nextCursor : null, }; } diff --git a/packages/front/index.tsx b/packages/front/index.tsx index 330d45a2..c937659b 100644 --- a/packages/front/index.tsx +++ b/packages/front/index.tsx @@ -1,3 +1,5 @@ +import { Highlighter } from 'shiki'; + import Alert from './src/components/alert'; import FolderDirectory from './src/components/directory'; import BreadCrumb from './src/components/directory/breadcrumb'; @@ -16,6 +18,7 @@ export * from './src/graphql'; export * from './src/hooks'; export * from './src/services'; export * from './src/utils/constants'; +export type { PublicSnippetItem, PublicSnippetResult } from './src/typings/queries'; export { Alert, @@ -31,3 +34,5 @@ export { ViewSnippet, classNames, }; + +export type { Highlighter }; diff --git a/packages/front/src/components/directory/snippets/form/create-snippet.tsx b/packages/front/src/components/directory/snippets/form/create-snippet.tsx index 645f5e01..be937608 100644 --- a/packages/front/src/components/directory/snippets/form/create-snippet.tsx +++ b/packages/front/src/components/directory/snippets/form/create-snippet.tsx @@ -26,18 +26,7 @@ const CreateSnippetContainer = ({ closeModal, folderId, open }: Props) => { const formMethods = useForm({ defaultValues: { - code: `@ExceptionHandler(ConstraintViolationException.class) -public ResponseEntity constraintViolationException(ConstraintViolationException ex, WebRequest request) { - List errors = new ArrayList<>(); - - ex.getConstraintViolations().forEach(cv -> errors.add(cv.getMessage())); - - Map> result = new HashMap<>(); - - result.put("errors", errors); - return new ResponseEntity<>(result, HttpStatus.BAD_REQUEST); -} -`, + code: `\n`, codeHighlight: CODE_HIGHLIGHT_OPTIONS[0], isPrivate: true, lineHighlight: [], diff --git a/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts b/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts index 55385f99..9088ca29 100644 --- a/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts +++ b/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts @@ -3,6 +3,8 @@ import { BUNDLED_LANGUAGES } from 'shiki'; import { HighLightOption, HighlightSnippetArgs, TextSelection } from '../../../../../../typings/snippet-form'; +const languageNames = BUNDLED_LANGUAGES.map((language) => language.id); + export const useEditor = () => { const [textSelection, setTextSelection] = useState(null); @@ -20,6 +22,20 @@ export const useEditor = () => { return line; }; + const selectLanguage = (language: string) => { + const mappers: Record = { + yml: 'yaml', + }; + + const mappedLanguage = language in mappers ? mappers[language] : language; + + if (languageNames.includes(mappedLanguage)) { + return mappedLanguage; + } + + return 'txt'; + }; + const highlightSnippet = ({ code, highlighter, language, lineHighlight, theme }: HighlightSnippetArgs) => { if (!highlighter) { return code; @@ -27,7 +43,7 @@ export const useEditor = () => { return highlighter .codeToHtml(code, { - lang: language, + lang: selectLanguage(language), lineOptions: buildLineOptions(lineHighlight), theme, }) @@ -41,7 +57,7 @@ export const useEditor = () => { }; const getLanguageFromExtension = (fileName?: string) => { - const DEFAULT_LANGUAGE = 'js'; + const DEFAULT_LANGUAGE = 'txt'; if (!fileName || !fileName.includes('.')) { return DEFAULT_LANGUAGE; @@ -49,8 +65,6 @@ export const useEditor = () => { const possibleExtension = fileName.split('.').pop(); - const languageNames = BUNDLED_LANGUAGES.map((language) => language.id); - if (!possibleExtension || (possibleExtension && !languageNames.includes(possibleExtension as any))) { return DEFAULT_LANGUAGE; } diff --git a/packages/front/src/components/link/external-link.tsx b/packages/front/src/components/link/external-link.tsx index d1419b38..2b5aa4cf 100644 --- a/packages/front/src/components/link/external-link.tsx +++ b/packages/front/src/components/link/external-link.tsx @@ -12,6 +12,7 @@ export const ExternalLink = ({ child, href }: Props) => { if (child.type !== 'a') { throw new Error('Child must be an element'); } + return cloneElement(child, { href, rel: 'noopener noreferrer', diff --git a/packages/front/src/graphql/generated.ts b/packages/front/src/graphql/generated.ts index 47552552..73540c73 100644 --- a/packages/front/src/graphql/generated.ts +++ b/packages/front/src/graphql/generated.ts @@ -68,49 +68,40 @@ export type Mutation = { updateSnippet: Snippet; }; - export type MutationCreateFolderArgs = { input: CreateFolderInput; }; - export type MutationCreateSnippetArgs = { input: CreateSnippetInput; }; - export type MutationDeleteFoldersArgs = { folderIds: Array; }; - export type MutationDeleteSnippetArgs = { id: Scalars['ID']; }; - export type MutationLoginUserArgs = { email: Scalars['String']; password: Scalars['String']; }; - export type MutationSignupUserArgs = { input: SignupUserInput; }; - export type MutationSubscribeToNewsletterArgs = { email: Scalars['String']; }; - export type MutationUpdateFolderArgs = { id: Scalars['ID']; input: UpdateFolderInput; }; - export type MutationUpdateSnippetArgs = { id: Scalars['ID']; input: UpdateSnippetInput; @@ -119,13 +110,25 @@ export type MutationUpdateSnippetArgs = { export const OauthProvider = { Github: 'github', Stackoverflow: 'stackoverflow', - Twitter: 'twitter' + Twitter: 'twitter', } as const; export type OauthProvider = typeof OauthProvider[keyof typeof OauthProvider]; +export type PublicSnippetsArgs = { + itemPerPage?: InputMaybe; + nextToken?: InputMaybe; +}; + +export type PublicSnippetsResult = { + __typename?: 'PublicSnippetsResult'; + hasMore: Scalars['Boolean']; + itemPerPage?: Maybe; + items: Array; + nextToken?: Maybe; +}; + export type Query = { __typename?: 'Query'; - allSnippets: Array; authenticatedUser: User; findFolder: Folder; findSnippet: SnippetInfo; @@ -136,28 +139,29 @@ export type Query = { mySnippets: Array; /** @deprecated https://stackoverflow.com/questions/59868942/graphql-a-schema-must-have-a-query-operation-defined */ ping?: Maybe; + publicSnippets: PublicSnippetsResult; }; - export type QueryFindFolderArgs = { folderId: Scalars['String']; }; - export type QueryFindSnippetArgs = { snippetId: Scalars['String']; }; - export type QueryListDirectoryArgs = { folderId: Scalars['String']; }; - export type QueryListFoldersArgs = { folderId?: InputMaybe; }; +export type QueryPublicSnippetsArgs = { + args: PublicSnippetsArgs; +}; + export type Result = { __typename?: 'Result'; message: Scalars['String']; @@ -175,7 +179,7 @@ export type Role = { export const RoleName = { Admin: 'admin', - User: 'user' + User: 'user', } as const; export type RoleName = typeof RoleName[keyof typeof RoleName]; @@ -200,6 +204,7 @@ export type Snippet = { language: Scalars['String']; lineHighlight?: Maybe; name: Scalars['String']; + shortContent: Scalars['String']; size: Scalars['Int']; theme: Scalars['String']; updatedAt: Scalars['Date']; @@ -215,7 +220,7 @@ export type SnippetInfo = { export const SnippetVisibility = { Private: 'private', - Public: 'public' + Public: 'public', } as const; export type SnippetVisibility = typeof SnippetVisibility[keyof typeof SnippetVisibility]; @@ -254,95 +259,171 @@ export type CreateFolderMutationVariables = Exact<{ input: CreateFolderInput; }>; - -export type CreateFolderMutation = { __typename?: 'Mutation', createFolder: { __typename?: 'Folder', id: string } }; +export type CreateFolderMutation = { __typename?: 'Mutation'; createFolder: { __typename?: 'Folder'; id: string } }; export type DeleteFoldersMutationVariables = Exact<{ folderIds: Array | Scalars['String']; }>; - -export type DeleteFoldersMutation = { __typename?: 'Mutation', deleteFolders: boolean }; +export type DeleteFoldersMutation = { __typename?: 'Mutation'; deleteFolders: boolean }; export type UpdateFolderMutationVariables = Exact<{ id: Scalars['ID']; input: UpdateFolderInput; }>; - -export type UpdateFolderMutation = { __typename?: 'Mutation', updateFolder: { __typename: 'Folder', id: string, name: string, updatedAt: any } }; +export type UpdateFolderMutation = { + __typename?: 'Mutation'; + updateFolder: { __typename: 'Folder'; id: string; name: string; updatedAt: any }; +}; export type FindFolderQueryVariables = Exact<{ folderId: Scalars['String']; }>; - -export type FindFolderQuery = { __typename?: 'Query', findFolder: { __typename?: 'Folder', id: string, name: string } }; +export type FindFolderQuery = { __typename?: 'Query'; findFolder: { __typename?: 'Folder'; id: string; name: string } }; export type ListDirectoryQueryVariables = Exact<{ folderId: Scalars['String']; }>; - -export type ListDirectoryQuery = { __typename?: 'Query', listDirectory?: { __typename?: 'Directory', folders: Array<{ __typename?: 'Folder', id: string, name: string, subFoldersCount: number }>, snippets: Array<{ __typename?: 'Snippet', id: string, name: string, language: string, content: string }>, paths: Array<{ __typename?: 'Folder', id: string, name: string }> } | null }; +export type ListDirectoryQuery = { + __typename?: 'Query'; + listDirectory?: { + __typename?: 'Directory'; + folders: Array<{ __typename?: 'Folder'; id: string; name: string; subFoldersCount: number }>; + snippets: Array<{ __typename?: 'Snippet'; id: string; name: string; language: string; content: string }>; + paths: Array<{ __typename?: 'Folder'; id: string; name: string }>; + } | null; +}; export type SubscribeNewsletterMutationVariables = Exact<{ email: Scalars['String']; }>; - -export type SubscribeNewsletterMutation = { __typename?: 'Mutation', subscribeToNewsletter: { __typename?: 'Result', message: string } }; +export type SubscribeNewsletterMutation = { + __typename?: 'Mutation'; + subscribeToNewsletter: { __typename?: 'Result'; message: string }; +}; export type CreateSnippetMutationVariables = Exact<{ input: CreateSnippetInput; }>; - -export type CreateSnippetMutation = { __typename?: 'Mutation', createSnippet: { __typename?: 'Snippet', id: string } }; +export type CreateSnippetMutation = { __typename?: 'Mutation'; createSnippet: { __typename?: 'Snippet'; id: string } }; export type DeleteSnippetMutationVariables = Exact<{ id: Scalars['ID']; }>; - -export type DeleteSnippetMutation = { __typename?: 'Mutation', deleteSnippet: boolean }; +export type DeleteSnippetMutation = { __typename?: 'Mutation'; deleteSnippet: boolean }; export type UpdateSnippetMutationVariables = Exact<{ id: Scalars['ID']; input: UpdateSnippetInput; }>; - -export type UpdateSnippetMutation = { __typename?: 'Mutation', updateSnippet: { __typename: 'Snippet', id: string, name: string, description?: string | null, language: string, lineHighlight?: string | null, visibility: SnippetVisibility, content: string, theme: string, updatedAt: any } }; +export type UpdateSnippetMutation = { + __typename?: 'Mutation'; + updateSnippet: { + __typename: 'Snippet'; + id: string; + name: string; + description?: string | null; + language: string; + lineHighlight?: string | null; + visibility: SnippetVisibility; + content: string; + theme: string; + updatedAt: any; + }; +}; export type FindSnippetQueryVariables = Exact<{ snippetId: Scalars['String']; }>; +export type FindSnippetQuery = { + __typename?: 'Query'; + findSnippet: { + __typename?: 'SnippetInfo'; + paths: Array<{ __typename?: 'Folder'; id: string; name: string }>; + snippet: { + __typename: 'Snippet'; + id: string; + name: string; + description?: string | null; + language: string; + lineHighlight?: string | null; + visibility: SnippetVisibility; + content: string; + theme: string; + createdAt: any; + updatedAt: any; + folder: { __typename?: 'Folder'; id: string }; + }; + }; +}; -export type FindSnippetQuery = { __typename?: 'Query', findSnippet: { __typename?: 'SnippetInfo', paths: Array<{ __typename?: 'Folder', id: string, name: string }>, snippet: { __typename: 'Snippet', id: string, name: string, description?: string | null, language: string, lineHighlight?: string | null, visibility: SnippetVisibility, content: string, theme: string, createdAt: any, updatedAt: any, folder: { __typename?: 'Folder', id: string } } } }; +export type PublicSnippetsQueryVariables = Exact<{ + args: PublicSnippetsArgs; +}>; + +export type PublicSnippetsQuery = { + __typename?: 'Query'; + publicSnippets: { + __typename: 'PublicSnippetsResult'; + hasMore: boolean; + itemPerPage?: number | null; + nextToken?: string | null; + items: Array<{ + __typename: 'Snippet'; + id: string; + name: string; + description?: string | null; + language: string; + lineHighlight?: string | null; + shortContent: string; + theme: string; + createdAt: any; + user: { __typename?: 'User'; id: string; username?: string | null; name: string; pictureUrl?: string | null }; + }>; + }; +}; export type LoginUserMutationVariables = Exact<{ email: Scalars['String']; password: Scalars['String']; }>; +export type LoginUserMutation = { __typename?: 'Mutation'; loginUser: { __typename: 'LoginResult'; token: string } }; -export type LoginUserMutation = { __typename?: 'Mutation', loginUser: { __typename: 'LoginResult', token: string } }; - -export type LogoutUserMutationVariables = Exact<{ [key: string]: never; }>; - +export type LogoutUserMutationVariables = Exact<{ [key: string]: never }>; -export type LogoutUserMutation = { __typename?: 'Mutation', logoutUser: boolean }; +export type LogoutUserMutation = { __typename?: 'Mutation'; logoutUser: boolean }; export type SignupUserMutationVariables = Exact<{ input: SignupUserInput; }>; +export type SignupUserMutation = { + __typename?: 'Mutation'; + signupUser: { __typename?: 'SignupUserResult'; message: string }; +}; -export type SignupUserMutation = { __typename?: 'Mutation', signupUser: { __typename?: 'SignupUserResult', message: string } }; - -export type AuthenticatedUserQueryVariables = Exact<{ [key: string]: never; }>; - +export type AuthenticatedUserQueryVariables = Exact<{ [key: string]: never }>; -export type AuthenticatedUserQuery = { __typename?: 'Query', authenticatedUser: { __typename: 'User', id: string, email: string, isEnabled: boolean, name: string, pictureUrl?: string | null, username?: string | null, role: { __typename: 'Role', name: RoleName }, rootFolder: { __typename: 'Folder', id: string } } }; +export type AuthenticatedUserQuery = { + __typename?: 'Query'; + authenticatedUser: { + __typename: 'User'; + id: string; + email: string; + isEnabled: boolean; + name: string; + pictureUrl?: string | null; + username?: string | null; + role: { __typename: 'Role'; name: RoleName }; + rootFolder: { __typename: 'Folder'; id: string }; + }; +}; diff --git a/packages/front/src/graphql/index.ts b/packages/front/src/graphql/index.ts index e9569eea..19cd137c 100644 --- a/packages/front/src/graphql/index.ts +++ b/packages/front/src/graphql/index.ts @@ -1,4 +1,5 @@ import { subscribeNewsletterMutation } from './newsletters/mutations/subscribe-newsletter'; +import { findPublicSnippetsQuery } from './snippets/queries/public-snippets'; import { authenticatedUserQuery } from './users/queries/authenticated-user'; -export { authenticatedUserQuery, subscribeNewsletterMutation }; +export { authenticatedUserQuery, findPublicSnippetsQuery, subscribeNewsletterMutation }; diff --git a/packages/front/src/graphql/snippets/queries/public-snippets.ts b/packages/front/src/graphql/snippets/queries/public-snippets.ts new file mode 100644 index 00000000..c6467f28 --- /dev/null +++ b/packages/front/src/graphql/snippets/queries/public-snippets.ts @@ -0,0 +1,47 @@ +import { gql, useQuery } from '@apollo/client'; + +import { PublicSnippetsQuery, PublicSnippetsQueryVariables } from '../../generated'; + +type UsePublicSnippetsQueryArgs = { + itemPerPage?: number | null; + nextToken?: string | null; +}; + +export const findPublicSnippetsQuery = gql` + query publicSnippets($args: PublicSnippetsArgs!) { + publicSnippets(args: $args) { + __typename + hasMore + itemPerPage + nextToken + items { + __typename + id + name + description + language + lineHighlight + shortContent + theme + createdAt + user { + id + username + name + pictureUrl + } + } + } + } +`; + +export const usePublicSnippetsQuery = (args: UsePublicSnippetsQueryArgs) => { + return useQuery(findPublicSnippetsQuery, { + variables: { + args: { + itemPerPage: args.itemPerPage, + nextToken: args.nextToken, + }, + }, + }); +}; diff --git a/packages/front/src/hooks/index.ts b/packages/front/src/hooks/index.ts index 5230433b..b56fe573 100644 --- a/packages/front/src/hooks/index.ts +++ b/packages/front/src/hooks/index.ts @@ -1,3 +1,4 @@ import useBooleanState from './use-boolean-state'; +import { useCodeHighlighter } from './use-code-highlighter'; -export { useBooleanState }; +export { useBooleanState, useCodeHighlighter }; diff --git a/packages/front/src/hooks/use-code-highlighter.ts b/packages/front/src/hooks/use-code-highlighter.ts index ed71ddbc..0c577f6f 100644 --- a/packages/front/src/hooks/use-code-highlighter.ts +++ b/packages/front/src/hooks/use-code-highlighter.ts @@ -12,7 +12,6 @@ export const useCodeHighlighter = () => { shiki.setCDN('/assets/shiki/'); return shiki.getHighlighter({ - langs: ['javascript', 'html', 'css', 'typescript', 'java', 'c', 'cpp', 'c#', 'php', 'python'], theme: 'monokai', themes: ['one-dark-pro', 'dracula', 'dark-plus', 'monokai', 'github-dark', 'github-light'], }); diff --git a/packages/front/src/services/index.ts b/packages/front/src/services/index.ts index 07cfb043..6641d5b4 100644 --- a/packages/front/src/services/index.ts +++ b/packages/front/src/services/index.ts @@ -2,18 +2,21 @@ import { useFindFolder } from './folders/find-folder'; import { useLazyListDirectory } from './folders/list-directory'; import { useSubscribeToNewsletter } from './newsletters/subscribe-to-newsletter'; import { useFindSnippet } from './snippets/find-snippet'; +import { formatPublicSnippetsResult, usePublicSnippets } from './snippets/public-snippets'; import { useAuthenticatedUser } from './users/authenticated-user'; import { useLoginUser } from './users/login-user'; import { useLogoutUser } from './users/logout-user'; import { useSignupUser } from './users/signup-user'; export { + formatPublicSnippetsResult, useAuthenticatedUser, useFindFolder, useFindSnippet, useLazyListDirectory, useLoginUser, useLogoutUser, + usePublicSnippets, useSignupUser, useSubscribeToNewsletter, }; diff --git a/packages/front/src/services/snippets/public-snippets.ts b/packages/front/src/services/snippets/public-snippets.ts new file mode 100644 index 00000000..81b8d01b --- /dev/null +++ b/packages/front/src/services/snippets/public-snippets.ts @@ -0,0 +1,48 @@ +import { PublicSnippetsQuery } from '../../graphql/generated'; +import { usePublicSnippetsQuery } from '../../graphql/snippets/queries/public-snippets'; +import { PublicSnippetResult } from '../../typings/queries'; + +type UsePublicSnippetsArgs = { + itemPerPage?: number | null; + nextToken?: string | null; +}; + +export const formatPublicSnippetsResult = (data?: PublicSnippetsQuery): PublicSnippetResult | undefined => { + if (!data?.publicSnippets) { + return; + } + + const { hasMore, itemPerPage, items, nextToken } = data.publicSnippets; + + return { + hasMore, + itemPerPage, + items: items.map((snippet) => ({ + content: snippet.shortContent, + createdAt: snippet.createdAt, + description: snippet.description ?? null, + id: snippet.id, + language: snippet.language, + lineHighLight: snippet.lineHighlight ? JSON.parse(snippet.lineHighlight) : [], + name: snippet.name, + theme: snippet.theme, + user: { + name: snippet.user.name, + pictureUrl: snippet.user.pictureUrl, + username: snippet.user.username, + }, + })), + nextToken, + }; +}; + +export const usePublicSnippets = (args: UsePublicSnippetsArgs) => { + const query = usePublicSnippetsQuery(args); + + const data = formatPublicSnippetsResult(query.data); + + return { + data, + isLoading: query.loading && !query.error && !query.data, + }; +}; diff --git a/packages/front/src/typings/queries.ts b/packages/front/src/typings/queries.ts index 3e631033..6e454cee 100644 --- a/packages/front/src/typings/queries.ts +++ b/packages/front/src/typings/queries.ts @@ -70,3 +70,26 @@ export type SnippetInfo = { paths: FilePath[]; snippet: SnippetItem; }; + +export type PublicSnippetItem = { + content: string; + createdAt: number; + description: string | null; + id: string; + language: string; + lineHighLight: [number, string][]; + name: string; + theme: string; + user: { + name: string; + pictureUrl?: string | null; + username?: string | null; + }; +}; + +export type PublicSnippetResult = { + hasMore: boolean; + itemPerPage?: number | null; + items: PublicSnippetItem[]; + nextToken?: string | null; +}; diff --git a/packages/front/src/utils/constants.ts b/packages/front/src/utils/constants.ts index cb4a0a25..59995216 100644 --- a/packages/front/src/utils/constants.ts +++ b/packages/front/src/utils/constants.ts @@ -59,3 +59,5 @@ export const THEME_BACKGROUND_COLOR_MAP: Record = { monokai: '#272822', 'one-dark-pro': '#282c34', }; + +export const SNIPPET_ITEM_PER_PAGE = 10; From 09c18ce7350b0193041721c5643635b4bdc6dae1 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 12:57:59 +0100 Subject: [PATCH 03/20] chore(snippet): create the column to save the highlighted snippet --- packages/database/package.json | 2 +- .../migration.sql | 2 ++ packages/database/prisma/schema.prisma | 1 + packages/database/prisma/schema.test.prisma | 1 + .../snippets/dtos/create-snippet-dto.test.ts | 4 +++ .../snippets/dtos/update-snippet-dto.test.ts | 4 +++ .../services/snippets/snippet.service.test.ts | 34 +++++++++++++++++-- packages/domain/__tests__/setup/test-utils.ts | 5 ++- packages/domain/package.json | 4 +-- .../src/snippets/dtos/create-snippet-dto.ts | 2 ++ .../src/snippets/dtos/update-snippet-dto.ts | 2 ++ .../domain/src/snippets/snippet.service.ts | 1 + 12 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 packages/database/prisma/migrations/20221030113708_add_content_html_in_snippets_table/migration.sql diff --git a/packages/database/package.json b/packages/database/package.json index 3f95356f..4c5ecbc5 100644 --- a/packages/database/package.json +++ b/packages/database/package.json @@ -11,7 +11,7 @@ "lint": "eslint src index.ts", "test": "jest", "db:dev": "pscale connect sharingan dev --port 3311", - "db:shadow": "docker run -d --rm -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=sharingan --name sharingan-shadow-db -p 3312:3306 mysql:8.0", + "db:shadow": "docker run -d --rm -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=sharingan --name sharingan-shadow-db -p 3312:3306 mysql:8.0.23", "db:shadow:stop": "docker kill sharingan-shadow-db && docker container prune -f", "db:deploy:create": "pscale deploy-request create sharingan dev", "db:generate": "prisma generate --schema=./prisma/schema.prisma", diff --git a/packages/database/prisma/migrations/20221030113708_add_content_html_in_snippets_table/migration.sql b/packages/database/prisma/migrations/20221030113708_add_content_html_in_snippets_table/migration.sql new file mode 100644 index 00000000..571c4685 --- /dev/null +++ b/packages/database/prisma/migrations/20221030113708_add_content_html_in_snippets_table/migration.sql @@ -0,0 +1,2 @@ +-- AlterTable +ALTER TABLE `snippets` ADD COLUMN `content_html` TEXT NULL; diff --git a/packages/database/prisma/schema.prisma b/packages/database/prisma/schema.prisma index b72e1447..bf32c917 100644 --- a/packages/database/prisma/schema.prisma +++ b/packages/database/prisma/schema.prisma @@ -91,6 +91,7 @@ model Snippet { folderId String @map("folder_id") name String @db.VarChar(255) content String @db.Text + contentHtml String? @db.Text @map("content_html") language String @db.VarChar(20) size Int @default(0) @db.Int visibility SnippetVisibility @default(public) diff --git a/packages/database/prisma/schema.test.prisma b/packages/database/prisma/schema.test.prisma index b068c9e5..ac37c3ad 100644 --- a/packages/database/prisma/schema.test.prisma +++ b/packages/database/prisma/schema.test.prisma @@ -90,6 +90,7 @@ model Snippet { folderId String @map("folder_id") name String @db.VarChar(255) content String @db.Text + contentHtml String? @db.Text @map("content_html") language String @db.VarChar(20) size Int @default(0) @db.Int visibility SnippetVisibility @default(public) diff --git a/packages/domain/__tests__/services/snippets/dtos/create-snippet-dto.test.ts b/packages/domain/__tests__/services/snippets/dtos/create-snippet-dto.test.ts index 003968da..5fed2fa9 100644 --- a/packages/domain/__tests__/services/snippets/dtos/create-snippet-dto.test.ts +++ b/packages/domain/__tests__/services/snippets/dtos/create-snippet-dto.test.ts @@ -11,6 +11,8 @@ describe('Test Create Snippet DTO', () => { // GIVEN const dto = new CreateSessionDto({ content: 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello
\n\t);\n};', + contentHighlighted: + 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello
\n\t);\n}; highlighted', description: 'Basic react component', folderId, language: 'tsx', @@ -27,6 +29,8 @@ describe('Test Create Snippet DTO', () => { // THEN expect(folder).toMatchObject({ content: 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello
\n\t);\n};', + contentHtml: + 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello
\n\t);\n}; highlighted', createdAt: expect.any(Date), description: 'Basic react component', folderId, diff --git a/packages/domain/__tests__/services/snippets/dtos/update-snippet-dto.test.ts b/packages/domain/__tests__/services/snippets/dtos/update-snippet-dto.test.ts index e4ac1d43..afeb6a01 100644 --- a/packages/domain/__tests__/services/snippets/dtos/update-snippet-dto.test.ts +++ b/packages/domain/__tests__/services/snippets/dtos/update-snippet-dto.test.ts @@ -11,6 +11,8 @@ describe('Test Update Snippet DTO', () => { const dto = new UpdateSnippetDto({ content: 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello Updated
\n\t);\n};', + contentHighlighted: + 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello Updated
\n\t);\n}; highlighted', creatorId: userId, description: 'Basic react component updated', language: 'tsx', @@ -34,6 +36,8 @@ describe('Test Update Snippet DTO', () => { const expectedSnippet: Snippet = { content: 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello Updated
\n\t);\n};', + contentHtml: + 'import React from "react";\n\nexport const App = () => {\n\n\treturn(\n\t\t
Hello Updated
\n\t);\n}; highlighted', createdAt: currentSnippet.createdAt, description: 'Basic react component updated', folderId: snippetToUpdate.folderId, diff --git a/packages/domain/__tests__/services/snippets/snippet.service.test.ts b/packages/domain/__tests__/services/snippets/snippet.service.test.ts index 8fbba210..1db27a23 100644 --- a/packages/domain/__tests__/services/snippets/snippet.service.test.ts +++ b/packages/domain/__tests__/services/snippets/snippet.service.test.ts @@ -27,6 +27,7 @@ describe('Test Snippet service', () => { // THEN expect(expectedSnippet).toMatchObject({ content: createSnippetDto.toSnippet().content, + contentHtml: createSnippetDto.toSnippet().contentHtml, createdAt: expect.any(Date), description: createSnippetDto.toSnippet().description, folderId: rootFolder.id, @@ -64,7 +65,7 @@ describe('Test Snippet service', () => { await deleteTestUsersById([user.id]); }); - it('should find all public snippets', async () => { + it('should retrieve all public snippets', async () => { // GIVEN const [user, rootFolder] = await createUserWithRootFolder(); const existingSnippets = await Promise.all([ @@ -77,10 +78,37 @@ describe('Test Snippet service', () => { ]); // WHEN - const publicSnippets = await snippetService.findPublicSnippet(); + const publicSnippets = await snippetService.findPublicSnippet({ itemPerPage: 10 }); // THEN - await expect(publicSnippets).toHaveLength(4); + await expect(publicSnippets.hasMore).toEqual(false); + await expect(publicSnippets.nextCursor).toEqual(null); + await expect(publicSnippets.items).toHaveLength(4); + + await deleteTestSnippetsById(existingSnippets.map((snippet) => snippet.id)); + await deleteTestFoldersById([rootFolder.id]); + await deleteTestUsersById([user.id]); + }); + + it('should retrieve a subset of public snippets', async () => { + // GIVEN + const [user, rootFolder] = await createUserWithRootFolder(); + const existingSnippets = await Promise.all([ + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'public' }), + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'private' }), + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'public' }), + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'private' }), + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'public' }), + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'public' }), + ]); + + // WHEN + const publicSnippets = await snippetService.findPublicSnippet({ itemPerPage: 3 }); + + // THEN + await expect(publicSnippets.hasMore).toEqual(true); + await expect(publicSnippets.nextCursor).toEqual(expect.any(String)); + await expect(publicSnippets.items).toHaveLength(3); await deleteTestSnippetsById(existingSnippets.map((snippet) => snippet.id)); await deleteTestFoldersById([rootFolder.id]); diff --git a/packages/domain/__tests__/setup/test-utils.ts b/packages/domain/__tests__/setup/test-utils.ts index 3fe13d0e..a6865344 100644 --- a/packages/domain/__tests__/setup/test-utils.ts +++ b/packages/domain/__tests__/setup/test-utils.ts @@ -153,8 +153,11 @@ export const createTestSnippetDto = ( const languageIndex = randNumber({ max: languages.length - 1, min: 0 }); const themeIndex = randNumber({ max: themes.length - 1, min: 0 }); + const snippetContent = randWord({ length: randNumber({ max: 30, min: 5 }) }).join('\n'); + return new CreateSnippetDto({ - content: randWord({ length: randNumber({ max: 30, min: 5 }) }).join('\n'), + content: snippetContent, + contentHighlighted: `${snippetContent} highlighted`, description: randWord({ length: randNumber({ max: 20, min: 10 }) }).join(' '), folderId: args?.folderId ?? generateTestId(), language: languages[languageIndex], diff --git a/packages/domain/package.json b/packages/domain/package.json index 1967cc1e..aaaec2e2 100644 --- a/packages/domain/package.json +++ b/packages/domain/package.json @@ -9,8 +9,8 @@ "build": "tsc --project tsconfig.prod.json", "clean": "rm -rf .turbo dist", "lint": "eslint --fix", - "db:test": "docker run -d --rm -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=sharingan --name sharingandb -p 3313:3306 mysql:8.0", - "db:test:stop": "docker container kill sharingandb", + "db:test": "docker run -d --rm -e MYSQL_ROOT_PASSWORD=secret -e MYSQL_DATABASE=sharingan --name sharingandb -p 3313:3306 mysql:8.0.23", + "db:test:stop": "docker container kill sharingandb && docker container prune -f", "db:test:migration": "npx prisma migrate dev --schema=../database/prisma/schema.test.prisma", "test": "TEST_WITH_DB=true IS_LOCAL=false jest", "test:unit": "jest", diff --git a/packages/domain/src/snippets/dtos/create-snippet-dto.ts b/packages/domain/src/snippets/dtos/create-snippet-dto.ts index 62cf7a51..6fbc2cb2 100644 --- a/packages/domain/src/snippets/dtos/create-snippet-dto.ts +++ b/packages/domain/src/snippets/dtos/create-snippet-dto.ts @@ -2,6 +2,7 @@ import { Snippet, SnippetVisibility, dbId } from '@sharingan/database'; type Input = { content: string; + contentHighlighted: string; description: string | null; folderId: string; language: string; @@ -30,6 +31,7 @@ export default class CreateSnippetDto { toSnippet(): Snippet { return { content: this._input.content, + contentHtml: this._input.contentHighlighted, createdAt: new Date(), description: this._input.description, folderId: this._input.folderId, diff --git a/packages/domain/src/snippets/dtos/update-snippet-dto.ts b/packages/domain/src/snippets/dtos/update-snippet-dto.ts index 134953f0..248fcda8 100644 --- a/packages/domain/src/snippets/dtos/update-snippet-dto.ts +++ b/packages/domain/src/snippets/dtos/update-snippet-dto.ts @@ -2,6 +2,7 @@ import { Snippet, SnippetVisibility } from '@sharingan/database'; type Input = { content: string; + contentHighlighted: string; creatorId: string; description: string | null; language: string; @@ -31,6 +32,7 @@ export default class UpdateSnippetDto { return { ...currentSnippet, content: this._input.content, + contentHtml: this._input.contentHighlighted, description: this._input.description, language: this._input.language, lineHighlight: this._input.lineHighlight, diff --git a/packages/domain/src/snippets/snippet.service.ts b/packages/domain/src/snippets/snippet.service.ts index 13377519..0786f877 100644 --- a/packages/domain/src/snippets/snippet.service.ts +++ b/packages/domain/src/snippets/snippet.service.ts @@ -20,6 +20,7 @@ export default class SnippetService { return dbClient.snippet.create({ data: { content: input.content, + contentHtml: input.contentHtml, description: input.description, folderId: input.folderId, id: input.id, From fc0449f87b664ae3b5e10ca55f4885551538a463 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 13:11:36 +0100 Subject: [PATCH 04/20] enh(core): add content highlighted in the snippet schema --- apps/core/src/resources/schema.graphql.ts | 1 + apps/core/src/resources/snippets/mutations/create-snippet.ts | 1 + apps/core/src/resources/snippets/mutations/update-snippet.ts | 1 + apps/core/src/resources/snippets/schema.graphql.ts | 2 ++ apps/core/src/types/graphql.d.ts | 4 ++++ 5 files changed, 9 insertions(+) diff --git a/apps/core/src/resources/schema.graphql.ts b/apps/core/src/resources/schema.graphql.ts index c119dcb7..9bba7573 100644 --- a/apps/core/src/resources/schema.graphql.ts +++ b/apps/core/src/resources/schema.graphql.ts @@ -60,6 +60,7 @@ export default gql` id: ID! name: String! content: String! + contentHighlighted: String shortContent: String! language: String! lineHighlight: String diff --git a/apps/core/src/resources/snippets/mutations/create-snippet.ts b/apps/core/src/resources/snippets/mutations/create-snippet.ts index 9e4f1f68..f2f886d5 100644 --- a/apps/core/src/resources/snippets/mutations/create-snippet.ts +++ b/apps/core/src/resources/snippets/mutations/create-snippet.ts @@ -10,6 +10,7 @@ export const createSnippet: MutationResolvers['createSnippet'] = async (_parent, const createSnippetDto = new CreateSnippetDto({ content: input.content, + contentHighlighted: input.contentHighlighted, description: input.description ?? null, folderId: input.folderId, language: input.language, diff --git a/apps/core/src/resources/snippets/mutations/update-snippet.ts b/apps/core/src/resources/snippets/mutations/update-snippet.ts index b928b119..fbcacb96 100644 --- a/apps/core/src/resources/snippets/mutations/update-snippet.ts +++ b/apps/core/src/resources/snippets/mutations/update-snippet.ts @@ -10,6 +10,7 @@ export const updateSnippet: MutationResolvers['updateSnippet'] = async (_parent, const updateSnippetDto = new UpdateSnippetDto({ content: input.content, + contentHighlighted: input.contentHighlighted, creatorId: userId, description: input.description ?? null, language: input.language, diff --git a/apps/core/src/resources/snippets/schema.graphql.ts b/apps/core/src/resources/snippets/schema.graphql.ts index 1f6f261e..e5f7ca8c 100644 --- a/apps/core/src/resources/snippets/schema.graphql.ts +++ b/apps/core/src/resources/snippets/schema.graphql.ts @@ -17,6 +17,7 @@ export default gql` folderId: String! name: String! content: String! + contentHighlighted: String! language: String! lineHighlight: String visibility: SnippetVisibility! @@ -27,6 +28,7 @@ export default gql` input UpdateSnippetInput { name: String! content: String! + contentHighlighted: String! language: String! lineHighlight: String visibility: SnippetVisibility! diff --git a/apps/core/src/types/graphql.d.ts b/apps/core/src/types/graphql.d.ts index 8beb6ef2..dc2f84f8 100644 --- a/apps/core/src/types/graphql.d.ts +++ b/apps/core/src/types/graphql.d.ts @@ -32,6 +32,7 @@ export type CreateFolderInput = { export type CreateSnippetInput = { content: Scalars['String']; + contentHighlighted: Scalars['String']; description?: InputMaybe; folderId: Scalars['String']; language: Scalars['String']; @@ -209,6 +210,7 @@ export type SignupUserResult = { export type Snippet = { __typename?: 'Snippet'; content: Scalars['String']; + contentHighlighted?: Maybe; createdAt: Scalars['Date']; description?: Maybe; folder: Folder; @@ -242,6 +244,7 @@ export type UpdateFolderInput = { export type UpdateSnippetInput = { content: Scalars['String']; + contentHighlighted: Scalars['String']; description?: InputMaybe; language: Scalars['String']; lineHighlight?: InputMaybe; @@ -586,6 +589,7 @@ export type SnippetResolvers< ParentType extends ResolversParentTypes['Snippet'] = ResolversParentTypes['Snippet'], > = { content?: Resolver; + contentHighlighted?: Resolver, ParentType, ContextType>; createdAt?: Resolver; description?: Resolver, ParentType, ContextType>; folder?: Resolver; From e310f48ed0ddd91e6b1e06b483be9767b7411e4e Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 15:12:57 +0100 Subject: [PATCH 05/20] feat(snippet): include the highlighted when creating a snippet --- .../snippets/form/create-snippet.tsx | 14 ++++- .../snippets/form/editor/hooks/use-editor.ts | 61 +++++++++++-------- .../directory/snippets/form/editor/index.tsx | 10 ++- .../directory/snippets/form/form-schema.ts | 1 + packages/front/src/graphql/generated.ts | 3 + packages/front/src/typings/snippet-form.ts | 1 + 6 files changed, 62 insertions(+), 28 deletions(-) diff --git a/packages/front/src/components/directory/snippets/form/create-snippet.tsx b/packages/front/src/components/directory/snippets/form/create-snippet.tsx index be937608..33308f9e 100644 --- a/packages/front/src/components/directory/snippets/form/create-snippet.tsx +++ b/packages/front/src/components/directory/snippets/form/create-snippet.tsx @@ -4,7 +4,7 @@ import { Fragment, useRef } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; import Button from '../../../../forms/button'; -import { useCodeHighlighter } from '../../../../hooks/use-code-highlighter'; +import { useCodeHighlighter } from '../../../../hooks'; import { useCreateSnippet } from '../../../../services/snippets/create-snippet'; import { CODE_HIGHLIGHT_OPTIONS, THEME_OPTIONS } from '../../../../utils/constants'; import { extractLanguageFromName, lineHighlightToString } from '../../../../utils/snippets'; @@ -26,8 +26,14 @@ const CreateSnippetContainer = ({ closeModal, folderId, open }: Props) => { const formMethods = useForm({ defaultValues: { - code: `\n`, + code: `import fs from "fs"; +import path from "path"; + +const content= fs.readFileSync(path.resolve(__dirname, 'file.json'), { encoding: "utf-8" }); + +console.log(content);`, codeHighlight: CODE_HIGHLIGHT_OPTIONS[0], + codeHighlighted: '', isPrivate: true, lineHighlight: [], theme: THEME_OPTIONS[0], @@ -40,6 +46,7 @@ const CreateSnippetContainer = ({ closeModal, folderId, open }: Props) => { formMethods.reset({ code: '', codeHighlight: CODE_HIGHLIGHT_OPTIONS[0], + codeHighlighted: '', description: '', isPrivate: true, lineHighlight: [], @@ -50,9 +57,12 @@ const CreateSnippetContainer = ({ closeModal, folderId, open }: Props) => { }; const submitCreateSnippet = async (values: SnippetFormValues) => { + console.log('Values => ', values); + await createSnippet({ input: { content: values.code, + contentHighlighted: values.codeHighlighted, description: values.description, folderId, language: extractLanguageFromName(values.name), diff --git a/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts b/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts index 9088ca29..49f2d46c 100644 --- a/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts +++ b/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts @@ -3,7 +3,7 @@ import { BUNDLED_LANGUAGES } from 'shiki'; import { HighLightOption, HighlightSnippetArgs, TextSelection } from '../../../../../../typings/snippet-form'; -const languageNames = BUNDLED_LANGUAGES.map((language) => language.id); +const languageNames = BUNDLED_LANGUAGES.map((language) => [language.id].concat(language.aliases ?? [])).flat(); export const useEditor = () => { const [textSelection, setTextSelection] = useState(null); @@ -22,38 +22,39 @@ export const useEditor = () => { return line; }; - const selectLanguage = (language: string) => { - const mappers: Record = { - yml: 'yaml', - }; + const highlightSnippet = ({ code, highlighter, language, lineHighlight, theme }: HighlightSnippetArgs) => { + if (!highlighter) { + return { + codeHighlighted: `
${code}
`, + codeHighlightedForPreview: `
${code}
`, + }; + } - const mappedLanguage = language in mappers ? mappers[language] : language; + const codeHighlightedWithoutLineNumbers = highlighter.codeToHtml(code, { + lang: language, + lineOptions: buildLineOptions(lineHighlight), + theme, + }); - if (languageNames.includes(mappedLanguage)) { - return mappedLanguage; - } + const preTagRegex = /
/;
 
-    return 'txt';
-  };
+    const preMatcher = codeHighlightedWithoutLineNumbers.match(preTagRegex);
 
-  const highlightSnippet = ({ code, highlighter, language, lineHighlight, theme }: HighlightSnippetArgs) => {
-    if (!highlighter) {
-      return code;
-    }
+    const preHtml = preMatcher && preMatcher.length > 0 ? preMatcher[0] : '
';
 
-    return highlighter
-      .codeToHtml(code, {
-        lang: selectLanguage(language),
-        lineOptions: buildLineOptions(lineHighlight),
-        theme,
-      })
-      .replace(/
/, '')
+    const codeHighlightedForPreview = codeHighlightedWithoutLineNumbers
+      .replace(preTagRegex, '')
       .replace('
', '') .split('\n') .map((line, i) => { return `${i + 1}${addWhitespaceForEmptyLine(line)}`; }) .join('\n'); + + return { + codeHighlighted: `${preHtml}${codeHighlightedForPreview}
`, + codeHighlightedForPreview, + }; }; const getLanguageFromExtension = (fileName?: string) => { @@ -63,13 +64,23 @@ export const useEditor = () => { return DEFAULT_LANGUAGE; } - const possibleExtension = fileName.split('.').pop(); + const language = fileName.split('.').pop(); + + if (!language) { + return DEFAULT_LANGUAGE; + } + + const mappers: Record = { + yml: 'yaml', + }; + + const mappedLanguage = language in mappers ? mappers[language] : language; - if (!possibleExtension || (possibleExtension && !languageNames.includes(possibleExtension as any))) { + if (!mappedLanguage || (mappedLanguage && !languageNames.includes(mappedLanguage as any))) { return DEFAULT_LANGUAGE; } - return possibleExtension; + return mappedLanguage; }; const mapToArray = (map: Map): Array<[Key, Value]> => { diff --git a/packages/front/src/components/directory/snippets/form/editor/index.tsx b/packages/front/src/components/directory/snippets/form/editor/index.tsx index aeab7352..3e843ae6 100644 --- a/packages/front/src/components/directory/snippets/form/editor/index.tsx +++ b/packages/front/src/components/directory/snippets/form/editor/index.tsx @@ -20,6 +20,14 @@ const SnippetTextEditor = ({ codeHighlightOptions, highlighter, themeOptions }: const { control, setValue } = useFormContext(); const { code, handleEditorSelect, isSnippetPrivate, onHighlight, theme } = useFormEditor(); + const handleCodeHighlight = (codeToHighlight: string) => { + const highlightedCode = onHighlight(highlighter)(codeToHighlight); + + setValue('codeHighlighted', highlightedCode.codeHighlighted); + + return highlightedCode.codeHighlightedForPreview; + }; + return (
@@ -62,7 +70,7 @@ const SnippetTextEditor = ({ codeHighlightOptions, highlighter, themeOptions }: setValue('code', code)} - highlight={onHighlight(highlighter)} + highlight={handleCodeHighlight} padding={6.5} style={{ backgroundColor: THEME_BACKGROUND_COLOR_MAP[theme.id], diff --git a/packages/front/src/components/directory/snippets/form/form-schema.ts b/packages/front/src/components/directory/snippets/form/form-schema.ts index 1e9856f2..2658201b 100644 --- a/packages/front/src/components/directory/snippets/form/form-schema.ts +++ b/packages/front/src/components/directory/snippets/form/form-schema.ts @@ -10,6 +10,7 @@ export type SnippetFormValues = EditorFormValues; export const formSchema = yup.object().shape({ code: yup.string().required(FORM_ERRORS.fieldRequired), + codeHighlighted: yup.string().required(FORM_ERRORS.fieldRequired), description: yup.string(), lineHighlight: yup.mixed(), name: yup diff --git a/packages/front/src/graphql/generated.ts b/packages/front/src/graphql/generated.ts index 73540c73..3db3b043 100644 --- a/packages/front/src/graphql/generated.ts +++ b/packages/front/src/graphql/generated.ts @@ -20,6 +20,7 @@ export type CreateFolderInput = { export type CreateSnippetInput = { content: Scalars['String']; + contentHighlighted: Scalars['String']; description?: InputMaybe; folderId: Scalars['String']; language: Scalars['String']; @@ -197,6 +198,7 @@ export type SignupUserResult = { export type Snippet = { __typename?: 'Snippet'; content: Scalars['String']; + contentHighlighted?: Maybe; createdAt: Scalars['Date']; description?: Maybe; folder: Folder; @@ -230,6 +232,7 @@ export type UpdateFolderInput = { export type UpdateSnippetInput = { content: Scalars['String']; + contentHighlighted: Scalars['String']; description?: InputMaybe; language: Scalars['String']; lineHighlight?: InputMaybe; diff --git a/packages/front/src/typings/snippet-form.ts b/packages/front/src/typings/snippet-form.ts index 5cc55401..7cb11a24 100644 --- a/packages/front/src/typings/snippet-form.ts +++ b/packages/front/src/typings/snippet-form.ts @@ -23,6 +23,7 @@ export type TextSelection = { export type EditorFormValues = { code: string; codeHighlight: SelectOption; + codeHighlighted: string; description: string; isPrivate: boolean; lineHighlight: Array<[number, string]>; From ceac0b3da60dd4bd06765dc90b2d855786408a66 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 16:09:45 +0100 Subject: [PATCH 06/20] feat(snippet): include the highlighted when updating a snippet --- packages/domain/src/snippets/snippet.service.ts | 1 + .../src/components/directory/snippets/form/view-snippet.tsx | 4 +++- packages/front/src/graphql/generated.ts | 1 + packages/front/src/graphql/snippets/queries/find-snippet.ts | 1 + packages/front/src/services/snippets/find-snippet.ts | 1 + packages/front/src/typings/queries.ts | 1 + 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/domain/src/snippets/snippet.service.ts b/packages/domain/src/snippets/snippet.service.ts index 0786f877..067f71bc 100644 --- a/packages/domain/src/snippets/snippet.service.ts +++ b/packages/domain/src/snippets/snippet.service.ts @@ -129,6 +129,7 @@ export default class SnippetService { return dbClient.snippet.update({ data: { content: input.content, + contentHtml: input.contentHtml, description: input.description, language: input.language, lineHighlight: input.lineHighlight, diff --git a/packages/front/src/components/directory/snippets/form/view-snippet.tsx b/packages/front/src/components/directory/snippets/form/view-snippet.tsx index a4cd1d71..e72ad3ca 100644 --- a/packages/front/src/components/directory/snippets/form/view-snippet.tsx +++ b/packages/front/src/components/directory/snippets/form/view-snippet.tsx @@ -2,7 +2,7 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { FormProvider, useForm } from 'react-hook-form'; import Button from '../../../../forms/button'; -import { useCodeHighlighter } from '../../../../hooks/use-code-highlighter'; +import { useCodeHighlighter } from '../../../../hooks'; import { useUpdateSnippet } from '../../../../services/snippets/update-snippet'; import { SnippetItem } from '../../../../typings/queries'; import { CODE_HIGHLIGHT_OPTIONS, THEME_OPTIONS } from '../../../../utils/constants'; @@ -31,6 +31,7 @@ const ViewSnippet = ({ snippet }: Props) => { defaultValues: { code: snippet.content, codeHighlight: CODE_HIGHLIGHT_OPTIONS[0], + codeHighlighted: snippet.contentHighlighted, description: snippet.description ?? undefined, isPrivate: snippet.isPrivate, lineHighlight: snippet.lineHighLight, @@ -45,6 +46,7 @@ const ViewSnippet = ({ snippet }: Props) => { id: snippet.id, input: { content: values.code, + contentHighlighted: values.codeHighlighted, description: values.description, language: extractLanguageFromName(values.name), lineHighlight: lineHighlightToString(values.lineHighlight), diff --git a/packages/front/src/graphql/generated.ts b/packages/front/src/graphql/generated.ts index 3db3b043..e32ecb90 100644 --- a/packages/front/src/graphql/generated.ts +++ b/packages/front/src/graphql/generated.ts @@ -360,6 +360,7 @@ export type FindSnippetQuery = { lineHighlight?: string | null; visibility: SnippetVisibility; content: string; + contentHighlighted?: string | null; theme: string; createdAt: any; updatedAt: any; diff --git a/packages/front/src/graphql/snippets/queries/find-snippet.ts b/packages/front/src/graphql/snippets/queries/find-snippet.ts index 02d497d6..032db65b 100644 --- a/packages/front/src/graphql/snippets/queries/find-snippet.ts +++ b/packages/front/src/graphql/snippets/queries/find-snippet.ts @@ -18,6 +18,7 @@ export const findSnippetQueryDocument = gql` lineHighlight visibility content + contentHighlighted theme createdAt updatedAt diff --git a/packages/front/src/services/snippets/find-snippet.ts b/packages/front/src/services/snippets/find-snippet.ts index c0103c7c..d5aaa6ce 100644 --- a/packages/front/src/services/snippets/find-snippet.ts +++ b/packages/front/src/services/snippets/find-snippet.ts @@ -13,6 +13,7 @@ const formatFindSnippetResult = (data?: FindSnippetQuery): SnippetInfo | undefin paths, snippet: { content: snippet.content, + contentHighlighted: snippet.contentHighlighted ?? '', createdAt: snippet.createdAt, description: snippet.description ?? null, folderId: snippet.folder.id, diff --git a/packages/front/src/typings/queries.ts b/packages/front/src/typings/queries.ts index 6e454cee..9466d440 100644 --- a/packages/front/src/typings/queries.ts +++ b/packages/front/src/typings/queries.ts @@ -54,6 +54,7 @@ export type FindFolderData = { export type SnippetItem = { content: string; + contentHighlighted: string; createdAt: number; description: string | null; folderId: string; From 113d08a2216a585e3325cf09b8b10bce7383a5ce Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 17:33:04 +0100 Subject: [PATCH 07/20] test(snippet): write tests case for updating and deleting a snippet --- .../services/snippets/snippet.service.test.ts | 173 ++++++++++++++++-- packages/domain/__tests__/setup/test-utils.ts | 35 ++++ 2 files changed, 196 insertions(+), 12 deletions(-) diff --git a/packages/domain/__tests__/services/snippets/snippet.service.test.ts b/packages/domain/__tests__/services/snippets/snippet.service.test.ts index 1db27a23..575b9124 100644 --- a/packages/domain/__tests__/services/snippets/snippet.service.test.ts +++ b/packages/domain/__tests__/services/snippets/snippet.service.test.ts @@ -1,5 +1,5 @@ import { Snippet } from '@sharingan/database'; -import SharinganError, { errors } from '@sharingan/utils'; +import SharinganError, { errors, generateRandomId } from '@sharingan/utils'; import { roleService, snippetService } from '../../../index'; import { @@ -7,8 +7,10 @@ import { createTestSnippetDto, createUserWithRootFolder, deleteTestFoldersById, + deleteTestSnippetDto, deleteTestSnippetsById, deleteTestUsersById, + updateTestSnippetDto, } from '../../setup/test-utils'; describe('Test Snippet service', () => { @@ -140,29 +142,176 @@ describe('Test Snippet service', () => { await deleteTestUsersById([user1.id, user2.id]); }); - it('should find all snippets of a folder', async () => { + it('should retrieve a snippet by its ID', async () => { + // GIVEN + const [user1, rootFolder1] = await createUserWithRootFolder(); + + const [snippet] = await Promise.all([ + createTestSnippet({ folderId: rootFolder1.id, userId: user1.id, visibility: 'public' }), + ]); + + // WHEN + const snippetFound = await snippetService.findById(snippet.id); + + // THEN + expect(snippetFound).toMatchObject({ + folderId: rootFolder1.id, + id: snippet.id, + userId: user1.id, + visibility: 'public', + }); + + await deleteTestSnippetsById([snippet.id]); + await deleteTestFoldersById([rootFolder1.id]); + await deleteTestUsersById([user1.id]); + }); + + it('should found no snippet given the ID provided', async () => { + // GIVEN + const snippetId = generateRandomId(); + + // WHEN + // THEN + await expect(async () => { + await snippetService.findById(snippetId); + }).rejects.toThrow(new SharinganError(errors.SNIPPET_NOT_FOUND(snippetId), 'SNIPPET_NOT_FOUND')); + }); + + it('should delete an existing snippet belonging to a user', async () => { + // GIVEN + const [user, rootFolder] = await createUserWithRootFolder(); + + const [snippet1, snippet2] = await Promise.all([ + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'public' }), + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'private' }), + ]); + + // WHEN + const deleteSnippetDto = deleteTestSnippetDto({ snippetId: snippet1.id, userId: snippet1.userId }); + + await snippetService.delete(deleteSnippetDto); + + // THEN + const folderSnippets = await snippetService.findByFolder(rootFolder.id); + + expect(folderSnippets).toHaveLength(1); + + await deleteTestSnippetsById([snippet2.id]); + await deleteTestFoldersById([rootFolder.id]); + await deleteTestUsersById([user.id]); + }); + + it('should not delete an existing snippet because it belongs to other user', async () => { // GIVEN const [user1, rootFolder1] = await createUserWithRootFolder(); const [user2, rootFolder2] = await createUserWithRootFolder(); - const existingSnippets = await Promise.all([ + const [snippet1, snippet2, snippet3] = await Promise.all([ createTestSnippet({ folderId: rootFolder1.id, userId: user1.id, visibility: 'public' }), - createTestSnippet({ folderId: rootFolder1.id, userId: user1.id, visibility: 'private' }), - createTestSnippet({ folderId: rootFolder2.id, userId: user2.id, visibility: 'public' }), - createTestSnippet({ folderId: rootFolder1.id, userId: user1.id, visibility: 'private' }), - createTestSnippet({ folderId: rootFolder2.id, userId: user2.id, visibility: 'public' }), - createTestSnippet({ folderId: rootFolder1.id, userId: user1.id, visibility: 'private' }), - createTestSnippet({ folderId: rootFolder1.id, userId: user1.id, visibility: 'private' }), + createTestSnippet({ folderId: rootFolder2.id, userId: user2.id, visibility: 'private' }), createTestSnippet({ folderId: rootFolder1.id, userId: user1.id, visibility: 'private' }), ]); // WHEN - const folderSnippets = await snippetService.findByFolder(rootFolder1.id); + const deleteSnippetDto = deleteTestSnippetDto({ snippetId: snippet1.id, userId: user2.id }); // THEN - await expect(folderSnippets).toHaveLength(6); + await expect(async () => { + await snippetService.delete(deleteSnippetDto); + }).rejects.toThrow( + new SharinganError(errors.CANT_EDIT_SNIPPET(deleteSnippetDto.creatorId, snippet1.id), 'CANT_EDIT_SNIPPET'), + ); - await deleteTestSnippetsById(existingSnippets.map((snippet) => snippet.id)); + const user1FolderSnippets = await snippetService.findByFolder(rootFolder1.id); + const user2FolderSnippets = await snippetService.findByFolder(rootFolder2.id); + + expect(user1FolderSnippets).toHaveLength(2); + expect(user2FolderSnippets).toHaveLength(1); + + await deleteTestSnippetsById([snippet2.id, snippet3.id]); + await deleteTestFoldersById([rootFolder1.id, rootFolder2.id]); + await deleteTestUsersById([user1.id, user2.id]); + }); + + it('should update an existing snippet in the specified folder', async () => { + // GIVEN + const [user, rootFolder] = await createUserWithRootFolder(); + const [snippet] = await Promise.all([ + createTestSnippet({ folderId: rootFolder.id, userId: user.id, visibility: 'public' }), + ]); + + const updateSnippetDto = updateTestSnippetDto({ snippetId: snippet.id, userId: user.id }); + + // WHEN + const updatedSnippet = await snippetService.update(updateSnippetDto); + + // THEN + const snippetToUpdate = updateSnippetDto.toSnippet(snippet); + + expect(updatedSnippet).toMatchObject({ + content: snippetToUpdate.content, + contentHtml: snippetToUpdate.contentHtml, + createdAt: expect.any(Date), + description: snippetToUpdate.description, + folderId: rootFolder.id, + id: snippet.id, + language: snippetToUpdate.language, + lineHighlight: snippetToUpdate.lineHighlight, + name: snippetToUpdate.name, + size: snippetToUpdate.size, + theme: snippetToUpdate.theme, + updatedAt: expect.any(Date), + userId: user.id, + visibility: snippetToUpdate.visibility, + }); + + await deleteTestSnippetsById([updatedSnippet.id]); + await deleteTestFoldersById([rootFolder.id]); + await deleteTestUsersById([user.id]); + }); + + it('should not update an existing snippet in the specified folder because another snippet with the updated name already exists in the folder', async () => { + // GIVEN + const [user, rootFolder] = await createUserWithRootFolder(); + const [snippet] = await Promise.all([ + createTestSnippet({ folderId: rootFolder.id, name: 'snippet-one.java', userId: user.id }), + createTestSnippet({ folderId: rootFolder.id, name: 'snippet-two.java', userId: user.id, visibility: 'private' }), + ]); + + const updateSnippetDto = updateTestSnippetDto({ name: 'snippet-two.java', snippetId: snippet.id, userId: user.id }); + + // WHEN + // THEN + await expect(async () => { + await snippetService.update(updateSnippetDto); + }).rejects.toThrow( + new SharinganError(errors.SNIPPET_ALREADY_EXIST(updateSnippetDto.name), 'SNIPPET_ALREADY_EXIST'), + ); + + await deleteTestSnippetsById([snippet.id]); + await deleteTestFoldersById([rootFolder.id]); + await deleteTestUsersById([user.id]); + }); + + it('should not update an existing snippet in the specified folder because because it belongs to other user', async () => { + // GIVEN + const [user1, rootFolder1] = await createUserWithRootFolder(); + const [user2, rootFolder2] = await createUserWithRootFolder(); + const [snippet] = await Promise.all([ + createTestSnippet({ folderId: rootFolder1.id, name: 'snippet-one.java', userId: user1.id }), + ]); + + const updateSnippetDto = updateTestSnippetDto({ snippetId: snippet.id, userId: user2.id }); + + // WHEN + // THEN + await expect(async () => { + await snippetService.update(updateSnippetDto); + }).rejects.toThrow( + new SharinganError(errors.CANT_EDIT_SNIPPET(updateSnippetDto.creatorId, snippet.id), 'CANT_EDIT_SNIPPET'), + ); + + await deleteTestSnippetsById([snippet.id]); await deleteTestFoldersById([rootFolder1.id, rootFolder2.id]); await deleteTestUsersById([user1.id, user2.id]); }); diff --git a/packages/domain/__tests__/setup/test-utils.ts b/packages/domain/__tests__/setup/test-utils.ts index a6865344..b756e27c 100644 --- a/packages/domain/__tests__/setup/test-utils.ts +++ b/packages/domain/__tests__/setup/test-utils.ts @@ -17,6 +17,8 @@ import CreateFolderDto from '../../src/folders/dtos/create-folder-dto'; import CreateUserRootFolderDto from '../../src/folders/dtos/create-user-root-folder-dto'; import CreateSessionDto from '../../src/sessions/dtos/create-session-dto'; import CreateSnippetDto from '../../src/snippets/dtos/create-snippet-dto'; +import DeleteSnippetDto from '../../src/snippets/dtos/delete-snippet-dto'; +import UpdateSnippetDto from '../../src/snippets/dtos/update-snippet-dto'; import UpdateUserDto from '../../src/users/dtos/update-user-dto'; type CreateManyTestFoldersArgs = { @@ -218,3 +220,36 @@ export const createTestSession = async (args: { userId: string }): Promise => { await dbClient.session.deleteMany({ where: { userId } }); }; + +export const deleteTestSnippetDto = (args: { snippetId: string; userId: string }): DeleteSnippetDto => { + return new DeleteSnippetDto({ + creatorId: args.userId, + snippetId: args.snippetId, + }); +}; + +export const updateTestSnippetDto = ( + args: { name?: string; snippetId?: string; userId?: string; visibility?: SnippetVisibility } | undefined, +): UpdateSnippetDto => { + const languages = ['java', 'js', 'ts', 'c', 'c++', 'python', 'go', 'php', 'csharp']; + const extensions = ['java', 'js', 'ts', 'c', 'cpp', 'py', 'go', 'php', 'cs']; + const themes = ['one-dark-pro', 'dracula', 'dark-plus', 'monokai', 'github-dark', 'github-light']; + + const languageIndex = randNumber({ max: languages.length - 1, min: 0 }); + const themeIndex = randNumber({ max: themes.length - 1, min: 0 }); + + const snippetContent = randWord({ length: randNumber({ max: 30, min: 5 }) }).join('\n'); + + return new UpdateSnippetDto({ + content: snippetContent, + contentHighlighted: `${snippetContent} highlighted`, + creatorId: args?.userId ?? generateTestId(), + description: randWord({ length: randNumber({ max: 20, min: 10 }) }).join(' '), + language: languages[languageIndex], + lineHighlight: null, + name: args?.name ?? `${randWord()}.${extensions[languageIndex]}`, + snippetId: args?.snippetId ?? generateTestId(), + theme: themes[themeIndex], + visibility: args?.visibility ?? 'public', + }); +}; From e4ec3efcfd27d5ad7c5b7893923ef4b6de2cd50a Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 18:35:55 +0100 Subject: [PATCH 08/20] test(domain): test the newsletter service --- .../newsletters/newsletter.service.test.ts | 75 +++++++++++++++++++ packages/domain/package.json | 1 + yarn.lock | 20 +++++ 3 files changed, 96 insertions(+) create mode 100644 packages/domain/__tests__/services/newsletters/newsletter.service.test.ts diff --git a/packages/domain/__tests__/services/newsletters/newsletter.service.test.ts b/packages/domain/__tests__/services/newsletters/newsletter.service.test.ts new file mode 100644 index 00000000..7e1753af --- /dev/null +++ b/packages/domain/__tests__/services/newsletters/newsletter.service.test.ts @@ -0,0 +1,75 @@ +import SharinganError from '@sharingan/utils'; +import nock from 'nock'; + +import NewsletterService from '../../../src/newsletters/newsletter.service'; + +const newsletterService = new NewsletterService({ + apiKey: 'apiKey', + formId: 'formId', +}); + +const baseURL = 'https://api.convertkit.com/v3'; + +describe('Test the newsletter service', () => { + test('Add the email address to the newsletter subscribers', async () => { + // GIVEN + const emailToSubscribe = 'user@email.com'; + const tags = ['sharingan']; + const formId = 'formId'; + + const scope = nock(baseURL) + .post(`/forms/${formId}/subscribe`, { + api_key: 'apiKey', + email: emailToSubscribe, + tags, + }) + .reply(200, { + subscription: { + id: '123ABC', + }, + }); + + // WHEN + await newsletterService.subscribe(emailToSubscribe, tags); + + // THEN + expect(scope.isDone()).toBe(true); + + nock.cleanAll(); + }); + + test('Handle HTTP error when the request to add the email address to the newsletter subscribers fails', async () => { + // GIVEN + const emailToSubscribe = 'user@email.com'; + const tags = ['sharingan']; + const formId = 'formId'; + + nock(baseURL) + .post(`/forms/${formId}/subscribe`, { + api_key: 'apiKey', + email: emailToSubscribe, + tags, + }) + .reply(400, { + message: 'Wrong api key provided!', + }); + + // WHEN + // THEN + const catchErrorsFormatted = { + data: { + message: 'Wrong api key provided!', + }, + message: 'Request failed with status code 400', + status: 400, + }; + + await expect(async () => { + await newsletterService.subscribe(emailToSubscribe, tags); + }).rejects.toThrow( + new SharinganError(JSON.stringify(catchErrorsFormatted, null, 2), 'NEWSLETTER_SUBSCRIBE_FAILED'), + ); + + nock.cleanAll(); + }); +}); diff --git a/packages/domain/package.json b/packages/domain/package.json index aaaec2e2..3a172b4b 100644 --- a/packages/domain/package.json +++ b/packages/domain/package.json @@ -28,6 +28,7 @@ "@types/bcryptjs": "^2.4.2", "@types/jest": "^28.1.4", "jest": "^28.1.2", + "nock": "^13.2.9", "ts-jest": "^28.0.5", "typescript": "4.8.4" } diff --git a/yarn.lock b/yarn.lock index 8bb896e3..ee1d33b4 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9356,6 +9356,11 @@ json-stable-stringify@^1.0.1: dependencies: jsonify "~0.0.0" +json-stringify-safe@^5.0.1: + version "5.0.1" + resolved "https://registry.yarnpkg.com/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz#1296a2d58fd45f19a0f6ce01d65701e2c735b6eb" + integrity sha512-ZClg6AaYvamvYEE82d3Iyd3vSSIjQ+odgjaTzRuO3s7toCdFKczob2i0zCh7JE8kWn17yvAWhUVxvqGwUalsRA== + json-to-pretty-yaml@^1.2.2: version "1.2.2" resolved "https://registry.npmjs.org/json-to-pretty-yaml/-/json-to-pretty-yaml-1.2.2.tgz" @@ -10322,6 +10327,16 @@ no-case@^3.0.4: lower-case "^2.0.2" tslib "^2.0.3" +nock@^13.2.9: + version "13.2.9" + resolved "https://registry.yarnpkg.com/nock/-/nock-13.2.9.tgz#4faf6c28175d36044da4cfa68e33e5a15086ad4c" + integrity sha512-1+XfJNYF1cjGB+TKMWi29eZ0b82QOvQs2YoLNzbpWGqFMtRQHTa57osqdGj4FrFPgkO4D4AZinzUJR9VvW3QUA== + dependencies: + debug "^4.1.0" + json-stringify-safe "^5.0.1" + lodash "^4.17.21" + propagate "^2.0.0" + node-dir@^0.1.17: version "0.1.17" resolved "https://registry.npmjs.org/node-dir/-/node-dir-0.1.17.tgz" @@ -11193,6 +11208,11 @@ prop-types@^15.7.2, prop-types@^15.8.1: object-assign "^4.1.1" react-is "^16.13.1" +propagate@^2.0.0: + version "2.0.1" + resolved "https://registry.yarnpkg.com/propagate/-/propagate-2.0.1.tgz#40cdedab18085c792334e64f0ac17256d38f9a45" + integrity sha512-vGrhOavPSTz4QVNuBNdcNXePNdNMaO1xj9yBeH1ScQPjk/rhg9sSlCXPhMkFuaNNW/syTvYqsnbIJxMBfRbbag== + property-expr@^2.0.4: version "2.0.5" resolved "https://registry.npmjs.org/property-expr/-/property-expr-2.0.5.tgz" From a347896af7603f3824a24c48d5c7ddabcc4d01a4 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 19:27:37 +0100 Subject: [PATCH 09/20] test(domain): test folders deletion --- .../services/folders/folder.service.test.ts | 132 +++++++++++++++++- .../services/folders/utils/folders.test.ts | 34 +---- packages/domain/__tests__/setup/test-utils.ts | 11 ++ packages/domain/src/folders/folder.service.ts | 6 +- packages/domain/src/folders/utils/folders.ts | 4 - 5 files changed, 142 insertions(+), 45 deletions(-) diff --git a/packages/domain/__tests__/services/folders/folder.service.test.ts b/packages/domain/__tests__/services/folders/folder.service.test.ts index fe583883..aa17899b 100644 --- a/packages/domain/__tests__/services/folders/folder.service.test.ts +++ b/packages/domain/__tests__/services/folders/folder.service.test.ts @@ -1,7 +1,7 @@ -import SharinganError, { errors } from '@sharingan/utils'; +import { Folder } from '@sharingan/database'; +import SharinganError, { errors, generateRandomId } from '@sharingan/utils'; -import { folderService, roleService } from '../../../index'; -import { CreateUserRootFolderDto } from '../../../index'; +import { CreateUserRootFolderDto, folderService, roleService } from '../../../index'; import CreateFolderDto from '../../../src/folders/dtos/create-folder-dto'; import { createManyTestFolders, @@ -10,6 +10,7 @@ import { createUserWithRootFolder, deleteTestFoldersById, deleteTestUsersById, + updateTestFolderDto, } from '../../setup/test-utils'; describe('Test Folder service', () => { @@ -250,6 +251,25 @@ describe('Test Folder service', () => { await deleteTestUsersById([user2.id]); }); + it('should not delete folders because we cannot delete a root folder', async () => { + // GIVEN + const [user, rootFolder] = await createUserWithRootFolder(); + const [myGistFolder] = await createManyTestFolders({ + folderNames: ['My gist'], + parentId: rootFolder.id, + userId: user.id, + }); + + // WHEN + // THEN + await expect(async () => { + await folderService.deleteMany([myGistFolder.id, rootFolder.id], user.id); + }).rejects.toThrow(new SharinganError(errors.CANT_DELETE_ROOT_FOLDER, 'CANT_DELETE_ROOT_FOLDER')); + + await deleteTestFoldersById([myGistFolder.id, rootFolder.id]); + await deleteTestUsersById([user.id]); + }); + it('should generate the breadcrumb path of a folder', async () => { // GIVEN const [user, rootFolder] = await createUserWithRootFolder(); @@ -292,4 +312,110 @@ describe('Test Folder service', () => { await deleteTestFoldersById([rootFolder.id]); await deleteTestUsersById([user.id]); }); + + it('should found no folder given the ID provided', async () => { + // GIVEN + const folderId = generateRandomId(); + + // WHEN + // THEN + await expect(async () => { + await folderService.findById(folderId); + }).rejects.toThrow(new SharinganError(errors.FOLDER_NOT_FOUND(folderId), 'FOLDER_NOT_FOUND')); + }); + + it('should update an existing folder in the specified folder', async () => { + // GIVEN + const [user, rootFolder] = await createUserWithRootFolder(); + const [folder] = await createManyTestFolders({ + folderNames: ['My gist'], + parentId: rootFolder.id, + userId: user.id, + }); + + const updateFolderDto = updateTestFolderDto({ folderId: folder.id, name: 'The Gist', userId: user.id }); + + // WHEN + const updatedFolder = await folderService.update(updateFolderDto); + + // THEN + const folderToUpdate = updateFolderDto.toFolder(folder); + + expect(updatedFolder).toMatchObject({ + createdAt: expect.any(Date), + id: folder.id, + isFavorite: false, + name: folderToUpdate.name, + parentId: rootFolder.id, + path: folder.path, + updatedAt: expect.any(Date), + userId: user.id, + }); + + await deleteTestFoldersById([updatedFolder.id, rootFolder.id]); + await deleteTestUsersById([user.id]); + }); + + it('should not update an existing folder in the specified folder because another folder with the updated name already exists in the folder', async () => { + // GIVEN + const [user, rootFolder] = await createUserWithRootFolder(); + const [folder1, folder2] = await createManyTestFolders({ + folderNames: ['folder-one', 'folder-two'], + parentId: rootFolder.id, + userId: user.id, + }); + + const updateFolderDto = updateTestFolderDto({ folderId: folder1.id, name: 'folder-two', userId: user.id }); + + // WHEN + // THEN + await expect(async () => { + await folderService.update(updateFolderDto); + }).rejects.toThrow(new SharinganError(errors.FOLDER_ALREADY_EXIST(updateFolderDto.name), 'FOLDER_ALREADY_EXIST')); + + await deleteTestFoldersById([folder1.id, folder2.id]); + await deleteTestFoldersById([rootFolder.id]); + await deleteTestUsersById([user.id]); + }); + + it('should not update an existing folder in the specified folder because it belongs to other user', async () => { + // GIVEN + const [user1, rootFolder1] = await createUserWithRootFolder(); + const [user2, rootFolder2] = await createUserWithRootFolder(); + const [folderUser2] = await createManyTestFolders({ + folderNames: ['folder-user-two'], + parentId: rootFolder2.id, + userId: user2.id, + }); + + const updateFolderDto = updateTestFolderDto({ folderId: folderUser2.id, userId: user1.id }); + + // WHEN + // THEN + await expect(async () => { + await folderService.update(updateFolderDto); + }).rejects.toThrow( + new SharinganError(errors.CANT_EDIT_FOLDER(updateFolderDto.creatorId, folderUser2.id), 'CANT_EDIT_FOLDER'), + ); + + await deleteTestFoldersById([folderUser2.id]); + await deleteTestFoldersById([rootFolder1.id, rootFolder2.id]); + await deleteTestUsersById([user1.id, user2.id]); + }); + + it('should not update the user root folder', async () => { + // GIVEN + const [user1, rootFolder] = await createUserWithRootFolder(); + + const updateFolderDto = updateTestFolderDto({ folderId: rootFolder.id, name: 'new-root-folder', userId: user1.id }); + + // WHEN + // THEN + await expect(async () => { + await folderService.update(updateFolderDto); + }).rejects.toThrow(new SharinganError(errors.CANT_RENAME_ROOT_FOLDER, 'CANT_RENAME_ROOT_FOLDER')); + + await deleteTestFoldersById([rootFolder.id]); + await deleteTestUsersById([user1.id]); + }); }); diff --git a/packages/domain/__tests__/services/folders/utils/folders.test.ts b/packages/domain/__tests__/services/folders/utils/folders.test.ts index 9475876e..ed87311b 100644 --- a/packages/domain/__tests__/services/folders/utils/folders.test.ts +++ b/packages/domain/__tests__/services/folders/utils/folders.test.ts @@ -1,41 +1,9 @@ import { Folder } from '@sharingan/database'; -import { isFoldersBelongToUser, isFoldersContainRoot } from '../../../../src/folders/utils/folders'; +import { isFoldersContainRoot } from '../../../../src/folders/utils/folders'; import { createTestFolderDto, generateTestId } from '../../../setup/test-utils'; describe('Test folders utilities', () => { - it('should assert all the folders belong to the user', () => { - // GIVEN - const parentId = generateTestId(); - const userId = generateTestId(); - const foldersToDelete: Folder[] = [ - createTestFolderDto({ parentId, userId }).toFolder(), - createTestFolderDto({ parentId, userId }).toFolder(), - ]; - - // WHEN - const isValid = isFoldersBelongToUser(foldersToDelete, userId); - - // THEN - expect(isValid).toEqual(true); - }); - - it('should assert not all the folders belong to the user', () => { - // GIVEN - const parentId = generateTestId(); - const userId = generateTestId(); - const foldersToDelete: Folder[] = [ - createTestFolderDto({ parentId, userId }).toFolder(), - createTestFolderDto().toFolder(), - ]; - - // WHEN - const isValid = isFoldersBelongToUser(foldersToDelete, userId); - - // THEN - expect(isValid).toEqual(false); - }); - it('should assert the folders contain the root folder', () => { // GIVEN const userId = generateTestId(); diff --git a/packages/domain/__tests__/setup/test-utils.ts b/packages/domain/__tests__/setup/test-utils.ts index b756e27c..c4a50595 100644 --- a/packages/domain/__tests__/setup/test-utils.ts +++ b/packages/domain/__tests__/setup/test-utils.ts @@ -15,6 +15,7 @@ import { import { CreateUserDto } from '../../index'; import CreateFolderDto from '../../src/folders/dtos/create-folder-dto'; import CreateUserRootFolderDto from '../../src/folders/dtos/create-user-root-folder-dto'; +import UpdateFolderDto from '../../src/folders/dtos/update-folder-dto'; import CreateSessionDto from '../../src/sessions/dtos/create-session-dto'; import CreateSnippetDto from '../../src/snippets/dtos/create-snippet-dto'; import DeleteSnippetDto from '../../src/snippets/dtos/delete-snippet-dto'; @@ -253,3 +254,13 @@ export const updateTestSnippetDto = ( visibility: args?.visibility ?? 'public', }); }; + +export const updateTestFolderDto = ( + args: { folderId?: string; name?: string; userId?: string } | undefined, +): UpdateFolderDto => { + return new UpdateFolderDto({ + creatorId: args?.userId ?? generateTestId(), + folderId: args?.folderId ?? generateTestId(), + name: args?.name ?? `${randWord()}`, + }); +}; diff --git a/packages/domain/src/folders/folder.service.ts b/packages/domain/src/folders/folder.service.ts index fe475312..1bb33065 100644 --- a/packages/domain/src/folders/folder.service.ts +++ b/packages/domain/src/folders/folder.service.ts @@ -4,7 +4,7 @@ import SharinganError, { errors } from '@sharingan/utils'; import CreateFolderDto from './dtos/create-folder-dto'; import CreateUserRootFolderDto from './dtos/create-user-root-folder-dto'; import UpdateFolderDto from './dtos/update-folder-dto'; -import { isFoldersBelongToUser, isFoldersContainRoot } from './utils/folders'; +import { isFoldersContainRoot } from './utils/folders'; export default class FolderService { async createUserRootFolder(dto: CreateUserRootFolderDto): Promise { @@ -92,10 +92,6 @@ export default class FolderService { }, }); - if (!isFoldersBelongToUser(foldersToDelete, userId)) { - throw new SharinganError(errors.FOLDERS_DONT_BELONG_TO_USER, 'FOLDERS_DONT_BELONG_TO_USER'); - } - if (isFoldersContainRoot(foldersToDelete)) { throw new SharinganError(errors.CANT_DELETE_ROOT_FOLDER, 'CANT_DELETE_ROOT_FOLDER'); } diff --git a/packages/domain/src/folders/utils/folders.ts b/packages/domain/src/folders/utils/folders.ts index 2fc24b53..01f45d48 100644 --- a/packages/domain/src/folders/utils/folders.ts +++ b/packages/domain/src/folders/utils/folders.ts @@ -1,9 +1,5 @@ import { Folder } from '@sharingan/database'; -export const isFoldersBelongToUser = (folders: Folder[], userId: string): boolean => { - return folders.every((folder) => folder.userId === userId); -}; - export const isFoldersContainRoot = (folders: Folder[]): boolean => { return folders.some((folder) => folder.parentId === null); }; From 8b8d899f7a7ebeb5a2fbbe68e9a8cd051d744752 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 30 Oct 2022 19:56:51 +0100 Subject: [PATCH 10/20] test(domain): test users service remaining cases --- .../services/users/user.service.test.ts | 71 ++++++++++++++++++- packages/domain/__tests__/setup/test-utils.ts | 14 +++- 2 files changed, 81 insertions(+), 4 deletions(-) diff --git a/packages/domain/__tests__/services/users/user.service.test.ts b/packages/domain/__tests__/services/users/user.service.test.ts index e842de75..3644ca9e 100644 --- a/packages/domain/__tests__/services/users/user.service.test.ts +++ b/packages/domain/__tests__/services/users/user.service.test.ts @@ -1,5 +1,5 @@ import { User } from '@sharingan/database'; -import SharinganError, { errors } from '@sharingan/utils'; +import SharinganError, { errors, generateRandomId } from '@sharingan/utils'; import { roleService, userService } from '../../../index'; import { @@ -55,6 +55,49 @@ describe('Test User service', () => { await deleteTestUsersById([createdUser.id]); }); + it('should create a user with no username', async () => { + // GIVEN + const role = await findTestRole('user'); + const createUserDto = await createTestUserDto({ roleId: role.id, username: null }); + + // WHEN + const createdUser = await userService.create(createUserDto); + + // THEN + expect(createdUser).toMatchObject({ + createdAt: expect.any(Date), + email: createUserDto.email, + id: createUserDto.toUser().id, + isEnabled: createUserDto.toUser().isEnabled, + name: createUserDto.toUser().name, + oauthProvider: createUserDto.toUser().oauthProvider, + password: null, + pictureUrl: createUserDto.toUser().pictureUrl, + roleId: createUserDto.toUser().roleId, + timezone: createUserDto.toUser().timezone, + updatedAt: expect.any(Date), + username: expect.any(String), + }); + + await deleteTestUsersById([createdUser.id]); + }); + + it('should create a user with a username that already exists', async () => { + // GIVEN + const role = await findTestRole('user'); + const user = await createTestUser({ username: 'roloto' }); + + const createUserDto = await createTestUserDto({ roleId: role.id, username: 'roloto' }); + + // WHEN + const createdUser = await userService.create(createUserDto); + + // THEN + expect(createdUser.username).not.toEqual('roloto'); + + await deleteTestUsersById([user.id, createdUser.id]); + }); + it('should create a user - validation check', async () => { // GIVEN const role = await findTestRole('user'); @@ -84,6 +127,21 @@ describe('Test User service', () => { await deleteTestUsersById([createdUser.id]); }); + it('should fail create a user because the email address already exists', async () => { + // GIVEN + const user = await createTestUser({ email: 'user@email.com' }); + const role = await findTestRole('user'); + const createUserDto = await createTestUserDto({ email: 'user@email.com', roleId: role.id }); + + // WHEN + // THEN + await expect(async () => { + await userService.create(createUserDto); + }).rejects.toThrow(new SharinganError(errors.EMAIL_ALREADY_TAKEN, 'EMAIL_ALREADY_TAKEN')); + + await deleteTestUsersById([user.id]); + }); + it('should update user information', async () => { // GIVEN const currentUser = await createTestUser({}); @@ -178,4 +236,15 @@ describe('Test User service', () => { await deleteTestUsersById([user.id]); }); + + it('should found no user given the ID provided', async () => { + // GIVEN + const snippetId = generateRandomId(); + + // WHEN + const user = await userService.findById(snippetId); + + // THEN + expect(user).toBeNull(); + }); }); diff --git a/packages/domain/__tests__/setup/test-utils.ts b/packages/domain/__tests__/setup/test-utils.ts index c4a50595..9c63a100 100644 --- a/packages/domain/__tests__/setup/test-utils.ts +++ b/packages/domain/__tests__/setup/test-utils.ts @@ -29,17 +29,21 @@ type CreateManyTestFoldersArgs = { }; type CreateTestUserDtoArgs = { + email?: string; isEnabled?: boolean; oauthProvider?: OauthProvider; password?: string | null; roleId: string; + username?: string | null; }; type CreateTestUserArgs = { + email?: string; isEnabled?: boolean; oauthProvider?: OauthProvider; password?: string | null; roleName?: RoleName; + username?: string | null; }; export const findTestRole = async (name: RoleName): Promise => { @@ -53,20 +57,22 @@ export const findTestRole = async (name: RoleName): Promise => { }; export const createTestUserDto = ({ + email, isEnabled, oauthProvider, password, roleId, + username = randUserName(), }: CreateTestUserDtoArgs): CreateUserDto => { const dto = new CreateUserDto({ - email: randEmail(), + email: email ?? randEmail(), name: randFullName(), oauthProvider: oauthProvider ?? 'github', password: password ?? null, pictureUrl: randImg({ category: 'people' }), roleId, timezone: randTimeZone(), - username: randUserName(), + username, }); dto.isEnabled = Boolean(isEnabled); @@ -75,14 +81,16 @@ export const createTestUserDto = ({ }; export const createTestUser = async ({ + email, isEnabled, oauthProvider, password, roleName = 'user', + username, }: CreateTestUserArgs): Promise => { const role = await findTestRole(roleName); - const createUserDto = createTestUserDto({ isEnabled, oauthProvider, password, roleId: role.id }); + const createUserDto = createTestUserDto({ email, isEnabled, oauthProvider, password, roleId: role.id, username }); return dbClient.user.create({ data: createUserDto.toUser() }); }; From 5d8563895c80daa126bb4b3fd53156f2efcddb9a Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Wed, 9 Nov 2022 23:21:41 +0100 Subject: [PATCH 11/20] feat(snippet): manually select the language of a code snippet --- .../directory/snippets/form/create-snippet.tsx | 4 +++- .../snippets/form/editor/hooks/use-form-editor.ts | 5 +++-- .../directory/snippets/form/editor/index.tsx | 10 +++++++++- .../src/components/directory/snippets/form/utils.ts | 11 +++++++++++ .../directory/snippets/form/view-snippet.tsx | 6 +++++- packages/front/src/forms/select-input.tsx | 7 +++++-- packages/front/src/typings/snippet-form.ts | 1 + packages/front/src/utils/snippets.ts | 2 +- 8 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 packages/front/src/components/directory/snippets/form/utils.ts diff --git a/packages/front/src/components/directory/snippets/form/create-snippet.tsx b/packages/front/src/components/directory/snippets/form/create-snippet.tsx index 33308f9e..8b6c9ba4 100644 --- a/packages/front/src/components/directory/snippets/form/create-snippet.tsx +++ b/packages/front/src/components/directory/snippets/form/create-snippet.tsx @@ -11,6 +11,7 @@ import { extractLanguageFromName, lineHighlightToString } from '../../../../util import { useToast } from '../../../toast/provider'; import { SnippetTextEditor } from './editor'; import { SnippetFormValues, formSchema } from './form-schema'; +import { generateSnippetLanguageOptions } from './utils'; type Props = { closeModal: () => void; @@ -65,7 +66,7 @@ console.log(content);`, contentHighlighted: values.codeHighlighted, description: values.description, folderId, - language: extractLanguageFromName(values.name), + language: values.language?.id ?? extractLanguageFromName(values.name), lineHighlight: lineHighlightToString(values.lineHighlight), name: values.name, theme: values.theme.id, @@ -117,6 +118,7 @@ console.log(content);`, diff --git a/packages/front/src/components/directory/snippets/form/editor/hooks/use-form-editor.ts b/packages/front/src/components/directory/snippets/form/editor/hooks/use-form-editor.ts index dedfe5d1..4117a217 100644 --- a/packages/front/src/components/directory/snippets/form/editor/hooks/use-form-editor.ts +++ b/packages/front/src/components/directory/snippets/form/editor/hooks/use-form-editor.ts @@ -20,11 +20,12 @@ export const useFormEditor = () => { const code = watch('code'); const name = watch('name'); const theme = watch('theme'); + const language = watch('language'); const lineHighlight = watch('lineHighlight'); const codeHighlight = watch('codeHighlight'); const isSnippetPrivate = watch('isPrivate'); - const language = getLanguageFromExtension(name); + const codeLanguage = language?.id ?? getLanguageFromExtension(name); useEffect(() => { const lineHighlightClone = new Map(lineHighlight); @@ -56,7 +57,7 @@ export const useFormEditor = () => { }, [codeHighlight]); const onHighlight = (highlighter?: Highlighter) => (code: string) => { - return highlightSnippet({ code, highlighter, language, lineHighlight, theme: theme.id }); + return highlightSnippet({ code, highlighter, language: codeLanguage, lineHighlight, theme: theme.id }); }; return { diff --git a/packages/front/src/components/directory/snippets/form/editor/index.tsx b/packages/front/src/components/directory/snippets/form/editor/index.tsx index 3e843ae6..c6c80927 100644 --- a/packages/front/src/components/directory/snippets/form/editor/index.tsx +++ b/packages/front/src/components/directory/snippets/form/editor/index.tsx @@ -13,10 +13,11 @@ import { useFormEditor } from './hooks/use-form-editor'; type Props = { codeHighlightOptions: SelectOption[]; highlighter?: Highlighter; + languageOptions: SelectOption[]; themeOptions: SelectOption[]; }; -const SnippetTextEditor = ({ codeHighlightOptions, highlighter, themeOptions }: Props) => { +const SnippetTextEditor = ({ codeHighlightOptions, highlighter, languageOptions, themeOptions }: Props) => { const { control, setValue } = useFormContext(); const { code, handleEditorSelect, isSnippetPrivate, onHighlight, theme } = useFormEditor(); @@ -55,6 +56,13 @@ const SnippetTextEditor = ({ codeHighlightOptions, highlighter, themeOptions }: />
+ ( + + )} + /> { + return BUNDLED_LANGUAGES.map((language) => ({ + id: language.id, + label: capitalize(language.id), + })); +}; diff --git a/packages/front/src/components/directory/snippets/form/view-snippet.tsx b/packages/front/src/components/directory/snippets/form/view-snippet.tsx index e72ad3ca..1894301c 100644 --- a/packages/front/src/components/directory/snippets/form/view-snippet.tsx +++ b/packages/front/src/components/directory/snippets/form/view-snippet.tsx @@ -10,6 +10,7 @@ import { extractLanguageFromName, lineHighlightToString } from '../../../../util import { useToast } from '../../../toast/provider'; import { SnippetTextEditor } from './editor'; import { SnippetFormValues, formSchema } from './form-schema'; +import { generateSnippetLanguageOptions } from './utils'; type Props = { snippet: SnippetItem; @@ -42,13 +43,15 @@ const ViewSnippet = ({ snippet }: Props) => { }); const submitUpdateSnippet = async (values: SnippetFormValues) => { + console.log('Values => ', values); + await updateSnippet({ id: snippet.id, input: { content: values.code, contentHighlighted: values.codeHighlighted, description: values.description, - language: extractLanguageFromName(values.name), + language: values.language?.id ?? extractLanguageFromName(values.name), lineHighlight: lineHighlightToString(values.lineHighlight), name: values.name, theme: values.theme.id, @@ -68,6 +71,7 @@ const ViewSnippet = ({ snippet }: Props) => { diff --git a/packages/front/src/forms/select-input.tsx b/packages/front/src/forms/select-input.tsx index 6b9e99f2..95a1ac11 100644 --- a/packages/front/src/forms/select-input.tsx +++ b/packages/front/src/forms/select-input.tsx @@ -10,11 +10,12 @@ type Props = { label?: string; onChange: (value: SelectOption) => void; options: SelectOption[]; + placeholder?: string; value?: SelectOption; }; const SelectInput = forwardRef((props: Props, ref) => { - const { className = 'w-40', label, onChange, options, value: selectedValue } = props; + const { className = 'w-40', label, onChange, options, placeholder = 'Select value...', value: selectedValue } = props; const generateOptionClasses = (isActive: boolean) => { return classNames( @@ -35,7 +36,9 @@ const SelectInput = forwardRef((props: Props, ref) => { {label && {label}}
- {selectedValue?.label} + + {selectedValue?.label ?? placeholder} + diff --git a/packages/front/src/typings/snippet-form.ts b/packages/front/src/typings/snippet-form.ts index 7cb11a24..dfc766b3 100644 --- a/packages/front/src/typings/snippet-form.ts +++ b/packages/front/src/typings/snippet-form.ts @@ -26,6 +26,7 @@ export type EditorFormValues = { codeHighlighted: string; description: string; isPrivate: boolean; + language: SelectOption; lineHighlight: Array<[number, string]>; name: string; theme: SelectOption; diff --git a/packages/front/src/utils/snippets.ts b/packages/front/src/utils/snippets.ts index 30cd8e8d..5057f3af 100644 --- a/packages/front/src/utils/snippets.ts +++ b/packages/front/src/utils/snippets.ts @@ -4,7 +4,7 @@ export const lineHighlightToString = (value: Array<[number, string]>) => { export const extractLanguageFromName = (name: string): string => { if (!name.includes('.')) { - return 'plain'; + return 'txt'; } const nameArrayPart = name.split('.'); From c905424fba439aa49be9e6717cef6350208eba8e Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Fri, 11 Nov 2022 15:58:09 +0100 Subject: [PATCH 12/20] feat(snippet): set the current language as the default when editing --- apps/web/src/styles/code-editor.css | 1 - .../directory/snippets/form/create-snippet.tsx | 11 ++--------- .../directory/snippets/form/view-snippet.tsx | 11 ++++++++--- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/apps/web/src/styles/code-editor.css b/apps/web/src/styles/code-editor.css index 2c5cfbb7..a5e6079c 100644 --- a/apps/web/src/styles/code-editor.css +++ b/apps/web/src/styles/code-editor.css @@ -4,7 +4,6 @@ .code-editor-container textarea { outline: 0; - caret-color: white; font-family: 'Inter', monospace !important; font-size: 14px; padding-left: 50px !important; diff --git a/packages/front/src/components/directory/snippets/form/create-snippet.tsx b/packages/front/src/components/directory/snippets/form/create-snippet.tsx index 8b6c9ba4..17b8d8a3 100644 --- a/packages/front/src/components/directory/snippets/form/create-snippet.tsx +++ b/packages/front/src/components/directory/snippets/form/create-snippet.tsx @@ -27,12 +27,7 @@ const CreateSnippetContainer = ({ closeModal, folderId, open }: Props) => { const formMethods = useForm({ defaultValues: { - code: `import fs from "fs"; -import path from "path"; - -const content= fs.readFileSync(path.resolve(__dirname, 'file.json'), { encoding: "utf-8" }); - -console.log(content);`, + code: `// Write your code here...\n`, codeHighlight: CODE_HIGHLIGHT_OPTIONS[0], codeHighlighted: '', isPrivate: true, @@ -45,7 +40,7 @@ console.log(content);`, const handleCloseModal = () => { closeModal(); formMethods.reset({ - code: '', + code: '// Write your code here...\n', codeHighlight: CODE_HIGHLIGHT_OPTIONS[0], codeHighlighted: '', description: '', @@ -58,8 +53,6 @@ console.log(content);`, }; const submitCreateSnippet = async (values: SnippetFormValues) => { - console.log('Values => ', values); - await createSnippet({ input: { content: values.code, diff --git a/packages/front/src/components/directory/snippets/form/view-snippet.tsx b/packages/front/src/components/directory/snippets/form/view-snippet.tsx index 1894301c..8a5fabdf 100644 --- a/packages/front/src/components/directory/snippets/form/view-snippet.tsx +++ b/packages/front/src/components/directory/snippets/form/view-snippet.tsx @@ -4,6 +4,7 @@ import { FormProvider, useForm } from 'react-hook-form'; import Button from '../../../../forms/button'; import { useCodeHighlighter } from '../../../../hooks'; import { useUpdateSnippet } from '../../../../services/snippets/update-snippet'; +import { SelectOption } from '../../../../typings/components'; import { SnippetItem } from '../../../../typings/queries'; import { CODE_HIGHLIGHT_OPTIONS, THEME_OPTIONS } from '../../../../utils/constants'; import { extractLanguageFromName, lineHighlightToString } from '../../../../utils/snippets'; @@ -22,11 +23,16 @@ const selectCodeHighlightOptionValue = (theme: string) => { return themeOption ?? THEME_OPTIONS[0]; }; +const selectLanguageOptionValue = (options: SelectOption[], language: string) => { + return options.find((option) => option.id === language); +}; + const ViewSnippet = ({ snippet }: Props) => { const { highlighter } = useCodeHighlighter(); const { toastError, toastSuccess } = useToast(); const { isLoading, updateSnippet } = useUpdateSnippet(snippet.folderId); + const languageOptions = generateSnippetLanguageOptions(); const formMethods = useForm({ defaultValues: { @@ -35,6 +41,7 @@ const ViewSnippet = ({ snippet }: Props) => { codeHighlighted: snippet.contentHighlighted, description: snippet.description ?? undefined, isPrivate: snippet.isPrivate, + language: selectLanguageOptionValue(languageOptions, snippet.language), lineHighlight: snippet.lineHighLight, name: snippet.name, theme: selectCodeHighlightOptionValue(snippet.theme), @@ -43,8 +50,6 @@ const ViewSnippet = ({ snippet }: Props) => { }); const submitUpdateSnippet = async (values: SnippetFormValues) => { - console.log('Values => ', values); - await updateSnippet({ id: snippet.id, input: { @@ -71,7 +76,7 @@ const ViewSnippet = ({ snippet }: Props) => { From 658c924ca3566db7cb106130527fcb80d700edf9 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sat, 12 Nov 2022 23:52:29 +0100 Subject: [PATCH 13/20] feat(snippet): update the resolver to retrieve snippet content --- apps/core/src/resources/resolvers.ts | 5 +++-- apps/core/src/resources/schema.graphql.ts | 3 +-- apps/core/src/types/graphql.d.ts | 6 ++---- .../src/components/snippets/public-snippet.tsx | 15 +++------------ apps/web/src/containers/private/browse.tsx | 6 ++---- packages/front/src/graphql/generated.ts | 6 +++--- .../graphql/snippets/queries/public-snippets.ts | 2 +- .../src/services/snippets/public-snippets.ts | 2 +- 8 files changed, 16 insertions(+), 29 deletions(-) diff --git a/apps/core/src/resources/resolvers.ts b/apps/core/src/resources/resolvers.ts index 830d2404..8e70f87f 100644 --- a/apps/core/src/resources/resolvers.ts +++ b/apps/core/src/resources/resolvers.ts @@ -13,7 +13,6 @@ import { updateSnippet } from './snippets/mutations/update-snippet'; import { findSnippet } from './snippets/queries/find-snippet'; import { mySnippets } from './snippets/queries/my-snippets'; import { publicSnippets } from './snippets/queries/public-snippets'; -import { shortContentResolver } from './snippets/queries/resolvers/short-content'; import { dateScalar } from './types/date'; import { loginUser } from './users/mutations/login-user'; import { logoutUser } from './users/mutations/logout-user'; @@ -58,10 +57,12 @@ const resolvers: Resolvers = { publicSnippets, }, Snippet: { + contentHighlighted: (snippet) => { + return snippet.contentHtml; + }, folder: (snippet, _args, context) => { return context.db.folder.findById(snippet.folderId); }, - shortContent: shortContentResolver, user: (snippet, _args, context) => { return context.db.user.findById(snippet.userId); }, diff --git a/apps/core/src/resources/schema.graphql.ts b/apps/core/src/resources/schema.graphql.ts index 9bba7573..270beb83 100644 --- a/apps/core/src/resources/schema.graphql.ts +++ b/apps/core/src/resources/schema.graphql.ts @@ -60,8 +60,7 @@ export default gql` id: ID! name: String! content: String! - contentHighlighted: String - shortContent: String! + contentHighlighted: String! language: String! lineHighlight: String size: Int! diff --git a/apps/core/src/types/graphql.d.ts b/apps/core/src/types/graphql.d.ts index dc2f84f8..113c29d3 100644 --- a/apps/core/src/types/graphql.d.ts +++ b/apps/core/src/types/graphql.d.ts @@ -210,7 +210,7 @@ export type SignupUserResult = { export type Snippet = { __typename?: 'Snippet'; content: Scalars['String']; - contentHighlighted?: Maybe; + contentHighlighted: Scalars['String']; createdAt: Scalars['Date']; description?: Maybe; folder: Folder; @@ -218,7 +218,6 @@ export type Snippet = { language: Scalars['String']; lineHighlight?: Maybe; name: Scalars['String']; - shortContent: Scalars['String']; size: Scalars['Int']; theme: Scalars['String']; updatedAt: Scalars['Date']; @@ -589,7 +588,7 @@ export type SnippetResolvers< ParentType extends ResolversParentTypes['Snippet'] = ResolversParentTypes['Snippet'], > = { content?: Resolver; - contentHighlighted?: Resolver, ParentType, ContextType>; + contentHighlighted?: Resolver; createdAt?: Resolver; description?: Resolver, ParentType, ContextType>; folder?: Resolver; @@ -597,7 +596,6 @@ export type SnippetResolvers< language?: Resolver; lineHighlight?: Resolver, ParentType, ContextType>; name?: Resolver; - shortContent?: Resolver; size?: Resolver; theme?: Resolver; updatedAt?: Resolver; diff --git a/apps/web/src/components/snippets/public-snippet.tsx b/apps/web/src/components/snippets/public-snippet.tsx index b275e258..12239497 100644 --- a/apps/web/src/components/snippets/public-snippet.tsx +++ b/apps/web/src/components/snippets/public-snippet.tsx @@ -1,22 +1,13 @@ -import { Highlighter, Link, PublicSnippetResult, UserAvatar } from '@sharingan/front'; -import { useEditor } from '@sharingan/front/src/components/directory/snippets/form/editor/hooks/use-editor'; +import { Link, PublicSnippetResult, UserAvatar } from '@sharingan/front'; type Props = { - highlighter?: Highlighter; snippet: PublicSnippetResult['items'][number]; }; -export const PublicSnippet = ({ highlighter, snippet }: Props) => { - const { highlightSnippet } = useEditor(); +export const PublicSnippet = ({ snippet }: Props) => { const { user } = snippet; - const htmlCode = highlightSnippet({ - code: snippet.content, - highlighter, - language: snippet.language, - lineHighlight: snippet.lineHighLight, - theme: snippet.theme, - }); + const htmlCode = snippet.content; return (
diff --git a/apps/web/src/containers/private/browse.tsx b/apps/web/src/containers/private/browse.tsx index 75866410..912c77d9 100644 --- a/apps/web/src/containers/private/browse.tsx +++ b/apps/web/src/containers/private/browse.tsx @@ -1,4 +1,4 @@ -import { PublicSnippetResult, useCodeHighlighter } from '@sharingan/front'; +import { PublicSnippetResult } from '@sharingan/front'; import { NextSeo } from 'next-seo'; import Layout from '@/components/layout/private/layout'; @@ -9,8 +9,6 @@ type Props = { }; const Browse = ({ data }: Props) => { - const { highlighter } = useCodeHighlighter(); - console.log(data); const snippets = data.items; @@ -29,7 +27,7 @@ const Browse = ({ data }: Props) => {
{snippets.map((snippet) => ( - + ))}
diff --git a/packages/front/src/graphql/generated.ts b/packages/front/src/graphql/generated.ts index e32ecb90..ca250a3b 100644 --- a/packages/front/src/graphql/generated.ts +++ b/packages/front/src/graphql/generated.ts @@ -198,7 +198,7 @@ export type SignupUserResult = { export type Snippet = { __typename?: 'Snippet'; content: Scalars['String']; - contentHighlighted?: Maybe; + contentHighlighted: Scalars['String']; createdAt: Scalars['Date']; description?: Maybe; folder: Folder; @@ -360,7 +360,7 @@ export type FindSnippetQuery = { lineHighlight?: string | null; visibility: SnippetVisibility; content: string; - contentHighlighted?: string | null; + contentHighlighted: string; theme: string; createdAt: any; updatedAt: any; @@ -387,7 +387,7 @@ export type PublicSnippetsQuery = { description?: string | null; language: string; lineHighlight?: string | null; - shortContent: string; + contentHighlighted: string; theme: string; createdAt: any; user: { __typename?: 'User'; id: string; username?: string | null; name: string; pictureUrl?: string | null }; diff --git a/packages/front/src/graphql/snippets/queries/public-snippets.ts b/packages/front/src/graphql/snippets/queries/public-snippets.ts index c6467f28..a092b773 100644 --- a/packages/front/src/graphql/snippets/queries/public-snippets.ts +++ b/packages/front/src/graphql/snippets/queries/public-snippets.ts @@ -21,7 +21,7 @@ export const findPublicSnippetsQuery = gql` description language lineHighlight - shortContent + contentHighlighted theme createdAt user { diff --git a/packages/front/src/services/snippets/public-snippets.ts b/packages/front/src/services/snippets/public-snippets.ts index 81b8d01b..4dce6d3f 100644 --- a/packages/front/src/services/snippets/public-snippets.ts +++ b/packages/front/src/services/snippets/public-snippets.ts @@ -18,7 +18,7 @@ export const formatPublicSnippetsResult = (data?: PublicSnippetsQuery): PublicSn hasMore, itemPerPage, items: items.map((snippet) => ({ - content: snippet.shortContent, + content: snippet.contentHighlighted, createdAt: snippet.createdAt, description: snippet.description ?? null, id: snippet.id, From 25290072460be103278d9c60570c0b4216a40dd8 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Mon, 14 Nov 2022 22:42:29 +0100 Subject: [PATCH 14/20] style(snippet): style the code preview on snippets list --- .../components/snippets/public-snippet.tsx | 15 +++-- apps/web/src/containers/private/browse.tsx | 2 +- apps/web/src/styles/code-snippet.css | 56 +++++++++++++++++++ apps/web/src/styles/globals.css | 1 + 4 files changed, 65 insertions(+), 9 deletions(-) create mode 100644 apps/web/src/styles/code-snippet.css diff --git a/apps/web/src/components/snippets/public-snippet.tsx b/apps/web/src/components/snippets/public-snippet.tsx index 12239497..0fbfefbb 100644 --- a/apps/web/src/components/snippets/public-snippet.tsx +++ b/apps/web/src/components/snippets/public-snippet.tsx @@ -10,7 +10,7 @@ export const PublicSnippet = ({ snippet }: Props) => { const htmlCode = snippet.content; return ( -
+
@@ -43,13 +43,12 @@ export const PublicSnippet = ({ snippet }: Props) => {
{snippet.description}
-
-

-      
+
); }; diff --git a/apps/web/src/containers/private/browse.tsx b/apps/web/src/containers/private/browse.tsx index 912c77d9..6918ad72 100644 --- a/apps/web/src/containers/private/browse.tsx +++ b/apps/web/src/containers/private/browse.tsx @@ -25,7 +25,7 @@ const Browse = ({ data }: Props) => {
-
+
{snippets.map((snippet) => ( ))} diff --git a/apps/web/src/styles/code-snippet.css b/apps/web/src/styles/code-snippet.css new file mode 100644 index 00000000..873ee372 --- /dev/null +++ b/apps/web/src/styles/code-snippet.css @@ -0,0 +1,56 @@ +.code-snippet-view { + border-radius: 0 0 3px 3px; + overflow-x: auto; + padding-top: 5px; + padding-bottom: 5px; + position: relative; + font-size: 14px; +} +.code-snippet-preview { + max-height: 232px; + overflow: hidden !important; +} +.code-snippet-view { + counter-reset: line; +} +.code-snippet-view pre { + padding-top: 10px; + padding-bottom: 10px; + padding-left: 50px !important; + white-space: pre !important; + border-radius: 0.375rem; +} +.code-snippet-view code { + font-family: 'Inter', monospace !important; + font-size: 14px; +} +.code-snippet-view code .line { + padding-right: 10px; +} +.code-snippet-view .line-number { + position: absolute; + left: 0; + color: #cccccc; + text-align: right; + width: 30px; + font-size: 12px; + height: 18px; + overflow: hidden; + padding-top: 2px; +} +.code-snippet-view code .line-diff { + width: 100vw; + display: inline-block; +} +.code-snippet-view code .line-diff-delete { + background-color: rgba(229,83,75,0.15); +} +.code-snippet-view code .line-diff-add { + background-color: rgba(87,171,90,0.3); +} +.code-snippet-view code .line-diff-current { + background-color: #475569; +} +.code-snippet-view code .line-diff-blur { + filter: blur(4px); +} diff --git a/apps/web/src/styles/globals.css b/apps/web/src/styles/globals.css index cebf7e3b..5910a471 100644 --- a/apps/web/src/styles/globals.css +++ b/apps/web/src/styles/globals.css @@ -2,3 +2,4 @@ @import "base.css"; @import "loader.css"; @import "code-editor.css"; +@import "code-snippet.css"; From c77108493906a17e86ec849d59332c440d5f65b8 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 20 Nov 2022 22:25:41 +0100 Subject: [PATCH 15/20] style(snippet): complete the ui to browse public snippet --- .../queries/resolvers/short-content.ts | 10 ---- .../components/snippets/public-snippet.tsx | 8 ---- apps/web/src/containers/private/browse.tsx | 48 ++++++++++++++++--- packages/front/src/icons/index.tsx | 6 +++ 4 files changed, 48 insertions(+), 24 deletions(-) delete mode 100644 apps/core/src/resources/snippets/queries/resolvers/short-content.ts diff --git a/apps/core/src/resources/snippets/queries/resolvers/short-content.ts b/apps/core/src/resources/snippets/queries/resolvers/short-content.ts deleted file mode 100644 index 10cf5a7f..00000000 --- a/apps/core/src/resources/snippets/queries/resolvers/short-content.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Snippet } from '../../../../types/graphql'; - -const MAX_CONTENT_LINES = 10; - -export const shortContentResolver = async (snippet: Snippet): Promise => { - const contentAsArray = snippet.content.split('\n'); - const maxItem = Math.min(MAX_CONTENT_LINES, contentAsArray.length); - - return contentAsArray.slice(0, maxItem).join('\n'); -}; diff --git a/apps/web/src/components/snippets/public-snippet.tsx b/apps/web/src/components/snippets/public-snippet.tsx index 0fbfefbb..c0d101f8 100644 --- a/apps/web/src/components/snippets/public-snippet.tsx +++ b/apps/web/src/components/snippets/public-snippet.tsx @@ -33,14 +33,6 @@ export const PublicSnippet = ({ snippet }: Props) => {
{snippet.createdAt}
-
- -
{snippet.description}
{ + const [sortOption, setSortOption] = useState(sortOptions[0]); + const [search, setSearch] = useState(); + console.log(data); const snippets = data.items; @@ -17,19 +28,44 @@ const Browse = ({ data }: Props) => {
-
-
-

Browse

-
-
+
+
+ +
+ +
+
+ +
{snippets.map((snippet) => ( ))}
+
+ + +
diff --git a/packages/front/src/icons/index.tsx b/packages/front/src/icons/index.tsx index 383a7df4..7b5e902c 100644 --- a/packages/front/src/icons/index.tsx +++ b/packages/front/src/icons/index.tsx @@ -1,6 +1,8 @@ import { CalendarIcon, ChartBarIcon, + ChevronDoubleLeftIcon, + ChevronDoubleRightIcon, ChevronDownIcon, DocumentAddIcon, FolderAddIcon, @@ -8,6 +10,7 @@ import { HomeIcon, InboxIcon, MenuIcon, + SearchIcon, UsersIcon, XIcon, } from '@heroicons/react/outline'; @@ -32,6 +35,8 @@ export default { Calendar: CalendarIcon, ChartBart: ChartBarIcon, Check: CheckIcon, + ChevronDoubleLeftIcon, + ChevronDoubleRightIcon, ChevronDown: ChevronDownIcon, Collection: CollectionIcon, Cross: CrossIcon, @@ -49,6 +54,7 @@ export default { Logo: LogoIcon, LogoLight: LogoLightIcon, Menu: MenuIcon, + OutlineSearch: SearchIcon, ProductHunt: ProductHuntIcon, Share: ShareIcon, Spinner: SpinnerIcon, From d76d74a5ddd8d2d4e8acb3d98e9ab86690308e22 Mon Sep 17 00:00:00 2001 From: Eric Cabrel TIOGO Date: Sun, 20 Nov 2022 23:39:24 +0100 Subject: [PATCH 16/20] chore(web): replace default exports with named exports --- apps/web/__tests__/ui/newsletter.test.tsx | 8 +-- apps/web/src/components/auth/auth-alert.tsx | 2 +- .../src/components/home/feature-section.tsx | 23 +++++--- apps/web/src/components/home/hero-section.tsx | 2 +- .../home/newsletter/newsletter-alert.tsx | 8 +-- .../home/newsletter/newsletter-form.tsx | 11 ++-- .../home/newsletter/newsletter-section.tsx | 4 +- apps/web/src/components/layout/main.tsx | 2 +- .../src/components/layout/private/header.tsx | 17 ++++-- .../src/components/layout/private/layout.tsx | 8 +-- .../src/components/layout/public/footer.tsx | 12 ++-- .../src/components/layout/public/header.tsx | 6 +- .../layout/public/public-layout.tsx | 6 +- apps/web/src/components/seo/seo.tsx | 2 +- .../components/snippets/public-snippet.tsx | 8 ++- apps/web/src/containers/auth/login.tsx | 26 +++++---- apps/web/src/containers/auth/signup.tsx | 30 +++++----- apps/web/src/containers/home/index.tsx | 8 +-- apps/web/src/containers/page-not-found.tsx | 14 ++--- apps/web/src/containers/private/browse.tsx | 18 +++--- .../src/containers/private/folders/view.tsx | 13 +++-- apps/web/src/containers/private/home.tsx | 15 ++--- apps/web/src/containers/private/profile.tsx | 4 +- .../src/containers/private/snippets/view.tsx | 13 +++-- apps/web/src/hooks/authentication/use-auth.ts | 2 +- .../use-set-authenticated-user.ts | 2 +- apps/web/src/hooks/use-boolean-state.ts | 2 +- apps/web/src/hooks/use-custom-ref.ts | 5 -- apps/web/src/hooks/use-folder-directory.ts | 2 +- apps/web/src/pages/_app.tsx | 2 +- apps/web/src/pages/app/browse.tsx | 12 ++-- apps/web/src/pages/app/folders/[id].tsx | 2 +- apps/web/src/pages/app/home.tsx | 2 +- apps/web/src/pages/app/profile.tsx | 2 +- apps/web/src/pages/app/snippets/[id].tsx | 2 +- apps/web/src/pages/auth/fail.tsx | 4 +- apps/web/src/pages/auth/signup-success.tsx | 4 +- apps/web/src/pages/auth/success.tsx | 6 +- apps/web/src/pages/signin.tsx | 2 +- packages/front/.gitignore | 2 +- packages/front/{src => }/components/alert.tsx | 2 +- .../components/dialog/confirm-dialog.tsx | 2 +- .../components/directory/breadcrumb.tsx | 2 +- .../components/directory/folders/empty.tsx | 4 +- .../components/directory/folders/folder.tsx | 2 +- .../directory/folders/form/edit-folder.tsx | 4 +- .../{src => }/components/directory/index.tsx | 14 ++--- .../snippets/form/create-snippet.tsx | 4 +- .../snippets/form/editor/hooks/use-editor.ts | 0 .../form/editor/hooks/use-form-editor.ts | 0 .../directory/snippets/form/editor/index.tsx | 6 +- .../directory/snippets/form/form-schema.ts | 0 .../directory/snippets/form/utils.ts | 0 .../directory/snippets/form/view-snippet.tsx | 2 +- .../components/directory/snippets/snippet.tsx | 2 +- .../components/link/external-link.tsx | 0 .../front/{src => }/components/link/index.tsx | 2 +- .../{src => }/components/menu-action.tsx | 2 +- .../{src => }/components/menus/dot-menu.tsx | 0 .../{src => }/components/toast/provider.tsx | 0 .../{src => }/components/toast/toast.tsx | 3 +- .../front/{src => }/components/toast/types.ts | 0 .../components/toast/use-toast-manager.ts | 0 .../{src => }/components/user-avatar.tsx | 2 +- packages/front/{src => }/forms/button.tsx | 2 +- .../front/{src => }/forms/select-input.tsx | 2 +- .../front/{src => }/forms/switch-input.tsx | 2 +- packages/front/{src => }/forms/text-input.tsx | 2 +- .../folders/mutations/create-folder.ts | 0 .../folders/mutations/delete-folders.ts | 0 .../folders/mutations/update-folder.ts | 0 .../graphql/folders/queries/find-folder.ts | 0 .../graphql/folders/queries/list-directory.ts | 0 packages/front/{src => }/graphql/generated.ts | 0 packages/front/{src => }/graphql/index.ts | 0 .../mutations/subscribe-newsletter.ts | 0 .../snippets/mutations/create-snippet.ts | 0 .../snippets/mutations/delete-snippet.ts | 0 .../snippets/mutations/update-snippet.ts | 0 .../graphql/snippets/queries/find-snippet.ts | 0 .../snippets/queries/public-snippets.ts | 0 .../graphql/users/mutations/login-user.ts | 0 .../graphql/users/mutations/logout-user.ts | 0 .../graphql/users/mutations/signup-user.ts | 0 .../users/queries/authenticated-user.ts | 0 packages/front/{src => }/hooks/index.ts | 0 .../{src => }/hooks/use-boolean-state.ts | 0 .../{src => }/hooks/use-code-highlighter.ts | 0 .../{src => }/hooks/use-copy-to-clipboard.ts | 0 packages/front/{src => }/hooks/use-hover.ts | 0 packages/front/{src => }/icons/check.tsx | 0 packages/front/{src => }/icons/collection.tsx | 0 packages/front/{src => }/icons/cross.tsx | 0 .../front/{src => }/icons/document-search.tsx | 0 packages/front/{src => }/icons/embed.tsx | 0 packages/front/{src => }/icons/extension.tsx | 0 packages/front/{src => }/icons/github.tsx | 0 packages/front/{src => }/icons/google.tsx | 0 packages/front/{src => }/icons/import.tsx | 0 packages/front/{src => }/icons/index.tsx | 56 +++++++++---------- packages/front/{src => }/icons/logo-light.tsx | 0 packages/front/{src => }/icons/logo.tsx | 0 .../front/{src => }/icons/product-hunt.tsx | 0 packages/front/{src => }/icons/share.tsx | 0 packages/front/{src => }/icons/spinner.tsx | 0 packages/front/{src => }/icons/twitter.tsx | 0 packages/front/index.tsx | 37 ------------ packages/front/package.json | 2 +- .../services/folders/create-folder.ts | 0 .../services/folders/delete-folders.ts | 0 .../{src => }/services/folders/find-folder.ts | 0 .../services/folders/list-directory.ts | 0 .../services/folders/update-folder.ts | 0 packages/front/{src => }/services/index.ts | 0 .../newsletters/subscribe-to-newsletter.ts | 0 .../services/snippets/create-snippet.ts | 0 .../services/snippets/delete-snippet.ts | 0 .../services/snippets/find-snippet.ts | 0 .../services/snippets/public-snippets.ts | 0 .../services/snippets/update-snippet.ts | 0 .../services/users/authenticated-user.ts | 0 .../{src => }/services/users/login-user.ts | 0 .../{src => }/services/users/logout-user.ts | 0 .../{src => }/services/users/signup-user.ts | 0 packages/front/tsconfig.json | 12 +++- .../front/{src => }/typings/components.ts | 0 packages/front/{src => }/typings/queries.ts | 0 .../front/{src => }/typings/snippet-form.ts | 0 packages/front/{src => }/utils/classnames.ts | 0 packages/front/{src => }/utils/constants.ts | 0 packages/front/{src => }/utils/forms.ts | 0 packages/front/{src => }/utils/snippets.ts | 0 packages/front/{src => }/utils/text.ts | 0 133 files changed, 239 insertions(+), 242 deletions(-) delete mode 100644 apps/web/src/hooks/use-custom-ref.ts rename packages/front/{src => }/components/alert.tsx (97%) rename packages/front/{src => }/components/dialog/confirm-dialog.tsx (98%) rename packages/front/{src => }/components/directory/breadcrumb.tsx (98%) rename packages/front/{src => }/components/directory/folders/empty.tsx (95%) rename packages/front/{src => }/components/directory/folders/folder.tsx (98%) rename packages/front/{src => }/components/directory/folders/form/edit-folder.tsx (98%) rename packages/front/{src => }/components/directory/index.tsx (95%) rename packages/front/{src => }/components/directory/snippets/form/create-snippet.tsx (98%) rename packages/front/{src => }/components/directory/snippets/form/editor/hooks/use-editor.ts (100%) rename packages/front/{src => }/components/directory/snippets/form/editor/hooks/use-form-editor.ts (100%) rename packages/front/{src => }/components/directory/snippets/form/editor/index.tsx (94%) rename packages/front/{src => }/components/directory/snippets/form/form-schema.ts (100%) rename packages/front/{src => }/components/directory/snippets/form/utils.ts (100%) rename packages/front/{src => }/components/directory/snippets/form/view-snippet.tsx (98%) rename packages/front/{src => }/components/directory/snippets/snippet.tsx (99%) rename packages/front/{src => }/components/link/external-link.tsx (100%) rename packages/front/{src => }/components/link/index.tsx (95%) rename packages/front/{src => }/components/menu-action.tsx (98%) rename packages/front/{src => }/components/menus/dot-menu.tsx (100%) rename packages/front/{src => }/components/toast/provider.tsx (100%) rename packages/front/{src => }/components/toast/toast.tsx (98%) rename packages/front/{src => }/components/toast/types.ts (100%) rename packages/front/{src => }/components/toast/use-toast-manager.ts (100%) rename packages/front/{src => }/components/user-avatar.tsx (97%) rename packages/front/{src => }/forms/button.tsx (98%) rename packages/front/{src => }/forms/select-input.tsx (99%) rename packages/front/{src => }/forms/switch-input.tsx (98%) rename packages/front/{src => }/forms/text-input.tsx (98%) rename packages/front/{src => }/graphql/folders/mutations/create-folder.ts (100%) rename packages/front/{src => }/graphql/folders/mutations/delete-folders.ts (100%) rename packages/front/{src => }/graphql/folders/mutations/update-folder.ts (100%) rename packages/front/{src => }/graphql/folders/queries/find-folder.ts (100%) rename packages/front/{src => }/graphql/folders/queries/list-directory.ts (100%) rename packages/front/{src => }/graphql/generated.ts (100%) rename packages/front/{src => }/graphql/index.ts (100%) rename packages/front/{src => }/graphql/newsletters/mutations/subscribe-newsletter.ts (100%) rename packages/front/{src => }/graphql/snippets/mutations/create-snippet.ts (100%) rename packages/front/{src => }/graphql/snippets/mutations/delete-snippet.ts (100%) rename packages/front/{src => }/graphql/snippets/mutations/update-snippet.ts (100%) rename packages/front/{src => }/graphql/snippets/queries/find-snippet.ts (100%) rename packages/front/{src => }/graphql/snippets/queries/public-snippets.ts (100%) rename packages/front/{src => }/graphql/users/mutations/login-user.ts (100%) rename packages/front/{src => }/graphql/users/mutations/logout-user.ts (100%) rename packages/front/{src => }/graphql/users/mutations/signup-user.ts (100%) rename packages/front/{src => }/graphql/users/queries/authenticated-user.ts (100%) rename packages/front/{src => }/hooks/index.ts (100%) rename packages/front/{src => }/hooks/use-boolean-state.ts (100%) rename packages/front/{src => }/hooks/use-code-highlighter.ts (100%) rename packages/front/{src => }/hooks/use-copy-to-clipboard.ts (100%) rename packages/front/{src => }/hooks/use-hover.ts (100%) rename packages/front/{src => }/icons/check.tsx (100%) rename packages/front/{src => }/icons/collection.tsx (100%) rename packages/front/{src => }/icons/cross.tsx (100%) rename packages/front/{src => }/icons/document-search.tsx (100%) rename packages/front/{src => }/icons/embed.tsx (100%) rename packages/front/{src => }/icons/extension.tsx (100%) rename packages/front/{src => }/icons/github.tsx (100%) rename packages/front/{src => }/icons/google.tsx (100%) rename packages/front/{src => }/icons/import.tsx (100%) rename packages/front/{src => }/icons/index.tsx (57%) rename packages/front/{src => }/icons/logo-light.tsx (100%) rename packages/front/{src => }/icons/logo.tsx (100%) rename packages/front/{src => }/icons/product-hunt.tsx (100%) rename packages/front/{src => }/icons/share.tsx (100%) rename packages/front/{src => }/icons/spinner.tsx (100%) rename packages/front/{src => }/icons/twitter.tsx (100%) rename packages/front/{src => }/services/folders/create-folder.ts (100%) rename packages/front/{src => }/services/folders/delete-folders.ts (100%) rename packages/front/{src => }/services/folders/find-folder.ts (100%) rename packages/front/{src => }/services/folders/list-directory.ts (100%) rename packages/front/{src => }/services/folders/update-folder.ts (100%) rename packages/front/{src => }/services/index.ts (100%) rename packages/front/{src => }/services/newsletters/subscribe-to-newsletter.ts (100%) rename packages/front/{src => }/services/snippets/create-snippet.ts (100%) rename packages/front/{src => }/services/snippets/delete-snippet.ts (100%) rename packages/front/{src => }/services/snippets/find-snippet.ts (100%) rename packages/front/{src => }/services/snippets/public-snippets.ts (100%) rename packages/front/{src => }/services/snippets/update-snippet.ts (100%) rename packages/front/{src => }/services/users/authenticated-user.ts (100%) rename packages/front/{src => }/services/users/login-user.ts (100%) rename packages/front/{src => }/services/users/logout-user.ts (100%) rename packages/front/{src => }/services/users/signup-user.ts (100%) rename packages/front/{src => }/typings/components.ts (100%) rename packages/front/{src => }/typings/queries.ts (100%) rename packages/front/{src => }/typings/snippet-form.ts (100%) rename packages/front/{src => }/utils/classnames.ts (100%) rename packages/front/{src => }/utils/constants.ts (100%) rename packages/front/{src => }/utils/forms.ts (100%) rename packages/front/{src => }/utils/snippets.ts (100%) rename packages/front/{src => }/utils/text.ts (100%) diff --git a/apps/web/__tests__/ui/newsletter.test.tsx b/apps/web/__tests__/ui/newsletter.test.tsx index 758fd8cc..45049c04 100644 --- a/apps/web/__tests__/ui/newsletter.test.tsx +++ b/apps/web/__tests__/ui/newsletter.test.tsx @@ -1,11 +1,11 @@ import { MockedProvider } from '@apollo/client/testing'; -import { subscribeNewsletterMutation } from '@sharingan/front'; +import { subscribeNewsletterMutation } from '@sharingan/front/graphql'; import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import React from 'react'; import { act } from 'react-dom/test-utils'; -import NewsletterForm from '@/components/home/newsletter/newsletter-form'; +import { NewsletterForm } from '@/components/home/newsletter/newsletter-form'; describe('Newsletter Form', () => { beforeEach(() => { @@ -38,7 +38,7 @@ describe('Newsletter Form', () => { ]; render( - + , ); @@ -81,7 +81,7 @@ describe('Newsletter Form', () => { ]; render( - + , ); diff --git a/apps/web/src/components/auth/auth-alert.tsx b/apps/web/src/components/auth/auth-alert.tsx index 73e55513..720b8529 100644 --- a/apps/web/src/components/auth/auth-alert.tsx +++ b/apps/web/src/components/auth/auth-alert.tsx @@ -32,4 +32,4 @@ const AuthAlert = ({ ctaLabel, descriptionElement, redirectLink, title }: Props) ); }; -export default AuthAlert; +export { AuthAlert }; diff --git a/apps/web/src/components/home/feature-section.tsx b/apps/web/src/components/home/feature-section.tsx index 61707f2a..d4e2b079 100644 --- a/apps/web/src/components/home/feature-section.tsx +++ b/apps/web/src/components/home/feature-section.tsx @@ -1,39 +1,46 @@ -import { Icon } from '@sharingan/front'; +import { + CollectionIcon, + DocumentSearchIcon, + EmbedIcon, + ExtensionIcon, + ImportIcon, + ShareIcon, +} from '@sharingan/front/icons'; const features = [ { description: 'Organize related code snippets into folders the same way you manage your file on the computer.', - icon: , + icon: , id: 'organize-snippets', title: 'Organize your snippets', }, { description: 'Quickly find a code snippet in your whole directory and access it.', - icon: , + icon: , id: 'find-snippets', title: 'Find your snippets', }, { description: 'You can easily import all your code snippets from GitHub Gist to keep them all in one place.', - icon: , + icon: , id: 'import-snippets', title: 'Import from GitHub Gist', }, { description: 'Share your code snippets with other developers. Give them the ability to interact and improve.', - icon: , + icon: , id: 'share-snippets', title: 'Share your snippets', }, { description: 'For content creators, you can embed your snippet on a blog post or a post on social networks.', - icon: , + icon: , id: 'embed-snippets', title: 'Embed your snippets', }, { description: 'Easily capture and save code snippets while you are browsing on the web.', - icon: , + icon: , id: 'browser-extensions', title: 'Browser extensions', }, @@ -66,4 +73,4 @@ const FeatureSection = () => { ); }; -export default FeatureSection; +export { FeatureSection }; diff --git a/apps/web/src/components/home/hero-section.tsx b/apps/web/src/components/home/hero-section.tsx index 0bad2cd7..7c480e44 100644 --- a/apps/web/src/components/home/hero-section.tsx +++ b/apps/web/src/components/home/hero-section.tsx @@ -59,4 +59,4 @@ const HeroSection = () => { ); }; -export default HeroSection; +export { HeroSection }; diff --git a/apps/web/src/components/home/newsletter/newsletter-alert.tsx b/apps/web/src/components/home/newsletter/newsletter-alert.tsx index 03d8d549..9486efc7 100644 --- a/apps/web/src/components/home/newsletter/newsletter-alert.tsx +++ b/apps/web/src/components/home/newsletter/newsletter-alert.tsx @@ -1,5 +1,5 @@ import { Dialog, Transition } from '@headlessui/react'; -import { Icon } from '@sharingan/front'; +import { CheckIcon, CrossIcon } from '@sharingan/front/icons'; import classNames from 'classnames'; import React, { Fragment, useState } from 'react'; @@ -17,7 +17,7 @@ type Content = { const alertContentMap: Record = { failure: { description: An error occurred while performing the subscription, - icon: , + icon: , title: 'Subscription failure', }, success: { @@ -28,7 +28,7 @@ const alertContentMap: Record = { You will receive updates on the application progress. ), - icon: , + icon: , title: 'Subscription successful', }, }; @@ -102,4 +102,4 @@ const NewsletterAlert = ({ handleClose, state = 'failure' }: Props) => { ); }; -export default NewsletterAlert; +export { NewsletterAlert }; diff --git a/apps/web/src/components/home/newsletter/newsletter-form.tsx b/apps/web/src/components/home/newsletter/newsletter-form.tsx index edbeeb52..f1bcc137 100644 --- a/apps/web/src/components/home/newsletter/newsletter-form.tsx +++ b/apps/web/src/components/home/newsletter/newsletter-form.tsx @@ -1,8 +1,9 @@ -import { Icon, useSubscribeToNewsletter } from '@sharingan/front'; +import { SpinnerIcon } from '@sharingan/front/icons'; +import { useSubscribeToNewsletter } from '@sharingan/front/services'; import { useState } from 'react'; -import NewsletterAlert from '@/components/home/newsletter/newsletter-alert'; -import useBooleanState from '@/hooks/use-boolean-state'; +import { NewsletterAlert } from '@/components/home/newsletter/newsletter-alert'; +import { useBooleanState } from '@/hooks/use-boolean-state'; import { REGEX_EMAIL } from '@/utils/constants'; const isEmailValid = (email: string) => REGEX_EMAIL.test(email); @@ -54,7 +55,7 @@ const NewsletterForm = () => { className="inline-flex items-center justify-center w-full px-8 py-4 text-base font-bold text-white transition-all duration-200 bg-gray-900 border border-transparent sm:w-auto sm:py-3 hover:bg-opacity-90 rounded-xl" onClick={handleSubscribe} > - {isLoading && } + {isLoading && } Get updates
@@ -62,4 +63,4 @@ const NewsletterForm = () => { ); }; -export default NewsletterForm; +export { NewsletterForm }; diff --git a/apps/web/src/components/home/newsletter/newsletter-section.tsx b/apps/web/src/components/home/newsletter/newsletter-section.tsx index ce7c7ff1..40bcc635 100644 --- a/apps/web/src/components/home/newsletter/newsletter-section.tsx +++ b/apps/web/src/components/home/newsletter/newsletter-section.tsx @@ -1,4 +1,4 @@ -import NewsletterForm from '@/components/home/newsletter/newsletter-form'; +import { NewsletterForm } from '@/components/home/newsletter/newsletter-form'; const NewsletterSection = () => { return ( @@ -32,4 +32,4 @@ const NewsletterSection = () => { ); }; -export default NewsletterSection; +export { NewsletterSection }; diff --git a/apps/web/src/components/layout/main.tsx b/apps/web/src/components/layout/main.tsx index e63cc667..e62ef8f0 100644 --- a/apps/web/src/components/layout/main.tsx +++ b/apps/web/src/components/layout/main.tsx @@ -19,4 +19,4 @@ const MainLayout = ({ children }: Props) => { ); }; -export default MainLayout; +export { MainLayout }; diff --git a/apps/web/src/components/layout/private/header.tsx b/apps/web/src/components/layout/private/header.tsx index c868fcad..581893ce 100644 --- a/apps/web/src/components/layout/private/header.tsx +++ b/apps/web/src/components/layout/private/header.tsx @@ -1,4 +1,9 @@ -import { Disclosure, Icon, Link, Menu, Transition, UserAvatar, classNames, useLogoutUser } from '@sharingan/front'; +import { Disclosure, Menu, Transition } from '@sharingan/front'; +import { Link } from '@sharingan/front/components/link'; +import { UserAvatar } from '@sharingan/front/components/user-avatar'; +import { LogoIcon, LogoLightIcon, MenuIcon, XIcon } from '@sharingan/front/icons'; +import { useLogoutUser } from '@sharingan/front/services'; +import { classNames } from '@sharingan/front/utils/classnames'; import { useRouter } from 'next/router'; import { Fragment } from 'react'; @@ -37,8 +42,8 @@ const Header = () => {
- - + +
{navigation.map((item) => ( @@ -98,9 +103,9 @@ const Header = () => { Open main menu {open ? ( -
@@ -157,4 +162,4 @@ const Header = () => { ); }; -export default Header; +export { Header }; diff --git a/apps/web/src/components/layout/private/layout.tsx b/apps/web/src/components/layout/private/layout.tsx index 562f0d4a..a616afa9 100644 --- a/apps/web/src/components/layout/private/layout.tsx +++ b/apps/web/src/components/layout/private/layout.tsx @@ -1,10 +1,10 @@ -import { useAuthenticatedUser } from '@sharingan/front'; -import { ToastProvider } from '@sharingan/front'; +import { ToastProvider } from '@sharingan/front/components/toast/provider'; +import { useAuthenticatedUser } from '@sharingan/front/services'; import { ReactNode } from 'react'; import { Loader } from '@/components/common/loader'; import { Redirect } from '@/components/common/redirect'; -import Header from '@/components/layout/private/header'; +import { Header } from '@/components/layout/private/header'; type Props = { children?: ReactNode; @@ -35,4 +35,4 @@ const Layout = ({ children }: Props) => { ); }; -export default Layout; +export { Layout }; diff --git a/apps/web/src/components/layout/public/footer.tsx b/apps/web/src/components/layout/public/footer.tsx index 646817d2..888e8ce6 100644 --- a/apps/web/src/components/layout/public/footer.tsx +++ b/apps/web/src/components/layout/public/footer.tsx @@ -1,20 +1,20 @@ -import { Icon } from '@sharingan/front'; +import { GithubIcon, LogoIcon, ProductHuntIcon, TwitterIcon } from '@sharingan/front/icons'; const socialIcons = [ { - icon: , + icon: , link: 'https://github.com/tericcabrel/sharingan', name: 'GitHub', target: '_blank', }, { - icon: , + icon: , link: 'https://twitter.com/sharingan_dev', name: 'Twitter', target: '_blank', }, { - icon: , + icon: , link: '#', name: 'Product Hunt', target: '_self', @@ -42,7 +42,7 @@ const PublicFooter = () => {
- +
    @@ -87,4 +87,4 @@ const PublicFooter = () => { ); }; -export default PublicFooter; +export { PublicFooter }; diff --git a/apps/web/src/components/layout/public/header.tsx b/apps/web/src/components/layout/public/header.tsx index 387ac02a..69c822f3 100644 --- a/apps/web/src/components/layout/public/header.tsx +++ b/apps/web/src/components/layout/public/header.tsx @@ -1,4 +1,4 @@ -import { Icon } from '@sharingan/front'; +import { LogoIcon } from '@sharingan/front/icons'; import Link from 'next/link'; import { MouseEvent, useState } from 'react'; @@ -38,7 +38,7 @@ const PublicHeader = () => {
    @@ -186,4 +186,4 @@ const PublicHeader = () => { ); }; -export default PublicHeader; +export { PublicHeader }; diff --git a/apps/web/src/components/layout/public/public-layout.tsx b/apps/web/src/components/layout/public/public-layout.tsx index 5b2d7d5a..9f272d44 100644 --- a/apps/web/src/components/layout/public/public-layout.tsx +++ b/apps/web/src/components/layout/public/public-layout.tsx @@ -1,7 +1,7 @@ import { ReactNode } from 'react'; -import PublicFooter from '@/components/layout/public/footer'; -import PublicHeader from '@/components/layout/public/header'; +import { PublicFooter } from '@/components/layout/public/footer'; +import { PublicHeader } from '@/components/layout/public/header'; type Props = { children: ReactNode; @@ -17,4 +17,4 @@ const PublicLayout = ({ children }: Props) => { ); }; -export default PublicLayout; +export { PublicLayout }; diff --git a/apps/web/src/components/seo/seo.tsx b/apps/web/src/components/seo/seo.tsx index 63bf4636..ed4f53af 100644 --- a/apps/web/src/components/seo/seo.tsx +++ b/apps/web/src/components/seo/seo.tsx @@ -45,4 +45,4 @@ const GlobalSeo = () => { ); }; -export default GlobalSeo; +export { GlobalSeo }; diff --git a/apps/web/src/components/snippets/public-snippet.tsx b/apps/web/src/components/snippets/public-snippet.tsx index c0d101f8..421d5fff 100644 --- a/apps/web/src/components/snippets/public-snippet.tsx +++ b/apps/web/src/components/snippets/public-snippet.tsx @@ -1,10 +1,12 @@ -import { Link, PublicSnippetResult, UserAvatar } from '@sharingan/front'; +import { Link } from '@sharingan/front/components/link'; +import { UserAvatar } from '@sharingan/front/components/user-avatar'; +import { PublicSnippetResult } from '@sharingan/front/typings/queries'; type Props = { snippet: PublicSnippetResult['items'][number]; }; -export const PublicSnippet = ({ snippet }: Props) => { +const PublicSnippet = ({ snippet }: Props) => { const { user } = snippet; const htmlCode = snippet.content; @@ -44,3 +46,5 @@ export const PublicSnippet = ({ snippet }: Props) => {
    ); }; + +export { PublicSnippet }; diff --git a/apps/web/src/containers/auth/login.tsx b/apps/web/src/containers/auth/login.tsx index 22b7a8a7..33562bfe 100644 --- a/apps/web/src/containers/auth/login.tsx +++ b/apps/web/src/containers/auth/login.tsx @@ -1,12 +1,16 @@ import { yupResolver } from '@hookform/resolvers/yup'; -import { Alert, Button, Icon, TextInput, useLoginUser } from '@sharingan/front'; +import { Alert } from '@sharingan/front/components/alert'; +import { Button } from '@sharingan/front/forms/button'; +import { TextInput } from '@sharingan/front/forms/text-input'; +import { GithubIcon, GoogleIcon } from '@sharingan/front/icons'; +import { useLoginUser } from '@sharingan/front/services'; import { NextSeo } from 'next-seo'; import Link from 'next/link'; import { useState } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; import * as yup from 'yup'; -import PublicLayout from '@/components/layout/public/public-layout'; +import { PublicLayout } from '@/components/layout/public/public-layout'; import { useAuth } from '@/hooks/authentication/use-auth'; import { FORM_ERRORS } from '@/utils/constants'; @@ -66,13 +70,13 @@ const Login = () => {

    Sign in for Sharingan

    - -
    @@ -81,14 +85,14 @@ const Login = () => {
-
+ {loginError && } - + - + - @@ -97,7 +101,7 @@ const Login = () => {

Don't have an account?{' '} - + Create an account now diff --git a/apps/web/src/containers/auth/signup.tsx b/apps/web/src/containers/auth/signup.tsx index 44a9a1d4..aa4896d2 100644 --- a/apps/web/src/containers/auth/signup.tsx +++ b/apps/web/src/containers/auth/signup.tsx @@ -1,13 +1,17 @@ import { yupResolver } from '@hookform/resolvers/yup'; -import { Alert, Button, Icon, TextInput, useSignupUser } from '@sharingan/front'; +import { Alert } from '@sharingan/front/components/alert'; +import { Link } from '@sharingan/front/components/link'; +import { Button } from '@sharingan/front/forms/button'; +import { TextInput } from '@sharingan/front/forms/text-input'; +import { GithubIcon, GoogleIcon } from '@sharingan/front/icons'; +import { useSignupUser } from '@sharingan/front/services'; import { NextSeo } from 'next-seo'; -import Link from 'next/link'; import { useRouter } from 'next/router'; import { useState } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; import * as yup from 'yup'; -import PublicLayout from '@/components/layout/public/public-layout'; +import { PublicLayout } from '@/components/layout/public/public-layout'; import { FORM_ERRORS } from '@/utils/constants'; const MIN_PASSWORD_LENGTH = 8; @@ -79,13 +83,13 @@ const Signup = () => {

Sign up for Sharingan

- -
@@ -94,25 +98,25 @@ const Signup = () => {
-
+ {signupError && } - + - +
@@ -74,4 +76,4 @@ const Browse = ({ data }: Props) => { ); }; -export default Browse; +export { Browse }; diff --git a/apps/web/src/containers/private/folders/view.tsx b/apps/web/src/containers/private/folders/view.tsx index 5a58d0e4..5d85bc6d 100644 --- a/apps/web/src/containers/private/folders/view.tsx +++ b/apps/web/src/containers/private/folders/view.tsx @@ -1,8 +1,9 @@ -import { FolderDirectory, useAuthenticatedUser, useFindFolder, useLazyListDirectory } from '@sharingan/front'; +import { Directory } from '@sharingan/front/components/directory'; +import { useFindFolder } from '@sharingan/front/services'; import { NextSeo } from 'next-seo'; import { useRouter } from 'next/router'; -import Layout from '@/components/layout/private/layout'; +import { Layout } from '@/components/layout/private/layout'; import { useFolderDirectory } from '@/hooks/use-folder-directory'; const FolderView = () => { @@ -20,13 +21,13 @@ const FolderView = () => {
{isFolderFound && ( - )}
@@ -34,4 +35,4 @@ const FolderView = () => { ); }; -export default FolderView; +export { FolderView }; diff --git a/apps/web/src/containers/private/home.tsx b/apps/web/src/containers/private/home.tsx index 052a563a..0c62c4ca 100644 --- a/apps/web/src/containers/private/home.tsx +++ b/apps/web/src/containers/private/home.tsx @@ -1,10 +1,11 @@ -import { FolderDirectory, useAuthenticatedUser } from '@sharingan/front'; +import { Directory } from '@sharingan/front/components/directory'; +import { useAuthenticatedUser } from '@sharingan/front/services'; import { NextSeo } from 'next-seo'; -import Layout from '@/components/layout/private/layout'; +import { Layout } from '@/components/layout/private/layout'; import { useFolderDirectory } from '@/hooks/use-folder-directory'; -const Home = () => { +const PrivateHome = () => { const { data: user } = useAuthenticatedUser(); const { handleBreadcrumbClick, navigateToFolder, openSnippet, rootFolderId } = useFolderDirectory(); @@ -12,17 +13,17 @@ const Home = () => {
-
); }; -export default Home; +export { PrivateHome }; diff --git a/apps/web/src/containers/private/profile.tsx b/apps/web/src/containers/private/profile.tsx index 061cdbc9..ed26a17b 100644 --- a/apps/web/src/containers/private/profile.tsx +++ b/apps/web/src/containers/private/profile.tsx @@ -1,6 +1,6 @@ import { NextSeo } from 'next-seo'; -import Layout from '@/components/layout/private/layout'; +import { Layout } from '@/components/layout/private/layout'; const Profile = () => { return ( @@ -26,4 +26,4 @@ const Profile = () => { ); }; -export default Profile; +export { Profile }; diff --git a/apps/web/src/containers/private/snippets/view.tsx b/apps/web/src/containers/private/snippets/view.tsx index 4ec74c79..b4288853 100644 --- a/apps/web/src/containers/private/snippets/view.tsx +++ b/apps/web/src/containers/private/snippets/view.tsx @@ -1,9 +1,10 @@ -import { useFindSnippet } from '@sharingan/front'; -import { BreadCrumb, ViewSnippet } from '@sharingan/front'; +import { BreadCrumb } from '@sharingan/front/components/directory/breadcrumb'; +import { ViewSnippet } from '@sharingan/front/components/directory/snippets/form/view-snippet'; +import { useFindSnippet } from '@sharingan/front/services'; import { NextSeo } from 'next-seo'; import { useRouter } from 'next/router'; -import Layout from '@/components/layout/private/layout'; +import { Layout } from '@/components/layout/private/layout'; import { useFolderDirectory } from '@/hooks/use-folder-directory'; const SnippetView = () => { @@ -23,10 +24,10 @@ const SnippetView = () => { {isSnippetFound && (
@@ -38,4 +39,4 @@ const SnippetView = () => { ); }; -export default SnippetView; +export { SnippetView }; diff --git a/apps/web/src/hooks/authentication/use-auth.ts b/apps/web/src/hooks/authentication/use-auth.ts index b5932c45..085b5690 100644 --- a/apps/web/src/hooks/authentication/use-auth.ts +++ b/apps/web/src/hooks/authentication/use-auth.ts @@ -1,5 +1,5 @@ import { useApolloClient } from '@apollo/client'; -import { useAuthenticatedUser } from '@sharingan/front'; +import { useAuthenticatedUser } from '@sharingan/front/services'; import { addDayToDate } from '@sharingan/utils'; import { useRouter } from 'next/router'; import { useCookies } from 'react-cookie'; diff --git a/apps/web/src/hooks/authentication/use-set-authenticated-user.ts b/apps/web/src/hooks/authentication/use-set-authenticated-user.ts index d80118b4..bf879416 100644 --- a/apps/web/src/hooks/authentication/use-set-authenticated-user.ts +++ b/apps/web/src/hooks/authentication/use-set-authenticated-user.ts @@ -18,4 +18,4 @@ const useSetAuthenticatedUser = () => { }, [router.query]); }; -export default useSetAuthenticatedUser; +export { useSetAuthenticatedUser }; diff --git a/apps/web/src/hooks/use-boolean-state.ts b/apps/web/src/hooks/use-boolean-state.ts index 8a61d8a8..36eec17d 100644 --- a/apps/web/src/hooks/use-boolean-state.ts +++ b/apps/web/src/hooks/use-boolean-state.ts @@ -10,4 +10,4 @@ const useBooleanState = (initialState = false) => { return [boolean, setToTrue, setToFalse] as const; }; -export default useBooleanState; +export { useBooleanState }; diff --git a/apps/web/src/hooks/use-custom-ref.ts b/apps/web/src/hooks/use-custom-ref.ts deleted file mode 100644 index 89ecff49..00000000 --- a/apps/web/src/hooks/use-custom-ref.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { useRef } from 'react'; - -export const useCustomRef = (initialValue?: T) => { - return useRef(initialValue ?? null); -}; diff --git a/apps/web/src/hooks/use-folder-directory.ts b/apps/web/src/hooks/use-folder-directory.ts index 4f803004..e350f6eb 100644 --- a/apps/web/src/hooks/use-folder-directory.ts +++ b/apps/web/src/hooks/use-folder-directory.ts @@ -1,4 +1,4 @@ -import { useAuthenticatedUser, useLazyListDirectory } from '@sharingan/front'; +import { useAuthenticatedUser, useLazyListDirectory } from '@sharingan/front/services'; import { useRouter } from 'next/router'; export const useFolderDirectory = () => { diff --git a/apps/web/src/pages/_app.tsx b/apps/web/src/pages/_app.tsx index c6416e53..3129d15b 100644 --- a/apps/web/src/pages/_app.tsx +++ b/apps/web/src/pages/_app.tsx @@ -1,7 +1,7 @@ import { ApolloProvider } from '@apollo/client'; import type { AppProps } from 'next/app'; -import GlobalSeo from '@/components/seo/seo'; +import { GlobalSeo } from '@/components/seo/seo'; import { useApollo } from '@/utils/apollo-client'; import '@/styles/globals.css'; diff --git a/apps/web/src/pages/app/browse.tsx b/apps/web/src/pages/app/browse.tsx index 24bd3d40..eec44ff4 100644 --- a/apps/web/src/pages/app/browse.tsx +++ b/apps/web/src/pages/app/browse.tsx @@ -1,12 +1,10 @@ -import { - PublicSnippetResult, - SNIPPET_ITEM_PER_PAGE, - findPublicSnippetsQuery, - formatPublicSnippetsResult, -} from '@sharingan/front'; +import { findPublicSnippetsQuery } from '@sharingan/front/graphql'; +import { formatPublicSnippetsResult } from '@sharingan/front/services'; +import { PublicSnippetResult } from '@sharingan/front/typings/queries'; +import { SNIPPET_ITEM_PER_PAGE } from '@sharingan/front/utils/constants'; import type { GetServerSidePropsContext, NextPage } from 'next'; -import Browse from '@/containers/private/browse'; +import { Browse } from '@/containers/private/browse'; import { addApolloState, initializeApollo } from '@/utils/apollo-client'; type Props = { diff --git a/apps/web/src/pages/app/folders/[id].tsx b/apps/web/src/pages/app/folders/[id].tsx index ccd437f0..e609fcf5 100644 --- a/apps/web/src/pages/app/folders/[id].tsx +++ b/apps/web/src/pages/app/folders/[id].tsx @@ -1,6 +1,6 @@ import type { NextPage } from 'next'; -import FolderView from '@/containers/private/folders/view'; +import { FolderView } from '@/containers/private/folders/view'; const PrivateFolderViewPage: NextPage = () => { return ; diff --git a/apps/web/src/pages/app/home.tsx b/apps/web/src/pages/app/home.tsx index 4f717174..afe2eb9e 100644 --- a/apps/web/src/pages/app/home.tsx +++ b/apps/web/src/pages/app/home.tsx @@ -1,6 +1,6 @@ import type { NextPage } from 'next'; -import PrivateHome from '@/containers/private/home'; +import { PrivateHome } from '@/containers/private/home'; const PrivateHomePage: NextPage = () => { return ; diff --git a/apps/web/src/pages/app/profile.tsx b/apps/web/src/pages/app/profile.tsx index 64453d84..78ae973b 100644 --- a/apps/web/src/pages/app/profile.tsx +++ b/apps/web/src/pages/app/profile.tsx @@ -1,6 +1,6 @@ import type { NextPage } from 'next'; -import Profile from '@/containers/private/profile'; +import { Profile } from '@/containers/private/profile'; const ProfilePage: NextPage = () => { return ; diff --git a/apps/web/src/pages/app/snippets/[id].tsx b/apps/web/src/pages/app/snippets/[id].tsx index bbed6460..5f793588 100644 --- a/apps/web/src/pages/app/snippets/[id].tsx +++ b/apps/web/src/pages/app/snippets/[id].tsx @@ -1,6 +1,6 @@ import type { NextPage } from 'next'; -import SnippetView from '@/containers/private/snippets/view'; +import { SnippetView } from '@/containers/private/snippets/view'; const PrivateSnippetViewPage: NextPage = () => { return ; diff --git a/apps/web/src/pages/auth/fail.tsx b/apps/web/src/pages/auth/fail.tsx index 1ea74aa6..bf408a6a 100644 --- a/apps/web/src/pages/auth/fail.tsx +++ b/apps/web/src/pages/auth/fail.tsx @@ -1,8 +1,8 @@ import type { NextPage } from 'next'; import { NextSeo } from 'next-seo'; -import AuthAlert from '@/components/auth/auth-alert'; -import PublicLayout from '@/components/layout/public/public-layout'; +import { AuthAlert } from '@/components/auth/auth-alert'; +import { PublicLayout } from '@/components/layout/public/public-layout'; const AuthErrorPage: NextPage = () => { return ( diff --git a/apps/web/src/pages/auth/signup-success.tsx b/apps/web/src/pages/auth/signup-success.tsx index 665f2c22..ed346d53 100644 --- a/apps/web/src/pages/auth/signup-success.tsx +++ b/apps/web/src/pages/auth/signup-success.tsx @@ -1,8 +1,8 @@ import type { NextPage } from 'next'; import { NextSeo } from 'next-seo'; -import AuthAlert from '@/components/auth/auth-alert'; -import PublicLayout from '@/components/layout/public/public-layout'; +import { AuthAlert } from '@/components/auth/auth-alert'; +import { PublicLayout } from '@/components/layout/public/public-layout'; const SignupSuccessPage: NextPage = () => { return ( diff --git a/apps/web/src/pages/auth/success.tsx b/apps/web/src/pages/auth/success.tsx index d08c040d..e59d40cf 100644 --- a/apps/web/src/pages/auth/success.tsx +++ b/apps/web/src/pages/auth/success.tsx @@ -1,9 +1,9 @@ import type { NextPage } from 'next'; import { NextSeo } from 'next-seo'; -import AuthAlert from '@/components/auth/auth-alert'; -import PublicLayout from '@/components/layout/public/public-layout'; -import useSetAuthenticatedUser from '@/hooks/authentication/use-set-authenticated-user'; +import { AuthAlert } from '@/components/auth/auth-alert'; +import { PublicLayout } from '@/components/layout/public/public-layout'; +import { useSetAuthenticatedUser } from '@/hooks/authentication/use-set-authenticated-user'; const AuthSuccessPage: NextPage = () => { useSetAuthenticatedUser(); diff --git a/apps/web/src/pages/signin.tsx b/apps/web/src/pages/signin.tsx index 8094dc57..4de1379f 100644 --- a/apps/web/src/pages/signin.tsx +++ b/apps/web/src/pages/signin.tsx @@ -1,4 +1,4 @@ -import { authenticatedUserQuery } from '@sharingan/front'; +import { authenticatedUserQuery } from '@sharingan/front/graphql'; import { GetServerSidePropsContext } from 'next'; import type { NextPage } from 'next'; import dynamic from 'next/dynamic'; diff --git a/packages/front/.gitignore b/packages/front/.gitignore index 2e7814ca..9dffdfbf 100644 --- a/packages/front/.gitignore +++ b/packages/front/.gitignore @@ -1,5 +1,5 @@ node_modules dist build -src/graphql/server +graphql/server tsconfig.tsbuildinfo diff --git a/packages/front/src/components/alert.tsx b/packages/front/components/alert.tsx similarity index 97% rename from packages/front/src/components/alert.tsx rename to packages/front/components/alert.tsx index 100728bf..4d9b0c60 100644 --- a/packages/front/src/components/alert.tsx +++ b/packages/front/components/alert.tsx @@ -31,4 +31,4 @@ const Alert = ({ message, title, type = 'info' }: Props) => { ); }; -export default Alert; +export { Alert }; diff --git a/packages/front/src/components/dialog/confirm-dialog.tsx b/packages/front/components/dialog/confirm-dialog.tsx similarity index 98% rename from packages/front/src/components/dialog/confirm-dialog.tsx rename to packages/front/components/dialog/confirm-dialog.tsx index d4acf774..3572baa3 100644 --- a/packages/front/src/components/dialog/confirm-dialog.tsx +++ b/packages/front/components/dialog/confirm-dialog.tsx @@ -2,7 +2,7 @@ import { Dialog, Transition } from '@headlessui/react'; import { ExclamationIcon } from '@heroicons/react/outline'; import { Fragment, useRef } from 'react'; -import Button from '../../forms/button'; +import { Button } from '../../forms/button'; type Props = { cancelText?: string; diff --git a/packages/front/src/components/directory/breadcrumb.tsx b/packages/front/components/directory/breadcrumb.tsx similarity index 98% rename from packages/front/src/components/directory/breadcrumb.tsx rename to packages/front/components/directory/breadcrumb.tsx index 57d50299..9ace895b 100644 --- a/packages/front/src/components/directory/breadcrumb.tsx +++ b/packages/front/components/directory/breadcrumb.tsx @@ -62,4 +62,4 @@ const BreadCrumb = ({ current, onPathClick, paths, rootFolderId }: Props) => { ); }; -export default BreadCrumb; +export { BreadCrumb }; diff --git a/packages/front/src/components/directory/folders/empty.tsx b/packages/front/components/directory/folders/empty.tsx similarity index 95% rename from packages/front/src/components/directory/folders/empty.tsx rename to packages/front/components/directory/folders/empty.tsx index 7e5e98f1..ab76e17f 100644 --- a/packages/front/src/components/directory/folders/empty.tsx +++ b/packages/front/components/directory/folders/empty.tsx @@ -1,6 +1,6 @@ import { PlusIcon } from '@heroicons/react/solid'; -import Button from '../../../forms/button'; +import { Button } from '../../../forms/button'; type Props = { handleCreateFolder: () => void; @@ -41,4 +41,4 @@ const EmptyFolder = ({ handleCreateFolder, handleCreateSnippet }: Props) => { ); }; -export default EmptyFolder; +export { EmptyFolder }; diff --git a/packages/front/src/components/directory/folders/folder.tsx b/packages/front/components/directory/folders/folder.tsx similarity index 98% rename from packages/front/src/components/directory/folders/folder.tsx rename to packages/front/components/directory/folders/folder.tsx index 399b5755..03990ad2 100644 --- a/packages/front/src/components/directory/folders/folder.tsx +++ b/packages/front/components/directory/folders/folder.tsx @@ -58,4 +58,4 @@ const Folder = ({ item, onDeleteClick, onNavigate, onRenameClick }: Props) => { ); }; -export default Folder; +export { Folder }; diff --git a/packages/front/src/components/directory/folders/form/edit-folder.tsx b/packages/front/components/directory/folders/form/edit-folder.tsx similarity index 98% rename from packages/front/src/components/directory/folders/form/edit-folder.tsx rename to packages/front/components/directory/folders/form/edit-folder.tsx index 517a171e..661294a4 100644 --- a/packages/front/src/components/directory/folders/form/edit-folder.tsx +++ b/packages/front/components/directory/folders/form/edit-folder.tsx @@ -4,8 +4,8 @@ import { Fragment, useRef } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; import * as yup from 'yup'; -import Button from '../../../../forms/button'; -import TextInput from '../../../../forms/text-input'; +import { Button } from '../../../../forms/button'; +import { TextInput } from '../../../../forms/text-input'; import { useCreateFolder } from '../../../../services/folders/create-folder'; import { useUpdateFolder } from '../../../../services/folders/update-folder'; import { FolderItem } from '../../../../typings/components'; diff --git a/packages/front/src/components/directory/index.tsx b/packages/front/components/directory/index.tsx similarity index 95% rename from packages/front/src/components/directory/index.tsx rename to packages/front/components/directory/index.tsx index 867bf7ff..a4f7bfb4 100644 --- a/packages/front/src/components/directory/index.tsx +++ b/packages/front/components/directory/index.tsx @@ -7,14 +7,14 @@ import { useDeleteSnippet } from '../../services/snippets/delete-snippet'; import { FolderItem, SnippetItem } from '../../typings/components'; import { displayItemLabel } from '../../utils/text'; import { ConfirmDialog } from '../dialog/confirm-dialog'; -import MenuAction from '../menu-action'; +import { MenuAction } from '../menu-action'; import { useToast } from '../toast/provider'; -import BreadCrumb from './breadcrumb'; -import EmptyFolder from './folders/empty'; -import Folder from './folders/folder'; +import { BreadCrumb } from './breadcrumb'; +import { EmptyFolder } from './folders/empty'; +import { Folder } from './folders/folder'; import { EditFolderContainer } from './folders/form/edit-folder'; -import CreateSnippetContainer from './snippets/form/create-snippet'; -import Snippet from './snippets/snippet'; +import { CreateSnippetContainer } from './snippets/form/create-snippet'; +import { Snippet } from './snippets/snippet'; type Props = { folderId: string; @@ -221,4 +221,4 @@ const Directory = ({ ); }; -export default Directory; +export { Directory }; diff --git a/packages/front/src/components/directory/snippets/form/create-snippet.tsx b/packages/front/components/directory/snippets/form/create-snippet.tsx similarity index 98% rename from packages/front/src/components/directory/snippets/form/create-snippet.tsx rename to packages/front/components/directory/snippets/form/create-snippet.tsx index 17b8d8a3..d843d3ba 100644 --- a/packages/front/src/components/directory/snippets/form/create-snippet.tsx +++ b/packages/front/components/directory/snippets/form/create-snippet.tsx @@ -3,7 +3,7 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { Fragment, useRef } from 'react'; import { FormProvider, useForm } from 'react-hook-form'; -import Button from '../../../../forms/button'; +import { Button } from '../../../../forms/button'; import { useCodeHighlighter } from '../../../../hooks'; import { useCreateSnippet } from '../../../../services/snippets/create-snippet'; import { CODE_HIGHLIGHT_OPTIONS, THEME_OPTIONS } from '../../../../utils/constants'; @@ -141,4 +141,4 @@ const CreateSnippetContainer = ({ closeModal, folderId, open }: Props) => { ); }; -export default CreateSnippetContainer; +export { CreateSnippetContainer }; diff --git a/packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts b/packages/front/components/directory/snippets/form/editor/hooks/use-editor.ts similarity index 100% rename from packages/front/src/components/directory/snippets/form/editor/hooks/use-editor.ts rename to packages/front/components/directory/snippets/form/editor/hooks/use-editor.ts diff --git a/packages/front/src/components/directory/snippets/form/editor/hooks/use-form-editor.ts b/packages/front/components/directory/snippets/form/editor/hooks/use-form-editor.ts similarity index 100% rename from packages/front/src/components/directory/snippets/form/editor/hooks/use-form-editor.ts rename to packages/front/components/directory/snippets/form/editor/hooks/use-form-editor.ts diff --git a/packages/front/src/components/directory/snippets/form/editor/index.tsx b/packages/front/components/directory/snippets/form/editor/index.tsx similarity index 94% rename from packages/front/src/components/directory/snippets/form/editor/index.tsx rename to packages/front/components/directory/snippets/form/editor/index.tsx index c6c80927..20394ff7 100644 --- a/packages/front/src/components/directory/snippets/form/editor/index.tsx +++ b/packages/front/components/directory/snippets/form/editor/index.tsx @@ -2,9 +2,9 @@ import { Controller, useFormContext } from 'react-hook-form'; import Editor from 'react-simple-code-editor'; import { Highlighter } from 'shiki'; -import SelectInput from '../../../../../forms/select-input'; -import SwitchInput from '../../../../../forms/switch-input'; -import TextInput from '../../../../../forms/text-input'; +import { SelectInput } from '../../../../../forms/select-input'; +import { SwitchInput } from '../../../../../forms/switch-input'; +import { TextInput } from '../../../../../forms/text-input'; import { SelectOption } from '../../../../../typings/components'; import { EditorFormValues } from '../../../../../typings/snippet-form'; import { THEME_BACKGROUND_COLOR_MAP } from '../../../../../utils/constants'; diff --git a/packages/front/src/components/directory/snippets/form/form-schema.ts b/packages/front/components/directory/snippets/form/form-schema.ts similarity index 100% rename from packages/front/src/components/directory/snippets/form/form-schema.ts rename to packages/front/components/directory/snippets/form/form-schema.ts diff --git a/packages/front/src/components/directory/snippets/form/utils.ts b/packages/front/components/directory/snippets/form/utils.ts similarity index 100% rename from packages/front/src/components/directory/snippets/form/utils.ts rename to packages/front/components/directory/snippets/form/utils.ts diff --git a/packages/front/src/components/directory/snippets/form/view-snippet.tsx b/packages/front/components/directory/snippets/form/view-snippet.tsx similarity index 98% rename from packages/front/src/components/directory/snippets/form/view-snippet.tsx rename to packages/front/components/directory/snippets/form/view-snippet.tsx index 8a5fabdf..cd636a0c 100644 --- a/packages/front/src/components/directory/snippets/form/view-snippet.tsx +++ b/packages/front/components/directory/snippets/form/view-snippet.tsx @@ -1,7 +1,7 @@ import { yupResolver } from '@hookform/resolvers/yup'; import { FormProvider, useForm } from 'react-hook-form'; -import Button from '../../../../forms/button'; +import { Button } from '../../../../forms/button'; import { useCodeHighlighter } from '../../../../hooks'; import { useUpdateSnippet } from '../../../../services/snippets/update-snippet'; import { SelectOption } from '../../../../typings/components'; diff --git a/packages/front/src/components/directory/snippets/snippet.tsx b/packages/front/components/directory/snippets/snippet.tsx similarity index 99% rename from packages/front/src/components/directory/snippets/snippet.tsx rename to packages/front/components/directory/snippets/snippet.tsx index de09a994..6ca8b148 100644 --- a/packages/front/src/components/directory/snippets/snippet.tsx +++ b/packages/front/components/directory/snippets/snippet.tsx @@ -88,4 +88,4 @@ const Snippet = ({ item, onClick, onDeleteClick }: Props) => { ); }; -export default Snippet; +export { Snippet }; diff --git a/packages/front/src/components/link/external-link.tsx b/packages/front/components/link/external-link.tsx similarity index 100% rename from packages/front/src/components/link/external-link.tsx rename to packages/front/components/link/external-link.tsx diff --git a/packages/front/src/components/link/index.tsx b/packages/front/components/link/index.tsx similarity index 95% rename from packages/front/src/components/link/index.tsx rename to packages/front/components/link/index.tsx index 49a5cdcc..dd516edd 100644 --- a/packages/front/src/components/link/index.tsx +++ b/packages/front/components/link/index.tsx @@ -13,4 +13,4 @@ const Link = ({ children, ...props }: Props) => { return ; }; -export default Link; +export { Link }; diff --git a/packages/front/src/components/menu-action.tsx b/packages/front/components/menu-action.tsx similarity index 98% rename from packages/front/src/components/menu-action.tsx rename to packages/front/components/menu-action.tsx index 5d58c61b..9de21737 100644 --- a/packages/front/src/components/menu-action.tsx +++ b/packages/front/components/menu-action.tsx @@ -53,4 +53,4 @@ const MenuAction = ({ onNewFolderClick, onNewSnippetClick }: Props) => { ); }; -export default MenuAction; +export { MenuAction }; diff --git a/packages/front/src/components/menus/dot-menu.tsx b/packages/front/components/menus/dot-menu.tsx similarity index 100% rename from packages/front/src/components/menus/dot-menu.tsx rename to packages/front/components/menus/dot-menu.tsx diff --git a/packages/front/src/components/toast/provider.tsx b/packages/front/components/toast/provider.tsx similarity index 100% rename from packages/front/src/components/toast/provider.tsx rename to packages/front/components/toast/provider.tsx diff --git a/packages/front/src/components/toast/toast.tsx b/packages/front/components/toast/toast.tsx similarity index 98% rename from packages/front/src/components/toast/toast.tsx rename to packages/front/components/toast/toast.tsx index b6a10ad4..528d72c5 100644 --- a/packages/front/src/components/toast/toast.tsx +++ b/packages/front/components/toast/toast.tsx @@ -1,8 +1,8 @@ +import { Transition } from '@headlessui/react'; import { CheckCircleIcon, ExclamationCircleIcon, XCircleIcon } from '@heroicons/react/outline'; import { XIcon } from '@heroicons/react/solid'; import { Fragment } from 'react'; -import { Transition } from '../../../index'; import { ToastType } from './types'; type Props = { @@ -24,6 +24,7 @@ const renderToastIcon = (type: ToastType) => { return