@hanzo/ui 8.4.13 → 8.5.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.
- package/dist/backends/gui/index.cjs +11 -1
- package/dist/backends/gui/index.d.ts +3 -0
- package/dist/backends/gui/index.d.ts.map +1 -1
- package/dist/backends/gui/index.js +3 -0
- package/dist/backends/gui/index.js.map +1 -1
- package/dist/backends/gui/link.cjs +126 -0
- package/dist/backends/gui/link.d.ts +65 -0
- package/dist/backends/gui/link.d.ts.map +1 -0
- package/dist/backends/gui/link.js +88 -0
- package/dist/backends/gui/link.js.map +1 -0
- package/dist/backends/gui/prose.cjs +33 -0
- package/dist/backends/gui/prose.d.ts +39 -0
- package/dist/backends/gui/prose.d.ts.map +1 -0
- package/dist/backends/gui/prose.js +30 -0
- package/dist/backends/gui/prose.js.map +1 -0
- package/dist/backends/gui/video.cjs +89 -0
- package/dist/backends/gui/video.d.ts +33 -0
- package/dist/backends/gui/video.d.ts.map +1 -0
- package/dist/backends/gui/video.js +53 -0
- package/dist/backends/gui/video.js.map +1 -0
- package/dist/blocks/accordian.cjs +19 -0
- package/dist/blocks/accordian.d.ts +4 -0
- package/dist/blocks/accordian.d.ts.map +1 -0
- package/dist/blocks/accordian.js +16 -0
- package/dist/blocks/accordian.js.map +1 -0
- package/dist/blocks/bullet-cards.cjs +40 -0
- package/dist/blocks/bullet-cards.d.ts +10 -0
- package/dist/blocks/bullet-cards.d.ts.map +1 -0
- package/dist/blocks/bullet-cards.js +37 -0
- package/dist/blocks/bullet-cards.js.map +1 -0
- package/dist/blocks/card.cjs +58 -0
- package/dist/blocks/card.d.ts +14 -0
- package/dist/blocks/card.d.ts.map +1 -0
- package/dist/blocks/card.js +55 -0
- package/dist/blocks/card.js.map +1 -0
- package/dist/blocks/carte-blanche.cjs +38 -0
- package/dist/blocks/carte-blanche.d.ts +13 -0
- package/dist/blocks/carte-blanche.d.ts.map +1 -0
- package/dist/blocks/carte-blanche.js +35 -0
- package/dist/blocks/carte-blanche.js.map +1 -0
- package/dist/blocks/content.cjs +65 -0
- package/dist/blocks/content.d.ts +11 -0
- package/dist/blocks/content.d.ts.map +1 -0
- package/dist/blocks/content.js +61 -0
- package/dist/blocks/content.js.map +1 -0
- package/dist/blocks/cta.cjs +103 -0
- package/dist/blocks/cta.d.ts +13 -0
- package/dist/blocks/cta.d.ts.map +1 -0
- package/dist/blocks/cta.js +67 -0
- package/dist/blocks/cta.js.map +1 -0
- package/dist/blocks/def.cjs +24 -0
- package/dist/blocks/def.d.ts +191 -0
- package/dist/blocks/def.d.ts.map +1 -0
- package/dist/blocks/def.js +22 -0
- package/dist/blocks/def.js.map +1 -0
- package/dist/blocks/enh-heading.cjs +86 -0
- package/dist/blocks/enh-heading.d.ts +7 -0
- package/dist/blocks/enh-heading.d.ts.map +1 -0
- package/dist/blocks/enh-heading.js +83 -0
- package/dist/blocks/enh-heading.js.map +1 -0
- package/dist/blocks/grid.cjs +98 -0
- package/dist/blocks/grid.d.ts +18 -0
- package/dist/blocks/grid.d.ts.map +1 -0
- package/dist/blocks/grid.js +62 -0
- package/dist/blocks/grid.js.map +1 -0
- package/dist/blocks/group.cjs +43 -0
- package/dist/blocks/group.d.ts +4 -0
- package/dist/blocks/group.d.ts.map +1 -0
- package/dist/blocks/group.js +40 -0
- package/dist/blocks/group.js.map +1 -0
- package/dist/blocks/heading.cjs +22 -0
- package/dist/blocks/heading.d.ts +4 -0
- package/dist/blocks/heading.d.ts.map +1 -0
- package/dist/blocks/heading.js +19 -0
- package/dist/blocks/heading.js.map +1 -0
- package/dist/blocks/image.cjs +54 -0
- package/dist/blocks/image.d.ts +19 -0
- package/dist/blocks/image.d.ts.map +1 -0
- package/dist/blocks/image.js +51 -0
- package/dist/blocks/image.js.map +1 -0
- package/dist/blocks/index.cjs +65 -0
- package/dist/blocks/index.d.ts +18 -0
- package/dist/blocks/index.d.ts.map +1 -0
- package/dist/blocks/index.js +30 -0
- package/dist/blocks/index.js.map +1 -0
- package/dist/blocks/screenful.cjs +139 -0
- package/dist/blocks/screenful.d.ts +18 -0
- package/dist/blocks/screenful.d.ts.map +1 -0
- package/dist/blocks/screenful.js +103 -0
- package/dist/blocks/screenful.js.map +1 -0
- package/dist/blocks/space.cjs +38 -0
- package/dist/blocks/space.d.ts +4 -0
- package/dist/blocks/space.d.ts.map +1 -0
- package/dist/blocks/space.js +35 -0
- package/dist/blocks/space.js.map +1 -0
- package/dist/blocks/spec.cjs +58 -0
- package/dist/blocks/spec.d.ts +60 -0
- package/dist/blocks/spec.d.ts.map +1 -0
- package/dist/blocks/spec.js +52 -0
- package/dist/blocks/spec.js.map +1 -0
- package/dist/blocks/video.cjs +103 -0
- package/dist/blocks/video.d.ts +22 -0
- package/dist/blocks/video.d.ts.map +1 -0
- package/dist/blocks/video.js +67 -0
- package/dist/blocks/video.js.map +1 -0
- package/dist/gallery.html +102 -1
- package/dist/index.cjs +9 -2
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.node.js +1 -1
- package/dist/primitives/ApplyTypography.cjs +8 -0
- package/dist/primitives/ApplyTypography.d.ts +2 -0
- package/dist/primitives/ApplyTypography.d.ts.map +1 -0
- package/dist/primitives/ApplyTypography.js +5 -0
- package/dist/primitives/ApplyTypography.js.map +1 -0
- package/dist/primitives/Link.cjs +8 -0
- package/dist/primitives/Link.d.ts +2 -0
- package/dist/primitives/Link.d.ts.map +1 -0
- package/dist/primitives/Link.js +5 -0
- package/dist/primitives/Link.js.map +1 -0
- package/dist/primitives/LinkElement.cjs +8 -0
- package/dist/primitives/LinkElement.d.ts +2 -0
- package/dist/primitives/LinkElement.d.ts.map +1 -0
- package/dist/primitives/LinkElement.js +5 -0
- package/dist/primitives/LinkElement.js.map +1 -0
- package/dist/primitives/MDXLink.cjs +8 -0
- package/dist/primitives/MDXLink.d.ts +2 -0
- package/dist/primitives/MDXLink.d.ts.map +1 -0
- package/dist/primitives/MDXLink.js +5 -0
- package/dist/primitives/MDXLink.js.map +1 -0
- package/dist/primitives/VideoPlayer.cjs +8 -0
- package/dist/primitives/VideoPlayer.d.ts +2 -0
- package/dist/primitives/VideoPlayer.d.ts.map +1 -0
- package/dist/primitives/VideoPlayer.js +5 -0
- package/dist/primitives/VideoPlayer.js.map +1 -0
- package/dist/primitives/YouTubeEmbed.cjs +8 -0
- package/dist/primitives/YouTubeEmbed.d.ts +2 -0
- package/dist/primitives/YouTubeEmbed.d.ts.map +1 -0
- package/dist/primitives/YouTubeEmbed.js +5 -0
- package/dist/primitives/YouTubeEmbed.js.map +1 -0
- package/dist/primitives/useLink.cjs +8 -0
- package/dist/primitives/useLink.d.ts +2 -0
- package/dist/primitives/useLink.d.ts.map +1 -0
- package/dist/primitives/useLink.js +5 -0
- package/dist/primitives/useLink.js.map +1 -0
- package/dist/product/menu/items.d.ts +1 -1
- package/dist/product/menu/items.d.ts.map +1 -1
- package/dist/styles.css +101 -0
- package/dist/theme.css +101 -0
- package/dist/tw.cjs +62 -1
- package/dist/tw.d.ts.map +1 -1
- package/dist/tw.js +62 -1
- package/dist/tw.js.map +1 -1
- package/dist/types.cjs +32 -0
- package/dist/types.d.ts +136 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +30 -0
- package/dist/types.js.map +1 -0
- package/package.json +13 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
// @hanzo/ui/blocks — content as data, and the renderers that draw it.
|
|
3
|
+
//
|
|
4
|
+
// import { Content, type Block } from '@hanzo/ui/blocks'
|
|
5
|
+
// <Content blocks={page} agent={agent} />
|
|
6
|
+
//
|
|
7
|
+
// A page is a `Block[]`. Each block names its type, the type picks a renderer,
|
|
8
|
+
// and the renderer reads the rest of the fields. So the content can be authored
|
|
9
|
+
// in a CMS, checked into a repo or produced by a server, and typed either way.
|
|
10
|
+
//
|
|
11
|
+
// The types and the components are both exported from here because the 5.x line
|
|
12
|
+
// exported them from here, and every consuming site imports both. `Block` is the
|
|
13
|
+
// type, `BlocksComponent` draws a list of them — the `…Component` suffix is what
|
|
14
|
+
// tells the two apart at a call site where both are in scope.
|
|
15
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
18
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
19
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
20
|
+
}
|
|
21
|
+
Object.defineProperty(o, k2, desc);
|
|
22
|
+
}) : (function(o, m, k, k2) {
|
|
23
|
+
if (k2 === undefined) k2 = k;
|
|
24
|
+
o[k2] = m[k];
|
|
25
|
+
}));
|
|
26
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
27
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.VideoBlockComponent = exports.SpaceBlockComponent = exports.ScreenfulBlockComponent = exports.ImageBlockComponent = exports.HeadingBlockComponent = exports.GroupBlockComponent = exports.GridBlockComponent = exports.EnhHeadingBlockComponent = exports.CTABlockComponent = exports.CarteBlancheBlockComponent = exports.CardBlockComponent = exports.BulletCardsBlockComponent = exports.AccordianBlockComponent = exports.registerBlockType = exports.ContentComponent = exports.BlocksComponent = exports.Content = exports.fit = exports.has = void 0;
|
|
31
|
+
__exportStar(require("./def.cjs"), exports);
|
|
32
|
+
var spec_1 = require("./spec.cjs");
|
|
33
|
+
Object.defineProperty(exports, "has", { enumerable: true, get: function () { return spec_1.has; } });
|
|
34
|
+
Object.defineProperty(exports, "fit", { enumerable: true, get: function () { return spec_1.fit; } });
|
|
35
|
+
var content_1 = require("./content.cjs");
|
|
36
|
+
Object.defineProperty(exports, "Content", { enumerable: true, get: function () { return content_1.Content; } });
|
|
37
|
+
Object.defineProperty(exports, "BlocksComponent", { enumerable: true, get: function () { return content_1.Content; } });
|
|
38
|
+
Object.defineProperty(exports, "ContentComponent", { enumerable: true, get: function () { return content_1.Content; } });
|
|
39
|
+
Object.defineProperty(exports, "registerBlockType", { enumerable: true, get: function () { return content_1.registerBlockType; } });
|
|
40
|
+
var accordian_1 = require("./accordian.cjs");
|
|
41
|
+
Object.defineProperty(exports, "AccordianBlockComponent", { enumerable: true, get: function () { return accordian_1.AccordianBlockComponent; } });
|
|
42
|
+
var bullet_cards_1 = require("./bullet-cards.cjs");
|
|
43
|
+
Object.defineProperty(exports, "BulletCardsBlockComponent", { enumerable: true, get: function () { return bullet_cards_1.BulletCardsBlockComponent; } });
|
|
44
|
+
var card_1 = require("./card.cjs");
|
|
45
|
+
Object.defineProperty(exports, "CardBlockComponent", { enumerable: true, get: function () { return card_1.CardBlockComponent; } });
|
|
46
|
+
var carte_blanche_1 = require("./carte-blanche.cjs");
|
|
47
|
+
Object.defineProperty(exports, "CarteBlancheBlockComponent", { enumerable: true, get: function () { return carte_blanche_1.CarteBlancheBlockComponent; } });
|
|
48
|
+
var cta_1 = require("./cta.cjs");
|
|
49
|
+
Object.defineProperty(exports, "CTABlockComponent", { enumerable: true, get: function () { return cta_1.CTABlockComponent; } });
|
|
50
|
+
var enh_heading_1 = require("./enh-heading.cjs");
|
|
51
|
+
Object.defineProperty(exports, "EnhHeadingBlockComponent", { enumerable: true, get: function () { return enh_heading_1.EnhHeadingBlockComponent; } });
|
|
52
|
+
var grid_1 = require("./grid.cjs");
|
|
53
|
+
Object.defineProperty(exports, "GridBlockComponent", { enumerable: true, get: function () { return grid_1.GridBlockComponent; } });
|
|
54
|
+
var group_1 = require("./group.cjs");
|
|
55
|
+
Object.defineProperty(exports, "GroupBlockComponent", { enumerable: true, get: function () { return group_1.GroupBlockComponent; } });
|
|
56
|
+
var heading_1 = require("./heading.cjs");
|
|
57
|
+
Object.defineProperty(exports, "HeadingBlockComponent", { enumerable: true, get: function () { return heading_1.HeadingBlockComponent; } });
|
|
58
|
+
var image_1 = require("./image.cjs");
|
|
59
|
+
Object.defineProperty(exports, "ImageBlockComponent", { enumerable: true, get: function () { return image_1.ImageBlockComponent; } });
|
|
60
|
+
var screenful_1 = require("./screenful.cjs");
|
|
61
|
+
Object.defineProperty(exports, "ScreenfulBlockComponent", { enumerable: true, get: function () { return screenful_1.ScreenfulBlockComponent; } });
|
|
62
|
+
var space_1 = require("./space.cjs");
|
|
63
|
+
Object.defineProperty(exports, "SpaceBlockComponent", { enumerable: true, get: function () { return space_1.SpaceBlockComponent; } });
|
|
64
|
+
var video_1 = require("./video.cjs");
|
|
65
|
+
Object.defineProperty(exports, "VideoBlockComponent", { enumerable: true, get: function () { return video_1.VideoBlockComponent; } });
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export * from './def.js';
|
|
2
|
+
export type { BlockComponentProps } from './spec.js';
|
|
3
|
+
export { has, fit } from './spec.js';
|
|
4
|
+
export { Content, Content as BlocksComponent, Content as ContentComponent, registerBlockType } from './content.js';
|
|
5
|
+
export { AccordianBlockComponent } from './accordian.js';
|
|
6
|
+
export { BulletCardsBlockComponent } from './bullet-cards.js';
|
|
7
|
+
export { CardBlockComponent } from './card.js';
|
|
8
|
+
export { CarteBlancheBlockComponent } from './carte-blanche.js';
|
|
9
|
+
export { CTABlockComponent } from './cta.js';
|
|
10
|
+
export { EnhHeadingBlockComponent } from './enh-heading.js';
|
|
11
|
+
export { GridBlockComponent } from './grid.js';
|
|
12
|
+
export { GroupBlockComponent } from './group.js';
|
|
13
|
+
export { HeadingBlockComponent } from './heading.js';
|
|
14
|
+
export { ImageBlockComponent } from './image.js';
|
|
15
|
+
export { ScreenfulBlockComponent } from './screenful.js';
|
|
16
|
+
export { SpaceBlockComponent } from './space.js';
|
|
17
|
+
export { VideoBlockComponent } from './video.js';
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAcA,cAAc,OAAO,CAAA;AACrB,YAAY,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AACjD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,OAAO,IAAI,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @hanzo/ui/blocks — content as data, and the renderers that draw it.
|
|
2
|
+
//
|
|
3
|
+
// import { Content, type Block } from '@hanzo/ui/blocks'
|
|
4
|
+
// <Content blocks={page} agent={agent} />
|
|
5
|
+
//
|
|
6
|
+
// A page is a `Block[]`. Each block names its type, the type picks a renderer,
|
|
7
|
+
// and the renderer reads the rest of the fields. So the content can be authored
|
|
8
|
+
// in a CMS, checked into a repo or produced by a server, and typed either way.
|
|
9
|
+
//
|
|
10
|
+
// The types and the components are both exported from here because the 5.x line
|
|
11
|
+
// exported them from here, and every consuming site imports both. `Block` is the
|
|
12
|
+
// type, `BlocksComponent` draws a list of them — the `…Component` suffix is what
|
|
13
|
+
// tells the two apart at a call site where both are in scope.
|
|
14
|
+
export * from './def.js';
|
|
15
|
+
export { has, fit } from './spec.js';
|
|
16
|
+
export { Content, Content as BlocksComponent, Content as ContentComponent, registerBlockType } from './content.js';
|
|
17
|
+
export { AccordianBlockComponent } from './accordian.js';
|
|
18
|
+
export { BulletCardsBlockComponent } from './bullet-cards.js';
|
|
19
|
+
export { CardBlockComponent } from './card.js';
|
|
20
|
+
export { CarteBlancheBlockComponent } from './carte-blanche.js';
|
|
21
|
+
export { CTABlockComponent } from './cta.js';
|
|
22
|
+
export { EnhHeadingBlockComponent } from './enh-heading.js';
|
|
23
|
+
export { GridBlockComponent } from './grid.js';
|
|
24
|
+
export { GroupBlockComponent } from './group.js';
|
|
25
|
+
export { HeadingBlockComponent } from './heading.js';
|
|
26
|
+
export { ImageBlockComponent } from './image.js';
|
|
27
|
+
export { ScreenfulBlockComponent } from './screenful.js';
|
|
28
|
+
export { SpaceBlockComponent } from './space.js';
|
|
29
|
+
export { VideoBlockComponent } from './video.js';
|
|
30
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/blocks/index.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,EAAE;AACF,2DAA2D;AAC3D,4CAA4C;AAC5C,EAAE;AACF,+EAA+E;AAC/E,gFAAgF;AAChF,+EAA+E;AAC/E,EAAE;AACF,gFAAgF;AAChF,iFAAiF;AACjF,iFAAiF;AACjF,8DAA8D;AAE9D,cAAc,OAAO,CAAA;AAErB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,EAAE,OAAO,EAAE,OAAO,IAAI,eAAe,EAAE,OAAO,IAAI,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAA;AAE/G,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAA;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAA;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAA;AACzC,OAAO,EAAE,wBAAwB,EAAE,MAAM,eAAe,CAAA;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAA;AAC3C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,qBAAqB,EAAE,MAAM,WAAW,CAAA;AACjD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAA;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
|
+
if (k2 === undefined) k2 = k;
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
10
|
+
}) : (function(o, m, k, k2) {
|
|
11
|
+
if (k2 === undefined) k2 = k;
|
|
12
|
+
o[k2] = m[k];
|
|
13
|
+
}));
|
|
14
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
15
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
16
|
+
}) : function(o, v) {
|
|
17
|
+
o["default"] = v;
|
|
18
|
+
});
|
|
19
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
20
|
+
var ownKeys = function(o) {
|
|
21
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
22
|
+
var ar = [];
|
|
23
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
24
|
+
return ar;
|
|
25
|
+
};
|
|
26
|
+
return ownKeys(o);
|
|
27
|
+
};
|
|
28
|
+
return function (mod) {
|
|
29
|
+
if (mod && mod.__esModule) return mod;
|
|
30
|
+
var result = {};
|
|
31
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
32
|
+
__setModuleDefault(result, mod);
|
|
33
|
+
return result;
|
|
34
|
+
};
|
|
35
|
+
})();
|
|
36
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
|
+
exports.ScreenfulBlockComponent = void 0;
|
|
38
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
39
|
+
const React = __importStar(require("react"));
|
|
40
|
+
const prose_1 = require("../backends/gui/prose.cjs");
|
|
41
|
+
const box_1 = require("../box.cjs");
|
|
42
|
+
const cn_1 = require("../core/cn.cjs");
|
|
43
|
+
const content_1 = require("./content.cjs");
|
|
44
|
+
const spec_1 = require("./spec.cjs");
|
|
45
|
+
/**
|
|
46
|
+
* Is the element mostly on screen?
|
|
47
|
+
*
|
|
48
|
+
* Native IntersectionObserver rather than a package: this is the only place in
|
|
49
|
+
* the library that needs it, and the hook it would replace is fifteen lines.
|
|
50
|
+
* 0.75 because the caller is deciding whether to PLAY a video — a strip of it
|
|
51
|
+
* appearing at the edge of the viewport is not someone watching.
|
|
52
|
+
*/
|
|
53
|
+
const useInView = (threshold = 0.75, initial = false) => {
|
|
54
|
+
const ref = React.useRef(null);
|
|
55
|
+
const [inView, setInView] = React.useState(initial);
|
|
56
|
+
React.useEffect(() => {
|
|
57
|
+
const el = ref.current;
|
|
58
|
+
if (!el || typeof IntersectionObserver === 'undefined')
|
|
59
|
+
return;
|
|
60
|
+
const io = new IntersectionObserver(([e]) => setInView(e.isIntersecting), { threshold });
|
|
61
|
+
io.observe(el);
|
|
62
|
+
return () => io.disconnect();
|
|
63
|
+
}, [threshold]);
|
|
64
|
+
return { ref, inView };
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* A background video that plays only while it is on screen.
|
|
68
|
+
*
|
|
69
|
+
* Mounted after the first client render, never on the server: a `<video>` in
|
|
70
|
+
* server markup is a download that starts before anything has decided the
|
|
71
|
+
* element is even visible.
|
|
72
|
+
*/
|
|
73
|
+
const Backdrop = ({ block, className, initialInView, }) => {
|
|
74
|
+
const [mounted, setMounted] = React.useState(false);
|
|
75
|
+
const { ref, inView } = useInView(0.75, initialInView);
|
|
76
|
+
React.useEffect(() => setMounted(true), []);
|
|
77
|
+
if (!mounted)
|
|
78
|
+
return null;
|
|
79
|
+
return ((0, jsx_runtime_1.jsx)("div", { ref: ref, className: className, children: inView && ((0, jsx_runtime_1.jsx)("video", { autoPlay: true, loop: true, muted: true, playsInline: true, style: { margin: 0, height: '100%', width: '100%', objectFit: 'cover' }, children: block.sources?.map((src, i) => ((0, jsx_runtime_1.jsx)("source", { src: src }, i))) })) }));
|
|
80
|
+
};
|
|
81
|
+
/** The banner, as a still. It is also the video's first frame, so nothing jumps. */
|
|
82
|
+
const Poster = ({ banner, className, children, }) => banner ? ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('relative', className), style: {
|
|
83
|
+
height: '100%',
|
|
84
|
+
width: '100%',
|
|
85
|
+
backgroundImage: `url(${typeof banner === 'string' ? banner : banner.poster})`,
|
|
86
|
+
backgroundSize: 'cover',
|
|
87
|
+
backgroundRepeat: 'no-repeat',
|
|
88
|
+
}, children: children })) : ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('h-full w-full relative', className), children: children }));
|
|
89
|
+
/** One column of a screenful, placed by its own specifiers. */
|
|
90
|
+
const Column = ({ blocks, specifiers, agent, className, }) => {
|
|
91
|
+
const spec = (s) => (0, spec_1.has)(specifiers, s);
|
|
92
|
+
const phone = agent === 'phone';
|
|
93
|
+
const place = phone
|
|
94
|
+
? (0, cn_1.cn)('items-start', spec('mobile-vert-center') ? 'justify-center' : 'justify-start')
|
|
95
|
+
: (0, cn_1.cn)(spec('right') ? 'items-end' : spec('center') ? 'items-center' : 'items-start', spec('bottom') ? 'justify-end' : spec('vert-center') ? 'justify-center' : 'justify-start',
|
|
96
|
+
// Right-aligned running text is hard to read at phone widths, so this
|
|
97
|
+
// is a desktop-only hint on purpose.
|
|
98
|
+
spec('text-align-right') ? 'text-right' : 'text-left');
|
|
99
|
+
// h-full is what makes the vertical placement above mean anything — without a
|
|
100
|
+
// height there is no free space for `justify-*` to distribute.
|
|
101
|
+
return ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('flex flex-col justify-center h-full', place, className), children: (0, jsx_runtime_1.jsx)(content_1.Content, { blocks: blocks, agent: agent }) }));
|
|
102
|
+
};
|
|
103
|
+
const Columns = ({ block: b, agent, className, }) => {
|
|
104
|
+
if (b.contentColumns.length === 1) {
|
|
105
|
+
return ((0, jsx_runtime_1.jsx)(Column, { blocks: b.contentColumns[0], specifiers: b.columnSpecifiers?.[0], agent: agent, className: className }));
|
|
106
|
+
}
|
|
107
|
+
// `order` is one-based in flex, and the 5.x original tested the index for
|
|
108
|
+
// truthiness — so the column asked to come FIRST was the one that never moved.
|
|
109
|
+
const order = (i) => {
|
|
110
|
+
const at = b.mobileOrder?.indexOf(i);
|
|
111
|
+
return at !== undefined && at >= 0 ? `order-${at + 1} md:order-none` : '';
|
|
112
|
+
};
|
|
113
|
+
return ((0, jsx_runtime_1.jsx)(box_1.Box, { className: (0, cn_1.cn)('flex flex-col gap-2 sm:gap-4 h-full', agent !== 'phone' && `md:grid md:gap-8 md:grid-cols-${b.contentColumns.length}`, className), children: b.contentColumns.map((column, i) => ((0, jsx_runtime_1.jsx)(Column, { blocks: column, specifiers: b.columnSpecifiers?.[i], agent: agent, className: order(i) }, i))) }));
|
|
114
|
+
};
|
|
115
|
+
/**
|
|
116
|
+
* One screenful: a full-height section, optionally over a banner, holding one
|
|
117
|
+
* to three columns of blocks.
|
|
118
|
+
*
|
|
119
|
+
* `snapTile` makes it a stop in a scroll-snapping sequence, which is why it
|
|
120
|
+
* fixes the height rather than setting a minimum — a snap point that can grow
|
|
121
|
+
* past the viewport can never be fully scrolled to.
|
|
122
|
+
*/
|
|
123
|
+
const ScreenfulBlockComponent = ({ block, agent, initialInView = false, snapTile = false, className, contentClassName, bottom, }) => {
|
|
124
|
+
if (block.blockType !== 'screenful')
|
|
125
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "screenful block required" });
|
|
126
|
+
const b = block;
|
|
127
|
+
const spec = (s) => (0, spec_1.has)(b.specifiers, s);
|
|
128
|
+
const video = b.banner && typeof b.banner === 'object';
|
|
129
|
+
const oneColumn = b.contentColumns.length === 1;
|
|
130
|
+
const vertCenter = spec('vert-center');
|
|
131
|
+
const gutters = spec('narrow-gutters')
|
|
132
|
+
? (0, cn_1.cn)('px-6 lg:px-8 2xl:px-2 pb-4 lg:pb-6 xl:pb-8', snapTile && 'pt-15 md:pt-26 lg:pt-28')
|
|
133
|
+
: spec('no-gutters')
|
|
134
|
+
? (0, cn_1.cn)('px-0 pb-0', snapTile && 'pt-11 lg:pt-20')
|
|
135
|
+
: 'px-[8vw] xl:px-[1vw] pb-[8vh] pt-[calc(44px+4vh)] md:pt-[calc(80px+6vh)]';
|
|
136
|
+
return ((0, jsx_runtime_1.jsxs)(box_1.Box, { tag: "section", ...(b.anchorId ? { id: b.anchorId } : {}), className: (0, cn_1.cn)(snapTile ? 'snap-start snap-always h-[100vh]' : 'min-h-screen', bottom && 'flex flex-col', className), children: [(0, jsx_runtime_1.jsx)(prose_1.ApplyTypography, { className: (0, cn_1.cn)('w-full flex flex-row justify-center self-stretch', snapTile && (agent === 'desktop' ? 'h-full' : 'h-[100svh]'), bottom && 'grow'), children: (0, jsx_runtime_1.jsxs)(Poster, { banner: b.banner, children: [video && ((0, jsx_runtime_1.jsx)(Backdrop, { block: b.banner, className: "absolute top-0 left-0 bottom-0 right-0", initialInView: initialInView })), (0, jsx_runtime_1.jsxs)(box_1.Box, { className: (0, cn_1.cn)('xl:mx-auto overflow-y-hidden h-full', !spec('full-screen-width') && 'max-w-screen-xl', gutters, agent && agent !== 'desktop' && 'pt-15 sm:pt-17 pb-0 px-3 sm:px-8', snapTile ? 'absolute left-0 right-0 top-0 bottom-0' : 'flex min-h-screen w-full', contentClassName, vertCenter && (0, cn_1.cn)('self-center', oneColumn && 'py-0')), children: [(0, jsx_runtime_1.jsx)(Columns, { block: b, agent: agent, className: "w-full" }), b.footer] })] }) }), bottom] }));
|
|
137
|
+
};
|
|
138
|
+
exports.ScreenfulBlockComponent = ScreenfulBlockComponent;
|
|
139
|
+
exports.default = exports.ScreenfulBlockComponent;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type BlockComponentProps } from './spec.js';
|
|
3
|
+
/**
|
|
4
|
+
* One screenful: a full-height section, optionally over a banner, holding one
|
|
5
|
+
* to three columns of blocks.
|
|
6
|
+
*
|
|
7
|
+
* `snapTile` makes it a stop in a scroll-snapping sequence, which is why it
|
|
8
|
+
* fixes the height rather than setting a minimum — a snap point that can grow
|
|
9
|
+
* past the viewport can never be fully scrolled to.
|
|
10
|
+
*/
|
|
11
|
+
export declare const ScreenfulBlockComponent: ({ block, agent, initialInView, snapTile, className, contentClassName, bottom, }: BlockComponentProps & {
|
|
12
|
+
initialInView?: boolean;
|
|
13
|
+
snapTile?: boolean;
|
|
14
|
+
contentClassName?: string;
|
|
15
|
+
bottom?: React.ReactNode;
|
|
16
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default ScreenfulBlockComponent;
|
|
18
|
+
//# sourceMappingURL=screenful.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenful.d.ts","sourceRoot":"","sources":["../../src/blocks/screenful.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAO9B,OAAO,EAAE,KAAK,mBAAmB,EAAO,MAAM,QAAQ,CAAA;AA0KtD;;;;;;;GAOG;AACH,eAAO,MAAM,uBAAuB,oFAQjC,mBAAmB,GAAG;IACvB,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CACzB,4CA2DA,CAAA;eAEc,uBAAuB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ApplyTypography } from '../backends/gui/prose.js';
|
|
5
|
+
import { Box } from '../box.js';
|
|
6
|
+
import { cn } from '../core/cn.js';
|
|
7
|
+
import { Content as Blocks } from './content.js';
|
|
8
|
+
import { has } from './spec.js';
|
|
9
|
+
/**
|
|
10
|
+
* Is the element mostly on screen?
|
|
11
|
+
*
|
|
12
|
+
* Native IntersectionObserver rather than a package: this is the only place in
|
|
13
|
+
* the library that needs it, and the hook it would replace is fifteen lines.
|
|
14
|
+
* 0.75 because the caller is deciding whether to PLAY a video — a strip of it
|
|
15
|
+
* appearing at the edge of the viewport is not someone watching.
|
|
16
|
+
*/
|
|
17
|
+
const useInView = (threshold = 0.75, initial = false) => {
|
|
18
|
+
const ref = React.useRef(null);
|
|
19
|
+
const [inView, setInView] = React.useState(initial);
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
const el = ref.current;
|
|
22
|
+
if (!el || typeof IntersectionObserver === 'undefined')
|
|
23
|
+
return;
|
|
24
|
+
const io = new IntersectionObserver(([e]) => setInView(e.isIntersecting), { threshold });
|
|
25
|
+
io.observe(el);
|
|
26
|
+
return () => io.disconnect();
|
|
27
|
+
}, [threshold]);
|
|
28
|
+
return { ref, inView };
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* A background video that plays only while it is on screen.
|
|
32
|
+
*
|
|
33
|
+
* Mounted after the first client render, never on the server: a `<video>` in
|
|
34
|
+
* server markup is a download that starts before anything has decided the
|
|
35
|
+
* element is even visible.
|
|
36
|
+
*/
|
|
37
|
+
const Backdrop = ({ block, className, initialInView, }) => {
|
|
38
|
+
const [mounted, setMounted] = React.useState(false);
|
|
39
|
+
const { ref, inView } = useInView(0.75, initialInView);
|
|
40
|
+
React.useEffect(() => setMounted(true), []);
|
|
41
|
+
if (!mounted)
|
|
42
|
+
return null;
|
|
43
|
+
return (_jsx("div", { ref: ref, className: className, children: inView && (_jsx("video", { autoPlay: true, loop: true, muted: true, playsInline: true, style: { margin: 0, height: '100%', width: '100%', objectFit: 'cover' }, children: block.sources?.map((src, i) => (_jsx("source", { src: src }, i))) })) }));
|
|
44
|
+
};
|
|
45
|
+
/** The banner, as a still. It is also the video's first frame, so nothing jumps. */
|
|
46
|
+
const Poster = ({ banner, className, children, }) => banner ? (_jsx(Box, { className: cn('relative', className), style: {
|
|
47
|
+
height: '100%',
|
|
48
|
+
width: '100%',
|
|
49
|
+
backgroundImage: `url(${typeof banner === 'string' ? banner : banner.poster})`,
|
|
50
|
+
backgroundSize: 'cover',
|
|
51
|
+
backgroundRepeat: 'no-repeat',
|
|
52
|
+
}, children: children })) : (_jsx(Box, { className: cn('h-full w-full relative', className), children: children }));
|
|
53
|
+
/** One column of a screenful, placed by its own specifiers. */
|
|
54
|
+
const Column = ({ blocks, specifiers, agent, className, }) => {
|
|
55
|
+
const spec = (s) => has(specifiers, s);
|
|
56
|
+
const phone = agent === 'phone';
|
|
57
|
+
const place = phone
|
|
58
|
+
? cn('items-start', spec('mobile-vert-center') ? 'justify-center' : 'justify-start')
|
|
59
|
+
: cn(spec('right') ? 'items-end' : spec('center') ? 'items-center' : 'items-start', spec('bottom') ? 'justify-end' : spec('vert-center') ? 'justify-center' : 'justify-start',
|
|
60
|
+
// Right-aligned running text is hard to read at phone widths, so this
|
|
61
|
+
// is a desktop-only hint on purpose.
|
|
62
|
+
spec('text-align-right') ? 'text-right' : 'text-left');
|
|
63
|
+
// h-full is what makes the vertical placement above mean anything — without a
|
|
64
|
+
// height there is no free space for `justify-*` to distribute.
|
|
65
|
+
return (_jsx(Box, { className: cn('flex flex-col justify-center h-full', place, className), children: _jsx(Blocks, { blocks: blocks, agent: agent }) }));
|
|
66
|
+
};
|
|
67
|
+
const Columns = ({ block: b, agent, className, }) => {
|
|
68
|
+
if (b.contentColumns.length === 1) {
|
|
69
|
+
return (_jsx(Column, { blocks: b.contentColumns[0], specifiers: b.columnSpecifiers?.[0], agent: agent, className: className }));
|
|
70
|
+
}
|
|
71
|
+
// `order` is one-based in flex, and the 5.x original tested the index for
|
|
72
|
+
// truthiness — so the column asked to come FIRST was the one that never moved.
|
|
73
|
+
const order = (i) => {
|
|
74
|
+
const at = b.mobileOrder?.indexOf(i);
|
|
75
|
+
return at !== undefined && at >= 0 ? `order-${at + 1} md:order-none` : '';
|
|
76
|
+
};
|
|
77
|
+
return (_jsx(Box, { className: cn('flex flex-col gap-2 sm:gap-4 h-full', agent !== 'phone' && `md:grid md:gap-8 md:grid-cols-${b.contentColumns.length}`, className), children: b.contentColumns.map((column, i) => (_jsx(Column, { blocks: column, specifiers: b.columnSpecifiers?.[i], agent: agent, className: order(i) }, i))) }));
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* One screenful: a full-height section, optionally over a banner, holding one
|
|
81
|
+
* to three columns of blocks.
|
|
82
|
+
*
|
|
83
|
+
* `snapTile` makes it a stop in a scroll-snapping sequence, which is why it
|
|
84
|
+
* fixes the height rather than setting a minimum — a snap point that can grow
|
|
85
|
+
* past the viewport can never be fully scrolled to.
|
|
86
|
+
*/
|
|
87
|
+
export const ScreenfulBlockComponent = ({ block, agent, initialInView = false, snapTile = false, className, contentClassName, bottom, }) => {
|
|
88
|
+
if (block.blockType !== 'screenful')
|
|
89
|
+
return _jsx(_Fragment, { children: "screenful block required" });
|
|
90
|
+
const b = block;
|
|
91
|
+
const spec = (s) => has(b.specifiers, s);
|
|
92
|
+
const video = b.banner && typeof b.banner === 'object';
|
|
93
|
+
const oneColumn = b.contentColumns.length === 1;
|
|
94
|
+
const vertCenter = spec('vert-center');
|
|
95
|
+
const gutters = spec('narrow-gutters')
|
|
96
|
+
? cn('px-6 lg:px-8 2xl:px-2 pb-4 lg:pb-6 xl:pb-8', snapTile && 'pt-15 md:pt-26 lg:pt-28')
|
|
97
|
+
: spec('no-gutters')
|
|
98
|
+
? cn('px-0 pb-0', snapTile && 'pt-11 lg:pt-20')
|
|
99
|
+
: 'px-[8vw] xl:px-[1vw] pb-[8vh] pt-[calc(44px+4vh)] md:pt-[calc(80px+6vh)]';
|
|
100
|
+
return (_jsxs(Box, { tag: "section", ...(b.anchorId ? { id: b.anchorId } : {}), className: cn(snapTile ? 'snap-start snap-always h-[100vh]' : 'min-h-screen', bottom && 'flex flex-col', className), children: [_jsx(ApplyTypography, { className: cn('w-full flex flex-row justify-center self-stretch', snapTile && (agent === 'desktop' ? 'h-full' : 'h-[100svh]'), bottom && 'grow'), children: _jsxs(Poster, { banner: b.banner, children: [video && (_jsx(Backdrop, { block: b.banner, className: "absolute top-0 left-0 bottom-0 right-0", initialInView: initialInView })), _jsxs(Box, { className: cn('xl:mx-auto overflow-y-hidden h-full', !spec('full-screen-width') && 'max-w-screen-xl', gutters, agent && agent !== 'desktop' && 'pt-15 sm:pt-17 pb-0 px-3 sm:px-8', snapTile ? 'absolute left-0 right-0 top-0 bottom-0' : 'flex min-h-screen w-full', contentClassName, vertCenter && cn('self-center', oneColumn && 'py-0')), children: [_jsx(Columns, { block: b, agent: agent, className: "w-full" }), b.footer] })] }) }), bottom] }));
|
|
101
|
+
};
|
|
102
|
+
export default ScreenfulBlockComponent;
|
|
103
|
+
//# sourceMappingURL=screenful.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"screenful.js","sourceRoot":"","sources":["../../src/blocks/screenful.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAE9B,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAC5B,OAAO,EAAE,EAAE,EAAE,MAAM,YAAY,CAAA;AAE/B,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,WAAW,CAAA;AAC7C,OAAO,EAA4B,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEtD;;;;;;;GAOG;AACH,MAAM,SAAS,GAAG,CAAC,SAAS,GAAG,IAAI,EAAE,OAAO,GAAG,KAAK,EAAE,EAAE;IACtD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAwB,IAAI,CAAC,CAAA;IACrD,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAA;IAEnD,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,MAAM,EAAE,GAAG,GAAG,CAAC,OAAO,CAAA;QACtB,IAAI,CAAC,EAAE,IAAI,OAAO,oBAAoB,KAAK,WAAW;YAAE,OAAM;QAC9D,MAAM,EAAE,GAAG,IAA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
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SpaceBlockComponent = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const prose_1 = require("../backends/gui/prose.cjs");
|
|
6
|
+
const box_1 = require("../box.cjs");
|
|
7
|
+
const def_1 = require("./def.cjs");
|
|
8
|
+
/** 0 is a paragraph's worth of space; 1–6 are the heading tags'. */
|
|
9
|
+
const TAGS = ['div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
10
|
+
const SpaceBlockComponent = ({ block, className }) => {
|
|
11
|
+
if (block.blockType !== 'space')
|
|
12
|
+
return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "space block required" });
|
|
13
|
+
const b = block;
|
|
14
|
+
// Measured against a heading: the space a level-N heading WOULD occupy, so a
|
|
15
|
+
// gap between sections matches the rhythm of the text around it.
|
|
16
|
+
//
|
|
17
|
+
// Tested against undefined, not for truth. Level 0 means "a paragraph's
|
|
18
|
+
// worth", and `if (b.level)` reads 0 as absent — so it fell through to the
|
|
19
|
+
// rung ladder below and the h-4 case it documents could never be reached.
|
|
20
|
+
if (b.level !== undefined) {
|
|
21
|
+
const Tag = TAGS[b.level];
|
|
22
|
+
return ((0, jsx_runtime_1.jsx)(prose_1.ApplyTypography, { className: className, children: (0, jsx_runtime_1.jsx)(box_1.Box, { tag: Tag, "aria-hidden": true, className: `invisible m-0 ${b.level === 0 ? 'h-4' : ''}`, children: "\u00A0" }) }));
|
|
23
|
+
}
|
|
24
|
+
// One number is that height at every rung.
|
|
25
|
+
if (typeof b.sizes === 'number') {
|
|
26
|
+
return (0, jsx_runtime_1.jsx)(box_1.Box, { "aria-hidden": true, className: `invisible w-[1px] h-${b.sizes} ${className ?? ''}` });
|
|
27
|
+
}
|
|
28
|
+
// Otherwise the given rungs sit over the defaults, and each becomes a
|
|
29
|
+
// prefixed class. `xs` lands at the base (see the VARIANT map in tw.ts), so
|
|
30
|
+
// the ladder has a floor and every larger rung overrides it in turn.
|
|
31
|
+
const sizes = { ...def_1.SPACE_DEFAULTS, ...b.sizes };
|
|
32
|
+
const rungs = Object.entries(sizes)
|
|
33
|
+
.map(([rung, v]) => `${rung}:h-${v}`)
|
|
34
|
+
.join(' ');
|
|
35
|
+
return (0, jsx_runtime_1.jsx)(box_1.Box, { "aria-hidden": true, className: `invisible w-[1px] ${rungs} ${className ?? ''}` });
|
|
36
|
+
};
|
|
37
|
+
exports.SpaceBlockComponent = SpaceBlockComponent;
|
|
38
|
+
exports.default = exports.SpaceBlockComponent;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.d.ts","sourceRoot":"","sources":["../../src/blocks/space.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,QAAQ,CAAA;AAKjD,eAAO,MAAM,mBAAmB,yBAA0B,mBAAmB,4CAmC5E,CAAA;eAEc,mBAAmB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use client';import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ApplyTypography } from '../backends/gui/prose.js';
|
|
3
|
+
import { Box } from '../box.js';
|
|
4
|
+
import { SPACE_DEFAULTS } from './def.js';
|
|
5
|
+
/** 0 is a paragraph's worth of space; 1–6 are the heading tags'. */
|
|
6
|
+
const TAGS = ['div', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
7
|
+
export const SpaceBlockComponent = ({ block, className }) => {
|
|
8
|
+
if (block.blockType !== 'space')
|
|
9
|
+
return _jsx(_Fragment, { children: "space block required" });
|
|
10
|
+
const b = block;
|
|
11
|
+
// Measured against a heading: the space a level-N heading WOULD occupy, so a
|
|
12
|
+
// gap between sections matches the rhythm of the text around it.
|
|
13
|
+
//
|
|
14
|
+
// Tested against undefined, not for truth. Level 0 means "a paragraph's
|
|
15
|
+
// worth", and `if (b.level)` reads 0 as absent — so it fell through to the
|
|
16
|
+
// rung ladder below and the h-4 case it documents could never be reached.
|
|
17
|
+
if (b.level !== undefined) {
|
|
18
|
+
const Tag = TAGS[b.level];
|
|
19
|
+
return (_jsx(ApplyTypography, { className: className, children: _jsx(Box, { tag: Tag, "aria-hidden": true, className: `invisible m-0 ${b.level === 0 ? 'h-4' : ''}`, children: "\u00A0" }) }));
|
|
20
|
+
}
|
|
21
|
+
// One number is that height at every rung.
|
|
22
|
+
if (typeof b.sizes === 'number') {
|
|
23
|
+
return _jsx(Box, { "aria-hidden": true, className: `invisible w-[1px] h-${b.sizes} ${className ?? ''}` });
|
|
24
|
+
}
|
|
25
|
+
// Otherwise the given rungs sit over the defaults, and each becomes a
|
|
26
|
+
// prefixed class. `xs` lands at the base (see the VARIANT map in tw.ts), so
|
|
27
|
+
// the ladder has a floor and every larger rung overrides it in turn.
|
|
28
|
+
const sizes = { ...SPACE_DEFAULTS, ...b.sizes };
|
|
29
|
+
const rungs = Object.entries(sizes)
|
|
30
|
+
.map(([rung, v]) => `${rung}:h-${v}`)
|
|
31
|
+
.join(' ');
|
|
32
|
+
return _jsx(Box, { "aria-hidden": true, className: `invisible w-[1px] ${rungs} ${className ?? ''}` });
|
|
33
|
+
};
|
|
34
|
+
export default SpaceBlockComponent;
|
|
35
|
+
//# sourceMappingURL=space.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"space.js","sourceRoot":"","sources":["../../src/blocks/space.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAE5B,OAAO,EAAE,cAAc,EAAmC,MAAM,OAAO,CAAA;AAGvE,oEAAoE;AACpE,MAAM,IAAI,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAA;AAEj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AAK,IAAI,SAAS,IAAI,EAAE,EAAE,GAAI,CAAA;AACxF,CAAC,CAAA;AAED,eAAe,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
'use client';"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.name = exports.fit = exports.has = exports.sx = void 0;
|
|
4
|
+
const cn_1 = require("../core/cn.cjs");
|
|
5
|
+
const tw_1 = require("../tw.cjs");
|
|
6
|
+
/**
|
|
7
|
+
* Class notation as gui style props.
|
|
8
|
+
*
|
|
9
|
+
* A gui component takes `className` and passes it STRAIGHT to the element, so
|
|
10
|
+
* `<Card className="flex w-full">` renders `class="… flex w-full"` — four dead
|
|
11
|
+
* tokens against a stylesheet that defines none of them, since there is no
|
|
12
|
+
* Tailwind here to define them. Measured: every token survives to the DOM and
|
|
13
|
+
* nothing styles it.
|
|
14
|
+
*
|
|
15
|
+
* `<Box>` already solves this for host elements by converting the string first.
|
|
16
|
+
* This is the same conversion for the case Box cannot cover — a gui component
|
|
17
|
+
* that must stay itself. The classes become style props, gui compiles them to
|
|
18
|
+
* its own atomic rules, and no unqualified name reaches the document.
|
|
19
|
+
*
|
|
20
|
+
* So: `<Box className="…">` for an element, `{...sx('…')}` for a component.
|
|
21
|
+
*
|
|
22
|
+
* Anything `tw` does not read is handed back as `className`, exactly as Box
|
|
23
|
+
* does with it — dropping it would be worse than leaking it, because a class
|
|
24
|
+
* with a real rule behind it (`hz-prose`) is not something `tw` should be
|
|
25
|
+
* expected to know about, and silently discarding it would unstyle the element
|
|
26
|
+
* with nothing to show for it.
|
|
27
|
+
*/
|
|
28
|
+
const sx = (...classes) => {
|
|
29
|
+
const { props, rest } = (0, tw_1.tw)((0, cn_1.cn)(...classes));
|
|
30
|
+
return rest ? { ...props, className: rest } : props;
|
|
31
|
+
};
|
|
32
|
+
exports.sx = sx;
|
|
33
|
+
/**
|
|
34
|
+
* Is `token` one of the hints in a specifier bag?
|
|
35
|
+
*
|
|
36
|
+
* A bag is space-separated and open — a site adds a hint by typing one, and an
|
|
37
|
+
* unknown hint is ignored rather than failing a build. Undefined reads as
|
|
38
|
+
* empty, so a block with no specifiers answers false rather than throwing.
|
|
39
|
+
*/
|
|
40
|
+
const has = (specifiers, token) => !!specifiers && specifiers.split(/\s+/).includes(token);
|
|
41
|
+
exports.has = has;
|
|
42
|
+
/**
|
|
43
|
+
* The largest box with `dim`'s aspect ratio that fits inside `within`.
|
|
44
|
+
*
|
|
45
|
+
* Which side binds is decided by comparing the two ratios, not by trying one
|
|
46
|
+
* and clamping: a portrait image in a landscape box is bound by height, and the
|
|
47
|
+
* reverse by width.
|
|
48
|
+
*/
|
|
49
|
+
const fit = (dim, within) => {
|
|
50
|
+
const ratio = dim.w / dim.h;
|
|
51
|
+
return ratio > within.w / within.h
|
|
52
|
+
? { w: within.w, h: within.w / ratio }
|
|
53
|
+
: { w: within.h * ratio, h: within.h };
|
|
54
|
+
};
|
|
55
|
+
exports.fit = fit;
|
|
56
|
+
/** The filename an image url ends in — the last-resort alt text. */
|
|
57
|
+
const name = (src) => src.split('/').filter(Boolean).pop() ?? src;
|
|
58
|
+
exports.name = name;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ClassValue } from '../tw.js';
|
|
2
|
+
import type { Dimensions } from '../types.js';
|
|
3
|
+
import type { Block } from './def.js';
|
|
4
|
+
/**
|
|
5
|
+
* Class notation as gui style props.
|
|
6
|
+
*
|
|
7
|
+
* A gui component takes `className` and passes it STRAIGHT to the element, so
|
|
8
|
+
* `<Card className="flex w-full">` renders `class="… flex w-full"` — four dead
|
|
9
|
+
* tokens against a stylesheet that defines none of them, since there is no
|
|
10
|
+
* Tailwind here to define them. Measured: every token survives to the DOM and
|
|
11
|
+
* nothing styles it.
|
|
12
|
+
*
|
|
13
|
+
* `<Box>` already solves this for host elements by converting the string first.
|
|
14
|
+
* This is the same conversion for the case Box cannot cover — a gui component
|
|
15
|
+
* that must stay itself. The classes become style props, gui compiles them to
|
|
16
|
+
* its own atomic rules, and no unqualified name reaches the document.
|
|
17
|
+
*
|
|
18
|
+
* So: `<Box className="…">` for an element, `{...sx('…')}` for a component.
|
|
19
|
+
*
|
|
20
|
+
* Anything `tw` does not read is handed back as `className`, exactly as Box
|
|
21
|
+
* does with it — dropping it would be worse than leaking it, because a class
|
|
22
|
+
* with a real rule behind it (`hz-prose`) is not something `tw` should be
|
|
23
|
+
* expected to know about, and silently discarding it would unstyle the element
|
|
24
|
+
* with nothing to show for it.
|
|
25
|
+
*/
|
|
26
|
+
export declare const sx: (...classes: ClassValue[]) => Record<string, unknown>;
|
|
27
|
+
/**
|
|
28
|
+
* What every renderer is handed: the block to draw, plus the two things only
|
|
29
|
+
* the page above it knows.
|
|
30
|
+
*
|
|
31
|
+
* `agent` is the device class ('phone' | 'desktop'). It is a PROP rather than a
|
|
32
|
+
* media query because these blocks render on a server that has to emit the
|
|
33
|
+
* right markup first time — a phone layout that arrives as desktop markup and
|
|
34
|
+
* corrects itself on hydration is a visible jump, and for the video blocks it
|
|
35
|
+
* is a wasted download rather than a reflow.
|
|
36
|
+
*/
|
|
37
|
+
export interface BlockComponentProps {
|
|
38
|
+
block: Block;
|
|
39
|
+
className?: string;
|
|
40
|
+
agent?: string;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Is `token` one of the hints in a specifier bag?
|
|
44
|
+
*
|
|
45
|
+
* A bag is space-separated and open — a site adds a hint by typing one, and an
|
|
46
|
+
* unknown hint is ignored rather than failing a build. Undefined reads as
|
|
47
|
+
* empty, so a block with no specifiers answers false rather than throwing.
|
|
48
|
+
*/
|
|
49
|
+
export declare const has: (specifiers: string | undefined, token: string) => boolean;
|
|
50
|
+
/**
|
|
51
|
+
* The largest box with `dim`'s aspect ratio that fits inside `within`.
|
|
52
|
+
*
|
|
53
|
+
* Which side binds is decided by comparing the two ratios, not by trying one
|
|
54
|
+
* and clamping: a portrait image in a landscape box is bound by height, and the
|
|
55
|
+
* reverse by width.
|
|
56
|
+
*/
|
|
57
|
+
export declare const fit: (dim: Dimensions, within: Dimensions) => Dimensions;
|
|
58
|
+
/** The filename an image url ends in — the last-resort alt text. */
|
|
59
|
+
export declare const name: (src: string) => string;
|
|
60
|
+
//# sourceMappingURL=spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec.d.ts","sourceRoot":"","sources":["../../src/blocks/spec.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,UAAU,EAAM,MAAM,OAAO,CAAA;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,OAAO,CAAA;AAElC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,EAAE,eAAgB,UAAU,EAAE,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAGnE,CAAA;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,KAAK,CAAA;IACZ,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,eAAgB,MAAM,GAAG,SAAS,SAAS,MAAM,KAAG,OACX,CAAA;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,GAAG,QAAS,UAAU,UAAU,UAAU,KAAG,UAKzD,CAAA;AAED,oEAAoE;AACpE,eAAO,MAAM,IAAI,QAAS,MAAM,KAAG,MAAqD,CAAA"}
|