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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 card-gate-frame contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,152 @@
1
+ # Card Gate Frame
2
+
3
+ [![Six ornamental SVG frame examples in ivory, forest green, copper, sage, midnight blue, and burgundy.](docs/assets/readme-demo.svg)](docs/assets/readme-demo.svg)
4
+
5
+ Deterministic ornamental SVG frames for prepared HTML containers, with a DOM-free geometry generator, TypeScript declarations, and zero runtime dependencies.
6
+
7
+ Package version 1.0.0 includes three generation algorithms. Use explicit `generationVersion: 3` for French ironwork across the `courtyard`, `fleuron`, `arcade`, `vine`, `fan`, and `volute` families. Generation 2 offers alternate compositions; omitting `generationVersion` selects the original courtyard algorithm (generation 1). Equal version, seed, dimensions, options, and paint reproduce equal output.
8
+
9
+ ## Installation
10
+
11
+ Install with:
12
+
13
+ ```sh
14
+ pnpm add card-gate-frame
15
+ ```
16
+
17
+ ## Browser quick start
18
+
19
+ Gate Frame uses the target's existing padding as the content-safe region; it does not add padding or change the target's outer dimensions.
20
+
21
+ ```html
22
+ <article id="card" class="card">
23
+ <h2>Courtyard notes</h2>
24
+ <button type="button">Open</button>
25
+ </article>
26
+ ```
27
+
28
+ ```css
29
+ .card {
30
+ box-sizing: border-box;
31
+ position: relative;
32
+ max-width: 960px;
33
+ min-height: 25rem;
34
+ padding: 8.5rem 2.375rem 2.375rem;
35
+ }
36
+ ```
37
+
38
+ ```ts
39
+ import { gateFrame } from "card-gate-frame";
40
+
41
+ const controller = gateFrame("#card", {
42
+ seed: "lyon-42",
43
+ family: "courtyard",
44
+ density: 0.58,
45
+ curvature: 0.72,
46
+ stroke: "#20221e",
47
+ surface: "rgba(143, 119, 79, 0.12)",
48
+ });
49
+
50
+ await controller.whenReady();
51
+ ```
52
+
53
+ Select generation 3 for French ironwork and its additional controls:
54
+
55
+ ```ts
56
+ controller.destroy();
57
+
58
+ const workshop = gateFrame("#card", {
59
+ generationVersion: 3,
60
+ seed: "lyon-42",
61
+ family: "fan",
62
+ crest: "diamond",
63
+ density: 0.58,
64
+ curvature: 0.72,
65
+ symmetry: 0.86,
66
+ peakHeight: 0.48,
67
+ sideComplexity: 0.64,
68
+ });
69
+
70
+ await workshop.whenReady();
71
+ ```
72
+
73
+ The exact minimum padding is reported by generated `contentInsets` and varies with the measured size and options. The DOM adapter compares those physical insets with computed padding and reports `GateFrameInsufficientSpaceError` instead of obscuring content. When padding changes without a box resize, call `controller.update({})` to re-check it.
74
+
75
+ Generated frames support widths of 160–1600 CSS pixels, heights of 96–1200 CSS
76
+ pixels, and a `width / height` ratio of 0.5–6, all inclusive. For the DOM adapter,
77
+ these are the target's padding-box dimensions, excluding its borders. Keep the
78
+ target within those bounds; an out-of-range size reports `UNSUPPORTED_DIMENSIONS`.
79
+
80
+ ## DOM-free core
81
+
82
+ ```ts
83
+ import { generateGate, renderGateSVG } from "card-gate-frame/core";
84
+
85
+ const geometry = generateGate(
86
+ { width: 640, height: 360 },
87
+ { seed: "lyon-42", family: "courtyard", generationVersion: 1 },
88
+ );
89
+
90
+ const svg = renderGateSVG(geometry, {
91
+ stroke: "#20221e",
92
+ surface: "#d6c4a1",
93
+ });
94
+ ```
95
+
96
+ `card-gate-frame/core` has no DOM globals or DOM declaration requirement.
97
+
98
+ ## Targets and cleanup
99
+
100
+ The current adapter supports exactly `div`, `article`, `section`, and `aside` elements when they are measurable horizontal-writing-mode containers, including block, inline-block, flex, and grid containers. Other element types, replaced elements, restricted form controls, table internals, inline or `display: contents` targets, fragmented or vertical-writing targets, and shadow hosts are rejected. Pass an element directly for a supported target inside an open shadow root.
101
+
102
+ The imperative overlay is appended as the target's last child. Avoid framework-owned targets or CSS that depends on direct-child structural selectors such as `:empty` or `:last-child`. The overlay is hidden from accessibility APIs and ignores pointer input, but application content still owns its focus styles.
103
+
104
+ ```ts
105
+ controller.update({ density: 0.7 });
106
+ await controller.whenReady();
107
+ const svg = controller.toSVG();
108
+ controller.destroy(); // Idempotent; removes owned DOM, observers, and style changes.
109
+ ```
110
+
111
+ The controller API is deliberately small:
112
+
113
+ | Method | Result |
114
+ | --- | --- |
115
+ | `status()` | Current pending, ready, error, or destroyed state. |
116
+ | `whenReady()` | Resolves to the next committed snapshot or rejects with its typed error. |
117
+ | `update(options)` | Atomically replaces the provided options and schedules a render. |
118
+ | `randomize(seed?)` | Chooses or applies a seed and returns it. |
119
+ | `snapshot()` | Returns the last committed immutable snapshot, or `null`. |
120
+ | `toSVG()` | Serializes the committed frame; throws before readiness or after destroy. |
121
+ | `destroy()` | Idempotently releases every resource owned by the controller. |
122
+
123
+ Failures extend `GateFrameError` and expose stable codes: `INVALID_SELECTOR`,
124
+ `TARGET_NOT_FOUND`, `TARGET_NOT_HTML_ELEMENT`, `UNSUPPORTED_TARGET`,
125
+ `POSITIONING_CONFLICT`, `ALREADY_MOUNTED`, `INVALID_OPTIONS`,
126
+ `UNSUPPORTED_DIMENSIONS`, `INSUFFICIENT_CONTENT_SPACE`, `NOT_READY`, and
127
+ `DESTROYED`.
128
+
129
+ ## Compatibility constraints
130
+
131
+ Both entry points are safe to import during server rendering, but `gateFrame()`
132
+ requires a browser DOM when called. Use `card-gate-frame/core` for generation on a
133
+ server or worker.
134
+
135
+ The DOM adapter has no network or external stylesheet requirement. It does set
136
+ inline positioning styles on its owned SVG and, when needed, the target; a CSP
137
+ that forbids all style attributes is therefore incompatible with this adapter.
138
+
139
+ Framework users should mount through a host-element ref after the framework has
140
+ created the element, and call `destroy()` before that host is unmounted. Gate
141
+ Frame does not provide framework adapters in this release and appends its SVG as
142
+ the host's last child, so framework code must tolerate that owned child.
143
+
144
+ The package is ESM-only and targets ES2022. Release tests use Playwright 1.63.0 with Chromium 153.0.8010.12, Firefox 155.0, and WebKit 26.6. Other branded browsers and previous versions are outside the verified matrix.
145
+
146
+ ## Example
147
+
148
+ The repository includes an interactive six-family example. Run `pnpm install --frozen-lockfile` and `pnpm dev` from a source checkout.
149
+
150
+ The showcase above uses real generation 3 output. Download the [SVG](docs/assets/readme-demo.svg), [PNG](docs/assets/readme-demo.png), or [individual example cards and raw frames](docs/assets/examples). The card copy, typography, and backgrounds illustrate possible uses; the library generates the ornamental frames. Run `pnpm demo:readme` to regenerate all assets, or `pnpm demo:readme --svg-only` for SVGs without launching a browser.
151
+
152
+ MIT licensed; see LICENSE.
@@ -0,0 +1,2 @@
1
+ import { C as NormalizedGateGenerationOptionsV2, S as NormalizedGateGenerationOptionsV1, _ as GatePaintOptions, a as GateFamily, b as GateSeed, c as GateGenerationOptionsV2, d as GateGeometry, f as GateGeometryBase, g as GateInsets, h as GateGeometryV3, i as GateDimensions, l as GateGenerationOptionsV3, m as GateGeometryV2, n as generateGate, o as GateGenerationOptions, p as GateGeometryV1, r as GateCrest, s as GateGenerationOptionsV1, t as renderGateSVG, u as GateGenerationVersion, v as GatePath, w as NormalizedGateGenerationOptionsV3, x as NormalizedGateGenerationOptions, y as GatePathCommand } from "../index-B0WElJq8.js";
2
+ export { type GateCrest, type GateDimensions, type GateFamily, type GateGenerationOptions, type GateGenerationOptionsV1, type GateGenerationOptionsV2, type GateGenerationOptionsV3, type GateGenerationVersion, type GateGeometry, type GateGeometryBase, type GateGeometryV1, type GateGeometryV2, type GateGeometryV3, type GateInsets, type GatePaintOptions, type GatePath, type GatePathCommand, type GateSeed, type NormalizedGateGenerationOptions, type NormalizedGateGenerationOptionsV1, type NormalizedGateGenerationOptionsV2, type NormalizedGateGenerationOptionsV3, generateGate, renderGateSVG };
@@ -0,0 +1,3 @@
1
+ import { n as generateGate, t as renderGateSVG } from "../core-DzM1ds_q.js";
2
+
3
+ export { generateGate, renderGateSVG };