slackblock 1.1.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +62 -0
- package/README.md +227 -68
- package/dist/block.cjs +79 -124
- package/dist/block.cjs.map +1 -1
- package/dist/{block.d.mts → block.d.cts} +128 -92
- package/dist/block.d.ts +128 -92
- package/dist/block.mjs +80 -114
- package/dist/block.mjs.map +1 -1
- package/dist/index.cjs +250 -143
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -0
- package/dist/index.d.ts +19 -4
- package/dist/index.mjs +243 -133
- package/dist/index.mjs.map +1 -1
- package/dist/jsx-dev-runtime.cjs +43 -0
- package/dist/jsx-dev-runtime.cjs.map +1 -0
- package/dist/jsx-dev-runtime.d.cts +1 -0
- package/dist/jsx-dev-runtime.d.ts +1 -0
- package/dist/jsx-dev-runtime.mjs +15 -0
- package/dist/jsx-dev-runtime.mjs.map +1 -0
- package/dist/jsx-runtime.cjs +46 -0
- package/dist/jsx-runtime.cjs.map +1 -0
- package/dist/jsx-runtime.d.cts +28 -0
- package/dist/jsx-runtime.d.ts +28 -0
- package/dist/jsx-runtime.mjs +19 -0
- package/dist/jsx-runtime.mjs.map +1 -0
- package/dist/{types.d-0WEt-h92.d.mts → types.d-BHoTwZUO.d.cts} +11 -11
- package/dist/{types.d-0WEt-h92.d.ts → types.d-BHoTwZUO.d.ts} +11 -11
- package/package.json +35 -30
- package/dist/index.d.mts +0 -7
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
type ComponentType = string | ((...parameters: unknown[]) => unknown) | (new (...parameters: unknown[]) => unknown);
|
|
2
|
+
declare function jsx(type: ComponentType, props: Record<string, unknown>): {
|
|
3
|
+
type: ComponentType;
|
|
4
|
+
props: Record<string, unknown>;
|
|
5
|
+
children: any[];
|
|
6
|
+
};
|
|
7
|
+
declare function jsxs(type: ComponentType, props: Record<string, unknown>): {
|
|
8
|
+
type: ComponentType;
|
|
9
|
+
props: Record<string, unknown>;
|
|
10
|
+
children: any[];
|
|
11
|
+
};
|
|
12
|
+
declare const Fragment = "fragment";
|
|
13
|
+
declare namespace JSX {
|
|
14
|
+
type Element = {
|
|
15
|
+
type: ComponentType;
|
|
16
|
+
props: Record<string, unknown>;
|
|
17
|
+
children: unknown[];
|
|
18
|
+
};
|
|
19
|
+
type IntrinsicElements = Record<string, Record<string, unknown>>;
|
|
20
|
+
type ElementClass = {
|
|
21
|
+
props: Record<string, unknown>;
|
|
22
|
+
};
|
|
23
|
+
type ElementAttributesProperty = {
|
|
24
|
+
props: Record<string, unknown>;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export { Fragment, JSX, jsx, jsxs };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// src/jsx-runtime.ts
|
|
2
|
+
function jsx(type, props) {
|
|
3
|
+
const { children } = props;
|
|
4
|
+
return {
|
|
5
|
+
type,
|
|
6
|
+
props,
|
|
7
|
+
children: Array.isArray(children) ? children : children === void 0 ? [] : [children]
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function jsxs(type, props) {
|
|
11
|
+
return jsx(type, props);
|
|
12
|
+
}
|
|
13
|
+
var Fragment = "fragment";
|
|
14
|
+
export {
|
|
15
|
+
Fragment,
|
|
16
|
+
jsx,
|
|
17
|
+
jsxs
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=jsx-runtime.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/jsx-runtime.ts"],"sourcesContent":["type ComponentType = string | ((...parameters: unknown[]) => unknown) | (new (...parameters: unknown[]) => unknown);\n\nexport function jsx(type: ComponentType, props: Record<string, unknown>) {\n const {children} = props;\n\n return {\n type,\n props,\n children: Array.isArray(children) ? children : (children === undefined ? [] : [children]),\n };\n}\n\nexport function jsxs(type: ComponentType, props: Record<string, unknown>) {\n return jsx(type, props);\n}\n\nexport const Fragment = 'fragment';\n\n// eslint-disable-next-line @typescript-eslint/no-namespace\nexport namespace JSX {\n export type Element = {type: ComponentType; props: Record<string, unknown>; children: unknown[]};\n export type IntrinsicElements = Record<string, Record<string, unknown>>;\n export type ElementClass = {props: Record<string, unknown>};\n export type ElementAttributesProperty = {props: Record<string, unknown>};\n}\n"],"mappings":";AAEO,SAAS,IAAI,MAAqB,OAAgC;AACvE,QAAM,EAAC,SAAQ,IAAI;AAEnB,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA,UAAU,MAAM,QAAQ,QAAQ,IAAI,WAAY,aAAa,SAAY,CAAC,IAAI,CAAC,QAAQ;AAAA,EACzF;AACF;AAEO,SAAS,KAAK,MAAqB,OAAgC;AACxE,SAAO,IAAI,MAAM,KAAK;AACxB;AAEO,IAAM,WAAW;","names":[]}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KnownBlock, Block, MessageAttachment, MessageMetadata, EntityMetadata } from '@slack/types';
|
|
1
|
+
import { KnownBlock, Block as Block$1, MessageAttachment, MessageMetadata, EntityMetadata } from '@slack/types';
|
|
3
2
|
|
|
4
3
|
type Channel = {
|
|
5
4
|
channel: string;
|
|
@@ -12,7 +11,7 @@ type MarkdownText = {
|
|
|
12
11
|
};
|
|
13
12
|
type ChannelAndText = Channel & Text;
|
|
14
13
|
type ChannelAndBlocks = Channel & Partial<Text> & {
|
|
15
|
-
blocks: Array<KnownBlock | Block>;
|
|
14
|
+
blocks: Array<KnownBlock | Block$1>;
|
|
16
15
|
};
|
|
17
16
|
type ChannelAndAttachments = Channel & Partial<Text> & {
|
|
18
17
|
attachments: MessageAttachment[];
|
|
@@ -69,11 +68,12 @@ type ChatPostMessageArguments = {
|
|
|
69
68
|
mrkdwn?: boolean;
|
|
70
69
|
};
|
|
71
70
|
|
|
72
|
-
type
|
|
73
|
-
type StandardBlockElement = ReactElement<any, any>;
|
|
71
|
+
type Block = KnownBlock | Block$1;
|
|
74
72
|
|
|
75
|
-
type
|
|
76
|
-
|
|
73
|
+
type InteractiveBlockElement = JSX.Element;
|
|
74
|
+
|
|
75
|
+
type InputBlockElement = JSX.Element;
|
|
76
|
+
type BlockElement = JSX.Element;
|
|
77
77
|
|
|
78
78
|
type SlackMessageContents =
|
|
79
79
|
| Omit<ChannelAndText, 'channel'>
|
|
@@ -103,14 +103,14 @@ type SlackMessageBase = SlackMessageContents
|
|
|
103
103
|
|
|
104
104
|
type SlackMessage = SlackMessageBase & Omit<ChatPostMessageArguments, 'channel' | 'token'>;
|
|
105
105
|
|
|
106
|
-
type AnyFunction = (...parameters:
|
|
106
|
+
type AnyFunction = (...parameters: unknown[]) => unknown;
|
|
107
107
|
|
|
108
|
-
type AnyConstructor = new (...parameters:
|
|
108
|
+
type AnyConstructor = new (...parameters: unknown[]) => unknown;
|
|
109
109
|
|
|
110
110
|
type WithType = {
|
|
111
111
|
type?: string | AnyFunction | AnyConstructor;
|
|
112
112
|
};
|
|
113
|
-
type BElement =
|
|
113
|
+
type BElement = JSX.Element & WithType;
|
|
114
114
|
type Element = BElement;
|
|
115
115
|
type Child =
|
|
116
116
|
| string
|
|
@@ -121,4 +121,4 @@ type Child =
|
|
|
121
121
|
// eslint-disable-next-line @typescript-eslint/no-restricted-types -- React children can be null.
|
|
122
122
|
| null;
|
|
123
123
|
|
|
124
|
-
export type {
|
|
124
|
+
export type { Block as B, Child as C, Element as E, InteractiveBlockElement as I, SlackMessage as S, InputBlockElement as a, BlockElement as b };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KnownBlock, Block, MessageAttachment, MessageMetadata, EntityMetadata } from '@slack/types';
|
|
1
|
+
import { KnownBlock, Block as Block$1, MessageAttachment, MessageMetadata, EntityMetadata } from '@slack/types';
|
|
3
2
|
|
|
4
3
|
type Channel = {
|
|
5
4
|
channel: string;
|
|
@@ -12,7 +11,7 @@ type MarkdownText = {
|
|
|
12
11
|
};
|
|
13
12
|
type ChannelAndText = Channel & Text;
|
|
14
13
|
type ChannelAndBlocks = Channel & Partial<Text> & {
|
|
15
|
-
blocks: Array<KnownBlock | Block>;
|
|
14
|
+
blocks: Array<KnownBlock | Block$1>;
|
|
16
15
|
};
|
|
17
16
|
type ChannelAndAttachments = Channel & Partial<Text> & {
|
|
18
17
|
attachments: MessageAttachment[];
|
|
@@ -69,11 +68,12 @@ type ChatPostMessageArguments = {
|
|
|
69
68
|
mrkdwn?: boolean;
|
|
70
69
|
};
|
|
71
70
|
|
|
72
|
-
type
|
|
73
|
-
type StandardBlockElement = ReactElement<any, any>;
|
|
71
|
+
type Block = KnownBlock | Block$1;
|
|
74
72
|
|
|
75
|
-
type
|
|
76
|
-
|
|
73
|
+
type InteractiveBlockElement = JSX.Element;
|
|
74
|
+
|
|
75
|
+
type InputBlockElement = JSX.Element;
|
|
76
|
+
type BlockElement = JSX.Element;
|
|
77
77
|
|
|
78
78
|
type SlackMessageContents =
|
|
79
79
|
| Omit<ChannelAndText, 'channel'>
|
|
@@ -103,14 +103,14 @@ type SlackMessageBase = SlackMessageContents
|
|
|
103
103
|
|
|
104
104
|
type SlackMessage = SlackMessageBase & Omit<ChatPostMessageArguments, 'channel' | 'token'>;
|
|
105
105
|
|
|
106
|
-
type AnyFunction = (...parameters:
|
|
106
|
+
type AnyFunction = (...parameters: unknown[]) => unknown;
|
|
107
107
|
|
|
108
|
-
type AnyConstructor = new (...parameters:
|
|
108
|
+
type AnyConstructor = new (...parameters: unknown[]) => unknown;
|
|
109
109
|
|
|
110
110
|
type WithType = {
|
|
111
111
|
type?: string | AnyFunction | AnyConstructor;
|
|
112
112
|
};
|
|
113
|
-
type BElement =
|
|
113
|
+
type BElement = JSX.Element & WithType;
|
|
114
114
|
type Element = BElement;
|
|
115
115
|
type Child =
|
|
116
116
|
| string
|
|
@@ -121,4 +121,4 @@ type Child =
|
|
|
121
121
|
// eslint-disable-next-line @typescript-eslint/no-restricted-types -- React children can be null.
|
|
122
122
|
| null;
|
|
123
123
|
|
|
124
|
-
export type {
|
|
124
|
+
export type { Block as B, Child as C, Element as E, InteractiveBlockElement as I, SlackMessage as S, InputBlockElement as a, BlockElement as b };
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "slackblock",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-beta.1",
|
|
4
4
|
"description": "JSX-based Slack message renderer",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
7
7
|
},
|
|
8
|
-
"
|
|
8
|
+
"type": "module",
|
|
9
9
|
"main": "dist/index.cjs",
|
|
10
10
|
"module": "dist/index.mjs",
|
|
11
11
|
"types": "dist/index.d.ts",
|
|
@@ -14,6 +14,12 @@
|
|
|
14
14
|
"block": [
|
|
15
15
|
"dist/block.d.ts"
|
|
16
16
|
],
|
|
17
|
+
"jsx-runtime": [
|
|
18
|
+
"dist/jsx-runtime.d.ts"
|
|
19
|
+
],
|
|
20
|
+
"jsx-dev-runtime": [
|
|
21
|
+
"dist/jsx-dev-runtime.d.ts"
|
|
22
|
+
],
|
|
17
23
|
"*": [
|
|
18
24
|
"dist/index.d.ts"
|
|
19
25
|
]
|
|
@@ -31,6 +37,18 @@
|
|
|
31
37
|
"import": "./dist/block.mjs",
|
|
32
38
|
"require": "./dist/block.cjs",
|
|
33
39
|
"default": "./dist/block.cjs"
|
|
40
|
+
},
|
|
41
|
+
"./jsx-runtime": {
|
|
42
|
+
"types": "./dist/jsx-runtime.d.ts",
|
|
43
|
+
"import": "./dist/jsx-runtime.mjs",
|
|
44
|
+
"require": "./dist/jsx-runtime.cjs",
|
|
45
|
+
"default": "./dist/jsx-runtime.cjs"
|
|
46
|
+
},
|
|
47
|
+
"./jsx-dev-runtime": {
|
|
48
|
+
"types": "./dist/jsx-dev-runtime.d.ts",
|
|
49
|
+
"import": "./dist/jsx-dev-runtime.mjs",
|
|
50
|
+
"require": "./dist/jsx-dev-runtime.cjs",
|
|
51
|
+
"default": "./dist/jsx-dev-runtime.cjs"
|
|
34
52
|
}
|
|
35
53
|
},
|
|
36
54
|
"sideEffects": false,
|
|
@@ -40,23 +58,11 @@
|
|
|
40
58
|
"LICENSE",
|
|
41
59
|
"CHANGELOG.md"
|
|
42
60
|
],
|
|
43
|
-
"scripts": {
|
|
44
|
-
"prepare": "husky install",
|
|
45
|
-
"test": "pnpm run test:tsc && pnpm run test:lint && pnpm run test:unit",
|
|
46
|
-
"test:tsc": "tsc -p ./src -p ./test --noEmit",
|
|
47
|
-
"test:lint": "xo",
|
|
48
|
-
"test:unit": "vitest run",
|
|
49
|
-
"prebuild": "pnpm run clean",
|
|
50
|
-
"clean": "rimraf ./dist",
|
|
51
|
-
"build": "tsup",
|
|
52
|
-
"prepublishOnly": "pnpm run test && pnpm run build"
|
|
53
|
-
},
|
|
54
61
|
"repository": {
|
|
55
62
|
"type": "git",
|
|
56
63
|
"url": "git+https://github.com/kolyaventuri/block.git"
|
|
57
64
|
},
|
|
58
65
|
"keywords": [
|
|
59
|
-
"react",
|
|
60
66
|
"slack",
|
|
61
67
|
"message",
|
|
62
68
|
"bot"
|
|
@@ -68,41 +74,40 @@
|
|
|
68
74
|
},
|
|
69
75
|
"homepage": "https://github.com/kolyaventuri/block#readme",
|
|
70
76
|
"devDependencies": {
|
|
77
|
+
"@changesets/cli": "^2.30.0",
|
|
71
78
|
"@types/node": "25.0.10",
|
|
72
|
-
"@types/react": "^19.2.9",
|
|
73
79
|
"@typescript-eslint/eslint-plugin": "^8.53.1",
|
|
74
80
|
"@typescript-eslint/parser": "^8.53.1",
|
|
81
|
+
"@vitest/coverage-v8": "^4.0.18",
|
|
75
82
|
"eslint": "^9.39.2",
|
|
76
83
|
"eslint-config-xo": "^0.49.0",
|
|
77
|
-
"eslint-config-xo-react": "^0.29.0",
|
|
78
84
|
"eslint-config-xo-typescript": "^9.0.0",
|
|
79
|
-
"eslint-plugin-react": "^7.37.5",
|
|
80
|
-
"eslint-plugin-react-hooks": "^7.0.1",
|
|
81
85
|
"husky": "^9.1.7",
|
|
86
|
+
"knip": "^5.85.0",
|
|
82
87
|
"lint-staged": "^16.2.7",
|
|
83
|
-
"react": "^19.2.3",
|
|
84
88
|
"rimraf": "^6.1.2",
|
|
85
89
|
"tsup": "^8.5.1",
|
|
86
90
|
"typescript": "^5.9.3",
|
|
87
91
|
"vitest": "^4.0.18",
|
|
88
92
|
"xo": "^1.2.3"
|
|
89
93
|
},
|
|
90
|
-
"peerDependencies": {
|
|
91
|
-
"react": "^16.14.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
92
|
-
},
|
|
93
94
|
"dependencies": {
|
|
94
95
|
"@slack/types": "^2.19.0"
|
|
95
96
|
},
|
|
96
|
-
"pnpm": {
|
|
97
|
-
"overrides": {
|
|
98
|
-
"@eslint/plugin-kit": "^0.3.4",
|
|
99
|
-
"minimatch": "^10.2.3",
|
|
100
|
-
"rollup": "^4.59.0"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
97
|
"lint-staged": {
|
|
104
98
|
"*.{ts,tsx}": [
|
|
105
99
|
"xo"
|
|
106
100
|
]
|
|
101
|
+
},
|
|
102
|
+
"scripts": {
|
|
103
|
+
"test": "pnpm run test:tsc && pnpm run test:lint && pnpm run test:knip && pnpm run test:unit",
|
|
104
|
+
"test:tsc": "tsc -p tsconfig.json --noEmit && tsc -p test/tsconfig.json --noEmit",
|
|
105
|
+
"test:lint": "xo --fix",
|
|
106
|
+
"test:knip": "knip",
|
|
107
|
+
"test:unit": "vitest run",
|
|
108
|
+
"prebuild": "pnpm run clean",
|
|
109
|
+
"clean": "rimraf ./dist",
|
|
110
|
+
"build": "tsup",
|
|
111
|
+
"release": "pnpm run build && changeset publish"
|
|
107
112
|
}
|
|
108
|
-
}
|
|
113
|
+
}
|