Skip to content

Commit

Permalink
Merge pull request #92 from xpadev-net/develop
Browse files Browse the repository at this point in the history
release: v0.2.69
  • Loading branch information
xpadev-net authored Jan 4, 2024
2 parents 1c595e2 + 437ce2c commit 977ff8f
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@xpadev-net/niconicomments",
"version": "0.2.68",
"version": "0.2.69",
"description": "NiconiComments is a comment drawing library that is somewhat compatible with the official Nico Nico Douga player.",
"main": "dist/bundle.js",
"types": "dist/bundle.d.ts",
Expand Down
8 changes: 6 additions & 2 deletions src/@types/IComment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import type { CommentLoc, FormattedCommentWithSize, Position } from "@/@types/";
import type { IRenderer } from "@/@types/renderer";
import type {
CommentLoc,
FormattedCommentWithSize,
IRenderer,
Position,
} from "@/@types/";

export interface IComment {
comment: FormattedCommentWithSize;
Expand Down
3 changes: 1 addition & 2 deletions src/@types/IPlugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { IComment } from "@/@types/";
import type { IRenderer } from "@/@types/renderer";
import type { IComment, IRenderer } from "@/@types/";

export interface IPluginConstructor {
id: string;
Expand Down
1 change: 1 addition & 0 deletions src/@types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export * from "./format.formatted";
export * from "./format.legacy";
export * from "./format.owner";
export * from "./format.v1";
export * from "./format.xml2js";
export * from "./IComment";
export * from "./input-parser";
export * from "./IPlugins";
Expand Down
2 changes: 1 addition & 1 deletion src/@types/input-parser.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { FormattedComment } from "@/@types/format.formatted";
import type { FormattedComment } from "@/@types/";

export interface InputParser {
key: string[];
Expand Down
2 changes: 1 addition & 1 deletion src/@types/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type {
OwnerComment,
RawApiResponse,
V1Thread,
Xml2jsPacket,
} from "@/@types/";
import type { Xml2jsPacket } from "@/@types/format.xml2js";

export const ZInputFormatType = union([
literal("XMLDocument"),
Expand Down
2 changes: 1 addition & 1 deletion src/comments/BaseComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ import type {
FormattedCommentWithFont,
FormattedCommentWithSize,
IComment,
IRenderer,
MeasureTextInput,
MeasureTextResult,
ParseContentResult,
Position,
} from "@/@types/";
import type { IRenderer } from "@/@types/renderer";
import { imageCache } from "@/contexts";
import { isDebug } from "@/contexts/debug";
import { config } from "@/definition/config";
Expand Down
2 changes: 1 addition & 1 deletion src/comments/FlashComment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import type {
FormattedComment,
FormattedCommentWithFont,
FormattedCommentWithSize,
IRenderer,
MeasureTextInput,
MeasureTextResult,
Position,
} from "@/@types/";
import type { IRenderer } from "@/@types/renderer";
import { config, options } from "@/definition/config";
import { TypeGuardError } from "@/errors/TypeGuardError";
import typeGuard from "@/typeGuard";
Expand Down
2 changes: 1 addition & 1 deletion src/comments/HTML5Comment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import type {
FormattedCommentWithFont,
FormattedCommentWithSize,
HTML5Fonts,
IRenderer,
MeasureTextInput,
MeasureTextResult,
} from "@/@types/";
import type { IRenderer } from "@/@types/renderer";
import { config, options } from "@/definition/config";
import { TypeGuardError } from "@/errors/TypeGuardError";
import typeGuard from "@/typeGuard";
Expand Down
2 changes: 1 addition & 1 deletion src/contexts/cache.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IRenderer } from "@/@types/renderer";
import type { IRenderer } from "@/@types/";

let imageCache: {
[key: string]: { image: IRenderer; timeout: number };
Expand Down
5 changes: 2 additions & 3 deletions src/input/xml2js.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import { parse } from "valibot";

import type { FormattedComment, InputParser } from "@/@types";
import type { Xml2jsPacket } from "@/@types/format.xml2js";
import { ZXml2jsPacket } from "@/@types/format.xml2js";
import type { FormattedComment, InputParser, Xml2jsPacket } from "@/@types";
import { ZXml2jsPacket } from "@/@types/";

export const Xml2jsParser: InputParser = {
key: ["xml2js"],
Expand Down
2 changes: 1 addition & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import type {
IComment,
InputFormat,
IPluginList,
IRenderer,
Options,
Position,
Timeline,
} from "@/@types/";
import type { IRenderer } from "@/@types/renderer";
import { FlashComment } from "@/comments/";
import {
plugins,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/canvas.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IRenderer } from "@/@types/renderer";
import type { IRenderer } from "@/@types/";
import { CanvasRenderingContext2DError } from "@/errors";

/**
Expand Down
11 changes: 11 additions & 0 deletions src/typeGuard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ import type {
RawApiResponse,
V1Comment,
V1Thread,
Xml2jsChat,
Xml2jsChatItem,
Xml2jsPacket,
} from "@/@types/";
import {
ZApiChat,
Expand All @@ -58,6 +61,9 @@ import {
ZRawApiResponse,
ZV1Comment,
ZV1Thread,
ZXml2jsChat,
ZXml2jsChatItem,
ZXml2jsPacket,
} from "@/@types/";
import { colors } from "@/definition/colors";

Expand Down Expand Up @@ -117,6 +123,11 @@ const typeGuard = {
}
return true;
},
xml2js: {
packet: (i: unknown): i is Xml2jsPacket => is(ZXml2jsPacket, i),
chat: (i: unknown): i is Xml2jsChat => is(ZXml2jsChat, i),
chatItem: (i: unknown): i is Xml2jsChatItem => is(ZXml2jsChatItem, i),
},
legacyOwner: {
comments: (i: unknown): i is string =>
is(
Expand Down
2 changes: 1 addition & 1 deletion src/utils/border.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { IRenderer } from "@/@types/renderer";
import type { IRenderer } from "@/@types/";

/**
* ボタンの左端枠を描画する
Expand Down
2 changes: 1 addition & 1 deletion src/utils/niconico.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import type {
CommentContentItem,
CommentHTML5Font,
CommentSize,
IRenderer,
MeasureInput,
} from "@/@types";
import type { IRenderer } from "@/@types/renderer";
import { config } from "@/definition/config";
import { TypeGuardError } from "@/errors/TypeGuardError";

Expand Down
3 changes: 1 addition & 2 deletions src/utils/plugins.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { FormattedComment } from "@/@types";
import type { IRenderer } from "@/@types/renderer";
import type { FormattedComment, IRenderer } from "@/@types";
import { HTML5Comment } from "@/comments";
import { config } from "@/definition/config";

Expand Down

0 comments on commit 977ff8f

Please sign in to comment.