@malloydata/malloy-explorer 0.0.257-dev250410160631

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 (158) hide show
  1. package/.editorconfig +8 -0
  2. package/.github/workflows/prerelease.yaml +28 -0
  3. package/.github/workflows/test.yaml +26 -0
  4. package/.node-version +1 -0
  5. package/.prettierrc.js +8 -0
  6. package/.vscode/extensions.json +6 -0
  7. package/@flowtypes/components/MalloyExplorerProvider.flow.js +13 -0
  8. package/@flowtypes/components/QueryPanel/QueryActionBar.flow.js +10 -0
  9. package/@flowtypes/components/QueryPanel/QueryEditor.flow.js +9 -0
  10. package/@flowtypes/components/ResultPanel/ResultPanel.flow.js +14 -0
  11. package/@flowtypes/components/ResultPanel/SubmittedQuery.flow.js +32 -0
  12. package/@flowtypes/components/SourcePanel/SourcePanel.flow.js +9 -0
  13. package/@flowtypes/contexts/ExplorerPanelsContext.flow.js +6 -0
  14. package/@flowtypes/index.flow.js +18 -0
  15. package/CONTRIBUTING.md +44 -0
  16. package/LICENSE +9 -0
  17. package/README.md +23 -0
  18. package/babel.config.mjs +35 -0
  19. package/dist/cjs/index.cjs +30740 -0
  20. package/dist/cjs/index.cjs.map +1 -0
  21. package/dist/esm/index.js +30723 -0
  22. package/dist/esm/index.js.map +1 -0
  23. package/dist/malloy-explorer.css +422 -0
  24. package/dist/types/components/ErrorElement.d.ts +18 -0
  25. package/dist/types/components/FieldHoverCard.d.ts +13 -0
  26. package/dist/types/components/FieldToken.d.ts +19 -0
  27. package/dist/types/components/Label.d.ts +5 -0
  28. package/dist/types/components/MalloyExplorerProvider.d.ts +11 -0
  29. package/dist/types/components/QueryPanel/AddMenu/AddAggregate.d.ts +6 -0
  30. package/dist/types/components/QueryPanel/AddMenu/AddEmptyNest.d.ts +6 -0
  31. package/dist/types/components/QueryPanel/AddMenu/AddFieldItem.d.ts +15 -0
  32. package/dist/types/components/QueryPanel/AddMenu/AddGroupBy.d.ts +6 -0
  33. package/dist/types/components/QueryPanel/AddMenu/AddItem.d.ts +9 -0
  34. package/dist/types/components/QueryPanel/AddMenu/AddLimit.d.ts +6 -0
  35. package/dist/types/components/QueryPanel/AddMenu/AddMenu.d.ts +6 -0
  36. package/dist/types/components/QueryPanel/AddMenu/AddOrderBy.d.ts +6 -0
  37. package/dist/types/components/QueryPanel/AddMenu/AddView.d.ts +7 -0
  38. package/dist/types/components/QueryPanel/AddMenu/AddWhere.d.ts +6 -0
  39. package/dist/types/components/QueryPanel/AddMenu/FieldList.d.ts +11 -0
  40. package/dist/types/components/QueryPanel/AddMenu/FieldMenu.d.ts +10 -0
  41. package/dist/types/components/QueryPanel/AddMenu/ValueList.d.ts +10 -0
  42. package/dist/types/components/QueryPanel/AddMenu/colors.stylex.d.ts +7 -0
  43. package/dist/types/components/QueryPanel/AddMenu/hooks/useSearch.d.ts +10 -0
  44. package/dist/types/components/QueryPanel/AddMenu/styles.d.ts +34 -0
  45. package/dist/types/components/QueryPanel/FieldHover.d.ts +10 -0
  46. package/dist/types/components/QueryPanel/LiteralValueEditor.d.ts +9 -0
  47. package/dist/types/components/QueryPanel/Operations.d.ts +6 -0
  48. package/dist/types/components/QueryPanel/Parameters.d.ts +8 -0
  49. package/dist/types/components/QueryPanel/Query.d.ts +8 -0
  50. package/dist/types/components/QueryPanel/QueryActionBar.d.ts +11 -0
  51. package/dist/types/components/QueryPanel/QueryEditor.d.ts +15 -0
  52. package/dist/types/components/QueryPanel/QueryPanel.d.ts +10 -0
  53. package/dist/types/components/QueryPanel/Source.d.ts +8 -0
  54. package/dist/types/components/QueryPanel/View.d.ts +6 -0
  55. package/dist/types/components/QueryPanel/ViewDefinition.d.ts +6 -0
  56. package/dist/types/components/QueryPanel/Visualization.d.ts +7 -0
  57. package/dist/types/components/QueryPanel/VisualizationIcon.d.ts +5 -0
  58. package/dist/types/components/QueryPanel/index.d.ts +3 -0
  59. package/dist/types/components/QueryPanel/operations/AggregateOperations.d.ts +7 -0
  60. package/dist/types/components/QueryPanel/operations/ClearButton.d.ts +4 -0
  61. package/dist/types/components/QueryPanel/operations/GroupByOperations.d.ts +7 -0
  62. package/dist/types/components/QueryPanel/operations/LimitOperation.d.ts +7 -0
  63. package/dist/types/components/QueryPanel/operations/NestOperation.d.ts +7 -0
  64. package/dist/types/components/QueryPanel/operations/OperationActionTitle.d.ts +12 -0
  65. package/dist/types/components/QueryPanel/operations/OrderByOperations.d.ts +7 -0
  66. package/dist/types/components/QueryPanel/operations/WhereOperations.d.ts +7 -0
  67. package/dist/types/components/QueryPanel/operations/hover.stylex.d.ts +17 -0
  68. package/dist/types/components/ResultPanel/BookmarkedView.d.ts +7 -0
  69. package/dist/types/components/ResultPanel/EmptyQueryDisplay.d.ts +6 -0
  70. package/dist/types/components/ResultPanel/ResultDisplay.d.ts +6 -0
  71. package/dist/types/components/ResultPanel/ResultPanel.d.ts +14 -0
  72. package/dist/types/components/ResultPanel/SubmittedQuery.d.ts +28 -0
  73. package/dist/types/components/ResultPanel/ViewAttributeTable.d.ts +9 -0
  74. package/dist/types/components/ResultPanel/Visualization.d.ts +5 -0
  75. package/dist/types/components/ResultPanel/index.d.ts +1 -0
  76. package/dist/types/components/SourcePanel/AddFieldDropdownMenu.d.ts +13 -0
  77. package/dist/types/components/SourcePanel/FieldGroupList.d.ts +10 -0
  78. package/dist/types/components/SourcePanel/FieldTokenWithActions.d.ts +7 -0
  79. package/dist/types/components/SourcePanel/NestFieldDropdownMenu.d.ts +12 -0
  80. package/dist/types/components/SourcePanel/OperationDropdownMenuItems.d.ts +10 -0
  81. package/dist/types/components/SourcePanel/SearchResultList.d.ts +8 -0
  82. package/dist/types/components/SourcePanel/SourcePanel.d.ts +7 -0
  83. package/dist/types/components/SourcePanel/field-token.stylex.d.ts +3 -0
  84. package/dist/types/components/SourcePanel/hooks/useNestOperations.d.ts +9 -0
  85. package/dist/types/components/SourcePanel/hooks/useOperations.d.ts +8 -0
  86. package/dist/types/components/SourcePanel/index.d.ts +1 -0
  87. package/dist/types/components/SourcePanel/utils.d.ts +24 -0
  88. package/dist/types/components/TopValuesTable.d.ts +7 -0
  89. package/dist/types/components/filters/BooleanFilterToken.d.ts +11 -0
  90. package/dist/types/components/filters/DateTimeFilterToken.d.ts +12 -0
  91. package/dist/types/components/filters/NumberFilterToken.d.ts +13 -0
  92. package/dist/types/components/filters/PillInput.d.ts +18 -0
  93. package/dist/types/components/filters/StringFilterToken.d.ts +14 -0
  94. package/dist/types/components/filters/index.d.ts +0 -0
  95. package/dist/types/components/hooks/useClickOutside.d.ts +1 -0
  96. package/dist/types/components/primitives/Badge.d.ts +37 -0
  97. package/dist/types/components/primitives/BadgeForField.d.ts +6 -0
  98. package/dist/types/components/primitives/Banner.d.ts +36 -0
  99. package/dist/types/components/primitives/Button.d.ts +92 -0
  100. package/dist/types/components/primitives/Card.d.ts +12 -0
  101. package/dist/types/components/primitives/CodeBlock.d.ts +26 -0
  102. package/dist/types/components/primitives/CollapsibleListItem.d.ts +16 -0
  103. package/dist/types/components/primitives/CollapsiblePanel.d.ts +13 -0
  104. package/dist/types/components/primitives/DOMElement.d.ts +5 -0
  105. package/dist/types/components/primitives/DatePicker.d.ts +9 -0
  106. package/dist/types/components/primitives/Divider.d.ts +24 -0
  107. package/dist/types/components/primitives/DropdownMenu.d.ts +33 -0
  108. package/dist/types/components/primitives/ErrorIcon.d.ts +8 -0
  109. package/dist/types/components/primitives/Icon.d.ts +57 -0
  110. package/dist/types/components/primitives/List.d.ts +9 -0
  111. package/dist/types/components/primitives/ListItem.d.ts +21 -0
  112. package/dist/types/components/primitives/NumberInput.d.ts +10 -0
  113. package/dist/types/components/primitives/Popover.d.ts +19 -0
  114. package/dist/types/components/primitives/ResizeBar.d.ts +7 -0
  115. package/dist/types/components/primitives/ScrollableArea.d.ts +9 -0
  116. package/dist/types/components/primitives/SelectDropdown.d.ts +31 -0
  117. package/dist/types/components/primitives/Spinner.d.ts +22 -0
  118. package/dist/types/components/primitives/TextInput.d.ts +54 -0
  119. package/dist/types/components/primitives/badge.stylex.d.ts +6 -0
  120. package/dist/types/components/primitives/button.stylex.d.ts +6 -0
  121. package/dist/types/components/primitives/colors.stylex.d.ts +39 -0
  122. package/dist/types/components/primitives/dropdown-menu.stylex.d.ts +9 -0
  123. package/dist/types/components/primitives/index.d.ts +22 -0
  124. package/dist/types/components/primitives/scrollable-area.stylex.d.ts +6 -0
  125. package/dist/types/components/primitives/styles.d.ts +74 -0
  126. package/dist/types/components/primitives/syntax_highlighting/malloyGrammar.d.ts +279 -0
  127. package/dist/types/components/primitives/syntax_highlighting/syntaxHighlighter.d.ts +6 -0
  128. package/dist/types/components/primitives/syntax_highlighting/transformers/lineNumberTransformer.d.ts +3 -0
  129. package/dist/types/components/primitives/syntax_highlighting/transformers/lineSpacingTransformer.d.ts +8 -0
  130. package/dist/types/components/primitives/syntax_highlighting/transformers/transformers.d.ts +8 -0
  131. package/dist/types/components/primitives/tokens/EditableToken.d.ts +50 -0
  132. package/dist/types/components/primitives/tokens/SelectorToken.d.ts +18 -0
  133. package/dist/types/components/primitives/tokens/Token.d.ts +49 -0
  134. package/dist/types/components/primitives/tokens/TokenGroup.d.ts +21 -0
  135. package/dist/types/components/primitives/tokens/styles.d.ts +45 -0
  136. package/dist/types/components/primitives/tokens/token.stylex.d.ts +6 -0
  137. package/dist/types/components/primitives/tokens/types.d.ts +5 -0
  138. package/dist/types/components/primitives/utils/icon.d.ts +388 -0
  139. package/dist/types/components/styles.d.ts +66 -0
  140. package/dist/types/components/utils/fields.d.ts +9 -0
  141. package/dist/types/components/utils/icon.d.ts +7 -0
  142. package/dist/types/components/utils/renderer.d.ts +6 -0
  143. package/dist/types/components/utils/segment.d.ts +6 -0
  144. package/dist/types/contexts/ExplorerPanelsContext.d.ts +11 -0
  145. package/dist/types/contexts/QueryEditorContext.d.ts +25 -0
  146. package/dist/types/hooks/useQueryBuilder.d.ts +3 -0
  147. package/dist/types/index.d.ts +8 -0
  148. package/dist/types/types/error.d.ts +8 -0
  149. package/eslint.config.mjs +156 -0
  150. package/index.html +19 -0
  151. package/package.json +109 -0
  152. package/postcss.config.mjs +20 -0
  153. package/scripts/env.d.ts +3 -0
  154. package/scripts/gen_flow.ts +38 -0
  155. package/scripts/malloy-packages.ts +17 -0
  156. package/scripts/tsconfig.json +8 -0
  157. package/tsconfig.json +16 -0
  158. package/vite.config.mts +65 -0
@@ -0,0 +1,156 @@
1
+ import {fixupConfigRules, fixupPluginRules} from '@eslint/compat';
2
+ import typescriptEslint from '@typescript-eslint/eslint-plugin';
3
+ import stylexEslint from '@stylexjs/eslint-plugin';
4
+ import jest from 'eslint-plugin-jest';
5
+ import prettier from 'eslint-plugin-prettier';
6
+ import react from 'eslint-plugin-react';
7
+ import reactHooks from 'eslint-plugin-react-hooks';
8
+ import tsParser from '@typescript-eslint/parser';
9
+ import globals from 'globals';
10
+ import path from 'node:path';
11
+ import {fileURLToPath} from 'node:url';
12
+ import js from '@eslint/js';
13
+ import {FlatCompat} from '@eslint/eslintrc';
14
+
15
+ const __filename = fileURLToPath(import.meta.url);
16
+ const __dirname = path.dirname(__filename);
17
+ const compat = new FlatCompat({
18
+ baseDirectory: __dirname,
19
+ recommendedConfig: js.configs.recommended,
20
+ allConfig: js.configs.all,
21
+ });
22
+
23
+ export default [
24
+ {
25
+ ignores: [
26
+ '**/*.d.ts',
27
+ '**/@flowtypes',
28
+ '**/flow',
29
+ '**/node_modules/',
30
+ '**/dist/',
31
+ '**/build/',
32
+ '**/malloy-samples/',
33
+ ],
34
+ },
35
+ ...fixupConfigRules(
36
+ compat.extends(
37
+ 'eslint:recommended',
38
+ 'plugin:@typescript-eslint/eslint-recommended',
39
+ 'plugin:@typescript-eslint/recommended',
40
+ 'prettier',
41
+ 'plugin:jest/recommended',
42
+ 'plugin:prettier/recommended',
43
+ 'plugin:react/recommended',
44
+ 'plugin:react-hooks/recommended'
45
+ )
46
+ ),
47
+ {
48
+ plugins: {
49
+ '@typescript-eslint': fixupPluginRules(typescriptEslint),
50
+ jest: fixupPluginRules(jest),
51
+ prettier: fixupPluginRules(prettier),
52
+ '@stylexjs': fixupPluginRules(stylexEslint),
53
+ react: fixupPluginRules(react),
54
+ 'react-hooks': fixupPluginRules(reactHooks),
55
+ },
56
+
57
+ settings: {
58
+ react: {
59
+ version: 'detect',
60
+ },
61
+ },
62
+
63
+ rules: {
64
+ 'array-callback-return': 'error',
65
+ 'consistent-return': 'error',
66
+
67
+ 'no-console': [
68
+ 'error',
69
+ {
70
+ allow: ['debug', 'info', 'warn', 'error'],
71
+ },
72
+ ],
73
+
74
+ 'prettier/prettier': 'error',
75
+ 'sort-keys': 'off',
76
+ 'no-duplicate-imports': 'error',
77
+
78
+ 'no-restricted-imports': [
79
+ 'error',
80
+ {
81
+ patterns: ['@malloydata/malloy/src/*'],
82
+
83
+ paths: [
84
+ {
85
+ name: 'lodash',
86
+ message: 'Import [module] from lodash/[module] instead',
87
+ },
88
+ ],
89
+ },
90
+ ],
91
+
92
+ 'no-throw-literal': 'error',
93
+
94
+ '@typescript-eslint/consistent-type-imports': [
95
+ 'error',
96
+ {
97
+ prefer: 'no-type-imports',
98
+ },
99
+ ],
100
+
101
+ '@typescript-eslint/no-empty-function': 'off',
102
+ '@typescript-eslint/no-non-null-assertion': 'off',
103
+
104
+ '@typescript-eslint/no-unused-vars': [
105
+ 'error',
106
+ {
107
+ argsIgnorePattern: '^_',
108
+ varsIgnorePattern: '^_',
109
+ },
110
+ ],
111
+
112
+ '@typescript-eslint/parameter-properties': [
113
+ 'error',
114
+ {
115
+ prefer: 'parameter-property',
116
+ },
117
+ ],
118
+ },
119
+ },
120
+ {
121
+ files: ['**/*.tsx?'],
122
+
123
+ languageOptions: {
124
+ parser: tsParser,
125
+ ecmaVersion: 5,
126
+ sourceType: 'script',
127
+
128
+ parserOptions: {
129
+ warnOnUnsupportedTypeScriptVersion: false,
130
+ project: ['./tsconfig.json'],
131
+ },
132
+ },
133
+
134
+ rules: {
135
+ '@typescript-eslint/no-floating-promises': 'error',
136
+ },
137
+ },
138
+ {
139
+ files: ['scripts/**'],
140
+
141
+ rules: {
142
+ 'node/no-unpublished-import': 'off',
143
+ 'no-console': 'off',
144
+ 'no-process-exit': 'off',
145
+ },
146
+ },
147
+ {
148
+ files: ['**/*.spec.ts'],
149
+
150
+ languageOptions: {
151
+ globals: {
152
+ ...globals.jest,
153
+ },
154
+ },
155
+ },
156
+ ];
package/index.html ADDED
@@ -0,0 +1,19 @@
1
+ <!doctype html>
2
+ <html>
3
+ <head>
4
+ <title>Malloy Explorer Dev</title>
5
+ </head>
6
+ <body>
7
+ <div>
8
+ <ul>
9
+ <li><a href="/dev/explorer.html">Malloy Explorer</a></li>
10
+ <ul>
11
+ <li><a href="/dev/source.html">Source Panel</a></li>
12
+ <li><a href="/dev/query.html">Query Panel</a></li>
13
+ <li><a href="/dev/result.html">Result Panel</a></li>
14
+ <li><a href="/dev/primitives.html">Primitive Components</a></li>
15
+ </ul>
16
+ </ul>
17
+ </div>
18
+ </body>
19
+ </html>
package/package.json ADDED
@@ -0,0 +1,109 @@
1
+ {
2
+ "name": "@malloydata/malloy-explorer",
3
+ "version": "0.0.257-dev250410160631",
4
+ "description": "Malloy visual query builder",
5
+ "main": "dist/cjs/index.cjs",
6
+ "types": "dist/types/index.d.ts",
7
+ "module": "dist/esm/index.js",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "default": "./dist/esm/index.js"
12
+ },
13
+ "require": {
14
+ "default": "./dist/cjs/index.cjs"
15
+ }
16
+ },
17
+ "./package.json": "./package.json",
18
+ "./styles.css": "./dist/stylex.css"
19
+ },
20
+ "scripts": {
21
+ "build": "npm run build-bundle && npm run build-types && npm run build-flow",
22
+ "build-bundle": "vite build --outDir 'dist' --config vite.config.mts",
23
+ "build-types": "tsc --declaration --emitDeclarationOnly",
24
+ "build-flow": "tsx scripts/gen_flow.ts",
25
+ "dev": "vite",
26
+ "preview": "vite preview",
27
+ "lint": "tsc --noEmit && eslint .",
28
+ "malloy-update-next": "npm install --no-fund --no-audit --save-exact $(./scripts/malloy-packages.ts next)",
29
+ "malloy-update": "npm install --no-fund --no-audit --save-exact $(./scripts/malloy-packages.ts latest)",
30
+ "malloy-link": "npm --no-fund --no-audit link $(./scripts/malloy-packages.ts)",
31
+ "malloy-unlink": "npm --no-fund --no-save --no-audit unlink $(./scripts/malloy-packages.ts) && npm --no-fund --no-audit install --force",
32
+ "malloy-build-and-link": "cd ../malloy && npm run -ws build --workspace=@malloydata/malloy-query-builder --workspace=@malloydata/malloy-filter --workspace=@malloydata/malloy-interfaces --workspace=@malloydata/malloy-tag && npm link -ws",
33
+ "prepublishOnly": "npm run build",
34
+ "test": "jest src"
35
+ },
36
+ "bin": {
37
+ "malloy-packages": "./scripts/malloy-packages.ts"
38
+ },
39
+ "repository": {
40
+ "type": "git",
41
+ "url": "git+https://github.com/malloydata/malloy-explorer.git"
42
+ },
43
+ "keywords": [
44
+ "malloy",
45
+ "analytics"
46
+ ],
47
+ "author": "scullin@meta.com",
48
+ "license": "MIT",
49
+ "bugs": {
50
+ "url": "https://github.com/malloydata/malloy-explorer/issues"
51
+ },
52
+ "homepage": "https://github.com/malloydata/malloy-explorer#readme",
53
+ "dependencies": {
54
+ "@radix-ui/react-dialog": "^1.1.6",
55
+ "@radix-ui/react-dropdown-menu": "^2.1.6",
56
+ "@radix-ui/react-icons": "^1.3.2",
57
+ "@radix-ui/react-popover": "^1.1.6",
58
+ "@radix-ui/react-scroll-area": "^1.2.3",
59
+ "@radix-ui/react-select": "^2.1.6",
60
+ "@radix-ui/react-tabs": "^1.1.3",
61
+ "@radix-ui/react-tooltip": "^1.1.8",
62
+ "@shikijs/core": "^3.2.1",
63
+ "@shikijs/engine-javascript": "^3.2.1",
64
+ "@shikijs/langs": "^3.2.1",
65
+ "@shikijs/themes": "^3.2.1",
66
+ "@shikijs/types": "^3.2.1",
67
+ "@stylexjs/stylex": "^0.10.1",
68
+ "assert": "^2.1.0",
69
+ "moment": "^2.30.1",
70
+ "react": "^19.0.0",
71
+ "react-dom": "^19.0.0"
72
+ },
73
+ "devDependencies": {
74
+ "@babel/preset-react": "^7.26.3",
75
+ "@eslint/compat": "^1.2.7",
76
+ "@eslint/js": "^9.21.0",
77
+ "@rollup/plugin-replace": "^6.0.2",
78
+ "@stylexjs/eslint-plugin": "^0.11.1",
79
+ "@stylexjs/postcss-plugin": "^0.11.1",
80
+ "@stylexjs/rollup-plugin": "^0.10.1",
81
+ "@types/react": "^19.0.10",
82
+ "@types/react-dom": "^19.0.4",
83
+ "@typescript-eslint/eslint-plugin": "^8.26.0",
84
+ "@vitejs/plugin-react": "^4.3.4",
85
+ "autoprefixer": "^10.4.21",
86
+ "eslint": "^9.20.1",
87
+ "eslint-config-prettier": "^10.0.1",
88
+ "eslint-plugin-jest": "^28.11.0",
89
+ "eslint-plugin-prettier": "^5.2.3",
90
+ "eslint-plugin-react": "^7.37.4",
91
+ "eslint-plugin-react-hooks": "^5.2.0",
92
+ "flow-api-translator": "^0.26.0",
93
+ "globals": "^16.0.0",
94
+ "jest": "^29.7.0",
95
+ "postcss": "^8.5.3",
96
+ "tsx": "^4.19.3",
97
+ "vite": "^6.1.0",
98
+ "vite-plugin-svgr": "^4.3.0"
99
+ },
100
+ "peerDependencies": {
101
+ "react": ">= 19.0.0",
102
+ "react-dom": ">= 19.0.0",
103
+ "@malloydata/malloy-filter": ">= 0.0.257",
104
+ "@malloydata/malloy-interfaces": ">= 0.0.257",
105
+ "@malloydata/malloy-query-builder": ">= 0.0.257",
106
+ "@malloydata/malloy-tag": ">= 0.0.257",
107
+ "@malloydata/render": ">= 0.0.257"
108
+ }
109
+ }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ *
8
+ */
9
+
10
+ import babelConfig from './babel.config.mjs';
11
+
12
+ export default {
13
+ plugins: {
14
+ '@stylexjs/postcss-plugin': {
15
+ include: ['src/**/*.{js,jsx,ts,tsx}'],
16
+ useCSSLayers: true,
17
+ babelConfig,
18
+ },
19
+ },
20
+ };
@@ -0,0 +1,3 @@
1
+ declare module 'flow-api-translator' {
2
+ function unstable_translateTSDefToFlowDef(file: string): Promise<string>;
3
+ }
@@ -0,0 +1,38 @@
1
+ import {unstable_translateTSDefToFlowDef} from 'flow-api-translator';
2
+ import * as fs from 'fs';
3
+ import * as path from 'path';
4
+
5
+ const outDir = path.resolve('@flowtypes');
6
+ const inDir = path.resolve('dist/types');
7
+
8
+ const files = [
9
+ 'index.d.ts',
10
+ 'components/MalloyExplorerProvider.d.ts',
11
+ 'components/QueryPanel/QueryEditor.d.ts',
12
+ 'components/QueryPanel/QueryActionBar.d.ts',
13
+ 'components/ResultPanel/ResultPanel.d.ts',
14
+ 'components/ResultPanel/SubmittedQuery.d.ts',
15
+ 'components/SourcePanel/SourcePanel.d.ts',
16
+ 'contexts/ExplorerPanelsContext.d.ts',
17
+ ];
18
+
19
+ async function go() {
20
+ if (fs.existsSync(outDir)) {
21
+ fs.rmSync(outDir, {recursive: true});
22
+ }
23
+
24
+ for (const file of files) {
25
+ const inFile = path.resolve(inDir, file);
26
+ const outFile = path.resolve(outDir, file.replace('.d.ts', '.flow.js'));
27
+ const outFileDir = path.dirname(outFile);
28
+ console.log(`Generating flow types for file ${file}`);
29
+ const contents = fs.readFileSync(inFile, 'utf8');
30
+ const flow = await unstable_translateTSDefToFlowDef(contents);
31
+ if (!fs.existsSync(outFileDir)) {
32
+ fs.mkdirSync(outFileDir, {recursive: true});
33
+ }
34
+ fs.writeFileSync(outFile, flow);
35
+ }
36
+ }
37
+
38
+ go();
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env ts-node
2
+ import packageJson from '../package.json';
3
+
4
+ const deps = Object.keys(packageJson.dependencies);
5
+ const devDeps = Object.keys(packageJson.devDependencies);
6
+ const peerDeps = Object.keys(packageJson.peerDependencies);
7
+
8
+ let malloyPackages = [...deps, ...devDeps, ...peerDeps].filter(name =>
9
+ name.startsWith('@malloydata')
10
+ );
11
+
12
+ if (process.argv.length === 3) {
13
+ malloyPackages = malloyPackages.map(
14
+ packageJson => `${packageJson}@${process.argv[2]}`
15
+ );
16
+ }
17
+ console.log(malloyPackages.join(' '));
@@ -0,0 +1,8 @@
1
+ {
2
+ "compilerOptions": {
3
+ "esModuleInterop": true,
4
+ "resolveJsonModule": true,
5
+ "rootDir": ".",
6
+ "strict": true
7
+ }
8
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "esModuleInterop": true,
4
+ "jsx": "react-jsx",
5
+ "module": "ESNext",
6
+ "moduleResolution": "bundler",
7
+ "noEmit": false,
8
+ "outDir": "dist/types",
9
+ "resolveJsonModule": true,
10
+ "rootDir": "src",
11
+ "skipLibCheck": true,
12
+ "strict": true,
13
+ "target": "ES2019"
14
+ },
15
+ "include": ["src"]
16
+ }
@@ -0,0 +1,65 @@
1
+ import {defineConfig} from 'vite';
2
+ import {resolve} from 'path';
3
+
4
+ import replace from '@rollup/plugin-replace';
5
+ import react from '@vitejs/plugin-react';
6
+ import svgr from 'vite-plugin-svgr';
7
+ import babelConfig from './babel.config.mjs';
8
+
9
+ export default defineConfig({
10
+ plugins: [
11
+ svgr(),
12
+ react({babel: babelConfig}),
13
+ replace({
14
+ 'Object.defineProperty(exports, "__esModule", { value: true });':
15
+ 'Object.defineProperty(typeof exports !== \'undefined\' ? exports : {}, "__esModule", { value: true });',
16
+ delimiters: ['\n', '\n'],
17
+ }),
18
+ ],
19
+ build: {
20
+ lib: {
21
+ entry: resolve(__dirname, 'src/index.ts'),
22
+ formats: ['es', 'cjs'],
23
+ fileName: format => {
24
+ if (format === 'cjs') return 'cjs/[name].cjs';
25
+ return 'esm/[name].js';
26
+ },
27
+ name: 'index',
28
+ },
29
+ rollupOptions: {
30
+ preserveSymlinks: true,
31
+ external: [
32
+ 'react',
33
+ 'react-dom',
34
+ 'react/jsx-runtime',
35
+ '@malloydata/malloy-tag',
36
+ '@malloydata/malloy-filter',
37
+ '@malloydata/malloy-interfaces',
38
+ '@malloydata/malloy-query-builder',
39
+ '@malloydata/render',
40
+ '@malloydata/render/webcomponent',
41
+ ],
42
+ output: {
43
+ manualChunks: _id => {
44
+ return 'index';
45
+ },
46
+ },
47
+ },
48
+ minify: false,
49
+ sourcemap: true,
50
+ },
51
+ define: {
52
+ 'process.env': {},
53
+ },
54
+ optimizeDeps: {
55
+ force: true,
56
+ include: [
57
+ '@malloydata/render',
58
+ '@malloydata/malloy-tag',
59
+ '@malloydata/malloy-filter',
60
+ '@malloydata/malloy-interfaces',
61
+ '@malloydata/malloy-query-builder',
62
+ '@malloydata/render/webcomponent',
63
+ ],
64
+ },
65
+ });