xmlui 0.9.21 → 0.9.25
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/dist/apiInterceptorWorker-CFF3bC6o.mjs +818 -0
- package/dist/{index-B3CWFAxa.mjs → index-DtxDGaqF.mjs} +11942 -3291
- package/dist/index.css +1301 -564
- package/dist/language-server-web-worker.mjs +1 -1
- package/dist/language-server.mjs +1 -1
- package/dist/lint-CYAUfk0_.mjs +168 -0
- package/dist/metadata-utils-CCIMqe69.mjs +466 -0
- package/dist/scripts/package.json +252 -0
- package/dist/scripts/src/components/App/AppLayoutContext.js +0 -1
- package/dist/scripts/src/components/App/AppNative.js +21 -9
- package/dist/scripts/src/components/AppHeader/AppHeader.js +1 -1
- package/dist/scripts/src/components/AutoComplete/AutoComplete.js +5 -2
- package/dist/scripts/src/components/AutoComplete/AutoCompleteNative.js +13 -10
- package/dist/scripts/src/components/Bookmark/BookmarkNative.js +5 -1
- package/dist/scripts/src/components/CodeBlock/CodeBlock.js +31 -0
- package/dist/scripts/src/components/CodeBlock/CodeBlockNative.js +82 -0
- package/dist/scripts/src/components/ComponentProvider.js +5 -0
- package/dist/scripts/src/components/DatePicker/DatePickerNative.js +1 -0
- package/dist/scripts/src/components/Form/FormContext.js +5 -4
- package/dist/scripts/src/components/Form/FormNative.js +41 -43
- package/dist/scripts/src/components/Form/formActions.js +1 -1
- package/dist/scripts/src/components/FormItem/FormItem.js +6 -3
- package/dist/scripts/src/components/FormItem/FormItemNative.js +56 -15
- package/dist/scripts/src/components/FormItem/ItemWithLabel.js +1 -1
- package/dist/scripts/src/components/Heading/Heading.js +13 -0
- package/dist/scripts/src/components/Heading/HeadingNative.js +1 -1
- package/dist/scripts/src/components/HtmlTags/HtmlTags.js +7 -3
- package/dist/scripts/src/components/Icon/DarkToLightIcon.js +10 -0
- package/dist/scripts/src/components/Icon/LightToDark.js +10 -0
- package/dist/scripts/src/components/IconProvider.js +4 -0
- package/dist/scripts/src/components/Image/ImageNative.js +1 -1
- package/dist/scripts/src/components/Items/ItemsNative.js +8 -6
- package/dist/scripts/src/components/Link/Link.js +5 -5
- package/dist/scripts/src/components/List/ListNative.js +1 -1
- package/dist/scripts/src/components/Markdown/Markdown.js +52 -16
- package/dist/scripts/src/components/Markdown/MarkdownNative.js +34 -73
- package/dist/scripts/src/components/Markdown/highlight-code.js +160 -0
- package/dist/scripts/src/components/Markdown/parse-binding-expr.js +60 -0
- package/dist/scripts/src/components/Markdown/utils.js +282 -0
- package/dist/scripts/src/components/ModalDialog/ConfirmationModalContextProvider.js +116 -0
- package/dist/scripts/src/components/ModalDialog/Dialog.js +20 -0
- package/dist/scripts/src/components/NavGroup/NavGroupNative.js +4 -5
- package/dist/scripts/src/components/NestedApp/NestedApp.js +61 -0
- package/dist/scripts/src/components/NestedApp/NestedAppNative.js +125 -0
- package/dist/scripts/src/components/NestedApp/Tooltip.js +46 -0
- package/dist/scripts/src/components/NumberBox/NumberBox.js +4 -1
- package/dist/scripts/src/components/NumberBox/NumberBoxNative.js +2 -2
- package/dist/scripts/src/components/Option/Option.js +3 -2
- package/dist/scripts/src/components/Select/Select.js +5 -3
- package/dist/scripts/src/components/Select/SelectNative.js +53 -40
- package/dist/scripts/src/components/SelectionStore/SelectionStore.js +1 -1
- package/dist/scripts/src/components/Spinner/Spinner.js +0 -1
- package/dist/scripts/src/components/TableOfContents/TableOfContents.js +1 -0
- package/dist/scripts/src/components/Text/Text.js +12 -1
- package/dist/scripts/src/components/Text/TextNative.js +5 -1
- package/dist/scripts/src/components/TextBox/TextBox.js +6 -1
- package/dist/scripts/src/components/TextBox/TextBoxNative.js +2 -2
- package/dist/scripts/src/components/Theme/ThemeNative.js +7 -3
- package/dist/scripts/src/components/ToneChangerButton/ToneChangerButton.js +1 -3
- package/dist/scripts/src/components-core/RestApiProxy.js +10 -7
- package/dist/scripts/src/components-core/TableOfContentsContext.js +1 -1
- package/dist/scripts/src/components-core/appContext/date-functions.js +23 -0
- package/dist/scripts/src/components-core/appContext/math-function.js +27 -0
- package/dist/scripts/src/components-core/appContext/misc-utils.js +13 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptor.js +199 -0
- package/dist/scripts/src/components-core/interception/ApiInterceptorProvider.js +94 -0
- package/dist/scripts/src/components-core/interception/Backend.js +128 -0
- package/dist/scripts/src/components-core/interception/Errors.js +129 -0
- package/dist/scripts/src/components-core/interception/InMemoryDb.js +41 -0
- package/dist/scripts/src/components-core/interception/IndexedDb.js +207 -0
- package/dist/scripts/src/components-core/interception/ReadonlyCollection.js +145 -0
- package/dist/scripts/src/components-core/interception/abstractions.js +2 -0
- package/dist/scripts/src/components-core/interception/apiInterceptorWorker.js +46 -0
- package/dist/scripts/src/components-core/interception/useApiInterceptorContext.js +9 -0
- package/dist/scripts/src/components-core/rendering/AppContent.js +336 -0
- package/dist/scripts/src/components-core/rendering/AppRoot.js +84 -0
- package/dist/scripts/src/components-core/rendering/AppWrapper.js +49 -0
- package/dist/scripts/src/components-core/rendering/ComponentAdapter.js +17 -7
- package/dist/scripts/src/components-core/rendering/Container.js +2 -1
- package/dist/scripts/src/components-core/theming/ThemeProvider.js +2 -7
- package/dist/scripts/src/components-core/theming/themes/root.js +1 -0
- package/dist/scripts/src/components-core/utils/date-utils.js +78 -0
- package/dist/scripts/src/components-core/utils/hooks.js +26 -0
- package/dist/scripts/src/components-core/utils/misc.js +1 -1
- package/dist/scripts/src/components-core/utils/request-params.js +70 -0
- package/dist/scripts/src/logging/LoggerContext.js +22 -0
- package/dist/scripts/src/logging/LoggerInitializer.js +14 -0
- package/dist/scripts/src/logging/LoggerService.js +60 -0
- package/dist/scripts/src/parsers/xmlui-parser/transform.js +7 -0
- package/dist/{server-common-DW5h7Q34.mjs → server-common-9TiLMTJj.mjs} +106 -98
- package/dist/style.css +3314 -2823
- package/dist/{lint-EcgF-9Wr.mjs → transform-DC0Gy6qw.mjs} +1246 -540
- package/dist/xmlui-metadata.mjs +2850 -2665
- package/dist/xmlui-metadata.umd.js +2850 -2665
- package/dist/xmlui-parser.d.ts +49 -4
- package/dist/xmlui-parser.mjs +49 -48
- package/dist/xmlui-standalone.umd.js +34674 -31457
- package/dist/xmlui.d.ts +3 -1
- package/dist/xmlui.mjs +10 -10
- package/package.json +3 -1
- package/dist/apiInterceptorWorker-7aKQ2rBj.mjs +0 -8447
- package/dist/parser-CBXS8ft2.mjs +0 -1196
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "xmlui",
|
|
3
|
+
"version": "0.9.25",
|
|
4
|
+
"sideEffects": false,
|
|
5
|
+
"scripts": {
|
|
6
|
+
"start-test-bed": "cd src/testing/infrastructure && xmlui start",
|
|
7
|
+
"build:test-bed": "cd src/testing/infrastructure && xmlui build --build-mode=INLINE_ALL --withHostingMetaFiles --withMock",
|
|
8
|
+
"build:bin": "tsc -p tsconfig.bin.json",
|
|
9
|
+
"build:xmlui": "vite build --mode lib",
|
|
10
|
+
"build:xmlui-standalone": "vite build --mode standalone",
|
|
11
|
+
"build:xmlui-metadata": "vite build --mode metadata",
|
|
12
|
+
"build:ext-meta": "node scripts/build-extension-packages/build-extension-packages.mjs",
|
|
13
|
+
"build": "rimraf dist && tsc && npm run build:bin && npm run build:xmlui-metadata && npm run build:xmlui && npm run build:xmlui-standalone",
|
|
14
|
+
"build:extensions": "cd ../packages/xmlui-animations && npm run build && cd ../xmlui-charts && npm run build && cd ../xmlui-pdf && npm run build && cd ../xmlui-spreadsheet && cd ../xmlui-devtools && npm run build && npm run build",
|
|
15
|
+
"test": "npm run test:unit",
|
|
16
|
+
"test:unit": "vitest run",
|
|
17
|
+
"test:e2e": "playwright test",
|
|
18
|
+
"test:e2e-smoke": "playwright test --project smoke",
|
|
19
|
+
"test:e2e-ui": "npm run test:e2e -- --ui",
|
|
20
|
+
"lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",
|
|
21
|
+
"prepublishOnly": "clean-package && npm run build",
|
|
22
|
+
"cleanPackage": "clean-package",
|
|
23
|
+
"postpublish": "clean-package restore",
|
|
24
|
+
"generate-docs": "node scripts/generate-docs/get-docs.mjs",
|
|
25
|
+
"prepare-docs-data": "npm run build:xmlui-metadata",
|
|
26
|
+
"generate-all-docs": "npm run build:xmlui-metadata && npm run build:ext-meta && npm run generate-docs",
|
|
27
|
+
"export-themes": "npm run prepare-docs-data && node scripts/generate-docs/create-theme-files.mjs",
|
|
28
|
+
"generate-langserver-metadata": "node scripts/get-langserver-metadata.mjs > src/language-server/xmlui-metadata-generated.mjs"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@eslint-community/regexpp": "4.10.0",
|
|
32
|
+
"@formkit/auto-animate": "0.7.0",
|
|
33
|
+
"@internationalized/number": "^3.6.0",
|
|
34
|
+
"@modyfi/vite-plugin-yaml": "1.1.0",
|
|
35
|
+
"@monaco-editor/loader": "^1.5.0",
|
|
36
|
+
"@popperjs/core": "2.11.6",
|
|
37
|
+
"@radix-ui/react-accordion": "^1.2.0",
|
|
38
|
+
"@radix-ui/react-alert-dialog": "^1.1.2",
|
|
39
|
+
"@radix-ui/react-dialog": "1.0.5",
|
|
40
|
+
"@radix-ui/react-dropdown-menu": "2.0.6",
|
|
41
|
+
"@radix-ui/react-hover-card": "1.0.7",
|
|
42
|
+
"@radix-ui/react-popover": "^1.1.2",
|
|
43
|
+
"@radix-ui/react-radio-group": "1.1.3",
|
|
44
|
+
"@radix-ui/react-select": "^2.1.2",
|
|
45
|
+
"@radix-ui/react-slider": "^1.2.3",
|
|
46
|
+
"@radix-ui/react-tabs": "1.1.0",
|
|
47
|
+
"@radix-ui/react-tooltip": "^1.2.4",
|
|
48
|
+
"@radix-ui/react-visually-hidden": "1.0.3",
|
|
49
|
+
"@remix-run/react": "2.9.1",
|
|
50
|
+
"@tanstack/react-query": "^4.36.1",
|
|
51
|
+
"@tanstack/react-query-devtools": "^4.36.1",
|
|
52
|
+
"@tanstack/react-table": "8.17.3",
|
|
53
|
+
"@tanstack/react-virtual": "3.10.8",
|
|
54
|
+
"@types/chroma-js": "^3.1.1",
|
|
55
|
+
"@types/color": "3.0.6",
|
|
56
|
+
"@vitejs/plugin-react": "4.3.0",
|
|
57
|
+
"adm-zip": "0.5.10",
|
|
58
|
+
"axios": "1.7.7",
|
|
59
|
+
"chroma-js": "^3.1.2",
|
|
60
|
+
"classnames": "2.5.1",
|
|
61
|
+
"cmdk": "^1.0.4",
|
|
62
|
+
"color": "4.2.3",
|
|
63
|
+
"date-fns": "2.30.0",
|
|
64
|
+
"dexie": "3.2.4",
|
|
65
|
+
"dotenv": "16.3.1",
|
|
66
|
+
"embla-carousel-autoplay": "^8.3.0",
|
|
67
|
+
"embla-carousel-react": "^8.3.0",
|
|
68
|
+
"emoji-picker-react": "4.4.10",
|
|
69
|
+
"glob": "7.2.0",
|
|
70
|
+
"immer": "9.0.16",
|
|
71
|
+
"lodash-es": "4.17.21",
|
|
72
|
+
"memoize-one": "6.0.0",
|
|
73
|
+
"msw": "2.0.1",
|
|
74
|
+
"oidc-client-ts": "2.1.0",
|
|
75
|
+
"papaparse": "^5.5.2",
|
|
76
|
+
"react": "18.2.0",
|
|
77
|
+
"react-currency-input-field": "3.6.9",
|
|
78
|
+
"react-datepicker": "4.25.0",
|
|
79
|
+
"react-day-picker": "9.6.7",
|
|
80
|
+
"react-dom": "18.2.0",
|
|
81
|
+
"react-dropzone": "14.2.3",
|
|
82
|
+
"react-helmet-async": "1.3.0",
|
|
83
|
+
"react-hot-toast": "2.4.1",
|
|
84
|
+
"react-icons": "4.12.0",
|
|
85
|
+
"react-imask": "7.1.3",
|
|
86
|
+
"react-markdown": "^9.0.1",
|
|
87
|
+
"react-measure": "2.5.2",
|
|
88
|
+
"react-popper": "2.3.0",
|
|
89
|
+
"react-resizable-panels": "2.0.19",
|
|
90
|
+
"react-rnd": "^10.5.2",
|
|
91
|
+
"react-router-dom": "6.23.0",
|
|
92
|
+
"react-select": "5.7.4",
|
|
93
|
+
"react-sticky-el": "^2.1.1",
|
|
94
|
+
"react-textarea-autosize": "8.5.3",
|
|
95
|
+
"react-virtualized-auto-sizer": "1.0.24",
|
|
96
|
+
"react-window": "1.8.10",
|
|
97
|
+
"recharts": "^2.15.1",
|
|
98
|
+
"rehype-raw": "^7.0.0",
|
|
99
|
+
"remark-gfm": "^4.0.1",
|
|
100
|
+
"sass": "1.55.0",
|
|
101
|
+
"scroll-into-view-if-needed": "^3.1.0",
|
|
102
|
+
"shiki": "^1.14.1",
|
|
103
|
+
"ts-node": "10.9.1",
|
|
104
|
+
"unist-util-visit": "^5.0.0",
|
|
105
|
+
"use-context-selector": "1.4.1",
|
|
106
|
+
"virtua": "0.40.0",
|
|
107
|
+
"vite-plugin-lib-inject-css": "1.3.0",
|
|
108
|
+
"vite-plugin-svgr": "4.2.0",
|
|
109
|
+
"vscode-languageserver": "^9.0.1",
|
|
110
|
+
"vscode-languageserver-textdocument": "^1.0.11",
|
|
111
|
+
"yargs": "17.7.2"
|
|
112
|
+
},
|
|
113
|
+
"devDependencies": {
|
|
114
|
+
"@babel/core": "7.19.6",
|
|
115
|
+
"@babel/preset-env": "7.19.4",
|
|
116
|
+
"@babel/preset-typescript": "7.18.6",
|
|
117
|
+
"@playwright/test": "1.50.1",
|
|
118
|
+
"@rollup/pluginutils": "5.1.0",
|
|
119
|
+
"@types/adm-zip": "0.5.4",
|
|
120
|
+
"@types/glob": "7.2.0",
|
|
121
|
+
"@types/lodash-es": "4.17.6",
|
|
122
|
+
"@types/node": "18.11.5",
|
|
123
|
+
"@types/react": "18.2.23",
|
|
124
|
+
"@types/react-datepicker": "4.19.5",
|
|
125
|
+
"@types/react-dom": "18.2.8",
|
|
126
|
+
"@types/react-measure": "^2.0.8",
|
|
127
|
+
"@types/react-pdf": "5.7.2",
|
|
128
|
+
"@types/react-window": "1.8.8",
|
|
129
|
+
"@types/yargs": "17.0.31",
|
|
130
|
+
"@typescript-eslint/eslint-plugin": "8.15.0",
|
|
131
|
+
"@typescript-eslint/parser": "8.15.0",
|
|
132
|
+
"babel-loader": "8.2.5",
|
|
133
|
+
"clean-package": "2.2.0",
|
|
134
|
+
"eslint": "^8.57.0",
|
|
135
|
+
"eslint-import-resolver-typescript": "3.6.1",
|
|
136
|
+
"eslint-plugin-import": "2.28.1",
|
|
137
|
+
"eslint-plugin-jsx-a11y": "6.7.1",
|
|
138
|
+
"eslint-plugin-react": "^7.37.4",
|
|
139
|
+
"eslint-plugin-react-hooks": "^5.2.0",
|
|
140
|
+
"prettier": "^3.3.3",
|
|
141
|
+
"rimraf": "6.0.1",
|
|
142
|
+
"rollup-plugin-visualizer": "5.8.3",
|
|
143
|
+
"serve": "14.2.0",
|
|
144
|
+
"typescript": "5.7.3",
|
|
145
|
+
"vite": "5.4.9",
|
|
146
|
+
"vite-plugin-dts": "4.5.0",
|
|
147
|
+
"vitest": "^3.0.3"
|
|
148
|
+
},
|
|
149
|
+
"optionalDependencies": {
|
|
150
|
+
"@esbuild/linux-x64": "0.25.2",
|
|
151
|
+
"@rollup/rollup-linux-x64-gnu": "4.20.0",
|
|
152
|
+
"@rollup/rollup-win32-x64-msvc": "4.20.0"
|
|
153
|
+
},
|
|
154
|
+
"files": [
|
|
155
|
+
"dist",
|
|
156
|
+
"src/styles"
|
|
157
|
+
],
|
|
158
|
+
"bin": {
|
|
159
|
+
"xmlui": "dist/scripts/bin/bootstrap.js"
|
|
160
|
+
},
|
|
161
|
+
"clean-package": {
|
|
162
|
+
"replace": {
|
|
163
|
+
"bin": {
|
|
164
|
+
"xmlui": "dist/scripts/bin/bootstrap.js"
|
|
165
|
+
},
|
|
166
|
+
"main": "./dist/xmlui.umd.js",
|
|
167
|
+
"module": "./dist/xmlui.mjs",
|
|
168
|
+
"types": "./dist/xmlui.d.ts",
|
|
169
|
+
"exports": {
|
|
170
|
+
".": {
|
|
171
|
+
"import": "./dist/xmlui.mjs",
|
|
172
|
+
"require": "./dist/xmlui.umd.js"
|
|
173
|
+
},
|
|
174
|
+
"./language-server": {
|
|
175
|
+
"import": "./dist/language-server.mjs",
|
|
176
|
+
"require": "./dist/language-server.mjs"
|
|
177
|
+
},
|
|
178
|
+
"./language-server-web-worker": {
|
|
179
|
+
"import": "./dist/language-server-web-worker.mjs",
|
|
180
|
+
"require": "./dist/language-server-web-worker.mjs"
|
|
181
|
+
},
|
|
182
|
+
"./parser": {
|
|
183
|
+
"import": "./dist/xmlui-parser.mjs",
|
|
184
|
+
"require": "./dist/xmlui-parser.mjs"
|
|
185
|
+
},
|
|
186
|
+
"./*.css": {
|
|
187
|
+
"import": "./dist/*.css",
|
|
188
|
+
"require": "./dist/*.css"
|
|
189
|
+
},
|
|
190
|
+
"./index.scss": {
|
|
191
|
+
"import": "./src/index.scss",
|
|
192
|
+
"require": "./src/index.scss"
|
|
193
|
+
},
|
|
194
|
+
"./vite-xmlui-plugin": {
|
|
195
|
+
"import": "./dist/scripts/bin/vite-xmlui-plugin.js",
|
|
196
|
+
"require": "./dist/scripts/bin/vite-xmlui-plugin.js"
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"main": "./dist/xmlui.umd.js",
|
|
202
|
+
"exports": {
|
|
203
|
+
".": {
|
|
204
|
+
"import": "./dist/xmlui.mjs",
|
|
205
|
+
"require": "./dist/xmlui.umd.js"
|
|
206
|
+
},
|
|
207
|
+
"./language-server": {
|
|
208
|
+
"import": "./dist/language-server.mjs",
|
|
209
|
+
"require": "./dist/language-server.mjs"
|
|
210
|
+
},
|
|
211
|
+
"./language-server-web-worker": {
|
|
212
|
+
"import": "./dist/language-server-web-worker.mjs",
|
|
213
|
+
"require": "./dist/language-server-web-worker.mjs"
|
|
214
|
+
},
|
|
215
|
+
"./parser": {
|
|
216
|
+
"import": "./dist/xmlui-parser.mjs",
|
|
217
|
+
"require": "./dist/xmlui-parser.mjs"
|
|
218
|
+
},
|
|
219
|
+
"./*.css": {
|
|
220
|
+
"import": "./dist/*.css",
|
|
221
|
+
"require": "./dist/*.css"
|
|
222
|
+
},
|
|
223
|
+
"./index.scss": {
|
|
224
|
+
"import": "./src/index.scss",
|
|
225
|
+
"require": "./src/index.scss"
|
|
226
|
+
},
|
|
227
|
+
"./vite-xmlui-plugin": {
|
|
228
|
+
"import": "./dist/scripts/bin/vite-xmlui-plugin.js",
|
|
229
|
+
"require": "./dist/scripts/bin/vite-xmlui-plugin.js"
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
"browserslist": {
|
|
233
|
+
"production": [
|
|
234
|
+
">0.2%",
|
|
235
|
+
"not dead",
|
|
236
|
+
"not op_mini all"
|
|
237
|
+
],
|
|
238
|
+
"development": [
|
|
239
|
+
"last 1 chrome version",
|
|
240
|
+
"last 1 firefox version",
|
|
241
|
+
"last 1 safari version"
|
|
242
|
+
]
|
|
243
|
+
},
|
|
244
|
+
"repository": {
|
|
245
|
+
"url": "https://github.com/xmlui-com/xmlui.git"
|
|
246
|
+
},
|
|
247
|
+
"msw": {
|
|
248
|
+
"workerDirectory": "src/testing/infrastructure/public"
|
|
249
|
+
},
|
|
250
|
+
"module": "./dist/xmlui.mjs",
|
|
251
|
+
"types": "./dist/xmlui.d.ts"
|
|
252
|
+
}
|
|
@@ -37,7 +37,7 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
37
37
|
const mounted = (0, react_1.useRef)(false);
|
|
38
38
|
const layoutWithDefaultValue = layout || getThemeVar("layout-App") || "condensed-sticky";
|
|
39
39
|
const safeLayout = layoutWithDefaultValue === null || layoutWithDefaultValue === void 0 ? void 0 : layoutWithDefaultValue.trim().replace(/[\u2013\u2014\u2011]/g, "-"); //It replaces all – (–) and — (—) and non-breaking hyphen '‑' symbols with simple dashes (-).
|
|
40
|
-
const { setLoggedInUser, mediaSize } = (0, AppContext_1.useAppContext)();
|
|
40
|
+
const { setLoggedInUser, mediaSize, forceRefreshAnchorScroll } = (0, AppContext_1.useAppContext)();
|
|
41
41
|
const hasRegisteredHeader = header !== undefined;
|
|
42
42
|
const hasRegisteredNavPanel = navPanelDef !== undefined;
|
|
43
43
|
const pagesWrapperInnerStyle = (0, react_1.useMemo)(() => {
|
|
@@ -93,13 +93,23 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
93
93
|
}, []));
|
|
94
94
|
const styleWithHelpers = (0, react_1.useMemo)(() => {
|
|
95
95
|
return {
|
|
96
|
-
"--header-height": !scrollWholePage
|
|
97
|
-
|
|
96
|
+
"--header-height": !scrollWholePage ||
|
|
97
|
+
safeLayout === "vertical" ||
|
|
98
|
+
safeLayout === "horizontal" ||
|
|
99
|
+
safeLayout === "condensed"
|
|
100
|
+
? "0px"
|
|
101
|
+
: headerHeight + "px",
|
|
102
|
+
"--footer-height": !scrollWholePage ||
|
|
103
|
+
safeLayout === "vertical" ||
|
|
104
|
+
safeLayout === "horizontal" ||
|
|
105
|
+
safeLayout === "condensed"
|
|
106
|
+
? "0px"
|
|
107
|
+
: footerHeight + "px",
|
|
98
108
|
"--header-abs-height": headerHeight + "px",
|
|
99
109
|
"--footer-abs-height": footerHeight + "px",
|
|
100
|
-
"--scrollbar-width": noScrollbarGutters ?
|
|
110
|
+
"--scrollbar-width": noScrollbarGutters ? "0px" : scrollbarWidth + "px",
|
|
101
111
|
};
|
|
102
|
-
}, [footerHeight, headerHeight, noScrollbarGutters, scrollWholePage, scrollbarWidth]);
|
|
112
|
+
}, [footerHeight, headerHeight, noScrollbarGutters, safeLayout, scrollWholePage, scrollbarWidth]);
|
|
103
113
|
const [drawerVisible, setDrawerVisible] = (0, react_1.useState)(false);
|
|
104
114
|
const location = (0, react_2.useLocation)();
|
|
105
115
|
const toggleDrawer = (0, react_1.useCallback)(() => {
|
|
@@ -113,6 +123,12 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
113
123
|
behavior: "instant", // Optional if you want to skip the scrolling animation
|
|
114
124
|
});
|
|
115
125
|
}, [location.pathname]);
|
|
126
|
+
(0, react_1.useEffect)(() => {
|
|
127
|
+
requestAnimationFrame(() => {
|
|
128
|
+
// we have to force refresh the anchor scroll to pos, because it depends on the header height (scroll-margin-top on anchors)
|
|
129
|
+
forceRefreshAnchorScroll();
|
|
130
|
+
});
|
|
131
|
+
}, [forceRefreshAnchorScroll]);
|
|
116
132
|
const [subNavPanelSlot, setSubNavPanelSlot] = (0, react_1.useState)(null);
|
|
117
133
|
const registerSubNavPanelSlot = (0, react_1.useCallback)((element) => {
|
|
118
134
|
setSubNavPanelSlot(element);
|
|
@@ -185,9 +201,6 @@ function App({ children, style, layout, loggedInUser, scrollWholePage, noScrollb
|
|
|
185
201
|
case "vertical-full-header":
|
|
186
202
|
content = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(wrapperBaseClasses, App_module_scss_1.default.verticalFullHeader), style: styleWithHelpers, ref: scrollPageContainerRef, children: [(0, jsx_runtime_1.jsx)("header", { className: (0, classnames_1.default)(App_module_scss_1.default.headerWrapper, App_module_scss_1.default.sticky), ref: headerRefCallback, children: header }), (0, jsx_runtime_1.jsxs)("div", { className: App_module_scss_1.default.content, children: [navPanelVisible && (0, jsx_runtime_1.jsx)("aside", { className: App_module_scss_1.default.navPanelWrapper, children: navPanel }), (0, jsx_runtime_1.jsx)("main", { className: App_module_scss_1.default.contentWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapper, ref: noScrollPageContainerRef, children: (0, jsx_runtime_1.jsx)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapperInner, style: pagesWrapperInnerStyle, children: children }) }) }) })] }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.footerWrapper, ref: footerRefCallback, children: footer })] }));
|
|
187
203
|
break;
|
|
188
|
-
case "vertical-constrained-width":
|
|
189
|
-
content = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(wrapperBaseClasses, App_module_scss_1.default.verticalConstrained), style: styleWithHelpers, ref: scrollPageContainerRef, children: [(0, jsx_runtime_1.jsx)("header", { className: (0, classnames_1.default)(App_module_scss_1.default.headerWrapper, App_module_scss_1.default.sticky), ref: headerRefCallback, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.header, style: { paddingInline: 0 }, children: header }) }), (0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(App_module_scss_1.default.content, App_module_scss_1.default.verticalConstrained), children: [navPanelVisible && (0, jsx_runtime_1.jsx)("aside", { className: App_module_scss_1.default.navPanelWrapper, children: navPanel }), (0, jsx_runtime_1.jsx)("main", { className: App_module_scss_1.default.contentWrapper, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapper, ref: noScrollPageContainerRef, children: (0, jsx_runtime_1.jsx)(ScrollContext_1.ScrollContext.Provider, { value: scrollContainerRef, children: (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.PagesWrapperInner, style: pagesWrapperInnerStyle, children: children }) }) }) })] }), (0, jsx_runtime_1.jsx)("div", { className: App_module_scss_1.default.footerWrapper, ref: footerRefCallback, children: footer })] }));
|
|
190
|
-
break;
|
|
191
204
|
case "condensed":
|
|
192
205
|
case "condensed-sticky":
|
|
193
206
|
content = ((0, jsx_runtime_1.jsxs)("div", { className: (0, classnames_1.default)(wrapperBaseClasses, App_module_scss_1.default.horizontal, {
|
|
@@ -213,7 +226,6 @@ function getAppLayoutOrientation(appLayout) {
|
|
|
213
226
|
case "vertical":
|
|
214
227
|
case "vertical-sticky":
|
|
215
228
|
case "vertical-full-header":
|
|
216
|
-
case "vertical-constrained-width":
|
|
217
229
|
return "vertical";
|
|
218
230
|
default:
|
|
219
231
|
return "horizontal";
|
|
@@ -39,7 +39,7 @@ exports.AppHeaderMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
39
39
|
"`padding` variants, such as `paddingLeft-logo-AppHeader` and others).",
|
|
40
40
|
[`width‑logo‑${COMP}`]: "Sets the width of the displayed logo",
|
|
41
41
|
},
|
|
42
|
-
defaultThemeVars: Object.assign(Object.assign(Object.assign({ [`height-${COMP}`]: "$space-14", [`maxWidth-content-${COMP}`]: "$maxWidth-content-App", [`borderBottom-${COMP}`]: "1px solid $borderColor" }, (0, base_utils_1.paddingSubject)(`logo-${COMP}`, { horizontal: "$space-0", vertical: "$space-4" })), (0, base_utils_1.paddingSubject)(COMP, { horizontal: "$space-4", vertical: "$space-0" })), { [`borderRadius-${COMP}`]: "0px", [`backgroundColor-${COMP}`]: "$color-surface-raised" }),
|
|
42
|
+
defaultThemeVars: Object.assign(Object.assign(Object.assign({ [`height-${COMP}`]: "$space-14", [`maxWidth-content-${COMP}`]: "$maxWidth-content-App", [`maxWidth-${COMP}`]: "$maxWidth-App", [`borderBottom-${COMP}`]: "1px solid $borderColor" }, (0, base_utils_1.paddingSubject)(`logo-${COMP}`, { horizontal: "$space-0", vertical: "$space-4" })), (0, base_utils_1.paddingSubject)(COMP, { horizontal: "$space-4", vertical: "$space-0" })), { [`borderRadius-${COMP}`]: "0px", [`backgroundColor-${COMP}`]: "$color-surface-raised" }),
|
|
43
43
|
});
|
|
44
44
|
exports.appHeaderComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AppHeaderMd, ({ node, renderChild, layoutCss, layoutContext, extractValue }) => {
|
|
45
45
|
var _a, _b;
|
|
@@ -26,6 +26,10 @@ exports.AutoCompleteMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
26
26
|
readOnly: (0, metadata_helpers_1.dReadonly)(),
|
|
27
27
|
enabled: (0, metadata_helpers_1.dEnabled)(),
|
|
28
28
|
validationStatus: (0, metadata_helpers_1.dValidationStatus)(),
|
|
29
|
+
label: (0, metadata_helpers_1.dLabel)(),
|
|
30
|
+
labelPosition: (0, metadata_helpers_1.dLabelPosition)("top"),
|
|
31
|
+
labelWidth: (0, metadata_helpers_1.dLabelWidth)(COMP),
|
|
32
|
+
labelBreak: (0, metadata_helpers_1.dLabelBreak)(COMP),
|
|
29
33
|
dropdownHeight: (0, ComponentDefs_1.d)("This property sets the height of the dropdown list."),
|
|
30
34
|
multi: (0, metadata_helpers_1.dMulti)(),
|
|
31
35
|
optionTemplate: (0, metadata_helpers_1.dComponent)(`This property enables the customization of list items. To access the attributes of ` +
|
|
@@ -48,7 +52,6 @@ exports.AutoCompleteMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
48
52
|
"particular option."),
|
|
49
53
|
},
|
|
50
54
|
themeVars: (0, themeVars_1.parseScssVar)(AutoComplete_module_scss_1.default.themeVars),
|
|
51
|
-
themeVarDescriptions: {},
|
|
52
55
|
defaultThemeVars: {
|
|
53
56
|
[`backgroundColor-menu-${COMP}`]: "$backgroundColor-primary",
|
|
54
57
|
[`boxShadow-menu-${COMP}`]: "$boxShadow-md",
|
|
@@ -70,7 +73,7 @@ exports.AutoCompleteMd = (0, ComponentDefs_1.createMetadata)({
|
|
|
70
73
|
},
|
|
71
74
|
});
|
|
72
75
|
exports.autoCompleteComponentRenderer = (0, renderers_1.createComponentRenderer)(COMP, exports.AutoCompleteMd, ({ node, state, updateState, extractValue, renderChild, lookupEventHandler, layoutCss, registerComponentApi, }) => {
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(AutoCompleteNative_1.AutoComplete, { multi: extractValue.asOptionalBoolean(node.props.multi), style: layoutCss, updateState: updateState, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), optionRenderer: node.props.optionTemplate
|
|
76
|
+
return ((0, jsx_runtime_1.jsx)(AutoCompleteNative_1.AutoComplete, { multi: extractValue.asOptionalBoolean(node.props.multi), style: layoutCss, updateState: updateState, initialValue: extractValue(node.props.initialValue), value: state === null || state === void 0 ? void 0 : state.value, label: extractValue(node.props.label), labelPosition: extractValue(node.props.labelPosition), labelWidth: extractValue(node.props.labelWidth), labelBreak: extractValue.asOptionalBoolean(node.props.labelBreak), autoFocus: extractValue.asOptionalBoolean(node.props.autoFocus), enabled: extractValue.asOptionalBoolean(node.props.enabled), placeholder: extractValue.asOptionalString(node.props.placeholder), validationStatus: extractValue(node.props.validationStatus), onDidChange: lookupEventHandler("didChange"), onFocus: lookupEventHandler("gotFocus"), onBlur: lookupEventHandler("lostFocus"), registerComponentApi: registerComponentApi, emptyListTemplate: renderChild(node.props.emptyListTemplate), dropdownHeight: extractValue(node.props.dropdownHeight), optionRenderer: node.props.optionTemplate
|
|
74
77
|
? (item) => {
|
|
75
78
|
return ((0, jsx_runtime_1.jsx)(container_helpers_1.MemoizedItem, { node: node.props.optionTemplate, item: item, renderChild: renderChild }));
|
|
76
79
|
}
|
|
@@ -35,6 +35,8 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete({ id, initi
|
|
|
35
35
|
const { root } = (0, ThemeContext_1.useTheme)();
|
|
36
36
|
const [width, setWidth] = (0, react_1.useState)(0);
|
|
37
37
|
const observer = (0, react_1.useRef)();
|
|
38
|
+
const generatedId = (0, react_1.useId)();
|
|
39
|
+
const inputId = id || generatedId;
|
|
38
40
|
// Set initial state based on the initialValue prop
|
|
39
41
|
(0, react_1.useEffect)(() => {
|
|
40
42
|
if (initialValue !== undefined) {
|
|
@@ -79,7 +81,8 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete({ id, initi
|
|
|
79
81
|
(0, react_1.useEffect)(() => {
|
|
80
82
|
var _a;
|
|
81
83
|
if (!multi) {
|
|
82
|
-
|
|
84
|
+
const label = (_a = Array.from(options).find((o) => o.value === value)) === null || _a === void 0 ? void 0 : _a.label;
|
|
85
|
+
setInputValue(label ? label + "" : "");
|
|
83
86
|
}
|
|
84
87
|
}, [multi, options, value]);
|
|
85
88
|
// Clear selected value
|
|
@@ -154,17 +157,17 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete({ id, initi
|
|
|
154
157
|
setOpen,
|
|
155
158
|
};
|
|
156
159
|
}, [inputValue, multi, optionRenderer, options, toggleOption, value, open, setOpen]);
|
|
157
|
-
return ((0, jsx_runtime_1.jsx)(AutoCompleteContext_1.AutoCompleteContext.Provider, { value: autoCompleteContextValue, children: (0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: SelectNative_1.HiddenOption, children: (0, jsx_runtime_1.jsxs)(OptionContext_1.OptionContext.Provider, { value: optionContextValue, children: [children, (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(react_popover_1.Popover, { open: open, children: (0, jsx_runtime_1.jsxs)(cmdk_1.Command, { ref: dropdownRef, className: AutoComplete_module_scss_1.default.command, filter: (value, search, keywords) => {
|
|
160
|
+
return ((0, jsx_runtime_1.jsx)(AutoCompleteContext_1.AutoCompleteContext.Provider, { value: autoCompleteContextValue, children: (0, jsx_runtime_1.jsx)(OptionTypeProvider_1.default, { Component: SelectNative_1.HiddenOption, children: (0, jsx_runtime_1.jsxs)(OptionContext_1.OptionContext.Provider, { value: optionContextValue, children: [children, (0, jsx_runtime_1.jsx)(ItemWithLabel_1.ItemWithLabel, { id: inputId, ref: forwardedRef, labelPosition: labelPosition, label: label, labelWidth: labelWidth, labelBreak: labelBreak, required: required, enabled: enabled, onFocus: onFocus, onBlur: onBlur, style: style, children: (0, jsx_runtime_1.jsx)(react_popover_1.Popover, { open: open, children: (0, jsx_runtime_1.jsxs)(cmdk_1.Command, { ref: dropdownRef, className: AutoComplete_module_scss_1.default.command, filter: (value, search, keywords) => {
|
|
158
161
|
const extendedValue = value + " " + keywords.join(" ");
|
|
159
162
|
if (extendedValue.toLowerCase().includes(search.toLowerCase()))
|
|
160
163
|
return 1;
|
|
161
164
|
return 0;
|
|
162
|
-
}, children: [(0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { style: { width: "100%" },
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
165
|
+
}, children: [(0, jsx_runtime_1.jsx)(react_popover_1.PopoverTrigger, { style: { width: "100%" }, id: inputId, onClick: () => {
|
|
166
|
+
var _a;
|
|
167
|
+
if (!enabled)
|
|
168
|
+
return;
|
|
169
|
+
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
170
|
+
}, children: (0, jsx_runtime_1.jsxs)("div", { ref: setReferenceElement, style: style, className: (0, classnames_1.default)(AutoComplete_module_scss_1.default.badgeListWrapper, AutoComplete_module_scss_1.default[validationStatus], {
|
|
168
171
|
[AutoComplete_module_scss_1.default.disabled]: !enabled,
|
|
169
172
|
[AutoComplete_module_scss_1.default.focused]: document.activeElement === inputRef.current,
|
|
170
173
|
}), children: [multi ? ((0, jsx_runtime_1.jsxs)("div", { className: AutoComplete_module_scss_1.default.badgeList, children: [Array.isArray(value) &&
|
|
@@ -192,10 +195,10 @@ exports.AutoComplete = (0, react_1.forwardRef)(function AutoComplete({ id, initi
|
|
|
192
195
|
}, onBlur: () => {
|
|
193
196
|
setOpen(false);
|
|
194
197
|
onBlur();
|
|
195
|
-
}, placeholder: placeholder, className: AutoComplete_module_scss_1.default.commandInput })), (0, jsx_runtime_1.jsxs)("div", { className: AutoComplete_module_scss_1.default.actions, children: [(value === null || value === void 0 ? void 0 : value.length) > 0 && enabled && ((0, jsx_runtime_1.jsx)("
|
|
198
|
+
}, placeholder: placeholder, className: AutoComplete_module_scss_1.default.commandInput })), (0, jsx_runtime_1.jsxs)("div", { className: AutoComplete_module_scss_1.default.actions, children: [(value === null || value === void 0 ? void 0 : value.length) > 0 && enabled && ((0, jsx_runtime_1.jsx)("span", { onClick: (event) => {
|
|
196
199
|
event.stopPropagation();
|
|
197
200
|
clearValue();
|
|
198
|
-
}, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close" }) })), (0, jsx_runtime_1.jsx)("
|
|
201
|
+
}, children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "close" }) })), (0, jsx_runtime_1.jsx)("span", { onClick: () => setOpen(true), children: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "chevrondown" }) })] })] }) }), open && ((0, jsx_runtime_1.jsx)(react_popover_1.Portal, { container: root, children: (0, jsx_runtime_1.jsx)(react_popover_1.PopoverContent, { asChild: true, style: { width, height: dropdownHeight }, className: AutoComplete_module_scss_1.default.popoverContent, align: "start", onOpenAutoFocus: (e) => e.preventDefault(), children: (0, jsx_runtime_1.jsxs)(cmdk_1.CommandList, { className: AutoComplete_module_scss_1.default.commandList, onMouseUp: () => {
|
|
199
202
|
var _a;
|
|
200
203
|
(_a = inputRef === null || inputRef === void 0 ? void 0 : inputRef.current) === null || _a === void 0 ? void 0 : _a.focus();
|
|
201
204
|
}, style: { height: dropdownHeight }, children: [(0, jsx_runtime_1.jsx)(cmdk_1.CommandEmpty, { children: emptyListNode }), (0, jsx_runtime_1.jsx)(CreatableItem, {}), (0, jsx_runtime_1.jsx)(cmdk_1.CommandGroup, { children: Array.from(options).map(({ value, label, enabled, keywords, labelText }) => ((0, jsx_runtime_1.jsx)(AutoCompleteOption, { value: value, label: label, enabled: enabled, keywords: keywords, labelText: labelText }, value))) })] }) }) }))] }) }) })] }) }) }));
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
exports.Bookmark = exports.defaultProps = void 0;
|
|
4
7
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
8
|
const react_1 = require("react");
|
|
6
9
|
const TableOfContentsContext_1 = require("../../components-core/TableOfContentsContext");
|
|
10
|
+
const Bookmark_module_scss_1 = __importDefault(require("./Bookmark.module.scss"));
|
|
7
11
|
exports.defaultProps = {
|
|
8
12
|
level: 1,
|
|
9
13
|
omitFromToc: false,
|
|
@@ -24,6 +28,6 @@ const Bookmark = ({ uid, level = exports.defaultProps.level, children, title, om
|
|
|
24
28
|
});
|
|
25
29
|
}
|
|
26
30
|
}, [uid, observeIntersection, registerHeading, level, title, omitFromToc]);
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)("span", { ref: elementRef, id: uid, "data-anchor": true, children: children }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)("span", { ref: elementRef, id: uid, "data-anchor": true, className: Bookmark_module_scss_1.default.anchorRef, children: children }));
|
|
28
32
|
};
|
|
29
33
|
exports.Bookmark = Bookmark;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.codeBlockComponentRenderer = exports.CodeBlockMd = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const CodeBlock_module_scss_1 = __importDefault(require("./CodeBlock.module.scss"));
|
|
9
|
+
const ComponentDefs_1 = require("../../abstractions/ComponentDefs");
|
|
10
|
+
const renderers_1 = require("../../components-core/renderers");
|
|
11
|
+
const themeVars_1 = require("../../components-core/theming/themeVars");
|
|
12
|
+
const CodeBlockNative_1 = require("./CodeBlockNative");
|
|
13
|
+
const COMP = "CodeBlock";
|
|
14
|
+
exports.CodeBlockMd = (0, ComponentDefs_1.createMetadata)({
|
|
15
|
+
description: `The \`${COMP}\` component displays code with optional syntax highlighting and meta information.`,
|
|
16
|
+
props: {},
|
|
17
|
+
themeVars: (0, themeVars_1.parseScssVar)(CodeBlock_module_scss_1.default.themeVars),
|
|
18
|
+
defaultThemeVars: {
|
|
19
|
+
"backgroundColor-CodeBlock": "$color-surface-100",
|
|
20
|
+
"backgroundColor-CodeBlock-header": "$color-primary-100",
|
|
21
|
+
//"borderLeft-CodeBlock": "$color-surface-300 2px solid",
|
|
22
|
+
"marginTop-CodeBlock": "$space-5",
|
|
23
|
+
"marginBottom-CodeBlock": "$space-5",
|
|
24
|
+
dark: {
|
|
25
|
+
"backgroundColor-CodeBlock-header": "$color-primary-200",
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
exports.codeBlockComponentRenderer = (0, renderers_1.createComponentRenderer)("CodeBlock", exports.CodeBlockMd, ({ node, extractValue, renderChild, layoutCss }) => {
|
|
30
|
+
return ((0, jsx_runtime_1.jsx)(CodeBlockNative_1.CodeBlock, { style: layoutCss, children: renderChild(node.children) }));
|
|
31
|
+
});
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.CodeBlock = CodeBlock;
|
|
7
|
+
exports.markdownCodeBlockParser = markdownCodeBlockParser;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const CodeBlock_module_scss_1 = __importDefault(require("./CodeBlock.module.scss"));
|
|
10
|
+
const TextNative_1 = require("../Text/TextNative");
|
|
11
|
+
const highlight_code_1 = require("../Markdown/highlight-code");
|
|
12
|
+
const ButtonNative_1 = require("../Button/ButtonNative");
|
|
13
|
+
const IconNative_1 = __importDefault(require("../Icon/IconNative"));
|
|
14
|
+
const react_hot_toast_1 = __importDefault(require("react-hot-toast"));
|
|
15
|
+
const unist_util_visit_1 = require("unist-util-visit");
|
|
16
|
+
function CodeBlock({ children, meta, textToCopy, style }) {
|
|
17
|
+
if (!meta) {
|
|
18
|
+
return (0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: children });
|
|
19
|
+
}
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlock, style: style, children: [meta.filename && ((0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockHeader, children: (0, jsx_runtime_1.jsx)(TextNative_1.Text, { variant: "em", children: meta.filename }) })), (0, jsx_runtime_1.jsxs)("div", { className: CodeBlock_module_scss_1.default.codeBlockCopyWrapper, children: [children, (0, jsx_runtime_1.jsx)("div", { className: CodeBlock_module_scss_1.default.codeBlockCopyButton, children: (0, jsx_runtime_1.jsx)(ButtonNative_1.Button, { variant: "outlined", themeColor: "primary", size: "sm", icon: (0, jsx_runtime_1.jsx)(IconNative_1.default, { name: "copy", "aria-hidden": true }), onClick: () => {
|
|
21
|
+
if (!textToCopy)
|
|
22
|
+
return;
|
|
23
|
+
navigator.clipboard.writeText(textToCopy);
|
|
24
|
+
react_hot_toast_1.default.success("Code copied!");
|
|
25
|
+
} }) })] })] }));
|
|
26
|
+
}
|
|
27
|
+
function markdownCodeBlockParser() {
|
|
28
|
+
return function transformer(tree) {
|
|
29
|
+
(0, unist_util_visit_1.visit)(tree, "code", visitor);
|
|
30
|
+
};
|
|
31
|
+
function visitor(node, _, parent) {
|
|
32
|
+
var _a;
|
|
33
|
+
const { lang, meta } = node;
|
|
34
|
+
const nodeData = { hProperties: {} };
|
|
35
|
+
if (lang !== null) {
|
|
36
|
+
nodeData.hProperties["dataLanguage"] = lang;
|
|
37
|
+
node.data = nodeData;
|
|
38
|
+
}
|
|
39
|
+
if (!parent)
|
|
40
|
+
return;
|
|
41
|
+
if (!meta)
|
|
42
|
+
return;
|
|
43
|
+
const params = (_a = splitter(meta)) === null || _a === void 0 ? void 0 : _a.filter((s) => s !== "").map((s) => s.trim());
|
|
44
|
+
if (!params)
|
|
45
|
+
return;
|
|
46
|
+
if (params.length === 0)
|
|
47
|
+
return;
|
|
48
|
+
const parsedMeta = params.reduce((acc, item) => {
|
|
49
|
+
item = item.trim();
|
|
50
|
+
if (item === "")
|
|
51
|
+
return acc;
|
|
52
|
+
if (item.indexOf("=") === -1) {
|
|
53
|
+
if (item.startsWith("/") && item.endsWith("/")) {
|
|
54
|
+
acc[highlight_code_1.CodeHighlighterMetaKeys.highlightSubstrings.data] = item.substring(1, item.length - 1);
|
|
55
|
+
}
|
|
56
|
+
if (item.startsWith("{") && item.endsWith("}")) {
|
|
57
|
+
acc[highlight_code_1.CodeHighlighterMetaKeys.highlightRows.data] = item.substring(1, item.length - 1);
|
|
58
|
+
}
|
|
59
|
+
if (item === "copy") {
|
|
60
|
+
acc[highlight_code_1.CodeHighlighterMetaKeys.copy.data] = "true";
|
|
61
|
+
}
|
|
62
|
+
if (item === "rowNumbers") {
|
|
63
|
+
acc[highlight_code_1.CodeHighlighterMetaKeys.rowNumbers.data] = "true";
|
|
64
|
+
}
|
|
65
|
+
return acc;
|
|
66
|
+
}
|
|
67
|
+
const index = item.indexOf("=");
|
|
68
|
+
if (item.substring(0, index) !== "filename")
|
|
69
|
+
return acc;
|
|
70
|
+
acc["dataFilename"] = item
|
|
71
|
+
.substring(index + 1)
|
|
72
|
+
.replace(/"(.+)"/, "$1")
|
|
73
|
+
.replace(/'(.+)'/, "$1");
|
|
74
|
+
return acc;
|
|
75
|
+
}, {});
|
|
76
|
+
nodeData.hProperties = Object.assign(Object.assign({}, nodeData.hProperties), parsedMeta);
|
|
77
|
+
node.data = nodeData;
|
|
78
|
+
}
|
|
79
|
+
function splitter(str) {
|
|
80
|
+
return str.match(/(?:("|')[^"']*\1|\{[^{}]*\}|\/.*?\/|[^\s"'{}/])+/g);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -98,6 +98,8 @@ const HtmlTags_1 = require("./HtmlTags/HtmlTags");
|
|
|
98
98
|
const ColorPicker_1 = require("./ColorPicker/ColorPicker");
|
|
99
99
|
const RadioItem_1 = require("./RadioGroup/RadioItem");
|
|
100
100
|
const InspectButton_1 = require("./InspectButton/InspectButton");
|
|
101
|
+
const NestedApp_1 = require("./NestedApp/NestedApp");
|
|
102
|
+
const CodeBlock_1 = require("./CodeBlock/CodeBlock");
|
|
101
103
|
/**
|
|
102
104
|
* The framework has a specialized component concept, the "property holder
|
|
103
105
|
* component." These components only hold property values but do not render
|
|
@@ -376,6 +378,7 @@ class ComponentRegistry {
|
|
|
376
378
|
this.registerCoreComponent(Bookmark_1.bookmarkComponentRenderer);
|
|
377
379
|
this.registerCoreComponent(TableOfContents_1.tableOfContentsRenderer);
|
|
378
380
|
this.registerCoreComponent(Breakout_1.breakoutComponentRenderer);
|
|
381
|
+
this.registerCoreComponent(CodeBlock_1.codeBlockComponentRenderer);
|
|
379
382
|
}
|
|
380
383
|
this.registerCoreComponent(Theme_1.themeComponentRenderer);
|
|
381
384
|
this.registerCoreComponent(AppState_1.appStateComponentRenderer);
|
|
@@ -485,6 +488,8 @@ class ComponentRegistry {
|
|
|
485
488
|
this.registerCoreComponent(HtmlTags_1.htmlVarTagRenderer);
|
|
486
489
|
this.registerCoreComponent(HtmlTags_1.htmlVideoTagRenderer);
|
|
487
490
|
this.registerCoreComponent(HtmlTags_1.htmlWbrTagRenderer);
|
|
491
|
+
// --- Nested app and related components
|
|
492
|
+
this.registerCoreComponent(NestedApp_1.nestedAppComponentRenderer);
|
|
488
493
|
this.registerActionFn(APICall_1.apiAction);
|
|
489
494
|
this.registerActionFn(FileDownloadAction_1.downloadAction);
|
|
490
495
|
this.registerActionFn(FileUploadAction_1.uploadAction);
|
|
@@ -49,6 +49,7 @@ const ThemeContext_1 = require("../../components-core/theming/ThemeContext");
|
|
|
49
49
|
const constants_1 = require("../../components-core/constants");
|
|
50
50
|
const misc_1 = require("../../components-core/utils/misc");
|
|
51
51
|
const InputAdornment_1 = require("../Input/InputAdornment");
|
|
52
|
+
require("react-day-picker/dist/style.css");
|
|
52
53
|
exports.DatePickerModeValues = ["single", "range"];
|
|
53
54
|
var WeekDays;
|
|
54
55
|
(function (WeekDays) {
|