@prismicio/types-internal 0.3.3 → 1.0.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.
Files changed (94) hide show
  1. package/lib/customtypes/CustomType.d.ts +309 -311
  2. package/lib/customtypes/CustomType.js +6 -6
  3. package/lib/customtypes/Format.d.ts +4 -0
  4. package/lib/customtypes/Format.js +8 -0
  5. package/lib/customtypes/Section.d.ts +309 -309
  6. package/lib/customtypes/widgets/Group.d.ts +22 -23
  7. package/lib/customtypes/widgets/Group.js +2 -2
  8. package/lib/customtypes/widgets/UID.d.ts +1 -2
  9. package/lib/customtypes/widgets/UID.js +2 -2
  10. package/lib/customtypes/widgets/Widget.d.ts +353 -354
  11. package/lib/customtypes/widgets/Widget.js +3 -3
  12. package/lib/customtypes/widgets/WidgetTypes.d.ts +22 -22
  13. package/lib/customtypes/widgets/WidgetTypes.js +22 -23
  14. package/lib/customtypes/widgets/index.d.ts +1 -1
  15. package/lib/customtypes/widgets/index.js +1 -1
  16. package/lib/customtypes/widgets/nestable/BooleanField.d.ts +1 -2
  17. package/lib/customtypes/widgets/nestable/BooleanField.js +2 -2
  18. package/lib/customtypes/widgets/nestable/Color.d.ts +1 -2
  19. package/lib/customtypes/widgets/nestable/Color.js +2 -2
  20. package/lib/customtypes/widgets/nestable/Date.d.ts +1 -2
  21. package/lib/customtypes/widgets/nestable/Date.js +2 -2
  22. package/lib/customtypes/widgets/nestable/Embed.d.ts +1 -2
  23. package/lib/customtypes/widgets/nestable/Embed.js +2 -2
  24. package/lib/customtypes/widgets/nestable/GeoPoint.d.ts +1 -2
  25. package/lib/customtypes/widgets/nestable/GeoPoint.js +2 -2
  26. package/lib/customtypes/widgets/nestable/Image.d.ts +2 -3
  27. package/lib/customtypes/widgets/nestable/Image.js +3 -3
  28. package/lib/customtypes/widgets/nestable/IntegrationField.d.ts +1 -2
  29. package/lib/customtypes/widgets/nestable/IntegrationField.js +2 -2
  30. package/lib/customtypes/widgets/nestable/Link.d.ts +4 -5
  31. package/lib/customtypes/widgets/nestable/Link.js +3 -3
  32. package/lib/customtypes/widgets/nestable/NestableWidget.d.ts +21 -21
  33. package/lib/customtypes/widgets/nestable/Number.d.ts +1 -2
  34. package/lib/customtypes/widgets/nestable/Number.js +2 -2
  35. package/lib/customtypes/widgets/nestable/Range.d.ts +1 -2
  36. package/lib/customtypes/widgets/nestable/Range.js +2 -2
  37. package/lib/customtypes/widgets/nestable/RichText.d.ts +22 -22
  38. package/lib/customtypes/widgets/nestable/RichText.js +38 -39
  39. package/lib/customtypes/widgets/nestable/Select.d.ts +2 -3
  40. package/lib/customtypes/widgets/nestable/Select.js +3 -3
  41. package/lib/customtypes/widgets/nestable/Separator.d.ts +1 -2
  42. package/lib/customtypes/widgets/nestable/Separator.js +2 -2
  43. package/lib/customtypes/widgets/nestable/Text.d.ts +1 -2
  44. package/lib/customtypes/widgets/nestable/Text.js +2 -2
  45. package/lib/customtypes/widgets/nestable/Timestamp.d.ts +1 -2
  46. package/lib/customtypes/widgets/nestable/Timestamp.js +2 -2
  47. package/lib/customtypes/widgets/slices/CompositeSlice.d.ts +43 -44
  48. package/lib/customtypes/widgets/slices/CompositeSlice.js +2 -2
  49. package/lib/customtypes/widgets/slices/LegacySlice.d.ts +43 -43
  50. package/lib/customtypes/widgets/slices/SharedSlice.d.ts +86 -87
  51. package/lib/customtypes/widgets/slices/SharedSlice.js +3 -3
  52. package/lib/customtypes/widgets/slices/SharedSliceRef.d.ts +1 -2
  53. package/lib/customtypes/widgets/slices/SharedSliceRef.js +2 -2
  54. package/lib/customtypes/widgets/slices/Slices.d.ts +529 -531
  55. package/lib/customtypes/widgets/slices/Slices.js +6 -6
  56. package/lib/customtypes/widgets/slices/SlicesTypes.d.ts +5 -5
  57. package/lib/customtypes/widgets/slices/SlicesTypes.js +5 -6
  58. package/lib/customtypes/widgets/slices/index.d.ts +1 -1
  59. package/lib/customtypes/widgets/slices/index.js +1 -1
  60. package/lib/documents/widgets/index.d.ts +1 -0
  61. package/lib/documents/widgets/nestable/Link/index.d.ts +1 -0
  62. package/lib/documents/widgets/nestable/StructuredTextContent/Block.d.ts +16 -17
  63. package/lib/documents/widgets/nestable/StructuredTextContent/Block.js +1 -1
  64. package/package.json +1 -1
  65. package/src/customtypes/CustomType.ts +2 -2
  66. package/src/customtypes/widgets/Group.ts +1 -1
  67. package/src/customtypes/widgets/UID.ts +1 -1
  68. package/src/customtypes/widgets/Widget.ts +1 -1
  69. package/src/customtypes/widgets/WidgetTypes.ts +22 -22
  70. package/src/customtypes/widgets/index.ts +1 -1
  71. package/src/customtypes/widgets/nestable/BooleanField.ts +1 -1
  72. package/src/customtypes/widgets/nestable/Color.ts +1 -1
  73. package/src/customtypes/widgets/nestable/Date.ts +1 -1
  74. package/src/customtypes/widgets/nestable/Embed.ts +1 -1
  75. package/src/customtypes/widgets/nestable/GeoPoint.ts +1 -1
  76. package/src/customtypes/widgets/nestable/Image.ts +2 -2
  77. package/src/customtypes/widgets/nestable/IntegrationField.ts +1 -1
  78. package/src/customtypes/widgets/nestable/Link.ts +4 -4
  79. package/src/customtypes/widgets/nestable/Number.ts +1 -1
  80. package/src/customtypes/widgets/nestable/Range.ts +1 -1
  81. package/src/customtypes/widgets/nestable/RichText.ts +37 -35
  82. package/src/customtypes/widgets/nestable/Select.ts +4 -2
  83. package/src/customtypes/widgets/nestable/Separator.ts +1 -1
  84. package/src/customtypes/widgets/nestable/Text.ts +1 -1
  85. package/src/customtypes/widgets/nestable/Timestamp.ts +1 -1
  86. package/src/customtypes/widgets/slices/CompositeSlice.ts +1 -1
  87. package/src/customtypes/widgets/slices/SharedSlice.ts +2 -2
  88. package/src/customtypes/widgets/slices/SharedSliceRef.ts +1 -1
  89. package/src/customtypes/widgets/slices/Slices.ts +3 -3
  90. package/src/customtypes/widgets/slices/SlicesTypes.ts +5 -5
  91. package/src/customtypes/widgets/slices/index.ts +1 -1
  92. package/src/documents/widgets/index.ts +1 -5
  93. package/src/documents/widgets/nestable/Link/index.ts +2 -0
  94. package/src/documents/widgets/nestable/StructuredTextContent/Block.ts +1 -1
@@ -1,7 +1,7 @@
1
1
  import * as t from "io-ts"
2
2
 
3
3
  import { StringOrNull } from "../../../validators"
4
- import WidgetTypes from "../WidgetTypes"
4
+ import { WidgetTypes } from "../WidgetTypes"
5
5
 
6
6
  const TextConfig = t.exact(
7
7
  t.partial({
@@ -1,7 +1,7 @@
1
1
  import * as t from "io-ts"
2
2
 
3
3
  import { StringOrNull } from "../../../validators"
4
- import WidgetTypes from "../WidgetTypes"
4
+ import { WidgetTypes } from "../WidgetTypes"
5
5
 
6
6
  const TimestampConfig = t.exact(
7
7
  t.partial({
@@ -2,7 +2,7 @@ import * as t from "io-ts"
2
2
 
3
3
  import { StringOrNull } from "../../../validators"
4
4
  import NestableWidget from "../nestable/NestableWidget"
5
- import SlicesTypes from "./SlicesTypes"
5
+ import { SlicesTypes } from "./SlicesTypes"
6
6
 
7
7
  const CompositeSliceConfig = t.exact(
8
8
  t.partial({
@@ -2,7 +2,7 @@ import * as t from "io-ts"
2
2
  import { withFallback } from "io-ts-types/lib/withFallback"
3
3
 
4
4
  import NestableWidget from "../nestable/NestableWidget"
5
- import SlicesTypes from "./SlicesTypes"
5
+ import { SlicesTypes } from "./SlicesTypes"
6
6
 
7
7
  const IMAGE_PLACEHOLDER_URL =
8
8
  "https://images.prismic.io/slice-machine/621a5ec4-0387-4bc5-9860-2dd46cbc07cd_default_ss.png?auto=compress,format"
@@ -33,7 +33,7 @@ export const SharedSlice = t.exact(
33
33
  id: t.string,
34
34
  type: t.literal(SlicesTypes.SharedSlice),
35
35
  name: t.string,
36
- variations: t.array(Variation),
36
+ variations: t.readonlyArray(Variation),
37
37
  }),
38
38
  t.partial({
39
39
  description: t.string,
@@ -1,6 +1,6 @@
1
1
  import * as t from "io-ts"
2
2
 
3
- import SlicesTypes from "./SlicesTypes"
3
+ import { SlicesTypes } from "./SlicesTypes"
4
4
 
5
5
  const SharedSliceRef = t.exact(
6
6
  t.type({
@@ -1,17 +1,17 @@
1
1
  import * as t from "io-ts"
2
2
 
3
3
  import { StringOrNull } from "../../../validators"
4
- import WidgetTypes from "../WidgetTypes"
4
+ import { WidgetTypes } from "../WidgetTypes"
5
5
  import CompositeSlice from "./CompositeSlice"
6
6
  import LegacySlice from "./LegacySlice"
7
7
  import { SharedSlice } from "./SharedSlice"
8
8
  import SharedSliceRef from "./SharedSliceRef"
9
- import SlicesTypes from "./SlicesTypes"
9
+ import { SlicesTypes } from "./SlicesTypes"
10
10
 
11
11
  export const SlicesLabels = t.union([
12
12
  t.record(
13
13
  t.string,
14
- t.array(
14
+ t.readonlyArray(
15
15
  t.exact(
16
16
  t.intersection([
17
17
  t.type({
@@ -1,6 +1,6 @@
1
- enum SlicesTypes {
2
- Slice = "Slice",
3
- SharedSlice = "SharedSlice",
4
- }
1
+ export const SlicesTypes = {
2
+ Slice: "Slice",
3
+ SharedSlice: "SharedSlice",
4
+ } as const
5
5
 
6
- export default SlicesTypes
6
+ export type SlicesTypes = typeof SlicesTypes[keyof typeof SlicesTypes]
@@ -4,4 +4,4 @@ export * from "./SharedSlice"
4
4
  export { default as SharedSliceRef } from "./SharedSliceRef"
5
5
  export * as Slice from "./Slice"
6
6
  export * as SliceZone from "./Slices"
7
- export { default as SlicesTypes } from "./SlicesTypes"
7
+ export { SlicesTypes } from "./SlicesTypes"
@@ -21,11 +21,7 @@ export const WidgetTypes = {
21
21
  slices: SlicesContentType,
22
22
  } as const
23
23
 
24
- /*const widgetKeyRegex = new RegExp("^[^<>]*$")
25
- export const WidgetKey = refineType(t.string, "WidgetKey", (s: string) =>
26
- widgetKeyRegex.test(s),
27
- )
28
- export type WidgetKey = t.TypeOf<typeof WidgetKey>*/
24
+ export type WidgetTypes = typeof WidgetTypes[keyof typeof WidgetTypes]
29
25
 
30
26
  export type WidgetKey = string
31
27
 
@@ -31,3 +31,5 @@ export const LinksTypes = {
31
31
  ImageLink: ImageLinkType,
32
32
  LinkContent: LinkContentType,
33
33
  } as const
34
+
35
+ export type LinksTypes = typeof LinksTypes[keyof typeof LinksTypes]
@@ -19,7 +19,7 @@ export const Meta = t.exact(
19
19
  t.type({
20
20
  start: t.number,
21
21
  end: t.number,
22
- type: RichTextNodeTypeCodec,
22
+ type: t.union([RichTextNodeTypeCodec, t.literal("label")]),
23
23
  }),
24
24
  ]),
25
25
  )