mithwire 0.50.3__py3-none-any.whl

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 (76) hide show
  1. mithwire/__init__.py +32 -0
  2. mithwire/cdp/README.md +4 -0
  3. mithwire/cdp/__init__.py +6 -0
  4. mithwire/cdp/accessibility.py +668 -0
  5. mithwire/cdp/animation.py +494 -0
  6. mithwire/cdp/audits.py +1995 -0
  7. mithwire/cdp/autofill.py +292 -0
  8. mithwire/cdp/background_service.py +215 -0
  9. mithwire/cdp/bluetooth_emulation.py +626 -0
  10. mithwire/cdp/browser.py +821 -0
  11. mithwire/cdp/cache_storage.py +311 -0
  12. mithwire/cdp/cast.py +172 -0
  13. mithwire/cdp/console.py +107 -0
  14. mithwire/cdp/crash_report_context.py +55 -0
  15. mithwire/cdp/css.py +2750 -0
  16. mithwire/cdp/database.py +179 -0
  17. mithwire/cdp/debugger.py +1405 -0
  18. mithwire/cdp/device_access.py +141 -0
  19. mithwire/cdp/device_orientation.py +45 -0
  20. mithwire/cdp/dom.py +2257 -0
  21. mithwire/cdp/dom_debugger.py +321 -0
  22. mithwire/cdp/dom_snapshot.py +876 -0
  23. mithwire/cdp/dom_storage.py +222 -0
  24. mithwire/cdp/emulation.py +1779 -0
  25. mithwire/cdp/event_breakpoints.py +56 -0
  26. mithwire/cdp/extensions.py +238 -0
  27. mithwire/cdp/fed_cm.py +283 -0
  28. mithwire/cdp/fetch.py +507 -0
  29. mithwire/cdp/file_system.py +115 -0
  30. mithwire/cdp/headless_experimental.py +115 -0
  31. mithwire/cdp/heap_profiler.py +401 -0
  32. mithwire/cdp/indexed_db.py +528 -0
  33. mithwire/cdp/input_.py +701 -0
  34. mithwire/cdp/inspector.py +95 -0
  35. mithwire/cdp/io.py +101 -0
  36. mithwire/cdp/layer_tree.py +464 -0
  37. mithwire/cdp/log.py +190 -0
  38. mithwire/cdp/media.py +313 -0
  39. mithwire/cdp/memory.py +305 -0
  40. mithwire/cdp/network.py +5342 -0
  41. mithwire/cdp/overlay.py +1468 -0
  42. mithwire/cdp/page.py +3972 -0
  43. mithwire/cdp/performance.py +124 -0
  44. mithwire/cdp/performance_timeline.py +200 -0
  45. mithwire/cdp/preload.py +575 -0
  46. mithwire/cdp/profiler.py +420 -0
  47. mithwire/cdp/pwa.py +278 -0
  48. mithwire/cdp/py.typed +0 -0
  49. mithwire/cdp/runtime.py +1589 -0
  50. mithwire/cdp/schema.py +50 -0
  51. mithwire/cdp/security.py +518 -0
  52. mithwire/cdp/service_worker.py +401 -0
  53. mithwire/cdp/smart_card_emulation.py +891 -0
  54. mithwire/cdp/storage.py +1573 -0
  55. mithwire/cdp/system_info.py +327 -0
  56. mithwire/cdp/target.py +829 -0
  57. mithwire/cdp/tethering.py +65 -0
  58. mithwire/cdp/tracing.py +377 -0
  59. mithwire/cdp/util.py +18 -0
  60. mithwire/cdp/web_audio.py +606 -0
  61. mithwire/cdp/web_authn.py +598 -0
  62. mithwire/cdp/web_mcp.py +293 -0
  63. mithwire/core/_contradict.py +142 -0
  64. mithwire/core/browser.py +923 -0
  65. mithwire/core/cf_templates/cf_dark_checkbox.png +0 -0
  66. mithwire/core/cf_templates/cf_light_checkbox.png +0 -0
  67. mithwire/core/config.py +323 -0
  68. mithwire/core/connection.py +564 -0
  69. mithwire/core/element.py +1205 -0
  70. mithwire/core/tab.py +2202 -0
  71. mithwire/core/util.py +5063 -0
  72. mithwire-0.50.3.dist-info/METADATA +1049 -0
  73. mithwire-0.50.3.dist-info/RECORD +76 -0
  74. mithwire-0.50.3.dist-info/WHEEL +5 -0
  75. mithwire-0.50.3.dist-info/licenses/LICENSE.txt +619 -0
  76. mithwire-0.50.3.dist-info/top_level.txt +1 -0
mithwire/cdp/css.py ADDED
@@ -0,0 +1,2750 @@
1
+ # DO NOT EDIT THIS FILE!
2
+ #
3
+ # This file is generated from the CDP specification. If you need to make
4
+ # changes, edit the generator and regenerate all of the modules.
5
+ #
6
+ # CDP domain: CSS (experimental)
7
+
8
+ from __future__ import annotations
9
+ import enum
10
+ import typing
11
+ from dataclasses import dataclass
12
+ from .util import event_class, T_JSON_DICT
13
+
14
+ from . import dom
15
+ from . import page
16
+ from deprecated.sphinx import deprecated # type: ignore
17
+
18
+
19
+ class StyleSheetOrigin(enum.Enum):
20
+ '''
21
+ Stylesheet type: "injected" for stylesheets injected via extension, "user-agent" for user-agent
22
+ stylesheets, "inspector" for stylesheets created by the inspector (i.e. those holding the "via
23
+ inspector" rules), "regular" for regular stylesheets.
24
+ '''
25
+ INJECTED = "injected"
26
+ USER_AGENT = "user-agent"
27
+ INSPECTOR = "inspector"
28
+ REGULAR = "regular"
29
+
30
+ def to_json(self) -> str:
31
+ return self.value
32
+
33
+ @classmethod
34
+ def from_json(cls, json: str) -> StyleSheetOrigin:
35
+ return cls(json)
36
+
37
+
38
+ @dataclass
39
+ class PseudoElementMatches:
40
+ '''
41
+ CSS rule collection for a single pseudo style.
42
+ '''
43
+ #: Pseudo element type.
44
+ pseudo_type: dom.PseudoType
45
+
46
+ #: Matches of CSS rules applicable to the pseudo style.
47
+ matches: typing.List[RuleMatch]
48
+
49
+ #: Pseudo element custom ident.
50
+ pseudo_identifier: typing.Optional[str] = None
51
+
52
+ def to_json(self) -> T_JSON_DICT:
53
+ json: T_JSON_DICT = dict()
54
+ json['pseudoType'] = self.pseudo_type.to_json()
55
+ json['matches'] = [i.to_json() for i in self.matches]
56
+ if self.pseudo_identifier is not None:
57
+ json['pseudoIdentifier'] = self.pseudo_identifier
58
+ return json
59
+
60
+ @classmethod
61
+ def from_json(cls, json: T_JSON_DICT) -> PseudoElementMatches:
62
+ return cls(
63
+ pseudo_type=dom.PseudoType.from_json(json['pseudoType']),
64
+ matches=[RuleMatch.from_json(i) for i in json['matches']],
65
+ pseudo_identifier=str(json['pseudoIdentifier']) if json.get('pseudoIdentifier', None) is not None else None,
66
+ )
67
+
68
+
69
+ @dataclass
70
+ class CSSAnimationStyle:
71
+ '''
72
+ CSS style coming from animations with the name of the animation.
73
+ '''
74
+ #: The style coming from the animation.
75
+ style: CSSStyle
76
+
77
+ #: The name of the animation.
78
+ name: typing.Optional[str] = None
79
+
80
+ def to_json(self) -> T_JSON_DICT:
81
+ json: T_JSON_DICT = dict()
82
+ json['style'] = self.style.to_json()
83
+ if self.name is not None:
84
+ json['name'] = self.name
85
+ return json
86
+
87
+ @classmethod
88
+ def from_json(cls, json: T_JSON_DICT) -> CSSAnimationStyle:
89
+ return cls(
90
+ style=CSSStyle.from_json(json['style']),
91
+ name=str(json['name']) if json.get('name', None) is not None else None,
92
+ )
93
+
94
+
95
+ @dataclass
96
+ class InheritedStyleEntry:
97
+ '''
98
+ Inherited CSS rule collection from ancestor node.
99
+ '''
100
+ #: Matches of CSS rules matching the ancestor node in the style inheritance chain.
101
+ matched_css_rules: typing.List[RuleMatch]
102
+
103
+ #: The ancestor node's inline style, if any, in the style inheritance chain.
104
+ inline_style: typing.Optional[CSSStyle] = None
105
+
106
+ def to_json(self) -> T_JSON_DICT:
107
+ json: T_JSON_DICT = dict()
108
+ json['matchedCSSRules'] = [i.to_json() for i in self.matched_css_rules]
109
+ if self.inline_style is not None:
110
+ json['inlineStyle'] = self.inline_style.to_json()
111
+ return json
112
+
113
+ @classmethod
114
+ def from_json(cls, json: T_JSON_DICT) -> InheritedStyleEntry:
115
+ return cls(
116
+ matched_css_rules=[RuleMatch.from_json(i) for i in json['matchedCSSRules']],
117
+ inline_style=CSSStyle.from_json(json['inlineStyle']) if json.get('inlineStyle', None) is not None else None,
118
+ )
119
+
120
+
121
+ @dataclass
122
+ class InheritedAnimatedStyleEntry:
123
+ '''
124
+ Inherited CSS style collection for animated styles from ancestor node.
125
+ '''
126
+ #: Styles coming from the animations of the ancestor, if any, in the style inheritance chain.
127
+ animation_styles: typing.Optional[typing.List[CSSAnimationStyle]] = None
128
+
129
+ #: The style coming from the transitions of the ancestor, if any, in the style inheritance chain.
130
+ transitions_style: typing.Optional[CSSStyle] = None
131
+
132
+ def to_json(self) -> T_JSON_DICT:
133
+ json: T_JSON_DICT = dict()
134
+ if self.animation_styles is not None:
135
+ json['animationStyles'] = [i.to_json() for i in self.animation_styles]
136
+ if self.transitions_style is not None:
137
+ json['transitionsStyle'] = self.transitions_style.to_json()
138
+ return json
139
+
140
+ @classmethod
141
+ def from_json(cls, json: T_JSON_DICT) -> InheritedAnimatedStyleEntry:
142
+ return cls(
143
+ animation_styles=[CSSAnimationStyle.from_json(i) for i in json['animationStyles']] if json.get('animationStyles', None) is not None else None,
144
+ transitions_style=CSSStyle.from_json(json['transitionsStyle']) if json.get('transitionsStyle', None) is not None else None,
145
+ )
146
+
147
+
148
+ @dataclass
149
+ class InheritedPseudoElementMatches:
150
+ '''
151
+ Inherited pseudo element matches from pseudos of an ancestor node.
152
+ '''
153
+ #: Matches of pseudo styles from the pseudos of an ancestor node.
154
+ pseudo_elements: typing.List[PseudoElementMatches]
155
+
156
+ def to_json(self) -> T_JSON_DICT:
157
+ json: T_JSON_DICT = dict()
158
+ json['pseudoElements'] = [i.to_json() for i in self.pseudo_elements]
159
+ return json
160
+
161
+ @classmethod
162
+ def from_json(cls, json: T_JSON_DICT) -> InheritedPseudoElementMatches:
163
+ return cls(
164
+ pseudo_elements=[PseudoElementMatches.from_json(i) for i in json['pseudoElements']],
165
+ )
166
+
167
+
168
+ @dataclass
169
+ class RuleMatch:
170
+ '''
171
+ Match data for a CSS rule.
172
+ '''
173
+ #: CSS rule in the match.
174
+ rule: CSSRule
175
+
176
+ #: Matching selector indices in the rule's selectorList selectors (0-based).
177
+ matching_selectors: typing.List[int]
178
+
179
+ def to_json(self) -> T_JSON_DICT:
180
+ json: T_JSON_DICT = dict()
181
+ json['rule'] = self.rule.to_json()
182
+ json['matchingSelectors'] = [i for i in self.matching_selectors]
183
+ return json
184
+
185
+ @classmethod
186
+ def from_json(cls, json: T_JSON_DICT) -> RuleMatch:
187
+ return cls(
188
+ rule=CSSRule.from_json(json['rule']),
189
+ matching_selectors=[int(i) for i in json['matchingSelectors']],
190
+ )
191
+
192
+
193
+ @dataclass
194
+ class Value:
195
+ '''
196
+ Data for a simple selector (these are delimited by commas in a selector list).
197
+ '''
198
+ #: Value text.
199
+ text: str
200
+
201
+ #: Value range in the underlying resource (if available).
202
+ range_: typing.Optional[SourceRange] = None
203
+
204
+ #: Specificity of the selector.
205
+ specificity: typing.Optional[Specificity] = None
206
+
207
+ def to_json(self) -> T_JSON_DICT:
208
+ json: T_JSON_DICT = dict()
209
+ json['text'] = self.text
210
+ if self.range_ is not None:
211
+ json['range'] = self.range_.to_json()
212
+ if self.specificity is not None:
213
+ json['specificity'] = self.specificity.to_json()
214
+ return json
215
+
216
+ @classmethod
217
+ def from_json(cls, json: T_JSON_DICT) -> Value:
218
+ return cls(
219
+ text=str(json['text']),
220
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
221
+ specificity=Specificity.from_json(json['specificity']) if json.get('specificity', None) is not None else None,
222
+ )
223
+
224
+
225
+ @dataclass
226
+ class Specificity:
227
+ '''
228
+ Specificity:
229
+ https://drafts.csswg.org/selectors/#specificity-rules
230
+ '''
231
+ #: The a component, which represents the number of ID selectors.
232
+ a: int
233
+
234
+ #: The b component, which represents the number of class selectors, attributes selectors, and
235
+ #: pseudo-classes.
236
+ b: int
237
+
238
+ #: The c component, which represents the number of type selectors and pseudo-elements.
239
+ c: int
240
+
241
+ def to_json(self) -> T_JSON_DICT:
242
+ json: T_JSON_DICT = dict()
243
+ json['a'] = self.a
244
+ json['b'] = self.b
245
+ json['c'] = self.c
246
+ return json
247
+
248
+ @classmethod
249
+ def from_json(cls, json: T_JSON_DICT) -> Specificity:
250
+ return cls(
251
+ a=int(json['a']),
252
+ b=int(json['b']),
253
+ c=int(json['c']),
254
+ )
255
+
256
+
257
+ @dataclass
258
+ class SelectorList:
259
+ '''
260
+ Selector list data.
261
+ '''
262
+ #: Selectors in the list.
263
+ selectors: typing.List[Value]
264
+
265
+ #: Rule selector text.
266
+ text: str
267
+
268
+ def to_json(self) -> T_JSON_DICT:
269
+ json: T_JSON_DICT = dict()
270
+ json['selectors'] = [i.to_json() for i in self.selectors]
271
+ json['text'] = self.text
272
+ return json
273
+
274
+ @classmethod
275
+ def from_json(cls, json: T_JSON_DICT) -> SelectorList:
276
+ return cls(
277
+ selectors=[Value.from_json(i) for i in json['selectors']],
278
+ text=str(json['text']),
279
+ )
280
+
281
+
282
+ @dataclass
283
+ class CSSStyleSheetHeader:
284
+ '''
285
+ CSS stylesheet metainformation.
286
+ '''
287
+ #: The stylesheet identifier.
288
+ style_sheet_id: dom.StyleSheetId
289
+
290
+ #: Owner frame identifier.
291
+ frame_id: page.FrameId
292
+
293
+ #: Stylesheet resource URL. Empty if this is a constructed stylesheet created using
294
+ #: new CSSStyleSheet() (but non-empty if this is a constructed stylesheet imported
295
+ #: as a CSS module script).
296
+ source_url: str
297
+
298
+ #: Stylesheet origin.
299
+ origin: StyleSheetOrigin
300
+
301
+ #: Stylesheet title.
302
+ title: str
303
+
304
+ #: Denotes whether the stylesheet is disabled.
305
+ disabled: bool
306
+
307
+ #: Whether this stylesheet is created for STYLE tag by parser. This flag is not set for
308
+ #: document.written STYLE tags.
309
+ is_inline: bool
310
+
311
+ #: Whether this stylesheet is mutable. Inline stylesheets become mutable
312
+ #: after they have been modified via CSSOM API.
313
+ #: ``<link>`` element's stylesheets become mutable only if DevTools modifies them.
314
+ #: Constructed stylesheets (new CSSStyleSheet()) are mutable immediately after creation.
315
+ is_mutable: bool
316
+
317
+ #: True if this stylesheet is created through new CSSStyleSheet() or imported as a
318
+ #: CSS module script.
319
+ is_constructed: bool
320
+
321
+ #: Line offset of the stylesheet within the resource (zero based).
322
+ start_line: float
323
+
324
+ #: Column offset of the stylesheet within the resource (zero based).
325
+ start_column: float
326
+
327
+ #: Size of the content (in characters).
328
+ length: float
329
+
330
+ #: Line offset of the end of the stylesheet within the resource (zero based).
331
+ end_line: float
332
+
333
+ #: Column offset of the end of the stylesheet within the resource (zero based).
334
+ end_column: float
335
+
336
+ #: URL of source map associated with the stylesheet (if any).
337
+ source_map_url: typing.Optional[str] = None
338
+
339
+ #: The backend id for the owner node of the stylesheet.
340
+ owner_node: typing.Optional[dom.BackendNodeId] = None
341
+
342
+ #: Whether the sourceURL field value comes from the sourceURL comment.
343
+ has_source_url: typing.Optional[bool] = None
344
+
345
+ #: If the style sheet was loaded from a network resource, this indicates when the resource failed to load
346
+ loading_failed: typing.Optional[bool] = None
347
+
348
+ def to_json(self) -> T_JSON_DICT:
349
+ json: T_JSON_DICT = dict()
350
+ json['styleSheetId'] = self.style_sheet_id.to_json()
351
+ json['frameId'] = self.frame_id.to_json()
352
+ json['sourceURL'] = self.source_url
353
+ json['origin'] = self.origin.to_json()
354
+ json['title'] = self.title
355
+ json['disabled'] = self.disabled
356
+ json['isInline'] = self.is_inline
357
+ json['isMutable'] = self.is_mutable
358
+ json['isConstructed'] = self.is_constructed
359
+ json['startLine'] = self.start_line
360
+ json['startColumn'] = self.start_column
361
+ json['length'] = self.length
362
+ json['endLine'] = self.end_line
363
+ json['endColumn'] = self.end_column
364
+ if self.source_map_url is not None:
365
+ json['sourceMapURL'] = self.source_map_url
366
+ if self.owner_node is not None:
367
+ json['ownerNode'] = self.owner_node.to_json()
368
+ if self.has_source_url is not None:
369
+ json['hasSourceURL'] = self.has_source_url
370
+ if self.loading_failed is not None:
371
+ json['loadingFailed'] = self.loading_failed
372
+ return json
373
+
374
+ @classmethod
375
+ def from_json(cls, json: T_JSON_DICT) -> CSSStyleSheetHeader:
376
+ return cls(
377
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']),
378
+ frame_id=page.FrameId.from_json(json['frameId']),
379
+ source_url=str(json['sourceURL']),
380
+ origin=StyleSheetOrigin.from_json(json['origin']),
381
+ title=str(json['title']),
382
+ disabled=bool(json['disabled']),
383
+ is_inline=bool(json['isInline']),
384
+ is_mutable=bool(json['isMutable']),
385
+ is_constructed=bool(json['isConstructed']),
386
+ start_line=float(json['startLine']),
387
+ start_column=float(json['startColumn']),
388
+ length=float(json['length']),
389
+ end_line=float(json['endLine']),
390
+ end_column=float(json['endColumn']),
391
+ source_map_url=str(json['sourceMapURL']) if json.get('sourceMapURL', None) is not None else None,
392
+ owner_node=dom.BackendNodeId.from_json(json['ownerNode']) if json.get('ownerNode', None) is not None else None,
393
+ has_source_url=bool(json['hasSourceURL']) if json.get('hasSourceURL', None) is not None else None,
394
+ loading_failed=bool(json['loadingFailed']) if json.get('loadingFailed', None) is not None else None,
395
+ )
396
+
397
+
398
+ @dataclass
399
+ class CSSRule:
400
+ '''
401
+ CSS rule representation.
402
+ '''
403
+ #: Rule selector data.
404
+ selector_list: SelectorList
405
+
406
+ #: Parent stylesheet's origin.
407
+ origin: StyleSheetOrigin
408
+
409
+ #: Associated style declaration.
410
+ style: CSSStyle
411
+
412
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
413
+ #: stylesheet rules) this rule came from.
414
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
415
+
416
+ #: Array of selectors from ancestor style rules, sorted by distance from the current rule.
417
+ nesting_selectors: typing.Optional[typing.List[str]] = None
418
+
419
+ #: The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
420
+ origin_tree_scope_node_id: typing.Optional[dom.BackendNodeId] = None
421
+
422
+ #: Media list array (for rules involving media queries). The array enumerates media queries
423
+ #: starting with the innermost one, going outwards.
424
+ media: typing.Optional[typing.List[CSSMedia]] = None
425
+
426
+ #: Container query list array (for rules involving container queries).
427
+ #: The array enumerates container queries starting with the innermost one, going outwards.
428
+ container_queries: typing.Optional[typing.List[CSSContainerQuery]] = None
429
+
430
+ #: @supports CSS at-rule array.
431
+ #: The array enumerates @supports at-rules starting with the innermost one, going outwards.
432
+ supports: typing.Optional[typing.List[CSSSupports]] = None
433
+
434
+ #: Cascade layer array. Contains the layer hierarchy that this rule belongs to starting
435
+ #: with the innermost layer and going outwards.
436
+ layers: typing.Optional[typing.List[CSSLayer]] = None
437
+
438
+ #: @scope CSS at-rule array.
439
+ #: The array enumerates @scope at-rules starting with the innermost one, going outwards.
440
+ scopes: typing.Optional[typing.List[CSSScope]] = None
441
+
442
+ #: The array keeps the types of ancestor CSSRules from the innermost going outwards.
443
+ rule_types: typing.Optional[typing.List[CSSRuleType]] = None
444
+
445
+ #: @starting-style CSS at-rule array.
446
+ #: The array enumerates @starting-style at-rules starting with the innermost one, going outwards.
447
+ starting_styles: typing.Optional[typing.List[CSSStartingStyle]] = None
448
+
449
+ #: @navigation CSS at-rule array.
450
+ #: The array enumerates @navigation at-rules starting with the innermost one, going outwards.
451
+ navigations: typing.Optional[typing.List[CSSNavigation]] = None
452
+
453
+ def to_json(self) -> T_JSON_DICT:
454
+ json: T_JSON_DICT = dict()
455
+ json['selectorList'] = self.selector_list.to_json()
456
+ json['origin'] = self.origin.to_json()
457
+ json['style'] = self.style.to_json()
458
+ if self.style_sheet_id is not None:
459
+ json['styleSheetId'] = self.style_sheet_id.to_json()
460
+ if self.nesting_selectors is not None:
461
+ json['nestingSelectors'] = [i for i in self.nesting_selectors]
462
+ if self.origin_tree_scope_node_id is not None:
463
+ json['originTreeScopeNodeId'] = self.origin_tree_scope_node_id.to_json()
464
+ if self.media is not None:
465
+ json['media'] = [i.to_json() for i in self.media]
466
+ if self.container_queries is not None:
467
+ json['containerQueries'] = [i.to_json() for i in self.container_queries]
468
+ if self.supports is not None:
469
+ json['supports'] = [i.to_json() for i in self.supports]
470
+ if self.layers is not None:
471
+ json['layers'] = [i.to_json() for i in self.layers]
472
+ if self.scopes is not None:
473
+ json['scopes'] = [i.to_json() for i in self.scopes]
474
+ if self.rule_types is not None:
475
+ json['ruleTypes'] = [i.to_json() for i in self.rule_types]
476
+ if self.starting_styles is not None:
477
+ json['startingStyles'] = [i.to_json() for i in self.starting_styles]
478
+ if self.navigations is not None:
479
+ json['navigations'] = [i.to_json() for i in self.navigations]
480
+ return json
481
+
482
+ @classmethod
483
+ def from_json(cls, json: T_JSON_DICT) -> CSSRule:
484
+ return cls(
485
+ selector_list=SelectorList.from_json(json['selectorList']),
486
+ origin=StyleSheetOrigin.from_json(json['origin']),
487
+ style=CSSStyle.from_json(json['style']),
488
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
489
+ nesting_selectors=[str(i) for i in json['nestingSelectors']] if json.get('nestingSelectors', None) is not None else None,
490
+ origin_tree_scope_node_id=dom.BackendNodeId.from_json(json['originTreeScopeNodeId']) if json.get('originTreeScopeNodeId', None) is not None else None,
491
+ media=[CSSMedia.from_json(i) for i in json['media']] if json.get('media', None) is not None else None,
492
+ container_queries=[CSSContainerQuery.from_json(i) for i in json['containerQueries']] if json.get('containerQueries', None) is not None else None,
493
+ supports=[CSSSupports.from_json(i) for i in json['supports']] if json.get('supports', None) is not None else None,
494
+ layers=[CSSLayer.from_json(i) for i in json['layers']] if json.get('layers', None) is not None else None,
495
+ scopes=[CSSScope.from_json(i) for i in json['scopes']] if json.get('scopes', None) is not None else None,
496
+ rule_types=[CSSRuleType.from_json(i) for i in json['ruleTypes']] if json.get('ruleTypes', None) is not None else None,
497
+ starting_styles=[CSSStartingStyle.from_json(i) for i in json['startingStyles']] if json.get('startingStyles', None) is not None else None,
498
+ navigations=[CSSNavigation.from_json(i) for i in json['navigations']] if json.get('navigations', None) is not None else None,
499
+ )
500
+
501
+
502
+ class CSSRuleType(enum.Enum):
503
+ '''
504
+ Enum indicating the type of a CSS rule, used to represent the order of a style rule's ancestors.
505
+ This list only contains rule types that are collected during the ancestor rule collection.
506
+ '''
507
+ MEDIA_RULE = "MediaRule"
508
+ SUPPORTS_RULE = "SupportsRule"
509
+ CONTAINER_RULE = "ContainerRule"
510
+ LAYER_RULE = "LayerRule"
511
+ SCOPE_RULE = "ScopeRule"
512
+ STYLE_RULE = "StyleRule"
513
+ STARTING_STYLE_RULE = "StartingStyleRule"
514
+ NAVIGATION_RULE = "NavigationRule"
515
+
516
+ def to_json(self) -> str:
517
+ return self.value
518
+
519
+ @classmethod
520
+ def from_json(cls, json: str) -> CSSRuleType:
521
+ return cls(json)
522
+
523
+
524
+ @dataclass
525
+ class RuleUsage:
526
+ '''
527
+ CSS coverage information.
528
+ '''
529
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
530
+ #: stylesheet rules) this rule came from.
531
+ style_sheet_id: dom.StyleSheetId
532
+
533
+ #: Offset of the start of the rule (including selector) from the beginning of the stylesheet.
534
+ start_offset: float
535
+
536
+ #: Offset of the end of the rule body from the beginning of the stylesheet.
537
+ end_offset: float
538
+
539
+ #: Indicates whether the rule was actually used by some element in the page.
540
+ used: bool
541
+
542
+ def to_json(self) -> T_JSON_DICT:
543
+ json: T_JSON_DICT = dict()
544
+ json['styleSheetId'] = self.style_sheet_id.to_json()
545
+ json['startOffset'] = self.start_offset
546
+ json['endOffset'] = self.end_offset
547
+ json['used'] = self.used
548
+ return json
549
+
550
+ @classmethod
551
+ def from_json(cls, json: T_JSON_DICT) -> RuleUsage:
552
+ return cls(
553
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']),
554
+ start_offset=float(json['startOffset']),
555
+ end_offset=float(json['endOffset']),
556
+ used=bool(json['used']),
557
+ )
558
+
559
+
560
+ @dataclass
561
+ class SourceRange:
562
+ '''
563
+ Text range within a resource. All numbers are zero-based.
564
+ '''
565
+ #: Start line of range.
566
+ start_line: int
567
+
568
+ #: Start column of range (inclusive).
569
+ start_column: int
570
+
571
+ #: End line of range
572
+ end_line: int
573
+
574
+ #: End column of range (exclusive).
575
+ end_column: int
576
+
577
+ def to_json(self) -> T_JSON_DICT:
578
+ json: T_JSON_DICT = dict()
579
+ json['startLine'] = self.start_line
580
+ json['startColumn'] = self.start_column
581
+ json['endLine'] = self.end_line
582
+ json['endColumn'] = self.end_column
583
+ return json
584
+
585
+ @classmethod
586
+ def from_json(cls, json: T_JSON_DICT) -> SourceRange:
587
+ return cls(
588
+ start_line=int(json['startLine']),
589
+ start_column=int(json['startColumn']),
590
+ end_line=int(json['endLine']),
591
+ end_column=int(json['endColumn']),
592
+ )
593
+
594
+
595
+ @dataclass
596
+ class ShorthandEntry:
597
+ #: Shorthand name.
598
+ name: str
599
+
600
+ #: Shorthand value.
601
+ value: str
602
+
603
+ #: Whether the property has "!important" annotation (implies ``false`` if absent).
604
+ important: typing.Optional[bool] = None
605
+
606
+ def to_json(self) -> T_JSON_DICT:
607
+ json: T_JSON_DICT = dict()
608
+ json['name'] = self.name
609
+ json['value'] = self.value
610
+ if self.important is not None:
611
+ json['important'] = self.important
612
+ return json
613
+
614
+ @classmethod
615
+ def from_json(cls, json: T_JSON_DICT) -> ShorthandEntry:
616
+ return cls(
617
+ name=str(json['name']),
618
+ value=str(json['value']),
619
+ important=bool(json['important']) if json.get('important', None) is not None else None,
620
+ )
621
+
622
+
623
+ @dataclass
624
+ class CSSComputedStyleProperty:
625
+ #: Computed style property name.
626
+ name: str
627
+
628
+ #: Computed style property value.
629
+ value: str
630
+
631
+ def to_json(self) -> T_JSON_DICT:
632
+ json: T_JSON_DICT = dict()
633
+ json['name'] = self.name
634
+ json['value'] = self.value
635
+ return json
636
+
637
+ @classmethod
638
+ def from_json(cls, json: T_JSON_DICT) -> CSSComputedStyleProperty:
639
+ return cls(
640
+ name=str(json['name']),
641
+ value=str(json['value']),
642
+ )
643
+
644
+
645
+ @dataclass
646
+ class ComputedStyleExtraFields:
647
+ #: Returns whether or not this node is being rendered with base appearance,
648
+ #: which happens when it has its appearance property set to base/base-select
649
+ #: or it is in the subtree of an element being rendered with base appearance.
650
+ is_appearance_base: bool
651
+
652
+ def to_json(self) -> T_JSON_DICT:
653
+ json: T_JSON_DICT = dict()
654
+ json['isAppearanceBase'] = self.is_appearance_base
655
+ return json
656
+
657
+ @classmethod
658
+ def from_json(cls, json: T_JSON_DICT) -> ComputedStyleExtraFields:
659
+ return cls(
660
+ is_appearance_base=bool(json['isAppearanceBase']),
661
+ )
662
+
663
+
664
+ @dataclass
665
+ class CSSStyle:
666
+ '''
667
+ CSS style representation.
668
+ '''
669
+ #: CSS properties in the style.
670
+ css_properties: typing.List[CSSProperty]
671
+
672
+ #: Computed values for all shorthands found in the style.
673
+ shorthand_entries: typing.List[ShorthandEntry]
674
+
675
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
676
+ #: stylesheet rules) this rule came from.
677
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
678
+
679
+ #: Style declaration text (if available).
680
+ css_text: typing.Optional[str] = None
681
+
682
+ #: Style declaration range in the enclosing stylesheet (if available).
683
+ range_: typing.Optional[SourceRange] = None
684
+
685
+ def to_json(self) -> T_JSON_DICT:
686
+ json: T_JSON_DICT = dict()
687
+ json['cssProperties'] = [i.to_json() for i in self.css_properties]
688
+ json['shorthandEntries'] = [i.to_json() for i in self.shorthand_entries]
689
+ if self.style_sheet_id is not None:
690
+ json['styleSheetId'] = self.style_sheet_id.to_json()
691
+ if self.css_text is not None:
692
+ json['cssText'] = self.css_text
693
+ if self.range_ is not None:
694
+ json['range'] = self.range_.to_json()
695
+ return json
696
+
697
+ @classmethod
698
+ def from_json(cls, json: T_JSON_DICT) -> CSSStyle:
699
+ return cls(
700
+ css_properties=[CSSProperty.from_json(i) for i in json['cssProperties']],
701
+ shorthand_entries=[ShorthandEntry.from_json(i) for i in json['shorthandEntries']],
702
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
703
+ css_text=str(json['cssText']) if json.get('cssText', None) is not None else None,
704
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
705
+ )
706
+
707
+
708
+ @dataclass
709
+ class CSSProperty:
710
+ '''
711
+ CSS property declaration data.
712
+ '''
713
+ #: The property name.
714
+ name: str
715
+
716
+ #: The property value.
717
+ value: str
718
+
719
+ #: Whether the property has "!important" annotation (implies ``false`` if absent).
720
+ important: typing.Optional[bool] = None
721
+
722
+ #: Whether the property is implicit (implies ``false`` if absent).
723
+ implicit: typing.Optional[bool] = None
724
+
725
+ #: The full property text as specified in the style.
726
+ text: typing.Optional[str] = None
727
+
728
+ #: Whether the property is understood by the browser (implies ``true`` if absent).
729
+ parsed_ok: typing.Optional[bool] = None
730
+
731
+ #: Whether the property is disabled by the user (present for source-based properties only).
732
+ disabled: typing.Optional[bool] = None
733
+
734
+ #: The entire property range in the enclosing style declaration (if available).
735
+ range_: typing.Optional[SourceRange] = None
736
+
737
+ #: Parsed longhand components of this property if it is a shorthand.
738
+ #: This field will be empty if the given property is not a shorthand.
739
+ longhand_properties: typing.Optional[typing.List[CSSProperty]] = None
740
+
741
+ def to_json(self) -> T_JSON_DICT:
742
+ json: T_JSON_DICT = dict()
743
+ json['name'] = self.name
744
+ json['value'] = self.value
745
+ if self.important is not None:
746
+ json['important'] = self.important
747
+ if self.implicit is not None:
748
+ json['implicit'] = self.implicit
749
+ if self.text is not None:
750
+ json['text'] = self.text
751
+ if self.parsed_ok is not None:
752
+ json['parsedOk'] = self.parsed_ok
753
+ if self.disabled is not None:
754
+ json['disabled'] = self.disabled
755
+ if self.range_ is not None:
756
+ json['range'] = self.range_.to_json()
757
+ if self.longhand_properties is not None:
758
+ json['longhandProperties'] = [i.to_json() for i in self.longhand_properties]
759
+ return json
760
+
761
+ @classmethod
762
+ def from_json(cls, json: T_JSON_DICT) -> CSSProperty:
763
+ return cls(
764
+ name=str(json['name']),
765
+ value=str(json['value']),
766
+ important=bool(json['important']) if json.get('important', None) is not None else None,
767
+ implicit=bool(json['implicit']) if json.get('implicit', None) is not None else None,
768
+ text=str(json['text']) if json.get('text', None) is not None else None,
769
+ parsed_ok=bool(json['parsedOk']) if json.get('parsedOk', None) is not None else None,
770
+ disabled=bool(json['disabled']) if json.get('disabled', None) is not None else None,
771
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
772
+ longhand_properties=[CSSProperty.from_json(i) for i in json['longhandProperties']] if json.get('longhandProperties', None) is not None else None,
773
+ )
774
+
775
+
776
+ @dataclass
777
+ class CSSMedia:
778
+ '''
779
+ CSS media rule descriptor.
780
+ '''
781
+ #: Media query text.
782
+ text: str
783
+
784
+ #: Source of the media query: "mediaRule" if specified by a @media rule, "importRule" if
785
+ #: specified by an @import rule, "linkedSheet" if specified by a "media" attribute in a linked
786
+ #: stylesheet's LINK tag, "inlineSheet" if specified by a "media" attribute in an inline
787
+ #: stylesheet's STYLE tag.
788
+ source: str
789
+
790
+ #: URL of the document containing the media query description.
791
+ source_url: typing.Optional[str] = None
792
+
793
+ #: The associated rule (@media or @import) header range in the enclosing stylesheet (if
794
+ #: available).
795
+ range_: typing.Optional[SourceRange] = None
796
+
797
+ #: Identifier of the stylesheet containing this object (if exists).
798
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
799
+
800
+ #: Array of media queries.
801
+ media_list: typing.Optional[typing.List[MediaQuery]] = None
802
+
803
+ def to_json(self) -> T_JSON_DICT:
804
+ json: T_JSON_DICT = dict()
805
+ json['text'] = self.text
806
+ json['source'] = self.source
807
+ if self.source_url is not None:
808
+ json['sourceURL'] = self.source_url
809
+ if self.range_ is not None:
810
+ json['range'] = self.range_.to_json()
811
+ if self.style_sheet_id is not None:
812
+ json['styleSheetId'] = self.style_sheet_id.to_json()
813
+ if self.media_list is not None:
814
+ json['mediaList'] = [i.to_json() for i in self.media_list]
815
+ return json
816
+
817
+ @classmethod
818
+ def from_json(cls, json: T_JSON_DICT) -> CSSMedia:
819
+ return cls(
820
+ text=str(json['text']),
821
+ source=str(json['source']),
822
+ source_url=str(json['sourceURL']) if json.get('sourceURL', None) is not None else None,
823
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
824
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
825
+ media_list=[MediaQuery.from_json(i) for i in json['mediaList']] if json.get('mediaList', None) is not None else None,
826
+ )
827
+
828
+
829
+ @dataclass
830
+ class MediaQuery:
831
+ '''
832
+ Media query descriptor.
833
+ '''
834
+ #: Array of media query expressions.
835
+ expressions: typing.List[MediaQueryExpression]
836
+
837
+ #: Whether the media query condition is satisfied.
838
+ active: bool
839
+
840
+ def to_json(self) -> T_JSON_DICT:
841
+ json: T_JSON_DICT = dict()
842
+ json['expressions'] = [i.to_json() for i in self.expressions]
843
+ json['active'] = self.active
844
+ return json
845
+
846
+ @classmethod
847
+ def from_json(cls, json: T_JSON_DICT) -> MediaQuery:
848
+ return cls(
849
+ expressions=[MediaQueryExpression.from_json(i) for i in json['expressions']],
850
+ active=bool(json['active']),
851
+ )
852
+
853
+
854
+ @dataclass
855
+ class MediaQueryExpression:
856
+ '''
857
+ Media query expression descriptor.
858
+ '''
859
+ #: Media query expression value.
860
+ value: float
861
+
862
+ #: Media query expression units.
863
+ unit: str
864
+
865
+ #: Media query expression feature.
866
+ feature: str
867
+
868
+ #: The associated range of the value text in the enclosing stylesheet (if available).
869
+ value_range: typing.Optional[SourceRange] = None
870
+
871
+ #: Computed length of media query expression (if applicable).
872
+ computed_length: typing.Optional[float] = None
873
+
874
+ def to_json(self) -> T_JSON_DICT:
875
+ json: T_JSON_DICT = dict()
876
+ json['value'] = self.value
877
+ json['unit'] = self.unit
878
+ json['feature'] = self.feature
879
+ if self.value_range is not None:
880
+ json['valueRange'] = self.value_range.to_json()
881
+ if self.computed_length is not None:
882
+ json['computedLength'] = self.computed_length
883
+ return json
884
+
885
+ @classmethod
886
+ def from_json(cls, json: T_JSON_DICT) -> MediaQueryExpression:
887
+ return cls(
888
+ value=float(json['value']),
889
+ unit=str(json['unit']),
890
+ feature=str(json['feature']),
891
+ value_range=SourceRange.from_json(json['valueRange']) if json.get('valueRange', None) is not None else None,
892
+ computed_length=float(json['computedLength']) if json.get('computedLength', None) is not None else None,
893
+ )
894
+
895
+
896
+ @dataclass
897
+ class CSSContainerQuery:
898
+ '''
899
+ CSS container query rule descriptor.
900
+ '''
901
+ #: Container query text.
902
+ #: Contains the query part without the container name for a single query.
903
+ #: Deprecated in favor of conditionText which contains the full prelude
904
+ #: after @container.
905
+ text: str
906
+
907
+ #: CSSContainerRule.conditionText
908
+ condition_text: str
909
+
910
+ #: The associated rule header range in the enclosing stylesheet (if
911
+ #: available).
912
+ range_: typing.Optional[SourceRange] = None
913
+
914
+ #: Identifier of the stylesheet containing this object (if exists).
915
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
916
+
917
+ #: Optional name for the container.
918
+ name: typing.Optional[str] = None
919
+
920
+ #: Optional physical axes queried for the container.
921
+ physical_axes: typing.Optional[dom.PhysicalAxes] = None
922
+
923
+ #: Optional logical axes queried for the container.
924
+ logical_axes: typing.Optional[dom.LogicalAxes] = None
925
+
926
+ #: true if the query contains scroll-state() queries.
927
+ queries_scroll_state: typing.Optional[bool] = None
928
+
929
+ #: true if the query contains anchored() queries.
930
+ queries_anchored: typing.Optional[bool] = None
931
+
932
+ def to_json(self) -> T_JSON_DICT:
933
+ json: T_JSON_DICT = dict()
934
+ json['text'] = self.text
935
+ json['conditionText'] = self.condition_text
936
+ if self.range_ is not None:
937
+ json['range'] = self.range_.to_json()
938
+ if self.style_sheet_id is not None:
939
+ json['styleSheetId'] = self.style_sheet_id.to_json()
940
+ if self.name is not None:
941
+ json['name'] = self.name
942
+ if self.physical_axes is not None:
943
+ json['physicalAxes'] = self.physical_axes.to_json()
944
+ if self.logical_axes is not None:
945
+ json['logicalAxes'] = self.logical_axes.to_json()
946
+ if self.queries_scroll_state is not None:
947
+ json['queriesScrollState'] = self.queries_scroll_state
948
+ if self.queries_anchored is not None:
949
+ json['queriesAnchored'] = self.queries_anchored
950
+ return json
951
+
952
+ @classmethod
953
+ def from_json(cls, json: T_JSON_DICT) -> CSSContainerQuery:
954
+ return cls(
955
+ text=str(json['text']),
956
+ condition_text=str(json['conditionText']),
957
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
958
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
959
+ name=str(json['name']) if json.get('name', None) is not None else None,
960
+ physical_axes=dom.PhysicalAxes.from_json(json['physicalAxes']) if json.get('physicalAxes', None) is not None else None,
961
+ logical_axes=dom.LogicalAxes.from_json(json['logicalAxes']) if json.get('logicalAxes', None) is not None else None,
962
+ queries_scroll_state=bool(json['queriesScrollState']) if json.get('queriesScrollState', None) is not None else None,
963
+ queries_anchored=bool(json['queriesAnchored']) if json.get('queriesAnchored', None) is not None else None,
964
+ )
965
+
966
+
967
+ @dataclass
968
+ class CSSSupports:
969
+ '''
970
+ CSS Supports at-rule descriptor.
971
+ '''
972
+ #: Supports rule text.
973
+ text: str
974
+
975
+ #: Whether the supports condition is satisfied.
976
+ active: bool
977
+
978
+ #: The associated rule header range in the enclosing stylesheet (if
979
+ #: available).
980
+ range_: typing.Optional[SourceRange] = None
981
+
982
+ #: Identifier of the stylesheet containing this object (if exists).
983
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
984
+
985
+ def to_json(self) -> T_JSON_DICT:
986
+ json: T_JSON_DICT = dict()
987
+ json['text'] = self.text
988
+ json['active'] = self.active
989
+ if self.range_ is not None:
990
+ json['range'] = self.range_.to_json()
991
+ if self.style_sheet_id is not None:
992
+ json['styleSheetId'] = self.style_sheet_id.to_json()
993
+ return json
994
+
995
+ @classmethod
996
+ def from_json(cls, json: T_JSON_DICT) -> CSSSupports:
997
+ return cls(
998
+ text=str(json['text']),
999
+ active=bool(json['active']),
1000
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
1001
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1002
+ )
1003
+
1004
+
1005
+ @dataclass
1006
+ class CSSNavigation:
1007
+ '''
1008
+ CSS Navigation at-rule descriptor.
1009
+ '''
1010
+ #: Navigation rule text.
1011
+ text: str
1012
+
1013
+ #: Whether the navigation condition is satisfied.
1014
+ active: typing.Optional[bool] = None
1015
+
1016
+ #: The associated rule header range in the enclosing stylesheet (if
1017
+ #: available).
1018
+ range_: typing.Optional[SourceRange] = None
1019
+
1020
+ #: Identifier of the stylesheet containing this object (if exists).
1021
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1022
+
1023
+ def to_json(self) -> T_JSON_DICT:
1024
+ json: T_JSON_DICT = dict()
1025
+ json['text'] = self.text
1026
+ if self.active is not None:
1027
+ json['active'] = self.active
1028
+ if self.range_ is not None:
1029
+ json['range'] = self.range_.to_json()
1030
+ if self.style_sheet_id is not None:
1031
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1032
+ return json
1033
+
1034
+ @classmethod
1035
+ def from_json(cls, json: T_JSON_DICT) -> CSSNavigation:
1036
+ return cls(
1037
+ text=str(json['text']),
1038
+ active=bool(json['active']) if json.get('active', None) is not None else None,
1039
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
1040
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1041
+ )
1042
+
1043
+
1044
+ @dataclass
1045
+ class CSSScope:
1046
+ '''
1047
+ CSS Scope at-rule descriptor.
1048
+ '''
1049
+ #: Scope rule text.
1050
+ text: str
1051
+
1052
+ #: The associated rule header range in the enclosing stylesheet (if
1053
+ #: available).
1054
+ range_: typing.Optional[SourceRange] = None
1055
+
1056
+ #: Identifier of the stylesheet containing this object (if exists).
1057
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1058
+
1059
+ def to_json(self) -> T_JSON_DICT:
1060
+ json: T_JSON_DICT = dict()
1061
+ json['text'] = self.text
1062
+ if self.range_ is not None:
1063
+ json['range'] = self.range_.to_json()
1064
+ if self.style_sheet_id is not None:
1065
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1066
+ return json
1067
+
1068
+ @classmethod
1069
+ def from_json(cls, json: T_JSON_DICT) -> CSSScope:
1070
+ return cls(
1071
+ text=str(json['text']),
1072
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
1073
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1074
+ )
1075
+
1076
+
1077
+ @dataclass
1078
+ class CSSLayer:
1079
+ '''
1080
+ CSS Layer at-rule descriptor.
1081
+ '''
1082
+ #: Layer name.
1083
+ text: str
1084
+
1085
+ #: The associated rule header range in the enclosing stylesheet (if
1086
+ #: available).
1087
+ range_: typing.Optional[SourceRange] = None
1088
+
1089
+ #: Identifier of the stylesheet containing this object (if exists).
1090
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1091
+
1092
+ def to_json(self) -> T_JSON_DICT:
1093
+ json: T_JSON_DICT = dict()
1094
+ json['text'] = self.text
1095
+ if self.range_ is not None:
1096
+ json['range'] = self.range_.to_json()
1097
+ if self.style_sheet_id is not None:
1098
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1099
+ return json
1100
+
1101
+ @classmethod
1102
+ def from_json(cls, json: T_JSON_DICT) -> CSSLayer:
1103
+ return cls(
1104
+ text=str(json['text']),
1105
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
1106
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1107
+ )
1108
+
1109
+
1110
+ @dataclass
1111
+ class CSSStartingStyle:
1112
+ '''
1113
+ CSS Starting Style at-rule descriptor.
1114
+ '''
1115
+ #: The associated rule header range in the enclosing stylesheet (if
1116
+ #: available).
1117
+ range_: typing.Optional[SourceRange] = None
1118
+
1119
+ #: Identifier of the stylesheet containing this object (if exists).
1120
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1121
+
1122
+ def to_json(self) -> T_JSON_DICT:
1123
+ json: T_JSON_DICT = dict()
1124
+ if self.range_ is not None:
1125
+ json['range'] = self.range_.to_json()
1126
+ if self.style_sheet_id is not None:
1127
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1128
+ return json
1129
+
1130
+ @classmethod
1131
+ def from_json(cls, json: T_JSON_DICT) -> CSSStartingStyle:
1132
+ return cls(
1133
+ range_=SourceRange.from_json(json['range']) if json.get('range', None) is not None else None,
1134
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1135
+ )
1136
+
1137
+
1138
+ @dataclass
1139
+ class CSSLayerData:
1140
+ '''
1141
+ CSS Layer data.
1142
+ '''
1143
+ #: Layer name.
1144
+ name: str
1145
+
1146
+ #: Layer order. The order determines the order of the layer in the cascade order.
1147
+ #: A higher number has higher priority in the cascade order.
1148
+ order: float
1149
+
1150
+ #: Direct sub-layers
1151
+ sub_layers: typing.Optional[typing.List[CSSLayerData]] = None
1152
+
1153
+ def to_json(self) -> T_JSON_DICT:
1154
+ json: T_JSON_DICT = dict()
1155
+ json['name'] = self.name
1156
+ json['order'] = self.order
1157
+ if self.sub_layers is not None:
1158
+ json['subLayers'] = [i.to_json() for i in self.sub_layers]
1159
+ return json
1160
+
1161
+ @classmethod
1162
+ def from_json(cls, json: T_JSON_DICT) -> CSSLayerData:
1163
+ return cls(
1164
+ name=str(json['name']),
1165
+ order=float(json['order']),
1166
+ sub_layers=[CSSLayerData.from_json(i) for i in json['subLayers']] if json.get('subLayers', None) is not None else None,
1167
+ )
1168
+
1169
+
1170
+ @dataclass
1171
+ class PlatformFontUsage:
1172
+ '''
1173
+ Information about amount of glyphs that were rendered with given font.
1174
+ '''
1175
+ #: Font's family name reported by platform.
1176
+ family_name: str
1177
+
1178
+ #: Font's PostScript name reported by platform.
1179
+ post_script_name: str
1180
+
1181
+ #: Indicates if the font was downloaded or resolved locally.
1182
+ is_custom_font: bool
1183
+
1184
+ #: Amount of glyphs that were rendered with this font.
1185
+ glyph_count: float
1186
+
1187
+ def to_json(self) -> T_JSON_DICT:
1188
+ json: T_JSON_DICT = dict()
1189
+ json['familyName'] = self.family_name
1190
+ json['postScriptName'] = self.post_script_name
1191
+ json['isCustomFont'] = self.is_custom_font
1192
+ json['glyphCount'] = self.glyph_count
1193
+ return json
1194
+
1195
+ @classmethod
1196
+ def from_json(cls, json: T_JSON_DICT) -> PlatformFontUsage:
1197
+ return cls(
1198
+ family_name=str(json['familyName']),
1199
+ post_script_name=str(json['postScriptName']),
1200
+ is_custom_font=bool(json['isCustomFont']),
1201
+ glyph_count=float(json['glyphCount']),
1202
+ )
1203
+
1204
+
1205
+ @dataclass
1206
+ class FontVariationAxis:
1207
+ '''
1208
+ Information about font variation axes for variable fonts
1209
+ '''
1210
+ #: The font-variation-setting tag (a.k.a. "axis tag").
1211
+ tag: str
1212
+
1213
+ #: Human-readable variation name in the default language (normally, "en").
1214
+ name: str
1215
+
1216
+ #: The minimum value (inclusive) the font supports for this tag.
1217
+ min_value: float
1218
+
1219
+ #: The maximum value (inclusive) the font supports for this tag.
1220
+ max_value: float
1221
+
1222
+ #: The default value.
1223
+ default_value: float
1224
+
1225
+ def to_json(self) -> T_JSON_DICT:
1226
+ json: T_JSON_DICT = dict()
1227
+ json['tag'] = self.tag
1228
+ json['name'] = self.name
1229
+ json['minValue'] = self.min_value
1230
+ json['maxValue'] = self.max_value
1231
+ json['defaultValue'] = self.default_value
1232
+ return json
1233
+
1234
+ @classmethod
1235
+ def from_json(cls, json: T_JSON_DICT) -> FontVariationAxis:
1236
+ return cls(
1237
+ tag=str(json['tag']),
1238
+ name=str(json['name']),
1239
+ min_value=float(json['minValue']),
1240
+ max_value=float(json['maxValue']),
1241
+ default_value=float(json['defaultValue']),
1242
+ )
1243
+
1244
+
1245
+ @dataclass
1246
+ class FontFace:
1247
+ '''
1248
+ Properties of a web font: https://www.w3.org/TR/2008/REC-CSS2-20080411/fonts.html#font-descriptions
1249
+ and additional information such as platformFontFamily and fontVariationAxes.
1250
+ '''
1251
+ #: The font-family.
1252
+ font_family: str
1253
+
1254
+ #: The font-style.
1255
+ font_style: str
1256
+
1257
+ #: The font-variant.
1258
+ font_variant: str
1259
+
1260
+ #: The font-weight.
1261
+ font_weight: str
1262
+
1263
+ #: The font-stretch.
1264
+ font_stretch: str
1265
+
1266
+ #: The font-display.
1267
+ font_display: str
1268
+
1269
+ #: The unicode-range.
1270
+ unicode_range: str
1271
+
1272
+ #: The src.
1273
+ src: str
1274
+
1275
+ #: The resolved platform font family
1276
+ platform_font_family: str
1277
+
1278
+ #: Available variation settings (a.k.a. "axes").
1279
+ font_variation_axes: typing.Optional[typing.List[FontVariationAxis]] = None
1280
+
1281
+ def to_json(self) -> T_JSON_DICT:
1282
+ json: T_JSON_DICT = dict()
1283
+ json['fontFamily'] = self.font_family
1284
+ json['fontStyle'] = self.font_style
1285
+ json['fontVariant'] = self.font_variant
1286
+ json['fontWeight'] = self.font_weight
1287
+ json['fontStretch'] = self.font_stretch
1288
+ json['fontDisplay'] = self.font_display
1289
+ json['unicodeRange'] = self.unicode_range
1290
+ json['src'] = self.src
1291
+ json['platformFontFamily'] = self.platform_font_family
1292
+ if self.font_variation_axes is not None:
1293
+ json['fontVariationAxes'] = [i.to_json() for i in self.font_variation_axes]
1294
+ return json
1295
+
1296
+ @classmethod
1297
+ def from_json(cls, json: T_JSON_DICT) -> FontFace:
1298
+ return cls(
1299
+ font_family=str(json['fontFamily']),
1300
+ font_style=str(json['fontStyle']),
1301
+ font_variant=str(json['fontVariant']),
1302
+ font_weight=str(json['fontWeight']),
1303
+ font_stretch=str(json['fontStretch']),
1304
+ font_display=str(json['fontDisplay']),
1305
+ unicode_range=str(json['unicodeRange']),
1306
+ src=str(json['src']),
1307
+ platform_font_family=str(json['platformFontFamily']),
1308
+ font_variation_axes=[FontVariationAxis.from_json(i) for i in json['fontVariationAxes']] if json.get('fontVariationAxes', None) is not None else None,
1309
+ )
1310
+
1311
+
1312
+ @dataclass
1313
+ class CSSTryRule:
1314
+ '''
1315
+ CSS try rule representation.
1316
+ '''
1317
+ #: Parent stylesheet's origin.
1318
+ origin: StyleSheetOrigin
1319
+
1320
+ #: Associated style declaration.
1321
+ style: CSSStyle
1322
+
1323
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
1324
+ #: stylesheet rules) this rule came from.
1325
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1326
+
1327
+ def to_json(self) -> T_JSON_DICT:
1328
+ json: T_JSON_DICT = dict()
1329
+ json['origin'] = self.origin.to_json()
1330
+ json['style'] = self.style.to_json()
1331
+ if self.style_sheet_id is not None:
1332
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1333
+ return json
1334
+
1335
+ @classmethod
1336
+ def from_json(cls, json: T_JSON_DICT) -> CSSTryRule:
1337
+ return cls(
1338
+ origin=StyleSheetOrigin.from_json(json['origin']),
1339
+ style=CSSStyle.from_json(json['style']),
1340
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1341
+ )
1342
+
1343
+
1344
+ @dataclass
1345
+ class CSSPositionTryRule:
1346
+ '''
1347
+ CSS @position-try rule representation.
1348
+ '''
1349
+ #: The prelude dashed-ident name
1350
+ name: Value
1351
+
1352
+ #: Parent stylesheet's origin.
1353
+ origin: StyleSheetOrigin
1354
+
1355
+ #: Associated style declaration.
1356
+ style: CSSStyle
1357
+
1358
+ active: bool
1359
+
1360
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
1361
+ #: stylesheet rules) this rule came from.
1362
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1363
+
1364
+ def to_json(self) -> T_JSON_DICT:
1365
+ json: T_JSON_DICT = dict()
1366
+ json['name'] = self.name.to_json()
1367
+ json['origin'] = self.origin.to_json()
1368
+ json['style'] = self.style.to_json()
1369
+ json['active'] = self.active
1370
+ if self.style_sheet_id is not None:
1371
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1372
+ return json
1373
+
1374
+ @classmethod
1375
+ def from_json(cls, json: T_JSON_DICT) -> CSSPositionTryRule:
1376
+ return cls(
1377
+ name=Value.from_json(json['name']),
1378
+ origin=StyleSheetOrigin.from_json(json['origin']),
1379
+ style=CSSStyle.from_json(json['style']),
1380
+ active=bool(json['active']),
1381
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1382
+ )
1383
+
1384
+
1385
+ @dataclass
1386
+ class CSSKeyframesRule:
1387
+ '''
1388
+ CSS keyframes rule representation.
1389
+ '''
1390
+ #: Animation name.
1391
+ animation_name: Value
1392
+
1393
+ #: List of keyframes.
1394
+ keyframes: typing.List[CSSKeyframeRule]
1395
+
1396
+ def to_json(self) -> T_JSON_DICT:
1397
+ json: T_JSON_DICT = dict()
1398
+ json['animationName'] = self.animation_name.to_json()
1399
+ json['keyframes'] = [i.to_json() for i in self.keyframes]
1400
+ return json
1401
+
1402
+ @classmethod
1403
+ def from_json(cls, json: T_JSON_DICT) -> CSSKeyframesRule:
1404
+ return cls(
1405
+ animation_name=Value.from_json(json['animationName']),
1406
+ keyframes=[CSSKeyframeRule.from_json(i) for i in json['keyframes']],
1407
+ )
1408
+
1409
+
1410
+ @dataclass
1411
+ class CSSPropertyRegistration:
1412
+ '''
1413
+ Representation of a custom property registration through CSS.registerProperty
1414
+ '''
1415
+ property_name: str
1416
+
1417
+ inherits: bool
1418
+
1419
+ syntax: str
1420
+
1421
+ initial_value: typing.Optional[Value] = None
1422
+
1423
+ def to_json(self) -> T_JSON_DICT:
1424
+ json: T_JSON_DICT = dict()
1425
+ json['propertyName'] = self.property_name
1426
+ json['inherits'] = self.inherits
1427
+ json['syntax'] = self.syntax
1428
+ if self.initial_value is not None:
1429
+ json['initialValue'] = self.initial_value.to_json()
1430
+ return json
1431
+
1432
+ @classmethod
1433
+ def from_json(cls, json: T_JSON_DICT) -> CSSPropertyRegistration:
1434
+ return cls(
1435
+ property_name=str(json['propertyName']),
1436
+ inherits=bool(json['inherits']),
1437
+ syntax=str(json['syntax']),
1438
+ initial_value=Value.from_json(json['initialValue']) if json.get('initialValue', None) is not None else None,
1439
+ )
1440
+
1441
+
1442
+ @dataclass
1443
+ class CSSAtRule:
1444
+ '''
1445
+ CSS generic @rule representation.
1446
+ '''
1447
+ #: Type of at-rule.
1448
+ type_: str
1449
+
1450
+ #: Parent stylesheet's origin.
1451
+ origin: StyleSheetOrigin
1452
+
1453
+ #: Associated style declaration.
1454
+ style: CSSStyle
1455
+
1456
+ #: Subsection of font-feature-values, if this is a subsection.
1457
+ subsection: typing.Optional[str] = None
1458
+
1459
+ #: LINT.ThenChange(//third_party/blink/renderer/core/inspector/inspector_style_sheet.cc:FontVariantAlternatesFeatureType,//third_party/blink/renderer/core/inspector/inspector_css_agent.cc:FontVariantAlternatesFeatureType)
1460
+ #: Associated name, if applicable.
1461
+ name: typing.Optional[Value] = None
1462
+
1463
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
1464
+ #: stylesheet rules) this rule came from.
1465
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1466
+
1467
+ def to_json(self) -> T_JSON_DICT:
1468
+ json: T_JSON_DICT = dict()
1469
+ json['type'] = self.type_
1470
+ json['origin'] = self.origin.to_json()
1471
+ json['style'] = self.style.to_json()
1472
+ if self.subsection is not None:
1473
+ json['subsection'] = self.subsection
1474
+ if self.name is not None:
1475
+ json['name'] = self.name.to_json()
1476
+ if self.style_sheet_id is not None:
1477
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1478
+ return json
1479
+
1480
+ @classmethod
1481
+ def from_json(cls, json: T_JSON_DICT) -> CSSAtRule:
1482
+ return cls(
1483
+ type_=str(json['type']),
1484
+ origin=StyleSheetOrigin.from_json(json['origin']),
1485
+ style=CSSStyle.from_json(json['style']),
1486
+ subsection=str(json['subsection']) if json.get('subsection', None) is not None else None,
1487
+ name=Value.from_json(json['name']) if json.get('name', None) is not None else None,
1488
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1489
+ )
1490
+
1491
+
1492
+ @dataclass
1493
+ class CSSPropertyRule:
1494
+ '''
1495
+ CSS property at-rule representation.
1496
+ '''
1497
+ #: Parent stylesheet's origin.
1498
+ origin: StyleSheetOrigin
1499
+
1500
+ #: Associated property name.
1501
+ property_name: Value
1502
+
1503
+ #: Associated style declaration.
1504
+ style: CSSStyle
1505
+
1506
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
1507
+ #: stylesheet rules) this rule came from.
1508
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1509
+
1510
+ def to_json(self) -> T_JSON_DICT:
1511
+ json: T_JSON_DICT = dict()
1512
+ json['origin'] = self.origin.to_json()
1513
+ json['propertyName'] = self.property_name.to_json()
1514
+ json['style'] = self.style.to_json()
1515
+ if self.style_sheet_id is not None:
1516
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1517
+ return json
1518
+
1519
+ @classmethod
1520
+ def from_json(cls, json: T_JSON_DICT) -> CSSPropertyRule:
1521
+ return cls(
1522
+ origin=StyleSheetOrigin.from_json(json['origin']),
1523
+ property_name=Value.from_json(json['propertyName']),
1524
+ style=CSSStyle.from_json(json['style']),
1525
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1526
+ )
1527
+
1528
+
1529
+ @dataclass
1530
+ class CSSFunctionParameter:
1531
+ '''
1532
+ CSS function argument representation.
1533
+ '''
1534
+ #: The parameter name.
1535
+ name: str
1536
+
1537
+ #: The parameter type.
1538
+ type_: str
1539
+
1540
+ def to_json(self) -> T_JSON_DICT:
1541
+ json: T_JSON_DICT = dict()
1542
+ json['name'] = self.name
1543
+ json['type'] = self.type_
1544
+ return json
1545
+
1546
+ @classmethod
1547
+ def from_json(cls, json: T_JSON_DICT) -> CSSFunctionParameter:
1548
+ return cls(
1549
+ name=str(json['name']),
1550
+ type_=str(json['type']),
1551
+ )
1552
+
1553
+
1554
+ @dataclass
1555
+ class CSSFunctionConditionNode:
1556
+ '''
1557
+ CSS function conditional block representation.
1558
+ '''
1559
+ #: Block body.
1560
+ children: typing.List[CSSFunctionNode]
1561
+
1562
+ #: The condition text.
1563
+ condition_text: str
1564
+
1565
+ #: Media query for this conditional block. Only one type of condition should be set.
1566
+ media: typing.Optional[CSSMedia] = None
1567
+
1568
+ #: Container query for this conditional block. Only one type of condition should be set.
1569
+ container_queries: typing.Optional[CSSContainerQuery] = None
1570
+
1571
+ #: @supports CSS at-rule condition. Only one type of condition should be set.
1572
+ supports: typing.Optional[CSSSupports] = None
1573
+
1574
+ #: @navigation condition. Only one type of condition should be set.
1575
+ navigation: typing.Optional[CSSNavigation] = None
1576
+
1577
+ def to_json(self) -> T_JSON_DICT:
1578
+ json: T_JSON_DICT = dict()
1579
+ json['children'] = [i.to_json() for i in self.children]
1580
+ json['conditionText'] = self.condition_text
1581
+ if self.media is not None:
1582
+ json['media'] = self.media.to_json()
1583
+ if self.container_queries is not None:
1584
+ json['containerQueries'] = self.container_queries.to_json()
1585
+ if self.supports is not None:
1586
+ json['supports'] = self.supports.to_json()
1587
+ if self.navigation is not None:
1588
+ json['navigation'] = self.navigation.to_json()
1589
+ return json
1590
+
1591
+ @classmethod
1592
+ def from_json(cls, json: T_JSON_DICT) -> CSSFunctionConditionNode:
1593
+ return cls(
1594
+ children=[CSSFunctionNode.from_json(i) for i in json['children']],
1595
+ condition_text=str(json['conditionText']),
1596
+ media=CSSMedia.from_json(json['media']) if json.get('media', None) is not None else None,
1597
+ container_queries=CSSContainerQuery.from_json(json['containerQueries']) if json.get('containerQueries', None) is not None else None,
1598
+ supports=CSSSupports.from_json(json['supports']) if json.get('supports', None) is not None else None,
1599
+ navigation=CSSNavigation.from_json(json['navigation']) if json.get('navigation', None) is not None else None,
1600
+ )
1601
+
1602
+
1603
+ @dataclass
1604
+ class CSSFunctionNode:
1605
+ '''
1606
+ Section of the body of a CSS function rule.
1607
+ '''
1608
+ #: A conditional block. If set, style should not be set.
1609
+ condition: typing.Optional[CSSFunctionConditionNode] = None
1610
+
1611
+ #: Values set by this node. If set, condition should not be set.
1612
+ style: typing.Optional[CSSStyle] = None
1613
+
1614
+ def to_json(self) -> T_JSON_DICT:
1615
+ json: T_JSON_DICT = dict()
1616
+ if self.condition is not None:
1617
+ json['condition'] = self.condition.to_json()
1618
+ if self.style is not None:
1619
+ json['style'] = self.style.to_json()
1620
+ return json
1621
+
1622
+ @classmethod
1623
+ def from_json(cls, json: T_JSON_DICT) -> CSSFunctionNode:
1624
+ return cls(
1625
+ condition=CSSFunctionConditionNode.from_json(json['condition']) if json.get('condition', None) is not None else None,
1626
+ style=CSSStyle.from_json(json['style']) if json.get('style', None) is not None else None,
1627
+ )
1628
+
1629
+
1630
+ @dataclass
1631
+ class CSSFunctionRule:
1632
+ '''
1633
+ CSS function at-rule representation.
1634
+ '''
1635
+ #: Name of the function.
1636
+ name: Value
1637
+
1638
+ #: Parent stylesheet's origin.
1639
+ origin: StyleSheetOrigin
1640
+
1641
+ #: List of parameters.
1642
+ parameters: typing.List[CSSFunctionParameter]
1643
+
1644
+ #: Function body.
1645
+ children: typing.List[CSSFunctionNode]
1646
+
1647
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
1648
+ #: stylesheet rules) this rule came from.
1649
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1650
+
1651
+ #: The BackendNodeId of the DOM node that constitutes the origin tree scope of this rule.
1652
+ origin_tree_scope_node_id: typing.Optional[dom.BackendNodeId] = None
1653
+
1654
+ def to_json(self) -> T_JSON_DICT:
1655
+ json: T_JSON_DICT = dict()
1656
+ json['name'] = self.name.to_json()
1657
+ json['origin'] = self.origin.to_json()
1658
+ json['parameters'] = [i.to_json() for i in self.parameters]
1659
+ json['children'] = [i.to_json() for i in self.children]
1660
+ if self.style_sheet_id is not None:
1661
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1662
+ if self.origin_tree_scope_node_id is not None:
1663
+ json['originTreeScopeNodeId'] = self.origin_tree_scope_node_id.to_json()
1664
+ return json
1665
+
1666
+ @classmethod
1667
+ def from_json(cls, json: T_JSON_DICT) -> CSSFunctionRule:
1668
+ return cls(
1669
+ name=Value.from_json(json['name']),
1670
+ origin=StyleSheetOrigin.from_json(json['origin']),
1671
+ parameters=[CSSFunctionParameter.from_json(i) for i in json['parameters']],
1672
+ children=[CSSFunctionNode.from_json(i) for i in json['children']],
1673
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1674
+ origin_tree_scope_node_id=dom.BackendNodeId.from_json(json['originTreeScopeNodeId']) if json.get('originTreeScopeNodeId', None) is not None else None,
1675
+ )
1676
+
1677
+
1678
+ @dataclass
1679
+ class CSSKeyframeRule:
1680
+ '''
1681
+ CSS keyframe rule representation.
1682
+ '''
1683
+ #: Parent stylesheet's origin.
1684
+ origin: StyleSheetOrigin
1685
+
1686
+ #: Associated key text.
1687
+ key_text: Value
1688
+
1689
+ #: Associated style declaration.
1690
+ style: CSSStyle
1691
+
1692
+ #: The css style sheet identifier (absent for user agent stylesheet and user-specified
1693
+ #: stylesheet rules) this rule came from.
1694
+ style_sheet_id: typing.Optional[dom.StyleSheetId] = None
1695
+
1696
+ def to_json(self) -> T_JSON_DICT:
1697
+ json: T_JSON_DICT = dict()
1698
+ json['origin'] = self.origin.to_json()
1699
+ json['keyText'] = self.key_text.to_json()
1700
+ json['style'] = self.style.to_json()
1701
+ if self.style_sheet_id is not None:
1702
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1703
+ return json
1704
+
1705
+ @classmethod
1706
+ def from_json(cls, json: T_JSON_DICT) -> CSSKeyframeRule:
1707
+ return cls(
1708
+ origin=StyleSheetOrigin.from_json(json['origin']),
1709
+ key_text=Value.from_json(json['keyText']),
1710
+ style=CSSStyle.from_json(json['style']),
1711
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']) if json.get('styleSheetId', None) is not None else None,
1712
+ )
1713
+
1714
+
1715
+ @dataclass
1716
+ class StyleDeclarationEdit:
1717
+ '''
1718
+ A descriptor of operation to mutate style declaration text.
1719
+ '''
1720
+ #: The css style sheet identifier.
1721
+ style_sheet_id: dom.StyleSheetId
1722
+
1723
+ #: The range of the style text in the enclosing stylesheet.
1724
+ range_: SourceRange
1725
+
1726
+ #: New style text.
1727
+ text: str
1728
+
1729
+ def to_json(self) -> T_JSON_DICT:
1730
+ json: T_JSON_DICT = dict()
1731
+ json['styleSheetId'] = self.style_sheet_id.to_json()
1732
+ json['range'] = self.range_.to_json()
1733
+ json['text'] = self.text
1734
+ return json
1735
+
1736
+ @classmethod
1737
+ def from_json(cls, json: T_JSON_DICT) -> StyleDeclarationEdit:
1738
+ return cls(
1739
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId']),
1740
+ range_=SourceRange.from_json(json['range']),
1741
+ text=str(json['text']),
1742
+ )
1743
+
1744
+
1745
+ def add_rule(
1746
+ style_sheet_id: dom.StyleSheetId,
1747
+ rule_text: str,
1748
+ location: SourceRange,
1749
+ node_for_property_syntax_validation: typing.Optional[dom.NodeId] = None
1750
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSRule]:
1751
+ '''
1752
+ Inserts a new rule with the given ``ruleText`` in a stylesheet with given ``styleSheetId``, at the
1753
+ position specified by ``location``.
1754
+
1755
+ :param style_sheet_id: The css style sheet identifier where a new rule should be inserted.
1756
+ :param rule_text: The text of a new rule.
1757
+ :param location: Text position of a new rule in the target style sheet.
1758
+ :param node_for_property_syntax_validation: **(EXPERIMENTAL)** *(Optional)* NodeId for the DOM node in whose context custom property declarations for registered properties should be validated. If omitted, declarations in the new rule text can only be validated statically, which may produce incorrect results if the declaration contains a var() for example.
1759
+ :returns: The newly created rule.
1760
+ '''
1761
+ params: T_JSON_DICT = dict()
1762
+ params['styleSheetId'] = style_sheet_id.to_json()
1763
+ params['ruleText'] = rule_text
1764
+ params['location'] = location.to_json()
1765
+ if node_for_property_syntax_validation is not None:
1766
+ params['nodeForPropertySyntaxValidation'] = node_for_property_syntax_validation.to_json()
1767
+ cmd_dict: T_JSON_DICT = {
1768
+ 'method': 'CSS.addRule',
1769
+ 'params': params,
1770
+ }
1771
+ json = yield cmd_dict
1772
+ return CSSRule.from_json(json['rule'])
1773
+
1774
+
1775
+ def collect_class_names(
1776
+ style_sheet_id: dom.StyleSheetId
1777
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]:
1778
+ '''
1779
+ Returns all class names from specified stylesheet.
1780
+
1781
+ :param style_sheet_id:
1782
+ :returns: Class name list.
1783
+ '''
1784
+ params: T_JSON_DICT = dict()
1785
+ params['styleSheetId'] = style_sheet_id.to_json()
1786
+ cmd_dict: T_JSON_DICT = {
1787
+ 'method': 'CSS.collectClassNames',
1788
+ 'params': params,
1789
+ }
1790
+ json = yield cmd_dict
1791
+ return [str(i) for i in json['classNames']]
1792
+
1793
+
1794
+ def create_style_sheet(
1795
+ frame_id: page.FrameId,
1796
+ force: typing.Optional[bool] = None
1797
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dom.StyleSheetId]:
1798
+ '''
1799
+ Creates a new special "via-inspector" stylesheet in the frame with given ``frameId``.
1800
+
1801
+ :param frame_id: Identifier of the frame where "via-inspector" stylesheet should be created.
1802
+ :param force: *(Optional)* If true, creates a new stylesheet for every call. If false, returns a stylesheet previously created by a call with force=false for the frame's document if it exists or creates a new stylesheet (default: false).
1803
+ :returns: Identifier of the created "via-inspector" stylesheet.
1804
+ '''
1805
+ params: T_JSON_DICT = dict()
1806
+ params['frameId'] = frame_id.to_json()
1807
+ if force is not None:
1808
+ params['force'] = force
1809
+ cmd_dict: T_JSON_DICT = {
1810
+ 'method': 'CSS.createStyleSheet',
1811
+ 'params': params,
1812
+ }
1813
+ json = yield cmd_dict
1814
+ return dom.StyleSheetId.from_json(json['styleSheetId'])
1815
+
1816
+
1817
+ def disable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1818
+ '''
1819
+ Disables the CSS agent for the given page.
1820
+ '''
1821
+ cmd_dict: T_JSON_DICT = {
1822
+ 'method': 'CSS.disable',
1823
+ }
1824
+ json = yield cmd_dict
1825
+
1826
+
1827
+ def enable() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1828
+ '''
1829
+ Enables the CSS agent for the given page. Clients should not assume that the CSS agent has been
1830
+ enabled until the result of this command is received.
1831
+ '''
1832
+ cmd_dict: T_JSON_DICT = {
1833
+ 'method': 'CSS.enable',
1834
+ }
1835
+ json = yield cmd_dict
1836
+
1837
+
1838
+ def force_pseudo_state(
1839
+ node_id: dom.NodeId,
1840
+ forced_pseudo_classes: typing.List[str]
1841
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1842
+ '''
1843
+ Ensures that the given node will have specified pseudo-classes whenever its style is computed by
1844
+ the browser.
1845
+
1846
+ :param node_id: The element id for which to force the pseudo state.
1847
+ :param forced_pseudo_classes: Element pseudo classes to force when computing the element's style.
1848
+ '''
1849
+ params: T_JSON_DICT = dict()
1850
+ params['nodeId'] = node_id.to_json()
1851
+ params['forcedPseudoClasses'] = [i for i in forced_pseudo_classes]
1852
+ cmd_dict: T_JSON_DICT = {
1853
+ 'method': 'CSS.forcePseudoState',
1854
+ 'params': params,
1855
+ }
1856
+ json = yield cmd_dict
1857
+
1858
+
1859
+ def force_starting_style(
1860
+ node_id: dom.NodeId,
1861
+ forced: bool
1862
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
1863
+ '''
1864
+ Ensures that the given node is in its starting-style state.
1865
+
1866
+ :param node_id: The element id for which to force the starting-style state.
1867
+ :param forced: Boolean indicating if this is on or off.
1868
+ '''
1869
+ params: T_JSON_DICT = dict()
1870
+ params['nodeId'] = node_id.to_json()
1871
+ params['forced'] = forced
1872
+ cmd_dict: T_JSON_DICT = {
1873
+ 'method': 'CSS.forceStartingStyle',
1874
+ 'params': params,
1875
+ }
1876
+ json = yield cmd_dict
1877
+
1878
+
1879
+ def get_background_colors(
1880
+ node_id: dom.NodeId
1881
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[typing.List[str]], typing.Optional[str], typing.Optional[str]]]:
1882
+ '''
1883
+ :param node_id: Id of the node to get background colors for.
1884
+ :returns: A tuple with the following items:
1885
+
1886
+ 0. **backgroundColors** - *(Optional)* The range of background colors behind this element, if it contains any visible text. If no visible text is present, this will be undefined. In the case of a flat background color, this will consist of simply that color. In the case of a gradient, this will consist of each of the color stops. For anything more complicated, this will be an empty array. Images will be ignored (as if the image had failed to load).
1887
+ 1. **computedFontSize** - *(Optional)* The computed font size for this node, as a CSS computed value string (e.g. '12px').
1888
+ 2. **computedFontWeight** - *(Optional)* The computed font weight for this node, as a CSS computed value string (e.g. 'normal' or '100').
1889
+ '''
1890
+ params: T_JSON_DICT = dict()
1891
+ params['nodeId'] = node_id.to_json()
1892
+ cmd_dict: T_JSON_DICT = {
1893
+ 'method': 'CSS.getBackgroundColors',
1894
+ 'params': params,
1895
+ }
1896
+ json = yield cmd_dict
1897
+ return (
1898
+ [str(i) for i in json['backgroundColors']] if json.get('backgroundColors', None) is not None else None,
1899
+ str(json['computedFontSize']) if json.get('computedFontSize', None) is not None else None,
1900
+ str(json['computedFontWeight']) if json.get('computedFontWeight', None) is not None else None
1901
+ )
1902
+
1903
+
1904
+ def get_computed_style_for_node(
1905
+ node_id: dom.NodeId
1906
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[CSSComputedStyleProperty], ComputedStyleExtraFields]]:
1907
+ '''
1908
+ Returns the computed style for a DOM node identified by ``nodeId``.
1909
+
1910
+ :param node_id:
1911
+ :returns: A tuple with the following items:
1912
+
1913
+ 0. **computedStyle** - Computed style for the specified DOM node.
1914
+ 1. **extraFields** - A list of non-standard "extra fields" which blink stores alongside each computed style.
1915
+ '''
1916
+ params: T_JSON_DICT = dict()
1917
+ params['nodeId'] = node_id.to_json()
1918
+ cmd_dict: T_JSON_DICT = {
1919
+ 'method': 'CSS.getComputedStyleForNode',
1920
+ 'params': params,
1921
+ }
1922
+ json = yield cmd_dict
1923
+ return (
1924
+ [CSSComputedStyleProperty.from_json(i) for i in json['computedStyle']],
1925
+ ComputedStyleExtraFields.from_json(json['extraFields'])
1926
+ )
1927
+
1928
+
1929
+ def resolve_values(
1930
+ values: typing.List[str],
1931
+ node_id: dom.NodeId,
1932
+ property_name: typing.Optional[str] = None,
1933
+ pseudo_type: typing.Optional[dom.PseudoType] = None,
1934
+ pseudo_identifier: typing.Optional[str] = None
1935
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[str]]:
1936
+ '''
1937
+ Resolve the specified values in the context of the provided element.
1938
+ For example, a value of '1em' is evaluated according to the computed
1939
+ 'font-size' of the element and a value 'calc(1px + 2px)' will be
1940
+ resolved to '3px'.
1941
+ If the ``propertyName`` was specified the ``values`` are resolved as if
1942
+ they were property's declaration. If a value cannot be parsed according
1943
+ to the provided property syntax, the value is parsed using combined
1944
+ syntax as if null ``propertyName`` was provided. If the value cannot be
1945
+ resolved even then, return the provided value without any changes.
1946
+ Note: this function currently does not resolve CSS random() function,
1947
+ it returns unmodified random() function parts.`
1948
+
1949
+ **EXPERIMENTAL**
1950
+
1951
+ :param values: Cascade-dependent keywords (revert/revert-layer) do not work.
1952
+ :param node_id: Id of the node in whose context the expression is evaluated
1953
+ :param property_name: *(Optional)* Only longhands and custom property names are accepted.
1954
+ :param pseudo_type: *(Optional)* Pseudo element type, only works for pseudo elements that generate elements in the tree, such as ::before and ::after.
1955
+ :param pseudo_identifier: *(Optional)* Pseudo element custom ident.
1956
+ :returns:
1957
+ '''
1958
+ params: T_JSON_DICT = dict()
1959
+ params['values'] = [i for i in values]
1960
+ params['nodeId'] = node_id.to_json()
1961
+ if property_name is not None:
1962
+ params['propertyName'] = property_name
1963
+ if pseudo_type is not None:
1964
+ params['pseudoType'] = pseudo_type.to_json()
1965
+ if pseudo_identifier is not None:
1966
+ params['pseudoIdentifier'] = pseudo_identifier
1967
+ cmd_dict: T_JSON_DICT = {
1968
+ 'method': 'CSS.resolveValues',
1969
+ 'params': params,
1970
+ }
1971
+ json = yield cmd_dict
1972
+ return [str(i) for i in json['results']]
1973
+
1974
+
1975
+ def get_longhand_properties(
1976
+ shorthand_name: str,
1977
+ value: str
1978
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[CSSProperty]]:
1979
+ '''
1980
+
1981
+
1982
+ **EXPERIMENTAL**
1983
+
1984
+ :param shorthand_name:
1985
+ :param value:
1986
+ :returns:
1987
+ '''
1988
+ params: T_JSON_DICT = dict()
1989
+ params['shorthandName'] = shorthand_name
1990
+ params['value'] = value
1991
+ cmd_dict: T_JSON_DICT = {
1992
+ 'method': 'CSS.getLonghandProperties',
1993
+ 'params': params,
1994
+ }
1995
+ json = yield cmd_dict
1996
+ return [CSSProperty.from_json(i) for i in json['longhandProperties']]
1997
+
1998
+
1999
+ def get_inline_styles_for_node(
2000
+ node_id: dom.NodeId
2001
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[CSSStyle], typing.Optional[CSSStyle]]]:
2002
+ '''
2003
+ Returns the styles defined inline (explicitly in the "style" attribute and implicitly, using DOM
2004
+ attributes) for a DOM node identified by ``nodeId``.
2005
+
2006
+ :param node_id:
2007
+ :returns: A tuple with the following items:
2008
+
2009
+ 0. **inlineStyle** - *(Optional)* Inline style for the specified DOM node.
2010
+ 1. **attributesStyle** - *(Optional)* Attribute-defined element style (e.g. resulting from "width=20 height=100%").
2011
+ '''
2012
+ params: T_JSON_DICT = dict()
2013
+ params['nodeId'] = node_id.to_json()
2014
+ cmd_dict: T_JSON_DICT = {
2015
+ 'method': 'CSS.getInlineStylesForNode',
2016
+ 'params': params,
2017
+ }
2018
+ json = yield cmd_dict
2019
+ return (
2020
+ CSSStyle.from_json(json['inlineStyle']) if json.get('inlineStyle', None) is not None else None,
2021
+ CSSStyle.from_json(json['attributesStyle']) if json.get('attributesStyle', None) is not None else None
2022
+ )
2023
+
2024
+
2025
+ def get_animated_styles_for_node(
2026
+ node_id: dom.NodeId
2027
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[typing.List[CSSAnimationStyle]], typing.Optional[CSSStyle], typing.Optional[typing.List[InheritedAnimatedStyleEntry]]]]:
2028
+ '''
2029
+ Returns the styles coming from animations & transitions
2030
+ including the animation & transition styles coming from inheritance chain.
2031
+
2032
+ **EXPERIMENTAL**
2033
+
2034
+ :param node_id:
2035
+ :returns: A tuple with the following items:
2036
+
2037
+ 0. **animationStyles** - *(Optional)* Styles coming from animations.
2038
+ 1. **transitionsStyle** - *(Optional)* Style coming from transitions.
2039
+ 2. **inherited** - *(Optional)* Inherited style entries for animationsStyle and transitionsStyle from the inheritance chain of the element.
2040
+ '''
2041
+ params: T_JSON_DICT = dict()
2042
+ params['nodeId'] = node_id.to_json()
2043
+ cmd_dict: T_JSON_DICT = {
2044
+ 'method': 'CSS.getAnimatedStylesForNode',
2045
+ 'params': params,
2046
+ }
2047
+ json = yield cmd_dict
2048
+ return (
2049
+ [CSSAnimationStyle.from_json(i) for i in json['animationStyles']] if json.get('animationStyles', None) is not None else None,
2050
+ CSSStyle.from_json(json['transitionsStyle']) if json.get('transitionsStyle', None) is not None else None,
2051
+ [InheritedAnimatedStyleEntry.from_json(i) for i in json['inherited']] if json.get('inherited', None) is not None else None
2052
+ )
2053
+
2054
+
2055
+ def get_matched_styles_for_node(
2056
+ node_id: dom.NodeId
2057
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.Optional[CSSStyle], typing.Optional[CSSStyle], typing.Optional[typing.List[RuleMatch]], typing.Optional[typing.List[PseudoElementMatches]], typing.Optional[typing.List[InheritedStyleEntry]], typing.Optional[typing.List[InheritedPseudoElementMatches]], typing.Optional[typing.List[CSSKeyframesRule]], typing.Optional[typing.List[CSSPositionTryRule]], typing.Optional[int], typing.Optional[typing.List[CSSPropertyRule]], typing.Optional[typing.List[CSSPropertyRegistration]], typing.Optional[typing.List[CSSAtRule]], typing.Optional[dom.NodeId], typing.Optional[typing.List[CSSFunctionRule]]]]:
2058
+ '''
2059
+ Returns requested styles for a DOM node identified by ``nodeId``.
2060
+
2061
+ :param node_id:
2062
+ :returns: A tuple with the following items:
2063
+
2064
+ 0. **inlineStyle** - *(Optional)* Inline style for the specified DOM node.
2065
+ 1. **attributesStyle** - *(Optional)* Attribute-defined element style (e.g. resulting from "width=20 height=100%").
2066
+ 2. **matchedCSSRules** - *(Optional)* CSS rules matching this node, from all applicable stylesheets.
2067
+ 3. **pseudoElements** - *(Optional)* Pseudo style matches for this node.
2068
+ 4. **inherited** - *(Optional)* A chain of inherited styles (from the immediate node parent up to the DOM tree root).
2069
+ 5. **inheritedPseudoElements** - *(Optional)* A chain of inherited pseudo element styles (from the immediate node parent up to the DOM tree root).
2070
+ 6. **cssKeyframesRules** - *(Optional)* A list of CSS keyframed animations matching this node.
2071
+ 7. **cssPositionTryRules** - *(Optional)* A list of CSS @position-try rules matching this node, based on the position-try-fallbacks property.
2072
+ 8. **activePositionFallbackIndex** - *(Optional)* Index of the active fallback in the applied position-try-fallback property, will not be set if there is no active position-try fallback.
2073
+ 9. **cssPropertyRules** - *(Optional)* A list of CSS at-property rules matching this node.
2074
+ 10. **cssPropertyRegistrations** - *(Optional)* A list of CSS property registrations matching this node.
2075
+ 11. **cssAtRules** - *(Optional)* A list of simple @rules matching this node or its pseudo-elements.
2076
+ 12. **parentLayoutNodeId** - *(Optional)* Id of the first parent element that does not have display: contents.
2077
+ 13. **cssFunctionRules** - *(Optional)* A list of CSS at-function rules referenced by styles of this node.
2078
+ '''
2079
+ params: T_JSON_DICT = dict()
2080
+ params['nodeId'] = node_id.to_json()
2081
+ cmd_dict: T_JSON_DICT = {
2082
+ 'method': 'CSS.getMatchedStylesForNode',
2083
+ 'params': params,
2084
+ }
2085
+ json = yield cmd_dict
2086
+ return (
2087
+ CSSStyle.from_json(json['inlineStyle']) if json.get('inlineStyle', None) is not None else None,
2088
+ CSSStyle.from_json(json['attributesStyle']) if json.get('attributesStyle', None) is not None else None,
2089
+ [RuleMatch.from_json(i) for i in json['matchedCSSRules']] if json.get('matchedCSSRules', None) is not None else None,
2090
+ [PseudoElementMatches.from_json(i) for i in json['pseudoElements']] if json.get('pseudoElements', None) is not None else None,
2091
+ [InheritedStyleEntry.from_json(i) for i in json['inherited']] if json.get('inherited', None) is not None else None,
2092
+ [InheritedPseudoElementMatches.from_json(i) for i in json['inheritedPseudoElements']] if json.get('inheritedPseudoElements', None) is not None else None,
2093
+ [CSSKeyframesRule.from_json(i) for i in json['cssKeyframesRules']] if json.get('cssKeyframesRules', None) is not None else None,
2094
+ [CSSPositionTryRule.from_json(i) for i in json['cssPositionTryRules']] if json.get('cssPositionTryRules', None) is not None else None,
2095
+ int(json['activePositionFallbackIndex']) if json.get('activePositionFallbackIndex', None) is not None else None,
2096
+ [CSSPropertyRule.from_json(i) for i in json['cssPropertyRules']] if json.get('cssPropertyRules', None) is not None else None,
2097
+ [CSSPropertyRegistration.from_json(i) for i in json['cssPropertyRegistrations']] if json.get('cssPropertyRegistrations', None) is not None else None,
2098
+ [CSSAtRule.from_json(i) for i in json['cssAtRules']] if json.get('cssAtRules', None) is not None else None,
2099
+ dom.NodeId.from_json(json['parentLayoutNodeId']) if json.get('parentLayoutNodeId', None) is not None else None,
2100
+ [CSSFunctionRule.from_json(i) for i in json['cssFunctionRules']] if json.get('cssFunctionRules', None) is not None else None
2101
+ )
2102
+
2103
+
2104
+ def get_environment_variables() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,dict]:
2105
+ '''
2106
+ Returns the values of the default UA-defined environment variables used in env()
2107
+
2108
+ **EXPERIMENTAL**
2109
+
2110
+ :returns:
2111
+ '''
2112
+ cmd_dict: T_JSON_DICT = {
2113
+ 'method': 'CSS.getEnvironmentVariables',
2114
+ }
2115
+ json = yield cmd_dict
2116
+ return dict(json['environmentVariables'])
2117
+
2118
+
2119
+ def get_media_queries() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[CSSMedia]]:
2120
+ '''
2121
+ Returns all media queries parsed by the rendering engine.
2122
+
2123
+ :returns:
2124
+ '''
2125
+ cmd_dict: T_JSON_DICT = {
2126
+ 'method': 'CSS.getMediaQueries',
2127
+ }
2128
+ json = yield cmd_dict
2129
+ return [CSSMedia.from_json(i) for i in json['medias']]
2130
+
2131
+
2132
+ def get_platform_fonts_for_node(
2133
+ node_id: dom.NodeId
2134
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[PlatformFontUsage]]:
2135
+ '''
2136
+ Requests information about platform fonts which we used to render child TextNodes in the given
2137
+ node.
2138
+
2139
+ :param node_id:
2140
+ :returns: Usage statistics for every employed platform font.
2141
+ '''
2142
+ params: T_JSON_DICT = dict()
2143
+ params['nodeId'] = node_id.to_json()
2144
+ cmd_dict: T_JSON_DICT = {
2145
+ 'method': 'CSS.getPlatformFontsForNode',
2146
+ 'params': params,
2147
+ }
2148
+ json = yield cmd_dict
2149
+ return [PlatformFontUsage.from_json(i) for i in json['fonts']]
2150
+
2151
+
2152
+ def get_style_sheet_text(
2153
+ style_sheet_id: dom.StyleSheetId
2154
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,str]:
2155
+ '''
2156
+ Returns the current textual content for a stylesheet.
2157
+
2158
+ :param style_sheet_id:
2159
+ :returns: The stylesheet text.
2160
+ '''
2161
+ params: T_JSON_DICT = dict()
2162
+ params['styleSheetId'] = style_sheet_id.to_json()
2163
+ cmd_dict: T_JSON_DICT = {
2164
+ 'method': 'CSS.getStyleSheetText',
2165
+ 'params': params,
2166
+ }
2167
+ json = yield cmd_dict
2168
+ return str(json['text'])
2169
+
2170
+
2171
+ def get_layers_for_node(
2172
+ node_id: dom.NodeId
2173
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSLayerData]:
2174
+ '''
2175
+ Returns all layers parsed by the rendering engine for the tree scope of a node.
2176
+ Given a DOM element identified by nodeId, getLayersForNode returns the root
2177
+ layer for the nearest ancestor document or shadow root. The layer root contains
2178
+ the full layer tree for the tree scope and their ordering.
2179
+
2180
+ **EXPERIMENTAL**
2181
+
2182
+ :param node_id:
2183
+ :returns:
2184
+ '''
2185
+ params: T_JSON_DICT = dict()
2186
+ params['nodeId'] = node_id.to_json()
2187
+ cmd_dict: T_JSON_DICT = {
2188
+ 'method': 'CSS.getLayersForNode',
2189
+ 'params': params,
2190
+ }
2191
+ json = yield cmd_dict
2192
+ return CSSLayerData.from_json(json['rootLayer'])
2193
+
2194
+
2195
+ def get_location_for_selector(
2196
+ style_sheet_id: dom.StyleSheetId,
2197
+ selector_text: str
2198
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[SourceRange]]:
2199
+ '''
2200
+ Given a CSS selector text and a style sheet ID, getLocationForSelector
2201
+ returns an array of locations of the CSS selector in the style sheet.
2202
+
2203
+ **EXPERIMENTAL**
2204
+
2205
+ :param style_sheet_id:
2206
+ :param selector_text:
2207
+ :returns:
2208
+ '''
2209
+ params: T_JSON_DICT = dict()
2210
+ params['styleSheetId'] = style_sheet_id.to_json()
2211
+ params['selectorText'] = selector_text
2212
+ cmd_dict: T_JSON_DICT = {
2213
+ 'method': 'CSS.getLocationForSelector',
2214
+ 'params': params,
2215
+ }
2216
+ json = yield cmd_dict
2217
+ return [SourceRange.from_json(i) for i in json['ranges']]
2218
+
2219
+
2220
+ def track_computed_style_updates_for_node(
2221
+ node_id: typing.Optional[dom.NodeId] = None
2222
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
2223
+ '''
2224
+ Starts tracking the given node for the computed style updates
2225
+ and whenever the computed style is updated for node, it queues
2226
+ a ``computedStyleUpdated`` event with throttling.
2227
+ There can only be 1 node tracked for computed style updates
2228
+ so passing a new node id removes tracking from the previous node.
2229
+ Pass ``undefined`` to disable tracking.
2230
+
2231
+ **EXPERIMENTAL**
2232
+
2233
+ :param node_id: *(Optional)*
2234
+ '''
2235
+ params: T_JSON_DICT = dict()
2236
+ if node_id is not None:
2237
+ params['nodeId'] = node_id.to_json()
2238
+ cmd_dict: T_JSON_DICT = {
2239
+ 'method': 'CSS.trackComputedStyleUpdatesForNode',
2240
+ 'params': params,
2241
+ }
2242
+ json = yield cmd_dict
2243
+
2244
+
2245
+ def track_computed_style_updates(
2246
+ properties_to_track: typing.List[CSSComputedStyleProperty]
2247
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
2248
+ '''
2249
+ Starts tracking the given computed styles for updates. The specified array of properties
2250
+ replaces the one previously specified. Pass empty array to disable tracking.
2251
+ Use takeComputedStyleUpdates to retrieve the list of nodes that had properties modified.
2252
+ The changes to computed style properties are only tracked for nodes pushed to the front-end
2253
+ by the DOM agent. If no changes to the tracked properties occur after the node has been pushed
2254
+ to the front-end, no updates will be issued for the node.
2255
+
2256
+ **EXPERIMENTAL**
2257
+
2258
+ :param properties_to_track:
2259
+ '''
2260
+ params: T_JSON_DICT = dict()
2261
+ params['propertiesToTrack'] = [i.to_json() for i in properties_to_track]
2262
+ cmd_dict: T_JSON_DICT = {
2263
+ 'method': 'CSS.trackComputedStyleUpdates',
2264
+ 'params': params,
2265
+ }
2266
+ json = yield cmd_dict
2267
+
2268
+
2269
+ def take_computed_style_updates() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[dom.NodeId]]:
2270
+ '''
2271
+ Polls the next batch of computed style updates.
2272
+
2273
+ **EXPERIMENTAL**
2274
+
2275
+ :returns: The list of node Ids that have their tracked computed styles updated.
2276
+ '''
2277
+ cmd_dict: T_JSON_DICT = {
2278
+ 'method': 'CSS.takeComputedStyleUpdates',
2279
+ }
2280
+ json = yield cmd_dict
2281
+ return [dom.NodeId.from_json(i) for i in json['nodeIds']]
2282
+
2283
+
2284
+ def set_effective_property_value_for_node(
2285
+ node_id: dom.NodeId,
2286
+ property_name: str,
2287
+ value: str
2288
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
2289
+ '''
2290
+ Find a rule with the given active property for the given node and set the new value for this
2291
+ property
2292
+
2293
+ :param node_id: The element id for which to set property.
2294
+ :param property_name:
2295
+ :param value:
2296
+ '''
2297
+ params: T_JSON_DICT = dict()
2298
+ params['nodeId'] = node_id.to_json()
2299
+ params['propertyName'] = property_name
2300
+ params['value'] = value
2301
+ cmd_dict: T_JSON_DICT = {
2302
+ 'method': 'CSS.setEffectivePropertyValueForNode',
2303
+ 'params': params,
2304
+ }
2305
+ json = yield cmd_dict
2306
+
2307
+
2308
+ def set_property_rule_property_name(
2309
+ style_sheet_id: dom.StyleSheetId,
2310
+ range_: SourceRange,
2311
+ property_name: str
2312
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Value]:
2313
+ '''
2314
+ Modifies the property rule property name.
2315
+
2316
+ :param style_sheet_id:
2317
+ :param range_:
2318
+ :param property_name:
2319
+ :returns: The resulting key text after modification.
2320
+ '''
2321
+ params: T_JSON_DICT = dict()
2322
+ params['styleSheetId'] = style_sheet_id.to_json()
2323
+ params['range'] = range_.to_json()
2324
+ params['propertyName'] = property_name
2325
+ cmd_dict: T_JSON_DICT = {
2326
+ 'method': 'CSS.setPropertyRulePropertyName',
2327
+ 'params': params,
2328
+ }
2329
+ json = yield cmd_dict
2330
+ return Value.from_json(json['propertyName'])
2331
+
2332
+
2333
+ def set_keyframe_key(
2334
+ style_sheet_id: dom.StyleSheetId,
2335
+ range_: SourceRange,
2336
+ key_text: str
2337
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,Value]:
2338
+ '''
2339
+ Modifies the keyframe rule key text.
2340
+
2341
+ :param style_sheet_id:
2342
+ :param range_:
2343
+ :param key_text:
2344
+ :returns: The resulting key text after modification.
2345
+ '''
2346
+ params: T_JSON_DICT = dict()
2347
+ params['styleSheetId'] = style_sheet_id.to_json()
2348
+ params['range'] = range_.to_json()
2349
+ params['keyText'] = key_text
2350
+ cmd_dict: T_JSON_DICT = {
2351
+ 'method': 'CSS.setKeyframeKey',
2352
+ 'params': params,
2353
+ }
2354
+ json = yield cmd_dict
2355
+ return Value.from_json(json['keyText'])
2356
+
2357
+
2358
+ def set_media_text(
2359
+ style_sheet_id: dom.StyleSheetId,
2360
+ range_: SourceRange,
2361
+ text: str
2362
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSMedia]:
2363
+ '''
2364
+ Modifies the rule selector.
2365
+
2366
+ :param style_sheet_id:
2367
+ :param range_:
2368
+ :param text:
2369
+ :returns: The resulting CSS media rule after modification.
2370
+ '''
2371
+ params: T_JSON_DICT = dict()
2372
+ params['styleSheetId'] = style_sheet_id.to_json()
2373
+ params['range'] = range_.to_json()
2374
+ params['text'] = text
2375
+ cmd_dict: T_JSON_DICT = {
2376
+ 'method': 'CSS.setMediaText',
2377
+ 'params': params,
2378
+ }
2379
+ json = yield cmd_dict
2380
+ return CSSMedia.from_json(json['media'])
2381
+
2382
+
2383
+ @deprecated(version="1.3")
2384
+ def set_container_query_text(
2385
+ style_sheet_id: dom.StyleSheetId,
2386
+ range_: SourceRange,
2387
+ text: str
2388
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSContainerQuery]:
2389
+ '''
2390
+ Modifies the expression of a container query.
2391
+ Deprecated. Use setContainerQueryConditionText instead.
2392
+
2393
+ .. deprecated:: 1.3
2394
+
2395
+ **EXPERIMENTAL**
2396
+
2397
+ :param style_sheet_id:
2398
+ :param range_:
2399
+ :param text:
2400
+ :returns: The resulting CSS container query rule after modification.
2401
+ '''
2402
+ params: T_JSON_DICT = dict()
2403
+ params['styleSheetId'] = style_sheet_id.to_json()
2404
+ params['range'] = range_.to_json()
2405
+ params['text'] = text
2406
+ cmd_dict: T_JSON_DICT = {
2407
+ 'method': 'CSS.setContainerQueryText',
2408
+ 'params': params,
2409
+ }
2410
+ json = yield cmd_dict
2411
+ return CSSContainerQuery.from_json(json['containerQuery'])
2412
+
2413
+
2414
+ def set_container_query_condition_text(
2415
+ style_sheet_id: dom.StyleSheetId,
2416
+ range_: SourceRange,
2417
+ text: str
2418
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSContainerQuery]:
2419
+ '''
2420
+
2421
+
2422
+ **EXPERIMENTAL**
2423
+
2424
+ :param style_sheet_id:
2425
+ :param range_:
2426
+ :param text:
2427
+ :returns: The resulting CSS container query rule after modification.
2428
+ '''
2429
+ params: T_JSON_DICT = dict()
2430
+ params['styleSheetId'] = style_sheet_id.to_json()
2431
+ params['range'] = range_.to_json()
2432
+ params['text'] = text
2433
+ cmd_dict: T_JSON_DICT = {
2434
+ 'method': 'CSS.setContainerQueryConditionText',
2435
+ 'params': params,
2436
+ }
2437
+ json = yield cmd_dict
2438
+ return CSSContainerQuery.from_json(json['containerQuery'])
2439
+
2440
+
2441
+ def set_supports_text(
2442
+ style_sheet_id: dom.StyleSheetId,
2443
+ range_: SourceRange,
2444
+ text: str
2445
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSSupports]:
2446
+ '''
2447
+ Modifies the expression of a supports at-rule.
2448
+
2449
+ **EXPERIMENTAL**
2450
+
2451
+ :param style_sheet_id:
2452
+ :param range_:
2453
+ :param text:
2454
+ :returns: The resulting CSS Supports rule after modification.
2455
+ '''
2456
+ params: T_JSON_DICT = dict()
2457
+ params['styleSheetId'] = style_sheet_id.to_json()
2458
+ params['range'] = range_.to_json()
2459
+ params['text'] = text
2460
+ cmd_dict: T_JSON_DICT = {
2461
+ 'method': 'CSS.setSupportsText',
2462
+ 'params': params,
2463
+ }
2464
+ json = yield cmd_dict
2465
+ return CSSSupports.from_json(json['supports'])
2466
+
2467
+
2468
+ def set_navigation_text(
2469
+ style_sheet_id: dom.StyleSheetId,
2470
+ range_: SourceRange,
2471
+ text: str
2472
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSNavigation]:
2473
+ '''
2474
+ Modifies the expression of a navigation at-rule.
2475
+
2476
+ **EXPERIMENTAL**
2477
+
2478
+ :param style_sheet_id:
2479
+ :param range_:
2480
+ :param text:
2481
+ :returns: The resulting CSS Navigation rule after modification.
2482
+ '''
2483
+ params: T_JSON_DICT = dict()
2484
+ params['styleSheetId'] = style_sheet_id.to_json()
2485
+ params['range'] = range_.to_json()
2486
+ params['text'] = text
2487
+ cmd_dict: T_JSON_DICT = {
2488
+ 'method': 'CSS.setNavigationText',
2489
+ 'params': params,
2490
+ }
2491
+ json = yield cmd_dict
2492
+ return CSSNavigation.from_json(json['navigation'])
2493
+
2494
+
2495
+ def set_scope_text(
2496
+ style_sheet_id: dom.StyleSheetId,
2497
+ range_: SourceRange,
2498
+ text: str
2499
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,CSSScope]:
2500
+ '''
2501
+ Modifies the expression of a scope at-rule.
2502
+
2503
+ **EXPERIMENTAL**
2504
+
2505
+ :param style_sheet_id:
2506
+ :param range_:
2507
+ :param text:
2508
+ :returns: The resulting CSS Scope rule after modification.
2509
+ '''
2510
+ params: T_JSON_DICT = dict()
2511
+ params['styleSheetId'] = style_sheet_id.to_json()
2512
+ params['range'] = range_.to_json()
2513
+ params['text'] = text
2514
+ cmd_dict: T_JSON_DICT = {
2515
+ 'method': 'CSS.setScopeText',
2516
+ 'params': params,
2517
+ }
2518
+ json = yield cmd_dict
2519
+ return CSSScope.from_json(json['scope'])
2520
+
2521
+
2522
+ def set_rule_selector(
2523
+ style_sheet_id: dom.StyleSheetId,
2524
+ range_: SourceRange,
2525
+ selector: str
2526
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,SelectorList]:
2527
+ '''
2528
+ Modifies the rule selector.
2529
+
2530
+ :param style_sheet_id:
2531
+ :param range_:
2532
+ :param selector:
2533
+ :returns: The resulting selector list after modification.
2534
+ '''
2535
+ params: T_JSON_DICT = dict()
2536
+ params['styleSheetId'] = style_sheet_id.to_json()
2537
+ params['range'] = range_.to_json()
2538
+ params['selector'] = selector
2539
+ cmd_dict: T_JSON_DICT = {
2540
+ 'method': 'CSS.setRuleSelector',
2541
+ 'params': params,
2542
+ }
2543
+ json = yield cmd_dict
2544
+ return SelectorList.from_json(json['selectorList'])
2545
+
2546
+
2547
+ def set_style_sheet_text(
2548
+ style_sheet_id: dom.StyleSheetId,
2549
+ text: str
2550
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Optional[str]]:
2551
+ '''
2552
+ Sets the new stylesheet text.
2553
+
2554
+ :param style_sheet_id:
2555
+ :param text:
2556
+ :returns: *(Optional)* URL of source map associated with script (if any).
2557
+ '''
2558
+ params: T_JSON_DICT = dict()
2559
+ params['styleSheetId'] = style_sheet_id.to_json()
2560
+ params['text'] = text
2561
+ cmd_dict: T_JSON_DICT = {
2562
+ 'method': 'CSS.setStyleSheetText',
2563
+ 'params': params,
2564
+ }
2565
+ json = yield cmd_dict
2566
+ return str(json['sourceMapURL']) if json.get('sourceMapURL', None) is not None else None
2567
+
2568
+
2569
+ def set_style_texts(
2570
+ edits: typing.List[StyleDeclarationEdit],
2571
+ node_for_property_syntax_validation: typing.Optional[dom.NodeId] = None
2572
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[CSSStyle]]:
2573
+ '''
2574
+ Applies specified style edits one after another in the given order.
2575
+
2576
+ :param edits:
2577
+ :param node_for_property_syntax_validation: **(EXPERIMENTAL)** *(Optional)* NodeId for the DOM node in whose context custom property declarations for registered properties should be validated. If omitted, declarations in the new rule text can only be validated statically, which may produce incorrect results if the declaration contains a var() for example.
2578
+ :returns: The resulting styles after modification.
2579
+ '''
2580
+ params: T_JSON_DICT = dict()
2581
+ params['edits'] = [i.to_json() for i in edits]
2582
+ if node_for_property_syntax_validation is not None:
2583
+ params['nodeForPropertySyntaxValidation'] = node_for_property_syntax_validation.to_json()
2584
+ cmd_dict: T_JSON_DICT = {
2585
+ 'method': 'CSS.setStyleTexts',
2586
+ 'params': params,
2587
+ }
2588
+ json = yield cmd_dict
2589
+ return [CSSStyle.from_json(i) for i in json['styles']]
2590
+
2591
+
2592
+ def start_rule_usage_tracking() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
2593
+ '''
2594
+ Enables the selector recording.
2595
+ '''
2596
+ cmd_dict: T_JSON_DICT = {
2597
+ 'method': 'CSS.startRuleUsageTracking',
2598
+ }
2599
+ json = yield cmd_dict
2600
+
2601
+
2602
+ def stop_rule_usage_tracking() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.List[RuleUsage]]:
2603
+ '''
2604
+ Stop tracking rule usage and return the list of rules that were used since last call to
2605
+ ``takeCoverageDelta`` (or since start of coverage instrumentation).
2606
+
2607
+ :returns:
2608
+ '''
2609
+ cmd_dict: T_JSON_DICT = {
2610
+ 'method': 'CSS.stopRuleUsageTracking',
2611
+ }
2612
+ json = yield cmd_dict
2613
+ return [RuleUsage.from_json(i) for i in json['ruleUsage']]
2614
+
2615
+
2616
+ def take_coverage_delta() -> typing.Generator[T_JSON_DICT,T_JSON_DICT,typing.Tuple[typing.List[RuleUsage], float]]:
2617
+ '''
2618
+ Obtain list of rules that became used since last call to this method (or since start of coverage
2619
+ instrumentation).
2620
+
2621
+ :returns: A tuple with the following items:
2622
+
2623
+ 0. **coverage** -
2624
+ 1. **timestamp** - Monotonically increasing time, in seconds.
2625
+ '''
2626
+ cmd_dict: T_JSON_DICT = {
2627
+ 'method': 'CSS.takeCoverageDelta',
2628
+ }
2629
+ json = yield cmd_dict
2630
+ return (
2631
+ [RuleUsage.from_json(i) for i in json['coverage']],
2632
+ float(json['timestamp'])
2633
+ )
2634
+
2635
+
2636
+ def set_local_fonts_enabled(
2637
+ enabled: bool
2638
+ ) -> typing.Generator[T_JSON_DICT,T_JSON_DICT,None]:
2639
+ '''
2640
+ Enables/disables rendering of local CSS fonts (enabled by default).
2641
+
2642
+ **EXPERIMENTAL**
2643
+
2644
+ :param enabled: Whether rendering of local fonts is enabled.
2645
+ '''
2646
+ params: T_JSON_DICT = dict()
2647
+ params['enabled'] = enabled
2648
+ cmd_dict: T_JSON_DICT = {
2649
+ 'method': 'CSS.setLocalFontsEnabled',
2650
+ 'params': params,
2651
+ }
2652
+ json = yield cmd_dict
2653
+
2654
+
2655
+ @event_class('CSS.fontsUpdated')
2656
+ @dataclass
2657
+ class FontsUpdated:
2658
+ '''
2659
+ Fires whenever a web font is updated. A non-empty font parameter indicates a successfully loaded
2660
+ web font.
2661
+ '''
2662
+ #: The web font that has loaded.
2663
+ font: typing.Optional[FontFace]
2664
+
2665
+ @classmethod
2666
+ def from_json(cls, json: T_JSON_DICT) -> FontsUpdated:
2667
+ return cls(
2668
+ font=FontFace.from_json(json['font']) if json.get('font', None) is not None else None
2669
+ )
2670
+
2671
+
2672
+ @event_class('CSS.mediaQueryResultChanged')
2673
+ @dataclass
2674
+ class MediaQueryResultChanged:
2675
+ '''
2676
+ Fires whenever a MediaQuery result changes (for example, after a browser window has been
2677
+ resized.) The current implementation considers only viewport-dependent media features.
2678
+ '''
2679
+
2680
+
2681
+ @classmethod
2682
+ def from_json(cls, json: T_JSON_DICT) -> MediaQueryResultChanged:
2683
+ return cls(
2684
+
2685
+ )
2686
+
2687
+
2688
+ @event_class('CSS.styleSheetAdded')
2689
+ @dataclass
2690
+ class StyleSheetAdded:
2691
+ '''
2692
+ Fired whenever an active document stylesheet is added.
2693
+ '''
2694
+ #: Added stylesheet metainfo.
2695
+ header: CSSStyleSheetHeader
2696
+
2697
+ @classmethod
2698
+ def from_json(cls, json: T_JSON_DICT) -> StyleSheetAdded:
2699
+ return cls(
2700
+ header=CSSStyleSheetHeader.from_json(json['header'])
2701
+ )
2702
+
2703
+
2704
+ @event_class('CSS.styleSheetChanged')
2705
+ @dataclass
2706
+ class StyleSheetChanged:
2707
+ '''
2708
+ Fired whenever a stylesheet is changed as a result of the client operation.
2709
+ '''
2710
+ style_sheet_id: dom.StyleSheetId
2711
+
2712
+ @classmethod
2713
+ def from_json(cls, json: T_JSON_DICT) -> StyleSheetChanged:
2714
+ return cls(
2715
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId'])
2716
+ )
2717
+
2718
+
2719
+ @event_class('CSS.styleSheetRemoved')
2720
+ @dataclass
2721
+ class StyleSheetRemoved:
2722
+ '''
2723
+ Fired whenever an active document stylesheet is removed.
2724
+ '''
2725
+ #: Identifier of the removed stylesheet.
2726
+ style_sheet_id: dom.StyleSheetId
2727
+
2728
+ @classmethod
2729
+ def from_json(cls, json: T_JSON_DICT) -> StyleSheetRemoved:
2730
+ return cls(
2731
+ style_sheet_id=dom.StyleSheetId.from_json(json['styleSheetId'])
2732
+ )
2733
+
2734
+
2735
+ @event_class('CSS.computedStyleUpdated')
2736
+ @dataclass
2737
+ class ComputedStyleUpdated:
2738
+ '''
2739
+ **EXPERIMENTAL**
2740
+
2741
+
2742
+ '''
2743
+ #: The node id that has updated computed styles.
2744
+ node_id: dom.NodeId
2745
+
2746
+ @classmethod
2747
+ def from_json(cls, json: T_JSON_DICT) -> ComputedStyleUpdated:
2748
+ return cls(
2749
+ node_id=dom.NodeId.from_json(json['nodeId'])
2750
+ )