Skip to content

Commit 48a0b49

Browse files
committed
generate indexers (with overloads if necessary) for additionalProperties & patternProperties
Fixes #15
1 parent 74007cc commit 48a0b49

File tree

19 files changed

+496
-103
lines changed

19 files changed

+496
-103
lines changed

declarations/src/main/kotlin/bookmarks/bookmarks.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,29 @@ external class CreateDetails {
9191
* A single string-valued id, or an array of string-valued ids */
9292
typealias IdOrIdList = Any
9393

94+
/**
95+
* An object specifying properties and values to match when searching. Produces bookmarks matching all properties.
96+
*/
97+
external class Query {
98+
/**
99+
* A string of words and quoted phrases that are matched against bookmark URLs and titles.
100+
*/
101+
var query: String?
102+
103+
/**
104+
* The URL of the bookmark; matches verbatim. Note that folders have no URL.
105+
*/
106+
var url: String?
107+
108+
/**
109+
* The title of the bookmark; matches verbatim.
110+
*/
111+
var title: String?
112+
}
113+
94114
/**
95115
* Either a string of words and quoted phrases that are matched against bookmark URLs and titles, or an object. If an object, the properties <code>query</code>, <code>url</code>, and <code>title</code> may be specified and bookmarks matching all specified properties will be produced. */
96-
typealias Query = Any
116+
typealias Query2 = Any
97117

98118
external class Destination {
99119
var parentId: String?

declarations/src/main/kotlin/browserAction/browserAction.kt

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,13 @@ import tabs.Tab
77
typealias ColorArray = Array<Int>
88

99
/**
10-
* Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element). */
11-
typealias ImageDataType = Any
10+
* Pixel data for an image. Must be an ImageData object (for example, from a <code>canvas</code> element).
11+
*/
12+
external class ImageDataType {
13+
operator fun get(key: String): dynamic
14+
15+
operator fun set(key: String, value: dynamic)
16+
}
1217

1318
external class Details {
1419
/**
@@ -29,24 +34,36 @@ external class Details2 {
2934
var tabId: Int?
3035
}
3136

37+
external class ImageData {
38+
operator fun get(key: String): ImageDataType
39+
40+
operator fun set(key: String, value: ImageDataType)
41+
}
42+
3243
/**
3344
* Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}' */
34-
typealias ImageData = Any
45+
typealias ImageData2 = Any
46+
47+
external class Path {
48+
operator fun get(key: String): String
49+
50+
operator fun set(key: String, value: String)
51+
}
3552

3653
/**
3754
* Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}' */
38-
typealias Path = Any
55+
typealias Path2 = Any
3956

4057
external class Details3 {
4158
/**
4259
* Either an ImageData object or a dictionary {size -> ImageData} representing icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.imageData = foo' is equivalent to 'details.imageData = {'19': foo}'
4360
*/
44-
var imageData: ImageData?
61+
var imageData: ImageData2?
4562

4663
/**
4764
* Either a relative image path or a dictionary {size -> relative image path} pointing to icon to be set. If the icon is specified as a dictionary, the actual image to be used is chosen depending on screen's pixel density. If the number of image pixels that fit into one screen space unit equals <code>scale</code>, then image with size <code>scale</code> * 19 will be selected. Initially only scales 1 and 2 will be supported. At least one image must be specified. Note that 'details.path = foo' is equivalent to 'details.imageData = {'19': foo}'
4865
*/
49-
var path: Path?
66+
var path: Path2?
5067

5168
/**
5269
* Limits the change to when a particular tab is selected. Automatically resets when the tab is closed.

declarations/src/main/kotlin/contentScripts/contentScripts.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package contentScripts
33
import extensionTypes.RunAt
44
import kotlin.js.Promise
55
import manifest.MatchPattern
6+
import manifest.UnrecognizedProperty
67

78
typealias ExtensionFileOrCode = Any
89

@@ -42,6 +43,10 @@ external class RegisteredContentScriptOptions {
4243
* The soonest that the JavaScript or CSS will be injected into the tab. Defaults to "document_idle".
4344
*/
4445
var runAt: RunAt?
46+
47+
operator fun get(key: String): UnrecognizedProperty
48+
49+
operator fun set(key: String, value: UnrecognizedProperty)
4550
}
4651

4752
/**

declarations/src/main/kotlin/devtools/devtools.kt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,13 @@ external class InspectedWindowNamespace {
8787
typealias Request = Any
8888

8989
/**
90-
* A HAR log. See HAR specification for details. */
91-
typealias HarLog = Any
90+
* A HAR log. See HAR specification for details.
91+
*/
92+
external class HarLog {
93+
operator fun get(key: String): dynamic
94+
95+
operator fun set(key: String, value: dynamic)
96+
}
9297

9398
external class NetworkNamespace {
9499
val onNavigated: Event<(url: String) -> Unit>

declarations/src/main/kotlin/extension/extension.kt

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ external class LastError {
1414
* Description of the error that has taken place.
1515
*/
1616
var message: String
17+
18+
operator fun get(key: String): dynamic
19+
20+
operator fun set(key: String, value: dynamic)
1721
}
1822

1923
external class FetchProperties {
@@ -33,9 +37,17 @@ external class FetchProperties {
3337
var tabId: Int?
3438
}
3539

36-
typealias GetViewsResult = Any
40+
external class GetViewsResult {
41+
operator fun get(key: String): dynamic
42+
43+
operator fun set(key: String, value: dynamic)
44+
}
45+
46+
external class GetBackgroundPageResult {
47+
operator fun get(key: String): dynamic
3748

38-
typealias GetBackgroundPageResult = Any
49+
operator fun set(key: String, value: dynamic)
50+
}
3951

4052
external class ExtensionNamespace {
4153
/**

0 commit comments

Comments
 (0)