react-blockkit 0.4.0 → 0.5.0
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/dist/errors.d.ts +5 -0
- package/dist/errors.d.ts.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +126 -110
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -11,7 +11,7 @@ export { BlockKitProvider, useBlockKitContext } from "./context.js";
|
|
|
11
11
|
export type { BlockKitProviderProps } from "./context.js";
|
|
12
12
|
export { ButtonElement, ChoiceGroup, ImageElement, InputElement, InteractiveElement, OverflowElement, SelectElement, } from "./elements/Elements.js";
|
|
13
13
|
export type { ButtonElementProps, ImageElementProps, InputElementProps, InteractiveElementProps, OverflowElementProps, SelectElementProps, } from "./elements/Elements.js";
|
|
14
|
-
export { BlockKitInvariantError } from "./errors.js";
|
|
14
|
+
export { BlockKitInvariantError, isBlockKitInvariantError } from "./errors.js";
|
|
15
15
|
export type { BlockKitInvariantCode, BlockKitInvariantDetails } from "./errors.js";
|
|
16
16
|
export { Markdown, tokenizeMarkdown } from "./text/Markdown.js";
|
|
17
17
|
export type { MarkdownProps } from "./text/Markdown.js";
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,UAAU,E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AAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnE,mBAAmB,YAAY,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,iBAAiB,GAClB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export { BlockKitProvider, useBlockKitContext } from "./context.js";
|
|
|
11
11
|
export type { BlockKitProviderProps } from "./context.js";
|
|
12
12
|
export { ButtonElement, ChoiceGroup, ImageElement, InputElement, InteractiveElement, OverflowElement, SelectElement, } from "./elements/Elements.js";
|
|
13
13
|
export type { ButtonElementProps, ImageElementProps, InputElementProps, InteractiveElementProps, OverflowElementProps, SelectElementProps, } from "./elements/Elements.js";
|
|
14
|
-
export { BlockKitInvariantError } from "./errors.js";
|
|
14
|
+
export { BlockKitInvariantError, isBlockKitInvariantError } from "./errors.js";
|
|
15
15
|
export type { BlockKitInvariantCode, BlockKitInvariantDetails } from "./errors.js";
|
|
16
16
|
export { Markdown, tokenizeMarkdown } from "./text/Markdown.js";
|
|
17
17
|
export type { MarkdownProps } from "./text/Markdown.js";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACnD,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AACnD,OAAO,EACL,UAAU,EACV,SAAS,EACT,aAAa,EACb,cAAc,EACd,SAAS,EAC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AAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACnE,mBAAmB,YAAY,CAAC;AAChC,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,sBAAsB,EACtB,4BAA4B,EAC5B,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,QAAQ,EACR,iBAAiB,GAClB,MAAM,iBAAiB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4537,7 +4537,15 @@ function hr({ block: e, className: t, path: n = "block" }) {
|
|
|
4537
4537
|
}
|
|
4538
4538
|
//#endregion
|
|
4539
4539
|
//#region src/errors.ts
|
|
4540
|
-
var gr = class extends Error {
|
|
4540
|
+
var gr = Symbol.for("slackmark.error.blockKitInvariant"), _r = class extends Error {
|
|
4541
|
+
static {
|
|
4542
|
+
Object.defineProperty(this.prototype, gr, {
|
|
4543
|
+
configurable: !1,
|
|
4544
|
+
enumerable: !1,
|
|
4545
|
+
value: !0,
|
|
4546
|
+
writable: !1
|
|
4547
|
+
});
|
|
4548
|
+
}
|
|
4541
4549
|
code;
|
|
4542
4550
|
path;
|
|
4543
4551
|
name;
|
|
@@ -4545,14 +4553,22 @@ var gr = class extends Error {
|
|
|
4545
4553
|
super(`${t.path}: ${e}`), this.code = t.code, this.path = t.path, this.name = "BlockKitInvariantError";
|
|
4546
4554
|
}
|
|
4547
4555
|
};
|
|
4556
|
+
function vr(e) {
|
|
4557
|
+
if (typeof e != "object" || !e) return !1;
|
|
4558
|
+
try {
|
|
4559
|
+
return Reflect.get(e, gr) === !0;
|
|
4560
|
+
} catch {
|
|
4561
|
+
return !1;
|
|
4562
|
+
}
|
|
4563
|
+
}
|
|
4548
4564
|
//#endregion
|
|
4549
4565
|
//#region src/BlockKit.tsx
|
|
4550
|
-
function
|
|
4566
|
+
function yr(e) {
|
|
4551
4567
|
let t = e;
|
|
4552
4568
|
if (typeof e == "string") try {
|
|
4553
4569
|
t = JSON.parse(e);
|
|
4554
4570
|
} catch {
|
|
4555
|
-
throw new
|
|
4571
|
+
throw new _r("data: expected valid JSON", {
|
|
4556
4572
|
code: "invalid_json",
|
|
4557
4573
|
path: "data"
|
|
4558
4574
|
});
|
|
@@ -4568,8 +4584,8 @@ function _r(e) {
|
|
|
4568
4584
|
blocks: [t]
|
|
4569
4585
|
};
|
|
4570
4586
|
}
|
|
4571
|
-
function
|
|
4572
|
-
let c = o(() =>
|
|
4587
|
+
function br({ "aria-label": e = "Slack Block Kit preview", className: t, data: n, onAction: r, resolvers: i, surface: a = "message", theme: s = "light" }) {
|
|
4588
|
+
let c = o(() => yr(n), [n]), l = g(s === "dark" ? we : Ce, O.root, s === "dark" ? O.rootDark : O.rootLight);
|
|
4573
4589
|
return /* @__PURE__ */ u(b, {
|
|
4574
4590
|
onAction: r,
|
|
4575
4591
|
resolvers: i,
|
|
@@ -4591,14 +4607,14 @@ function vr({ "aria-label": e = "Slack Block Kit preview", className: t, data: n
|
|
|
4591
4607
|
}
|
|
4592
4608
|
//#endregion
|
|
4593
4609
|
//#region src/validation.ts
|
|
4594
|
-
function
|
|
4595
|
-
throw new
|
|
4610
|
+
function xr(e, t, n) {
|
|
4611
|
+
throw new _r(n, {
|
|
4596
4612
|
code: e,
|
|
4597
4613
|
path: t
|
|
4598
4614
|
});
|
|
4599
4615
|
}
|
|
4600
4616
|
function z(e, t, n, r) {
|
|
4601
|
-
e ||
|
|
4617
|
+
e || xr(t, n, r);
|
|
4602
4618
|
}
|
|
4603
4619
|
function B(e, t) {
|
|
4604
4620
|
z(w(e), "invalid_type", t, "expected an object");
|
|
@@ -4630,13 +4646,13 @@ function J(e, t) {
|
|
|
4630
4646
|
function Y(e, t, n = yn) {
|
|
4631
4647
|
B(e, t), q(e.type, ["plain_text", "mrkdwn"], `${t}.type`), H(e.text, `${t}.text`, { max: n }), e.type === "plain_text" ? (G(e.emoji, `${t}.emoji`), z(e.verbatim === void 0, "invalid_value", `${t}.verbatim`, "verbatim is only legal on mrkdwn text")) : (G(e.verbatim, `${t}.verbatim`), z(e.emoji === void 0, "invalid_value", `${t}.emoji`, "emoji is only legal on plain_text"));
|
|
4632
4648
|
}
|
|
4633
|
-
function
|
|
4649
|
+
function Sr(e, t = "text", n = yn) {
|
|
4634
4650
|
Y(e, t, n);
|
|
4635
4651
|
}
|
|
4636
4652
|
function X(e, t, n = yn) {
|
|
4637
4653
|
Y(e, t, n), z(w(e) && e.type === "plain_text", "invalid_value", `${t}.type`, "expected \"plain_text\"");
|
|
4638
4654
|
}
|
|
4639
|
-
function
|
|
4655
|
+
function Cr(e, t) {
|
|
4640
4656
|
B(e, t);
|
|
4641
4657
|
let n = e.id !== void 0, r = e.url !== void 0;
|
|
4642
4658
|
z(n !== r, "invalid_value", t, "must contain exactly one of id or url"), n && H(e.id, `${t}.id`), r && H(e.url, `${t}.url`, { max: Sn });
|
|
@@ -4644,50 +4660,50 @@ function xr(e, t) {
|
|
|
4644
4660
|
function Z(e, t) {
|
|
4645
4661
|
B(e, t), K(e, "image", t), H(e.alt_text, `${t}.alt_text`, { max: Cn });
|
|
4646
4662
|
let n = e.image_url !== void 0, r = e.slack_file !== void 0;
|
|
4647
|
-
z(n !== r, "invalid_value", t, "must contain exactly one of image_url or slack_file"), n && H(e.image_url, `${t}.image_url`, { max: Sn }), r &&
|
|
4663
|
+
z(n !== r, "invalid_value", t, "must contain exactly one of image_url or slack_file"), n && H(e.image_url, `${t}.image_url`, { max: Sn }), r && Cr(e.slack_file, `${t}.slack_file`);
|
|
4648
4664
|
}
|
|
4649
|
-
function
|
|
4665
|
+
function wr(e, t = "element") {
|
|
4650
4666
|
Z(e, t);
|
|
4651
4667
|
}
|
|
4652
|
-
function
|
|
4668
|
+
function Tr(e, t) {
|
|
4653
4669
|
B(e, t), Y(e.text, `${t}.text`, 75), U(e.value, `${t}.value`, { max: 75 }), U(e.url, `${t}.url`, { max: En }), e.description !== void 0 && X(e.description, `${t}.description`, 75);
|
|
4654
4670
|
}
|
|
4655
|
-
function
|
|
4671
|
+
function Er(e, t, n) {
|
|
4656
4672
|
V(e, t), z(e.length > 0, "missing_field", t, "must contain at least one option"), z(e.length <= n, "limit_exceeded", t, `must contain at most ${String(n)} options`), e.forEach((e, n) => {
|
|
4657
|
-
|
|
4673
|
+
Tr(e, `${t}[${String(n)}]`);
|
|
4658
4674
|
});
|
|
4659
4675
|
}
|
|
4660
|
-
function
|
|
4676
|
+
function Dr(e, t) {
|
|
4661
4677
|
U(e.action_id, `${t}.action_id`, { max: 255 });
|
|
4662
4678
|
}
|
|
4663
|
-
function
|
|
4679
|
+
function Or(e, t) {
|
|
4664
4680
|
e.placeholder !== void 0 && X(e.placeholder, `${t}.placeholder`, 150);
|
|
4665
4681
|
}
|
|
4666
|
-
function
|
|
4667
|
-
B(e, t), K(e, "button", t),
|
|
4682
|
+
function kr(e, t) {
|
|
4683
|
+
B(e, t), K(e, "button", t), Dr(e, t), X(e.text, `${t}.text`, 75), U(e.url, `${t}.url`, { max: En }), U(e.value, `${t}.value`, { max: Dn }), U(e.accessibility_label, `${t}.accessibility_label`, { max: 75 }), e.style !== void 0 && q(e.style, ["primary", "danger"], `${t}.style`);
|
|
4668
4684
|
}
|
|
4669
|
-
function
|
|
4685
|
+
function Ar(e, t) {
|
|
4670
4686
|
let n = e.options !== void 0, r = e.option_groups !== void 0;
|
|
4671
|
-
z(n !== r, "invalid_value", t, "must contain exactly one of options or option_groups"), n &&
|
|
4687
|
+
z(n !== r, "invalid_value", t, "must contain exactly one of options or option_groups"), n && Er(e.options, `${t}.options`, 100), r && (V(e.option_groups, `${t}.option_groups`), z(e.option_groups.length <= 100, "limit_exceeded", `${t}.option_groups`, "must contain at most 100 groups"), e.option_groups.forEach((e, n) => {
|
|
4672
4688
|
let r = `${t}.option_groups[${String(n)}]`;
|
|
4673
|
-
B(e, r), X(e.label, `${r}.label`, 75),
|
|
4689
|
+
B(e, r), X(e.label, `${r}.label`, 75), Er(e.options, `${r}.options`, 100);
|
|
4674
4690
|
}));
|
|
4675
4691
|
}
|
|
4676
|
-
function
|
|
4677
|
-
switch (B(e, t), H(e.type, `${t}.type`),
|
|
4692
|
+
function jr(e, t) {
|
|
4693
|
+
switch (B(e, t), H(e.type, `${t}.type`), Dr(e, t), Or(e, t), e.type) {
|
|
4678
4694
|
case "button":
|
|
4679
|
-
|
|
4695
|
+
kr(e, t);
|
|
4680
4696
|
return;
|
|
4681
4697
|
case "checkboxes":
|
|
4682
4698
|
case "radio_buttons":
|
|
4683
|
-
|
|
4699
|
+
Er(e.options, `${t}.options`, 10);
|
|
4684
4700
|
return;
|
|
4685
4701
|
case "overflow":
|
|
4686
|
-
|
|
4702
|
+
Er(e.options, `${t}.options`, 5);
|
|
4687
4703
|
return;
|
|
4688
4704
|
case "static_select":
|
|
4689
4705
|
case "multi_static_select":
|
|
4690
|
-
|
|
4706
|
+
Ar(e, t);
|
|
4691
4707
|
return;
|
|
4692
4708
|
case "external_select":
|
|
4693
4709
|
case "multi_external_select":
|
|
@@ -4733,13 +4749,13 @@ function kr(e, t) {
|
|
|
4733
4749
|
case "workflow_button":
|
|
4734
4750
|
X(e.text, `${t}.text`, 75), B(e.workflow, `${t}.workflow`), B(e.workflow.trigger, `${t}.workflow.trigger`), H(e.workflow.trigger.url, `${t}.workflow.trigger.url`);
|
|
4735
4751
|
return;
|
|
4736
|
-
default:
|
|
4752
|
+
default: xr("unsupported_element", `${t}.type`, `unsupported element "${e.type}"`);
|
|
4737
4753
|
}
|
|
4738
4754
|
}
|
|
4739
|
-
function
|
|
4740
|
-
|
|
4755
|
+
function Mr(e, t = "element") {
|
|
4756
|
+
jr(e, t);
|
|
4741
4757
|
}
|
|
4742
|
-
function
|
|
4758
|
+
function Nr(e, t) {
|
|
4743
4759
|
if (e !== void 0) {
|
|
4744
4760
|
B(e, t);
|
|
4745
4761
|
for (let n of [
|
|
@@ -4751,8 +4767,8 @@ function jr(e, t) {
|
|
|
4751
4767
|
]) G(e[n], `${t}.${n}`);
|
|
4752
4768
|
}
|
|
4753
4769
|
}
|
|
4754
|
-
function
|
|
4755
|
-
switch (B(e, t), H(e.type, `${t}.type`),
|
|
4770
|
+
function Pr(e, t) {
|
|
4771
|
+
switch (B(e, t), H(e.type, `${t}.type`), Nr(e.style, `${t}.style`), e.type) {
|
|
4756
4772
|
case "text":
|
|
4757
4773
|
H(e.text, `${t}.text`, { allowEmpty: !0 });
|
|
4758
4774
|
return;
|
|
@@ -4806,12 +4822,12 @@ function Mr(e, t) {
|
|
|
4806
4822
|
case "workflow_mention":
|
|
4807
4823
|
z(Object.keys(e).length > 1, "missing_field", t, `${e.type} must contain its reference fields`);
|
|
4808
4824
|
return;
|
|
4809
|
-
default:
|
|
4825
|
+
default: xr("unsupported_element", `${t}.type`, `unsupported rich text element "${e.type}"`);
|
|
4810
4826
|
}
|
|
4811
4827
|
}
|
|
4812
|
-
function
|
|
4828
|
+
function Fr(e, t) {
|
|
4813
4829
|
V(e, t), e.forEach((e, n) => {
|
|
4814
|
-
|
|
4830
|
+
Pr(e, `${t}[${String(n)}]`);
|
|
4815
4831
|
});
|
|
4816
4832
|
}
|
|
4817
4833
|
function Q(e, t) {
|
|
@@ -4820,7 +4836,7 @@ function Q(e, t) {
|
|
|
4820
4836
|
switch (B(e, r), H(e.type, `${r}.type`), e.type) {
|
|
4821
4837
|
case "rich_text_section":
|
|
4822
4838
|
case "rich_text_quote":
|
|
4823
|
-
|
|
4839
|
+
Fr(e.elements, `${r}.elements`);
|
|
4824
4840
|
return;
|
|
4825
4841
|
case "rich_text_list":
|
|
4826
4842
|
q(e.style, ["bullet", "ordered"], `${r}.style`), e.indent !== void 0 && W(e.indent, `${r}.indent`, {
|
|
@@ -4832,25 +4848,25 @@ function Q(e, t) {
|
|
|
4832
4848
|
min: 0
|
|
4833
4849
|
}), V(e.elements, `${r}.elements`), e.elements.forEach((e, t) => {
|
|
4834
4850
|
let n = `${r}.elements[${String(t)}]`;
|
|
4835
|
-
B(e, n), K(e, "rich_text_section", n),
|
|
4851
|
+
B(e, n), K(e, "rich_text_section", n), Fr(e.elements, `${n}.elements`);
|
|
4836
4852
|
});
|
|
4837
4853
|
return;
|
|
4838
4854
|
case "rich_text_preformatted":
|
|
4839
|
-
|
|
4855
|
+
Fr(e.elements, `${r}.elements`), U(e.language, `${r}.language`);
|
|
4840
4856
|
return;
|
|
4841
|
-
default:
|
|
4857
|
+
default: xr("unsupported_element", `${r}.type`, `unsupported rich text container "${e.type}"`);
|
|
4842
4858
|
}
|
|
4843
4859
|
});
|
|
4844
4860
|
}
|
|
4845
|
-
function
|
|
4861
|
+
function Ir(e, t = "block") {
|
|
4846
4862
|
Q(e, t);
|
|
4847
4863
|
}
|
|
4848
|
-
function
|
|
4864
|
+
function Lr(e, t) {
|
|
4849
4865
|
B(e, t), K(e, "section", t), J(e, t);
|
|
4850
4866
|
let n = e.text !== void 0, r = e.fields !== void 0;
|
|
4851
4867
|
z(n || r, "missing_field", t, "requires text or fields"), n && Y(e.text, `${t}.text`, bn), r && (V(e.fields, `${t}.fields`), z(e.fields.length > 0 && e.fields.length <= 10, "limit_exceeded", `${t}.fields`, "must contain 1–10 text objects"), e.fields.forEach((e, n) => {
|
|
4852
4868
|
Y(e, `${t}.fields[${String(n)}]`, xn);
|
|
4853
|
-
})), e.accessory !== void 0 && (B(e.accessory, `${t}.accessory`), e.accessory.type === "image" ? Z(e.accessory, `${t}.accessory`) : (
|
|
4869
|
+
})), e.accessory !== void 0 && (B(e.accessory, `${t}.accessory`), e.accessory.type === "image" ? Z(e.accessory, `${t}.accessory`) : (jr(e.accessory, `${t}.accessory`), z(![
|
|
4854
4870
|
"datetimepicker",
|
|
4855
4871
|
"file_input",
|
|
4856
4872
|
"plain_text_input",
|
|
@@ -4860,26 +4876,26 @@ function Fr(e, t) {
|
|
|
4860
4876
|
"rich_text_input"
|
|
4861
4877
|
].includes(String(e.accessory.type)), "invalid_value", `${t}.accessory.type`, "element is not legal as a section accessory"))), G(e.expand, `${t}.expand`);
|
|
4862
4878
|
}
|
|
4863
|
-
function
|
|
4879
|
+
function Rr(e, t) {
|
|
4864
4880
|
B(e, t), K(e, "header", t), J(e, t), X(e.text, `${t}.text`, 150), e.level !== void 0 && W(e.level, `${t}.level`, {
|
|
4865
4881
|
integer: !0,
|
|
4866
4882
|
min: 1,
|
|
4867
4883
|
max: 4
|
|
4868
4884
|
});
|
|
4869
4885
|
}
|
|
4870
|
-
function
|
|
4886
|
+
function zr(e, t) {
|
|
4871
4887
|
Z(e, t), B(e, t), J(e, t), e.title !== void 0 && X(e.title, `${t}.title`, wn);
|
|
4872
4888
|
}
|
|
4873
|
-
function
|
|
4889
|
+
function Br(e, t) {
|
|
4874
4890
|
B(e, t), K(e, "context", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 10, "limit_exceeded", `${t}.elements`, "must contain 1–10 elements"), e.elements.forEach((e, n) => {
|
|
4875
4891
|
let r = `${t}.elements[${String(n)}]`;
|
|
4876
4892
|
B(e, r), e.type === "image" ? Z(e, r) : Y(e, r);
|
|
4877
4893
|
});
|
|
4878
4894
|
}
|
|
4879
|
-
function
|
|
4895
|
+
function Vr(e, t) {
|
|
4880
4896
|
B(e, t), K(e, "actions", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 25, "limit_exceeded", `${t}.elements`, "must contain 1–25 elements"), e.elements.forEach((e, n) => {
|
|
4881
4897
|
let r = `${t}.elements[${String(n)}]`;
|
|
4882
|
-
|
|
4898
|
+
jr(e, r), B(e, r), z([
|
|
4883
4899
|
"button",
|
|
4884
4900
|
"checkboxes",
|
|
4885
4901
|
"datepicker",
|
|
@@ -4902,8 +4918,8 @@ function zr(e, t) {
|
|
|
4902
4918
|
].includes(String(e.type)), "invalid_value", `${r}.type`, "element is not legal inside an actions block");
|
|
4903
4919
|
});
|
|
4904
4920
|
}
|
|
4905
|
-
function
|
|
4906
|
-
B(e, n), K(e, "input", n), J(e, n), z(t !== "message", "surface_mismatch", n, "input blocks are only legal on modal and home surfaces"), X(e.label, `${n}.label`, 2e3), e.hint !== void 0 && X(e.hint, `${n}.hint`, 2e3), G(e.optional, `${n}.optional`), G(e.dispatch_action, `${n}.dispatch_action`),
|
|
4921
|
+
function Hr(e, t, n) {
|
|
4922
|
+
B(e, n), K(e, "input", n), J(e, n), z(t !== "message", "surface_mismatch", n, "input blocks are only legal on modal and home surfaces"), X(e.label, `${n}.label`, 2e3), e.hint !== void 0 && X(e.hint, `${n}.hint`, 2e3), G(e.optional, `${n}.optional`), G(e.dispatch_action, `${n}.dispatch_action`), jr(e.element, `${n}.element`), B(e.element, `${n}.element`), z(![
|
|
4907
4923
|
"button",
|
|
4908
4924
|
"overflow",
|
|
4909
4925
|
"workflow_button",
|
|
@@ -4911,7 +4927,7 @@ function Br(e, t, n) {
|
|
|
4911
4927
|
"feedback_buttons"
|
|
4912
4928
|
].includes(String(e.element.type)), "invalid_value", `${n}.element.type`, "element is not legal inside an input block"), z(!(e.dispatch_action === !0 && e.element.type === "file_input"), "invalid_value", `${n}.dispatch_action`, "dispatch_action is incompatible with file_input");
|
|
4913
4929
|
}
|
|
4914
|
-
function
|
|
4930
|
+
function Ur(e) {
|
|
4915
4931
|
if (!w(e)) return 0;
|
|
4916
4932
|
if (e.type === "raw_text") return typeof e.text == "string" ? e.text.length : 0;
|
|
4917
4933
|
if (e.type === "raw_number") return typeof e.text == "string" ? e.text.length : typeof e.value == "number" ? String(e.value).length : 0;
|
|
@@ -4922,7 +4938,7 @@ function Vr(e) {
|
|
|
4922
4938
|
}
|
|
4923
4939
|
return 0;
|
|
4924
4940
|
}
|
|
4925
|
-
function
|
|
4941
|
+
function Wr(e, t, n) {
|
|
4926
4942
|
switch (B(e, t), H(e.type, `${t}.type`), e.type) {
|
|
4927
4943
|
case "raw_text":
|
|
4928
4944
|
H(e.text, `${t}.text`);
|
|
@@ -4933,21 +4949,21 @@ function Hr(e, t, n) {
|
|
|
4933
4949
|
case "rich_text":
|
|
4934
4950
|
z(n, "invalid_value", t, "rich_text is not legal in this row"), Q(e, t);
|
|
4935
4951
|
return;
|
|
4936
|
-
default:
|
|
4952
|
+
default: xr("invalid_value", `${t}.type`, `unsupported table cell "${e.type}"`);
|
|
4937
4953
|
}
|
|
4938
4954
|
}
|
|
4939
|
-
function
|
|
4955
|
+
function Gr(e, t, n, r, i) {
|
|
4940
4956
|
V(e, t), z(e.length > 0, "missing_field", t, "must contain at least one row"), z(e.length <= n, "limit_exceeded", t, `must contain at most ${String(n)} rows`);
|
|
4941
4957
|
let a, o = 0;
|
|
4942
4958
|
return e.forEach((e, n) => {
|
|
4943
4959
|
let r = `${t}[${String(n)}]`;
|
|
4944
4960
|
V(e, r), z(e.length > 0 && e.length <= 20, "limit_exceeded", r, "must contain 1–20 cells"), a === void 0 ? a = e.length : z(e.length === a, "invalid_value", r, "all table rows must contain the same number of cells"), e.forEach((e, t) => {
|
|
4945
|
-
|
|
4961
|
+
Wr(e, `${r}[${String(t)}]`, i || n !== 0), o += Ur(e);
|
|
4946
4962
|
});
|
|
4947
4963
|
}), z(o <= r, "limit_exceeded", t, `cell content must contain at most ${String(r)} characters`), a ?? 0;
|
|
4948
4964
|
}
|
|
4949
|
-
function
|
|
4950
|
-
B(e, t), K(e, "table", t), J(e, t),
|
|
4965
|
+
function Kr(e, t) {
|
|
4966
|
+
B(e, t), K(e, "table", t), J(e, t), Gr(e.rows, `${t}.rows`, 100, On, !0), e.column_settings !== void 0 && (V(e.column_settings, `${t}.column_settings`), z(e.column_settings.length <= 20, "limit_exceeded", `${t}.column_settings`, "must contain at most 20 entries"), e.column_settings.forEach((e, n) => {
|
|
4951
4967
|
if (e === null) return;
|
|
4952
4968
|
let r = `${t}.column_settings[${String(n)}]`;
|
|
4953
4969
|
B(e, r), e.align !== void 0 && q(e.align, [
|
|
@@ -4957,9 +4973,9 @@ function Wr(e, t) {
|
|
|
4957
4973
|
], `${r}.align`), G(e.is_wrapped, `${r}.is_wrapped`);
|
|
4958
4974
|
}));
|
|
4959
4975
|
}
|
|
4960
|
-
function
|
|
4976
|
+
function qr(e, t) {
|
|
4961
4977
|
B(e, t), K(e, "data_table", t), J(e, t), H(e.caption, `${t}.caption`);
|
|
4962
|
-
let n =
|
|
4978
|
+
let n = Gr(e.rows, `${t}.rows`, 201, kn, !1);
|
|
4963
4979
|
V(e.rows, `${t}.rows`), z(e.rows.length >= 2, "invalid_value", `${t}.rows`, "requires a header row and at least one data row"), e.page_size !== void 0 && W(e.page_size, `${t}.page_size`, {
|
|
4964
4980
|
integer: !0,
|
|
4965
4981
|
min: 1,
|
|
@@ -4970,7 +4986,7 @@ function Gr(e, t) {
|
|
|
4970
4986
|
max: n - 1
|
|
4971
4987
|
});
|
|
4972
4988
|
}
|
|
4973
|
-
function
|
|
4989
|
+
function Jr(e, t) {
|
|
4974
4990
|
if (B(e, t), K(e, "data_visualization", t), J(e, t), H(e.title, `${t}.title`, { max: 50 }), B(e.chart, `${t}.chart`), H(e.chart.type, `${t}.chart.type`), e.chart.type === "pie") {
|
|
4975
4991
|
V(e.chart.segments, `${t}.chart.segments`), z(e.chart.segments.length > 0 && e.chart.segments.length <= 12, "limit_exceeded", `${t}.chart.segments`, "must contain 1–12 segments"), e.chart.segments.forEach((e, n) => {
|
|
4976
4992
|
let r = `${t}.chart.segments[${String(n)}]`;
|
|
@@ -4999,20 +5015,20 @@ function Kr(e, t) {
|
|
|
4999
5015
|
});
|
|
5000
5016
|
});
|
|
5001
5017
|
}
|
|
5002
|
-
function
|
|
5018
|
+
function Yr(e, t) {
|
|
5003
5019
|
B(e, t), K(e, "card", t), J(e, t), z(e.hero_image !== void 0 || e.title !== void 0 || e.actions !== void 0 || e.body !== void 0, "missing_field", t, "requires at least one of hero_image, title, actions, or body"), e.hero_image !== void 0 && Z(e.hero_image, `${t}.hero_image`), e.icon !== void 0 && Z(e.icon, `${t}.icon`), z(!(e.icon !== void 0 && e.slack_icon !== void 0), "invalid_value", t, "icon and slack_icon are mutually exclusive"), e.slack_icon !== void 0 && (B(e.slack_icon, `${t}.slack_icon`), K(e.slack_icon, "icon", `${t}.slack_icon`), H(e.slack_icon.name, `${t}.slack_icon.name`));
|
|
5004
5020
|
for (let n of ["title", "subtitle"]) e[n] !== void 0 && Y(e[n], `${t}.${n}`, 150);
|
|
5005
5021
|
for (let n of ["body", "subtext"]) e[n] !== void 0 && Y(e[n], `${t}.${n}`, 200);
|
|
5006
5022
|
e.actions !== void 0 && (V(e.actions, `${t}.actions`), z(e.actions.length > 0 && e.actions.length <= 3, "limit_exceeded", `${t}.actions`, "must contain 1–3 buttons"), e.actions.forEach((e, n) => {
|
|
5007
|
-
|
|
5023
|
+
kr(e, `${t}.actions[${String(n)}]`);
|
|
5008
5024
|
}));
|
|
5009
5025
|
}
|
|
5010
|
-
function
|
|
5026
|
+
function Xr(e, t) {
|
|
5011
5027
|
B(e, t), K(e, "carousel", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 10, "limit_exceeded", `${t}.elements`, "must contain 1–10 cards"), e.elements.forEach((e, n) => {
|
|
5012
|
-
|
|
5028
|
+
Yr(e, `${t}.elements[${String(n)}]`);
|
|
5013
5029
|
});
|
|
5014
5030
|
}
|
|
5015
|
-
function
|
|
5031
|
+
function Zr(e, t, n) {
|
|
5016
5032
|
B(e, n), K(e, "alert", n), J(e, n), z(t === "modal", "surface_mismatch", n, "alert blocks are only legal on modal surfaces"), Y(e.text, `${n}.text`, 200), e.level !== void 0 && q(e.level, [
|
|
5017
5033
|
"default",
|
|
5018
5034
|
"info",
|
|
@@ -5021,10 +5037,10 @@ function Yr(e, t, n) {
|
|
|
5021
5037
|
"success"
|
|
5022
5038
|
], `${n}.level`);
|
|
5023
5039
|
}
|
|
5024
|
-
function
|
|
5040
|
+
function Qr(e, t) {
|
|
5025
5041
|
B(e, t), K(e, "context_actions", t), J(e, t), V(e.elements, `${t}.elements`), z(e.elements.length > 0 && e.elements.length <= 5, "limit_exceeded", `${t}.elements`, "must contain 1–5 elements"), e.elements.forEach((e, n) => {
|
|
5026
5042
|
let r = `${t}.elements[${String(n)}]`;
|
|
5027
|
-
if (B(e, r),
|
|
5043
|
+
if (B(e, r), Dr(e, r), e.type === "icon_button") {
|
|
5028
5044
|
q(e.icon, ["trash"], `${r}.icon`), X(e.text, `${r}.text`, 75), U(e.value, `${r}.value`, { max: Dn });
|
|
5029
5045
|
return;
|
|
5030
5046
|
}
|
|
@@ -5035,7 +5051,7 @@ function Xr(e, t) {
|
|
|
5035
5051
|
}
|
|
5036
5052
|
});
|
|
5037
5053
|
}
|
|
5038
|
-
function
|
|
5054
|
+
function $r(e, t) {
|
|
5039
5055
|
B(e, t), K(e, "task_card", t), J(e, t), H(e.task_id, `${t}.task_id`), H(e.title, `${t}.title`), q(e.status, [
|
|
5040
5056
|
"pending",
|
|
5041
5057
|
"in_progress",
|
|
@@ -5046,12 +5062,12 @@ function Zr(e, t) {
|
|
|
5046
5062
|
B(e, r), K(e, "url", r), H(e.url, `${r}.url`), H(e.text, `${r}.text`);
|
|
5047
5063
|
}));
|
|
5048
5064
|
}
|
|
5049
|
-
function
|
|
5065
|
+
function ei(e, t) {
|
|
5050
5066
|
B(e, t), K(e, "plan", t), J(e, t), H(e.title, `${t}.title`), e.tasks !== void 0 && (V(e.tasks, `${t}.tasks`), e.tasks.forEach((e, n) => {
|
|
5051
|
-
|
|
5067
|
+
$r(e, `${t}.tasks[${String(n)}]`);
|
|
5052
5068
|
}));
|
|
5053
5069
|
}
|
|
5054
|
-
function
|
|
5070
|
+
function ti(e, t) {
|
|
5055
5071
|
B(e, t), K(e, "container", t), J(e, t), z(e.title !== void 0 || e.rich_text_title !== void 0, "missing_field", t, "requires title or rich_text_title"), e.title !== void 0 && X(e.title, `${t}.title`, 150), e.rich_text_title !== void 0 && Q(e.rich_text_title, `${t}.rich_text_title`), e.subtitle !== void 0 && X(e.subtitle, `${t}.subtitle`, 150), e.icon !== void 0 && Z(e.icon, `${t}.icon`), e.width !== void 0 && q(e.width, [
|
|
5056
5072
|
"narrow",
|
|
5057
5073
|
"standard",
|
|
@@ -5073,122 +5089,122 @@ function $r(e, t) {
|
|
|
5073
5089
|
];
|
|
5074
5090
|
e.child_blocks.forEach((e, r) => {
|
|
5075
5091
|
let i = `${t}.child_blocks[${String(r)}]`;
|
|
5076
|
-
B(e, i), H(e.type, `${i}.type`), z(n.includes(e.type), "invalid_value", `${i}.type`, `"${e.type}" is not legal inside a container`),
|
|
5092
|
+
B(e, i), H(e.type, `${i}.type`), z(n.includes(e.type), "invalid_value", `${i}.type`, `"${e.type}" is not legal inside a container`), ii(e, "message", i);
|
|
5077
5093
|
});
|
|
5078
5094
|
}
|
|
5079
|
-
function
|
|
5095
|
+
function ni(e, t) {
|
|
5080
5096
|
B(e, t), K(e, "file", t), J(e, t), z(e.source === "remote", "invalid_value", `${t}.source`, "expected \"remote\""), H(e.external_id, `${t}.external_id`);
|
|
5081
5097
|
}
|
|
5082
|
-
function
|
|
5098
|
+
function ri(e, t) {
|
|
5083
5099
|
B(e, t), K(e, "video", t), J(e, t), H(e.video_url, `${t}.video_url`), H(e.thumbnail_url, `${t}.thumbnail_url`), H(e.alt_text, `${t}.alt_text`, { max: Cn }), X(e.title, `${t}.title`, 199), e.description !== void 0 && X(e.description, `${t}.description`, 199), U(e.author_name, `${t}.author_name`, { max: 49 });
|
|
5084
5100
|
}
|
|
5085
5101
|
function $(e, t, n) {
|
|
5086
5102
|
z(e === "message", "surface_mismatch", t, `${n} blocks are only documented for message surfaces`);
|
|
5087
5103
|
}
|
|
5088
|
-
function
|
|
5104
|
+
function ii(e, t = "message", n = "block") {
|
|
5089
5105
|
switch (B(e, n), J(e, n), e.type) {
|
|
5090
5106
|
case "actions":
|
|
5091
|
-
|
|
5107
|
+
Vr(e, n);
|
|
5092
5108
|
return;
|
|
5093
5109
|
case "alert":
|
|
5094
|
-
|
|
5110
|
+
Zr(e, t, n);
|
|
5095
5111
|
return;
|
|
5096
5112
|
case "card":
|
|
5097
|
-
$(t, n, e.type),
|
|
5113
|
+
$(t, n, e.type), Yr(e, n);
|
|
5098
5114
|
return;
|
|
5099
5115
|
case "carousel":
|
|
5100
|
-
$(t, n, e.type),
|
|
5116
|
+
$(t, n, e.type), Xr(e, n);
|
|
5101
5117
|
return;
|
|
5102
5118
|
case "container":
|
|
5103
|
-
$(t, n, e.type),
|
|
5119
|
+
$(t, n, e.type), ti(e, n);
|
|
5104
5120
|
return;
|
|
5105
5121
|
case "context":
|
|
5106
|
-
|
|
5122
|
+
Br(e, n);
|
|
5107
5123
|
return;
|
|
5108
5124
|
case "context_actions":
|
|
5109
|
-
$(t, n, e.type),
|
|
5125
|
+
$(t, n, e.type), Qr(e, n);
|
|
5110
5126
|
return;
|
|
5111
5127
|
case "data_table":
|
|
5112
|
-
$(t, n, e.type),
|
|
5128
|
+
$(t, n, e.type), qr(e, n);
|
|
5113
5129
|
return;
|
|
5114
5130
|
case "data_visualization":
|
|
5115
|
-
$(t, n, e.type),
|
|
5131
|
+
$(t, n, e.type), Jr(e, n);
|
|
5116
5132
|
return;
|
|
5117
5133
|
case "divider":
|
|
5118
5134
|
K(e, "divider", n);
|
|
5119
5135
|
return;
|
|
5120
5136
|
case "file":
|
|
5121
|
-
$(t, n, e.type),
|
|
5137
|
+
$(t, n, e.type), ni(e, n);
|
|
5122
5138
|
return;
|
|
5123
5139
|
case "header":
|
|
5124
|
-
|
|
5140
|
+
Rr(e, n);
|
|
5125
5141
|
return;
|
|
5126
5142
|
case "image":
|
|
5127
|
-
|
|
5143
|
+
zr(e, n);
|
|
5128
5144
|
return;
|
|
5129
5145
|
case "input":
|
|
5130
|
-
|
|
5146
|
+
Hr(e, t, n);
|
|
5131
5147
|
return;
|
|
5132
5148
|
case "markdown":
|
|
5133
5149
|
$(t, n, e.type), H(e.text, `${n}.text`, { max: Tn });
|
|
5134
5150
|
return;
|
|
5135
5151
|
case "plan":
|
|
5136
|
-
$(t, n, e.type),
|
|
5152
|
+
$(t, n, e.type), ei(e, n);
|
|
5137
5153
|
return;
|
|
5138
5154
|
case "rich_text":
|
|
5139
5155
|
Q(e, n);
|
|
5140
5156
|
return;
|
|
5141
5157
|
case "section":
|
|
5142
|
-
|
|
5158
|
+
Lr(e, n);
|
|
5143
5159
|
return;
|
|
5144
5160
|
case "table":
|
|
5145
|
-
$(t, n, e.type),
|
|
5161
|
+
$(t, n, e.type), Kr(e, n);
|
|
5146
5162
|
return;
|
|
5147
5163
|
case "task_card":
|
|
5148
|
-
$(t, n, e.type),
|
|
5164
|
+
$(t, n, e.type), $r(e, n);
|
|
5149
5165
|
return;
|
|
5150
5166
|
case "video":
|
|
5151
|
-
|
|
5167
|
+
ri(e, n);
|
|
5152
5168
|
return;
|
|
5153
|
-
default:
|
|
5169
|
+
default: xr("unsupported_block", `${n}.type`, `unsupported block "${String(e.type)}"`);
|
|
5154
5170
|
}
|
|
5155
5171
|
}
|
|
5156
|
-
function
|
|
5157
|
-
|
|
5172
|
+
function ai(e, t, n = "message", r = "block") {
|
|
5173
|
+
ii(e, n, r), z(e.type === t, "invalid_value", `${r}.type`, `expected "${t}"`);
|
|
5158
5174
|
}
|
|
5159
|
-
function
|
|
5175
|
+
function oi(e, t) {
|
|
5160
5176
|
return Array.isArray(e) ? e : (B(e, t), V(e.blocks, `${t}.blocks`), e.blocks);
|
|
5161
5177
|
}
|
|
5162
|
-
function
|
|
5163
|
-
let r = Array.isArray(e) ? n : `${n}.blocks`, i =
|
|
5178
|
+
function si(e, t = "message", n = "data") {
|
|
5179
|
+
let r = Array.isArray(e) ? n : `${n}.blocks`, i = oi(e, n), a = t === "message" ? 50 : 100;
|
|
5164
5180
|
z(i.length <= a, "limit_exceeded", r, `${t} surfaces accept at most ${String(a)} blocks`);
|
|
5165
5181
|
let o = 0, s = 0, c = 0, l = /* @__PURE__ */ new Set();
|
|
5166
5182
|
i.forEach((e, n) => {
|
|
5167
5183
|
let i = `${r}[${String(n)}]`;
|
|
5168
|
-
if (
|
|
5169
|
-
else if (e.type === "table") for (let t of e.rows) for (let e of t) s +=
|
|
5170
|
-
else if (e.type === "data_table") for (let t of e.rows) for (let e of t) c +=
|
|
5184
|
+
if (ii(e, t, i), e.block_id !== void 0 && (z(!l.has(e.block_id), "duplicate_id", `${i}.block_id`, `"${e.block_id}" is already used in this payload`), l.add(e.block_id)), e.type === "markdown") o += e.text.length;
|
|
5185
|
+
else if (e.type === "table") for (let t of e.rows) for (let e of t) s += Ur(e);
|
|
5186
|
+
else if (e.type === "data_table") for (let t of e.rows) for (let e of t) c += Ur(e);
|
|
5171
5187
|
}), z(o <= Tn, "limit_exceeded", r, `markdown blocks exceed the cumulative ${String(Tn)} character limit`), z(s <= On, "limit_exceeded", r, `table cells exceed the cumulative ${String(On)} character limit`), z(c <= kn, "limit_exceeded", r, `data_table cells exceed the cumulative ${String(kn)} character limit`);
|
|
5172
5188
|
}
|
|
5173
|
-
function
|
|
5189
|
+
function ci(e, t = "message") {
|
|
5174
5190
|
let n = e;
|
|
5175
5191
|
if (typeof e == "string") try {
|
|
5176
5192
|
n = JSON.parse(e);
|
|
5177
5193
|
} catch {
|
|
5178
|
-
throw new
|
|
5194
|
+
throw new _r("expected valid JSON", {
|
|
5179
5195
|
code: "invalid_json",
|
|
5180
5196
|
path: "data"
|
|
5181
5197
|
});
|
|
5182
5198
|
}
|
|
5183
|
-
return
|
|
5199
|
+
return si(n, t), n;
|
|
5184
5200
|
}
|
|
5185
|
-
function
|
|
5186
|
-
return
|
|
5201
|
+
function li(e) {
|
|
5202
|
+
return ui(e) ? e.blocks : e;
|
|
5187
5203
|
}
|
|
5188
|
-
function
|
|
5204
|
+
function ui(e) {
|
|
5189
5205
|
return !Array.isArray(e);
|
|
5190
5206
|
}
|
|
5191
5207
|
//#endregion
|
|
5192
|
-
export { rr as ActionsBlock, hn as AlertBlock, ur as Block,
|
|
5208
|
+
export { rr as ActionsBlock, hn as AlertBlock, ur as Block, br as BlockKit, _r as BlockKitInvariantError, b as BlockKitProvider, lt as ButtonElement, fn as CardBlock, mn as CarouselBlock, pt as ChoiceGroup, hr as ContainerBlock, or as ContextActionsBlock, Qt as ContextBlock, un as DataTableBlock, $n as DataVisualizationBlock, Yt as DividerBlock, tn as FileBlock, Jt as HeaderBlock, Xt as ImageBlock, F as ImageElement, ir as InputBlock, Et as InputElement, Dt as InteractiveElement, Gt as Markdown, en as MarkdownBlock, I as Mrkdwn, ut as OverflowElement, vn as PlanBlock, N as RichText, $t as RichTextBlock, qt as SectionBlock, xt as SelectElement, sn as TableBlock, an as TableCell, gn as TaskCardBlock, L as Text, nn as VideoBlock, si as assertBlockKitData, ai as assertBlockType, wr as assertImageElementData, Mr as assertInteractiveElementData, ii as assertRenderableBlock, Ir as assertRichTextBlockData, Sr as assertTextObjectData, li as blocksOf, we as darkTheme, vr as isBlockKitInvariantError, Ce as lightTheme, ci as parseBlockKitData, Vt as tokenizeMarkdown, Ft as tokenizeMrkdwn, Se as tokens, x as useBlockKitContext };
|
|
5193
5209
|
|
|
5194
5210
|
//# sourceMappingURL=index.js.map
|