Initial commit: notification-elements-demo app

Interactive Angular 19 demo for @sda/notification-elements-ui with
6 sections: Bell & Feed, Notification Center, Inbox, Comments &
Threads, Mention Input, and Full-Featured layout. Includes mock
data, dark mode toggle, and real-time event log.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Giuliano Silvestro
2026-02-13 21:49:19 +10:00
commit 5d0c9ec7eb
36473 changed files with 3778146 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import { ObjAstNode } from './ast';
import { SymbolTable } from './types';
export declare class Import {
readonly parent: Import | null;
readonly symbols: SymbolTable;
readonly offset: number;
length: number;
protected readonly byText: Map<string, number>;
constructor(parent: Import | null, symbols: SymbolTable);
getId(symbol: string): number | undefined;
getText(id: number): string | undefined;
add(symbol: string): number;
toAst(): ObjAstNode;
}

48
node_modules/@jsonjoy.com/json-pack/lib/ion/Import.js generated vendored Normal file
View File

@@ -0,0 +1,48 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Import = void 0;
const ast_1 = require("./ast");
class Import {
constructor(parent, symbols) {
this.parent = parent;
this.symbols = symbols;
this.byText = new Map();
this.offset = parent ? parent.offset + parent.length : 1;
this.length = symbols.length;
for (let i = 0; i < symbols.length; i++) {
const symbol = symbols[i];
this.byText.set(symbol, this.offset + i);
}
}
getId(symbol) {
const id = this.byText.get(symbol);
if (id !== undefined)
return id;
if (this.parent)
this.parent.getId(symbol);
return undefined;
}
getText(id) {
if (id < this.offset)
return this.parent ? this.parent.getText(id) : undefined;
return this.symbols[id - this.offset];
}
add(symbol) {
let id = this.byText.get(symbol);
if (id !== undefined)
return id;
const length = this.symbols.length;
id = this.offset + length;
this.symbols.push(symbol);
this.length++;
this.byText.set(symbol, id);
return id;
}
toAst() {
const map = new Map();
map.set(7, (0, ast_1.toAst)(this.symbols, this));
return new ast_1.ObjAstNode(map);
}
}
exports.Import = Import;
//# sourceMappingURL=Import.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"Import.js","sourceRoot":"","sources":["../../src/ion/Import.ts"],"names":[],"mappings":";;;AAAA,+BAAiD;AAGjD,MAAa,MAAM;IAKjB,YACkB,MAAqB,EACrB,OAAoB;QADpB,WAAM,GAAN,MAAM,CAAe;QACrB,YAAO,GAAP,OAAO,CAAa;QAJnB,WAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;QAMpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACzD,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YACxC,MAAM,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;YAC1B,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC3C,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,MAAc;QACzB,MAAM,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QAChC,IAAI,IAAI,CAAC,MAAM;YAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3C,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,OAAO,CAAC,EAAU;QACvB,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC/E,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;IACxC,CAAC;IAEM,GAAG,CAAC,MAAc;QACvB,IAAI,EAAE,GAAG,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjC,IAAI,EAAE,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QAChC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACnC,EAAE,GAAG,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAC1B,IAAI,CAAC,MAAM,EAAE,CAAC;QACd,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAC5B,OAAO,EAAE,CAAC;IACZ,CAAC;IAEM,KAAK;QACV,MAAM,GAAG,GAAG,IAAI,GAAG,EAA4B,CAAC;QAChD,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,IAAA,WAAK,EAAC,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,CAAC;QACtC,OAAO,IAAI,gBAAU,CAAC,GAAG,CAAC,CAAC;IAC7B,CAAC;CACF;AA7CD,wBA6CC"}

View File

@@ -0,0 +1,7 @@
import { IonDecoderBase } from './IonDecoderBase';
import type { IReader, IReaderResettable } from '@jsonjoy.com/buffers/lib';
export declare class IonDecoder<R extends IReader & IReaderResettable = IReader & IReaderResettable> extends IonDecoderBase<R> {
constructor(reader?: R);
decode(data: Uint8Array): unknown;
read(): unknown;
}

View File

@@ -0,0 +1,23 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IonDecoder = void 0;
const IonDecoderBase_1 = require("./IonDecoderBase");
const Import_1 = require("./Import");
const symbols_1 = require("./symbols");
class IonDecoder extends IonDecoderBase_1.IonDecoderBase {
constructor(reader) {
super(reader);
}
decode(data) {
this.reader.reset(data);
this.symbols = new Import_1.Import(symbols_1.systemSymbolImport, []);
this.validateBVM();
this.readSymbolTable();
return this.val();
}
read() {
return this.val();
}
}
exports.IonDecoder = IonDecoder;
//# sourceMappingURL=IonDecoder.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"IonDecoder.js","sourceRoot":"","sources":["../../src/ion/IonDecoder.ts"],"names":[],"mappings":";;;AACA,qDAAgD;AAChD,qCAAgC;AAChC,uCAA6C;AAG7C,MAAa,UAAgF,SAAQ,+BAAiB;IACpH,YAAY,MAAU;QACpB,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEM,MAAM,CAAC,IAAgB;QAC5B,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAGxB,IAAI,CAAC,OAAO,GAAG,IAAI,eAAM,CAAC,4BAAkB,EAAE,EAAE,CAAC,CAAC;QAGlD,IAAI,CAAC,WAAW,EAAE,CAAC;QAGnB,IAAI,CAAC,eAAe,EAAE,CAAC;QAGvB,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;IAEM,IAAI;QACT,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC;IACpB,CAAC;CACF;AAxBD,gCAwBC"}

View File

@@ -0,0 +1,25 @@
import type { CachedUtf8Decoder } from '@jsonjoy.com/buffers/lib/utf8/CachedUtf8Decoder';
import type { IReader, IReaderResettable } from '@jsonjoy.com/buffers/lib';
import { Import } from './Import';
export declare class IonDecoderBase<R extends IReader & IReaderResettable = IReader & IReaderResettable> {
readonly reader: R;
readonly utf8Decoder: CachedUtf8Decoder;
protected symbols?: Import;
constructor(reader?: R);
val(): unknown;
protected readNull(length: number): null;
protected readBool(length: number): boolean | null;
protected readUint(length: number): number | null;
protected readNint(length: number): number | null;
protected readFloat(length: number): number | null;
protected readString(length: number): string | null;
protected readBinary(length: number): Uint8Array | null;
protected readList(length: number): unknown[] | null;
protected readStruct(length: number): Record<string, unknown> | null;
protected readAnnotation(length: number): unknown;
protected readVUint(): number;
protected readVInt(): number;
protected getSymbolText(symbolId: number): string;
protected validateBVM(): void;
protected readSymbolTable(): void;
}

View File

@@ -0,0 +1,242 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IonDecoderBase = void 0;
const tslib_1 = require("tslib");
const Reader_1 = require("@jsonjoy.com/buffers/lib/Reader");
const sharedCachedUtf8Decoder_1 = tslib_1.__importDefault(require("@jsonjoy.com/buffers/lib/utf8/sharedCachedUtf8Decoder"));
const Import_1 = require("./Import");
class IonDecoderBase {
constructor(reader) {
this.reader = (reader ?? new Reader_1.Reader());
this.utf8Decoder = sharedCachedUtf8Decoder_1.default;
}
val() {
const typedesc = this.reader.u8();
const type = (typedesc >> 4) & 0xf;
const length = typedesc & 0xf;
switch (type) {
case 0:
return this.readNull(length);
case 1:
return this.readBool(length);
case 2:
return this.readUint(length);
case 3:
return this.readNint(length);
case 4:
return this.readFloat(length);
case 8:
return this.readString(length);
case 10:
return this.readBinary(length);
case 11:
return this.readList(length);
case 13:
return this.readStruct(length);
case 14:
return this.readAnnotation(length);
default:
throw new Error(`Unknown Ion type: 0x${type.toString(16)}`);
}
}
readNull(length) {
if (length === 15)
return null;
if (length === 0) {
this.val();
return null;
}
if (length === 14) {
const padLength = this.readVUint();
this.reader.x += padLength;
this.val();
return null;
}
this.reader.x += length;
this.val();
return null;
}
readBool(length) {
if (length === 15)
return null;
if (length === 0)
return false;
if (length === 1)
return true;
throw new Error(`Invalid bool length: ${length}`);
}
readUint(length) {
if (length === 15)
return null;
if (length === 0)
return 0;
let value = 0;
for (let i = 0; i < length; i++) {
value = value * 256 + this.reader.u8();
}
return value;
}
readNint(length) {
if (length === 15)
return null;
if (length === 0)
throw new Error('Negative zero is illegal');
let value = 0;
for (let i = 0; i < length; i++) {
value = value * 256 + this.reader.u8();
}
return -value;
}
readFloat(length) {
if (length === 15)
return null;
if (length === 0)
return 0.0;
if (length === 4)
return this.reader.f32();
if (length === 8)
return this.reader.f64();
throw new Error(`Unsupported float length: ${length}`);
}
readString(length) {
if (length === 15)
return null;
let actualLength = length;
if (length === 14) {
actualLength = this.readVUint();
}
if (actualLength === 0)
return '';
return this.reader.utf8(actualLength);
}
readBinary(length) {
if (length === 15)
return null;
let actualLength = length;
if (length === 14) {
actualLength = this.readVUint();
}
if (actualLength === 0)
return new Uint8Array(0);
return this.reader.buf(actualLength);
}
readList(length) {
if (length === 15)
return null;
let actualLength = length;
if (length === 14) {
actualLength = this.readVUint();
}
if (actualLength === 0)
return [];
const endPos = this.reader.x + actualLength;
const list = [];
while (this.reader.x < endPos) {
list.push(this.val());
}
if (this.reader.x !== endPos) {
throw new Error('List parsing error: incorrect length');
}
return list;
}
readStruct(length) {
if (length === 15)
return null;
let actualLength = length;
if (length === 14) {
actualLength = this.readVUint();
}
if (actualLength === 0)
return {};
const endPos = this.reader.x + actualLength;
const struct = {};
while (this.reader.x < endPos) {
const fieldNameId = this.readVUint();
const fieldName = this.getSymbolText(fieldNameId);
const fieldValue = this.val();
struct[fieldName] = fieldValue;
}
if (this.reader.x !== endPos) {
throw new Error('Struct parsing error: incorrect length');
}
return struct;
}
readAnnotation(length) {
if (length < 3) {
throw new Error('Annotation wrapper must have at least 3 bytes');
}
let actualLength = length;
if (length === 14) {
actualLength = this.readVUint();
}
const annotLength = this.readVUint();
const endAnnotPos = this.reader.x + annotLength;
while (this.reader.x < endAnnotPos) {
this.readVUint();
}
if (this.reader.x !== endAnnotPos) {
throw new Error('Annotation parsing error: incorrect annotation length');
}
return this.val();
}
readVUint() {
let value = 0;
let byte;
do {
byte = this.reader.u8();
value = (value << 7) | (byte & 0x7f);
} while ((byte & 0x80) === 0);
return value;
}
readVInt() {
const firstByte = this.reader.u8();
if (firstByte & 0x80) {
const sign = firstByte & 0x40 ? -1 : 1;
const magnitude = firstByte & 0x3f;
return sign * magnitude;
}
const sign = firstByte & 0x40 ? -1 : 1;
let magnitude = firstByte & 0x3f;
let byte;
do {
byte = this.reader.u8();
magnitude = (magnitude << 7) | (byte & 0x7f);
} while ((byte & 0x80) === 0);
return sign * magnitude;
}
getSymbolText(symbolId) {
if (!this.symbols) {
throw new Error('No symbol table available');
}
const symbol = this.symbols.getText(symbolId);
if (symbol === undefined) {
throw new Error(`Unknown symbol ID: ${symbolId}`);
}
return symbol;
}
validateBVM() {
const bvm = this.reader.u32();
if (bvm !== 0xe00100ea) {
throw new Error(`Invalid Ion Binary Version Marker: 0x${bvm.toString(16)}`);
}
}
readSymbolTable() {
if (this.reader.x < this.reader.uint8.length) {
const nextByte = this.reader.peak();
const type = (nextByte >> 4) & 0xf;
if (type === 14) {
const annotValue = this.val();
if (annotValue && typeof annotValue === 'object' && !Array.isArray(annotValue)) {
const symbolsKey = 'symbols';
const obj = annotValue;
if (symbolsKey in obj && Array.isArray(obj[symbolsKey])) {
const newSymbols = obj[symbolsKey];
this.symbols = new Import_1.Import(this.symbols || null, newSymbols);
}
}
}
}
}
}
exports.IonDecoderBase = IonDecoderBase;
//# sourceMappingURL=IonDecoderBase.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,22 @@
import type { IWriter, IWriterGrowable } from '@jsonjoy.com/buffers/lib';
import { AnnotationAstNode, ArrAstNode, AstNode, BinAstNode, BoolAstNode, FloatAstNode, NintAstNode, ObjAstNode, StrAstNode, UintAstNode } from './ast';
import { Import } from './Import';
export declare class IonEncoderFast {
readonly writer: IWriter & IWriterGrowable;
protected symbols?: Import;
constructor(writer?: IWriter & IWriterGrowable);
encode(value: unknown): Uint8Array;
writeAny(value: AstNode<unknown>): void;
writeIvm(): void;
writeSymbolTable(): void;
writeAnnotations(node: AnnotationAstNode): void;
writeBool(node: BoolAstNode): void;
encodeUint(node: UintAstNode): void;
encodeNint(node: NintAstNode): void;
writeFloat(node: FloatAstNode): void;
writeVUint(num: number): void;
writeStr(node: StrAstNode): void;
writeBin(node: BinAstNode): void;
writeArr(node: ArrAstNode): void;
writeObj(node: ObjAstNode): void;
}

View File

@@ -0,0 +1,248 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IonEncoderFast = void 0;
const Writer_1 = require("@jsonjoy.com/buffers/lib/Writer");
const ast_1 = require("./ast");
const Import_1 = require("./Import");
const symbols_1 = require("./symbols");
class IonEncoderFast {
constructor(writer = new Writer_1.Writer()) {
this.writer = writer;
}
encode(value) {
this.writer.reset();
this.symbols = new Import_1.Import(symbols_1.systemSymbolImport, []);
const ast = (0, ast_1.toAst)(value, this.symbols);
this.writeIvm();
this.writeSymbolTable();
this.writeAny(ast);
return this.writer.flush();
}
writeAny(value) {
if (value instanceof ast_1.NullAstNode)
this.writer.u8(0 + 15);
else if (value instanceof ast_1.StrAstNode)
this.writeStr(value);
else if (value instanceof ast_1.UintAstNode)
this.encodeUint(value);
else if (value instanceof ast_1.NintAstNode)
this.encodeNint(value);
else if (value instanceof ast_1.ObjAstNode)
this.writeObj(value);
else if (value instanceof ast_1.ArrAstNode)
this.writeArr(value);
else if (value instanceof ast_1.FloatAstNode)
this.writeFloat(value);
else if (value instanceof ast_1.BoolAstNode)
this.writeBool(value);
else if (value instanceof ast_1.BinAstNode)
this.writeBin(value);
}
writeIvm() {
this.writer.u32(0xe00100ea);
}
writeSymbolTable() {
if (!this.symbols?.length)
return;
const node = new ast_1.AnnotationAstNode(this.symbols.toAst(), [3]);
this.writeAnnotations(node);
}
writeAnnotations(node) {
const writer = this.writer;
if (node.len < 14)
writer.u8(224 + node.len);
else {
writer.u8(224 + 14);
this.writeVUint(node.len);
}
this.writeVUint(node.annotationLen);
for (let i = 0; i < node.annotations.length; i++)
this.writeVUint(node.annotations[i]);
this.writeAny(node.val);
}
writeBool(node) {
this.writer.u8(16 + (node.val ? 1 : 0));
}
encodeUint(node) {
const uint = node.val;
if (!uint)
this.writer.u8(32);
else if (uint <= 0xff)
this.writer.u16(((32 + 1) << 8) + uint);
else if (uint <= 0xffff)
this.writer.u8u16(32 + 2, uint);
else if (uint <= 0xffffff)
this.writer.u32(((32 + 3) << 24) + uint);
else if (uint <= 0xffffffff)
this.writer.u8u32(32 + 4, uint);
else {
let lo = uint | 0;
if (lo < 0)
lo += 4294967296;
let hi = uint - lo;
hi /= 4294967296;
if (uint <= 0xffffffffff) {
this.writer.u16(((32 + 5) << 8) + hi);
this.writer.u32(lo);
}
else if (uint <= 0xffffffffffff) {
this.writer.u8u16(32 + 6, hi);
this.writer.u32(lo);
}
else {
this.writer.u16(((32 + 7) << 8) + (hi >> 16));
this.writer.u16(hi & 0xffff);
this.writer.u32(lo);
}
}
}
encodeNint(node) {
const uint = -node.val;
if (uint <= 0xff)
this.writer.u16(((48 + 1) << 8) + uint);
else if (uint <= 0xffff)
this.writer.u8u16(48 + 2, uint);
else if (uint <= 0xffffff)
this.writer.u32(((48 + 3) << 24) + uint);
else if (uint <= 0xffffffff)
this.writer.u8u32(48 + 4, uint);
else {
let lo = uint | 0;
if (lo < 0)
lo += 4294967296;
let hi = uint - lo;
hi /= 4294967296;
if (uint <= 0xffffffffff) {
this.writer.u16(((48 + 5) << 8) + hi);
this.writer.u32(lo);
}
else if (uint <= 0xffffffffffff) {
this.writer.u8u16(48 + 6, hi);
this.writer.u32(lo);
}
else {
this.writer.u16(((48 + 7) << 8) + (hi >> 16));
this.writer.u16(hi & 0xffff);
this.writer.u32(lo);
}
}
}
writeFloat(node) {
this.writer.u8f64(64 + 8, node.val);
}
writeVUint(num) {
const writer = this.writer;
if (num <= 0b1111111) {
writer.u8(0b10000000 + num);
}
else if (num <= 16383) {
writer.ensureCapacity(2);
const uint8 = writer.uint8;
uint8[writer.x++] = num >>> 7;
uint8[writer.x++] = 0b10000000 + (num & 0b01111111);
}
else if (num <= 2097151) {
writer.ensureCapacity(3);
const uint8 = writer.uint8;
uint8[writer.x++] = num >>> 14;
uint8[writer.x++] = (num >>> 7) & 0b01111111;
uint8[writer.x++] = 0b10000000 + (num & 0b01111111);
}
else if (num <= 268435455) {
writer.ensureCapacity(4);
const uint8 = writer.uint8;
uint8[writer.x++] = num >>> 21;
uint8[writer.x++] = (num >>> 14) & 0b01111111;
uint8[writer.x++] = (num >>> 7) & 0b01111111;
uint8[writer.x++] = 0b10000000 + (num & 0b01111111);
}
else {
let lo32 = num | 0;
if (lo32 < 0)
lo32 += 4294967296;
const hi32 = (num - lo32) / 4294967296;
if (num <= 34359738367) {
writer.ensureCapacity(5);
const uint8 = writer.uint8;
uint8[writer.x++] = (hi32 << 4) | (num >>> 28);
uint8[writer.x++] = (num >>> 21) & 0b01111111;
uint8[writer.x++] = (num >>> 14) & 0b01111111;
uint8[writer.x++] = (num >>> 7) & 0b01111111;
uint8[writer.x++] = 0b10000000 + (num & 0b01111111);
}
else if (num <= 4398046511103) {
writer.ensureCapacity(6);
const uint8 = writer.uint8;
uint8[writer.x++] = (hi32 >>> 3) & 0b1111;
uint8[writer.x++] = ((hi32 & 0b111) << 4) | (num >>> 28);
uint8[writer.x++] = (num >>> 21) & 0b01111111;
uint8[writer.x++] = (num >>> 14) & 0b01111111;
uint8[writer.x++] = (num >>> 7) & 0b01111111;
uint8[writer.x++] = 0b10000000 + (num & 0b01111111);
}
}
}
writeStr(node) {
const str = node.val;
const length = node.len;
const writer = this.writer;
if (length < 14)
writer.u8(128 + length);
else {
writer.u8(128 + 14);
this.writeVUint(length);
}
writer.ensureCapacity(length * 4);
writer.utf8(str);
}
writeBin(node) {
const buf = node.val;
const length = node.len;
const writer = this.writer;
if (length < 14)
writer.u8(160 + length);
else {
writer.u8(160 + 14);
this.writeVUint(length);
}
writer.buf(buf, length);
}
writeArr(node) {
const writer = this.writer;
const arr = node.val;
if (arr === null) {
writer.u8(176 + 15);
return;
}
const length = node.len;
if (length < 14)
writer.u8(176 + length);
else {
writer.u8(176 + 14);
this.writeVUint(length);
}
for (let i = 0; i < length; i++)
this.writeAny(arr[i]);
}
writeObj(node) {
const writer = this.writer;
const arr = node.val;
if (arr === null) {
writer.u8(176 + 15);
return;
}
const length = node.len;
if (length < 14)
writer.u8(208 + length);
else {
writer.u8(208 + 14);
this.writeVUint(length);
}
node.val.forEach((n, symbolId) => {
this.writeVUint(symbolId);
this.writeAny(n);
});
}
}
exports.IonEncoderFast = IonEncoderFast;
//# sourceMappingURL=IonEncoderFast.js.map

File diff suppressed because one or more lines are too long

68
node_modules/@jsonjoy.com/json-pack/lib/ion/ast.d.ts generated vendored Normal file
View File

@@ -0,0 +1,68 @@
import { Import } from './Import';
export interface AstNode<T> {
readonly val: T;
readonly len: number;
byteLength(): number;
}
export declare class NullAstNode implements AstNode<null> {
readonly val: null;
readonly len = 1;
byteLength(): number;
}
export declare class BoolAstNode implements AstNode<boolean> {
readonly val: boolean;
readonly len = 1;
constructor(val: boolean);
byteLength(): number;
}
export declare class UintAstNode implements AstNode<number> {
readonly val: number;
readonly len: number;
constructor(val: number);
byteLength(): number;
}
export declare class NintAstNode implements AstNode<number> {
readonly val: number;
readonly len: number;
constructor(val: number);
byteLength(): number;
}
export declare class FloatAstNode implements AstNode<number> {
readonly val: number;
readonly len: number;
constructor(val: number);
byteLength(): number;
}
export declare class StrAstNode implements AstNode<string> {
readonly val: string;
readonly len: number;
constructor(val: string);
byteLength(): number;
}
export declare class BinAstNode implements AstNode<Uint8Array> {
readonly val: Uint8Array;
readonly len: number;
constructor(val: Uint8Array);
byteLength(): number;
}
export declare class ArrAstNode implements AstNode<AstNode<unknown>[] | null> {
readonly val: AstNode<unknown>[] | null;
readonly len: number;
constructor(val: AstNode<unknown>[] | null);
byteLength(): number;
}
export declare class ObjAstNode implements AstNode<Map<number, AstNode<unknown>> | null> {
readonly val: Map<number, AstNode<unknown>> | null;
readonly len: number;
constructor(val: Map<number, AstNode<unknown>> | null);
byteLength(): number;
}
export declare class AnnotationAstNode implements AstNode<AstNode<unknown>> {
readonly val: AstNode<unknown>;
readonly annotations: number[];
readonly len: number;
readonly annotationLen: number;
constructor(val: AstNode<unknown>, annotations: number[]);
byteLength(): number;
}
export declare const toAst: (val: unknown, symbols: Import) => AstNode<unknown>;

213
node_modules/@jsonjoy.com/json-pack/lib/ion/ast.js generated vendored Normal file
View File

@@ -0,0 +1,213 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.toAst = exports.AnnotationAstNode = exports.ObjAstNode = exports.ArrAstNode = exports.BinAstNode = exports.StrAstNode = exports.FloatAstNode = exports.NintAstNode = exports.UintAstNode = exports.BoolAstNode = exports.NullAstNode = void 0;
const utf8_1 = require("@jsonjoy.com/util/lib/strings/utf8");
class NullAstNode {
constructor() {
this.val = null;
this.len = 1;
}
byteLength() {
return 1;
}
}
exports.NullAstNode = NullAstNode;
class BoolAstNode {
constructor(val) {
this.val = val;
this.len = 1;
}
byteLength() {
return 1;
}
}
exports.BoolAstNode = BoolAstNode;
class UintAstNode {
constructor(val) {
this.val = val;
if (!val)
this.len = 0;
else if (val <= 0xff)
this.len = 1;
else if (val <= 0xffff)
this.len = 2;
else if (val <= 0xffffff)
this.len = 3;
else if (val <= 0xffffffff)
this.len = 4;
else if (val <= 0xffffffffff)
this.len = 5;
else if (val <= 0xffffffffffff)
this.len = 6;
else
this.len = 7;
}
byteLength() {
return 1 + this.len;
}
}
exports.UintAstNode = UintAstNode;
class NintAstNode {
constructor(val) {
this.val = val;
const uint = -val;
if (!uint)
this.len = 0;
else if (uint <= 0xff)
this.len = 1;
else if (uint <= 0xffff)
this.len = 2;
else if (uint <= 0xffffff)
this.len = 3;
else if (uint <= 0xffffffff)
this.len = 4;
else if (uint <= 0xffffffffff)
this.len = 5;
else if (uint <= 0xffffffffffff)
this.len = 6;
else
this.len = 7;
}
byteLength() {
return 1 + this.len;
}
}
exports.NintAstNode = NintAstNode;
class FloatAstNode {
constructor(val) {
this.val = val;
this.len = 8;
}
byteLength() {
return 1 + this.len;
}
}
exports.FloatAstNode = FloatAstNode;
const vUintLen = (num) => {
if (num <= 0b1111111)
return 1;
else if (num <= 16383)
return 2;
else if (num <= 2097151)
return 3;
else if (num <= 268435455)
return 4;
else if (num <= 34359738367)
return 5;
else
return 6;
};
class StrAstNode {
constructor(val) {
this.val = val;
this.len = (0, utf8_1.utf8Size)(val);
}
byteLength() {
return this.len < 14 ? 1 + this.len : 1 + vUintLen(this.len) + this.len;
}
}
exports.StrAstNode = StrAstNode;
class BinAstNode {
constructor(val) {
this.val = val;
this.len = val.length;
}
byteLength() {
return this.len < 14 ? 1 + this.len : 1 + vUintLen(this.len) + this.len;
}
}
exports.BinAstNode = BinAstNode;
class ArrAstNode {
constructor(val) {
this.val = val;
if (val === null) {
this.len = 1;
}
else {
if (!val.length)
this.len = 0;
else {
let elementLength = 0;
for (let i = 0; i < val.length; i++)
elementLength += val[i].byteLength();
this.len = elementLength;
}
}
}
byteLength() {
return this.len < 14 ? 1 + this.len : 1 + vUintLen(this.len) + this.len;
}
}
exports.ArrAstNode = ArrAstNode;
class ObjAstNode {
constructor(val) {
this.val = val;
if (val === null) {
this.len = 1;
}
else {
if (!val.size)
this.len = 0;
else {
let len = 0;
val.forEach((node, symbolId) => {
len += vUintLen(symbolId) + node.byteLength();
});
this.len = len;
}
}
}
byteLength() {
return this.len < 14 ? 1 + this.len : 1 + vUintLen(this.len) + this.len;
}
}
exports.ObjAstNode = ObjAstNode;
class AnnotationAstNode {
constructor(val, annotations) {
this.val = val;
this.annotations = annotations;
let len = 0;
for (let i = 0; i < annotations.length; i++)
len += vUintLen(annotations[i]);
this.annotationLen = len;
len += vUintLen(len);
len += val.byteLength();
this.len = len;
}
byteLength() {
return this.len < 14 ? 1 + this.len : 1 + vUintLen(this.len) + this.len;
}
}
exports.AnnotationAstNode = AnnotationAstNode;
const isSafeInteger = Number.isSafeInteger;
const toAst = (val, symbols) => {
if (val === null)
return new NullAstNode();
if (val instanceof Array)
return new ArrAstNode(val.map((el) => (0, exports.toAst)(el, symbols)));
if (val instanceof Uint8Array)
return new BinAstNode(val);
switch (typeof val) {
case 'boolean':
return new BoolAstNode(val);
case 'number': {
if (isSafeInteger(val))
return val >= 0 ? new UintAstNode(val) : new NintAstNode(val);
else
return new FloatAstNode(val);
}
case 'string':
return new StrAstNode(val);
case 'object': {
const struct = new Map();
for (const key in val) {
const symbolId = symbols.add(key);
struct.set(symbolId, (0, exports.toAst)(val[key], symbols));
}
return new ObjAstNode(struct);
}
}
throw new Error('UNKNOWN_TYPE');
};
exports.toAst = toAst;
//# sourceMappingURL=ast.js.map

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,24 @@
export declare const enum TYPE {
NULL = 0,
BOOL = 1,
UINT = 2,
NINT = 3,
FLOT = 4,
STRI = 8,
LIST = 11,
BINA = 10,
STRU = 13,
ANNO = 14
}
export declare const enum TYPE_OVERLAY {
NULL = 0,
BOOL = 16,
UINT = 32,
NINT = 48,
FLOT = 64,
STRI = 128,
LIST = 176,
BINA = 160,
STRU = 208,
ANNO = 224
}

View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=constants.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/ion/constants.ts"],"names":[],"mappings":""}

View File

@@ -0,0 +1,7 @@
export * from './types';
export * from './constants';
export * from './Import';
export * from './IonEncoderFast';
export * from './IonDecoderBase';
export * from './IonDecoder';
export * from './symbols';

11
node_modules/@jsonjoy.com/json-pack/lib/ion/index.js generated vendored Normal file
View File

@@ -0,0 +1,11 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
tslib_1.__exportStar(require("./types"), exports);
tslib_1.__exportStar(require("./constants"), exports);
tslib_1.__exportStar(require("./Import"), exports);
tslib_1.__exportStar(require("./IonEncoderFast"), exports);
tslib_1.__exportStar(require("./IonDecoderBase"), exports);
tslib_1.__exportStar(require("./IonDecoder"), exports);
tslib_1.__exportStar(require("./symbols"), exports);
//# sourceMappingURL=index.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ion/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,sDAA4B;AAC5B,mDAAyB;AACzB,2DAAiC;AACjC,2DAAiC;AACjC,uDAA6B;AAC7B,oDAA0B"}

View File

@@ -0,0 +1,4 @@
import { Import } from './Import';
import { SymbolTable } from './types';
export declare const systemSymbolTable: SymbolTable;
export declare const systemSymbolImport: Import;

17
node_modules/@jsonjoy.com/json-pack/lib/ion/symbols.js generated vendored Normal file
View File

@@ -0,0 +1,17 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.systemSymbolImport = exports.systemSymbolTable = void 0;
const Import_1 = require("./Import");
exports.systemSymbolTable = [
'$ion',
'$ion_1_0',
'$ion_symbol_table',
'name',
'version',
'imports',
'symbols',
'max_id',
'$ion_shared_symbol_table',
];
exports.systemSymbolImport = new Import_1.Import(null, exports.systemSymbolTable);
//# sourceMappingURL=symbols.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"symbols.js","sourceRoot":"","sources":["../../src/ion/symbols.ts"],"names":[],"mappings":";;;AAAA,qCAAgC;AAGnB,QAAA,iBAAiB,GAAgB;IAC5C,MAAM;IACN,UAAU;IACV,mBAAmB;IACnB,MAAM;IACN,SAAS;IACT,SAAS;IACT,SAAS;IACT,QAAQ;IACR,0BAA0B;CAC3B,CAAC;AAEW,QAAA,kBAAkB,GAAG,IAAI,eAAM,CAAC,IAAI,EAAE,yBAAiB,CAAC,CAAC"}

View File

@@ -0,0 +1 @@
export type SymbolTable = string[];

3
node_modules/@jsonjoy.com/json-pack/lib/ion/types.js generated vendored Normal file
View File

@@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=types.js.map

View File

@@ -0,0 +1 @@
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/ion/types.ts"],"names":[],"mappings":""}