@actualwave/codemirror-lang-react-native 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ import type { CompletionSource } from "@codemirror/autocomplete";
2
+ import { type ModuleRegistry } from "./data";
3
+ export interface ReactNativeCompletionConfig {
4
+ modules?: ModuleRegistry;
5
+ styleFactories?: string[];
6
+ }
7
+ /**
8
+ * Builds the React/React Native contextual CompletionSource: import-scoped
9
+ * hook/component/prop suggestions, JSX tag-name and attribute-name
10
+ * completion, RN style dictionary property/value completion (inside
11
+ * `style={{ }}` or `StyleSheet.create({ ... })`), and import statement
12
+ * completion (module specifiers, then that module's exports).
13
+ *
14
+ * Nothing from `modules` is ever suggested as a hook/component/prop unless
15
+ * its local name is actually present in the current document's own import
16
+ * statements — this is the scoping rule the completion source is built
17
+ * around, not an incidental detail.
18
+ */
19
+ export declare function reactNativeCompletionSource(config?: ReactNativeCompletionConfig): CompletionSource;
20
+ //# sourceMappingURL=completion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/completion.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAsC,gBAAgB,EAAC,MAAM,0BAA0B,CAAA;AACnG,OAAO,EAAoC,KAAK,cAAc,EAAC,MAAM,QAAQ,CAAA;AAI7E,MAAM,WAAW,2BAA2B;IAI1C,OAAO,CAAC,EAAE,cAAc,CAAA;IAMxB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;CAC1B;AA+ED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,CAAC,EAAE,2BAA2B,GAAG,gBAAgB,CA2ElG"}
@@ -0,0 +1,11 @@
1
+ export type EntryType = "function" | "type" | "variable";
2
+ export interface ModuleExportEntry {
3
+ type: EntryType;
4
+ detail?: string;
5
+ props?: string[];
6
+ }
7
+ export type ModuleExports = Record<string, ModuleExportEntry>;
8
+ export type ModuleRegistry = Record<string, ModuleExports>;
9
+ export declare const BUILTIN_MODULES: ModuleRegistry;
10
+ export declare const STYLE_PROPERTIES: Record<string, string[] | undefined>;
11
+ //# sourceMappingURL=data.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAYA,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,UAAU,CAAA;AAExD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,SAAS,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,EAAE,CAAA;CACjB;AAED,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAA;AAC7D,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;AAgI1D,eAAO,MAAM,eAAe,EAAE,cAG7B,CAAA;AAQD,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,SAAS,CAuGjE,CAAA"}
@@ -0,0 +1,11 @@
1
+ import type { EditorState } from "@codemirror/state";
2
+ import type { SyntaxNode } from "@lezer/common";
3
+ export interface ImportInfo {
4
+ source: string;
5
+ imported: string;
6
+ }
7
+ export declare function collectImports(state: EditorState): Map<string, ImportInfo>;
8
+ export declare function findImportDeclaration(node: SyntaxNode | null): SyntaxNode | null;
9
+ export declare function getImportSource(state: EditorState, importDecl: SyntaxNode): string | null;
10
+ export declare function getImportGroupNames(state: EditorState, importDecl: SyntaxNode): Set<string>;
11
+ //# sourceMappingURL=imports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"imports.d.ts","sourceRoot":"","sources":["../../src/imports.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AAE7C,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAA;IAGd,QAAQ,EAAE,MAAM,CAAA;CACjB;AAMD,wBAAgB,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAmD1E;AAMD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,GAAG,UAAU,GAAG,IAAI,CAKhF;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAKzF;AAKD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAW3F"}
@@ -0,0 +1,9 @@
1
+ export { reactNativeCompletionSource } from "./completion";
2
+ export type { ReactNativeCompletionConfig } from "./completion";
3
+ export { BUILTIN_MODULES, STYLE_PROPERTIES } from "./data";
4
+ export type { EntryType, ModuleExportEntry, ModuleExports, ModuleRegistry } from "./data";
5
+ export { collectImports, findImportDeclaration, getImportSource, getImportGroupNames } from "./imports";
6
+ export type { ImportInfo } from "./imports";
7
+ export { classifyJsxContext, getTagName, findStyleObjectContext, classifyStylePosition, getExistingStyleKeys } from "./jsx";
8
+ export type { JsxContext, StylePropertyPosition } from "./jsx";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,2BAA2B,EAAC,MAAM,cAAc,CAAA;AACxD,YAAY,EAAC,2BAA2B,EAAC,MAAM,cAAc,CAAA;AAE7D,OAAO,EAAC,eAAe,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAA;AACxD,YAAY,EAAC,SAAS,EAAE,iBAAiB,EAAE,aAAa,EAAE,cAAc,EAAC,MAAM,QAAQ,CAAA;AAEvF,OAAO,EAAC,cAAc,EAAE,qBAAqB,EAAE,eAAe,EAAE,mBAAmB,EAAC,MAAM,WAAW,CAAA;AACrG,YAAY,EAAC,UAAU,EAAC,MAAM,WAAW,CAAA;AAEzC,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,oBAAoB,EAAC,MAAM,OAAO,CAAA;AACzH,YAAY,EAAC,UAAU,EAAE,qBAAqB,EAAC,MAAM,OAAO,CAAA"}
package/types/jsx.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ import type { EditorState } from "@codemirror/state";
2
+ import type { SyntaxNode } from "@lezer/common";
3
+ export type JsxContext = {
4
+ kind: "tag-name";
5
+ openTag: SyntaxNode;
6
+ } | {
7
+ kind: "attribute-name";
8
+ openTag: SyntaxNode;
9
+ };
10
+ export declare function classifyJsxContext(state: EditorState, pos: number): JsxContext | null;
11
+ export declare function getTagName(state: EditorState, openTag: SyntaxNode): string | null;
12
+ export interface StylePropertyPosition {
13
+ kind: "name" | "value";
14
+ objectExpression: SyntaxNode;
15
+ property?: SyntaxNode;
16
+ propertyName?: string;
17
+ }
18
+ export declare function findStyleObjectContext(state: EditorState, pos: number, styleFactories?: string[]): SyntaxNode | null;
19
+ export declare function classifyStylePosition(state: EditorState, pos: number, objectExpression: SyntaxNode): StylePropertyPosition;
20
+ export declare function getExistingStyleKeys(state: EditorState, objectExpression: SyntaxNode): Set<string>;
21
+ //# sourceMappingURL=jsx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"jsx.d.ts","sourceRoot":"","sources":["../../src/jsx.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAA;AAClD,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,eAAe,CAAA;AAE7C,MAAM,MAAM,UAAU,GAClB;IAAC,IAAI,EAAE,UAAU,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAC,GACvC;IAAC,IAAI,EAAE,gBAAgB,CAAC;IAAC,OAAO,EAAE,UAAU,CAAA;CAAC,CAAA;AAMjD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CA6BrF;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,IAAI,CAIjF;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAA;IAGtB,gBAAgB,EAAE,UAAU,CAAA;IAG5B,QAAQ,CAAC,EAAE,UAAU,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAiBD,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,EAClB,GAAG,EAAE,MAAM,EACX,cAAc,GAAE,MAAM,EAA4B,GACjD,UAAU,GAAG,IAAI,CAqCnB;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,UAAU,GAAG,qBAAqB,CAY1H;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,UAAU,GAAG,GAAG,CAAC,MAAM,CAAC,CAOlG"}