@shelamkoff/rector 1.0.0 → 1.0.1

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 (47) hide show
  1. package/README.md +1 -0
  2. package/dist/inline-plugins/mention/index.js +1 -2
  3. package/dist/plugins/attaches/index.js +1 -2
  4. package/dist/plugins/carousel/index.js +1 -2
  5. package/dist/plugins/checklist/index.js +1 -2
  6. package/dist/plugins/code/index.js +1 -2
  7. package/dist/plugins/columns/index.js +1 -2
  8. package/dist/plugins/delimiter/index.js +1 -2
  9. package/dist/plugins/embed/index.js +1 -2
  10. package/dist/plugins/gallery/index.js +1 -2
  11. package/dist/plugins/heading/index.js +1 -2
  12. package/dist/plugins/image/index.js +1 -2
  13. package/dist/plugins/link-preview/index.js +1 -2
  14. package/dist/plugins/list/index.js +1 -2
  15. package/dist/plugins/paragraph/index.js +1 -2
  16. package/dist/plugins/person/index.js +1 -2
  17. package/dist/plugins/poll/index.js +1 -2
  18. package/dist/plugins/quote/index.js +1 -2
  19. package/dist/plugins/raw/index.js +1 -2
  20. package/dist/plugins/spoiler/index.js +1 -2
  21. package/dist/plugins/table/index.js +1 -2
  22. package/dist/plugins/toggle/index.js +1 -2
  23. package/dist/plugins/warning/index.js +1 -2
  24. package/dist/renderer/index.js +1 -2
  25. package/dist/renderer/renderers/attaches/index.js +1 -2
  26. package/dist/renderer/renderers/carousel/index.js +1 -2
  27. package/dist/renderer/renderers/checklist/index.js +1 -2
  28. package/dist/renderer/renderers/code/index.js +1 -2
  29. package/dist/renderer/renderers/columns/index.js +1 -2
  30. package/dist/renderer/renderers/delimiter/index.js +1 -2
  31. package/dist/renderer/renderers/embed/index.js +1 -2
  32. package/dist/renderer/renderers/gallery/index.js +1 -2
  33. package/dist/renderer/renderers/heading/index.js +1 -2
  34. package/dist/renderer/renderers/image/index.js +1 -2
  35. package/dist/renderer/renderers/link-preview/index.js +1 -2
  36. package/dist/renderer/renderers/list/index.js +1 -2
  37. package/dist/renderer/renderers/paragraph/index.js +1 -2
  38. package/dist/renderer/renderers/person/index.js +1 -2
  39. package/dist/renderer/renderers/poll/index.js +1 -2
  40. package/dist/renderer/renderers/quote/index.js +1 -2
  41. package/dist/renderer/renderers/spoiler/index.js +1 -2
  42. package/dist/renderer/renderers/table/index.js +1 -2
  43. package/dist/renderer/renderers/toggle/index.js +1 -2
  44. package/dist/renderer/renderers/warning/index.js +1 -2
  45. package/package.json +8 -10
  46. package/dist/shared/resolvePath.d.ts +0 -8
  47. package/dist/shared/resolvePath.js +0 -10
package/README.md CHANGED
@@ -8,6 +8,7 @@ The complete guides, API reference, extension contracts, plugin catalog, and liv
8
8
 
9
9
  - [English documentation](https://shelamkoff.github.io/editor/)
10
10
  - [Документация на русском](https://shelamkoff.github.io/editor/ru/)
11
+ - [Live demo](https://shelamkoff.github.io/editor/#demo)
11
12
 
12
13
  ## Installation
13
14
 
@@ -33,13 +33,12 @@
33
33
  * @typedef {import('../../core/types').InlinePluginContext} InlinePluginContext
34
34
  */
35
35
 
36
- import { resolvePath } from '../../shared/resolvePath.js'
37
36
  import { injectStyleUrls } from '../../core/StyleInjector.js'
38
37
  import { createMentionWidget } from './widget.js'
39
38
  import { setSafeUrlAttribute } from '../../shared/sanitize/sanitizeUrl.js'
40
39
 
41
40
  /** Absolute URL to the plugin's stylesheet. Ref-counted via `injectStyleUrls`. */
42
- const STYLES_URL = resolvePath('./styles.css', import.meta.url)
41
+ const STYLES_URL = new URL('./styles.css', import.meta.url).href
43
42
 
44
43
  const DEFAULTS = Object.freeze({
45
44
  trigger: '@',
@@ -1,4 +1,3 @@
1
- import { resolvePath } from '../../shared/resolvePath.js'
2
1
  import { triggerFileInput } from '../shared/fileInput.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { getFileIcon, getExtension, formatSize, EXT_COLORS } from '../../shared/fileUtils.js'
@@ -6,7 +5,7 @@ import { validateAttachesData } from '../../shared/blockDataValidators.js'
6
5
  import { sanitizeUrl } from '../../shared/sanitize/sanitizeUrl.js'
7
6
  import { normalizeTextValue } from '../../shared/textFormat.js'
8
7
 
9
- const editorStyles = resolvePath('./attaches.css', import.meta.url)
8
+ const editorStyles = new URL('./attaches.css', import.meta.url).href
10
9
 
11
10
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3v4a1 1 0 0 0 1 1h4"/><path d="M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2"/><path d="M12 11v6"/><path d="M9.5 13.5l2.5-2.5l2.5 2.5"/></svg>'
12
11
  const ICON_SELECT = '<svg width="40" height="40" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><path d="M14 3v4a1 1 0 0 0 1 1h4"/><path d="M17 21h-10a2 2 0 0 1-2-2v-14a2 2 0 0 1 2-2h7l5 5v11a2 2 0 0 1-2 2"/><path d="M12 11v6"/><path d="M9.5 13.5l2.5-2.5l2.5 2.5"/></svg>'
@@ -1,6 +1,5 @@
1
1
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
2
2
  import { uid } from '../../core/uid.js'
3
- import { resolvePath } from '../../shared/resolvePath.js'
4
3
  import {
5
4
  normalizeCarouselAspectRatio,
6
5
  normalizeCarouselData,
@@ -22,7 +21,7 @@ import {
22
21
  ICON_REPLACE, ICON_SELECT, ICON_SETTINGS, ICON_TRASH, ICON_UPLOAD, ICON_URL,
23
22
  } from './icons.js'
24
23
 
25
- const editorStyles = resolvePath('./carousel.css', import.meta.url)
24
+ const editorStyles = new URL('./carousel.css', import.meta.url).href
26
25
 
27
26
  /**
28
27
  * Read a local image while respecting the owning block's lifecycle.
@@ -1,11 +1,10 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateChecklistData } from '../../shared/blockDataValidators.js'
5
4
  import { mapTextFields } from './mapTextFields.js'
6
5
  import { normalizeTextValue } from '../../shared/textFormat.js'
7
6
 
8
- const editorStyles = resolvePath('./checklist.css', import.meta.url)
7
+ const editorStyles = new URL('./checklist.css', import.meta.url).href
9
8
 
10
9
  // Tabler icon: list-check
11
10
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3.5 5.5l1.5 1.5l2.5-2.5"/><path d="M3.5 11.5l1.5 1.5l2.5-2.5"/><path d="M3.5 17.5l1.5 1.5l2.5-2.5"/><path d="M11 6h9"/><path d="M11 12h9"/><path d="M11 18h9"/></svg>'
@@ -1,10 +1,9 @@
1
- import { resolvePath } from '../../shared/resolvePath.js'
2
1
  import { getHighlightRuntime, loadHighlightRuntime } from '../../shared/highlightRuntime.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateCodeData } from '../../shared/blockDataValidators.js'
5
4
  import { READ_ONLY_INTERACTIVE_ATTRIBUTE } from '../../core/constants.js'
6
5
 
7
- const editorStyles = resolvePath('./code.css', import.meta.url)
6
+ const editorStyles = new URL('./code.css', import.meta.url).href
8
7
 
9
8
  /** @type {WeakMap<HTMLElement, {code: string, language: string, editMode: boolean, context: import('../../core/types').BlockMutationContext, copyResetTimer: ReturnType<typeof setTimeout> | null}>} */
10
9
  const codeStateMap = new WeakMap()
@@ -1,11 +1,10 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateColumnsData } from '../../shared/blockDataValidators.js'
5
4
  import { normalizeTextValue } from '../../shared/textFormat.js'
6
5
  import { mapColumnsTextFields } from '../../shared/mapTextFields.js'
7
6
 
8
- const editorStyles = resolvePath('./columns.css', import.meta.url)
7
+ const editorStyles = new URL('./columns.css', import.meta.url).href
9
8
 
10
9
  // Tabler icon: columns-2
11
10
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 3m0 1a1 1 0 0 1 1-1h16a1 1 0 0 1 1 1v16a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1z"/><path d="M12 3v18"/></svg>'
@@ -2,11 +2,10 @@
2
2
  // Delimiter — horizontal rule / section break
3
3
  // =============================================================================
4
4
 
5
- import { resolvePath } from '../../shared/resolvePath.js'
6
5
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
7
6
  import { validateDelimiterData } from '../../shared/blockDataValidators.js'
8
7
 
9
- const editorStyles = resolvePath('./delimiter.css', import.meta.url)
8
+ const editorStyles = new URL('./delimiter.css', import.meta.url).href
10
9
 
11
10
  // Tabler icon: separator-horizontal (three dots)
12
11
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M5 12h2"/><path d="M17 12h2"/><path d="M11 12h2"/></svg>'
@@ -1,13 +1,12 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
2
  import { SERVICES, buildPlayer } from './player.js'
3
- import { resolvePath } from '../../shared/resolvePath.js'
4
3
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
5
4
  import { validateEmbedData } from '../../shared/blockDataValidators.js'
6
5
  import { sanitizeUrl } from '../../shared/sanitize/sanitizeUrl.js'
7
6
  import { normalizeTextValue } from '../../shared/textFormat.js'
8
7
  import { READ_ONLY_INTERACTIVE_ATTRIBUTE } from '../../core/constants.js'
9
8
 
10
- const editorStyles = resolvePath('./embed.css', import.meta.url)
9
+ const editorStyles = new URL('./embed.css', import.meta.url).href
11
10
 
12
11
  // Tabler: device-tv (toolbox)
13
12
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 9a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v9a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2l0 -9"/><path d="M16 3l-4 4l-4 -4"/></svg>'
@@ -1,4 +1,3 @@
1
- import { resolvePath } from '../../shared/resolvePath.js'
2
1
  import { isSupportedImageFile, triggerFileInput } from '../shared/fileInput.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateGalleryData } from '../../shared/blockDataValidators.js'
@@ -10,7 +9,7 @@ import { renderEmptyView } from './view-empty.js'
10
9
  import { renderFilledView } from './view-filled.js'
11
10
  import { sanitizeMediaUrl } from '../../shared/sanitize/sanitizeUrl.js'
12
11
 
13
- const editorStyles = resolvePath('./gallery.css', import.meta.url)
12
+ const editorStyles = new URL('./gallery.css', import.meta.url).href
14
13
 
15
14
  /**
16
15
  * @typedef {(file: File, context: { signal: AbortSignal }) => Promise<{ url: string, alt?: string }>} UploadFn
@@ -1,12 +1,11 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { createHeadingLevelSelect } from './HeadingLevelSelect.js'
5
4
  import { mapTextFields } from './mapTextFields.js'
6
5
  import { validateHeadingData } from '../../shared/blockDataValidators.js'
7
6
  import { normalizeHeadingLevel, normalizeTextAlign, normalizeTextValue } from '../../shared/textFormat.js'
8
7
 
9
- const editorStyles = resolvePath('./heading.css', import.meta.url)
8
+ const editorStyles = new URL('./heading.css', import.meta.url).href
10
9
 
11
10
  // Tabler icon: heading
12
11
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M7 12h10"/><path d="M7 5v14"/><path d="M17 5v14"/><path d="M15 19h4"/><path d="M15 5h4"/><path d="M5 19h4"/><path d="M5 5h4"/></svg>'
@@ -1,4 +1,3 @@
1
- import { resolvePath } from '../../shared/resolvePath.js'
2
1
  import { isSupportedImageFile, triggerFileInput } from '../shared/fileInput.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateImageData } from '../../shared/blockDataValidators.js'
@@ -10,7 +9,7 @@ import { renderEmptyView } from './view-empty.js'
10
9
  import { renderFilledView } from './view-filled.js'
11
10
  import { sanitizeMediaUrl } from '../../shared/sanitize/index.js'
12
11
 
13
- const editorStyles = resolvePath('./image.css', import.meta.url)
12
+ const editorStyles = new URL('./image.css', import.meta.url).href
14
13
 
15
14
  /**
16
15
  * @typedef {{ url: string, alt?: string }} ImageSourceResult
@@ -1,10 +1,9 @@
1
- import { resolvePath } from '../../shared/resolvePath.js'
2
1
  import { sanitizeUrl, setSafeUrlAttribute } from '../../shared/sanitize/sanitizeUrl.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateLinkPreviewData } from '../../shared/blockDataValidators.js'
5
4
  import { normalizeTextValue } from '../../shared/textFormat.js'
6
5
 
7
- const editorStyles = resolvePath('./link-preview.css', import.meta.url)
6
+ const editorStyles = new URL('./link-preview.css', import.meta.url).href
8
7
 
9
8
  // Tabler: link (toolbox)
10
9
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 15l6-6"/><path d="M11 6l.463-.536a5 5 0 0 1 7.071 7.072L18 13"/><path d="M13 18l-.397.534a5.068 5.068 0 0 1-7.127 0 4.972 4.972 0 0 1 0-7.071L6 11"/></svg>'
@@ -1,11 +1,10 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { mapTextFields } from './mapTextFields.js'
5
4
  import { validateListData } from '../../shared/blockDataValidators.js'
6
5
  import { normalizeTextValue } from '../../shared/textFormat.js'
7
6
 
8
- const editorStyles = resolvePath('./list.css', import.meta.url)
7
+ const editorStyles = new URL('./list.css', import.meta.url).href
9
8
 
10
9
  // Tabler icon: list
11
10
  const ICON_UL = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6h11"/><path d="M9 12h11"/><path d="M9 18h11"/><path d="M5 6v.01"/><path d="M5 12v.01"/><path d="M5 18v.01"/></svg>'
@@ -1,11 +1,10 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { mapTextFields } from './mapTextFields.js'
5
4
  import { validateParagraphData } from '../../shared/blockDataValidators.js'
6
5
  import { normalizeTextAlign, normalizeTextValue } from '../../shared/textFormat.js'
7
6
 
8
- const editorStyles = resolvePath('./paragraph.css', import.meta.url)
7
+ const editorStyles = new URL('./paragraph.css', import.meta.url).href
9
8
 
10
9
  // Tabler icon: letter-t
11
10
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 4l12 0"/><path d="M12 4l0 16"/></svg>'
@@ -1,13 +1,12 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
2
  import { CropperDialog, cropperStylesUrl } from '@shelamkoff/cropper'
3
3
  import { resolveSocialIcon, SOCIAL_ICONS } from './socialResolver.js'
4
- import { resolvePath } from '../../shared/resolvePath.js'
5
4
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
6
5
  import { sanitizeUrl, setSafeUrlAttribute } from '../../shared/sanitize/sanitizeUrl.js'
7
6
  import { validatePersonData } from '../../shared/blockDataValidators.js'
8
7
  import { normalizeTextValue } from '../../shared/textFormat.js'
9
8
 
10
- const editorStyles = resolvePath('./person.css', import.meta.url)
9
+ const editorStyles = new URL('./person.css', import.meta.url).href
11
10
  const cropperStyles = cropperStylesUrl
12
11
 
13
12
  // Tabler icon: user-circle
@@ -1,5 +1,4 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { uid } from '../../core/uid.js'
5
4
  import {
@@ -11,7 +10,7 @@ import {
11
10
  } from '../../shared/pollData.js'
12
11
  import { setSafeUrlAttribute } from '../../shared/sanitize/sanitizeUrl.js'
13
12
 
14
- const editorStyles = resolvePath('./poll.css', import.meta.url)
13
+ const editorStyles = new URL('./poll.css', import.meta.url).href
15
14
 
16
15
  // Tabler icon: chart-bar
17
16
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 12m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v6a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"/><path d="M9 8m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v10a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"/><path d="M15 4m0 1a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v14a1 1 0 0 1 -1 1h-4a1 1 0 0 1 -1 -1z"/><path d="M4 20h14"/></svg>'
@@ -3,13 +3,12 @@
3
3
  // =============================================================================
4
4
 
5
5
  import { sanitizeHtml } from '../../core/sanitize.js'
6
- import { resolvePath } from '../../shared/resolvePath.js'
7
6
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
8
7
  import { mapTextFields } from './mapTextFields.js'
9
8
  import { validateQuoteData } from '../../shared/blockDataValidators.js'
10
9
  import { normalizeTextValue } from '../../shared/textFormat.js'
11
10
 
12
- const editorStyles = resolvePath('./quote.css', import.meta.url)
11
+ const editorStyles = new URL('./quote.css', import.meta.url).href
13
12
 
14
13
  // Tabler icon: blockquote
15
14
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="currentColor"><path d="M9 5a2 2 0 0 1 2 2v6c0 3.13 -1.65 5.193 -4.757 5.97a1 1 0 1 1 -.486 -1.94c2.227 -.557 3.243 -1.827 3.243 -4.03v-1h-3a2 2 0 0 1 -1.995 -1.85l-.005 -.15v-3a2 2 0 0 1 2 -2z"/><path d="M18 5a2 2 0 0 1 2 2v6c0 3.13 -1.65 5.193 -4.757 5.97a1 1 0 1 1 -.486 -1.94c2.227 -.557 3.243 -1.827 3.243 -4.03v-1h-3a2 2 0 0 1 -1.995 -1.85l-.005 -.15v-3a2 2 0 0 1 2 -2z"/></svg>'
@@ -1,10 +1,9 @@
1
- import { resolvePath } from '../../shared/resolvePath.js'
2
1
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
3
2
  import { validateRawData } from '../../shared/blockDataValidators.js'
4
3
  import { normalizeTextValue } from '../../shared/textFormat.js'
5
4
  import { sanitizeRawHtml } from '../../shared/sanitize/sanitizeRawHtml.js'
6
5
 
7
- const editorStyles = resolvePath('./raw.css', import.meta.url)
6
+ const editorStyles = new URL('./raw.css', import.meta.url).href
8
7
 
9
8
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M13 16v-8l2 5l2-5v8"/><path d="M1 16v-8"/><path d="M5 8v8"/><path d="M1 12h4"/><path d="M7 8h4"/><path d="M9 8v8"/><path d="M20 8v8h3"/></svg>'
10
9
 
@@ -5,14 +5,13 @@
5
5
  // =============================================================================
6
6
 
7
7
  import { sanitizeHtml } from '../../core/sanitize.js'
8
- import { resolvePath } from '../../shared/resolvePath.js'
9
8
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
10
9
  import { validateSpoilerData } from '../../shared/blockDataValidators.js'
11
10
  import { mapSpoilerTextFields } from '../../shared/mapTextFields.js'
12
11
  import { normalizeTextValue } from '../../shared/textFormat.js'
13
12
  import { READ_ONLY_INTERACTIVE_ATTRIBUTE } from '../../core/constants.js'
14
13
 
15
- const editorStyles = resolvePath('./spoiler.css', import.meta.url)
14
+ const editorStyles = new URL('./spoiler.css', import.meta.url).href
16
15
 
17
16
  // Tabler icon: eye-off
18
17
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/><path d="M16.681 16.673a8.717 8.717 0 0 1-4.681 1.327c-3.6 0-6.6-2-9-6 1.272-2.12 2.712-3.678 4.32-4.674m2.86-1.146a9.055 9.055 0 0 1 1.82-.18c3.6 0 6.6 2 9 6-.666 1.11-1.379 2.067-2.138 2.87"/><path d="M3 3l18 18"/></svg>'
@@ -1,10 +1,9 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateTableData } from '../../shared/blockDataValidators.js'
5
4
  import { mapTableTextFields } from '../../shared/mapTextFields.js'
6
5
 
7
- const editorStyles = resolvePath('./table.css', import.meta.url)
6
+ const editorStyles = new URL('./table.css', import.meta.url).href
8
7
 
9
8
  // Tabler icon: table
10
9
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 5a2 2 0 0 1 2 -2h14a2 2 0 0 1 2 2v14a2 2 0 0 1 -2 2h-14a2 2 0 0 1 -2 -2v-14z"/><path d="M3 10h18"/><path d="M10 3v18"/></svg>'
@@ -1,12 +1,11 @@
1
1
  import { sanitizeHtml } from '../../core/sanitize.js'
2
- import { resolvePath } from '../../shared/resolvePath.js'
3
2
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
4
3
  import { validateToggleData } from '../../shared/blockDataValidators.js'
5
4
  import { mapToggleTextFields } from '../../shared/mapTextFields.js'
6
5
  import { normalizeTextValue } from '../../shared/textFormat.js'
7
6
  import { READ_ONLY_INTERACTIVE_ATTRIBUTE } from '../../core/constants.js'
8
7
 
9
- const editorStyles = resolvePath('./toggle.css', import.meta.url)
8
+ const editorStyles = new URL('./toggle.css', import.meta.url).href
10
9
 
11
10
  let toggleSequence = 0
12
11
 
@@ -5,13 +5,12 @@
5
5
  // =============================================================================
6
6
 
7
7
  import { sanitizeHtml } from '../../core/sanitize.js'
8
- import { resolvePath } from '../../shared/resolvePath.js'
9
8
  import { BlockPluginAbstract } from '../BlockPluginAbstract.js'
10
9
  import { validateWarningData } from '../../shared/blockDataValidators.js'
11
10
  import { normalizeTextValue } from '../../shared/textFormat.js'
12
11
  import { mapWarningTextFields } from '../../shared/mapTextFields.js'
13
12
 
14
- const editorStyles = resolvePath('./warning.css', import.meta.url)
13
+ const editorStyles = new URL('./warning.css', import.meta.url).href
15
14
 
16
15
  // Tabler icon: alert-triangle
17
16
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 9v4"/><path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87l-8.106-13.536a1.914 1.914 0 0 0-3.274 0z"/><path d="M12 16h.01"/></svg>'
@@ -2,7 +2,6 @@
2
2
  import { InvalidBlockDataError, UnknownBlockTypeError } from './errors.js'
3
3
  import { createInlineParser } from './inline.js'
4
4
  import { createDefaultRenderers, getSupportedBlockTypes } from './renderers/index.js'
5
- import { resolvePath } from '../shared/resolvePath.js'
6
5
  import { deserializeInlineHtml } from '../shared/inlineMarshal.js'
7
6
  import { cloneEditorData } from '../shared/cloneEditorData.js'
8
7
  import defaultLocale from './locale/en.js'
@@ -11,7 +10,7 @@ import { validateKnownBlockData } from '../shared/blockDataValidators.js'
11
10
  import { normalizeKnownBlockData } from '../shared/blockDataNormalizers.js'
12
11
  import { normalizeTextAlign } from '../shared/textFormat.js'
13
12
 
14
- const baseCssUrl = resolvePath('./styles/base.css', import.meta.url)
13
+ const baseCssUrl = new URL('./styles/base.css', import.meta.url).href
15
14
 
16
15
  /**
17
16
  * Renders Rector document blocks to DOM elements.
@@ -1,12 +1,11 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { getFileIcon, getExtension, formatSize, EXT_COLORS } from '../../../shared/fileUtils.js'
4
3
  import { sanitizeDownloadUrl, setSafeUrlAttribute } from '../../../shared/sanitize/sanitizeUrl.js'
5
4
  import { loadZipRuntime } from '../../../shared/zipRuntime.js'
6
5
 
7
6
  let groupSequence = 0
8
7
 
9
- const styles = resolvePath('./styles.css', import.meta.url)
8
+ const styles = new URL('./styles.css', import.meta.url).href
10
9
 
11
10
  const ICON_CHEVRON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M6 9l6 6 6-6"/></svg>'
12
11
  const ICON_FILE_DEFAULT = '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M14 3v4a1 1 0 0 0 1 1h4"/><path d="M17 21h-10a2 2 0 0 1 -2 -2v-14a2 2 0 0 1 2 -2h7l5 5v11a2 2 0 0 1 -2 2"/></svg>'
@@ -9,12 +9,11 @@ import {
9
9
  createSwipe,
10
10
  createThumbnails,
11
11
  } from '@shelamkoff/carousel'
12
- import { resolvePath } from '../../../shared/resolvePath.js'
13
12
  import { normalizeCarouselData } from '../../../shared/carouselData.js'
14
13
  import { setSanitizedRawHtml } from '../../../shared/sanitize/sanitizeRawHtml.js'
15
14
  import { setSafeUrlAttribute } from '../../../shared/sanitize/sanitizeUrl.js'
16
15
 
17
- const styles = resolvePath('./styles.css', import.meta.url)
16
+ const styles = new URL('./styles.css', import.meta.url).href
18
17
 
19
18
  /**
20
19
  * Create the mixed-media carousel renderer and own its Carousel instances.
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapChecklistTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  /**
8
7
  * Checklist block renderer
@@ -5,9 +5,8 @@ import {
5
5
  loadHighlightRuntime,
6
6
  } from '../../../shared/highlightRuntime.js'
7
7
  import { escapeHtml } from '../../../shared/sanitize/escapeHtml.js'
8
- import { resolvePath } from '../../../shared/resolvePath.js'
9
8
 
10
- const styles = resolvePath('./styles.css', import.meta.url)
9
+ const styles = new URL('./styles.css', import.meta.url).href
11
10
 
12
11
 
13
12
  /**
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapColumnsTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  /** @type {Record<string, string>} */
8
7
  const LAYOUT_GRIDS = {
@@ -1,7 +1,6 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
 
4
- const styles = resolvePath('./styles.css', import.meta.url)
3
+ const styles = new URL('./styles.css', import.meta.url).href
5
4
 
6
5
  /**
7
6
  * Delimiter block renderer
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
2
  import { buildPlayer } from '../../../shared/embedPlayer.js'
3
- import { resolvePath } from '../../../shared/resolvePath.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  const ICON_PLAY = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" stroke-width="2" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M6 4v16a1 1 0 0 0 1.524 .852l13 -8a1 1 0 0 0 0 -1.704l-13 -8a1 1 0 0 0 -1.524 .852z" stroke-width="0" fill="currentColor"/></svg>`
8
7
 
@@ -10,10 +10,9 @@ import {
10
10
  createFullscreen,
11
11
  exposeStylesUrl,
12
12
  } from '@shelamkoff/expose'
13
- import { resolvePath } from '../../../shared/resolvePath.js'
14
13
  import { setSafeUrlAttribute } from '../../../shared/sanitize/sanitizeUrl.js'
15
14
 
16
- const styles = resolvePath('./styles.css', import.meta.url)
15
+ const styles = new URL('./styles.css', import.meta.url).href
17
16
  const exposeStyles = exposeStylesUrl
18
17
 
19
18
  const MAX_VISIBLE = 6
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapHeadingTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  /**
8
7
  * Heading block renderer for the Rector document format.
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { setSafeUrlAttribute } from '../../../shared/sanitize/sanitizeUrl.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  /**
8
7
  * Apply user-configured inline styles to the image and figure.
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { sanitizeUrl, setSafeUrlAttribute } from '../../../shared/sanitize/sanitizeUrl.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  // Tabler icon: external-link
8
7
  const ICON_EXTERNAL = `<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 6h-6a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-6"/><path d="M11 13l9-9"/><path d="M15 4h5v5"/></svg>`
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapListTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  /**
8
7
  * List block renderer for the Rector document format.
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapParagraphTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  /**
8
7
  * Paragraph block renderer for the Rector document format.
@@ -1,9 +1,8 @@
1
1
  // @ts-check
2
2
  import { Carousel, createSwipe, carouselStylesUrl } from '@shelamkoff/carousel'
3
- import { resolvePath } from '../../../shared/resolvePath.js'
4
3
  import { setSafeUrlAttribute } from '../../../shared/sanitize/sanitizeUrl.js'
5
4
 
6
- const styles = resolvePath('./styles.css', import.meta.url)
5
+ const styles = new URL('./styles.css', import.meta.url).href
7
6
  const carouselStyles = carouselStylesUrl
8
7
 
9
8
  const ICON_LEFT = '<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><path d="M15 6l-6 6l6 6"/></svg>'
@@ -1,5 +1,4 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import {
4
3
  applyLocalPollVote,
5
4
  normalizePollData,
@@ -8,7 +7,7 @@ import {
8
7
  } from '../../../shared/pollData.js'
9
8
  import { setSafeUrlAttribute } from '../../../shared/sanitize/sanitizeUrl.js'
10
9
 
11
- const styles = resolvePath('./styles.css', import.meta.url)
10
+ const styles = new URL('./styles.css', import.meta.url).href
12
11
 
13
12
  /**
14
13
  * Interactive poll renderer. Author configuration stays in the document;
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapQuoteTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  // Tabler icon: quote
8
7
  const ICON_QUOTE = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M3 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2H4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z"/><path d="M15 21c3 0 7-1 7-8V5c0-1.25-.756-2.017-2-2h-4c-1.25 0-2 .75-2 1.972V11c0 1.25.75 2 2 2 1 0 1 0 1 1v1c0 1-1 2-2 2s-1 .008-1 1.031V20c0 1 0 1 1 1z"/></svg>`
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapSpoilerTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  // Tabler icon: eye-off
8
7
  const ICON = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M10.585 10.587a2 2 0 0 0 2.829 2.828"/><path d="M16.681 16.673a8.717 8.717 0 0 1-4.681 1.327c-3.6 0-6.6-2-9-6 1.272-2.12 2.712-3.678 4.32-4.674m2.86-1.146a9.055 9.055 0 0 1 1.82-.18c3.6 0 6.6 2 9 6-.666 1.11-1.379 2.067-2.138 2.87"/><path d="M3 3l18 18"/></svg>'
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapTableTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  /**
8
7
  * Table block renderer
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapToggleTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  // Tabler icon: chevron-right
8
7
  const ICON_CHEVRON = `<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M9 6l6 6l-6 6"/></svg>`
@@ -1,8 +1,7 @@
1
1
  // @ts-check
2
- import { resolvePath } from '../../../shared/resolvePath.js'
3
2
  import { mapWarningTextFields as mapTextFields } from '../../../shared/mapTextFields.js'
4
3
 
5
- const styles = resolvePath('./styles.css', import.meta.url)
4
+ const styles = new URL('./styles.css', import.meta.url).href
6
5
 
7
6
  // Tabler icon: alert-triangle
8
7
  const ICON_WARNING = `<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M12 9v4"/><path d="M10.363 3.591l-8.106 13.534a1.914 1.914 0 0 0 1.636 2.871h16.214a1.914 1.914 0 0 0 1.636-2.87l-8.106-13.536a1.914 1.914 0 0 0-3.274 0z"/><path d="M12 16h.01"/></svg>`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shelamkoff/rector",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Extensible browser-native block editor with atomic history, versioned JSON, and document rendering",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -105,15 +105,13 @@
105
105
  "prepublishOnly": "npm run typecheck && npm test && npm run test:browser && npm run test:docs && npm run test:types && npm run test:package",
106
106
  "prepack": "npm run build"
107
107
  },
108
- "dependencies": {
109
- "@shelamkoff/color-picker": "^1.0.0",
110
- "@shelamkoff/event-bus": "^1.0.0"
111
- },
112
- "peerDependencies": {
113
- "@shelamkoff/carousel": "^1.0.0",
114
- "@shelamkoff/cropper": "^1.0.0",
115
- "@shelamkoff/expose": "^1.0.0"
116
- },
108
+ "dependencies": {
109
+ "@shelamkoff/carousel": "^1.0.0",
110
+ "@shelamkoff/color-picker": "^1.0.0",
111
+ "@shelamkoff/event-bus": "^1.0.0",
112
+ "@shelamkoff/cropper": "^1.0.0",
113
+ "@shelamkoff/expose": "^1.0.0"
114
+ },
117
115
  "devDependencies": {
118
116
  "@tabler/icons-vue": "^3.41.1",
119
117
  "typescript": "~5.9.3",
@@ -1,8 +0,0 @@
1
- /**
2
- * Resolve a relative file path against a module URL.
3
- *
4
- * @param {string} relativePath — path relative to the calling module (e.g. './styles.css')
5
- * @param {string} base — pass `import.meta.url` of the calling module
6
- * @returns {string} absolute URL string
7
- */
8
- export function resolvePath(relativePath: string, base: string): string;
@@ -1,10 +0,0 @@
1
- /**
2
- * Resolve a relative file path against a module URL.
3
- *
4
- * @param {string} relativePath — path relative to the calling module (e.g. './styles.css')
5
- * @param {string} base — pass `import.meta.url` of the calling module
6
- * @returns {string} absolute URL string
7
- */
8
- export function resolvePath(relativePath, base) {
9
- return new URL(relativePath, base).href
10
- }