context.dev 1.35.0 → 1.36.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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +9 -9
- data/lib/context_dev/models/web_extract_styleguide_params.rb +22 -1
- data/lib/context_dev/models/web_screenshot_params.rb +245 -1
- data/lib/context_dev/models/web_search_params.rb +270 -3
- data/lib/context_dev/models/web_web_crawl_md_params.rb +226 -1
- data/lib/context_dev/models/web_web_scrape_html_params.rb +224 -1
- data/lib/context_dev/models/web_web_scrape_md_params.rb +224 -1
- data/lib/context_dev/resources/web.rb +25 -7
- data/lib/context_dev/version.rb +1 -1
- data/rbi/context_dev/models/web_extract_styleguide_params.rbi +59 -0
- data/rbi/context_dev/models/web_screenshot_params.rbi +295 -0
- data/rbi/context_dev/models/web_search_params.rbi +288 -2
- data/rbi/context_dev/models/web_web_crawl_md_params.rbi +245 -0
- data/rbi/context_dev/models/web_web_scrape_html_params.rbi +450 -0
- data/rbi/context_dev/models/web_web_scrape_md_params.rbi +244 -0
- data/rbi/context_dev/resources/web.rbi +35 -1
- data/sig/context_dev/models/web_extract_styleguide_params.rbs +20 -0
- data/sig/context_dev/models/web_screenshot_params.rbs +446 -0
- data/sig/context_dev/models/web_search_params.rbs +503 -0
- data/sig/context_dev/models/web_web_crawl_md_params.rbs +426 -0
- data/sig/context_dev/models/web_web_scrape_html_params.rbs +426 -0
- data/sig/context_dev/models/web_web_scrape_md_params.rbs +426 -0
- data/sig/context_dev/resources/web.rbs +8 -0
- metadata +2 -2
|
@@ -14,6 +14,13 @@ module ContextDev
|
|
|
14
14
|
# @return [String]
|
|
15
15
|
required :url, String
|
|
16
16
|
|
|
17
|
+
# @!attribute country
|
|
18
|
+
# Two-letter ISO 3166-1 alpha-2 country code for the website request location.
|
|
19
|
+
# When provided, Context.dev fetches the target page from that country.
|
|
20
|
+
#
|
|
21
|
+
# @return [Symbol, ContextDev::Models::WebWebScrapeMdParams::Country, nil]
|
|
22
|
+
optional :country, enum: -> { ContextDev::WebWebScrapeMdParams::Country }
|
|
23
|
+
|
|
17
24
|
# @!attribute exclude_selectors
|
|
18
25
|
# CSS selectors to remove before conversion to Markdown. Applied after
|
|
19
26
|
# includeSelectors. Exclusion takes precedence: an element matching both is
|
|
@@ -99,12 +106,14 @@ module ContextDev
|
|
|
99
106
|
# @return [Integer, nil]
|
|
100
107
|
optional :wait_for_ms, Integer
|
|
101
108
|
|
|
102
|
-
# @!method initialize(url:, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
109
|
+
# @!method initialize(url:, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
103
110
|
# Some parameter documentations has been truncated, see
|
|
104
111
|
# {ContextDev::Models::WebWebScrapeMdParams} for more details.
|
|
105
112
|
#
|
|
106
113
|
# @param url [String] Full URL to scrape into LLM usable Markdown (must include http:// or https:// pr
|
|
107
114
|
#
|
|
115
|
+
# @param country [Symbol, ContextDev::Models::WebWebScrapeMdParams::Country] Two-letter ISO 3166-1 alpha-2 country code for the website request location. Whe
|
|
116
|
+
#
|
|
108
117
|
# @param exclude_selectors [Array<String>] CSS selectors to remove before conversion to Markdown. Applied after includeSele
|
|
109
118
|
#
|
|
110
119
|
# @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob
|
|
@@ -131,6 +140,220 @@ module ContextDev
|
|
|
131
140
|
#
|
|
132
141
|
# @param request_options [ContextDev::RequestOptions, Hash{Symbol=>Object}]
|
|
133
142
|
|
|
143
|
+
# Two-letter ISO 3166-1 alpha-2 country code for the website request location.
|
|
144
|
+
# When provided, Context.dev fetches the target page from that country.
|
|
145
|
+
module Country
|
|
146
|
+
extend ContextDev::Internal::Type::Enum
|
|
147
|
+
|
|
148
|
+
AD = :ad
|
|
149
|
+
AE = :ae
|
|
150
|
+
AF = :af
|
|
151
|
+
AG = :ag
|
|
152
|
+
AI = :ai
|
|
153
|
+
AL = :al
|
|
154
|
+
AM = :am
|
|
155
|
+
AO = :ao
|
|
156
|
+
AR = :ar
|
|
157
|
+
AT = :at
|
|
158
|
+
AU = :au
|
|
159
|
+
AW = :aw
|
|
160
|
+
AZ = :az
|
|
161
|
+
BA = :ba
|
|
162
|
+
BB = :bb
|
|
163
|
+
BD = :bd
|
|
164
|
+
BE = :be
|
|
165
|
+
BF = :bf
|
|
166
|
+
BG = :bg
|
|
167
|
+
BH = :bh
|
|
168
|
+
BI = :bi
|
|
169
|
+
BJ = :bj
|
|
170
|
+
BM = :bm
|
|
171
|
+
BN = :bn
|
|
172
|
+
BO = :bo
|
|
173
|
+
BQ = :bq
|
|
174
|
+
BR = :br
|
|
175
|
+
BS = :bs
|
|
176
|
+
BW = :bw
|
|
177
|
+
BY = :by
|
|
178
|
+
BZ = :bz
|
|
179
|
+
CA = :ca
|
|
180
|
+
CD = :cd
|
|
181
|
+
CF = :cf
|
|
182
|
+
CG = :cg
|
|
183
|
+
CH = :ch
|
|
184
|
+
CI = :ci
|
|
185
|
+
CL = :cl
|
|
186
|
+
CM = :cm
|
|
187
|
+
CN = :cn
|
|
188
|
+
CO = :co
|
|
189
|
+
CR = :cr
|
|
190
|
+
CV = :cv
|
|
191
|
+
CW = :cw
|
|
192
|
+
CY = :cy
|
|
193
|
+
CZ = :cz
|
|
194
|
+
DE = :de
|
|
195
|
+
DJ = :dj
|
|
196
|
+
DK = :dk
|
|
197
|
+
DM = :dm
|
|
198
|
+
DO = :do
|
|
199
|
+
DZ = :dz
|
|
200
|
+
EC = :ec
|
|
201
|
+
EE = :ee
|
|
202
|
+
EG = :eg
|
|
203
|
+
ES = :es
|
|
204
|
+
ET = :et
|
|
205
|
+
FI = :fi
|
|
206
|
+
FJ = :fj
|
|
207
|
+
FR = :fr
|
|
208
|
+
GA = :ga
|
|
209
|
+
GB = :gb
|
|
210
|
+
GD = :gd
|
|
211
|
+
GE = :ge
|
|
212
|
+
GF = :gf
|
|
213
|
+
GG = :gg
|
|
214
|
+
GH = :gh
|
|
215
|
+
GM = :gm
|
|
216
|
+
GN = :gn
|
|
217
|
+
GP = :gp
|
|
218
|
+
GQ = :gq
|
|
219
|
+
GR = :gr
|
|
220
|
+
GT = :gt
|
|
221
|
+
GU = :gu
|
|
222
|
+
GW = :gw
|
|
223
|
+
GY = :gy
|
|
224
|
+
HK = :hk
|
|
225
|
+
HN = :hn
|
|
226
|
+
HR = :hr
|
|
227
|
+
HT = :ht
|
|
228
|
+
HU = :hu
|
|
229
|
+
ID = :id
|
|
230
|
+
IE = :ie
|
|
231
|
+
IL = :il
|
|
232
|
+
IM = :im
|
|
233
|
+
IN = :in
|
|
234
|
+
IQ = :iq
|
|
235
|
+
IR = :ir
|
|
236
|
+
IS = :is
|
|
237
|
+
IT = :it
|
|
238
|
+
JE = :je
|
|
239
|
+
JM = :jm
|
|
240
|
+
JO = :jo
|
|
241
|
+
JP = :jp
|
|
242
|
+
KE = :ke
|
|
243
|
+
KG = :kg
|
|
244
|
+
KH = :kh
|
|
245
|
+
KN = :kn
|
|
246
|
+
KR = :kr
|
|
247
|
+
KW = :kw
|
|
248
|
+
KY = :ky
|
|
249
|
+
KZ = :kz
|
|
250
|
+
LA = :la
|
|
251
|
+
LB = :lb
|
|
252
|
+
LC = :lc
|
|
253
|
+
LK = :lk
|
|
254
|
+
LR = :lr
|
|
255
|
+
LS = :ls
|
|
256
|
+
LT = :lt
|
|
257
|
+
LU = :lu
|
|
258
|
+
LV = :lv
|
|
259
|
+
LY = :ly
|
|
260
|
+
MA = :ma
|
|
261
|
+
MC = :mc
|
|
262
|
+
MD = :md
|
|
263
|
+
ME = :me
|
|
264
|
+
MF = :mf
|
|
265
|
+
MG = :mg
|
|
266
|
+
MK = :mk
|
|
267
|
+
ML = :ml
|
|
268
|
+
MM = :mm
|
|
269
|
+
MN = :mn
|
|
270
|
+
MO = :mo
|
|
271
|
+
MQ = :mq
|
|
272
|
+
MR = :mr
|
|
273
|
+
MT = :mt
|
|
274
|
+
MU = :mu
|
|
275
|
+
MV = :mv
|
|
276
|
+
MW = :mw
|
|
277
|
+
MX = :mx
|
|
278
|
+
MY = :my
|
|
279
|
+
MZ = :mz
|
|
280
|
+
NA = :na
|
|
281
|
+
NC = :nc
|
|
282
|
+
NE = :ne
|
|
283
|
+
NG = :ng
|
|
284
|
+
NI = :ni
|
|
285
|
+
NL = :nl
|
|
286
|
+
NO = :no
|
|
287
|
+
NP = :np
|
|
288
|
+
NZ = :nz
|
|
289
|
+
OM = :om
|
|
290
|
+
PA = :pa
|
|
291
|
+
PE = :pe
|
|
292
|
+
PF = :pf
|
|
293
|
+
PG = :pg
|
|
294
|
+
PH = :ph
|
|
295
|
+
PK = :pk
|
|
296
|
+
PL = :pl
|
|
297
|
+
PR = :pr
|
|
298
|
+
PS = :ps
|
|
299
|
+
PT = :pt
|
|
300
|
+
PY = :py
|
|
301
|
+
QA = :qa
|
|
302
|
+
RE = :re
|
|
303
|
+
RO = :ro
|
|
304
|
+
RS = :rs
|
|
305
|
+
RU = :ru
|
|
306
|
+
RW = :rw
|
|
307
|
+
SA = :sa
|
|
308
|
+
SC = :sc
|
|
309
|
+
SD = :sd
|
|
310
|
+
SE = :se
|
|
311
|
+
SG = :sg
|
|
312
|
+
SI = :si
|
|
313
|
+
SK = :sk
|
|
314
|
+
SL = :sl
|
|
315
|
+
SM = :sm
|
|
316
|
+
SN = :sn
|
|
317
|
+
SO = :so
|
|
318
|
+
SR = :sr
|
|
319
|
+
SS = :ss
|
|
320
|
+
ST = :st
|
|
321
|
+
SV = :sv
|
|
322
|
+
SX = :sx
|
|
323
|
+
SY = :sy
|
|
324
|
+
SZ = :sz
|
|
325
|
+
TC = :tc
|
|
326
|
+
TD = :td
|
|
327
|
+
TG = :tg
|
|
328
|
+
TH = :th
|
|
329
|
+
TJ = :tj
|
|
330
|
+
TL = :tl
|
|
331
|
+
TM = :tm
|
|
332
|
+
TN = :tn
|
|
333
|
+
TR = :tr
|
|
334
|
+
TT = :tt
|
|
335
|
+
TW = :tw
|
|
336
|
+
TZ = :tz
|
|
337
|
+
UA = :ua
|
|
338
|
+
UG = :ug
|
|
339
|
+
US = :us
|
|
340
|
+
UY = :uy
|
|
341
|
+
UZ = :uz
|
|
342
|
+
VC = :vc
|
|
343
|
+
VE = :ve
|
|
344
|
+
VG = :vg
|
|
345
|
+
VI = :vi
|
|
346
|
+
VN = :vn
|
|
347
|
+
YE = :ye
|
|
348
|
+
YT = :yt
|
|
349
|
+
ZA = :za
|
|
350
|
+
ZM = :zm
|
|
351
|
+
ZW = :zw
|
|
352
|
+
|
|
353
|
+
# @!method self.values
|
|
354
|
+
# @return [Array<Symbol>]
|
|
355
|
+
end
|
|
356
|
+
|
|
134
357
|
class Pdf < ContextDev::Internal::Type::BaseModel
|
|
135
358
|
# @!attribute end_
|
|
136
359
|
# Last 1-based PDF page to parse. When omitted, parsing ends at the last page.
|
|
@@ -127,7 +127,9 @@ module ContextDev
|
|
|
127
127
|
# Extract a comprehensive design system from a website including colors,
|
|
128
128
|
# typography, spacing, shadows, and UI components.
|
|
129
129
|
#
|
|
130
|
-
# @overload extract_styleguide(direct_url: nil, domain: nil, max_age_ms: nil, timeout_ms: nil, request_options: {})
|
|
130
|
+
# @overload extract_styleguide(color_scheme: nil, direct_url: nil, domain: nil, max_age_ms: nil, timeout_ms: nil, request_options: {})
|
|
131
|
+
#
|
|
132
|
+
# @param color_scheme [Symbol, ContextDev::Models::WebExtractStyleguideParams::ColorScheme] Optional browser color scheme to emulate for websites that respond to prefers-co
|
|
131
133
|
#
|
|
132
134
|
# @param direct_url [String] A specific URL to fetch the styleguide from directly, bypassing domain resolutio
|
|
133
135
|
#
|
|
@@ -149,6 +151,7 @@ module ContextDev
|
|
|
149
151
|
method: :get,
|
|
150
152
|
path: "web/styleguide",
|
|
151
153
|
query: query.transform_keys(
|
|
154
|
+
color_scheme: "colorScheme",
|
|
152
155
|
direct_url: "directUrl",
|
|
153
156
|
max_age_ms: "maxAgeMs",
|
|
154
157
|
timeout_ms: "timeoutMS"
|
|
@@ -163,7 +166,11 @@ module ContextDev
|
|
|
163
166
|
#
|
|
164
167
|
# Capture a screenshot of a website.
|
|
165
168
|
#
|
|
166
|
-
# @overload screenshot(direct_url: nil, domain: nil, full_screenshot: nil, handle_cookie_popup: nil, max_age_ms: nil, page: nil, scroll_offset: nil, timeout_ms: nil, viewport: nil, wait_for_ms: nil, request_options: {})
|
|
169
|
+
# @overload screenshot(color_scheme: nil, country: nil, direct_url: nil, domain: nil, full_screenshot: nil, handle_cookie_popup: nil, max_age_ms: nil, page: nil, scroll_offset: nil, timeout_ms: nil, viewport: nil, wait_for_ms: nil, request_options: {})
|
|
170
|
+
#
|
|
171
|
+
# @param color_scheme [Symbol, ContextDev::Models::WebScreenshotParams::ColorScheme] Optional parameter to choose the site's visual theme in the screenshot. Use 'lig
|
|
172
|
+
#
|
|
173
|
+
# @param country [Symbol, ContextDev::Models::WebScreenshotParams::Country] Two-letter ISO 3166-1 alpha-2 country code for the website request location. Whe
|
|
167
174
|
#
|
|
168
175
|
# @param direct_url [String] A specific URL to screenshot directly, bypassing domain resolution (e.g., 'https
|
|
169
176
|
#
|
|
@@ -197,6 +204,7 @@ module ContextDev
|
|
|
197
204
|
method: :get,
|
|
198
205
|
path: "web/screenshot",
|
|
199
206
|
query: query.transform_keys(
|
|
207
|
+
color_scheme: "colorScheme",
|
|
200
208
|
direct_url: "directUrl",
|
|
201
209
|
full_screenshot: "fullScreenshot",
|
|
202
210
|
handle_cookie_popup: "handleCookiePopup",
|
|
@@ -215,9 +223,11 @@ module ContextDev
|
|
|
215
223
|
#
|
|
216
224
|
# Search the web and optionally scrape each result to Markdown in one round-trip.
|
|
217
225
|
#
|
|
218
|
-
# @overload search(query:, exclude_domains: nil, freshness: nil, include_domains: nil, markdown_options: nil, query_fanout: nil, timeout_ms: nil, request_options: {})
|
|
226
|
+
# @overload search(query:, country: nil, exclude_domains: nil, freshness: nil, include_domains: nil, markdown_options: nil, num_results: nil, query_fanout: nil, timeout_ms: nil, request_options: {})
|
|
227
|
+
#
|
|
228
|
+
# @param query [String] Search query. Accepts natural language as well as Google-style search operators
|
|
219
229
|
#
|
|
220
|
-
# @param
|
|
230
|
+
# @param country [Symbol, ContextDev::Models::WebSearchParams::Country] Two-letter ISO 3166-1 alpha-2 country code to localize results to a specific cou
|
|
221
231
|
#
|
|
222
232
|
# @param exclude_domains [Array<String>] Blocklist — drop results from these domains. Example: ["pinterest.com", "reddit.
|
|
223
233
|
#
|
|
@@ -227,6 +237,8 @@ module ContextDev
|
|
|
227
237
|
#
|
|
228
238
|
# @param markdown_options [ContextDev::Models::WebSearchParams::MarkdownOptions] Inline Markdown scraping for each result. Set `enabled: true` to activate.
|
|
229
239
|
#
|
|
240
|
+
# @param num_results [Integer] Number of results to request and return (10–100). Defaults to 10.
|
|
241
|
+
#
|
|
230
242
|
# @param query_fanout [Boolean] Expand the query into multiple parallel variants for broader recall.
|
|
231
243
|
#
|
|
232
244
|
# @param timeout_ms [Integer] Optional timeout in milliseconds for the request. If the request takes longer th
|
|
@@ -253,10 +265,12 @@ module ContextDev
|
|
|
253
265
|
# Performs a crawl starting from a given URL, extracts page content as Markdown,
|
|
254
266
|
# and returns results for all crawled pages.
|
|
255
267
|
#
|
|
256
|
-
# @overload web_crawl_md(url:, exclude_selectors: nil, follow_subdomains: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, pdf: nil, shorten_base64_images: nil, stop_after_ms: nil, timeout_ms: nil, url_regex: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
268
|
+
# @overload web_crawl_md(url:, country: nil, exclude_selectors: nil, follow_subdomains: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, max_depth: nil, max_pages: nil, pdf: nil, shorten_base64_images: nil, stop_after_ms: nil, timeout_ms: nil, url_regex: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
257
269
|
#
|
|
258
270
|
# @param url [String] The starting URL for the crawl (must include http:// or https:// protocol)
|
|
259
271
|
#
|
|
272
|
+
# @param country [Symbol, ContextDev::Models::WebWebCrawlMdParams::Country] Two-letter ISO 3166-1 alpha-2 country code identifying a supported Context.dev r
|
|
273
|
+
#
|
|
260
274
|
# @param exclude_selectors [Array<String>] CSS selectors to remove before each crawled page is converted to Markdown. Appli
|
|
261
275
|
#
|
|
262
276
|
# @param follow_subdomains [Boolean] When true, follow links on subdomains of the starting URL's domain (e.g. docs.ex
|
|
@@ -310,10 +324,12 @@ module ContextDev
|
|
|
310
324
|
#
|
|
311
325
|
# Scrapes the given URL and returns the raw HTML content of the page.
|
|
312
326
|
#
|
|
313
|
-
# @overload web_scrape_html(url:, exclude_selectors: nil, headers: nil, include_frames: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
327
|
+
# @overload web_scrape_html(url:, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
314
328
|
#
|
|
315
329
|
# @param url [String] Full URL to scrape (must include http:// or https:// protocol)
|
|
316
330
|
#
|
|
331
|
+
# @param country [Symbol, ContextDev::Models::WebWebScrapeHTMLParams::Country] Two-letter ISO 3166-1 alpha-2 country code for the website request location. Whe
|
|
332
|
+
#
|
|
317
333
|
# @param exclude_selectors [Array<String>] CSS selectors to remove from the result. Applied after includeSelectors. Exclusi
|
|
318
334
|
#
|
|
319
335
|
# @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob
|
|
@@ -405,10 +421,12 @@ module ContextDev
|
|
|
405
421
|
#
|
|
406
422
|
# Scrapes the given URL into LLM usable Markdown.
|
|
407
423
|
#
|
|
408
|
-
# @overload web_scrape_md(url:, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
424
|
+
# @overload web_scrape_md(url:, country: nil, exclude_selectors: nil, headers: nil, include_frames: nil, include_images: nil, include_links: nil, include_selectors: nil, max_age_ms: nil, pdf: nil, shorten_base64_images: nil, timeout_ms: nil, use_main_content_only: nil, wait_for_ms: nil, request_options: {})
|
|
409
425
|
#
|
|
410
426
|
# @param url [String] Full URL to scrape into LLM usable Markdown (must include http:// or https:// pr
|
|
411
427
|
#
|
|
428
|
+
# @param country [Symbol, ContextDev::Models::WebWebScrapeMdParams::Country] Two-letter ISO 3166-1 alpha-2 country code for the website request location. Whe
|
|
429
|
+
#
|
|
412
430
|
# @param exclude_selectors [Array<String>] CSS selectors to remove before conversion to Markdown. Applied after includeSele
|
|
413
431
|
#
|
|
414
432
|
# @param headers [Hash{Symbol=>String}] Optional outbound HTTP headers forwarded only to the target URL, sent as deep-ob
|
data/lib/context_dev/version.rb
CHANGED
|
@@ -14,6 +14,25 @@ module ContextDev
|
|
|
14
14
|
)
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Optional browser color scheme to emulate for websites that respond to
|
|
18
|
+
# prefers-color-scheme. This value is part of the styleguide cache key.
|
|
19
|
+
sig do
|
|
20
|
+
returns(
|
|
21
|
+
T.nilable(
|
|
22
|
+
ContextDev::WebExtractStyleguideParams::ColorScheme::OrSymbol
|
|
23
|
+
)
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
attr_reader :color_scheme
|
|
27
|
+
|
|
28
|
+
sig do
|
|
29
|
+
params(
|
|
30
|
+
color_scheme:
|
|
31
|
+
ContextDev::WebExtractStyleguideParams::ColorScheme::OrSymbol
|
|
32
|
+
).void
|
|
33
|
+
end
|
|
34
|
+
attr_writer :color_scheme
|
|
35
|
+
|
|
17
36
|
# A specific URL to fetch the styleguide from directly, bypassing domain
|
|
18
37
|
# resolution (e.g., 'https://example.com/design-system'). When provided, the
|
|
19
38
|
# styleguide is extracted from this exact URL. You must provide either 'domain' or
|
|
@@ -54,6 +73,8 @@ module ContextDev
|
|
|
54
73
|
|
|
55
74
|
sig do
|
|
56
75
|
params(
|
|
76
|
+
color_scheme:
|
|
77
|
+
ContextDev::WebExtractStyleguideParams::ColorScheme::OrSymbol,
|
|
57
78
|
direct_url: String,
|
|
58
79
|
domain: String,
|
|
59
80
|
max_age_ms: Integer,
|
|
@@ -62,6 +83,9 @@ module ContextDev
|
|
|
62
83
|
).returns(T.attached_class)
|
|
63
84
|
end
|
|
64
85
|
def self.new(
|
|
86
|
+
# Optional browser color scheme to emulate for websites that respond to
|
|
87
|
+
# prefers-color-scheme. This value is part of the styleguide cache key.
|
|
88
|
+
color_scheme: nil,
|
|
65
89
|
# A specific URL to fetch the styleguide from directly, bypassing domain
|
|
66
90
|
# resolution (e.g., 'https://example.com/design-system'). When provided, the
|
|
67
91
|
# styleguide is extracted from this exact URL. You must provide either 'domain' or
|
|
@@ -87,6 +111,8 @@ module ContextDev
|
|
|
87
111
|
sig do
|
|
88
112
|
override.returns(
|
|
89
113
|
{
|
|
114
|
+
color_scheme:
|
|
115
|
+
ContextDev::WebExtractStyleguideParams::ColorScheme::OrSymbol,
|
|
90
116
|
direct_url: String,
|
|
91
117
|
domain: String,
|
|
92
118
|
max_age_ms: Integer,
|
|
@@ -97,6 +123,39 @@ module ContextDev
|
|
|
97
123
|
end
|
|
98
124
|
def to_hash
|
|
99
125
|
end
|
|
126
|
+
|
|
127
|
+
# Optional browser color scheme to emulate for websites that respond to
|
|
128
|
+
# prefers-color-scheme. This value is part of the styleguide cache key.
|
|
129
|
+
module ColorScheme
|
|
130
|
+
extend ContextDev::Internal::Type::Enum
|
|
131
|
+
|
|
132
|
+
TaggedSymbol =
|
|
133
|
+
T.type_alias do
|
|
134
|
+
T.all(Symbol, ContextDev::WebExtractStyleguideParams::ColorScheme)
|
|
135
|
+
end
|
|
136
|
+
OrSymbol = T.type_alias { T.any(Symbol, String) }
|
|
137
|
+
|
|
138
|
+
LIGHT =
|
|
139
|
+
T.let(
|
|
140
|
+
:light,
|
|
141
|
+
ContextDev::WebExtractStyleguideParams::ColorScheme::TaggedSymbol
|
|
142
|
+
)
|
|
143
|
+
DARK =
|
|
144
|
+
T.let(
|
|
145
|
+
:dark,
|
|
146
|
+
ContextDev::WebExtractStyleguideParams::ColorScheme::TaggedSymbol
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
sig do
|
|
150
|
+
override.returns(
|
|
151
|
+
T::Array[
|
|
152
|
+
ContextDev::WebExtractStyleguideParams::ColorScheme::TaggedSymbol
|
|
153
|
+
]
|
|
154
|
+
)
|
|
155
|
+
end
|
|
156
|
+
def self.values
|
|
157
|
+
end
|
|
158
|
+
end
|
|
100
159
|
end
|
|
101
160
|
end
|
|
102
161
|
end
|