vocs 2.0.0-rc.3 → 2.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.
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../../src/react/Callout.tsx"],"names":[],"mappings":"AAKA,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,2CAe3C;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAY,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAAC;QAC1C,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAA;KACpE,CAAC,CAAA;CACH"}
1
+ {"version":3,"file":"Callout.d.ts","sourceRoot":"","sources":["../../src/react/Callout.tsx"],"names":[],"mappings":"AAKA,wBAAgB,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,KAAK,2CAwB3C;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,KAAY,KAAK,GAAG,KAAK,CAAC,iBAAiB,CAAC;QAC1C,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,GAAG,KAAK,GAAG,SAAS,CAAA;KACpE,CAAC,CAAA;CACH"}
@@ -4,7 +4,8 @@ import LucideInfo from '~icons/lucide/info';
4
4
  import LucideLightbulb from '~icons/lucide/lightbulb';
5
5
  import LucideTriangleAlert from '~icons/lucide/triangle-alert';
6
6
  export function Callout(props) {
7
- const { variant, ...rest } = props;
8
- return (_jsxs("aside", { ...rest, "data-v": true, "data-v-callout": true, "data-v-content": true, "data-v-context": variant, children: [_jsxs("div", { "data-v-callout-icon": true, children: [props.variant === 'note' ? _jsx(LucideInfo, {}) : null, props.variant === 'info' ? _jsx(LucideInfo, {}) : null, props.variant === 'warning' ? _jsx(LucideTriangleAlert, {}) : null, props.variant === 'danger' ? _jsx(LucideTriangleAlert, {}) : null, props.variant === 'tip' ? _jsx(LucideLightbulb, {}) : null, props.variant === 'success' ? _jsx(LucideCircleCheck, {}) : null] }), props.children] }));
7
+ const { children, variant, ...rest } = props;
8
+ const content = typeof children === 'string' || typeof children === 'number' ? (_jsx("div", { "data-v-callout-content": true, "data-v-content": true, children: children })) : (children);
9
+ return (_jsxs("aside", { ...rest, "data-v": true, "data-v-callout": true, "data-v-content": true, "data-v-context": variant, children: [_jsxs("div", { "data-v-callout-icon": true, children: [props.variant === 'note' ? _jsx(LucideInfo, {}) : null, props.variant === 'info' ? _jsx(LucideInfo, {}) : null, props.variant === 'warning' ? _jsx(LucideTriangleAlert, {}) : null, props.variant === 'danger' ? _jsx(LucideTriangleAlert, {}) : null, props.variant === 'tip' ? _jsx(LucideLightbulb, {}) : null, props.variant === 'success' ? _jsx(LucideCircleCheck, {}) : null] }), content] }));
9
10
  }
10
11
  //# sourceMappingURL=Callout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Callout.js","sourceRoot":"","sources":["../../src/react/Callout.tsx"],"names":[],"mappings":";AAAA,OAAO,iBAAiB,MAAM,4BAA4B,CAAA;AAC1D,OAAO,UAAU,MAAM,oBAAoB,CAAA;AAC3C,OAAO,eAAe,MAAM,yBAAyB,CAAA;AACrD,OAAO,mBAAmB,MAAM,8BAA8B,CAAA;AAE9D,MAAM,UAAU,OAAO,CAAC,KAAoB;IAC1C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAA;IAClC,OAAO,CACL,oBAAW,IAAI,oFAAuD,OAAO,aAC3E,uDACG,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,KAAC,UAAU,KAAG,CAAC,CAAC,CAAC,IAAI,EAChD,KAAK,CAAC,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,KAAC,UAAU,KAAG,CAAC,CAAC,CAAC,IAAI,EAChD,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAC,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AAG,CAAC,CAAC,CAAC,IAAI,EAC5D,KAAK,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAC,mBAAmB,KAAG,CAAC,CAAC,CAAC,IAAI,EAC3D,KAAK,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAC,eAAe,KAAG,CAAC,CAAC,CAAC,IAAI,EACpD,KAAK,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,KAAC,iBAAiB,KAAG,CAAC,CAAC,CAAC,IAAI,IACvD,EACL,OAAO,IACF,CACT,CAAA;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../../../../../../src/waku/internal/routes/_api/api/og.tsx"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,EAAE,OAAO,qBA4D/C"}
1
+ {"version":3,"file":"og.d.ts","sourceRoot":"","sources":["../../../../../../src/waku/internal/routes/_api/api/og.tsx"],"names":[],"mappings":"AAwBA,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAO,EAAE,OAAO,qBAoH/C"}
@@ -2,38 +2,63 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import * as Handler from '../../../../../server/handlers.js';
3
3
  const colors = {
4
4
  background: '#161616',
5
+ pattern: '#202020',
5
6
  text: '#ffffff',
6
7
  textMuted: 'rgba(255, 255, 255, 0.6)',
7
8
  };
9
+ const dimensions = {
10
+ height: 630,
11
+ width: 1200,
12
+ };
13
+ const patternStep = 56;
14
+ const diagonalOffsets = Array.from({ length: Math.ceil((dimensions.width + dimensions.height * 2) / patternStep) }, (_, index) => index * patternStep - dimensions.height);
15
+ const reverseDiagonalOffsets = Array.from({ length: Math.ceil((dimensions.width + dimensions.height * 2) / patternStep) }, (_, index) => index * patternStep);
8
16
  export default function handler(request) {
9
- return Handler.og(({ title, description, logo }) => (_jsxs("div", { style: {
10
- display: 'flex',
11
- flexDirection: 'column',
12
- alignItems: 'flex-start',
13
- justifyContent: 'center',
14
- width: '100%',
15
- height: '100%',
16
- padding: 80,
17
- backgroundColor: colors.background,
18
- color: colors.text,
19
- }, children: [logo && (_jsx("img", { alt: "", src: logo, style: {
20
- height: 48,
21
- position: 'absolute',
22
- right: 40,
23
- bottom: 40,
24
- } })), _jsxs("div", { style: {
25
- display: 'flex',
26
- flexDirection: 'column',
27
- gap: 12,
28
- }, children: [_jsx("div", { style: {
29
- fontSize: title.length < 15 ? 80 : 64,
30
- fontWeight: 700,
31
- lineHeight: 1.1,
32
- color: colors.text,
33
- }, children: title }), description && (_jsx("div", { style: {
34
- fontSize: 28,
35
- color: colors.textMuted,
36
- maxWidth: 800,
37
- }, children: description }))] })] }))).fetch(request);
17
+ return Handler.og(({ title, description, logo }) => {
18
+ const titleLines = title.split('\n');
19
+ return (_jsxs("div", { style: {
20
+ display: 'flex',
21
+ flexDirection: 'column',
22
+ alignItems: 'flex-start',
23
+ justifyContent: 'center',
24
+ position: 'relative',
25
+ width: '100%',
26
+ height: '100%',
27
+ overflow: 'hidden',
28
+ backgroundColor: colors.background,
29
+ color: colors.text,
30
+ }, children: [_jsx("div", { style: {
31
+ position: 'absolute',
32
+ top: 0,
33
+ right: 0,
34
+ bottom: 0,
35
+ left: 0,
36
+ }, children: _jsxs("svg", { "aria-hidden": true, width: dimensions.width, height: dimensions.height, viewBox: `0 0 ${dimensions.width} ${dimensions.height}`, fill: "none", children: [_jsx("title", { children: "Background pattern" }), diagonalOffsets.map((offset) => (_jsx("line", { x1: offset, y1: 0, x2: offset + dimensions.height, y2: dimensions.height, stroke: colors.pattern, strokeWidth: 1.5 }, `diagonal-${offset}`))), reverseDiagonalOffsets.map((offset) => (_jsx("line", { x1: offset, y1: 0, x2: offset - dimensions.height, y2: dimensions.height, stroke: colors.pattern, strokeWidth: 1.5 }, `reverse-diagonal-${offset}`)))] }) }), logo && (_jsx("img", { alt: "", src: logo, style: {
37
+ height: 48,
38
+ position: 'absolute',
39
+ right: 40,
40
+ bottom: 40,
41
+ } })), _jsxs("div", { style: {
42
+ display: 'flex',
43
+ flexDirection: 'column',
44
+ gap: 12,
45
+ position: 'relative',
46
+ justifyContent: 'center',
47
+ width: '100%',
48
+ height: '100%',
49
+ padding: 80,
50
+ }, children: [_jsx("div", { style: {
51
+ display: 'flex',
52
+ flexDirection: 'column',
53
+ fontSize: title.length < 15 ? 80 : 64,
54
+ fontWeight: 700,
55
+ lineHeight: 1.1,
56
+ color: colors.text,
57
+ }, children: titleLines.map((line) => (_jsx("div", { children: line }, line))) }), description && (_jsx("div", { style: {
58
+ fontSize: 28,
59
+ color: colors.textMuted,
60
+ maxWidth: 800,
61
+ }, children: description }))] })] }));
62
+ }).fetch(request);
38
63
  }
39
64
  //# sourceMappingURL=og.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"og.js","sourceRoot":"","sources":["../../../../../../src/waku/internal/routes/_api/api/og.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAA;AAE5D,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,SAAS;IACrB,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,0BAA0B;CACtC,CAAA;AAED,MAAM,CAAC,OAAO,UAAU,OAAO,CAAC,OAAgB;IAC9C,OAAO,OAAO,CAAC,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAClD,eACE,KAAK,EAAE;YACL,OAAO,EAAE,MAAM;YACf,aAAa,EAAE,QAAQ;YACvB,UAAU,EAAE,YAAY;YACxB,cAAc,EAAE,QAAQ;YACxB,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE;YACX,eAAe,EAAE,MAAM,CAAC,UAAU;YAClC,KAAK,EAAE,MAAM,CAAC,IAAI;SACnB,aAEA,IAAI,IAAI,CACP,cACE,GAAG,EAAC,EAAE,EACN,GAAG,EAAE,IAAI,EACT,KAAK,EAAE;oBACL,MAAM,EAAE,EAAE;oBACV,QAAQ,EAAE,UAAU;oBACpB,KAAK,EAAE,EAAE;oBACT,MAAM,EAAE,EAAE;iBACX,GACD,CACH,EAED,eACE,KAAK,EAAE;oBACL,OAAO,EAAE,MAAM;oBACf,aAAa,EAAE,QAAQ;oBACvB,GAAG,EAAE,EAAE;iBACR,aAED,cACE,KAAK,EAAE;4BACL,QAAQ,EAAE,KAAK,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE;4BACrC,UAAU,EAAE,GAAG;4BACf,UAAU,EAAE,GAAG;4BACf,KAAK,EAAE,MAAM,CAAC,IAAI;yBACnB,YAEA,KAAK,GACF,EAEL,WAAW,IAAI,CACd,cACE,KAAK,EAAE;4BACL,QAAQ,EAAE,EAAE;4BACZ,KAAK,EAAE,MAAM,CAAC,SAAS;4BACvB,QAAQ,EAAE,GAAG;yBACd,YAEA,WAAW,GACR,CACP,IACG,IACF,CACP,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AACnB,CAAC"}
1
+ {"version":3,"file":"og.js","sourceRoot":"","sources":["../../../../../../src/waku/internal/routes/_api/api/og.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAA;AAE5D,MAAM,MAAM,GAAG;IACb,UAAU,EAAE,SAAS;IACrB,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,SAAS;IACf,SAAS,EAAE,0BAA0B;CACtC,CAAA;AAED,MAAM,UAAU,GAAG;IACjB,MAAM,EAAE,GAAG;IACX,KAAK,EAAE,IAAI;CACZ,CAAA;AAED,MAAM,WAAW,GAAG,EAAE,CAAA;AACtB,MAAM,eAAe,GAAG,KAAK,CAAC,IAAI,CAChC,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,GAAG,UAAU,CAAC,MAAM,GAAG,CAAC,CAAC,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AE;gCACrC,UAAU,EAAE,GAAG;gCACf,UAAU,EAAE,GAAG;gCACf,KAAK,EAAE,MAAM,CAAC,IAAI;6BACnB,YAEA,UAAU,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CACxB,wBAAiB,IAAI,IAAX,IAAI,CAAc,CAC7B,CAAC,GACE,EAEL,WAAW,IAAI,CACd,cACE,KAAK,EAAE;gCACL,QAAQ,EAAE,EAAE;gCACZ,KAAK,EAAE,MAAM,CAAC,SAAS;gCACvB,QAAQ,EAAE,GAAG;6BACd,YAEA,WAAW,GACR,CACP,IACG,IACF,CACP,CAAA;IACH,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAA;AACnB,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "vocs",
3
3
  "type": "module",
4
- "version": "2.0.0-rc.3",
4
+ "version": "2.0.0",
5
5
  "main": "./dist/index.js",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -85,7 +85,7 @@
85
85
  "zod": "^4.3.5"
86
86
  },
87
87
  "peerDependencies": {
88
- "@vocs/twoslash-rust": "^0.1.0-rc.0",
88
+ "@vocs/twoslash-rust": "^0.1.0",
89
89
  "mermaid": "^11",
90
90
  "react": "^19",
91
91
  "react-dom": "^19",
@@ -4,7 +4,16 @@ import LucideLightbulb from '~icons/lucide/lightbulb'
4
4
  import LucideTriangleAlert from '~icons/lucide/triangle-alert'
5
5
 
6
6
  export function Callout(props: Callout.Props) {
7
- const { variant, ...rest } = props
7
+ const { children, variant, ...rest } = props
8
+ const content =
9
+ typeof children === 'string' || typeof children === 'number' ? (
10
+ <div data-v-callout-content data-v-content>
11
+ {children}
12
+ </div>
13
+ ) : (
14
+ children
15
+ )
16
+
8
17
  return (
9
18
  <aside {...rest} data-v data-v-callout data-v-content data-v-context={variant}>
10
19
  <div data-v-callout-icon>
@@ -15,7 +24,7 @@ export function Callout(props: Callout.Props) {
15
24
  {props.variant === 'tip' ? <LucideLightbulb /> : null}
16
25
  {props.variant === 'success' ? <LucideCircleCheck /> : null}
17
26
  </div>
18
- {props.children}
27
+ {content}
19
28
  </aside>
20
29
  )
21
30
  }
@@ -2,68 +2,140 @@ import * as Handler from '../../../../../server/handlers.js'
2
2
 
3
3
  const colors = {
4
4
  background: '#161616',
5
+ pattern: '#202020',
5
6
  text: '#ffffff',
6
7
  textMuted: 'rgba(255, 255, 255, 0.6)',
7
8
  }
8
9
 
10
+ const dimensions = {
11
+ height: 630,
12
+ width: 1200,
13
+ }
14
+
15
+ const patternStep = 56
16
+ const diagonalOffsets = Array.from(
17
+ { length: Math.ceil((dimensions.width + dimensions.height * 2) / patternStep) },
18
+ (_, index) => index * patternStep - dimensions.height,
19
+ )
20
+ const reverseDiagonalOffsets = Array.from(
21
+ { length: Math.ceil((dimensions.width + dimensions.height * 2) / patternStep) },
22
+ (_, index) => index * patternStep,
23
+ )
24
+
9
25
  export default function handler(request: Request) {
10
- return Handler.og(({ title, description, logo }) => (
11
- <div
12
- style={{
13
- display: 'flex',
14
- flexDirection: 'column',
15
- alignItems: 'flex-start',
16
- justifyContent: 'center',
17
- width: '100%',
18
- height: '100%',
19
- padding: 80,
20
- backgroundColor: colors.background,
21
- color: colors.text,
22
- }}
23
- >
24
- {logo && (
25
- <img
26
- alt=""
27
- src={logo}
28
- style={{
29
- height: 48,
30
- position: 'absolute',
31
- right: 40,
32
- bottom: 40,
33
- }}
34
- />
35
- )}
26
+ return Handler.og(({ title, description, logo }) => {
27
+ const titleLines = title.split('\n')
36
28
 
29
+ return (
37
30
  <div
38
31
  style={{
39
32
  display: 'flex',
40
33
  flexDirection: 'column',
41
- gap: 12,
34
+ alignItems: 'flex-start',
35
+ justifyContent: 'center',
36
+ position: 'relative',
37
+ width: '100%',
38
+ height: '100%',
39
+ overflow: 'hidden',
40
+ backgroundColor: colors.background,
41
+ color: colors.text,
42
42
  }}
43
43
  >
44
44
  <div
45
45
  style={{
46
- fontSize: title.length < 15 ? 80 : 64,
47
- fontWeight: 700,
48
- lineHeight: 1.1,
49
- color: colors.text,
46
+ position: 'absolute',
47
+ top: 0,
48
+ right: 0,
49
+ bottom: 0,
50
+ left: 0,
50
51
  }}
51
52
  >
52
- {title}
53
+ <svg
54
+ aria-hidden
55
+ width={dimensions.width}
56
+ height={dimensions.height}
57
+ viewBox={`0 0 ${dimensions.width} ${dimensions.height}`}
58
+ fill="none"
59
+ >
60
+ <title>Background pattern</title>
61
+ {diagonalOffsets.map((offset) => (
62
+ <line
63
+ key={`diagonal-${offset}`}
64
+ x1={offset}
65
+ y1={0}
66
+ x2={offset + dimensions.height}
67
+ y2={dimensions.height}
68
+ stroke={colors.pattern}
69
+ strokeWidth={1.5}
70
+ />
71
+ ))}
72
+ {reverseDiagonalOffsets.map((offset) => (
73
+ <line
74
+ key={`reverse-diagonal-${offset}`}
75
+ x1={offset}
76
+ y1={0}
77
+ x2={offset - dimensions.height}
78
+ y2={dimensions.height}
79
+ stroke={colors.pattern}
80
+ strokeWidth={1.5}
81
+ />
82
+ ))}
83
+ </svg>
53
84
  </div>
54
85
 
55
- {description && (
86
+ {logo && (
87
+ <img
88
+ alt=""
89
+ src={logo}
90
+ style={{
91
+ height: 48,
92
+ position: 'absolute',
93
+ right: 40,
94
+ bottom: 40,
95
+ }}
96
+ />
97
+ )}
98
+
99
+ <div
100
+ style={{
101
+ display: 'flex',
102
+ flexDirection: 'column',
103
+ gap: 12,
104
+ position: 'relative',
105
+ justifyContent: 'center',
106
+ width: '100%',
107
+ height: '100%',
108
+ padding: 80,
109
+ }}
110
+ >
56
111
  <div
57
112
  style={{
58
- fontSize: 28,
59
- color: colors.textMuted,
60
- maxWidth: 800,
113
+ display: 'flex',
114
+ flexDirection: 'column',
115
+ fontSize: title.length < 15 ? 80 : 64,
116
+ fontWeight: 700,
117
+ lineHeight: 1.1,
118
+ color: colors.text,
61
119
  }}
62
120
  >
63
- {description}
121
+ {titleLines.map((line) => (
122
+ <div key={line}>{line}</div>
123
+ ))}
64
124
  </div>
65
- )}
125
+
126
+ {description && (
127
+ <div
128
+ style={{
129
+ fontSize: 28,
130
+ color: colors.textMuted,
131
+ maxWidth: 800,
132
+ }}
133
+ >
134
+ {description}
135
+ </div>
136
+ )}
137
+ </div>
66
138
  </div>
67
- </div>
68
- )).fetch(request)
139
+ )
140
+ }).fetch(request)
69
141
  }