card-gate-frame 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":[],"sources":["../src/dom/index.ts"],"sourcesContent":["import type {\n GateCrest,\n GateFamily,\n GateGenerationOptions,\n GateGenerationOptionsV1,\n GateGenerationOptionsV2,\n GateGenerationOptionsV3,\n GateGenerationVersion,\n GateGeometry,\n GateGeometryV1,\n GateGeometryV2,\n GateGeometryV3,\n GatePaintOptions,\n GateSeed,\n} from \"../core/index.js\";\nimport { generateGate, renderGateSVG } from \"../core/index.js\";\nimport { isCompatibleCrest, isGateFamily } from \"../core/v2/generate.js\";\n\nexport type {\n GateCrest,\n GateFamily,\n GateGenerationVersion,\n GateGeometry,\n GateGeometryV1,\n GateGeometryV2,\n GateGeometryV3,\n};\n\nexport interface GateOptionsV1 {\n readonly seed?: GateSeed;\n readonly generationVersion?: 1;\n readonly family?: \"courtyard\";\n readonly density?: number;\n readonly curvature?: number;\n readonly symmetry?: never;\n readonly peakHeight?: never;\n readonly sideComplexity?: never;\n readonly crest?: never;\n readonly stroke?: string;\n readonly surface?: string;\n readonly responsive?: boolean;\n}\n\nexport interface GateOptionsV2 {\n readonly seed?: GateSeed;\n readonly generationVersion: 2;\n readonly family?: GateFamily | \"auto\";\n readonly density?: number;\n readonly curvature?: number;\n readonly symmetry?: number;\n readonly peakHeight?: number;\n readonly sideComplexity?: number;\n readonly crest?: GateCrest;\n readonly stroke?: string;\n readonly surface?: string;\n readonly responsive?: boolean;\n}\n\nexport interface GateOptionsV3 extends Omit<GateOptionsV2, \"generationVersion\"> {\n readonly generationVersion: 3;\n}\n\nexport type GateOptions = GateOptionsV1 | GateOptionsV2 | GateOptionsV3;\n\nexport type GateOptionUpdate =\n | Partial<GateOptionsV1>\n | (Partial<Omit<GateOptionsV2, \"generationVersion\">> & {\n readonly generationVersion?: 2;\n })\n | (Partial<Omit<GateOptionsV3, \"generationVersion\">> & { readonly generationVersion?: 3 });\n\nexport interface GateSnapshotBase {\n readonly seed: GateSeed;\n readonly paint: Readonly<Required<GatePaintOptions>>;\n}\n\nexport interface GateSnapshotV1 extends GateSnapshotBase {\n readonly generationVersion: 1;\n readonly geometry: Readonly<GateGeometryV1>;\n}\n\nexport interface GateSnapshotV2 extends GateSnapshotBase {\n readonly generationVersion: 2;\n readonly geometry: Readonly<GateGeometryV2>;\n}\n\nexport interface GateSnapshotV3 extends GateSnapshotBase {\n readonly generationVersion: 3;\n readonly geometry: Readonly<GateGeometryV3>;\n}\n\nexport type GateSnapshot = GateSnapshotV1 | GateSnapshotV2 | GateSnapshotV3;\n\nexport type GateFrameErrorCode =\n | \"INVALID_SELECTOR\"\n | \"TARGET_NOT_FOUND\"\n | \"TARGET_NOT_HTML_ELEMENT\"\n | \"UNSUPPORTED_TARGET\"\n | \"POSITIONING_CONFLICT\"\n | \"ALREADY_MOUNTED\"\n | \"INVALID_OPTIONS\"\n | \"UNSUPPORTED_DIMENSIONS\"\n | \"INSUFFICIENT_CONTENT_SPACE\"\n | \"NOT_READY\"\n | \"DESTROYED\";\n\nconst freezeContext = <Context extends Record<string, unknown>>(\n context: Context,\n): Readonly<Context> => {\n for (const value of Object.values(context)) {\n if (value !== null && typeof value === \"object\" && !Object.isFrozen(value)) {\n freezeContext(value as Record<string, unknown>);\n }\n }\n return Object.freeze(context);\n};\n\nexport class GateFrameError extends Error {\n declare readonly code: GateFrameErrorCode;\n declare readonly context: Readonly<Record<string, unknown>>;\n\n constructor(\n code: GateFrameErrorCode,\n message: string,\n context: Record<string, unknown> = {},\n name = \"GateFrameError\",\n ) {\n super(message);\n Object.defineProperties(this, {\n name: { value: name, enumerable: false },\n code: { value: code, enumerable: true },\n context: { value: freezeContext(context), enumerable: true },\n });\n }\n}\n\nexport class GateFrameInvalidSelectorError extends GateFrameError {\n constructor(selector: string) {\n super(\n \"INVALID_SELECTOR\",\n \"Gate Frame received an invalid selector\",\n { selector },\n \"GateFrameInvalidSelectorError\",\n );\n }\n}\n\nexport class GateFrameTargetNotFoundError extends GateFrameError {\n constructor(selector: string) {\n super(\n \"TARGET_NOT_FOUND\",\n \"Gate Frame could not find a target for the selector\",\n { selector },\n \"GateFrameTargetNotFoundError\",\n );\n }\n}\n\nexport class GateFrameTargetNotHTMLElementError extends GateFrameError {\n constructor(\n context:\n | {\n readonly source: \"selector\";\n readonly selector: string;\n readonly tagName: string;\n }\n | { readonly source: \"direct\"; readonly tagName: string }\n | { readonly source: \"direct\"; readonly valueType: string },\n ) {\n super(\n \"TARGET_NOT_HTML_ELEMENT\",\n \"Gate Frame targets must be HTML elements\",\n { ...context },\n \"GateFrameTargetNotHTMLElementError\",\n );\n }\n}\n\nexport class GateFrameAlreadyMountedError extends GateFrameError {\n constructor(target: HTMLElement) {\n super(\n \"ALREADY_MOUNTED\",\n \"Gate Frame is already mounted on this target\",\n { tagName: target.localName },\n \"GateFrameAlreadyMountedError\",\n );\n }\n}\n\ntype UnsupportedTargetReason =\n | \"replaced-element\"\n | \"restricted-form-control\"\n | \"table-internal\"\n | \"display-inline\"\n | \"display-contents\"\n | \"unsupported-display\"\n | \"content-model\"\n | \"writing-mode\"\n | \"fragmented\"\n | \"shadow-host\";\n\nexport class GateFrameUnsupportedTargetError extends GateFrameError {\n constructor(\n target: HTMLElement,\n reason: UnsupportedTargetReason,\n details: Record<string, unknown> = {},\n ) {\n super(\n \"UNSUPPORTED_TARGET\",\n \"Gate Frame does not support this target\",\n { tagName: target.localName, reason, ...details },\n \"GateFrameUnsupportedTargetError\",\n );\n }\n}\n\nexport class GateFramePositioningConflictError extends GateFrameError {\n constructor(target: HTMLElement, descendant: Element) {\n super(\n \"POSITIONING_CONFLICT\",\n \"Gate Frame will not change the containing block of an absolute descendant\",\n { tagName: target.localName, descendantTagName: descendant.localName },\n \"GateFramePositioningConflictError\",\n );\n }\n}\n\nexport class GateFrameInvalidOptionsError extends GateFrameError {\n constructor(context: {\n readonly optionKeys: ReadonlyArray<string>;\n readonly reason: string;\n readonly category?:\n | \"shape\"\n | \"unknown-key\"\n | \"responsive\"\n | \"version\"\n | \"family\"\n | \"seed\"\n | \"value\"\n | \"crest\"\n | \"paint\";\n }) {\n super(\n \"INVALID_OPTIONS\",\n \"Gate Frame received invalid options\",\n context.category === undefined\n ? { optionKeys: [...context.optionKeys], reason: context.reason }\n : {\n category: context.category,\n optionKeys: [...context.optionKeys],\n reason: context.reason,\n },\n \"GateFrameInvalidOptionsError\",\n );\n }\n}\n\nexport class GateFrameUnsupportedDimensionsError extends GateFrameError {\n constructor(dimensions: Readonly<{ width: number; height: number }>) {\n super(\n \"UNSUPPORTED_DIMENSIONS\",\n \"Gate Frame cannot generate geometry for the measured dimensions\",\n { dimensions: { ...dimensions } },\n \"GateFrameUnsupportedDimensionsError\",\n );\n }\n}\n\ninterface PhysicalInsets {\n readonly top: number;\n readonly right: number;\n readonly bottom: number;\n readonly left: number;\n}\n\nexport class GateFrameInsufficientSpaceError extends GateFrameError {\n constructor(measured: PhysicalInsets, required: PhysicalInsets) {\n super(\n \"INSUFFICIENT_CONTENT_SPACE\",\n \"Gate Frame requires more existing target padding\",\n { measured: { ...measured }, required: { ...required } },\n \"GateFrameInsufficientSpaceError\",\n );\n }\n}\n\nexport class GateFrameNotReadyError extends GateFrameError {\n constructor() {\n super(\"NOT_READY\", \"Gate Frame has not committed a render\", {}, \"GateFrameNotReadyError\");\n }\n}\n\nexport class GateFrameDestroyedError extends GateFrameError {\n constructor() {\n super(\"DESTROYED\", \"Gate Frame controller is destroyed\", {}, \"GateFrameDestroyedError\");\n }\n}\n\nexport type GateFrameStatus =\n | Readonly<{ state: \"pending\" }>\n | Readonly<{ state: \"ready\"; snapshot: Readonly<GateSnapshot> }>\n | Readonly<{ state: \"error\"; error: GateFrameError }>\n | Readonly<{ state: \"destroyed\" }>;\n\nexport interface GateFrameController {\n status(): GateFrameStatus;\n whenReady(): Promise<Readonly<GateSnapshot>>;\n update(options: GateOptionUpdate): GateFrameController;\n randomize(seed?: GateSeed): GateSeed;\n snapshot(): Readonly<GateSnapshot> | null;\n toSVG(): string;\n destroy(): void;\n}\n\ninterface ReadyWaiter {\n readonly resolve: (snapshot: Readonly<GateSnapshot>) => void;\n readonly reject: (error: Error) => void;\n}\n\ninterface NormalizedControllerOptionsBase {\n readonly seed: GateSeed;\n readonly density: number;\n readonly curvature: number;\n readonly stroke: string;\n readonly surface: string;\n readonly responsive: boolean;\n}\n\ninterface NormalizedControllerOptionsV1 extends NormalizedControllerOptionsBase {\n readonly generationVersion: 1;\n readonly family: \"courtyard\";\n}\n\ninterface NormalizedControllerOptionsV2 extends NormalizedControllerOptionsBase {\n readonly generationVersion: 2;\n readonly family: GateFamily | \"auto\";\n readonly symmetry: number;\n readonly peakHeight: number;\n readonly sideComplexity: number;\n readonly crest: GateCrest | undefined;\n}\n\ninterface NormalizedControllerOptionsV3\n extends Omit<NormalizedControllerOptionsV2, \"generationVersion\"> {\n readonly generationVersion: 3;\n}\n\ntype NormalizedControllerOptions =\n | NormalizedControllerOptionsV1\n | NormalizedControllerOptionsV2\n | NormalizedControllerOptionsV3;\n\nconst PENDING_STATUS: GateFrameStatus = Object.freeze({ state: \"pending\" });\nconst DESTROYED_STATUS: GateFrameStatus = Object.freeze({ state: \"destroyed\" });\nconst mountedTargets = new WeakMap<HTMLElement, GateFrameController>();\nconst REPLACED_TAGS = new Set([\"AUDIO\", \"CANVAS\", \"EMBED\", \"IFRAME\", \"IMG\", \"OBJECT\", \"VIDEO\"]);\nconst RESTRICTED_FORM_TAGS = new Set([\n \"BUTTON\",\n \"INPUT\",\n \"METER\",\n \"OPTION\",\n \"PROGRESS\",\n \"SELECT\",\n \"TEXTAREA\",\n]);\nconst TABLE_TAGS = new Set([\n \"CAPTION\",\n \"COL\",\n \"COLGROUP\",\n \"TABLE\",\n \"TBODY\",\n \"TD\",\n \"TFOOT\",\n \"TH\",\n \"THEAD\",\n \"TR\",\n]);\nconst SUPPORTED_TARGET_TAGS = new Set([\"ARTICLE\", \"ASIDE\", \"DIV\", \"SECTION\"]);\nconst SUPPORTED_DISPLAYS = new Set([\"block\", \"flex\", \"grid\", \"inline-block\", \"none\"]);\nconst V1_OPTION_KEYS = new Set([\n \"seed\",\n \"family\",\n \"generationVersion\",\n \"density\",\n \"curvature\",\n \"stroke\",\n \"surface\",\n \"responsive\",\n]);\nconst V2_OPTION_KEYS = new Set([\n ...V1_OPTION_KEYS,\n \"symmetry\",\n \"peakHeight\",\n \"sideComplexity\",\n \"crest\",\n]);\n\nconst classifyTarget = (target: HTMLElement, style: CSSStyleDeclaration): void => {\n const display = style.display || target.style.display || \"block\";\n const writingMode = style.writingMode || target.style.writingMode || \"horizontal-tb\";\n const columnCountValue = style.columnCount || target.style.columnCount || \"auto\";\n const columnWidth = style.columnWidth || target.style.columnWidth || \"auto\";\n if (target.shadowRoot !== null) {\n throw new GateFrameUnsupportedTargetError(target, \"shadow-host\");\n }\n if (RESTRICTED_FORM_TAGS.has(target.tagName)) {\n throw new GateFrameUnsupportedTargetError(target, \"restricted-form-control\");\n }\n if (TABLE_TAGS.has(target.tagName)) {\n throw new GateFrameUnsupportedTargetError(target, \"table-internal\");\n }\n if (REPLACED_TAGS.has(target.tagName)) {\n throw new GateFrameUnsupportedTargetError(target, \"replaced-element\");\n }\n if (display === \"inline\") {\n throw new GateFrameUnsupportedTargetError(target, \"display-inline\", {\n display,\n });\n }\n if (display === \"contents\") {\n throw new GateFrameUnsupportedTargetError(target, \"display-contents\", {\n display,\n });\n }\n if (!SUPPORTED_DISPLAYS.has(display)) {\n throw new GateFrameUnsupportedTargetError(target, \"unsupported-display\", {\n display,\n });\n }\n if (!SUPPORTED_TARGET_TAGS.has(target.tagName)) {\n throw new GateFrameUnsupportedTargetError(target, \"content-model\");\n }\n if (!writingMode.startsWith(\"horizontal\")) {\n throw new GateFrameUnsupportedTargetError(target, \"writing-mode\", {\n writingMode,\n });\n }\n const columnCount = Number.parseInt(columnCountValue, 10);\n if (\n (columnCountValue !== \"auto\" && Number.isFinite(columnCount) && columnCount > 1) ||\n columnWidth !== \"auto\"\n ) {\n throw new GateFrameUnsupportedTargetError(target, \"fragmented\", {\n columnCount: columnCountValue,\n columnWidth,\n });\n }\n};\n\nconst createRandomSeed = (): string => {\n const bytes = new Uint8Array(16);\n crypto.getRandomValues(bytes);\n return Array.from(bytes, (byte) => byte.toString(16).padStart(2, \"0\")).join(\"\");\n};\n\nconst invalidOptions = (options: unknown, reason: string): GateFrameInvalidOptionsError => {\n const optionKeys =\n options !== null && typeof options === \"object\" && !Array.isArray(options)\n ? Object.keys(options).sort()\n : [];\n return new GateFrameInvalidOptionsError({ optionKeys, reason });\n};\n\nconst assertV1OptionKeys = (options: Record<string, unknown>): void => {\n const unsupportedKeys = Reflect.ownKeys(options)\n .filter((key) => typeof key !== \"string\" || !V1_OPTION_KEYS.has(key))\n .map(String)\n .sort();\n if (unsupportedKeys.length > 0) {\n throw new GateFrameInvalidOptionsError({\n optionKeys: unsupportedKeys,\n reason: \"unsupported option keys\",\n });\n }\n};\n\ntype V2InvalidOptionsCategory =\n | \"shape\"\n | \"unknown-key\"\n | \"responsive\"\n | \"version\"\n | \"family\"\n | \"seed\"\n | \"value\"\n | \"crest\"\n | \"paint\";\n\nconst invalidV2Options = (\n category: V2InvalidOptionsCategory,\n optionKeys: ReadonlyArray<string>,\n reason: string,\n): GateFrameInvalidOptionsError =>\n new GateFrameInvalidOptionsError({ category, optionKeys: [...optionKeys].sort(), reason });\n\nconst assertV2OptionShape = (options: unknown): Record<string, unknown> => {\n if (options === null || typeof options !== \"object\" || Array.isArray(options)) {\n throw invalidV2Options(\"shape\", [], \"options must be a plain object\");\n }\n const record = options as Record<string, unknown>;\n const unsupportedKeys = Reflect.ownKeys(record)\n .filter((key) => typeof key !== \"string\" || !V2_OPTION_KEYS.has(key))\n .map(String)\n .sort();\n if (unsupportedKeys.length > 0) {\n throw invalidV2Options(\"unknown-key\", unsupportedKeys, \"unsupported option keys\");\n }\n return record;\n};\n\nconst ownValue = (record: Record<string, unknown>, key: string, fallback: unknown): unknown =>\n !Object.hasOwn(record, key) || record[key] === undefined ? fallback : record[key];\n\nconst isGateSeed = (value: unknown): value is GateSeed =>\n (typeof value === \"string\" && value.length > 0) ||\n (typeof value === \"number\" && Number.isFinite(value));\n\nconst isUnitControl = (value: unknown): value is number =>\n typeof value === \"number\" && Number.isFinite(value) && value >= 0 && value <= 1;\n\nconst EXPECTED_CORE_OPTION_ERROR =\n /^(?:GF-01 requires family: \"courtyard\"|GF-01 supports only generationVersion 1|Gate seed numbers must be finite|Gate seeds must be strings or finite numbers|Gate seed strings must not be empty|(?:density|curvature) must be (?:a finite number|between 0 and 1 inclusive)|(?:stroke|surface) paint must be (?:a string|a safe literal CSS color))$/;\n\nconst normalizeV1ControllerOptions = (\n options: GateOptionsV1,\n fallbackSeed?: GateSeed,\n): Readonly<NormalizedControllerOptionsV1> => {\n if (options === null || typeof options !== \"object\" || Array.isArray(options)) {\n throw invalidOptions(options, \"options must be a plain object\");\n }\n\n const optionRecord = options as Record<string, unknown>;\n assertV1OptionKeys(optionRecord);\n const optionOr = (name: string, fallback: unknown): unknown =>\n optionRecord[name] === undefined ? fallback : optionRecord[name];\n const responsive = optionOr(\"responsive\", true);\n if (typeof responsive !== \"boolean\") {\n throw invalidOptions(options, \"responsive must be a boolean\");\n }\n const defaultSeed =\n optionRecord.seed === undefined && fallbackSeed === undefined\n ? createRandomSeed()\n : fallbackSeed;\n\n const generationOptions = {\n seed: optionOr(\"seed\", defaultSeed),\n family: optionOr(\"family\", \"courtyard\"),\n generationVersion: optionOr(\"generationVersion\", 1),\n density: optionOr(\"density\", 0.55),\n curvature: optionOr(\"curvature\", 0.65),\n } as GateGenerationOptionsV1;\n const stroke = optionOr(\"stroke\", \"currentColor\");\n const surface = optionOr(\"surface\", \"transparent\");\n\n let validationGeometry: Readonly<GateGeometry>;\n try {\n validationGeometry = generateGate({ width: 160, height: 160 }, generationOptions);\n renderGateSVG(validationGeometry, {\n stroke: stroke as string,\n surface: surface as string,\n });\n } catch (cause) {\n if (\n (cause instanceof TypeError || cause instanceof RangeError) &&\n EXPECTED_CORE_OPTION_ERROR.test(cause.message)\n ) {\n throw invalidOptions(options, cause.message);\n }\n throw cause;\n }\n\n const normalizedStroke = (stroke as string).trim();\n const normalizedSurface = (surface as string).trim();\n if (!CSS.supports(\"color\", normalizedStroke) || !CSS.supports(\"color\", normalizedSurface)) {\n throw invalidOptions(options, \"paint must be supported CSS color syntax\");\n }\n\n return Object.freeze({\n seed: validationGeometry.seed,\n family: validationGeometry.options.family,\n generationVersion: validationGeometry.generationVersion,\n density: validationGeometry.options.density,\n curvature: validationGeometry.options.curvature,\n stroke: normalizedStroke,\n surface: normalizedSurface,\n responsive,\n });\n};\n\nconst normalizeFamilyControllerOptions = (\n options: GateOptionsV2 | GateOptionsV3,\n fallbackSeed?: GateSeed,\n): Readonly<NormalizedControllerOptionsV2 | NormalizedControllerOptionsV3> => {\n const optionRecord = assertV2OptionShape(options);\n const responsive = ownValue(optionRecord, \"responsive\", true);\n if (typeof responsive !== \"boolean\") {\n throw invalidV2Options(\"responsive\", [\"responsive\"], \"responsive must be a boolean\");\n }\n\n const generationVersion = ownValue(optionRecord, \"generationVersion\", 2);\n if (generationVersion !== 2 && generationVersion !== 3) {\n throw invalidV2Options(\"version\", [\"generationVersion\"], \"generationVersion must be 2 or 3\");\n }\n\n const requestedFamily = ownValue(optionRecord, \"family\", \"auto\");\n if (requestedFamily !== \"auto\" && !isGateFamily(requestedFamily)) {\n throw invalidV2Options(\"family\", [\"family\"], \"family must be auto or a supported family\");\n }\n\n const suppliedSeed = ownValue(optionRecord, \"seed\", undefined);\n const defaultSeed =\n suppliedSeed === undefined && fallbackSeed === undefined ? createRandomSeed() : fallbackSeed;\n const requestedSeed = suppliedSeed === undefined ? defaultSeed : suppliedSeed;\n if (!isGateSeed(requestedSeed)) {\n throw invalidV2Options(\"seed\", [\"seed\"], \"seed must be a non-empty string or finite number\");\n }\n\n const controls = [\n [\"density\", 0.55],\n [\"curvature\", 0.65],\n [\"symmetry\", 1],\n [\"peakHeight\", 0.35],\n [\"sideComplexity\", 0.5],\n ] as const;\n const normalizedControls: Record<(typeof controls)[number][0], number> = {\n density: 0.55,\n curvature: 0.65,\n symmetry: 1,\n peakHeight: 0.35,\n sideComplexity: 0.5,\n };\n for (const [key, fallback] of controls) {\n const value = ownValue(optionRecord, key, fallback);\n if (!isUnitControl(value)) {\n throw invalidV2Options(\"value\", [key], `${key} must be between 0 and 1 inclusive`);\n }\n normalizedControls[key] = value;\n }\n\n const requestedCrest = ownValue(optionRecord, \"crest\", undefined);\n if (\n requestedCrest !== undefined &&\n !([\"spear\", \"fleur\", \"diamond\", \"none\"] as const).includes(requestedCrest as GateCrest)\n ) {\n throw invalidV2Options(\"crest\", [\"crest\"], \"crest must be a supported crest\");\n }\n\n const generationOptions: GateGenerationOptionsV2 | GateGenerationOptionsV3 = {\n generationVersion,\n seed: requestedSeed,\n family: requestedFamily as GateFamily | \"auto\",\n density: normalizedControls.density,\n curvature: normalizedControls.curvature,\n symmetry: normalizedControls.symmetry,\n peakHeight: normalizedControls.peakHeight,\n sideComplexity: normalizedControls.sideComplexity,\n ...(requestedCrest === undefined ? {} : { crest: requestedCrest as GateCrest }),\n };\n\n let validationGeometry: Readonly<GateGeometryV2 | GateGeometryV3>;\n try {\n validationGeometry = generateGate({ width: 160, height: 160 }, generationOptions);\n } catch (cause) {\n if (cause instanceof TypeError || cause instanceof RangeError) {\n throw invalidV2Options(\"crest\", [\"crest\"], cause.message);\n }\n throw cause;\n }\n\n if (\n requestedCrest !== undefined &&\n !isCompatibleCrest(validationGeometry.options.family, requestedCrest)\n ) {\n throw invalidV2Options(\n \"crest\",\n [\"crest\"],\n `crest is incompatible with generation-v2 family ${validationGeometry.options.family}`,\n );\n }\n\n const stroke = ownValue(optionRecord, \"stroke\", \"currentColor\");\n const surface = ownValue(optionRecord, \"surface\", \"transparent\");\n try {\n renderGateSVG(validationGeometry, { stroke: stroke as string, surface: surface as string });\n } catch (cause) {\n if (cause instanceof TypeError || cause instanceof RangeError) {\n const key =\n typeof stroke !== \"string\" || cause.message.startsWith(\"stroke\") ? \"stroke\" : \"surface\";\n throw invalidV2Options(\"paint\", [key], cause.message);\n }\n throw cause;\n }\n\n const normalizedStroke = (stroke as string).trim();\n const normalizedSurface = (surface as string).trim();\n if (!CSS.supports(\"color\", normalizedStroke)) {\n throw invalidV2Options(\"paint\", [\"stroke\"], \"paint must be supported CSS color syntax\");\n }\n if (!CSS.supports(\"color\", normalizedSurface)) {\n throw invalidV2Options(\"paint\", [\"surface\"], \"paint must be supported CSS color syntax\");\n }\n\n return Object.freeze({\n seed: validationGeometry.seed,\n generationVersion,\n family: requestedFamily as GateFamily | \"auto\",\n density: validationGeometry.options.density,\n curvature: validationGeometry.options.curvature,\n symmetry: validationGeometry.options.symmetry,\n peakHeight: validationGeometry.options.peakHeight,\n sideComplexity: validationGeometry.options.sideComplexity,\n crest: requestedCrest as GateCrest | undefined,\n stroke: normalizedStroke,\n surface: normalizedSurface,\n responsive,\n });\n};\n\nconst normalizeControllerOptions = (\n options: GateOptions,\n fallbackSeed?: GateSeed,\n oracleVersion?: GateGenerationVersion,\n): Readonly<NormalizedControllerOptions> => {\n const optionRecord = options as unknown as Record<string, unknown>;\n const version =\n oracleVersion ??\n (options !== null &&\n typeof options === \"object\" &&\n !Array.isArray(options) &&\n Object.hasOwn(optionRecord, \"generationVersion\") &&\n (optionRecord.generationVersion === 2 || optionRecord.generationVersion === 3)\n ? optionRecord.generationVersion\n : 1);\n return version === 2 || version === 3\n ? normalizeFamilyControllerOptions(options as GateOptionsV2 | GateOptionsV3, fallbackSeed)\n : normalizeV1ControllerOptions(options as GateOptionsV1, fallbackSeed);\n};\n\nconst mergeControllerOptions = (\n current: Readonly<NormalizedControllerOptions>,\n updates: GateOptionUpdate,\n): Readonly<{ options: GateOptions; version: GateGenerationVersion }> => {\n const updateRecord = updates as unknown as Record<string, unknown>;\n const suppliedVersion =\n updates !== null &&\n typeof updates === \"object\" &&\n !Array.isArray(updates) &&\n Object.hasOwn(updateRecord, \"generationVersion\")\n ? updateRecord.generationVersion\n : undefined;\n const targetVersion = suppliedVersion === undefined ? current.generationVersion : suppliedVersion;\n const oracleVersion =\n targetVersion === 1\n ? 1\n : current.generationVersion !== 1 || targetVersion === 2 || targetVersion === 3\n ? 2\n : 1;\n\n if (oracleVersion === 2) {\n const checkedUpdates = assertV2OptionShape(updates);\n const responsive = ownValue(checkedUpdates, \"responsive\", undefined);\n if (responsive !== undefined && typeof responsive !== \"boolean\") {\n throw invalidV2Options(\"responsive\", [\"responsive\"], \"responsive must be a boolean\");\n }\n if (targetVersion !== 2 && targetVersion !== 3) {\n throw invalidV2Options(\n \"version\",\n [\"generationVersion\"],\n \"generationVersion must be 1, 2 or 3\",\n );\n }\n } else {\n if (updates === null || typeof updates !== \"object\" || Array.isArray(updates)) {\n throw invalidOptions(updates, \"options must be a plain object\");\n }\n assertV1OptionKeys(updateRecord);\n }\n\n const candidate: Record<string, unknown> =\n targetVersion === current.generationVersion\n ? { ...current }\n : Object.fromEntries(\n [\n \"seed\",\n \"family\",\n \"density\",\n \"curvature\",\n \"stroke\",\n \"surface\",\n \"responsive\",\n ...(current.generationVersion !== 1 && (targetVersion === 2 || targetVersion === 3)\n ? [\"symmetry\", \"peakHeight\", \"sideComplexity\", \"crest\"]\n : []),\n ].map((key) => [key, current[key as keyof NormalizedControllerOptions]]),\n );\n candidate.generationVersion = targetVersion;\n for (const [key, value] of Object.entries(updates)) {\n if (value !== undefined) {\n candidate[key] = value;\n }\n }\n return { options: candidate as GateOptions, version: targetVersion as GateGenerationVersion };\n};\n\nconst measuredBorderBox = (entry: ResizeObserverEntry): ResizeObserverSize | undefined => {\n return entry.borderBoxSize[0];\n};\n\nconst physicalBorderWidth = (\n style: CSSStyleDeclaration,\n side: \"left\" | \"right\" | \"top\" | \"bottom\",\n): number => {\n const value = Number.parseFloat(style.getPropertyValue(`border-${side}-width`));\n return Number.isFinite(value) ? value : 0;\n};\n\nconst physicalPadding = (style: CSSStyleDeclaration): PhysicalInsets => {\n const read = (side: \"top\" | \"right\" | \"bottom\" | \"left\"): number => {\n const value = Number.parseFloat(style.getPropertyValue(`padding-${side}`));\n return Number.isFinite(value) ? value : 0;\n };\n return {\n top: read(\"top\"),\n right: read(\"right\"),\n bottom: read(\"bottom\"),\n left: read(\"left\"),\n };\n};\n\nconst hasRequiredPadding = (measured: PhysicalInsets, required: PhysicalInsets): boolean =>\n measured.top >= required.top &&\n measured.right >= required.right &&\n measured.bottom >= required.bottom &&\n measured.left >= required.left;\n\nconst supportsDimensions = (dimensions: Readonly<{ width: number; height: number }>): boolean => {\n const { width, height } = dimensions;\n const aspectRatio = width / height;\n return (\n Number.isFinite(width) &&\n Number.isFinite(height) &&\n width >= 160 &&\n width <= 1_600 &&\n height >= 96 &&\n height <= 1_200 &&\n aspectRatio >= 0.5 &&\n aspectRatio <= 6\n );\n};\n\nconst parseOverlay = (standaloneSvg: string): SVGSVGElement => {\n const parsed = new DOMParser().parseFromString(standaloneSvg, \"image/svg+xml\");\n const parsedRoot = parsed.documentElement;\n if (parsedRoot.localName !== \"svg\" || parsedRoot.namespaceURI !== \"http://www.w3.org/2000/svg\") {\n throw new Error(\"Gate Frame core returned an invalid SVG document\");\n }\n\n return document.importNode(parsedRoot, true) as unknown as SVGSVGElement;\n};\n\nexport function gateFrame(\n targetValue: HTMLElement | string,\n options: GateOptions = {},\n): GateFrameController {\n let target: HTMLElement;\n if (typeof targetValue === \"string\") {\n let resolvedTarget: Element | null;\n try {\n resolvedTarget = document.querySelector(targetValue);\n } catch (cause) {\n if (cause instanceof DOMException && cause.name === \"SyntaxError\") {\n throw new GateFrameInvalidSelectorError(targetValue);\n }\n throw cause;\n }\n if (resolvedTarget === null) {\n throw new GateFrameTargetNotFoundError(targetValue);\n }\n if (!(resolvedTarget instanceof HTMLElement)) {\n throw new GateFrameTargetNotHTMLElementError({\n source: \"selector\",\n selector: targetValue,\n tagName: resolvedTarget.localName,\n });\n }\n target = resolvedTarget;\n } else {\n const directTarget: unknown = targetValue;\n if (!(directTarget instanceof HTMLElement)) {\n throw new GateFrameTargetNotHTMLElementError(\n directTarget instanceof Element\n ? { source: \"direct\", tagName: directTarget.localName }\n : { source: \"direct\", valueType: directTarget === null ? \"null\" : typeof directTarget },\n );\n }\n target = directTarget;\n }\n\n if (mountedTargets.has(target)) {\n throw new GateFrameAlreadyMountedError(target);\n }\n\n const initialStyle = getComputedStyle(target);\n classifyTarget(target, initialStyle);\n let currentOptions = normalizeControllerOptions(options);\n const computedPosition = initialStyle.position || target.style.position || \"static\";\n const previousPosition = target.style.getPropertyValue(\"position\");\n const previousPositionPriority = target.style.getPropertyPriority(\"position\");\n const ownsPosition = computedPosition === \"static\";\n if (ownsPosition) {\n const absoluteDescendant = Array.from(target.querySelectorAll(\"*\")).find(\n (descendant) => getComputedStyle(descendant).position === \"absolute\",\n );\n if (absoluteDescendant !== undefined) {\n throw new GateFramePositioningConflictError(target, absoluteDescendant);\n }\n target.style.setProperty(\"position\", \"relative\");\n }\n\n let seed = currentOptions.seed;\n let paint: Readonly<Required<GatePaintOptions>> = Object.freeze({\n stroke: currentOptions.stroke,\n surface: currentOptions.surface,\n });\n let currentStatus = PENDING_STATUS;\n let currentSnapshot: Readonly<GateSnapshot> | null = null;\n let standaloneSvg: string | null = null;\n let overlay: SVGSVGElement | null = null;\n let animationFrame: number | null = null;\n let generation = 0;\n let destroyed = false;\n let destroyError: GateFrameDestroyedError | null = null;\n let observing = false;\n let observedBorderBoxDimensions: Readonly<{ width: number; height: number }> | null = null;\n let measuredDimensions: Readonly<{ width: number; height: number }> | null = null;\n const readyWaiters: ReadyWaiter[] = [];\n\n const hasNonzeroLayout = (): boolean => target.offsetWidth > 0 && target.offsetHeight > 0;\n\n const invalidateMeasurement = (): void => {\n if (destroyed) {\n return;\n }\n measuredDimensions = null;\n currentStatus = PENDING_STATUS;\n generation += 1;\n if (animationFrame !== null) {\n cancelAnimationFrame(animationFrame);\n animationFrame = null;\n }\n };\n\n const publishRenderError = (error: GateFrameError): void => {\n generation += 1;\n if (animationFrame !== null) {\n cancelAnimationFrame(animationFrame);\n animationFrame = null;\n }\n overlay?.remove();\n overlay = null;\n currentStatus = Object.freeze({ state: \"error\", error });\n for (const waiter of readyWaiters.splice(0)) {\n waiter.reject(error);\n }\n };\n\n const scheduleRender = (): void => {\n if (destroyed || measuredDimensions === null) {\n return;\n }\n\n currentStatus = PENDING_STATUS;\n const token = ++generation;\n if (animationFrame !== null) {\n cancelAnimationFrame(animationFrame);\n animationFrame = null;\n }\n const frameId = requestAnimationFrame(() => {\n if (animationFrame === frameId) {\n animationFrame = null;\n }\n if (destroyed || token !== generation || measuredDimensions === null) {\n return;\n }\n if (!target.isConnected || !hasNonzeroLayout()) {\n invalidateMeasurement();\n return;\n }\n\n const style = getComputedStyle(target);\n try {\n classifyTarget(target, style);\n } catch (cause) {\n if (cause instanceof GateFrameUnsupportedTargetError) {\n publishRenderError(cause);\n return;\n }\n throw cause;\n }\n\n if (!supportsDimensions(measuredDimensions)) {\n publishRenderError(new GateFrameUnsupportedDimensionsError(measuredDimensions));\n return;\n }\n\n const generationOptions: GateGenerationOptions =\n currentOptions.generationVersion === 1\n ? {\n seed,\n family: \"courtyard\",\n generationVersion: 1,\n density: currentOptions.density,\n curvature: currentOptions.curvature,\n }\n : ({\n seed,\n generationVersion: currentOptions.generationVersion,\n family: currentOptions.family,\n density: currentOptions.density,\n curvature: currentOptions.curvature,\n symmetry: currentOptions.symmetry,\n peakHeight: currentOptions.peakHeight,\n sideComplexity: currentOptions.sideComplexity,\n ...(currentOptions.crest === undefined ? {} : { crest: currentOptions.crest }),\n } as GateGenerationOptionsV2 | GateGenerationOptionsV3);\n const geometry = generateGate(measuredDimensions, generationOptions);\n const measuredPadding = physicalPadding(style);\n if (!hasRequiredPadding(measuredPadding, geometry.contentInsets)) {\n publishRenderError(\n new GateFrameInsufficientSpaceError(measuredPadding, geometry.contentInsets),\n );\n return;\n }\n const nextStandaloneSvg = renderGateSVG(geometry, paint);\n const nextOverlay = parseOverlay(nextStandaloneSvg);\n if (destroyed || token !== generation) {\n return;\n }\n nextOverlay.setAttribute(\"data-gate-frame-overlay\", \"\");\n nextOverlay.setAttribute(\"aria-hidden\", \"true\");\n nextOverlay.setAttribute(\"focusable\", \"false\");\n nextOverlay.style.position = \"absolute\";\n nextOverlay.style.inset = \"0\";\n nextOverlay.style.width = \"100%\";\n nextOverlay.style.height = \"100%\";\n nextOverlay.style.pointerEvents = \"none\";\n\n const nextSnapshot: Readonly<GateSnapshot> =\n geometry.generationVersion === 1\n ? Object.freeze({\n seed: geometry.seed,\n generationVersion: 1,\n geometry,\n paint,\n })\n : geometry.generationVersion === 2\n ? Object.freeze({\n seed: geometry.seed,\n generationVersion: 2,\n geometry,\n paint,\n })\n : Object.freeze({ seed: geometry.seed, generationVersion: 3, geometry, paint });\n\n if (overlay === null) {\n target.append(nextOverlay);\n } else {\n overlay.replaceWith(nextOverlay);\n }\n if (currentOptions.responsive === false && observing) {\n observer.disconnect();\n observing = false;\n }\n overlay = nextOverlay;\n standaloneSvg = nextStandaloneSvg;\n currentSnapshot = nextSnapshot;\n currentStatus = Object.freeze({ state: \"ready\", snapshot: nextSnapshot });\n for (const waiter of readyWaiters.splice(0)) {\n waiter.resolve(nextSnapshot);\n }\n });\n animationFrame = frameId;\n };\n\n const observer = new ResizeObserver((entries) => {\n const entry = entries.find((candidate) => candidate.target === target);\n const borderBox = entry === undefined ? undefined : measuredBorderBox(entry);\n if (borderBox === undefined || !target.isConnected || !hasNonzeroLayout()) {\n invalidateMeasurement();\n return;\n }\n\n const style = getComputedStyle(target);\n observedBorderBoxDimensions = {\n width: borderBox.inlineSize,\n height: borderBox.blockSize,\n };\n const width =\n observedBorderBoxDimensions.width -\n physicalBorderWidth(style, \"left\") -\n physicalBorderWidth(style, \"right\");\n const height =\n observedBorderBoxDimensions.height -\n physicalBorderWidth(style, \"top\") -\n physicalBorderWidth(style, \"bottom\");\n if (width <= 0 || height <= 0) {\n invalidateMeasurement();\n return;\n }\n const measurementChanged =\n measuredDimensions?.width !== width || measuredDimensions.height !== height;\n measuredDimensions = { width, height };\n try {\n classifyTarget(target, style);\n } catch (cause) {\n if (cause instanceof GateFrameUnsupportedTargetError) {\n publishRenderError(cause);\n return;\n }\n throw cause;\n }\n if (!measurementChanged) {\n return;\n }\n scheduleRender();\n });\n\n const controller: GateFrameController = {\n status: () => currentStatus,\n whenReady: () => {\n if (destroyed) {\n return Promise.reject(destroyError ?? new GateFrameDestroyedError());\n }\n if (currentStatus.state === \"ready\") {\n return Promise.resolve(currentStatus.snapshot);\n }\n if (currentStatus.state === \"error\") {\n return Promise.reject(currentStatus.error);\n }\n return new Promise((resolve, reject) => readyWaiters.push({ resolve, reject }));\n },\n update: (nextOptions) => {\n if (destroyed) {\n throw destroyError ?? new GateFrameDestroyedError();\n }\n\n const merged = mergeControllerOptions(currentOptions, nextOptions);\n const candidateOptions = normalizeControllerOptions(\n merged.options,\n currentOptions.seed,\n merged.version,\n );\n if (observedBorderBoxDimensions !== null) {\n const style = getComputedStyle(target);\n const width =\n observedBorderBoxDimensions.width -\n physicalBorderWidth(style, \"left\") -\n physicalBorderWidth(style, \"right\");\n const height =\n observedBorderBoxDimensions.height -\n physicalBorderWidth(style, \"top\") -\n physicalBorderWidth(style, \"bottom\");\n if (width <= 0 || height <= 0) {\n invalidateMeasurement();\n } else {\n measuredDimensions = { width, height };\n }\n }\n const wasResponsive = currentOptions.responsive !== false;\n currentOptions = candidateOptions;\n seed = candidateOptions.seed;\n paint = Object.freeze({\n stroke: currentOptions.stroke,\n surface: currentOptions.surface,\n });\n if (wasResponsive === false && currentOptions.responsive !== false && !observing) {\n observer.observe(target, { box: \"border-box\" });\n observing = true;\n }\n scheduleRender();\n return controller;\n },\n randomize: (explicitSeed) => {\n if (destroyed) {\n throw destroyError ?? new GateFrameDestroyedError();\n }\n\n const requestedSeed = explicitSeed === undefined ? createRandomSeed() : explicitSeed;\n const merged = mergeControllerOptions(currentOptions, { seed: requestedSeed });\n const candidateOptions = normalizeControllerOptions(\n merged.options,\n currentOptions.seed,\n merged.version,\n );\n currentOptions = candidateOptions;\n seed = candidateOptions.seed;\n scheduleRender();\n return seed;\n },\n snapshot: () => {\n if (destroyed) {\n throw destroyError ?? new GateFrameDestroyedError();\n }\n return currentSnapshot;\n },\n toSVG: () => {\n if (destroyed) {\n throw destroyError ?? new GateFrameDestroyedError();\n }\n if (standaloneSvg === null) {\n throw new GateFrameNotReadyError();\n }\n return standaloneSvg;\n },\n destroy: () => {\n if (destroyed) {\n return;\n }\n\n destroyed = true;\n destroyError = new GateFrameDestroyedError();\n generation += 1;\n if (animationFrame !== null) {\n cancelAnimationFrame(animationFrame);\n animationFrame = null;\n }\n observer.disconnect();\n observing = false;\n overlay?.remove();\n overlay = null;\n for (const waiter of readyWaiters.splice(0)) {\n waiter.reject(destroyError);\n }\n if (\n ownsPosition &&\n target.style.getPropertyValue(\"position\") === \"relative\" &&\n target.style.getPropertyPriority(\"position\") === \"\"\n ) {\n if (previousPosition === \"\") {\n target.style.removeProperty(\"position\");\n } else {\n target.style.setProperty(\"position\", previousPosition, previousPositionPriority);\n }\n }\n mountedTargets.delete(target);\n currentSnapshot = null;\n standaloneSvg = null;\n currentStatus = DESTROYED_STATUS;\n },\n };\n\n mountedTargets.set(target, controller);\n observer.observe(target, { box: \"border-box\" });\n observing = true;\n return controller;\n}\n"],"mappings":";;;AA0GA,MAAM,iBACJ,YACsB;CACtB,KAAK,MAAM,SAAS,OAAO,OAAO,OAAO,GACvC,IAAI,UAAU,QAAQ,OAAO,UAAU,YAAY,CAAC,OAAO,SAAS,KAAK,GACvE,cAAc,KAAgC;CAGlD,OAAO,OAAO,OAAO,OAAO;AAC9B;AAEA,IAAa,iBAAb,cAAoC,MAAM;CAIxC,YACE,MACA,SACA,UAAmC,CAAC,GACpC,OAAO,kBACP;EACA,MAAM,OA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MAAM,UAAU,aAAa,OAAO,CAAC,GACxC,OAAO,OAAO,YAAY;GAE5B,IACE,gBACA,OAAO,MAAM,iBAAiB,UAAU,MAAM,cAC9C,OAAO,MAAM,oBAAoB,UAAU,MAAM,IACjD;IACA,IAAI,qBAAqB,IACvB,OAAO,MAAM,eAAe,UAAU;SAEtC,OAAO,MAAM,YAAY,YAAY,kBAAkB,wBAAwB;GAEnF;GACA,eAAe,OAAO,MAAM;GAC5B,kBAAkB;GAClB,gBAAgB;GAChB,gBAAgB;EAClB;CACF;CAEA,eAAe,IAAI,QAAQ,UAAU;CACrC,SAAS,QAAQ,QAAQ,EAAE,KAAK,aAAa,CAAC;CAC9C,YAAY;CACZ,OAAO;AACT"}
package/package.json ADDED
@@ -0,0 +1,79 @@
1
+ {
2
+ "name": "card-gate-frame",
3
+ "version": "1.0.0",
4
+ "description": "Deterministic ornamental SVG frames for prepared HTML containers and DOM-free generation.",
5
+ "keywords": [
6
+ "svg",
7
+ "frame",
8
+ "ornament",
9
+ "deterministic",
10
+ "typescript"
11
+ ],
12
+ "type": "module",
13
+ "license": "MIT",
14
+ "sideEffects": false,
15
+ "devEngines": {
16
+ "runtime": {
17
+ "name": "node",
18
+ "version": "26.8.1",
19
+ "onFail": "error"
20
+ }
21
+ },
22
+ "exports": {
23
+ ".": {
24
+ "types": "./dist/index.d.ts",
25
+ "import": "./dist/index.js"
26
+ },
27
+ "./core": {
28
+ "types": "./dist/core/index.d.ts",
29
+ "import": "./dist/core/index.js"
30
+ }
31
+ },
32
+ "files": [
33
+ "dist",
34
+ "README.md",
35
+ "LICENSE"
36
+ ],
37
+ "devDependencies": {
38
+ "@arethetypeswrong/cli": "0.18.5",
39
+ "@biomejs/biome": "2.5.12",
40
+ "@playwright/test": "1.63.0",
41
+ "@types/node": "26.4.1",
42
+ "fast-check": "4.9.0",
43
+ "publint": "0.3.24",
44
+ "tsdown": "0.23.0",
45
+ "typescript": "7.0.2",
46
+ "vite": "8.2.2",
47
+ "vitest": "5.0.0"
48
+ },
49
+ "repository": {
50
+ "type": "git",
51
+ "url": "git+https://github.com/fmarlats/card-gate-frame.git"
52
+ },
53
+ "homepage": "https://github.com/fmarlats/card-gate-frame",
54
+ "bugs": {
55
+ "url": "https://github.com/fmarlats/card-gate-frame/issues"
56
+ },
57
+ "publishConfig": {
58
+ "access": "public",
59
+ "registry": "https://registry.npmjs.org/"
60
+ },
61
+ "scripts": {
62
+ "dev": "pnpm build && vite examples/vanilla",
63
+ "demo:readme": "pnpm build && node scripts/generate-readme-demo.mjs",
64
+ "build": "tsdown",
65
+ "example:build": "pnpm build && vite build examples/vanilla",
66
+ "check:format": "biome format .",
67
+ "check:lint": "biome lint src tests scripts examples package.json playwright.config.ts tsdown.config.ts vitest.config.ts tsconfig*.json",
68
+ "check:types": "tsc -p tsconfig.core.json --noEmit && tsc -p tsconfig.dom.json --noEmit && tsc -p tsconfig.test.json --noEmit",
69
+ "check": "pnpm check:format && pnpm check:lint && pnpm check:types",
70
+ "format": "biome check --write .",
71
+ "test": "vitest run",
72
+ "test:release-properties": "GATE_FRAME_PROPERTY_RUNS=10000 vitest run tests/properties --testTimeout=60000",
73
+ "test:browser": "playwright test",
74
+ "test:package": "node scripts/verify-package.mjs",
75
+ "test:all": "pnpm verify && pnpm test:release-properties",
76
+ "test:watch": "vitest",
77
+ "verify": "pnpm check && pnpm test && pnpm build && pnpm test:browser && pnpm test:package"
78
+ }
79
+ }