@tellaro/tql 2.0.0 → 3.0.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.
@@ -1,2 +1,93 @@
1
- declare const _default: any;
1
+ import { TqlCompletionItem, TqlInputProps, TqlParseResult, TqlSnippet, TqlToken, TqlValidationResult } from '../src/types';
2
+ declare const _default: import('vue').DefineComponent<TqlInputProps, {
3
+ focus(): void;
4
+ blur(): void;
5
+ validate(): TqlValidationResult;
6
+ insertText(text: string): void;
7
+ insertSnippet(snippet: TqlSnippet): void;
8
+ getTokenAtPosition(pos: number): TqlToken | null;
9
+ getCursorPosition(): number;
10
+ setCursorPosition(pos: number): void;
11
+ isValid: boolean;
12
+ hasErrors: boolean;
13
+ errors: import('../src').TqlParseError[];
14
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
15
+ "update:modelValue": (value: string) => any;
16
+ validation: (result: TqlValidationResult) => any;
17
+ parse: (result: TqlParseResult) => any;
18
+ submit: (value: string) => any;
19
+ }, string, import('vue').PublicProps, Readonly<TqlInputProps> & Readonly<{
20
+ "onUpdate:modelValue"?: ((value: string) => any) | undefined;
21
+ onValidation?: ((result: TqlValidationResult) => any) | undefined;
22
+ onParse?: ((result: TqlParseResult) => any) | undefined;
23
+ onSubmit?: ((value: string) => any) | undefined;
24
+ }>, {
25
+ disabled: boolean;
26
+ placeholder: string;
27
+ showComplexity: boolean;
28
+ validateOnInput: boolean;
29
+ debounceMs: number;
30
+ autocomplete: boolean;
31
+ readonly: boolean;
32
+ rows: number;
33
+ multiline: boolean;
34
+ showValidation: boolean;
35
+ showSnippetButton: boolean;
36
+ syntaxHighlighting: boolean;
37
+ alwaysShowErrors: boolean;
38
+ resizable: boolean;
39
+ minHeight: string;
40
+ showHistory: boolean;
41
+ showPreview: boolean;
42
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {
43
+ wrapperRef: HTMLDivElement;
44
+ highlightRef: HTMLDivElement;
45
+ inputRef: HTMLInputElement;
46
+ autocompleteRef: import('vue').CreateComponentPublicInstanceWithMixins<Readonly<{
47
+ id?: string;
48
+ items: TqlCompletionItem[];
49
+ visible: boolean;
50
+ position: {
51
+ top: number;
52
+ left: number;
53
+ };
54
+ maxHeight?: number;
55
+ }> & Readonly<{
56
+ onSelect?: ((item: TqlCompletionItem) => any) | undefined;
57
+ onClose?: (() => any) | undefined;
58
+ }>, {
59
+ selectCurrent: () => void;
60
+ moveUp: () => void;
61
+ moveDown: () => void;
62
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
63
+ select: (item: TqlCompletionItem) => any;
64
+ close: () => any;
65
+ }, import('vue').PublicProps, {}, false, {}, {}, import('vue').GlobalComponents, import('vue').GlobalDirectives, string, {
66
+ listRef: HTMLDivElement;
67
+ }, any, import('vue').ComponentProvideOptions, {
68
+ P: {};
69
+ B: {};
70
+ D: {};
71
+ C: {};
72
+ M: {};
73
+ Defaults: {};
74
+ }, Readonly<{
75
+ id?: string;
76
+ items: TqlCompletionItem[];
77
+ visible: boolean;
78
+ position: {
79
+ top: number;
80
+ left: number;
81
+ };
82
+ maxHeight?: number;
83
+ }> & Readonly<{
84
+ onSelect?: ((item: TqlCompletionItem) => any) | undefined;
85
+ onClose?: (() => any) | undefined;
86
+ }>, {
87
+ selectCurrent: () => void;
88
+ moveUp: () => void;
89
+ moveDown: () => void;
90
+ }, {}, {}, {}, {}> | null;
91
+ validationMessagesRef: HTMLDivElement;
92
+ }, HTMLDivElement>;
2
93
  export default _default;
@@ -2,7 +2,7 @@ import o from "./TqlInput.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import t from "../_virtual/_plugin-vue_export-helper.js";
5
- const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-7ce615f9"]]);
5
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d513cd4d"]]);
6
6
  export {
7
7
  _ as default
8
8
  };
@@ -358,10 +358,17 @@ const ht = ["placeholder", "disabled", "readonly", "rows", "aria-expanded", "ari
358
358
  getTokenAtPosition: Ae,
359
359
  getCursorPosition: Se,
360
360
  setCursorPosition: Ce,
361
- // Reactive state for form validation
362
- isValid: G,
363
- hasErrors: D,
364
- errors: R
361
+ // Reactive state for form validation. Getters, so the exposed value is live
362
+ // and matches TqlInputExpose; Vue would unwrap a ref here anyway.
363
+ get isValid() {
364
+ return G.value;
365
+ },
366
+ get hasErrors() {
367
+ return D.value;
368
+ },
369
+ get errors() {
370
+ return R.value;
371
+ }
365
372
  });
366
373
  function ee() {
367
374
  (x.value || D.value) && k.value && Y();
@@ -1,4 +1,91 @@
1
- declare const TqlPreviewNode: any;
1
+ import { FieldUsage, LogicTreeNode } from '../../src/types';
2
+ import { PropType } from 'vue';
3
+ export interface Props {
4
+ /** The TQL query to preview */
5
+ query: string;
6
+ /** Whether to show the logic tree (default: true) */
7
+ showLogicTree?: boolean;
8
+ /** Whether to show field usage list (default: true) */
9
+ showFieldUsage?: boolean;
10
+ /** Whether to show complexity warnings (default: true) */
11
+ showComplexity?: boolean;
12
+ /** Whether to show operator summary (default: false) */
13
+ showOperatorSummary?: boolean;
14
+ /** Maximum depth to expand in logic tree (default: 3) */
15
+ maxExpandedDepth?: number;
16
+ /** Compact mode for smaller display (default: false) */
17
+ compact?: boolean;
18
+ }
19
+ declare const TqlPreviewNode: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
20
+ node: {
21
+ type: PropType<LogicTreeNode>;
22
+ required: true;
23
+ };
24
+ depth: {
25
+ type: NumberConstructor;
26
+ default: number;
27
+ };
28
+ nodeKey: {
29
+ type: StringConstructor;
30
+ required: true;
31
+ };
32
+ isExpanded: {
33
+ type: BooleanConstructor;
34
+ default: boolean;
35
+ };
36
+ autoExpandDepth: {
37
+ type: NumberConstructor;
38
+ default: number;
39
+ };
40
+ }>, {
41
+ hasChildren: import('vue').ComputedRef<boolean | undefined>;
42
+ nodeLabel: import('vue').ComputedRef<string>;
43
+ handleToggle: () => void;
44
+ handleClick: () => void;
45
+ getChildKey: (index: number) => string;
46
+ shouldChildExpand: (_childIndex: number) => boolean;
47
+ }, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("toggle" | "node-click")[], "toggle" | "node-click", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
48
+ node: {
49
+ type: PropType<LogicTreeNode>;
50
+ required: true;
51
+ };
52
+ depth: {
53
+ type: NumberConstructor;
54
+ default: number;
55
+ };
56
+ nodeKey: {
57
+ type: StringConstructor;
58
+ required: true;
59
+ };
60
+ isExpanded: {
61
+ type: BooleanConstructor;
62
+ default: boolean;
63
+ };
64
+ autoExpandDepth: {
65
+ type: NumberConstructor;
66
+ default: number;
67
+ };
68
+ }>> & Readonly<{
69
+ onToggle?: ((...args: any[]) => any) | undefined;
70
+ "onNode-click"?: ((...args: any[]) => any) | undefined;
71
+ }>, {
72
+ depth: number;
73
+ isExpanded: boolean;
74
+ autoExpandDepth: number;
75
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
2
76
  export { TqlPreviewNode };
3
- declare const _default: any;
77
+ declare const _default: import('vue').DefineComponent<Props, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {} & {
78
+ "node-click": (node: LogicTreeNode) => any;
79
+ "field-click": (field: FieldUsage) => any;
80
+ }, string, import('vue').PublicProps, Readonly<Props> & Readonly<{
81
+ "onNode-click"?: ((node: LogicTreeNode) => any) | undefined;
82
+ "onField-click"?: ((field: FieldUsage) => any) | undefined;
83
+ }>, {
84
+ showLogicTree: boolean;
85
+ showFieldUsage: boolean;
86
+ showComplexity: boolean;
87
+ showOperatorSummary: boolean;
88
+ maxExpandedDepth: number;
89
+ compact: boolean;
90
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
4
91
  export default _default;
@@ -1,9 +1,9 @@
1
1
  import o from "./TqlPreview.vue2.js";
2
- import { TqlPreviewNode as i } from "./TqlPreview.vue2.js";
2
+ import { TqlPreviewNode as _ } from "./TqlPreview.vue2.js";
3
3
  /* empty css */
4
4
  import r from "../../_virtual/_plugin-vue_export-helper.js";
5
- const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-3521fa37"]]);
5
+ const p = /* @__PURE__ */ r(o, [["__scopeId", "data-v-53107944"]]);
6
6
  export {
7
- i as TqlPreviewNode,
8
- m as default
7
+ _ as TqlPreviewNode,
8
+ p as default
9
9
  };
@@ -9,5 +9,5 @@ export { default as TqlInput } from './TqlInput.vue';
9
9
  export { default as TqlAutocomplete } from './TqlAutocomplete.vue';
10
10
  export { default as TqlPreview } from './components/TqlPreview.vue';
11
11
  export { default as TqlChart } from './TqlChart.vue';
12
- export { useTqlInput, type UseTqlInputOptions } from './useTqlInput';
12
+ export { useTqlInput, type UseTqlInputOptions, type UseTqlInputReturn } from './useTqlInput';
13
13
  export { useQueryHistory, type UseQueryHistoryReturn, type QueryHistoryEntry, type UseQueryHistoryOptions } from './composables/useQueryHistory';
@@ -1,5 +1,5 @@
1
- import { Ref } from 'vue';
2
- import { TqlCompletionItem, TqlFieldSchema, TqlParseResult, TqlSnippet, TqlToken, TqlValidationResult } from '../src/types';
1
+ import { ComputedRef, Ref } from 'vue';
2
+ import { TqlCompletionItem, TqlFieldSchema, TqlParseError, TqlParseResult, TqlParseWarning, TqlSnippet, TqlToken, TqlValidationResult } from '../src/types';
3
3
  export interface UseTqlInputOptions {
4
4
  modelValue: Ref<string>;
5
5
  fieldSchema?: Ref<TqlFieldSchema[] | undefined>;
@@ -21,34 +21,43 @@ export interface PlaceholderPosition {
21
21
  start: number;
22
22
  end: number;
23
23
  }
24
- export declare function useTqlInput(options: UseTqlInputOptions): {
25
- tokens: any;
26
- parseResult: any;
27
- validationResult: any;
28
- cursorPosition: any;
29
- completionItems: any;
30
- showAutocomplete: any;
31
- isValidating: any;
32
- isValid: any;
33
- errors: any;
34
- warnings: any;
35
- hasErrors: any;
36
- hasWarnings: any;
37
- tokenize: () => any;
38
- parse: () => TqlParseResult;
39
- validate: () => TqlValidationResult;
40
- updateCompletions: () => void;
41
- triggerAutocomplete: () => void;
42
- hideAutocomplete: () => void;
43
- handleInput: (value: string) => void;
44
- handleCursorChange: (position: number) => void;
45
- insertCompletion: (item: TqlCompletionItem) => {
24
+ /**
25
+ * What `useTqlInput` returns.
26
+ *
27
+ * Spelled out rather than inferred: with `declaration: true` the inferred type
28
+ * of the returned object (every `Ref<UnwrapRef<...>>` expanded) exceeds what the
29
+ * compiler will serialize (TS7056), so vue-tsc refused to type-check the package
30
+ * and no declaration for this composable could be emitted.
31
+ */
32
+ export interface UseTqlInputReturn {
33
+ tokens: Ref<TqlToken[]>;
34
+ parseResult: Ref<TqlParseResult | null>;
35
+ validationResult: Ref<TqlValidationResult | null>;
36
+ cursorPosition: Ref<number>;
37
+ completionItems: Ref<TqlCompletionItem[]>;
38
+ showAutocomplete: Ref<boolean>;
39
+ isValidating: Ref<boolean>;
40
+ isValid: ComputedRef<boolean>;
41
+ errors: ComputedRef<TqlParseError[]>;
42
+ warnings: ComputedRef<TqlParseWarning[]>;
43
+ hasErrors: ComputedRef<boolean>;
44
+ hasWarnings: ComputedRef<boolean>;
45
+ tokenize(): TqlToken[];
46
+ parse(): TqlParseResult;
47
+ validate(): TqlValidationResult;
48
+ updateCompletions(): void;
49
+ triggerAutocomplete(): void;
50
+ hideAutocomplete(): void;
51
+ handleInput(value: string): void;
52
+ handleCursorChange(position: number): void;
53
+ insertCompletion(item: TqlCompletionItem): {
46
54
  query: string;
47
55
  newCursorPosition: number;
48
56
  placeholders: PlaceholderPosition[];
49
57
  };
50
- insertSnippet: (snippet: TqlSnippet) => string;
51
- getTokenAtCursor: () => TqlToken | null;
52
- isPositionInError: (position: number) => boolean;
53
- getErrorsAtPosition: (position: number) => any;
54
- };
58
+ insertSnippet(snippet: TqlSnippet): string;
59
+ getTokenAtCursor(): TqlToken | null;
60
+ isPositionInError(position: number): boolean;
61
+ getErrorsAtPosition(position: number): TqlParseError[];
62
+ }
63
+ export declare function useTqlInput(options: UseTqlInputOptions): UseTqlInputReturn;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tellaro/tql",
3
- "version": "2.0.0",
3
+ "version": "3.0.0",
4
4
  "description": "Tellaro Query Language (TQL) parser, validator, and autocomplete for JavaScript/TypeScript",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -36,7 +36,6 @@
36
36
  "test:e2e:ui": "playwright test --ui",
37
37
  "playground:serve": "vite --config vite.playground.config.ts --port 5174",
38
38
  "playground:dev": "vite --config vite.playground.config.ts",
39
- "lint": "eslint src vue tests --ext .ts,.vue",
40
39
  "typecheck": "vue-tsc --noEmit",
41
40
  "prepublishOnly": "npm run build"
42
41
  },
@@ -102,14 +101,13 @@
102
101
  "chartjs-adapter-luxon": "^1.3.1",
103
102
  "chartjs-plugin-annotation": "^3.1.0",
104
103
  "chartjs-plugin-datalabels": "^2.2.0",
105
- "eslint": "^8.56.0",
106
- "js-yaml": "^4.1.0",
104
+ "js-yaml": "^4.3.2",
107
105
  "jsdom": "^24.0.0",
108
106
  "luxon": "^3.7.2",
109
107
  "typescript": "^5.3.0",
110
108
  "vite": "^7.3.2",
111
109
  "vite-plugin-dts": "^4.5.4",
112
- "vitest": "^4.0.18",
110
+ "vitest": "^4.1.11",
113
111
  "vue": "^3.4.0",
114
112
  "vue-tsc": "^3.2.4"
115
113
  },