@rimelight/ui 0.0.2 → 0.0.4

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 (105) hide show
  1. package/package.json +6 -3
  2. package/src/components/carousel/carousel-script.ts +188 -188
  3. package/src/components/carousel/index.ts +1 -1
  4. package/src/components/input-otp/InputOtpTypes.ts +6 -6
  5. package/src/components/radio-group/RadioGroupTypes.ts +6 -6
  6. package/src/components/select/SelectTypes.ts +13 -13
  7. package/src/components/switch/SwitchTypes.ts +6 -6
  8. package/src/components/toast/index.ts +1 -1
  9. package/src/components/toast/toast-manager.ts +234 -234
  10. package/src/components/toggle/ToggleTypes.ts +14 -14
  11. package/src/config/cookies.ts +5 -5
  12. package/src/config/index.ts +3 -3
  13. package/src/config/links.ts +4 -4
  14. package/src/config/site.config.ts +27 -45
  15. package/src/domain/cms/index.ts +1 -1
  16. package/src/domain/cms/types.ts +20 -20
  17. package/src/domain/i18n/constants.ts +21 -21
  18. package/src/domain/i18n/cookie-storage.ts +13 -13
  19. package/src/domain/i18n/country-to-locale-map.ts +67 -67
  20. package/src/domain/i18n/fetcher.ts +278 -268
  21. package/src/domain/i18n/flags.ts +16 -16
  22. package/src/domain/i18n/format.ts +90 -90
  23. package/src/domain/i18n/index.ts +10 -10
  24. package/src/domain/i18n/middleware/i18n.ts +161 -160
  25. package/src/domain/i18n/resolve-locale.ts +55 -55
  26. package/src/domain/i18n/schema.ts +29 -29
  27. package/src/domain/index.ts +4 -4
  28. package/src/domain/seo/constants.ts +6 -20
  29. package/src/domain/seo/index.ts +3 -3
  30. package/src/domain/seo/services/index.ts +3 -3
  31. package/src/domain/seo/services/llms.ts +56 -53
  32. package/src/domain/seo/services/robots.ts +12 -12
  33. package/src/domain/seo/services/sitemap.ts +56 -56
  34. package/src/domain/seo/utils.ts +36 -37
  35. package/src/domain/theme/constants.ts +6 -6
  36. package/src/domain/theme/index.ts +2 -2
  37. package/src/domain/theme/schema.ts +10 -10
  38. package/src/env.d.ts +49 -49
  39. package/src/integrations/index.ts +1 -0
  40. package/src/integrations/sri.ts +92 -0
  41. package/src/lib/component-preview.ts +73 -73
  42. package/src/lib/index.ts +6 -6
  43. package/src/lib/remark/remark-modified-time.ts +13 -13
  44. package/src/lib/showcase-preview-elements.ts +408 -408
  45. package/src/lib/showcase-renderer.ts +218 -218
  46. package/src/lib/showcase-utils.ts +189 -189
  47. package/src/lib/turnstile.ts +35 -35
  48. package/src/lib/utils/starwind/positioning.ts +318 -318
  49. package/src/locales/de/blog.json +9 -9
  50. package/src/locales/de/common.json +19 -19
  51. package/src/locales/de/errors.json +6 -6
  52. package/src/locales/de/home.json +20 -20
  53. package/src/locales/de/messages.json +8 -8
  54. package/src/locales/de/nav.json +13 -13
  55. package/src/locales/de/projects.json +9 -9
  56. package/src/locales/de/services.json +43 -43
  57. package/src/locales/en/blog.json +9 -9
  58. package/src/locales/en/chat.json +29 -29
  59. package/src/locales/en/common.json +19 -19
  60. package/src/locales/en/cookie_notice.json +11 -11
  61. package/src/locales/en/editor.json +24 -24
  62. package/src/locales/en/errors.json +6 -6
  63. package/src/locales/en/home.json +20 -20
  64. package/src/locales/en/messages.json +8 -8
  65. package/src/locales/en/nav.json +13 -13
  66. package/src/locales/en/projects.json +9 -9
  67. package/src/locales/en/services.json +43 -43
  68. package/src/locales/es/blog.json +9 -9
  69. package/src/locales/es/common.json +19 -19
  70. package/src/locales/es/errors.json +6 -6
  71. package/src/locales/es/home.json +20 -20
  72. package/src/locales/es/messages.json +8 -8
  73. package/src/locales/es/nav.json +13 -13
  74. package/src/locales/es/projects.json +9 -9
  75. package/src/locales/es/services.json +43 -43
  76. package/src/locales/ja/blog.json +9 -9
  77. package/src/locales/ja/common.json +19 -19
  78. package/src/locales/ja/errors.json +6 -6
  79. package/src/locales/ja/home.json +20 -20
  80. package/src/locales/ja/messages.json +8 -8
  81. package/src/locales/ja/nav.json +13 -13
  82. package/src/locales/ja/projects.json +9 -9
  83. package/src/locales/ja/services.json +43 -43
  84. package/src/locales/pt/blog.json +9 -9
  85. package/src/locales/pt/chat.json +29 -29
  86. package/src/locales/pt/common.json +19 -19
  87. package/src/locales/pt/cookie_notice.json +11 -11
  88. package/src/locales/pt/editor.json +24 -24
  89. package/src/locales/pt/errors.json +6 -6
  90. package/src/locales/pt/home.json +20 -20
  91. package/src/locales/pt/messages.json +8 -8
  92. package/src/locales/pt/nav.json +13 -13
  93. package/src/locales/pt/projects.json +9 -9
  94. package/src/locales/pt/services.json +43 -43
  95. package/src/middleware/index.ts +2 -0
  96. package/src/middleware/security.ts +15 -0
  97. package/src/middleware/sri.ts +78 -0
  98. package/src/utils/index.ts +2 -2
  99. package/src/utils/server/cookies.ts +98 -98
  100. package/src/utils/server/index.ts +1 -1
  101. package/src/utils/shared/deep-merge.ts +36 -36
  102. package/src/utils/shared/embed.ts +105 -105
  103. package/src/utils/shared/index.ts +3 -3
  104. package/src/utils/shared/parse-boolean.ts +14 -14
  105. package/worker-configuration.d.ts +0 -14791
@@ -1,189 +1,189 @@
1
- /**
2
- * Showcase Utilities
3
- *
4
- * Helper functions for defining component prop configurations
5
- */
6
-
7
- export interface PropDef {
8
- name: string
9
- type: string
10
- default?: any
11
- description?: string
12
- }
13
-
14
- function makePropDef(
15
- name: string,
16
- type: string,
17
- defaultValue: any,
18
- description: string | undefined
19
- ): PropDef {
20
- const result: PropDef = {
21
- name,
22
- type
23
- }
24
- if (defaultValue !== undefined) result.default = defaultValue
25
- if (description !== undefined) result.description = description
26
- return result
27
- }
28
-
29
- /**
30
- * Create prop definitions for string props
31
- */
32
- export function stringProp(
33
- name: string,
34
- options: {
35
- default?: string
36
- description?: string
37
- } = {}
38
- ): PropDef {
39
- return makePropDef(name, "string", options.default, options.description)
40
- }
41
-
42
- /**
43
- * Create prop definitions for boolean props
44
- */
45
- export function booleanProp(
46
- name: string,
47
- options: {
48
- default?: boolean
49
- description?: string
50
- } = {}
51
- ): PropDef {
52
- return makePropDef(name, "boolean", options.default, options.description)
53
- }
54
-
55
- /**
56
- * Create prop definitions for number props
57
- */
58
- export function numberProp(
59
- name: string,
60
- options: {
61
- default?: number
62
- description?: string
63
- } = {}
64
- ): PropDef {
65
- return makePropDef(name, "number", options.default, options.description)
66
- }
67
-
68
- /**
69
- * Create prop definitions for enum (union type) props
70
- */
71
- export function enumProp(
72
- name: string,
73
- values: string[],
74
- options: {
75
- default?: string
76
- description?: string
77
- } = {}
78
- ): PropDef {
79
- return makePropDef(
80
- name,
81
- values.map((v) => `'${v}'`).join(" | "),
82
- options.default,
83
- options.description
84
- )
85
- }
86
-
87
- /**
88
- * Create prop definitions for array props
89
- */
90
- export function arrayProp(
91
- name: string,
92
- options: {
93
- default?: any[]
94
- description?: string
95
- } = {}
96
- ): PropDef {
97
- return makePropDef(name, "array", options.default, options.description)
98
- }
99
-
100
- /**
101
- * Create prop definitions for object props
102
- */
103
- export function objectProp(
104
- name: string,
105
- options: {
106
- default?: Record<string, any>
107
- description?: string
108
- } = {}
109
- ): PropDef {
110
- return makePropDef(name, "object", options.default, options.description)
111
- }
112
-
113
- /**
114
- * Build common UI component props (variant, size)
115
- */
116
- export function uiProps(
117
- options: {
118
- variantValues?: string[]
119
- sizeValues?: string[]
120
- defaultVariant?: string
121
- defaultSize?: string
122
- } = {}
123
- ): PropDef[] {
124
- const props: PropDef[] = []
125
-
126
- if (options.variantValues) {
127
- props.push(
128
- enumProp("variant", options.variantValues, {
129
- default: options.defaultVariant ?? "default",
130
- description: "The visual style variant of the component."
131
- })
132
- )
133
- }
134
-
135
- if (options.sizeValues) {
136
- props.push(
137
- enumProp("size", options.sizeValues, {
138
- default: options.defaultSize ?? "md",
139
- description: "The size of the component."
140
- })
141
- )
142
- }
143
-
144
- return props
145
- }
146
-
147
- /**
148
- * Build common layout props (orientation, alignment, inverted)
149
- */
150
- export function layoutProps(
151
- options: {
152
- orientationValues?: string[]
153
- alignmentValues?: string[]
154
- defaultOrientation?: string
155
- defaultAlignment?: string
156
- includeInverted?: boolean
157
- } = {}
158
- ): PropDef[] {
159
- const props: PropDef[] = []
160
-
161
- if (options.orientationValues) {
162
- props.push(
163
- enumProp("orientation", options.orientationValues, {
164
- default: options.defaultOrientation ?? "vertical",
165
- description: "The layout orientation of the component."
166
- })
167
- )
168
- }
169
-
170
- if (options.alignmentValues) {
171
- props.push(
172
- enumProp("alignment", options.alignmentValues, {
173
- default: options.defaultAlignment ?? "center",
174
- description: "The content alignment."
175
- })
176
- )
177
- }
178
-
179
- if (options.includeInverted) {
180
- props.push(
181
- booleanProp("inverted", {
182
- default: false,
183
- description: "Inverts the order of content."
184
- })
185
- )
186
- }
187
-
188
- return props
189
- }
1
+ /**
2
+ * Showcase Utilities
3
+ *
4
+ * Helper functions for defining component prop configurations
5
+ */
6
+
7
+ export interface PropDef {
8
+ name: string
9
+ type: string
10
+ default?: any
11
+ description?: string
12
+ }
13
+
14
+ function makePropDef(
15
+ name: string,
16
+ type: string,
17
+ defaultValue: any,
18
+ description: string | undefined
19
+ ): PropDef {
20
+ const result: PropDef = {
21
+ name,
22
+ type
23
+ }
24
+ if (defaultValue !== undefined) result.default = defaultValue
25
+ if (description !== undefined) result.description = description
26
+ return result
27
+ }
28
+
29
+ /**
30
+ * Create prop definitions for string props
31
+ */
32
+ export function stringProp(
33
+ name: string,
34
+ options: {
35
+ default?: string
36
+ description?: string
37
+ } = {}
38
+ ): PropDef {
39
+ return makePropDef(name, "string", options.default, options.description)
40
+ }
41
+
42
+ /**
43
+ * Create prop definitions for boolean props
44
+ */
45
+ export function booleanProp(
46
+ name: string,
47
+ options: {
48
+ default?: boolean
49
+ description?: string
50
+ } = {}
51
+ ): PropDef {
52
+ return makePropDef(name, "boolean", options.default, options.description)
53
+ }
54
+
55
+ /**
56
+ * Create prop definitions for number props
57
+ */
58
+ export function numberProp(
59
+ name: string,
60
+ options: {
61
+ default?: number
62
+ description?: string
63
+ } = {}
64
+ ): PropDef {
65
+ return makePropDef(name, "number", options.default, options.description)
66
+ }
67
+
68
+ /**
69
+ * Create prop definitions for enum (union type) props
70
+ */
71
+ export function enumProp(
72
+ name: string,
73
+ values: string[],
74
+ options: {
75
+ default?: string
76
+ description?: string
77
+ } = {}
78
+ ): PropDef {
79
+ return makePropDef(
80
+ name,
81
+ values.map((v) => `'${v}'`).join(" | "),
82
+ options.default,
83
+ options.description
84
+ )
85
+ }
86
+
87
+ /**
88
+ * Create prop definitions for array props
89
+ */
90
+ export function arrayProp(
91
+ name: string,
92
+ options: {
93
+ default?: any[]
94
+ description?: string
95
+ } = {}
96
+ ): PropDef {
97
+ return makePropDef(name, "array", options.default, options.description)
98
+ }
99
+
100
+ /**
101
+ * Create prop definitions for object props
102
+ */
103
+ export function objectProp(
104
+ name: string,
105
+ options: {
106
+ default?: Record<string, any>
107
+ description?: string
108
+ } = {}
109
+ ): PropDef {
110
+ return makePropDef(name, "object", options.default, options.description)
111
+ }
112
+
113
+ /**
114
+ * Build common UI component props (variant, size)
115
+ */
116
+ export function uiProps(
117
+ options: {
118
+ variantValues?: string[]
119
+ sizeValues?: string[]
120
+ defaultVariant?: string
121
+ defaultSize?: string
122
+ } = {}
123
+ ): PropDef[] {
124
+ const props: PropDef[] = []
125
+
126
+ if (options.variantValues) {
127
+ props.push(
128
+ enumProp("variant", options.variantValues, {
129
+ default: options.defaultVariant ?? "default",
130
+ description: "The visual style variant of the component."
131
+ })
132
+ )
133
+ }
134
+
135
+ if (options.sizeValues) {
136
+ props.push(
137
+ enumProp("size", options.sizeValues, {
138
+ default: options.defaultSize ?? "md",
139
+ description: "The size of the component."
140
+ })
141
+ )
142
+ }
143
+
144
+ return props
145
+ }
146
+
147
+ /**
148
+ * Build common layout props (orientation, alignment, inverted)
149
+ */
150
+ export function layoutProps(
151
+ options: {
152
+ orientationValues?: string[]
153
+ alignmentValues?: string[]
154
+ defaultOrientation?: string
155
+ defaultAlignment?: string
156
+ includeInverted?: boolean
157
+ } = {}
158
+ ): PropDef[] {
159
+ const props: PropDef[] = []
160
+
161
+ if (options.orientationValues) {
162
+ props.push(
163
+ enumProp("orientation", options.orientationValues, {
164
+ default: options.defaultOrientation ?? "vertical",
165
+ description: "The layout orientation of the component."
166
+ })
167
+ )
168
+ }
169
+
170
+ if (options.alignmentValues) {
171
+ props.push(
172
+ enumProp("alignment", options.alignmentValues, {
173
+ default: options.defaultAlignment ?? "center",
174
+ description: "The content alignment."
175
+ })
176
+ )
177
+ }
178
+
179
+ if (options.includeInverted) {
180
+ props.push(
181
+ booleanProp("inverted", {
182
+ default: false,
183
+ description: "Inverts the order of content."
184
+ })
185
+ )
186
+ }
187
+
188
+ return props
189
+ }
@@ -1,35 +1,35 @@
1
- interface TurnstileResponse {
2
- "success": boolean
3
- "challenge_ts"?: string
4
- "hostname"?: string
5
- "error-codes"?: string[]
6
- "action"?: string
7
- "cdata"?: string
8
- }
9
-
10
- /**
11
- * Verify a Turnstile token with Cloudflare's API
12
- */
13
- export async function verifyTurnstileToken(
14
- token: string,
15
- secretKey: string,
16
- remoteIP?: string
17
- ): Promise<TurnstileResponse> {
18
- const response = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
19
- method: "POST",
20
- headers: {
21
- "Content-Type": "application/json"
22
- },
23
- body: JSON.stringify({
24
- secret: secretKey,
25
- response: token,
26
- remoteip: remoteIP
27
- })
28
- })
29
-
30
- if (!response.ok) {
31
- throw new Error(`Turnstile API error: ${response.status}`)
32
- }
33
-
34
- return response.json()
35
- }
1
+ interface TurnstileResponse {
2
+ "success": boolean
3
+ "challenge_ts"?: string
4
+ "hostname"?: string
5
+ "error-codes"?: string[]
6
+ "action"?: string
7
+ "cdata"?: string
8
+ }
9
+
10
+ /**
11
+ * Verify a Turnstile token with Cloudflare's API
12
+ */
13
+ export async function verifyTurnstileToken(
14
+ token: string,
15
+ secretKey: string,
16
+ remoteIP?: string
17
+ ): Promise<TurnstileResponse> {
18
+ const response = await fetch("https://challenges.cloudflare.com/turnstile/v0/siteverify", {
19
+ method: "POST",
20
+ headers: {
21
+ "Content-Type": "application/json"
22
+ },
23
+ body: JSON.stringify({
24
+ secret: secretKey,
25
+ response: token,
26
+ remoteip: remoteIP
27
+ })
28
+ })
29
+
30
+ if (!response.ok) {
31
+ throw new Error(`Turnstile API error: ${response.status}`)
32
+ }
33
+
34
+ return response.json()
35
+ }