# @snowcone-app/canvas — agent index (ships inside the npm tarball)

Zero-network onboarding: everything listed here is included in this package.
Read these before fetching anything.

- example/ — THE canonical integration (a no-canvas personalization widget:
  Editor.Root + Editor.Preview + Editor.TextField + Editor.Buy; the design
  editor chunk never loads). Copy example/src/Widget.tsx into your app;
  example/README.md has the copy protocol, the data-sc-* selector vocabulary,
  variant selection + quantity via useProductSelection(), and the
  failure-mode fixtures.
- STYLING_CONTRACT.md — GENERATED restyling contract: every data-sc-part
  value, the DOM each part renders, and every .sc-root theming token.
  Restyle the parts without reading package source.
- ERROR_CONTRACT.md — GENERATED error-code catalog: every EditorError code
  (when it fires, message template, error.data keys) plus the EmbedIssue
  advisory codes on the onIssue channel. Assert on codes, never prose.
- README.md — package overview: the canonical example first, then the
  standalone design editor (SnowconeCanvas).

Entry points:

- @snowcone-app/canvas/embed — the Editor.* parts and SnowconeEditor (the
  turnkey default composed from those same parts), the design() builder and
  typed layer tokens, useProductSelection(), the turnkey
  RealtimeEmbed/RealtimeCanvas/RealtimeMockup trio, and the chrome-building
  hooks (useEditor, useLayers, useCommands, ...).
- @snowcone-app/canvas — SnowconeCanvas, the standalone design editor.
- @snowcone-app/canvas/testing — assertRenders (two-render binding-liveness
  check), expectNoEditorErrors (REQUIRED in every integration test), and the
  deterministic failure fixtures (test403Design, testIncompleteDesign,
  failingGrant).
- @snowcone-app/canvas/style.css — the required stylesheet. Fully namespaced
  (.sc-root scope); it cannot collide with host CSS.

Contracts to rely on:

- All Editor.* throws are structured: EditorError with a stable `code` +
  `error.data` (valid names, offending values, docSlug). Assert on codes,
  never message prose.
- Buy incompleteness is state, not an error: [data-sc-buy-state="incomplete"]
  with machine-readable reason codes in [data-sc-buy-missing].
- The public embed surface is additive-only (CI-pinned).

Hosted docs (one fetch, the source of truth):
https://developers.snowcone.app/llms-full.txt
The primitives guide (grant-route framework variants, catalog ids, CMS/typed
layer notes): https://developers.snowcone.app/primitives
