deckjsx 0.8.1 → 0.8.3
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/README.md +54 -1
- package/dist/{adapter-B-bVXjv-.d.mts → adapter-C8BoybUB.d.mts} +2 -2
- package/dist/{adapter-CNSvvD4i.mjs → adapter-CGOiv9ip.mjs} +534 -63
- package/dist/adapter.d.mts +1 -1
- package/dist/adapter.mjs +1 -1
- package/dist/{index-BlOsGMTm.d.mts → index-vl2Yas8y.d.mts} +59 -18
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +1677 -199
- package/dist/inspect.d.mts +3 -3
- package/dist/jsx-dev-runtime.d.mts +3 -2
- package/dist/jsx-dev-runtime.mjs +1 -1
- package/dist/{jsx-runtime-Dd6G09P7.d.mts → jsx-runtime-B94seTQQ.d.mts} +2 -1
- package/dist/{jsx-runtime-DzJLgS1w.mjs → jsx-runtime-pAHuQYMh.mjs} +15 -2
- package/dist/jsx-runtime.d.mts +2 -2
- package/dist/jsx-runtime.mjs +1 -1
- package/dist/{model-oqG9gKTq.d.mts → model-CbLfsOqw.d.mts} +33 -8
- package/dist/node-output-L2bV2_8g.mjs +136 -0
- package/dist/{resolve-CfjiMtv5.d.mts → resolve-PWa5z4mw.d.mts} +5 -2
- package/dist/{tree-DNsco0U3.mjs → tree-DY5XQegS.mjs} +9 -1
- package/package.json +1 -1
- package/dist/node-output-BXQOTLKj.mjs +0 -28
package/README.md
CHANGED
|
@@ -237,6 +237,11 @@ styles. Class conflicts are resolved by selector specificity first, then stylesh
|
|
|
237
237
|
rule order. Supported selectors are intentionally small: class selectors, tag/class compounds, and
|
|
238
238
|
descendant selectors such as `.title`, `p.title`, or `.card .caption`.
|
|
239
239
|
|
|
240
|
+
Inline `span` text runs inherit text-related parent values such as `color`, `fontFamily`,
|
|
241
|
+
`fontSize`, `fontWeight`, `lineHeight`, `letterSpacing`, `direction`, and wrapping controls. The
|
|
242
|
+
inherited values are visible in resolved-style inspection; Project avoids duplicating inherited-only
|
|
243
|
+
run styles when the parent text box already carries the concrete PPTX text body style.
|
|
244
|
+
|
|
240
245
|
Style cascade is source-local. A mounted child deck resolves its own theme and stylesheets against
|
|
241
246
|
its own slides, which keeps sandboxed and HMR-style composition predictable.
|
|
242
247
|
|
|
@@ -262,7 +267,9 @@ const deck = new Deck({
|
|
|
262
267
|
deck.slide({ template: "report" }, ({ template }) => (
|
|
263
268
|
<main>
|
|
264
269
|
<h1 area={template.title}>Quarterly Review</h1>
|
|
265
|
-
<section area={template.body}>
|
|
270
|
+
<section area={template.body}>
|
|
271
|
+
<p style={{ width: "100%", height: 0.5 }}>Performance highlights</p>
|
|
272
|
+
</section>
|
|
266
273
|
</main>
|
|
267
274
|
));
|
|
268
275
|
```
|
|
@@ -307,6 +314,25 @@ If a loader claims an image source but cannot provide dimensions, treat that as
|
|
|
307
314
|
retrieval failure and report it through Project diagnostics rather than waiting for the writer to
|
|
308
315
|
guess.
|
|
309
316
|
|
|
317
|
+
When an `img` has probed intrinsic `width` and `height`, layout uses that ratio if the author did
|
|
318
|
+
not provide `aspectRatio`. This means an image with only `width` can derive its projected height,
|
|
319
|
+
and an image with only `height` can derive its projected width. Author `aspectRatio` still wins for
|
|
320
|
+
intentional crops, logos, or placeholder boxes. `aspectRatio: "auto"` is accepted as the CSS-like
|
|
321
|
+
spelling for no authored ratio.
|
|
322
|
+
|
|
323
|
+
For foreground images, use `objectFit` / `fit`, `objectPosition`, and `crop`. `objectFit: "fill"`
|
|
324
|
+
uses the same projection as deckjsx's `stretch` fit; unsupported CSS values such as `"none"` and
|
|
325
|
+
`"scale-down"` are preserved as diagnostics and fall back to `contain`:
|
|
326
|
+
|
|
327
|
+
```tsx
|
|
328
|
+
<img src="hero.png" style={{ x: 1, y: 1, width: 4 }} />
|
|
329
|
+
<img src="portrait.png" style={{ x: 5.3, y: 1, width: 2, height: 2, objectFit: "cover" }} />
|
|
330
|
+
<img src="map.png" style={{ x: 1, y: 3.4, width: 4, height: 1.6, objectPosition: "right 25% bottom 10%" }} />
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
For decorative or underlay images inside a box, use background layers with `backgroundSize`,
|
|
334
|
+
`backgroundPosition`, `backgroundRepeat`, `backgroundClip`, and `backgroundOrigin`.
|
|
335
|
+
|
|
310
336
|
Primitive string and number children inside view-like elements are normalized to implicit text
|
|
311
337
|
nodes. Inline rich text uses `span` inside text-like elements:
|
|
312
338
|
|
|
@@ -336,6 +362,10 @@ and simple `gridColumn` / `gridRow` spans resolve to concrete slide coordinates
|
|
|
336
362
|
rendering. Absolutely positioned children inside flex or grid containers also use the
|
|
337
363
|
container content frame, including padding, as their containing block.
|
|
338
364
|
|
|
365
|
+
`display: "flex"` follows CSS-like defaults for the supported subset: row direction when
|
|
366
|
+
`flexDirection` is omitted, and cross-axis stretch when `alignItems` is omitted. The older
|
|
367
|
+
deck-specific `layout: "stack"` default remains vertical.
|
|
368
|
+
|
|
339
369
|
Use direct slide children when you want slide-global absolute placement. Use children
|
|
340
370
|
inside a view-like element when you want a local, web-like layout region.
|
|
341
371
|
|
|
@@ -350,6 +380,29 @@ include the unsupported feature, the projected value, and a fallback strategy de
|
|
|
350
380
|
were preserved and which behavior is still missing. Malformed projected unsupported-semantic payloads
|
|
351
381
|
from custom projections fail before Render emits bytes.
|
|
352
382
|
|
|
383
|
+
## CSS-like Defaults And Gotchas
|
|
384
|
+
|
|
385
|
+
deckjsx intentionally stays close to HTML/CSS naming, but the current v0.8 layout engine is a slide
|
|
386
|
+
layout solver, not a browser. These are the defaults most likely to surprise CSS authors:
|
|
387
|
+
|
|
388
|
+
| Area | deckjsx v0.8 behavior | Browser expectation | Guidance |
|
|
389
|
+
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------- |
|
|
390
|
+
| Block views | `display: "block"` creates a local containing block and vertically flows unpositioned children; explicit frame props still opt into local absolute placement. | Block formatting creates vertical flow. | Use ordinary block flow for simple stacks; use flex/grid or explicit frames for decks. |
|
|
391
|
+
| Flex | `display: "flex"` defaults to row and cross-axis stretch. | Same for the supported subset. | Prefer flex for simple rows/columns. |
|
|
392
|
+
| Sizing | Block-flow text gets available width and a line-height based height; explicit/local absolute boxes still need size, insets, layout stretch, or image ratio. | Many elements have intrinsic or content-based size. | Use declared sizes for precise PPTX geometry; rely on block defaults for simple text. |
|
|
393
|
+
| Text measurement | Stack/grid do not measure wrapped text to push later siblings. | Browser layout uses measured content. | Use declared heights or `fit: "shrink"` for text boxes. |
|
|
394
|
+
| Units | Layout numbers are inches; font-size-like numbers are points. Strings support common CSS units including `cm`, `mm`, `Q`, `pc`, `vmin`, and `vmax`. | CSS unitless numbers are property-specific. | Use strings for CSS-like units when supported, or keep numeric domains explicit. |
|
|
395
|
+
| CSS-wide keywords | `initial`, `inherit`, `unset`, `revert`, and `revert-layer` fall back to supported-subset defaults with diagnostics where full cascade/reset semantics are missing. | CSS has full cascade defaulting semantics. | Prefer ordinary omission for defaults; inspect diagnostics when using reset keywords. |
|
|
396
|
+
| Text spacing | `letterSpacing` accepts `normal` or point lengths; paragraph before/after spacing accepts point lengths. | CSS text spacing uses property-specific length rules. | Prefer `px`, `pt`, `em`, or `rem` when porting CSS-like text spacing. |
|
|
397
|
+
| Style keys | Unsupported CSS-like property names produce nonblocking compile warnings and remain visible in graph inspection. | Browsers ignore invalid declarations after parsing rules. | Use supported style keys; expect warnings for `flex`, `flexFlow`, or logical aliases. |
|
|
398
|
+
| Box sizing | Containers, text, and shapes default to `border-box`. | CSS initial is `content-box`. | This is deliberate for slide geometry. |
|
|
399
|
+
| Border radius | Single-value `borderRadius` supports percentages against the projected short side. | CSS supports richer per-corner radii. | `borderRadius: "50%"` works for capsule-like PPTX geometry. |
|
|
400
|
+
| Shadows | One shadow layer projects offset/blur/color; spread radius is preserved as unsupported fallback metadata. | CSS box-shadow supports spread and multiple layers. | Avoid relying on spread for exact PPTX output; Project diagnostics preserve it. |
|
|
401
|
+
| Grid | Missing tracks fill the available grid content frame. | CSS implicit tracks default to `auto`. | Declare tracks for precise dashboards. |
|
|
402
|
+
| Images | Foreground images default to contain/center and can use probed natural ratio. | `<img>` has intrinsic layout behavior in normal document flow. | Use one axis plus probed dimensions, or set both axes for a fixed box. |
|
|
403
|
+
| Shapes | Shapes default to visible white fill with no stroke. | CSS boxes are transparent unless styled. | Use `fill: "transparent"` or a `div` when you need a layout/debug box. |
|
|
404
|
+
| zIndex | Simple projected paint-order number. | CSS stacking contexts and `auto`. | Use it for slide paint order, not browser compositing semantics. |
|
|
405
|
+
|
|
353
406
|
## Development
|
|
354
407
|
|
|
355
408
|
```bash
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { bn as RenderedArtifact, hn as RenderInspectionSummary, in as OutputFormat, rn as InspectionDetailLevel, sn as ProjectionFormat, w as PptxPackageModel } from "./model-
|
|
1
|
+
import { et as Diagnostics } from "./index-vl2Yas8y.mjs";
|
|
2
|
+
import { bn as RenderedArtifact, hn as RenderInspectionSummary, in as OutputFormat, rn as InspectionDetailLevel, sn as ProjectionFormat, w as PptxPackageModel } from "./model-CbLfsOqw.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/adapter.d.ts
|
|
5
5
|
type PptxRenderOptions = {
|