@lexical/html 0.44.1-nightly.20260519.0 → 0.45.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.
Files changed (66) hide show
  1. package/{DOMRenderExtension.d.ts → dist/DOMRenderExtension.d.ts} +12 -1
  2. package/dist/DOMRenderRuntime.d.ts +51 -0
  3. package/dist/LexicalHtml.dev.js +3192 -0
  4. package/dist/LexicalHtml.dev.mjs +3146 -0
  5. package/{LexicalHtml.js.flow → dist/LexicalHtml.js.flow} +16 -16
  6. package/dist/LexicalHtml.mjs +56 -0
  7. package/dist/LexicalHtml.node.mjs +54 -0
  8. package/dist/LexicalHtml.prod.js +9 -0
  9. package/dist/LexicalHtml.prod.mjs +9 -0
  10. package/dist/RenderContext.d.ts +68 -0
  11. package/{compileDOMRenderConfigOverrides.d.ts → dist/compileDOMRenderConfigOverrides.d.ts} +1 -1
  12. package/{constants.d.ts → dist/constants.d.ts} +2 -0
  13. package/dist/domOverride.d.ts +23 -0
  14. package/dist/import/CoreImportExtension.d.ts +11 -0
  15. package/dist/import/DOMImportExtension.d.ts +82 -0
  16. package/dist/import/HorizontalRuleImportExtension.d.ts +27 -0
  17. package/dist/import/ImportContext.d.ts +208 -0
  18. package/dist/import/compileImportRules.d.ts +50 -0
  19. package/dist/import/coreImportRules.d.ts +25 -0
  20. package/dist/import/defineImportRule.d.ts +32 -0
  21. package/dist/import/defineOverlayRules.d.ts +66 -0
  22. package/dist/import/index.d.ts +38 -0
  23. package/dist/import/inlineStylesFromStyleSheets.d.ts +28 -0
  24. package/dist/import/parseCss.d.ts +18 -0
  25. package/dist/import/runImport.d.ts +19 -0
  26. package/dist/import/schemas.d.ts +91 -0
  27. package/dist/import/sel.d.ts +74 -0
  28. package/dist/import/types.d.ts +394 -0
  29. package/dist/index.d.ts +44 -0
  30. package/{types.d.ts → dist/types.d.ts} +96 -8
  31. package/package.json +33 -18
  32. package/src/ContextRecord.ts +243 -0
  33. package/src/DOMRenderExtension.ts +96 -0
  34. package/src/DOMRenderRuntime.ts +265 -0
  35. package/src/RenderContext.ts +168 -0
  36. package/src/compileDOMRenderConfigOverrides.ts +416 -0
  37. package/src/constants.ts +18 -0
  38. package/src/domOverride.ts +46 -0
  39. package/src/import/CoreImportExtension.ts +26 -0
  40. package/src/import/DOMImportExtension.ts +221 -0
  41. package/src/import/HorizontalRuleImportExtension.ts +53 -0
  42. package/src/import/ImportContext.ts +339 -0
  43. package/src/import/compileImportRules.ts +178 -0
  44. package/src/import/coreImportRules.ts +485 -0
  45. package/src/import/defineImportRule.ts +40 -0
  46. package/src/import/defineOverlayRules.ts +105 -0
  47. package/src/import/index.ts +96 -0
  48. package/src/import/inlineStylesFromStyleSheets.ts +104 -0
  49. package/src/import/parseCss.ts +219 -0
  50. package/src/import/runImport.ts +245 -0
  51. package/src/import/schemas.ts +236 -0
  52. package/src/import/sel.ts +314 -0
  53. package/src/import/types.ts +471 -0
  54. package/src/index.ts +555 -0
  55. package/src/types.ts +470 -0
  56. package/LexicalHtml.dev.js +0 -914
  57. package/LexicalHtml.dev.mjs +0 -900
  58. package/LexicalHtml.mjs +0 -24
  59. package/LexicalHtml.node.mjs +0 -22
  60. package/LexicalHtml.prod.js +0 -9
  61. package/LexicalHtml.prod.mjs +0 -9
  62. package/RenderContext.d.ts +0 -32
  63. package/domOverride.d.ts +0 -18
  64. package/index.d.ts +0 -32
  65. /package/{ContextRecord.d.ts → dist/ContextRecord.d.ts} +0 -0
  66. /package/{LexicalHtml.js → dist/LexicalHtml.js} +0 -0
@@ -6,6 +6,16 @@
6
6
  *
7
7
  */
8
8
  import type { DOMRenderConfig, DOMRenderExtensionOutput } from './types';
9
+ import type { InitialEditorConfig } from 'lexical';
10
+ /** @internal The result returned from {@link DOMRenderExtension}'s `init`. */
11
+ interface DOMRenderInitResult {
12
+ /**
13
+ * The `nodes` and base `dom` captured from the editor config before `dom`
14
+ * is overwritten with the compiled config — the only fields the runtime
15
+ * needs to recompile.
16
+ */
17
+ initialEditorConfig: Pick<InitialEditorConfig, 'nodes' | 'dom'>;
18
+ }
9
19
  /**
10
20
  * @experimental
11
21
  *
@@ -13,4 +23,5 @@ import type { DOMRenderConfig, DOMRenderExtensionOutput } from './types';
13
23
  * editor. This is highly experimental and subject to change from one version
14
24
  * to the next.
15
25
  **/
16
- export declare const DOMRenderExtension: import("lexical").LexicalExtension<DOMRenderConfig, "@lexical/html/DOM", DOMRenderExtensionOutput, void>;
26
+ export declare const DOMRenderExtension: import("lexical").LexicalExtension<DOMRenderConfig, "@lexical/html/DOM", DOMRenderExtensionOutput, DOMRenderInitResult>;
27
+ export {};
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Copyright (c) Meta Platforms, Inc. and affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ *
7
+ */
8
+ import type { AnyDOMRenderMatch, AnyRenderStateConfigPairOrUpdater, ContextRecord, DOMRenderRuntime, RenderStateConfig } from './types';
9
+ import type { EditorDOMRenderConfig, InitialEditorConfig, LexicalEditor } from 'lexical';
10
+ import { DOMRenderContextSymbol } from './constants';
11
+ type RenderContextRecord = ContextRecord<typeof DOMRenderContextSymbol>;
12
+ /**
13
+ * The mutable, writable editor-level context record. Reads of a render state
14
+ * during reconciliation (and as the base layer of a session) fall through to
15
+ * this record, and it is the layer the `disabledForEditor` predicates read.
16
+ *
17
+ * @internal
18
+ */
19
+ export declare function createEditorContextRecord(contextDefaults: readonly AnyRenderStateConfigPairOrUpdater[]): RenderContextRecord;
20
+ /**
21
+ * Filter the configured overrides down to those that are resident in the
22
+ * editor's render config, removing any whose `disabledForEditor` predicate
23
+ * returns `true` for the given editor context.
24
+ *
25
+ * @internal
26
+ */
27
+ export declare function filterEditorInstalled(overrides: readonly AnyDOMRenderMatch[], record: RenderContextRecord): AnyDOMRenderMatch[];
28
+ /**
29
+ * Per-editor runtime backing {@link DOMRenderExtension}'s conditional
30
+ * overrides and imperative editor context. See {@link DOMRenderRuntime}.
31
+ *
32
+ * @internal
33
+ */
34
+ export declare class DOMRenderRuntimeImpl implements DOMRenderRuntime {
35
+ readonly editor: LexicalEditor;
36
+ /**
37
+ * The `nodes` and base `dom` captured at `init` (before `dom` was
38
+ * overwritten with the compiled config) — the clean base for every recompile.
39
+ */
40
+ readonly initialEditorConfig: Pick<InitialEditorConfig, 'nodes' | 'dom'>;
41
+ readonly overrides: readonly AnyDOMRenderMatch[];
42
+ readonly editorContext: RenderContextRecord;
43
+ readonly hasSessionGates: boolean;
44
+ installed: readonly AnyDOMRenderMatch[];
45
+ /** Memoized session configs keyed by the set of session-disabled overrides. */
46
+ private readonly sessionCache;
47
+ constructor(editor: LexicalEditor, initialEditorConfig: Pick<InitialEditorConfig, 'nodes' | 'dom'>, overrides: readonly AnyDOMRenderMatch[], editorContext: RenderContextRecord);
48
+ setContextValue<V>(cfg: RenderStateConfig<V>, value: V): void;
49
+ getSessionConfig(): EditorDOMRenderConfig;
50
+ }
51
+ export {};