frappe-ui 1.0.2 → 1.2.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.
- package/experimental/Calendar/CalendarEventRow.vue +0 -4
- package/experimental/Calendar/calendarUtils.ts +33 -21
- package/experimental/CommandPalette/CommandPaletteItem.vue +9 -1
- package/experimental/MultiEmailInput/MultiEmailInput.vue +64 -12
- package/experimental/MultiEmailInput/types.ts +12 -3
- package/experimental/SpriteIcons/IconPicker.vue +2 -1
- package/experimental/Stepper/StepIndicator.vue +129 -0
- package/experimental/Stepper/Stepper.api.md +117 -0
- package/experimental/Stepper/Stepper.md +95 -0
- package/experimental/Stepper/Stepper.vue +82 -0
- package/experimental/Stepper/StepperHorizontal.vue +93 -0
- package/experimental/Stepper/StepperVertical.vue +291 -0
- package/experimental/Stepper/index.ts +11 -0
- package/experimental/Stepper/resolve.ts +87 -0
- package/experimental/Stepper/types.ts +89 -0
- package/experimental.ts +2 -21
- package/package.json +1 -3
- package/src/charts/CalendarHeatmapChart.vue +353 -0
- package/src/charts/DonutChart.vue +34 -58
- package/src/charts/HeatmapChart.vue +26 -64
- package/src/charts/NumberCard.vue +62 -7
- package/src/charts/PercentageBarChart.vue +243 -0
- package/src/charts/SankeyChart.vue +14 -11
- package/src/charts/ScatterChart.vue +24 -20
- package/src/charts/axisChartCommon.ts +182 -18
- package/src/charts/axisFormat.ts +8 -3
- package/src/charts/calendarHeatmapOptions.ts +604 -0
- package/src/charts/colorMath.ts +26 -0
- package/src/charts/components/ChartContainer.vue +63 -53
- package/src/charts/components/ChartLegend.vue +216 -24
- package/src/charts/components/ChartScale.vue +85 -0
- package/src/charts/core/dataLabelFit.ts +45 -6
- package/src/charts/core/useAxisChart.ts +36 -19
- package/src/charts/core/useChart.ts +6 -1
- package/src/charts/core/usePlotKeyboard.ts +13 -2
- package/src/charts/docs/BarChart.md +11 -3
- package/src/charts/docs/CalendarHeatmapChart.api.md +165 -0
- package/src/charts/docs/CalendarHeatmapChart.md +33 -0
- package/src/charts/docs/ChartContainer.api.md +6 -0
- package/src/charts/docs/ChartLegend.api.md +1 -1
- package/src/charts/docs/ChartLegend.md +25 -3
- package/src/charts/docs/DonutChart.api.md +12 -0
- package/src/charts/docs/DonutChart.md +17 -0
- package/src/charts/docs/HeatmapChart.api.md +1 -1
- package/src/charts/docs/LineChart.md +5 -3
- package/src/charts/docs/NumberCard.api.md +6 -0
- package/src/charts/docs/NumberCard.md +6 -0
- package/src/charts/docs/Overview.md +13 -6
- package/src/charts/docs/PercentageBarChart.api.md +148 -0
- package/src/charts/docs/PercentageBarChart.md +42 -0
- package/src/charts/docs/ScatterChart.md +2 -3
- package/src/charts/donutChartOptions.ts +22 -130
- package/src/charts/format.ts +4 -1
- package/src/charts/heatmapOptions.ts +17 -12
- package/src/charts/hiddenSeries.ts +8 -3
- package/src/charts/index.ts +12 -0
- package/src/charts/legendOverflow.ts +40 -0
- package/src/charts/numberCardFormat.ts +19 -13
- package/src/charts/referenceLines.ts +2 -1
- package/src/charts/scatterOptions.ts +16 -3
- package/src/charts/seriesData.ts +8 -3
- package/src/charts/slices.ts +228 -0
- package/src/charts/tokens.ts +99 -0
- package/src/charts/types.ts +318 -9
- package/src/components/Avatar/Avatar.md +27 -2
- package/src/components/Avatar/Avatar.vue +29 -12
- package/src/components/Breadcrumbs/Breadcrumbs.vue +2 -1
- package/src/components/Combobox/Combobox.vue +9 -2
- package/src/components/Combobox/ComboboxResults.vue +6 -1
- package/src/components/Combobox/utils.ts +2 -1
- package/src/components/DatePicker/DatePicker.md +7 -0
- package/src/components/DatePicker/DatePicker.vue +6 -0
- package/src/components/DatePicker/DateTimePicker.vue +6 -0
- package/src/components/DatePicker/composables.ts +18 -1
- package/src/components/DatePicker/utils.ts +53 -0
- package/src/components/Dialog/Dialog.md +3 -1
- package/src/components/Duration/Duration.api.md +16 -3
- package/src/components/Duration/Duration.md +21 -0
- package/src/components/Duration/Duration.vue +29 -8
- package/src/components/Duration/duration.ts +105 -44
- package/src/components/Duration/index.ts +1 -0
- package/src/components/Duration/types.ts +30 -1
- package/src/components/HoverCard/HoverCard.vue +21 -5
- package/src/components/Menu/utils.ts +3 -2
- package/src/components/MobileNav/MobileNavItem.vue +3 -22
- package/src/components/MultiSelect/MultiSelect.api.md +5 -0
- package/src/components/MultiSelect/MultiSelect.vue +34 -0
- package/src/components/MultiSelect/MultiSelectResults.vue +3 -4
- package/src/components/MultiSelect/types.ts +6 -0
- package/src/components/Select/Select.vue +4 -4
- package/src/components/Select/utils.ts +1 -0
- package/src/components/SettingsDialog/SettingsDialog.api.md +7 -2
- package/src/components/SettingsDialog/SettingsDialog.md +2 -1
- package/src/components/SettingsDialog/SettingsRow.vue +12 -2
- package/src/components/Sidebar/SidebarItem.vue +3 -33
- package/src/components/SidebarRail/SidebarRailItem.vue +4 -17
- package/src/components/Switch/Switch.vue +3 -3
- package/src/components/Tooltip/Tooltip.vue +8 -0
- package/src/components/shared/deferredTrigger.ts +174 -0
- package/src/components/shared/navLink.ts +45 -0
- package/src/components/shared/selection/utils.ts +8 -1
- package/src/data-fetching/useCall/useCall.ts +25 -26
- package/src/data-fetching/useFrappeFetch.ts +48 -2
- package/src/data-fetching/useList/useList.ts +11 -3
- package/src/data-fetching/utils.ts +15 -1
- package/src/molecules/editor/components/MediaNodeView.vue +10 -1
- package/src/molecules/editor/components/MediaResizeGuide.vue +71 -0
- package/src/molecules/editor/components/media-node-view-utils.ts +7 -0
- package/src/molecules/editor/composables/useNodeViewResize.ts +142 -10
- package/src/molecules/editor/extensions/attachment/attachment-engine.ts +1 -1
- package/src/molecules/editor/extensions/content-paste/paste-html-utils.ts +16 -6
- package/src/molecules/editor/extensions/iframe/IframeNodeView.vue +29 -10
- package/src/molecules/editor/extensions/iframe/iframe-allowlist.ts +35 -16
- package/src/molecules/editor/extensions/iframe/iframe-embed-utils.ts +1 -1
- package/src/molecules/editor/extensions/iframe/iframe-extension.ts +30 -30
- package/src/molecules/editor/extensions/link/LinkEditorPopup.vue +1 -1
- package/src/molecules/editor/extensions/link/link-paste-plugin.ts +1 -1
- package/src/molecules/editor/extensions/shared/media-upload-engine.ts +1 -1
- package/src/molecules/editor/useEditor.ts +12 -6
- package/src/molecules/list/ListRow.vue +8 -1
- package/src/utils/dialog.ts +57 -16
- package/src/{molecules/editor/extensions/shared → utils}/url-safety.ts +28 -16
- package/tailwind/content.js +1 -1
- package/tailwind/plugin.js +22 -0
- package/vite/README.md +5 -3
- package/vite/codeLanguages.js +41 -17
- package/vite/doctypeInterfaceGenerator.js +52 -39
- package/vitepress/index.node.ts +0 -2
- package/experimental/TextEditor/TextEditor.api.md +0 -161
- package/experimental/TextEditor/TextEditor.vue +0 -298
- package/experimental/TextEditor/classIcon.ts +0 -21
- package/experimental/TextEditor/commands.js +0 -344
- package/experimental/TextEditor/components/CodeBlockComponent.vue +0 -103
- package/experimental/TextEditor/components/FontColor.vue +0 -153
- package/experimental/TextEditor/components/ImageViewerModal.vue +0 -463
- package/experimental/TextEditor/components/InsertImage.vue +0 -54
- package/experimental/TextEditor/components/InsertLink.vue +0 -13
- package/experimental/TextEditor/components/InsertVideo.vue +0 -14
- package/experimental/TextEditor/components/LinkPopup.vue +0 -99
- package/experimental/TextEditor/components/MediaNodeView.vue +0 -398
- package/experimental/TextEditor/components/MentionList.vue +0 -95
- package/experimental/TextEditor/components/TextEditorBubbleMenu.vue +0 -78
- package/experimental/TextEditor/components/TextEditorFixedMenu.vue +0 -78
- package/experimental/TextEditor/components/TextEditorFloatingMenu.vue +0 -61
- package/experimental/TextEditor/components/TextEditorMenu.vue +0 -218
- package/experimental/TextEditor/components/index.js +0 -0
- package/experimental/TextEditor/extensions/code-block.ts +0 -119
- package/experimental/TextEditor/extensions/color/color-extension.ts +0 -140
- package/experimental/TextEditor/extensions/color/color-styles.css +0 -25
- package/experimental/TextEditor/extensions/color/index.ts +0 -2
- package/experimental/TextEditor/extensions/content-paste-extension.ts +0 -160
- package/experimental/TextEditor/extensions/copy-styles.ts +0 -160
- package/experimental/TextEditor/extensions/emoji/EmojiList.vue +0 -55
- package/experimental/TextEditor/extensions/emoji/emoji-extension.ts +0 -55
- package/experimental/TextEditor/extensions/emoji/emojis.json +0 -7422
- package/experimental/TextEditor/extensions/heading/heading.ts +0 -20
- package/experimental/TextEditor/extensions/highlight/highlight-extension.ts +0 -241
- package/experimental/TextEditor/extensions/highlight/highlight-styles.css +0 -31
- package/experimental/TextEditor/extensions/highlight/index.ts +0 -2
- package/experimental/TextEditor/extensions/iframe/IframeNodeView.vue +0 -308
- package/experimental/TextEditor/extensions/iframe/InsertIframe.vue +0 -209
- package/experimental/TextEditor/extensions/iframe/iframe-extension.ts +0 -404
- package/experimental/TextEditor/extensions/iframe/index.ts +0 -11
- package/experimental/TextEditor/extensions/iframe/utils.ts +0 -283
- package/experimental/TextEditor/extensions/image/image-extension.ts +0 -661
- package/experimental/TextEditor/extensions/image/index.ts +0 -5
- package/experimental/TextEditor/extensions/image-group/ImageGroupNodeView.vue +0 -182
- package/experimental/TextEditor/extensions/image-group/ImageGroupUploadDialog.vue +0 -740
- package/experimental/TextEditor/extensions/image-group/image-group-extension.ts +0 -187
- package/experimental/TextEditor/extensions/image-viewer-extension.ts +0 -162
- package/experimental/TextEditor/extensions/link/index.ts +0 -1
- package/experimental/TextEditor/extensions/link/link-extension.ts +0 -323
- package/experimental/TextEditor/extensions/link/linkPasteHandler.ts +0 -51
- package/experimental/TextEditor/extensions/mention/index.ts +0 -1
- package/experimental/TextEditor/extensions/mention/mention-extension.ts +0 -204
- package/experimental/TextEditor/extensions/mention/style.css +0 -11
- package/experimental/TextEditor/extensions/shared/color-utils.ts +0 -236
- package/experimental/TextEditor/extensions/slash-commands/SlashCommandsList.vue +0 -59
- package/experimental/TextEditor/extensions/slash-commands/slash-commands-extension.ts +0 -184
- package/experimental/TextEditor/extensions/suggestion/SuggestionList.vue +0 -130
- package/experimental/TextEditor/extensions/suggestion/createSuggestionExtension.ts +0 -151
- package/experimental/TextEditor/extensions/suggestion/index.ts +0 -5
- package/experimental/TextEditor/extensions/tag/index.ts +0 -1
- package/experimental/TextEditor/extensions/tag/tag-extension.ts +0 -170
- package/experimental/TextEditor/extensions/toc-node/TocNodeView.vue +0 -439
- package/experimental/TextEditor/extensions/toc-node/index.ts +0 -3
- package/experimental/TextEditor/extensions/toc-node/toc-node-extension.ts +0 -167
- package/experimental/TextEditor/extensions/video-extension.ts +0 -653
- package/experimental/TextEditor/hljs-github.css +0 -197
- package/experimental/TextEditor/index.ts +0 -21
- package/experimental/TextEditor/style.css +0 -190
- package/experimental/TextEditor/types.ts +0 -72
- package/experimental/TextEditor/utils.js +0 -11
- package/src/utils/url-validation.ts +0 -39
package/vite/README.md
CHANGED
|
@@ -241,9 +241,11 @@ Error during dependency optimization:
|
|
|
241
241
|
|
|
242
242
|
The plugin replaces an absent package with a stub that throws when
|
|
243
243
|
`loadLanguage` reaches it. It covers both paths: a Rollup `resolveId` hook for
|
|
244
|
-
the build, and
|
|
245
|
-
|
|
246
|
-
|
|
244
|
+
the build, and a twin for dependency pre-bundling, which runs no user plugin
|
|
245
|
+
hooks. On Vite 8 the twin goes through `optimizeDeps.rolldownOptions.plugins`;
|
|
246
|
+
on older Vite it is an esbuild plugin through
|
|
247
|
+
`optimizeDeps.esbuildOptions.plugins`. The build and the dev server both
|
|
248
|
+
succeed, and the error names the package to install:
|
|
247
249
|
|
|
248
250
|
```
|
|
249
251
|
[frappe-ui] loadLanguage('sql') could not load @codemirror/lang-sql: Cannot find module '@codemirror/lang-sql'. If it is not installed: yarn add @codemirror/lang-sql
|
package/vite/codeLanguages.js
CHANGED
|
@@ -25,18 +25,23 @@
|
|
|
25
25
|
*
|
|
26
26
|
* The same job has to be done twice. `resolveId` covers the Rollup graph, which
|
|
27
27
|
* is the production build and every dev request the server transforms. It
|
|
28
|
-
* cannot cover Vite's dependency pre-bundling: that step is
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
* server exits:
|
|
28
|
+
* cannot cover Vite's dependency pre-bundling: that step is a separate esbuild
|
|
29
|
+
* or Rolldown build, and it runs no user plugin hooks. `frappe-ui` is a bare
|
|
30
|
+
* specifier, so `frappe-ui/code-editor` is pre-bundled, and an absent language
|
|
31
|
+
* there does not degrade. Before Vite 8, esbuild fails the optimize step and
|
|
32
|
+
* the dev server exits:
|
|
33
33
|
*
|
|
34
34
|
* Error during dependency optimization:
|
|
35
35
|
* ✘ [ERROR] Could not resolve "@codemirror/lang-json"
|
|
36
36
|
*
|
|
37
|
-
* So the plugin also
|
|
38
|
-
*
|
|
39
|
-
*
|
|
37
|
+
* So the plugin also hands the optimizer a twin. Vite 8 pre-bundles with
|
|
38
|
+
* Rolldown, which runs Rollup-style hooks, so the twin there is the same
|
|
39
|
+
* `resolveId` and `load` through `optimizeDeps.rolldownOptions.plugins`. Older
|
|
40
|
+
* Vite pre-bundles with esbuild, so the twin there does the same
|
|
41
|
+
* resolve-then-stub with esbuild's hooks through
|
|
42
|
+
* `optimizeDeps.esbuildOptions.plugins`. Vite 8 only imitates part of
|
|
43
|
+
* esbuild's plugin API, and the esbuild twin needs the parts it leaves out, so
|
|
44
|
+
* each Vite gets its own.
|
|
40
45
|
*/
|
|
41
46
|
|
|
42
47
|
import { dirname, join } from 'node:path'
|
|
@@ -85,6 +90,31 @@ function moduleKey(id) {
|
|
|
85
90
|
}
|
|
86
91
|
|
|
87
92
|
export function codeLanguages() {
|
|
93
|
+
return {
|
|
94
|
+
...stubPlugin(),
|
|
95
|
+
// `pre`, so the hook runs before Vite's resolver and can ask for it by
|
|
96
|
+
// hand. `this.resolve` reports the absence instead of throwing it.
|
|
97
|
+
enforce: 'pre',
|
|
98
|
+
|
|
99
|
+
config() {
|
|
100
|
+
// Vite 8 and rolldown-vite set `rolldownVersion`; esbuild Vite does not.
|
|
101
|
+
if (this?.meta?.rolldownVersion) {
|
|
102
|
+
return {
|
|
103
|
+
optimizeDeps: { rolldownOptions: { plugins: [stubPlugin()] } },
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { optimizeDeps: { esbuildOptions: { plugins: [esbuildTwin()] } } }
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Stub a language package that does not resolve, but only for frappe-ui's own
|
|
113
|
+
* `languages` module. Rollup and Rolldown share these hooks, so Vite 8's
|
|
114
|
+
* pre-bundling reuses them. It gets its own copy because `languagesModule` is
|
|
115
|
+
* cached per build.
|
|
116
|
+
*/
|
|
117
|
+
function stubPlugin() {
|
|
88
118
|
// `frappe-ui/code-editor`'s own directory, resolved once per build. A path
|
|
89
119
|
// test would be wrong: an app is free to keep its own
|
|
90
120
|
// `src/code-editor/languages.ts`, and stubbing a package that file needs
|
|
@@ -111,9 +141,6 @@ export function codeLanguages() {
|
|
|
111
141
|
|
|
112
142
|
return {
|
|
113
143
|
name: 'frappeui-code-languages',
|
|
114
|
-
// `pre`, so the hook runs before Vite's resolver and can ask for it by
|
|
115
|
-
// hand. `this.resolve` reports the absence instead of throwing it.
|
|
116
|
-
enforce: 'pre',
|
|
117
144
|
|
|
118
145
|
buildStart() {
|
|
119
146
|
languagesModule = null
|
|
@@ -138,16 +165,13 @@ export function codeLanguages() {
|
|
|
138
165
|
if (!id.startsWith(VIRTUAL_PREFIX)) return null
|
|
139
166
|
return stub(id.slice(VIRTUAL_PREFIX.length))
|
|
140
167
|
},
|
|
141
|
-
|
|
142
|
-
config() {
|
|
143
|
-
return { optimizeDeps: { esbuildOptions: { plugins: [esbuildTwin()] } } }
|
|
144
|
-
},
|
|
145
168
|
}
|
|
146
169
|
}
|
|
147
170
|
|
|
148
171
|
/**
|
|
149
|
-
* The pre-bundling half. Same rule, esbuild's hooks: stub a
|
|
150
|
-
* that does not resolve, but only for frappe-ui's own
|
|
172
|
+
* The pre-bundling half before Vite 8. Same rule, esbuild's hooks: stub a
|
|
173
|
+
* language package that does not resolve, but only for frappe-ui's own
|
|
174
|
+
* `languages` module.
|
|
151
175
|
*/
|
|
152
176
|
function esbuildTwin() {
|
|
153
177
|
return {
|
|
@@ -9,7 +9,7 @@ export class DocTypeInterfaceGenerator {
|
|
|
9
9
|
this.processedDoctypes = new Set()
|
|
10
10
|
this.existingInterfaces = {}
|
|
11
11
|
this.updatedInterfaces = 0
|
|
12
|
-
this.
|
|
12
|
+
this.doctypeFiles = new Map()
|
|
13
13
|
this.summary = {
|
|
14
14
|
processed: 0,
|
|
15
15
|
updated: 0,
|
|
@@ -194,45 +194,15 @@ export class DocTypeInterfaceGenerator {
|
|
|
194
194
|
}
|
|
195
195
|
|
|
196
196
|
async findJsonFile(appName, doctypeName) {
|
|
197
|
-
|
|
198
|
-
if (this.
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
'doctype',
|
|
204
|
-
doctypeName,
|
|
205
|
-
`${doctypeName}.json`,
|
|
206
|
-
)
|
|
207
|
-
let foundPath = null
|
|
208
|
-
|
|
209
|
-
const searchDirectory = async (directory) => {
|
|
210
|
-
const files = await fs.readdir(directory)
|
|
211
|
-
for (const file of files) {
|
|
212
|
-
const fullPath = path.join(directory, file)
|
|
213
|
-
try {
|
|
214
|
-
const stat = await fs.stat(fullPath)
|
|
215
|
-
if (stat.isDirectory()) {
|
|
216
|
-
await searchDirectory(fullPath)
|
|
217
|
-
} else if (fullPath.endsWith(targetPattern)) {
|
|
218
|
-
foundPath = fullPath
|
|
219
|
-
return
|
|
220
|
-
}
|
|
221
|
-
} catch (error) {
|
|
222
|
-
// Skip files/directories that can't be accessed (e.g., broken symlinks, permission denied)
|
|
223
|
-
if (error.code === 'ENOENT' || error.code === 'EACCES') {
|
|
224
|
-
continue
|
|
225
|
-
}
|
|
226
|
-
// Re-throw other unexpected errors
|
|
227
|
-
throw error
|
|
228
|
-
}
|
|
229
|
-
}
|
|
197
|
+
// Store the promise so parallel lookups share one walk of the app.
|
|
198
|
+
if (!this.doctypeFiles.has(appName)) {
|
|
199
|
+
this.doctypeFiles.set(
|
|
200
|
+
appName,
|
|
201
|
+
findDoctypeFiles(path.join(this.appsPath, appName)),
|
|
202
|
+
)
|
|
230
203
|
}
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
this.jsonFileCache.set(cacheKey, foundPath)
|
|
235
|
-
return foundPath
|
|
204
|
+
const files = await this.doctypeFiles.get(appName)
|
|
205
|
+
return files.get(doctypeName) ?? null
|
|
236
206
|
}
|
|
237
207
|
|
|
238
208
|
generateBaseInterfaces() {
|
|
@@ -253,3 +223,46 @@ export class DocTypeInterfaceGenerator {
|
|
|
253
223
|
`
|
|
254
224
|
}
|
|
255
225
|
}
|
|
226
|
+
|
|
227
|
+
// node_modules and dot folders hold no doctypes but can be most of an app's
|
|
228
|
+
// tree, so the walk skips them.
|
|
229
|
+
const SKIPPED_FOLDERS = /^(node_modules$|\.)/
|
|
230
|
+
|
|
231
|
+
// Maps each doctype name to its `doctype/<name>/<name>.json` file in the app.
|
|
232
|
+
async function findDoctypeFiles(appPath) {
|
|
233
|
+
const files = new Map()
|
|
234
|
+
|
|
235
|
+
const walk = async (directory) => {
|
|
236
|
+
let entries
|
|
237
|
+
try {
|
|
238
|
+
entries = await fs.readdir(directory, { withFileTypes: true })
|
|
239
|
+
} catch (error) {
|
|
240
|
+
if (error.code === 'ENOENT' || error.code === 'EACCES') {
|
|
241
|
+
return
|
|
242
|
+
}
|
|
243
|
+
throw error
|
|
244
|
+
}
|
|
245
|
+
for (const entry of entries) {
|
|
246
|
+
const fullPath = path.join(directory, entry.name)
|
|
247
|
+
if (entry.isDirectory() && !SKIPPED_FOLDERS.test(entry.name)) {
|
|
248
|
+
await walk(fullPath)
|
|
249
|
+
} else if (
|
|
250
|
+
isDoctypeFile(fullPath) &&
|
|
251
|
+
!files.has(path.basename(directory))
|
|
252
|
+
) {
|
|
253
|
+
files.set(path.basename(directory), fullPath)
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
await walk(appPath)
|
|
259
|
+
return files
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
function isDoctypeFile(filePath) {
|
|
263
|
+
const doctypeFolder = path.dirname(filePath)
|
|
264
|
+
return (
|
|
265
|
+
path.basename(filePath) === `${path.basename(doctypeFolder)}.json` &&
|
|
266
|
+
path.basename(path.dirname(doctypeFolder)) === 'doctype'
|
|
267
|
+
)
|
|
268
|
+
}
|
package/vitepress/index.node.ts
CHANGED
|
@@ -1,161 +0,0 @@
|
|
|
1
|
-
<!-- Auto Generated by scripts/propsgen.ts -->
|
|
2
|
-
<script setup>
|
|
3
|
-
import PropsTable from '@/components/Docs/PropsTable.vue'
|
|
4
|
-
import SlotsTable from '@/components/Docs/SlotsTable.vue'
|
|
5
|
-
import EmitsTable from '@/components/Docs/EmitsTable.vue'
|
|
6
|
-
|
|
7
|
-
const propsData = [
|
|
8
|
-
{
|
|
9
|
-
name: 'content',
|
|
10
|
-
description: 'Initial editor content (HTML/string). `null` renders an empty editor',
|
|
11
|
-
required: false,
|
|
12
|
-
type: 'string | null',
|
|
13
|
-
default: 'null'
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
name: 'placeholder',
|
|
17
|
-
description: 'Placeholder text or dynamic placeholder resolver',
|
|
18
|
-
required: false,
|
|
19
|
-
type: 'string | (() => string)',
|
|
20
|
-
default: '""'
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
name: 'editorClass',
|
|
24
|
-
description: 'Custom classes applied to the editor root',
|
|
25
|
-
required: false,
|
|
26
|
-
type: 'string | string[] | object',
|
|
27
|
-
default: '"prose-sm"'
|
|
28
|
-
},
|
|
29
|
-
{
|
|
30
|
-
name: 'editable',
|
|
31
|
-
description: 'Toggles editability of the editor',
|
|
32
|
-
required: false,
|
|
33
|
-
type: 'boolean',
|
|
34
|
-
default: 'true'
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
name: 'autofocus',
|
|
38
|
-
description: 'Autofocus the editor on mount',
|
|
39
|
-
required: false,
|
|
40
|
-
type: 'boolean',
|
|
41
|
-
default: 'false'
|
|
42
|
-
},
|
|
43
|
-
{
|
|
44
|
-
name: 'bubbleMenu',
|
|
45
|
-
description: 'Enables bubble menu or provides custom bubble menu items',
|
|
46
|
-
required: false,
|
|
47
|
-
type: 'boolean | any[]',
|
|
48
|
-
default: 'false'
|
|
49
|
-
},
|
|
50
|
-
{
|
|
51
|
-
name: 'bubbleMenuOptions',
|
|
52
|
-
description: 'Configuration options for the bubble menu',
|
|
53
|
-
required: false,
|
|
54
|
-
type: 'object',
|
|
55
|
-
default: '{}'
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
name: 'fixedMenu',
|
|
59
|
-
description: 'Enables fixed menu or provides custom fixed menu items',
|
|
60
|
-
required: false,
|
|
61
|
-
type: 'boolean | any[]',
|
|
62
|
-
default: 'false'
|
|
63
|
-
},
|
|
64
|
-
{
|
|
65
|
-
name: 'floatingMenu',
|
|
66
|
-
description: 'Enables floating menu or provides custom floating menu items',
|
|
67
|
-
required: false,
|
|
68
|
-
type: 'boolean | any[]',
|
|
69
|
-
default: 'false'
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
name: 'extensions',
|
|
73
|
-
description: 'Custom TipTap extensions',
|
|
74
|
-
required: false,
|
|
75
|
-
type: 'any[]',
|
|
76
|
-
default: '[]'
|
|
77
|
-
},
|
|
78
|
-
{
|
|
79
|
-
name: 'starterkitOptions',
|
|
80
|
-
description: 'Options passed to TipTap StarterKit',
|
|
81
|
-
required: false,
|
|
82
|
-
type: 'any',
|
|
83
|
-
default: '{}'
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
name: 'mentions',
|
|
87
|
-
description: 'Mention extension configuration',
|
|
88
|
-
required: false,
|
|
89
|
-
type: 'ConfigureMentionOptions',
|
|
90
|
-
default: 'null'
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
name: 'tags',
|
|
94
|
-
description: 'Tag / hashtag configuration',
|
|
95
|
-
required: false,
|
|
96
|
-
type: 'any[] | null',
|
|
97
|
-
default: 'null'
|
|
98
|
-
},
|
|
99
|
-
{
|
|
100
|
-
name: 'uploadFunction',
|
|
101
|
-
description: 'Async file upload handler (used for images, files, etc.)',
|
|
102
|
-
required: false,
|
|
103
|
-
type: '((file: File) => Promise<UploadedFile>)'
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
name: 'uploadArgs',
|
|
107
|
-
description: 'Extra arguments passed to the upload function',
|
|
108
|
-
required: false,
|
|
109
|
-
type: 'object'
|
|
110
|
-
}
|
|
111
|
-
]
|
|
112
|
-
|
|
113
|
-
const slotsData = [
|
|
114
|
-
{
|
|
115
|
-
name: 'top',
|
|
116
|
-
description: '',
|
|
117
|
-
type: '{ editor: { contentComponent: { uid: number; type: FunctionalComponent<{}, {}, any, {}> | { [x: stri'
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
name: 'editor',
|
|
121
|
-
description: '',
|
|
122
|
-
type: '{ editor: { contentComponent: { uid: number; type: FunctionalComponent<{}, {}, any, {}> | { [x: stri'
|
|
123
|
-
},
|
|
124
|
-
{
|
|
125
|
-
name: 'bottom',
|
|
126
|
-
description: '',
|
|
127
|
-
type: '{ editor: { contentComponent: { uid: number; type: FunctionalComponent<{}, {}, any, {}> | { [x: stri'
|
|
128
|
-
}
|
|
129
|
-
]
|
|
130
|
-
|
|
131
|
-
const emitsData = [
|
|
132
|
-
{
|
|
133
|
-
name: 'change',
|
|
134
|
-
description: 'Fired after the value is committed.',
|
|
135
|
-
type: '[content: string]'
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: 'focus',
|
|
139
|
-
description: '',
|
|
140
|
-
type: '[event: FocusEvent]'
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
name: 'blur',
|
|
144
|
-
description: '',
|
|
145
|
-
type: '[event: FocusEvent]'
|
|
146
|
-
},
|
|
147
|
-
{
|
|
148
|
-
name: 'transaction',
|
|
149
|
-
description: '',
|
|
150
|
-
type: '[editor: object]'
|
|
151
|
-
}
|
|
152
|
-
]
|
|
153
|
-
</script>
|
|
154
|
-
|
|
155
|
-
## API Reference
|
|
156
|
-
|
|
157
|
-
<PropsTable name="TextEditor" :data="propsData"/>
|
|
158
|
-
|
|
159
|
-
<SlotsTable :data="slotsData"/>
|
|
160
|
-
|
|
161
|
-
<EmitsTable :data="emitsData"/>
|
|
@@ -1,298 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div
|
|
3
|
-
v-if="editor"
|
|
4
|
-
class="relative w-full"
|
|
5
|
-
:class="attrsClass"
|
|
6
|
-
:style="attrsStyle"
|
|
7
|
-
v-bind="attrsWithoutClassStyle"
|
|
8
|
-
ref="rootRef"
|
|
9
|
-
>
|
|
10
|
-
<TextEditorBubbleMenu :buttons="bubbleMenu" :options="bubbleMenuOptions" />
|
|
11
|
-
<TextEditorFixedMenu
|
|
12
|
-
class="w-full overflow-x-auto rounded-t-6 border border-outline-elevation-2"
|
|
13
|
-
:buttons="fixedMenu"
|
|
14
|
-
/>
|
|
15
|
-
<TextEditorFloatingMenu :buttons="floatingMenu" />
|
|
16
|
-
<slot name="top" :editor />
|
|
17
|
-
<slot name="editor" :editor="editor">
|
|
18
|
-
<EditorContent :editor="editor" />
|
|
19
|
-
</slot>
|
|
20
|
-
<slot name="bottom" :editor />
|
|
21
|
-
</div>
|
|
22
|
-
</template>
|
|
23
|
-
|
|
24
|
-
<script lang="ts">
|
|
25
|
-
// @ts-nocheck -- frozen v0 code, kept out of type-check (see tsconfig.app.json)
|
|
26
|
-
// Module-scoped so the deprecation notice fires once per process, not per instance.
|
|
27
|
-
let deprecationWarned = false
|
|
28
|
-
</script>
|
|
29
|
-
|
|
30
|
-
<script setup lang="ts">
|
|
31
|
-
// @ts-nocheck -- frozen v0 code, kept out of type-check (see tsconfig.app.json)
|
|
32
|
-
import {
|
|
33
|
-
normalizeClass,
|
|
34
|
-
normalizeStyle,
|
|
35
|
-
computed,
|
|
36
|
-
watch,
|
|
37
|
-
onMounted,
|
|
38
|
-
onBeforeUnmount,
|
|
39
|
-
provide,
|
|
40
|
-
ref,
|
|
41
|
-
useAttrs,
|
|
42
|
-
useTemplateRef,
|
|
43
|
-
} from 'vue'
|
|
44
|
-
|
|
45
|
-
import { Editor, EditorContent } from '@tiptap/vue-3'
|
|
46
|
-
import type { EditorView } from '@tiptap/pm/view'
|
|
47
|
-
import StarterKit from '@tiptap/starter-kit'
|
|
48
|
-
import { Placeholder } from '@tiptap/extensions'
|
|
49
|
-
import Typography from '@tiptap/extension-typography'
|
|
50
|
-
import { TextStyleKit } from '@tiptap/extension-text-style'
|
|
51
|
-
import { TaskList, TaskItem } from '@tiptap/extension-list'
|
|
52
|
-
import TextAlign from '@tiptap/extension-text-align'
|
|
53
|
-
import {
|
|
54
|
-
Table,
|
|
55
|
-
TableRow,
|
|
56
|
-
TableCell,
|
|
57
|
-
TableHeader,
|
|
58
|
-
} from '@tiptap/extension-table'
|
|
59
|
-
|
|
60
|
-
import { ImageExtension } from './extensions/image'
|
|
61
|
-
import { VideoExtension } from './extensions/video-extension'
|
|
62
|
-
import ImageViewerExtension from './extensions/image-viewer-extension'
|
|
63
|
-
import { IframeExtension } from './extensions/iframe'
|
|
64
|
-
import { TocNodeExtension } from './extensions/toc-node'
|
|
65
|
-
import { LinkExtension } from './extensions/link/'
|
|
66
|
-
import NamedColorExtension from './extensions/color'
|
|
67
|
-
import NamedHighlightExtension from './extensions/highlight'
|
|
68
|
-
import StyleClipboardExtension from './extensions/copy-styles'
|
|
69
|
-
import { MentionExtension } from './extensions/mention'
|
|
70
|
-
import EmojiExtension from './extensions/emoji/emoji-extension'
|
|
71
|
-
import SlashCommands from './extensions/slash-commands/slash-commands-extension'
|
|
72
|
-
import { ContentPasteExtension } from './extensions/content-paste-extension'
|
|
73
|
-
import { Heading } from './extensions/heading/heading'
|
|
74
|
-
import { ImageGroup } from './extensions/image-group/image-group-extension'
|
|
75
|
-
import { ExtendedCode, ExtendedCodeBlock } from './extensions/code-block'
|
|
76
|
-
|
|
77
|
-
import TextEditorFixedMenu from './components/TextEditorFixedMenu.vue'
|
|
78
|
-
import TextEditorBubbleMenu from './components/TextEditorBubbleMenu.vue'
|
|
79
|
-
import TextEditorFloatingMenu from './components/TextEditorFloatingMenu.vue'
|
|
80
|
-
|
|
81
|
-
import { useFileUpload } from '#utils/useFileUpload'
|
|
82
|
-
import { TextEditorEmits, TextEditorProps } from './types'
|
|
83
|
-
import { getTagExtensions } from './extensions/tag'
|
|
84
|
-
|
|
85
|
-
defineOptions({ inheritAttrs: false })
|
|
86
|
-
|
|
87
|
-
function defaultUploadFunction(file: File) {
|
|
88
|
-
// useFileUpload is frappe specific
|
|
89
|
-
let fileUpload = useFileUpload()
|
|
90
|
-
// Default uploads to private so editor images/attachments are not served from
|
|
91
|
-
// the unauthenticated /files/ path (frappe/security#206). Callers can still
|
|
92
|
-
// override via uploadArgs (e.g. `private: false` for intentionally public files).
|
|
93
|
-
return fileUpload.upload(file, { private: true, ...(props.uploadArgs || {}) })
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
const props = withDefaults(defineProps<TextEditorProps>(), {
|
|
97
|
-
content: null,
|
|
98
|
-
placeholder: '',
|
|
99
|
-
editorClass: 'prose-sm',
|
|
100
|
-
editable: true,
|
|
101
|
-
autofocus: false,
|
|
102
|
-
bubbleMenu: false,
|
|
103
|
-
bubbleMenuOptions: () => ({}),
|
|
104
|
-
fixedMenu: false,
|
|
105
|
-
floatingMenu: false,
|
|
106
|
-
extensions: () => [],
|
|
107
|
-
starterkitOptions: () => ({}),
|
|
108
|
-
mentions: null,
|
|
109
|
-
tags: null,
|
|
110
|
-
})
|
|
111
|
-
|
|
112
|
-
const emit = defineEmits<TextEditorEmits>()
|
|
113
|
-
|
|
114
|
-
const editor = ref<Editor | null>(null)
|
|
115
|
-
|
|
116
|
-
const attrs = useAttrs()
|
|
117
|
-
const attrsClass = computed(() => normalizeClass(attrs.class))
|
|
118
|
-
const attrsStyle = computed(() => normalizeStyle(attrs.style))
|
|
119
|
-
const attrsWithoutClassStyle = computed(() => {
|
|
120
|
-
return Object.fromEntries(
|
|
121
|
-
Object.entries(attrs).filter(([key]) => key !== 'class' && key !== 'style'),
|
|
122
|
-
)
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
const editorProps = computed(() => {
|
|
126
|
-
return {
|
|
127
|
-
attributes: {
|
|
128
|
-
class: normalizeClass(['prose', props.editorClass]),
|
|
129
|
-
},
|
|
130
|
-
handleDOMEvents: {
|
|
131
|
-
// ProseMirror's dragstart runs even when read-only and overwrites the drag
|
|
132
|
-
// data; claiming the event (without preventDefault) keeps the browser's
|
|
133
|
-
// native payload, such as a link URL.
|
|
134
|
-
dragstart: (view: EditorView) => !view.editable,
|
|
135
|
-
},
|
|
136
|
-
}
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
watch(
|
|
140
|
-
() => props.content,
|
|
141
|
-
(val) => {
|
|
142
|
-
if (editor.value) {
|
|
143
|
-
let currentHTML = editor.value.getHTML()
|
|
144
|
-
if (currentHTML !== val) {
|
|
145
|
-
editor.value.commands.setContent(val)
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
},
|
|
149
|
-
)
|
|
150
|
-
|
|
151
|
-
watch(
|
|
152
|
-
() => props.editable,
|
|
153
|
-
(value) => {
|
|
154
|
-
if (editor.value) {
|
|
155
|
-
editor.value.setEditable(value)
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
)
|
|
159
|
-
|
|
160
|
-
watch(
|
|
161
|
-
editorProps,
|
|
162
|
-
(value) => {
|
|
163
|
-
if (editor.value) {
|
|
164
|
-
editor.value.setOptions({
|
|
165
|
-
editorProps: value,
|
|
166
|
-
})
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
{ deep: true },
|
|
170
|
-
)
|
|
171
|
-
|
|
172
|
-
onMounted(() => {
|
|
173
|
-
if (import.meta.env.DEV && !deprecationWarned) {
|
|
174
|
-
deprecationWarned = true
|
|
175
|
-
console.warn(
|
|
176
|
-
"<TextEditor> is deprecated. Use <Editor> with RichTextKit from 'frappe-ui/editor' for standard rich text, or compose your own kits/extensions for custom editors.",
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
editor.value = new Editor({
|
|
181
|
-
content: props.content || null,
|
|
182
|
-
editorProps: editorProps.value,
|
|
183
|
-
editable: props.editable,
|
|
184
|
-
autofocus: props.autofocus,
|
|
185
|
-
extensions: [
|
|
186
|
-
StarterKit.configure({
|
|
187
|
-
...props.starterkitOptions,
|
|
188
|
-
code: false,
|
|
189
|
-
codeBlock: false,
|
|
190
|
-
heading: false,
|
|
191
|
-
link: false,
|
|
192
|
-
}),
|
|
193
|
-
Heading.configure({
|
|
194
|
-
...(typeof props.starterkitOptions?.heading === 'object' &&
|
|
195
|
-
props.starterkitOptions.heading !== null
|
|
196
|
-
? props.starterkitOptions.heading
|
|
197
|
-
: {}),
|
|
198
|
-
}),
|
|
199
|
-
Table.configure({
|
|
200
|
-
resizable: true,
|
|
201
|
-
renderWrapper: true,
|
|
202
|
-
}),
|
|
203
|
-
TableRow,
|
|
204
|
-
TableHeader,
|
|
205
|
-
TableCell,
|
|
206
|
-
TaskList,
|
|
207
|
-
TaskItem.configure({
|
|
208
|
-
nested: true,
|
|
209
|
-
}),
|
|
210
|
-
Typography,
|
|
211
|
-
TextAlign.configure({
|
|
212
|
-
types: ['heading', 'paragraph'],
|
|
213
|
-
}),
|
|
214
|
-
TextStyleKit.configure({
|
|
215
|
-
backgroundColor: false,
|
|
216
|
-
color: false,
|
|
217
|
-
}),
|
|
218
|
-
NamedColorExtension,
|
|
219
|
-
NamedHighlightExtension,
|
|
220
|
-
ExtendedCode,
|
|
221
|
-
ExtendedCodeBlock,
|
|
222
|
-
ImageExtension.configure({
|
|
223
|
-
uploadFunction: props.uploadFunction || defaultUploadFunction,
|
|
224
|
-
}),
|
|
225
|
-
ImageGroup.configure({
|
|
226
|
-
uploadFunction: props.uploadFunction || defaultUploadFunction,
|
|
227
|
-
}),
|
|
228
|
-
ImageViewerExtension,
|
|
229
|
-
VideoExtension.configure({
|
|
230
|
-
uploadFunction: props.uploadFunction || defaultUploadFunction,
|
|
231
|
-
}),
|
|
232
|
-
IframeExtension,
|
|
233
|
-
TocNodeExtension,
|
|
234
|
-
LinkExtension.configure({
|
|
235
|
-
openOnClick: false,
|
|
236
|
-
}),
|
|
237
|
-
Placeholder.configure({
|
|
238
|
-
placeholder:
|
|
239
|
-
typeof props.placeholder === 'function'
|
|
240
|
-
? props.placeholder
|
|
241
|
-
: () => props.placeholder as string,
|
|
242
|
-
}),
|
|
243
|
-
props.mentions &&
|
|
244
|
-
MentionExtension.configure(
|
|
245
|
-
Array.isArray(props.mentions)
|
|
246
|
-
? { mentions: props.mentions }
|
|
247
|
-
: {
|
|
248
|
-
mentions: props.mentions.mentions,
|
|
249
|
-
component: props.mentions.component,
|
|
250
|
-
},
|
|
251
|
-
),
|
|
252
|
-
EmojiExtension,
|
|
253
|
-
SlashCommands,
|
|
254
|
-
...getTagExtensions(() => props.tags),
|
|
255
|
-
ContentPasteExtension.configure({
|
|
256
|
-
enabled: true,
|
|
257
|
-
uploadFunction: props.uploadFunction || defaultUploadFunction,
|
|
258
|
-
}),
|
|
259
|
-
StyleClipboardExtension,
|
|
260
|
-
...(props.extensions || []),
|
|
261
|
-
],
|
|
262
|
-
onUpdate: ({ editor }) => {
|
|
263
|
-
emit('change', editor.getHTML())
|
|
264
|
-
},
|
|
265
|
-
onTransaction: ({ editor }) => {
|
|
266
|
-
emit('transaction', editor)
|
|
267
|
-
},
|
|
268
|
-
onFocus: ({ editor, event }) => {
|
|
269
|
-
emit('focus', event)
|
|
270
|
-
},
|
|
271
|
-
onBlur: ({ editor, event }) => {
|
|
272
|
-
emit('blur', event)
|
|
273
|
-
},
|
|
274
|
-
})
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
onBeforeUnmount(() => {
|
|
278
|
-
if (editor.value) {
|
|
279
|
-
editor.value.destroy()
|
|
280
|
-
editor.value = null
|
|
281
|
-
}
|
|
282
|
-
})
|
|
283
|
-
|
|
284
|
-
provide(
|
|
285
|
-
'editor',
|
|
286
|
-
computed(() => editor.value),
|
|
287
|
-
)
|
|
288
|
-
|
|
289
|
-
const rootRef = useTemplateRef('rootRef')
|
|
290
|
-
defineExpose({
|
|
291
|
-
editor,
|
|
292
|
-
rootRef,
|
|
293
|
-
})
|
|
294
|
-
</script>
|
|
295
|
-
|
|
296
|
-
<style>
|
|
297
|
-
@import './style.css';
|
|
298
|
-
</style>
|