deckjsx 0.5.0 → 0.6.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.
@@ -1,3 +1,3 @@
1
- import { At as GraphNodeId, Bt as SemanticSlideNode, Dt as AssetEntity, Ft as SemanticNode, Gt as StyleClassRef, Ht as SemanticTextRunNode, It as SemanticNodeKind, Kt as StyleEntity, Lt as SemanticOrigin, Mt as SemanticContainerNode, Nt as SemanticDocumentNode, Ot as AssetEntityId, Pt as SemanticImageNode, Rt as SemanticRole, Ut as SourceIdentity, Vt as SemanticTextNode, Wt as SourceOrigin, jt as SemanticAuthorGraph, kt as BaseSemanticNode, qt as StyleEntityId, zt as SemanticShapeNode } from "./index-sb451NVh.mjs";
2
- import { a as ResolvedStyle, c as ResolvedStyleProperty, l as ResolvedStyleSource, n as CompileInspectResult, o as ResolvedStyleLayer, r as CompileMode, s as ResolvedStyleMap, u as StyleResolutionResult } from "./deck-CvTHG5ik.mjs";
3
- export { type AssetEntity, type AssetEntityId, type BaseSemanticNode, type CompileInspectResult, type CompileMode, type GraphNodeId, type ResolvedStyle, type ResolvedStyleLayer, type ResolvedStyleMap, type ResolvedStyleProperty, type ResolvedStyleSource, type SemanticAuthorGraph, type SemanticContainerNode, type SemanticDocumentNode, type SemanticImageNode, type SemanticNode, type SemanticNodeKind, type SemanticOrigin, type SemanticRole, type SemanticShapeNode, type SemanticSlideNode, type SemanticTextNode, type SemanticTextRunNode, type SourceIdentity, type SourceOrigin, type StyleClassRef, type StyleEntity, type StyleEntityId, type StyleResolutionResult };
1
+ import { At as SemanticContainerNode, Bt as SemanticTextRunNode, Et as BaseSemanticNode, Ft as SemanticOrigin, Gt as StyleEntityId, Ht as SourceOrigin, It as SemanticRole, Lt as SemanticShapeNode, Mt as SemanticImageNode, Nt as SemanticNode, Ot as GraphNodeId, Pt as SemanticNodeKind, Rt as SemanticSlideNode, Tt as AssetEntityId, Ut as StyleClassRef, Vt as SourceIdentity, Wt as StyleEntity, jt as SemanticDocumentNode, kt as SemanticAuthorGraph, wt as AssetEntity, zt as SemanticTextNode } from "./index-C5l8PX5V.mjs";
2
+ import { A as PptxContentTypeDefault, C as ProjectInspectionSummary, D as ResolvedStyleProperty, E as ResolvedStyleMap, M as PptxContentTypesPayload, N as PptxRelationshipsPayload, O as ResolvedStyleSource, S as ProjectInspectionResolvedValues, T as ResolvedStyleLayer, _ as ProjectInspectionAdapterLimitation, a as PptxElementKind, b as ProjectInspectionMediaSummary, c as PptxPackagePart, d as PptxRelationship, f as PptxRelationshipsPart, g as PptxSupportPartPayload, h as PptxSlidePart, i as PptxElementId, j as PptxContentTypeOverride, k as StyleResolutionResult, l as PptxPackagePartCategory, m as PptxSerializedIdentity, n as PptxContentTypesPart, o as PptxElementOrigin, p as PptxSerializedIdentities, r as PptxElement, s as PptxPackageModel, t as PackagePartId, u as PptxPackagePartKind, v as ProjectInspectionDiagnosticSummary, w as ResolvedStyle, x as ProjectInspectionPartSummary, y as ProjectInspectionElementSummary } from "./pptx-PzEK54aA.mjs";
3
+ export { type AssetEntity, type AssetEntityId, type BaseSemanticNode, type GraphNodeId, type PackagePartId, type PptxContentTypeDefault, type PptxContentTypeOverride, type PptxContentTypesPart, type PptxContentTypesPayload, type PptxElement, type PptxElementId, type PptxElementKind, type PptxElementOrigin, type PptxPackageModel, type PptxPackagePart, type PptxPackagePartCategory, type PptxPackagePartKind, type PptxRelationship, type PptxRelationshipsPart, type PptxRelationshipsPayload, type PptxSerializedIdentities, type PptxSerializedIdentity, type PptxSlidePart, type PptxSupportPartPayload, type ProjectInspectionAdapterLimitation, type ProjectInspectionDiagnosticSummary, type ProjectInspectionElementSummary, type ProjectInspectionMediaSummary, type ProjectInspectionPartSummary, type ProjectInspectionResolvedValues, type ProjectInspectionSummary, type ResolvedStyle, type ResolvedStyleLayer, type ResolvedStyleMap, type ResolvedStyleProperty, type ResolvedStyleSource, type SemanticAuthorGraph, type SemanticContainerNode, type SemanticDocumentNode, type SemanticImageNode, type SemanticNode, type SemanticNodeKind, type SemanticOrigin, type SemanticRole, type SemanticShapeNode, type SemanticSlideNode, type SemanticTextNode, type SemanticTextRunNode, type SourceIdentity, type SourceOrigin, type StyleClassRef, type StyleEntity, type StyleEntityId, type StyleResolutionResult };
@@ -1,3 +1,34 @@
1
+ //#region src/authoring/tags.ts
2
+ const INTRINSIC_VIEW_TAGS = new Set([
3
+ "article",
4
+ "aside",
5
+ "div",
6
+ "figure",
7
+ "footer",
8
+ "header",
9
+ "main",
10
+ "nav",
11
+ "section"
12
+ ]);
13
+ const INTRINSIC_TEXT_TAGS = new Set([
14
+ "h1",
15
+ "h2",
16
+ "h3",
17
+ "h4",
18
+ "h5",
19
+ "h6",
20
+ "p"
21
+ ]);
22
+ function isIntrinsicViewTag(value) {
23
+ return INTRINSIC_VIEW_TAGS.has(value);
24
+ }
25
+ function isIntrinsicTextTag(value) {
26
+ return INTRINSIC_TEXT_TAGS.has(value);
27
+ }
28
+ function isAuthoredTag(value) {
29
+ return isIntrinsicViewTag(value) || isIntrinsicTextTag(value) || value === "img" || value === "span";
30
+ }
31
+ //#endregion
1
32
  //#region src/authoring/tree.ts
2
33
  function isRecord$1(value) {
3
34
  return typeof value === "object" && value !== null;
@@ -48,6 +79,76 @@ function collectChildren(propsObject, children) {
48
79
  return children;
49
80
  }
50
81
  //#endregion
82
+ //#region src/authoring/author-node.ts
83
+ function textFromPrimitive(value) {
84
+ if (typeof value === "string" && value.trim().length === 0) return null;
85
+ const text = typeof value === "string" && /[\n\r\t]/.test(value) ? value.trim() : String(value);
86
+ if (text.length === 0) return null;
87
+ return authorNode("text", {}, [text]);
88
+ }
89
+ function authorNode(kind, props, children) {
90
+ return {
91
+ $$typeof: "deckjsx.author-node",
92
+ kind,
93
+ props,
94
+ children
95
+ };
96
+ }
97
+ function elementKind(node) {
98
+ if (node.source.kind === "component") switch (node.source.component) {
99
+ case "Slide": return "slide";
100
+ case "View": return "view";
101
+ case "Text": return "text";
102
+ case "Image": return "image";
103
+ case "Shape": return "shape";
104
+ }
105
+ if (isIntrinsicViewTag(node.source.tag)) return "view";
106
+ if (isIntrinsicTextTag(node.source.tag) || node.source.tag === "span") return "text";
107
+ return "image";
108
+ }
109
+ function convertChildrenFor(kind, children) {
110
+ const converted = [];
111
+ for (const child of children) {
112
+ if (child.kind === "fragment") {
113
+ converted.push(...convertChildrenFor(kind, child.children));
114
+ continue;
115
+ }
116
+ if (child.kind === "text") {
117
+ if (kind === "view" || kind === "slide") {
118
+ const textNode = textFromPrimitive(child.value);
119
+ if (textNode) converted.push(textNode);
120
+ continue;
121
+ }
122
+ converted.push(child.value);
123
+ continue;
124
+ }
125
+ converted.push(toAuthorNode(child));
126
+ }
127
+ return converted;
128
+ }
129
+ function toAuthorNode(node) {
130
+ const kind = elementKind(node);
131
+ const props = node.props;
132
+ switch (kind) {
133
+ case "slide": return authorNode("slide", props, convertChildrenFor(kind, node.children));
134
+ case "view": return authorNode("view", props, convertChildrenFor(kind, node.children));
135
+ case "text": return authorNode("text", props, convertChildrenFor(kind, node.children));
136
+ case "image": return authorNode("image", props, []);
137
+ case "shape": return authorNode("shape", props, []);
138
+ }
139
+ }
140
+ function toAuthorJsxNode(value) {
141
+ if (isAuthorNodeValue(value)) return value;
142
+ if (Array.isArray(value)) return value.map((item) => toAuthorJsxNode(item));
143
+ if (!isAuthorTreeNode(value)) return value;
144
+ if (value.kind === "fragment") return value.children.map((child) => toAuthorJsxNode(child));
145
+ if (value.kind === "text") return value.value;
146
+ return toAuthorNode(value);
147
+ }
148
+ function isAuthorNodeValue(value) {
149
+ return typeof value === "object" && value !== null && "$$typeof" in value && value.$$typeof === "deckjsx.author-node";
150
+ }
151
+ //#endregion
51
152
  //#region src/authoring/components.ts
52
153
  function splitChildren(props) {
53
154
  const { children, ...nodeProps } = props;
@@ -112,107 +213,6 @@ function Shape(props) {
112
213
  });
113
214
  }
114
215
  //#endregion
115
- //#region src/authoring/tags.ts
116
- const INTRINSIC_VIEW_TAGS = new Set([
117
- "article",
118
- "aside",
119
- "div",
120
- "figure",
121
- "footer",
122
- "header",
123
- "main",
124
- "nav",
125
- "section"
126
- ]);
127
- const INTRINSIC_TEXT_TAGS = new Set([
128
- "h1",
129
- "h2",
130
- "h3",
131
- "h4",
132
- "h5",
133
- "h6",
134
- "p"
135
- ]);
136
- function isIntrinsicViewTag(value) {
137
- return INTRINSIC_VIEW_TAGS.has(value);
138
- }
139
- function isIntrinsicTextTag(value) {
140
- return INTRINSIC_TEXT_TAGS.has(value);
141
- }
142
- function isAuthoredTag(value) {
143
- return isIntrinsicViewTag(value) || isIntrinsicTextTag(value) || value === "img" || value === "span";
144
- }
145
- //#endregion
146
- //#region src/authoring/legacy.ts
147
- function textFromPrimitive(value) {
148
- if (typeof value === "string" && value.trim().length === 0) return null;
149
- const text = typeof value === "string" && /[\n\r\t]/.test(value) ? value.trim() : String(value);
150
- if (text.length === 0) return null;
151
- return legacyNode("text", {}, [text]);
152
- }
153
- function legacyNode(kind, props, children) {
154
- return {
155
- $$typeof: "deckjsx.author-node",
156
- kind,
157
- props,
158
- children
159
- };
160
- }
161
- function elementKind(node) {
162
- if (node.source.kind === "component") switch (node.source.component) {
163
- case "Slide": return "slide";
164
- case "View": return "view";
165
- case "Text": return "text";
166
- case "Image": return "image";
167
- case "Shape": return "shape";
168
- }
169
- if (isIntrinsicViewTag(node.source.tag)) return "view";
170
- if (isIntrinsicTextTag(node.source.tag) || node.source.tag === "span") return "text";
171
- return "image";
172
- }
173
- function convertChildrenFor(kind, children) {
174
- const converted = [];
175
- for (const child of children) {
176
- if (child.kind === "fragment") {
177
- converted.push(...convertChildrenFor(kind, child.children));
178
- continue;
179
- }
180
- if (child.kind === "text") {
181
- if (kind === "view" || kind === "slide") {
182
- const textNode = textFromPrimitive(child.value);
183
- if (textNode) converted.push(textNode);
184
- continue;
185
- }
186
- converted.push(child.value);
187
- continue;
188
- }
189
- converted.push(toLegacyAuthorNode(child));
190
- }
191
- return converted;
192
- }
193
- function toLegacyAuthorNode(node) {
194
- const kind = elementKind(node);
195
- const props = node.props;
196
- switch (kind) {
197
- case "slide": return legacyNode("slide", props, convertChildrenFor(kind, node.children));
198
- case "view": return legacyNode("view", props, convertChildrenFor(kind, node.children));
199
- case "text": return legacyNode("text", props, convertChildrenFor(kind, node.children));
200
- case "image": return legacyNode("image", props, []);
201
- case "shape": return legacyNode("shape", props, []);
202
- }
203
- }
204
- function toLegacyJsxNode(value) {
205
- if (isLegacyAuthorNode(value)) return value;
206
- if (Array.isArray(value)) return value.map((item) => toLegacyJsxNode(item));
207
- if (!isAuthorTreeNode(value)) return value;
208
- if (value.kind === "fragment") return value.children.map((child) => toLegacyJsxNode(child));
209
- if (value.kind === "text") return value.value;
210
- return toLegacyAuthorNode(value);
211
- }
212
- function isLegacyAuthorNode(value) {
213
- return typeof value === "object" && value !== null && "$$typeof" in value && value.$$typeof === "deckjsx.author-node";
214
- }
215
- //#endregion
216
216
  //#region src/jsx.ts
217
217
  function isRecord(value) {
218
218
  return typeof value === "object" && value !== null;
@@ -277,7 +277,7 @@ function isAuthorNodeKind(value) {
277
277
  return value === "slide" || value === "view" || value === "text" || value === "image" || value === "shape";
278
278
  }
279
279
  function isAuthorNode(value) {
280
- if (!isLegacyAuthorNode(value)) return false;
280
+ if (!isAuthorNodeValue(value)) return false;
281
281
  return isAuthorNodeKind(value.kind);
282
282
  }
283
283
  function isSlideNode(value) {
@@ -287,4 +287,4 @@ function isContentNode(value) {
287
287
  return isAuthorNode(value) && value.kind !== "slide";
288
288
  }
289
289
  //#endregion
290
- export { isContentNode as a, toLegacyJsxNode as c, Shape as d, Slide as f, isAuthorTreeNode as h, isAuthorNode as i, isAuthoredTag as l, View as m, createElement as n, isSlideNode as o, Text as p, createElementWithMetadata as r, isLegacyAuthorNode as s, Fragment as t, Image as u };
290
+ export { isContentNode as a, Shape as c, View as d, isAuthorNodeValue as f, isAuthoredTag as h, isAuthorNode as i, Slide as l, isAuthorTreeNode as m, createElement as n, isSlideNode as o, toAuthorJsxNode as p, createElementWithMetadata as r, Image as s, Fragment as t, Text as u };
@@ -1,5 +1,5 @@
1
- import { on as AuthorTreeNode, sn as JsxKey } from "./index-sb451NVh.mjs";
2
- import { i as Fragment, n as jsx, r as jsxs, t as JSX } from "./jsx-runtime-Bk7Wx3AL.mjs";
1
+ import { an as JsxKey, in as AuthorTreeNode } from "./index-C5l8PX5V.mjs";
2
+ import { i as Fragment, n as jsx, r as jsxs, t as JSX } from "./jsx-runtime-DwfBuBkY.mjs";
3
3
 
4
4
  //#region src/jsx-dev-runtime.d.ts
5
5
  declare function jsxDEV(type: unknown, props: unknown, key?: JsxKey, _isStaticChildren?: boolean, source?: unknown): AuthorTreeNode;
@@ -1,4 +1,4 @@
1
- import { r as createElementWithMetadata, t as Fragment } from "./jsx-CK-x7PLd.mjs";
1
+ import { r as createElementWithMetadata, t as Fragment } from "./jsx-C671yNZa.mjs";
2
2
  import { jsx, jsxs } from "./jsx-runtime.mjs";
3
3
  //#region src/jsx-dev-runtime.ts
4
4
  function sourceSpanFromDevSource(source) {
@@ -1,4 +1,4 @@
1
- import { S as ViewProps, an as AuthorTreeChild, b as TextProps, c as ImageProps, d as IntrinsicImgProps, f as IntrinsicPProps, g as ShapeProps, in as AuthorElementNode, ln as IntrinsicTextTag, m as IntrinsicViewTag$1, o as DeckJsxIntrinsicElements, on as AuthorTreeNode, p as IntrinsicTextTag$1, sn as JsxKey, u as IntrinsicDivProps, un as IntrinsicViewTag, v as SlideProps } from "./index-sb451NVh.mjs";
1
+ import { _ as TextProps, a as DeckJsxIntrinsicElements, an as JsxKey, c as IntrinsicDivProps, cn as IntrinsicViewTag, d as IntrinsicTextTag$1, f as IntrinsicViewTag$1, h as SlideProps, in as AuthorTreeNode, l as IntrinsicImgProps, nn as AuthorElementNode, p as ShapeProps, rn as AuthorTreeChild, s as ImageProps, sn as IntrinsicTextTag, u as IntrinsicPProps, y as ViewProps } from "./index-C5l8PX5V.mjs";
2
2
 
3
3
  //#region src/authoring/components.d.ts
4
4
  declare function Slide(props: SlideProps): AuthorElementNode;
@@ -1,3 +1,3 @@
1
- import { sn as JsxKey } from "./index-sb451NVh.mjs";
2
- import { i as Fragment, n as jsx, r as jsxs, t as JSX } from "./jsx-runtime-Bk7Wx3AL.mjs";
1
+ import { an as JsxKey } from "./index-C5l8PX5V.mjs";
2
+ import { i as Fragment, n as jsx, r as jsxs, t as JSX } from "./jsx-runtime-DwfBuBkY.mjs";
3
3
  export { Fragment, JSX, JsxKey, jsx, jsxs };
@@ -1,4 +1,4 @@
1
- import { r as createElementWithMetadata, t as Fragment } from "./jsx-CK-x7PLd.mjs";
1
+ import { r as createElementWithMetadata, t as Fragment } from "./jsx-C671yNZa.mjs";
2
2
  //#region src/jsx-runtime.ts
3
3
  function jsx(type, props, key) {
4
4
  return createElementWithMetadata(type, props, key);