@openmaic/renderer 0.1.1 → 0.1.2

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/index.d.ts CHANGED
@@ -7,4 +7,5 @@ export { useViewportSize, type ViewportStyles, type UseViewportSizeOptions, type
7
7
  export { findElementGeometry, findNearestCorner, getElementPercentageGeometry, type PercentageGeometry, } from './utils/geometry';
8
8
  export { cn } from './utils/cn';
9
9
  export { getElementRange, getLineElementPath, getTableSubThemeColor } from './utils/element';
10
+ export { createTextProseStyles } from './styles';
10
11
  export * from './types';
package/dist/index.js CHANGED
@@ -10,5 +10,6 @@ export { useViewportSize } from './hooks/useViewportSize.js';
10
10
  export { findElementGeometry, findNearestCorner, getElementPercentageGeometry } from './utils/geometry.js';
11
11
  export { cn } from './utils/cn.js';
12
12
  export { getElementRange, getLineElementPath, getTableSubThemeColor } from './utils/element.js';
13
+ export { createTextProseStyles } from './styles.js';
13
14
  export * from '@openmaic/dsl';
14
15
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
package/dist/styles.d.ts CHANGED
@@ -8,4 +8,12 @@
8
8
  * `--paragraphSpace` CSS variable. List rules restore semantic markers that
9
9
  * host resets such as Tailwind Preflight remove.
10
10
  */
11
- export declare const SLIDE_RENDERER_STYLES = "\n.slide-renderer-prose p {\n margin-top: 0;\n margin-bottom: var(--paragraphSpace, 0);\n}\n.slide-renderer-prose p:last-child {\n margin-bottom: 0;\n}\n.slide-renderer-prose p:empty::before {\n content: '\\00a0';\n}\n.slide-renderer-prose .katex-display {\n margin: 0 !important;\n}\n.slide-renderer-prose ul {\n list-style-position: outside !important;\n padding-inline-start: 1.5rem !important;\n}\n.slide-renderer-prose ul:not([style*=\"list-style-type\"]) {\n list-style-type: disc !important;\n}\n.slide-renderer-prose ol {\n list-style-position: outside !important;\n padding-inline-start: 1.5rem !important;\n}\n.slide-renderer-prose ol:not([style*=\"list-style-type\"]) {\n list-style-type: decimal !important;\n}\n.slide-renderer-prose li {\n display: list-item !important;\n}\n/* Table cell inner container \u2014 matches the classroom (Vue) .cell-text design:\n tight base line-height, and a small spacing between adjacent <p> siblings\n so multi-paragraph cells don't collapse into a single visual block. The\n <p> margin reset above sets the baseline to 0; this rule re-adds spacing\n only between adjacent siblings, leaving the first/last paragraph flush. */\n.slide-renderer-cell-text p + p {\n margin-top: 0.4em;\n}\n@keyframes slide-renderer-pulse {\n 50% { opacity: 0.5; }\n}\n@keyframes slide-renderer-ping {\n 75%, 100% { transform: scale(2); opacity: 0; }\n}\n@keyframes slide-renderer-code-cursor-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0; }\n}\n.slide-renderer-pulse {\n animation: slide-renderer-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n.slide-renderer-ping {\n animation: slide-renderer-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n}\n";
11
+ /**
12
+ * Generates the reset rules that define rich-text geometry inside a slide.
13
+ *
14
+ * Both the static renderer and the ProseMirror editor need these exact rules:
15
+ * keeping the selector configurable lets them share one layout contract while
16
+ * retaining their different DOM roots.
17
+ */
18
+ export declare function createTextProseStyles(selector: string): string;
19
+ export declare const SLIDE_RENDERER_STYLES: string;
package/dist/styles.js CHANGED
@@ -8,37 +8,49 @@
8
8
  * `--paragraphSpace` CSS variable. List rules restore semantic markers that
9
9
  * host resets such as Tailwind Preflight remove.
10
10
  */
11
- const SLIDE_RENDERER_STYLES = `
12
- .slide-renderer-prose p {
11
+ /**
12
+ * Generates the reset rules that define rich-text geometry inside a slide.
13
+ *
14
+ * Both the static renderer and the ProseMirror editor need these exact rules:
15
+ * keeping the selector configurable lets them share one layout contract while
16
+ * retaining their different DOM roots.
17
+ */
18
+ function createTextProseStyles(selector) {
19
+ return `
20
+ ${selector} p {
13
21
  margin-top: 0;
14
22
  margin-bottom: var(--paragraphSpace, 0);
15
23
  }
16
- .slide-renderer-prose p:last-child {
24
+ ${selector} p:last-child {
17
25
  margin-bottom: 0;
18
26
  }
19
- .slide-renderer-prose p:empty::before {
27
+ ${selector} p:empty::before {
20
28
  content: '\\00a0';
21
29
  }
22
- .slide-renderer-prose .katex-display {
30
+ ${selector} .katex-display {
23
31
  margin: 0 !important;
24
32
  }
25
- .slide-renderer-prose ul {
33
+ ${selector} ul {
26
34
  list-style-position: outside !important;
27
35
  padding-inline-start: 1.5rem !important;
28
36
  }
29
- .slide-renderer-prose ul:not([style*="list-style-type"]) {
37
+ ${selector} ul:not([style*="list-style-type"]) {
30
38
  list-style-type: disc !important;
31
39
  }
32
- .slide-renderer-prose ol {
40
+ ${selector} ol {
33
41
  list-style-position: outside !important;
34
42
  padding-inline-start: 1.5rem !important;
35
43
  }
36
- .slide-renderer-prose ol:not([style*="list-style-type"]) {
44
+ ${selector} ol:not([style*="list-style-type"]) {
37
45
  list-style-type: decimal !important;
38
46
  }
39
- .slide-renderer-prose li {
47
+ ${selector} li {
40
48
  display: list-item !important;
41
49
  }
50
+ `;
51
+ }
52
+ const SLIDE_RENDERER_STYLES = `
53
+ ${createTextProseStyles('.slide-renderer-prose')}
42
54
  /* Table cell inner container — matches the classroom (Vue) .cell-text design:
43
55
  tight base line-height, and a small spacing between adjacent <p> siblings
44
56
  so multi-paragraph cells don't collapse into a single visual block. The
@@ -65,5 +77,5 @@ const SLIDE_RENDERER_STYLES = `
65
77
  }
66
78
  `;
67
79
 
68
- export { SLIDE_RENDERER_STYLES };
80
+ export { SLIDE_RENDERER_STYLES, createTextProseStyles };
69
81
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sources":["../src/styles.ts"],"sourcesContent":["/**\n * Package-level CSS rules that can't be expressed inline (descendant selectors,\n * keyframes, pseudo-classes). Rendered once via `<style>` at the top of\n * `<SlideCanvas>` so the package stays self-contained without Tailwind.\n *\n * The `.slide-renderer-prose` rules undo host and user-agent defaults so the\n * slide JSON is the single source of truth. Paragraph spacing comes from the\n * `--paragraphSpace` CSS variable. List rules restore semantic markers that\n * host resets such as Tailwind Preflight remove.\n */\nexport const SLIDE_RENDERER_STYLES = `\n.slide-renderer-prose p {\n margin-top: 0;\n margin-bottom: var(--paragraphSpace, 0);\n}\n.slide-renderer-prose p:last-child {\n margin-bottom: 0;\n}\n.slide-renderer-prose p:empty::before {\n content: '\\\\00a0';\n}\n.slide-renderer-prose .katex-display {\n margin: 0 !important;\n}\n.slide-renderer-prose ul {\n list-style-position: outside !important;\n padding-inline-start: 1.5rem !important;\n}\n.slide-renderer-prose ul:not([style*=\"list-style-type\"]) {\n list-style-type: disc !important;\n}\n.slide-renderer-prose ol {\n list-style-position: outside !important;\n padding-inline-start: 1.5rem !important;\n}\n.slide-renderer-prose ol:not([style*=\"list-style-type\"]) {\n list-style-type: decimal !important;\n}\n.slide-renderer-prose li {\n display: list-item !important;\n}\n/* Table cell inner container — matches the classroom (Vue) .cell-text design:\n tight base line-height, and a small spacing between adjacent <p> siblings\n so multi-paragraph cells don't collapse into a single visual block. The\n <p> margin reset above sets the baseline to 0; this rule re-adds spacing\n only between adjacent siblings, leaving the first/last paragraph flush. */\n.slide-renderer-cell-text p + p {\n margin-top: 0.4em;\n}\n@keyframes slide-renderer-pulse {\n 50% { opacity: 0.5; }\n}\n@keyframes slide-renderer-ping {\n 75%, 100% { transform: scale(2); opacity: 0; }\n}\n@keyframes slide-renderer-code-cursor-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0; }\n}\n.slide-renderer-pulse {\n animation: slide-renderer-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n.slide-renderer-ping {\n animation: slide-renderer-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n}\n`;\n"],"names":[],"mappings":"AAAA;;;;;;;;;AASG;AACI,MAAM,qBAAqB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"styles.js","sources":["../src/styles.ts"],"sourcesContent":["/**\n * Package-level CSS rules that can't be expressed inline (descendant selectors,\n * keyframes, pseudo-classes). Rendered once via `<style>` at the top of\n * `<SlideCanvas>` so the package stays self-contained without Tailwind.\n *\n * The `.slide-renderer-prose` rules undo host and user-agent defaults so the\n * slide JSON is the single source of truth. Paragraph spacing comes from the\n * `--paragraphSpace` CSS variable. List rules restore semantic markers that\n * host resets such as Tailwind Preflight remove.\n */\n/**\n * Generates the reset rules that define rich-text geometry inside a slide.\n *\n * Both the static renderer and the ProseMirror editor need these exact rules:\n * keeping the selector configurable lets them share one layout contract while\n * retaining their different DOM roots.\n */\nexport function createTextProseStyles(selector: string): string {\n return `\n${selector} p {\n margin-top: 0;\n margin-bottom: var(--paragraphSpace, 0);\n}\n${selector} p:last-child {\n margin-bottom: 0;\n}\n${selector} p:empty::before {\n content: '\\\\00a0';\n}\n${selector} .katex-display {\n margin: 0 !important;\n}\n${selector} ul {\n list-style-position: outside !important;\n padding-inline-start: 1.5rem !important;\n}\n${selector} ul:not([style*=\"list-style-type\"]) {\n list-style-type: disc !important;\n}\n${selector} ol {\n list-style-position: outside !important;\n padding-inline-start: 1.5rem !important;\n}\n${selector} ol:not([style*=\"list-style-type\"]) {\n list-style-type: decimal !important;\n}\n${selector} li {\n display: list-item !important;\n}\n`;\n}\n\nexport const SLIDE_RENDERER_STYLES = `\n${createTextProseStyles('.slide-renderer-prose')}\n/* Table cell inner container — matches the classroom (Vue) .cell-text design:\n tight base line-height, and a small spacing between adjacent <p> siblings\n so multi-paragraph cells don't collapse into a single visual block. The\n <p> margin reset above sets the baseline to 0; this rule re-adds spacing\n only between adjacent siblings, leaving the first/last paragraph flush. */\n.slide-renderer-cell-text p + p {\n margin-top: 0.4em;\n}\n@keyframes slide-renderer-pulse {\n 50% { opacity: 0.5; }\n}\n@keyframes slide-renderer-ping {\n 75%, 100% { transform: scale(2); opacity: 0; }\n}\n@keyframes slide-renderer-code-cursor-blink {\n 0%, 100% { opacity: 1; }\n 50% { opacity: 0; }\n}\n.slide-renderer-pulse {\n animation: slide-renderer-pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;\n}\n.slide-renderer-ping {\n animation: slide-renderer-ping 1s cubic-bezier(0, 0, 0.2, 1) infinite;\n}\n`;\n"],"names":[],"mappings":"AAAA;;;;;;;;;AASG;AACH;;;;;;AAMG;AACG,SAAU,qBAAqB,CAAC,QAAgB,EAAA;IACpD,OAAO;EACP,QAAQ,CAAA;;;;EAIR,QAAQ,CAAA;;;EAGR,QAAQ,CAAA;;;EAGR,QAAQ,CAAA;;;EAGR,QAAQ,CAAA;;;;EAIR,QAAQ,CAAA;;;EAGR,QAAQ,CAAA;;;;EAIR,QAAQ,CAAA;;;EAGR,QAAQ,CAAA;;;CAGT;AACD;AAEO,MAAM,qBAAqB,GAAG;EACnC,qBAAqB,CAAC,uBAAuB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openmaic/renderer",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "React component for rendering PPTist-style Slide JSON, extracted from OpenMAIC.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",