@astryxdesign/native 0.7.5-canary.f2dafed → 0.7.5-canary.fccd771
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.
- package/README.md +19 -2
- package/apple/Sources/AstryxNative/Generated/Button.swift +78 -0
- package/apple/Sources/AstryxNative/Generated/Divider.swift +45 -0
- package/apple/Sources/AstryxNative/Generated/Heading.swift +97 -0
- package/apple/Sources/AstryxNative/Generated/ProgressBar.swift +72 -0
- package/apple/Sources/AstryxNative/Generated/Switch.swift +106 -0
- package/apple/Sources/AstryxNative/Generated/Text.swift +100 -0
- package/apple/Sources/AstryxNative/Generated/TextInput.swift +129 -0
- package/apple/Tests/AstryxNativeTests/ControlPropsTests.swift +27 -0
- package/dist/components/Button.d.ts +10 -0
- package/dist/components/Button.d.ts.map +1 -0
- package/dist/components/Button.js +15 -0
- package/dist/components/Divider.d.ts +10 -0
- package/dist/components/Divider.d.ts.map +1 -0
- package/dist/components/Divider.js +6 -0
- package/dist/components/Heading.d.ts +10 -0
- package/dist/components/Heading.d.ts.map +1 -0
- package/dist/components/Heading.js +14 -0
- package/dist/components/ProgressBar.d.ts +10 -0
- package/dist/components/ProgressBar.d.ts.map +1 -0
- package/dist/components/ProgressBar.js +5 -0
- package/dist/components/Switch.d.ts +10 -0
- package/dist/components/Switch.d.ts.map +1 -0
- package/dist/components/Switch.js +6 -0
- package/dist/components/Text.d.ts +10 -0
- package/dist/components/Text.d.ts.map +1 -0
- package/dist/components/Text.js +13 -0
- package/dist/components/TextInput.d.ts +10 -0
- package/dist/components/TextInput.d.ts.map +1 -0
- package/dist/components/TextInput.js +9 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +17 -1
- package/dist/contract/fromComponentDoc.d.ts +43 -5
- package/dist/contract/fromComponentDoc.d.ts.map +1 -1
- package/dist/contract/fromComponentDoc.js +46 -4
- package/dist/contract/generateSwift.d.ts.map +1 -1
- package/dist/contract/generateSwift.js +11 -0
- package/dist/contract/generateTypeScript.d.ts.map +1 -1
- package/dist/contract/generateTypeScript.js +2 -0
- package/dist/contract/index.d.ts +7 -3
- package/dist/contract/index.d.ts.map +1 -1
- package/dist/contract/index.js +2 -1
- package/dist/contract/parseDocType.d.ts +5 -2
- package/dist/contract/parseDocType.d.ts.map +1 -1
- package/dist/contract/parseDocType.js +34 -5
- package/dist/contract/rules.d.ts +5 -2
- package/dist/contract/rules.d.ts.map +1 -1
- package/dist/contract/rules.js +8 -4
- package/dist/contract/types.d.ts +7 -0
- package/dist/contract/types.d.ts.map +1 -1
- package/dist/types/android.d.ts +23 -2
- package/dist/types/core.d.ts +97 -0
- package/dist/types/ios.d.ts +23 -2
- package/dist/types/macos.d.ts +23 -2
- package/dist/types/shared.d.ts +23 -2
- package/dist/types/windows.d.ts +23 -2
- package/package.json +3 -3
- package/src/components/Button.ts +26 -0
- package/src/components/Divider.ts +17 -0
- package/src/components/Heading.ts +25 -0
- package/src/components/ProgressBar.ts +16 -0
- package/src/components/Switch.ts +17 -0
- package/src/components/Text.ts +24 -0
- package/src/components/TextInput.ts +20 -0
- package/src/components/index.ts +17 -1
- package/src/contract/contracts.test.ts +27 -0
- package/src/contract/fromComponentDoc.test.ts +97 -0
- package/src/contract/fromComponentDoc.ts +104 -9
- package/src/contract/generateSwift.ts +16 -0
- package/src/contract/generateTypeScript.ts +2 -0
- package/src/contract/index.ts +13 -4
- package/src/contract/parseDocType.test.ts +45 -0
- package/src/contract/parseDocType.ts +41 -6
- package/src/contract/rules.ts +11 -4
- package/src/contract/types.ts +4 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
|
|
3
|
+
import Testing
|
|
4
|
+
@testable import AstryxNative
|
|
5
|
+
|
|
6
|
+
@Test func valueCallbacksCarryTheValueOnly() {
|
|
7
|
+
var received: Bool?
|
|
8
|
+
let props = SwitchProps(label: "Wi-Fi", value: false, onChange: { received = $0 })
|
|
9
|
+
props.onChange?(true)
|
|
10
|
+
#expect(received == true)
|
|
11
|
+
#expect(SwitchProps.baseTarget == .root)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@Test func textSlotsAndNumberSetsAreTyped() {
|
|
15
|
+
let heading = HeadingProps(level: .v2, children: "Orders")
|
|
16
|
+
#expect(heading.level.rawValue == 2)
|
|
17
|
+
#expect(heading.children == "Orders")
|
|
18
|
+
let divider = DividerProps(label: "Or")
|
|
19
|
+
#expect(divider.label == "Or")
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@Test func aButtonPressTakesNoArguments() {
|
|
23
|
+
var pressed = 0
|
|
24
|
+
let button = ButtonProps(label: "Pay", onClick: { pressed += 1 })
|
|
25
|
+
button.onClick?()
|
|
26
|
+
#expect(pressed == 1)
|
|
27
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/Button.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core Button contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* Button documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const button: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.d.ts","sourceRoot":"","sources":["../../src/components/Button.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,MAAM,EAAE,eAapB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
export const button = {
|
|
3
|
+
name: 'Button',
|
|
4
|
+
baseTarget: 'root',
|
|
5
|
+
callbacks: ['onClick'],
|
|
6
|
+
sameMeaning: { onClick: 'a press, as in Compose' },
|
|
7
|
+
webOnly: {
|
|
8
|
+
type: 'HTML form submission type',
|
|
9
|
+
name: 'HTML form field name',
|
|
10
|
+
form: 'HTML form owner',
|
|
11
|
+
target: 'HTML link target',
|
|
12
|
+
rel: 'HTML link relationship',
|
|
13
|
+
isIconOnly: 'needs an icon, which has no core slot yet',
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/Divider.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core Divider contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* Divider documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const divider: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=Divider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Divider.d.ts","sourceRoot":"","sources":["../../src/components/Divider.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,OAAO,EAAE,eAIrB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/Heading.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core Heading contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* Heading documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const heading: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=Heading.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Heading.d.ts","sourceRoot":"","sources":["../../src/components/Heading.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,OAAO,EAAE,eAYrB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
export const heading = {
|
|
3
|
+
name: 'Heading',
|
|
4
|
+
baseTarget: 'root',
|
|
5
|
+
doc: { file: 'Text/Heading' },
|
|
6
|
+
slots: { children: 'text' },
|
|
7
|
+
sameMeaning: { children: "the component's content, as on the web" },
|
|
8
|
+
webOnly: {
|
|
9
|
+
display: 'CSS display; native layout places text by its container',
|
|
10
|
+
wordBreak: 'CSS line breaking; native text breaks by platform rules',
|
|
11
|
+
textWrap: 'CSS text wrapping; native text wraps by platform rules',
|
|
12
|
+
hasCapsize: 'web text-box trimming of CSS line height',
|
|
13
|
+
},
|
|
14
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/ProgressBar.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core ProgressBar contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* ProgressBar documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const progressBar: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=ProgressBar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProgressBar.d.ts","sourceRoot":"","sources":["../../src/components/ProgressBar.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,WAAW,EAAE,eAGzB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/Switch.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core Switch contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* Switch documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const switchControl: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=Switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../src/components/Switch.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,aAAa,EAAE,eAI3B,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/Text.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core Text contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* Text documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const text: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=Text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Text.d.ts","sourceRoot":"","sources":["../../src/components/Text.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,IAAI,EAAE,eAWlB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
export const text = {
|
|
3
|
+
name: 'Text',
|
|
4
|
+
baseTarget: 'root',
|
|
5
|
+
slots: { children: 'text' },
|
|
6
|
+
sameMeaning: { children: "the component's content, as on the web" },
|
|
7
|
+
webOnly: {
|
|
8
|
+
display: 'CSS display; native layout places text by its container',
|
|
9
|
+
wordBreak: 'CSS line breaking; native text breaks by platform rules',
|
|
10
|
+
textWrap: 'CSS text wrapping; native text wraps by platform rules',
|
|
11
|
+
hasCapsize: 'web text-box trimming of CSS line height',
|
|
12
|
+
},
|
|
13
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file components/TextInput.ts
|
|
3
|
+
* @input None
|
|
4
|
+
* @output What @astryxdesign/native adds to the core TextInput contract
|
|
5
|
+
* @position Native additions read by fromComponentDoc together with core's
|
|
6
|
+
* TextInput documentation
|
|
7
|
+
*/
|
|
8
|
+
import type { NativeAdditions } from '../contract/fromComponentDoc.js';
|
|
9
|
+
export declare const textInput: NativeAdditions;
|
|
10
|
+
//# sourceMappingURL=TextInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TextInput.d.ts","sourceRoot":"","sources":["../../src/components/TextInput.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAErE,eAAO,MAAM,SAAS,EAAE,eAOvB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
export const textInput = {
|
|
3
|
+
name: 'TextInput',
|
|
4
|
+
// family:input-fields routes base props to the primary semantic control.
|
|
5
|
+
baseTarget: 'control',
|
|
6
|
+
webOnly: {
|
|
7
|
+
autoComplete: 'HTML autocomplete attribute',
|
|
8
|
+
},
|
|
9
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,iCAAiC,CAAC;AAUrE,eAAO,MAAM,iBAAiB,EAAE,SAAS,eAAe,EASvD,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
1
|
// Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
2
|
+
import { button } from './Button.js';
|
|
3
|
+
import { divider } from './Divider.js';
|
|
4
|
+
import { heading } from './Heading.js';
|
|
5
|
+
import { progressBar } from './ProgressBar.js';
|
|
2
6
|
import { selector } from './Selector.js';
|
|
3
|
-
|
|
7
|
+
import { switchControl } from './Switch.js';
|
|
8
|
+
import { text } from './Text.js';
|
|
9
|
+
import { textInput } from './TextInput.js';
|
|
10
|
+
export const NATIVE_COMPONENTS = [
|
|
11
|
+
button,
|
|
12
|
+
divider,
|
|
13
|
+
heading,
|
|
14
|
+
progressBar,
|
|
15
|
+
selector,
|
|
16
|
+
switchControl,
|
|
17
|
+
text,
|
|
18
|
+
textInput,
|
|
19
|
+
];
|
|
@@ -1,19 +1,56 @@
|
|
|
1
1
|
import type { BaseTarget, ComponentContract, PropMap } from './types.js';
|
|
2
2
|
import type { NativePlatform } from '../platforms.js';
|
|
3
|
-
|
|
3
|
+
interface DocProp {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly type?: unknown;
|
|
6
|
+
readonly required?: boolean;
|
|
7
|
+
readonly description?: unknown;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* The subset of a ComponentDoc this reader needs. A file that documents
|
|
11
|
+
* several components, such as Stack with HStack and VStack, lists them in
|
|
12
|
+
* `components`.
|
|
13
|
+
*/
|
|
4
14
|
export interface ComponentDocLike {
|
|
5
15
|
readonly name: string;
|
|
6
|
-
readonly props?: ReadonlyArray<
|
|
16
|
+
readonly props?: ReadonlyArray<DocProp>;
|
|
17
|
+
readonly components?: ReadonlyArray<{
|
|
7
18
|
readonly name: string;
|
|
8
|
-
readonly
|
|
9
|
-
readonly required?: boolean;
|
|
10
|
-
readonly description?: unknown;
|
|
19
|
+
readonly props?: ReadonlyArray<DocProp>;
|
|
11
20
|
}>;
|
|
12
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* Typed slots (AST-082 FR4) for documented free-form content. `text` is a
|
|
24
|
+
* string in the core contract, as a badge's label or a heading's words.
|
|
25
|
+
*/
|
|
26
|
+
export type SlotKind = 'text';
|
|
13
27
|
/** What the native package adds to one core component. */
|
|
14
28
|
export interface NativeAdditions {
|
|
15
29
|
readonly name: string;
|
|
16
30
|
readonly baseTarget: BaseTarget;
|
|
31
|
+
/**
|
|
32
|
+
* Where core documents the component when it is not `<Name>/<Name>.doc.mjs`:
|
|
33
|
+
* `file` relative to core's `src` without `.doc.mjs`, and `component` when
|
|
34
|
+
* the file documents several components.
|
|
35
|
+
*/
|
|
36
|
+
readonly doc?: {
|
|
37
|
+
readonly file: string;
|
|
38
|
+
readonly component?: string;
|
|
39
|
+
};
|
|
40
|
+
/** Documented free-form content props, given a typed slot in the core. */
|
|
41
|
+
readonly slots?: Readonly<Record<string, SlotKind>>;
|
|
42
|
+
/**
|
|
43
|
+
* Callbacks whose only documented argument is a DOM event but which name a
|
|
44
|
+
* moment every platform has, such as a button's press. Their core form
|
|
45
|
+
* takes no arguments.
|
|
46
|
+
*/
|
|
47
|
+
readonly callbacks?: readonly string[];
|
|
48
|
+
/**
|
|
49
|
+
* Core props whose name a platform toolkit also uses, with the same meaning
|
|
50
|
+
* (AST-082 FR8 forbids only a different meaning), and why: a button's
|
|
51
|
+
* `onClick` is a press in Compose too.
|
|
52
|
+
*/
|
|
53
|
+
readonly sameMeaning?: Readonly<Record<string, string>>;
|
|
17
54
|
/**
|
|
18
55
|
* Portable definitions for named types the documentation references. Fields
|
|
19
56
|
* the web type has that are not portable are left out on purpose.
|
|
@@ -29,4 +66,5 @@ export interface NativeAdditions {
|
|
|
29
66
|
readonly webOnly?: Readonly<Record<string, string>>;
|
|
30
67
|
}
|
|
31
68
|
export declare function fromComponentDoc(doc: ComponentDocLike, additions: NativeAdditions): ComponentContract;
|
|
69
|
+
export {};
|
|
32
70
|
//# sourceMappingURL=fromComponentDoc.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fromComponentDoc.d.ts","sourceRoot":"","sources":["../../src/contract/fromComponentDoc.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,OAAO,
|
|
1
|
+
{"version":3,"file":"fromComponentDoc.d.ts","sourceRoot":"","sources":["../../src/contract/fromComponentDoc.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EACV,UAAU,EACV,iBAAiB,EACjB,OAAO,EAIR,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAEpD,UAAU,OAAO;IACf,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC;QAClC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAC;KACzC,CAAC,CAAC;CACJ;AAED;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B,0DAA0D;AAC1D,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC;;;;OAIG;IACH,QAAQ,CAAC,GAAG,CAAC,EAAE;QAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IACpE,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC;IACpD;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACvC;;;;OAIG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACnD,gFAAgF;IAChF,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,cAAc,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACxE;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CACrD;AAwBD,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,gBAAgB,EACrB,SAAS,EAAE,eAAe,GACzB,iBAAiB,CA8GnB"}
|
|
@@ -10,11 +10,32 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { parseDocType } from './parseDocType.js';
|
|
12
12
|
import { coreNameProblem } from './rules.js';
|
|
13
|
+
/** The documented props of the component the additions name. */
|
|
14
|
+
function documentedProps(doc, additions) {
|
|
15
|
+
const wanted = additions.doc?.component;
|
|
16
|
+
if (wanted == null) {
|
|
17
|
+
return doc.props ?? [];
|
|
18
|
+
}
|
|
19
|
+
const entry = doc.components?.find(component => component.name === wanted);
|
|
20
|
+
if (!entry) {
|
|
21
|
+
throw new Error(`${additions.name}: core documentation "${doc.name}" does not document "${wanted}"`);
|
|
22
|
+
}
|
|
23
|
+
return entry.props ?? [];
|
|
24
|
+
}
|
|
25
|
+
const SLOT_TYPES = {
|
|
26
|
+
text: { kind: 'string' },
|
|
27
|
+
};
|
|
13
28
|
export function fromComponentDoc(doc, additions) {
|
|
14
29
|
const core = {};
|
|
15
30
|
const webOnly = [];
|
|
16
31
|
const types = additions.types ?? {};
|
|
17
|
-
|
|
32
|
+
const describe = (prop) => typeof prop.description === 'string' ? { doc: prop.description } : {};
|
|
33
|
+
for (const prop of documentedProps(doc, additions)) {
|
|
34
|
+
// `id` and `isHidden` are shared base props on every platform (FR7), so a
|
|
35
|
+
// documented prop of either name is the base prop, not a core prop.
|
|
36
|
+
if (prop.name === 'id' || prop.name === 'isHidden') {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
18
39
|
const declaredWebOnly = additions.webOnly?.[prop.name];
|
|
19
40
|
if (declaredWebOnly) {
|
|
20
41
|
webOnly.push({ name: prop.name, reason: declaredWebOnly });
|
|
@@ -29,13 +50,33 @@ export function fromComponentDoc(doc, additions) {
|
|
|
29
50
|
webOnly.push({ name: prop.name, reason: 'HTML attribute' });
|
|
30
51
|
continue;
|
|
31
52
|
}
|
|
32
|
-
const
|
|
53
|
+
const slot = additions.slots?.[prop.name];
|
|
54
|
+
const slotNameProblem = slot &&
|
|
55
|
+
coreNameProblem(prop.name, prop.name in (additions.sameMeaning ?? {}));
|
|
56
|
+
if (slotNameProblem) {
|
|
57
|
+
webOnly.push({ name: prop.name, reason: slotNameProblem });
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
if (slot) {
|
|
61
|
+
core[prop.name] = {
|
|
62
|
+
type: SLOT_TYPES[slot],
|
|
63
|
+
optional: prop.required !== true,
|
|
64
|
+
...describe(prop),
|
|
65
|
+
};
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
let parsed = parseDocType(String(prop.type ?? ''));
|
|
69
|
+
if (!parsed.ok &&
|
|
70
|
+
parsed.eventOnly === true &&
|
|
71
|
+
additions.callbacks?.includes(prop.name)) {
|
|
72
|
+
parsed = { ok: true, type: { kind: 'fn', args: [] } };
|
|
73
|
+
}
|
|
33
74
|
if (!parsed.ok) {
|
|
34
75
|
webOnly.push({ name: prop.name, reason: parsed.reason });
|
|
35
76
|
continue;
|
|
36
77
|
}
|
|
37
78
|
// A portable type can still carry a name another platform owns.
|
|
38
|
-
const nameProblem = coreNameProblem(prop.name);
|
|
79
|
+
const nameProblem = coreNameProblem(prop.name, prop.name in (additions.sameMeaning ?? {}));
|
|
39
80
|
if (nameProblem) {
|
|
40
81
|
webOnly.push({ name: prop.name, reason: nameProblem });
|
|
41
82
|
continue;
|
|
@@ -67,7 +108,7 @@ export function fromComponentDoc(doc, additions) {
|
|
|
67
108
|
core[prop.name] = {
|
|
68
109
|
type,
|
|
69
110
|
optional: prop.required !== true,
|
|
70
|
-
...(
|
|
111
|
+
...describe(prop),
|
|
71
112
|
};
|
|
72
113
|
}
|
|
73
114
|
return {
|
|
@@ -77,5 +118,6 @@ export function fromComponentDoc(doc, additions) {
|
|
|
77
118
|
core,
|
|
78
119
|
platforms: additions.platforms ?? {},
|
|
79
120
|
webOnly,
|
|
121
|
+
sameMeaning: Object.keys(additions.sameMeaning ?? {}).filter(name => name in core),
|
|
80
122
|
};
|
|
81
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateSwift.d.ts","sourceRoot":"","sources":["../../src/contract/generateSwift.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,iBAAiB,EAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"generateSwift.d.ts","sourceRoot":"","sources":["../../src/contract/generateSwift.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EAAC,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AAoKrE,6EAA6E;AAC7E,wBAAgB,aAAa,CAC3B,SAAS,EAAE,SAAS,iBAAiB,EAAE,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAMxB"}
|
|
@@ -16,6 +16,10 @@ const APPLE_PLATFORMS = [
|
|
|
16
16
|
const camel = (text) => text.replace(/[-_ ]+([a-zA-Z0-9])/g, (_, ch) => ch.toUpperCase());
|
|
17
17
|
const pascal = (text) => camel(text).replace(/^./, ch => ch.toUpperCase());
|
|
18
18
|
const ident = (name) => SWIFT_KEYWORDS.has(name) ? `\`${name}\`` : name;
|
|
19
|
+
/** `1` → `v1`, `0.5` → `v0_5`, `-1` → `vMinus1`. */
|
|
20
|
+
function numberCaseName(value) {
|
|
21
|
+
return `v${String(value).replace('-', 'Minus').replace('.', '_')}`;
|
|
22
|
+
}
|
|
19
23
|
function caseName(value) {
|
|
20
24
|
const name = camel(value.replace(/[^A-Za-z0-9_-]/g, '-'));
|
|
21
25
|
return ident(/^[0-9]/.test(name) ? `v${name}` : name || 'empty');
|
|
@@ -37,6 +41,13 @@ class SwiftWriter {
|
|
|
37
41
|
this.decls.push(`public enum ${name}: String, CaseIterable, Sendable {\n${cases.join('\n')}\n}`);
|
|
38
42
|
return name;
|
|
39
43
|
}
|
|
44
|
+
case 'numberEnum': {
|
|
45
|
+
const name = `${owner}${pascal(prop)}`;
|
|
46
|
+
const raw = type.values.every(Number.isInteger) ? 'Int' : 'Double';
|
|
47
|
+
const cases = type.values.map(value => ` case ${numberCaseName(value)} = ${value}`);
|
|
48
|
+
this.decls.push(`public enum ${name}: ${raw}, CaseIterable, Sendable {\n${cases.join('\n')}\n}`);
|
|
49
|
+
return name;
|
|
50
|
+
}
|
|
40
51
|
case 'array':
|
|
41
52
|
return `[${this.type(owner, prop, type.of)}]`;
|
|
42
53
|
case 'record': {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateTypeScript.d.ts","sourceRoot":"","sources":["../../src/contract/generateTypeScript.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,iBAAiB,EAAoB,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"generateTypeScript.d.ts","sourceRoot":"","sources":["../../src/contract/generateTypeScript.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAC,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AA6FrE,0EAA0E;AAC1E,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,SAAS,iBAAiB,EAAE,GACtC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CASxB"}
|
|
@@ -16,6 +16,8 @@ function tsType(type) {
|
|
|
16
16
|
return type.kind;
|
|
17
17
|
case 'enum':
|
|
18
18
|
return type.values.map(value => `'${value}'`).join(' | ');
|
|
19
|
+
case 'numberEnum':
|
|
20
|
+
return type.values.join(' | ');
|
|
19
21
|
case 'array': {
|
|
20
22
|
const inner = tsType(type.of);
|
|
21
23
|
return `ReadonlyArray<${inner}>`;
|
package/dist/contract/index.d.ts
CHANGED
|
@@ -2,15 +2,19 @@ import { type ComponentDocLike } from './fromComponentDoc.js';
|
|
|
2
2
|
import { type ContractIssue } from './rules.js';
|
|
3
3
|
import type { ComponentContract } from './types.js';
|
|
4
4
|
export { fromComponentDoc } from './fromComponentDoc.js';
|
|
5
|
-
export type { ComponentDocLike, NativeAdditions } from './fromComponentDoc.js';
|
|
5
|
+
export type { ComponentDocLike, NativeAdditions, SlotKind, } from './fromComponentDoc.js';
|
|
6
6
|
export { generateSwift } from './generateSwift.js';
|
|
7
7
|
export { generateTypeScript } from './generateTypeScript.js';
|
|
8
8
|
export { parseDocType } from './parseDocType.js';
|
|
9
9
|
export { checkContract, coreNameProblem } from './rules.js';
|
|
10
10
|
export type { ContractIssue } from './rules.js';
|
|
11
11
|
export type * from './types.js';
|
|
12
|
-
/**
|
|
13
|
-
|
|
12
|
+
/**
|
|
13
|
+
* Loads one core documentation file: a component name for
|
|
14
|
+
* `<Name>/<Name>.doc.mjs`, or a path such as `Text/Heading` relative to core's
|
|
15
|
+
* `src` without `.doc.mjs`.
|
|
16
|
+
*/
|
|
17
|
+
export type ComponentDocLoader = (file: string) => Promise<ComponentDocLike>;
|
|
14
18
|
export interface BuiltContracts {
|
|
15
19
|
readonly contracts: readonly ComponentContract[];
|
|
16
20
|
readonly warnings: readonly ContractIssue[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAmB,KAAK,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAgB,KAAK,aAAa,EAAC,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAElD,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,YAAY,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAWA,OAAO,EAAmB,KAAK,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AAC9E,OAAO,EAAgB,KAAK,aAAa,EAAC,MAAM,YAAY,CAAC;AAC7D,OAAO,KAAK,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAElD,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,YAAY,EACV,gBAAgB,EAChB,eAAe,EACf,QAAQ,GACT,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAC,kBAAkB,EAAC,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,aAAa,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAC1D,YAAY,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAC9C,mBAAmB,YAAY,CAAC;AAEhC;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,gBAAgB,CAAC,CAAC;AAE7E,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,SAAS,EAAE,SAAS,iBAAiB,EAAE,CAAC;IACjD,QAAQ,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,CAAC;CAC7C;AAED,8EAA8E;AAC9E,wBAAsB,cAAc,CAClC,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,cAAc,CAAC,CAkBzB"}
|
package/dist/contract/index.js
CHANGED
|
@@ -20,7 +20,8 @@ export async function buildContracts(loadDoc) {
|
|
|
20
20
|
const warnings = [];
|
|
21
21
|
const errors = [];
|
|
22
22
|
for (const additions of NATIVE_COMPONENTS) {
|
|
23
|
-
const
|
|
23
|
+
const doc = await loadDoc(additions.doc?.file ?? additions.name);
|
|
24
|
+
const contract = fromComponentDoc(doc, additions);
|
|
24
25
|
for (const issue of checkContract(contract)) {
|
|
25
26
|
(issue.level === 'error' ? errors : warnings).push(issue);
|
|
26
27
|
}
|
|
@@ -11,11 +11,14 @@ export type ParsedType = {
|
|
|
11
11
|
} | {
|
|
12
12
|
readonly ok: false;
|
|
13
13
|
readonly reason: string;
|
|
14
|
+
/** True for a callback whose only arguments are DOM events. */
|
|
15
|
+
readonly eventOnly?: boolean;
|
|
14
16
|
};
|
|
15
17
|
/**
|
|
16
18
|
* Parses a documented type string. Supported portable forms: `string`,
|
|
17
|
-
* `number`, `boolean`, closed string unions, arrays, plain object
|
|
18
|
-
* callbacks with portable arguments
|
|
19
|
+
* `number`, `boolean`, closed string or number unions, arrays, plain object
|
|
20
|
+
* literals, callbacks with portable arguments (a trailing DOM event argument
|
|
21
|
+
* is the web's part), and named types. A union of different
|
|
19
22
|
* kinds has no Swift or Kotlin form.
|
|
20
23
|
*/
|
|
21
24
|
export declare function parseDocType(raw: string): ParsedType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseDocType.d.ts","sourceRoot":"","sources":["../../src/contract/parseDocType.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,UAAU,GAClB;IAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAC5C;
|
|
1
|
+
{"version":3,"file":"parseDocType.d.ts","sourceRoot":"","sources":["../../src/contract/parseDocType.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AAEH,OAAO,KAAK,EAAW,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEnD,MAAM,MAAM,UAAU,GAClB;IAAC,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAA;CAAC,GAC5C;IACE,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;IACnB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,+DAA+D;IAC/D,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AA8JN;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,CA8DpD"}
|
|
@@ -19,7 +19,15 @@ const WEB_ONLY_TYPES = {
|
|
|
19
19
|
ChangeEvent: 'DOM event',
|
|
20
20
|
DragEvent: 'DOM event',
|
|
21
21
|
ClipboardEvent: 'DOM event',
|
|
22
|
+
FormEvent: 'DOM event',
|
|
23
|
+
TouchEvent: 'DOM event',
|
|
24
|
+
SyntheticEvent: 'DOM event',
|
|
22
25
|
};
|
|
26
|
+
/** True for a DOM event type, with or without its element parameter. */
|
|
27
|
+
function isDomEvent(text) {
|
|
28
|
+
const name = /^(?:React\.)?([A-Z]\w*)(?:<[\s\S]*>)?$/.exec(text.trim())?.[1];
|
|
29
|
+
return name != null && WEB_ONLY_TYPES[name] === 'DOM event';
|
|
30
|
+
}
|
|
23
31
|
const ok = (type) => ({ ok: true, type });
|
|
24
32
|
const no = (reason) => ({ ok: false, reason });
|
|
25
33
|
/** Splits on a separator at bracket depth zero, ignoring quoted text. */
|
|
@@ -115,10 +123,24 @@ function parseFunction(text) {
|
|
|
115
123
|
: 'callback returns a value; only void callbacks are portable today');
|
|
116
124
|
}
|
|
117
125
|
const params = arrow[0].slice(1, -1).trim();
|
|
118
|
-
const
|
|
119
|
-
for (const param of params ? splitTop(params, ',') : []) {
|
|
126
|
+
const types = (params ? splitTop(params, ',') : []).map(param => {
|
|
120
127
|
const match = /^([A-Za-z_$][\w$]*)\??\s*:\s*([\s\S]+)$/.exec(param);
|
|
121
|
-
|
|
128
|
+
return match ? match[2] : param;
|
|
129
|
+
});
|
|
130
|
+
// A value callback ends with the DOM event that caused it, as in
|
|
131
|
+
// `(checked: boolean, e: ChangeEvent) => void`. The values are the portable
|
|
132
|
+
// callback; the trailing event is the web's part. A callback that carries
|
|
133
|
+
// only an event stays on the web.
|
|
134
|
+
let end = types.length;
|
|
135
|
+
while (end > 0 && isDomEvent(types[end - 1])) {
|
|
136
|
+
end--;
|
|
137
|
+
}
|
|
138
|
+
if (end === 0 && types.length > 0) {
|
|
139
|
+
return { ok: false, reason: 'callback argument: DOM event', eventOnly: true };
|
|
140
|
+
}
|
|
141
|
+
const args = [];
|
|
142
|
+
for (const type of types.slice(0, end)) {
|
|
143
|
+
const parsed = parseDocType(type);
|
|
122
144
|
if (!parsed.ok) {
|
|
123
145
|
return no(`callback argument: ${parsed.reason}`);
|
|
124
146
|
}
|
|
@@ -128,8 +150,9 @@ function parseFunction(text) {
|
|
|
128
150
|
}
|
|
129
151
|
/**
|
|
130
152
|
* Parses a documented type string. Supported portable forms: `string`,
|
|
131
|
-
* `number`, `boolean`, closed string unions, arrays, plain object
|
|
132
|
-
* callbacks with portable arguments
|
|
153
|
+
* `number`, `boolean`, closed string or number unions, arrays, plain object
|
|
154
|
+
* literals, callbacks with portable arguments (a trailing DOM event argument
|
|
155
|
+
* is the web's part), and named types. A union of different
|
|
133
156
|
* kinds has no Swift or Kotlin form.
|
|
134
157
|
*/
|
|
135
158
|
export function parseDocType(raw) {
|
|
@@ -146,6 +169,9 @@ export function parseDocType(raw) {
|
|
|
146
169
|
if (members.every(m => /^'[^']*'$/.test(m))) {
|
|
147
170
|
return ok({ kind: 'enum', values: members.map(m => m.slice(1, -1)) });
|
|
148
171
|
}
|
|
172
|
+
if (members.every(m => /^-?\d+(?:\.\d+)?$/.test(m))) {
|
|
173
|
+
return ok({ kind: 'numberEnum', values: members.map(Number) });
|
|
174
|
+
}
|
|
149
175
|
const webOnly = members.find(m => WEB_ONLY_TYPES[m] != null);
|
|
150
176
|
if (webOnly) {
|
|
151
177
|
return no(WEB_ONLY_TYPES[webOnly]);
|
|
@@ -162,6 +188,9 @@ export function parseDocType(raw) {
|
|
|
162
188
|
if (WEB_ONLY_TYPES[t] != null) {
|
|
163
189
|
return no(WEB_ONLY_TYPES[t]);
|
|
164
190
|
}
|
|
191
|
+
if (isDomEvent(t)) {
|
|
192
|
+
return no('DOM event');
|
|
193
|
+
}
|
|
165
194
|
const generic = /^(?:Readonly)?Array<([\s\S]+)>$/.exec(t);
|
|
166
195
|
if (t.endsWith('[]') || generic) {
|
|
167
196
|
const inner = parseDocType(generic ? generic[1] : t.slice(0, -2));
|
package/dist/contract/rules.d.ts
CHANGED
|
@@ -4,7 +4,10 @@ export interface ContractIssue {
|
|
|
4
4
|
readonly rule: 'core-is-portable' | 'name-keyword' | 'name-toolkit' | 'platform-shadows-core' | 'same-name-different-meaning' | 'unknown-type';
|
|
5
5
|
readonly message: string;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Why a core prop name is not allowed, or null when it is. A toolkit name is
|
|
9
|
+
* allowed when the component declares it has the same meaning there.
|
|
10
|
+
*/
|
|
11
|
+
export declare function coreNameProblem(name: string, sameMeaning?: boolean): string | null;
|
|
9
12
|
export declare function checkContract(contract: ComponentContract): ContractIssue[];
|
|
10
13
|
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/contract/rules.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAC,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,IAAI,EACT,kBAAkB,GAClB,cAAc,GACd,cAAc,GACd,uBAAuB,GACvB,6BAA6B,GAC7B,cAAc,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../src/contract/rules.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAC,iBAAiB,EAAoB,MAAM,YAAY,CAAC;AAErE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,IAAI,EACT,kBAAkB,GAClB,cAAc,GACd,cAAc,GACd,uBAAuB,GACvB,6BAA6B,GAC7B,cAAc,CAAC;IACnB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,WAAW,UAAQ,GAClB,MAAM,GAAG,IAAI,CAgBf;AAeD,wBAAgB,aAAa,CAAC,QAAQ,EAAE,iBAAiB,GAAG,aAAa,EAAE,CAqE1E"}
|