a tool for shared writing and social publishing

add canvas lexicon

+394 -4
+5
lexicons/api/index.ts
··· 38 38 import * as PubLeafletComment from './types/pub/leaflet/comment' 39 39 import * as PubLeafletDocument from './types/pub/leaflet/document' 40 40 import * as PubLeafletGraphSubscription from './types/pub/leaflet/graph/subscription' 41 + import * as PubLeafletPagesCanvas from './types/pub/leaflet/pages/canvas' 41 42 import * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument' 42 43 import * as PubLeafletPublication from './types/pub/leaflet/publication' 43 44 import * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet' ··· 73 74 export * as PubLeafletComment from './types/pub/leaflet/comment' 74 75 export * as PubLeafletDocument from './types/pub/leaflet/document' 75 76 export * as PubLeafletGraphSubscription from './types/pub/leaflet/graph/subscription' 77 + export * as PubLeafletPagesCanvas from './types/pub/leaflet/pages/canvas' 76 78 export * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument' 77 79 export * as PubLeafletPublication from './types/pub/leaflet/publication' 78 80 export * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet' ··· 80 82 export * as PubLeafletThemeColor from './types/pub/leaflet/theme/color' 81 83 82 84 export const PUB_LEAFLET_PAGES = { 85 + CanvasTextAlignLeft: 'pub.leaflet.pages.canvas#textAlignLeft', 86 + CanvasTextAlignCenter: 'pub.leaflet.pages.canvas#textAlignCenter', 87 + CanvasTextAlignRight: 'pub.leaflet.pages.canvas#textAlignRight', 83 88 LinearDocumentTextAlignLeft: 'pub.leaflet.pages.linearDocument#textAlignLeft', 84 89 LinearDocumentTextAlignCenter: 85 90 'pub.leaflet.pages.linearDocument#textAlignCenter',
+103 -1
lexicons/api/lexicons.ts
··· 1405 1405 type: 'array', 1406 1406 items: { 1407 1407 type: 'union', 1408 - refs: ['lex:pub.leaflet.pages.linearDocument'], 1408 + refs: [ 1409 + 'lex:pub.leaflet.pages.linearDocument', 1410 + 'lex:pub.leaflet.pages.canvas', 1411 + ], 1409 1412 }, 1410 1413 }, 1411 1414 }, ··· 1429 1432 type: 'string', 1430 1433 format: 'at-uri', 1431 1434 }, 1435 + }, 1436 + }, 1437 + }, 1438 + }, 1439 + }, 1440 + PubLeafletPagesCanvas: { 1441 + lexicon: 1, 1442 + id: 'pub.leaflet.pages.canvas', 1443 + defs: { 1444 + main: { 1445 + type: 'object', 1446 + required: ['blocks'], 1447 + properties: { 1448 + id: { 1449 + type: 'string', 1450 + }, 1451 + blocks: { 1452 + type: 'array', 1453 + items: { 1454 + type: 'ref', 1455 + ref: 'lex:pub.leaflet.pages.canvas#block', 1456 + }, 1457 + }, 1458 + }, 1459 + }, 1460 + block: { 1461 + type: 'object', 1462 + required: ['block', 'x', 'y', 'width'], 1463 + properties: { 1464 + block: { 1465 + type: 'union', 1466 + refs: [ 1467 + 'lex:pub.leaflet.blocks.iframe', 1468 + 'lex:pub.leaflet.blocks.text', 1469 + 'lex:pub.leaflet.blocks.blockquote', 1470 + 'lex:pub.leaflet.blocks.header', 1471 + 'lex:pub.leaflet.blocks.image', 1472 + 'lex:pub.leaflet.blocks.unorderedList', 1473 + 'lex:pub.leaflet.blocks.website', 1474 + 'lex:pub.leaflet.blocks.math', 1475 + 'lex:pub.leaflet.blocks.code', 1476 + 'lex:pub.leaflet.blocks.horizontalRule', 1477 + 'lex:pub.leaflet.blocks.bskyPost', 1478 + 'lex:pub.leaflet.blocks.page', 1479 + ], 1480 + }, 1481 + x: { 1482 + type: 'integer', 1483 + }, 1484 + y: { 1485 + type: 'integer', 1486 + }, 1487 + width: { 1488 + type: 'integer', 1489 + }, 1490 + height: { 1491 + type: 'integer', 1492 + }, 1493 + rotation: { 1494 + type: 'integer', 1495 + }, 1496 + }, 1497 + }, 1498 + textAlignLeft: { 1499 + type: 'token', 1500 + }, 1501 + textAlignCenter: { 1502 + type: 'token', 1503 + }, 1504 + textAlignRight: { 1505 + type: 'token', 1506 + }, 1507 + quote: { 1508 + type: 'object', 1509 + required: ['start', 'end'], 1510 + properties: { 1511 + start: { 1512 + type: 'ref', 1513 + ref: 'lex:pub.leaflet.pages.canvas#position', 1514 + }, 1515 + end: { 1516 + type: 'ref', 1517 + ref: 'lex:pub.leaflet.pages.canvas#position', 1518 + }, 1519 + }, 1520 + }, 1521 + position: { 1522 + type: 'object', 1523 + required: ['block', 'offset'], 1524 + properties: { 1525 + block: { 1526 + type: 'array', 1527 + items: { 1528 + type: 'integer', 1529 + }, 1530 + }, 1531 + offset: { 1532 + type: 'integer', 1432 1533 }, 1433 1534 }, 1434 1535 }, ··· 1873 1974 PubLeafletComment: 'pub.leaflet.comment', 1874 1975 PubLeafletDocument: 'pub.leaflet.document', 1875 1976 PubLeafletGraphSubscription: 'pub.leaflet.graph.subscription', 1977 + PubLeafletPagesCanvas: 'pub.leaflet.pages.canvas', 1876 1978 PubLeafletPagesLinearDocument: 'pub.leaflet.pages.linearDocument', 1877 1979 PubLeafletPublication: 'pub.leaflet.publication', 1878 1980 PubLeafletRichtextFacet: 'pub.leaflet.richtext.facet',
+6 -1
lexicons/api/types/pub/leaflet/document.ts
··· 7 7 import { type $Typed, is$typed as _is$typed, type OmitKey } from '../../../util' 8 8 import type * as ComAtprotoRepoStrongRef from '../../com/atproto/repo/strongRef' 9 9 import type * as PubLeafletPagesLinearDocument from './pages/linearDocument' 10 + import type * as PubLeafletPagesCanvas from './pages/canvas' 10 11 11 12 const is$typed = _is$typed, 12 13 validate = _validate ··· 20 21 publishedAt?: string 21 22 publication: string 22 23 author: string 23 - pages: ($Typed<PubLeafletPagesLinearDocument.Main> | { $type: string })[] 24 + pages: ( 25 + | $Typed<PubLeafletPagesLinearDocument.Main> 26 + | $Typed<PubLeafletPagesCanvas.Main> 27 + | { $type: string } 28 + )[] 24 29 [k: string]: unknown 25 30 } 26 31
+112
lexicons/api/types/pub/leaflet/pages/canvas.ts
··· 1 + /** 2 + * GENERATED CODE - DO NOT MODIFY 3 + */ 4 + import { type ValidationResult, BlobRef } from '@atproto/lexicon' 5 + import { CID } from 'multiformats/cid' 6 + import { validate as _validate } from '../../../../lexicons' 7 + import { 8 + type $Typed, 9 + is$typed as _is$typed, 10 + type OmitKey, 11 + } from '../../../../util' 12 + import type * as PubLeafletBlocksIframe from '../blocks/iframe' 13 + import type * as PubLeafletBlocksText from '../blocks/text' 14 + import type * as PubLeafletBlocksBlockquote from '../blocks/blockquote' 15 + import type * as PubLeafletBlocksHeader from '../blocks/header' 16 + import type * as PubLeafletBlocksImage from '../blocks/image' 17 + import type * as PubLeafletBlocksUnorderedList from '../blocks/unorderedList' 18 + import type * as PubLeafletBlocksWebsite from '../blocks/website' 19 + import type * as PubLeafletBlocksMath from '../blocks/math' 20 + import type * as PubLeafletBlocksCode from '../blocks/code' 21 + import type * as PubLeafletBlocksHorizontalRule from '../blocks/horizontalRule' 22 + import type * as PubLeafletBlocksBskyPost from '../blocks/bskyPost' 23 + import type * as PubLeafletBlocksPage from '../blocks/page' 24 + 25 + const is$typed = _is$typed, 26 + validate = _validate 27 + const id = 'pub.leaflet.pages.canvas' 28 + 29 + export interface Main { 30 + $type?: 'pub.leaflet.pages.canvas' 31 + id?: string 32 + blocks: Block[] 33 + } 34 + 35 + const hashMain = 'main' 36 + 37 + export function isMain<V>(v: V) { 38 + return is$typed(v, id, hashMain) 39 + } 40 + 41 + export function validateMain<V>(v: V) { 42 + return validate<Main & V>(v, id, hashMain) 43 + } 44 + 45 + export interface Block { 46 + $type?: 'pub.leaflet.pages.canvas#block' 47 + block: 48 + | $Typed<PubLeafletBlocksIframe.Main> 49 + | $Typed<PubLeafletBlocksText.Main> 50 + | $Typed<PubLeafletBlocksBlockquote.Main> 51 + | $Typed<PubLeafletBlocksHeader.Main> 52 + | $Typed<PubLeafletBlocksImage.Main> 53 + | $Typed<PubLeafletBlocksUnorderedList.Main> 54 + | $Typed<PubLeafletBlocksWebsite.Main> 55 + | $Typed<PubLeafletBlocksMath.Main> 56 + | $Typed<PubLeafletBlocksCode.Main> 57 + | $Typed<PubLeafletBlocksHorizontalRule.Main> 58 + | $Typed<PubLeafletBlocksBskyPost.Main> 59 + | $Typed<PubLeafletBlocksPage.Main> 60 + | { $type: string } 61 + x: number 62 + y: number 63 + width: number 64 + height?: number 65 + rotation?: number 66 + } 67 + 68 + const hashBlock = 'block' 69 + 70 + export function isBlock<V>(v: V) { 71 + return is$typed(v, id, hashBlock) 72 + } 73 + 74 + export function validateBlock<V>(v: V) { 75 + return validate<Block & V>(v, id, hashBlock) 76 + } 77 + 78 + export const TEXTALIGNLEFT = `${id}#textAlignLeft` 79 + export const TEXTALIGNCENTER = `${id}#textAlignCenter` 80 + export const TEXTALIGNRIGHT = `${id}#textAlignRight` 81 + 82 + export interface Quote { 83 + $type?: 'pub.leaflet.pages.canvas#quote' 84 + start: Position 85 + end: Position 86 + } 87 + 88 + const hashQuote = 'quote' 89 + 90 + export function isQuote<V>(v: V) { 91 + return is$typed(v, id, hashQuote) 92 + } 93 + 94 + export function validateQuote<V>(v: V) { 95 + return validate<Quote & V>(v, id, hashQuote) 96 + } 97 + 98 + export interface Position { 99 + $type?: 'pub.leaflet.pages.canvas#position' 100 + block: number[] 101 + offset: number 102 + } 103 + 104 + const hashPosition = 'position' 105 + 106 + export function isPosition<V>(v: V) { 107 + return is$typed(v, id, hashPosition) 108 + } 109 + 110 + export function validatePosition<V>(v: V) { 111 + return validate<Position & V>(v, id, hashPosition) 112 + }
+1
lexicons/build.ts
··· 21 21 PubLeafletComment, 22 22 PubLeafletRichTextFacet, 23 23 PageLexicons.PubLeafletPagesLinearDocument, 24 + PageLexicons.PubLeafletPagesCanvasDocument, 24 25 ...ThemeLexicons, 25 26 ...BlockLexicons, 26 27 ...Object.values(PublicationLexicons),
+2 -1
lexicons/pub/leaflet/document.json
··· 48 48 "items": { 49 49 "type": "union", 50 50 "refs": [ 51 - "pub.leaflet.pages.linearDocument" 51 + "pub.leaflet.pages.linearDocument", 52 + "pub.leaflet.pages.canvas" 52 53 ] 53 54 } 54 55 }
+111
lexicons/pub/leaflet/pages/canvas.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "pub.leaflet.pages.canvas", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "required": [ 8 + "blocks" 9 + ], 10 + "properties": { 11 + "id": { 12 + "type": "string" 13 + }, 14 + "blocks": { 15 + "type": "array", 16 + "items": { 17 + "type": "ref", 18 + "ref": "#block" 19 + } 20 + } 21 + } 22 + }, 23 + "block": { 24 + "type": "object", 25 + "required": [ 26 + "block", 27 + "x", 28 + "y", 29 + "width" 30 + ], 31 + "properties": { 32 + "block": { 33 + "type": "union", 34 + "refs": [ 35 + "pub.leaflet.blocks.iframe", 36 + "pub.leaflet.blocks.text", 37 + "pub.leaflet.blocks.blockquote", 38 + "pub.leaflet.blocks.header", 39 + "pub.leaflet.blocks.image", 40 + "pub.leaflet.blocks.unorderedList", 41 + "pub.leaflet.blocks.website", 42 + "pub.leaflet.blocks.math", 43 + "pub.leaflet.blocks.code", 44 + "pub.leaflet.blocks.horizontalRule", 45 + "pub.leaflet.blocks.bskyPost", 46 + "pub.leaflet.blocks.page" 47 + ] 48 + }, 49 + "x": { 50 + "type": "integer" 51 + }, 52 + "y": { 53 + "type": "integer" 54 + }, 55 + "width": { 56 + "type": "integer" 57 + }, 58 + "height": { 59 + "type": "integer" 60 + }, 61 + "rotation": { 62 + "type": "integer" 63 + } 64 + } 65 + }, 66 + "textAlignLeft": { 67 + "type": "token" 68 + }, 69 + "textAlignCenter": { 70 + "type": "token" 71 + }, 72 + "textAlignRight": { 73 + "type": "token" 74 + }, 75 + "quote": { 76 + "type": "object", 77 + "required": [ 78 + "start", 79 + "end" 80 + ], 81 + "properties": { 82 + "start": { 83 + "type": "ref", 84 + "ref": "#position" 85 + }, 86 + "end": { 87 + "type": "ref", 88 + "ref": "#position" 89 + } 90 + } 91 + }, 92 + "position": { 93 + "type": "object", 94 + "required": [ 95 + "block", 96 + "offset" 97 + ], 98 + "properties": { 99 + "block": { 100 + "type": "array", 101 + "items": { 102 + "type": "integer" 103 + } 104 + }, 105 + "offset": { 106 + "type": "integer" 107 + } 108 + } 109 + } 110 + } 111 + }
+5 -1
lexicons/src/document.ts
··· 1 1 import { LexiconDoc } from "@atproto/lexicon"; 2 2 import { PubLeafletPagesLinearDocument } from "./pages/LinearDocument"; 3 + import { PubLeafletPagesCanvasDocument } from "./pages"; 3 4 4 5 export const PubLeafletDocument: LexiconDoc = { 5 6 lexicon: 1, ··· 25 26 type: "array", 26 27 items: { 27 28 type: "union", 28 - refs: [PubLeafletPagesLinearDocument.id], 29 + refs: [ 30 + PubLeafletPagesLinearDocument.id, 31 + PubLeafletPagesCanvasDocument.id, 32 + ], 29 33 }, 30 34 }, 31 35 },
+48
lexicons/src/pages/Canvas.ts
··· 1 + import { LexiconDoc } from "@atproto/lexicon"; 2 + import { BlockUnion } from "../blocks"; 3 + 4 + export const PubLeafletPagesCanvasDocument: LexiconDoc = { 5 + lexicon: 1, 6 + id: "pub.leaflet.pages.canvas", 7 + defs: { 8 + main: { 9 + type: "object", 10 + required: ["blocks"], 11 + properties: { 12 + id: { type: "string" }, 13 + blocks: { type: "array", items: { type: "ref", ref: "#block" } }, 14 + }, 15 + }, 16 + block: { 17 + type: "object", 18 + required: ["block", "x", "y", "width"], 19 + properties: { 20 + block: BlockUnion, 21 + x: { type: "integer" }, 22 + y: { type: "integer" }, 23 + width: { type: "integer" }, 24 + height: { type: "integer" }, 25 + rotation: { type: "integer" }, 26 + }, 27 + }, 28 + textAlignLeft: { type: "token" }, 29 + textAlignCenter: { type: "token" }, 30 + textAlignRight: { type: "token" }, 31 + quote: { 32 + type: "object", 33 + required: ["start", "end"], 34 + properties: { 35 + start: { type: "ref", ref: "#position" }, 36 + end: { type: "ref", ref: "#position" }, 37 + }, 38 + }, 39 + position: { 40 + type: "object", 41 + required: ["block", "offset"], 42 + properties: { 43 + block: { type: "array", items: { type: "integer" } }, 44 + offset: { type: "integer" }, 45 + }, 46 + }, 47 + }, 48 + };
+1
lexicons/src/pages/index.ts
··· 1 1 export { PubLeafletPagesLinearDocument } from "./LinearDocument"; 2 + export { PubLeafletPagesCanvasDocument } from "./Canvas";