@marktiderman/genesis-features 0.9.0 → 0.10.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.
Files changed (43) hide show
  1. package/README.md +14 -279
  2. package/dist/blocks.d.ts +4 -470
  3. package/dist/blocks.js +7 -5
  4. package/dist/gate-react.d.ts +4 -45
  5. package/dist/gate-react.js +7 -36
  6. package/dist/gate.d.ts +4 -15
  7. package/dist/gate.js +7 -5
  8. package/dist/index.d.ts +4 -124
  9. package/dist/index.js +7 -8
  10. package/dist/node.d.ts +4 -156
  11. package/dist/node.js +7 -486
  12. package/dist/react.d.ts +4 -57
  13. package/dist/react.js +7 -235
  14. package/dist/settings-protocol.d.ts +7 -0
  15. package/dist/settings-protocol.js +7 -0
  16. package/dist/settings-react.d.ts +7 -0
  17. package/dist/settings-react.js +8 -0
  18. package/dist/settings.d.ts +7 -0
  19. package/dist/settings.js +7 -0
  20. package/package.json +35 -51
  21. package/dist/blocks.js.map +0 -1
  22. package/dist/chunk-B6WRD3WF.js +0 -6
  23. package/dist/chunk-B6WRD3WF.js.map +0 -1
  24. package/dist/chunk-OW46SL2G.js +0 -10
  25. package/dist/chunk-OW46SL2G.js.map +0 -1
  26. package/dist/chunk-SEFG2QV6.js +0 -413
  27. package/dist/chunk-SEFG2QV6.js.map +0 -1
  28. package/dist/chunk-VYUX7VAX.js +0 -52
  29. package/dist/chunk-VYUX7VAX.js.map +0 -1
  30. package/dist/chunk-YTPGUU5F.js +0 -121
  31. package/dist/chunk-YTPGUU5F.js.map +0 -1
  32. package/dist/chunk-Z3TTDIVM.js +0 -494
  33. package/dist/chunk-Z3TTDIVM.js.map +0 -1
  34. package/dist/gate-oYFzQKyb.d.ts +0 -199
  35. package/dist/gate-react.js.map +0 -1
  36. package/dist/gate.js.map +0 -1
  37. package/dist/index.js.map +0 -1
  38. package/dist/model-sTRmrxz3.d.ts +0 -437
  39. package/dist/node.js.map +0 -1
  40. package/dist/packages-CWhdXtzS.d.ts +0 -203
  41. package/dist/platforms-NR0liM8L.d.ts +0 -10
  42. package/dist/react.js.map +0 -1
  43. package/dist/types-Bd766VxF.d.ts +0 -39
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/blocks.ts","../src/content-packs-legacy.ts","../src/content-packs.ts","../src/overlay.ts","../src/packages.ts"],"names":["keyProblems","isObject","isText"],"mappings":";;;;AAwKO,IAAM,UAAA,GAAN,cAAyB,KAAA,CAAM;AAAA,EACpC,YAAqB,QAAA,EAAoB;AACvC,IAAA,KAAA,CAAM,CAAA;AAAA,EAAoB,QAAA,CAAS,GAAA,CAAI,CAAC,CAAA,KAAM,CAAA,IAAA,EAAO,CAAC,CAAA,CAAE,CAAA,CAAE,IAAA,CAAK,IAAI,CAAC,CAAA,CAAE,CAAA;AADnD,IAAA,IAAA,CAAA,QAAA,GAAA,QAAA;AAEnB,IAAA,IAAA,CAAK,IAAA,GAAO,YAAA;AAAA,EACd;AAAA,EAHqB,QAAA;AAIvB;AAGA,IAAM,EAAA,GAAK,qCAAA;AAEX,IAAM,iBAAA,GAAoB,CAAC,KAAA,EAAO,UAAA,EAAY,UAAU,OAAA,EAAS,YAAA,EAAc,QAAA,EAAU,SAAA,EAAW,gBAAgB,CAAA;AAEpH,SAAS,WAAW,MAAA,EAAqC;AACvD,EAAA,MAAM,IAAA,uBAAW,GAAA,EAAY;AAC7B,EAAA,MAAM,GAAA,uBAAU,GAAA,EAAY;AAC5B,EAAA,KAAA,MAAW,CAAA,IAAK,MAAA,EAAQ,CAAC,IAAA,CAAK,GAAA,CAAI,CAAC,CAAA,GAAI,GAAA,GAAM,IAAA,EAAM,GAAA,CAAI,CAAC,CAAA;AACxD,EAAA,OAAO,CAAC,GAAG,GAAG,CAAA;AAChB;AAEA,SAAS,cAAc,KAAA,EAA4C;AACjE,EAAA,MAAM,EAAE,IAAG,GAAI,KAAA;AACf,EAAA,MAAM,WAAqB,EAAC;AAC5B,EAAA,IAAI,OAAO,EAAA,KAAO,QAA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CAAK,QAAQ,eAAA,IAAmB,EAAC,EAAG,QAAA,CAAS,MAAM,CAAA;AAAA,IACtF,KAAK,SAAA;AACH,MAAA,OAAO,IAAA;AAAA;AAEb;AAEA,SAAS,KAAK,IAAA,EAA2B;AACvC,EAAA,QAAQ,KAAK,KAAA;AAAO,IAClB,KAAK,YAAA;AACH,MAAA,OAAO,0DAAA;AAAA,IACT,KAAK,WAAA;AACH,MAAA,OAAO,uFAAA;AAAA,IACT,KAAK,QAAA;AACH,MAAA,OAAO,sFAAA;AAAA,IACT;AACE,MAAA,OAAO,EAAA;AAAA;AAEb","file":"chunk-Z3TTDIVM.js","sourcesContent":["/**\n * Blocks: a feature an app adds whole (account, push, observability, support,\n * updates), declared once with what it needs and what it contributes. The app\n * shell, the navigation tree and Settings consume contributions by FeatureId;\n * the app still owns where they go.\n *\n * Platform-neutral and free of zod, so it ships to phones:\n * `@marktiderman/genesis-features/blocks` (also re-exported from the root).\n */\nimport { cycleProblems, dependencyOrder, requirementProblem } from \"./graph\";\nimport { FEATURE_PLATFORMS, type FeaturePlatform } from \"./platforms\";\nimport type { ContentPackSectionValidator } from \"./content-packs\";\n\n/**\n * A navigation entry a block offers. The app's nav tree places it (by the\n * block's FeatureId and this id); a block never decides where it goes.\n * `id`, `label` and `path` match genesis-core's `NavigationNode`.\n *\n * @stability Beta\n */\nexport interface BlockNavItem {\n /** Unique across every enabled block. */\n id: string;\n label: string;\n path: string;\n /** An icon name the app's icon set knows. */\n icon?: string;\n /** Lower first. Default 0. */\n order?: number;\n /**\n * The navigation zone the entry lands in (ADR 0003): an id from the app's\n * zones (`NavigationZone`, genesis-core/navigation), copied to the tree node\n * the app builds from it, so a module's pages sit in their zone with no app\n * wiring. Unset: a global page.\n *\n * @stability Beta\n */\n zone?: string;\n}\n\n/**\n * A Settings row a block offers, placed in the section with id `section`\n * (`\"account\"`, `\"about\"`, or one of the app's own; an unknown id becomes a\n * new section at the end).\n *\n * @stability Beta\n */\nexport interface BlockSettingsRow {\n /** Unique across every enabled block. */\n id: string;\n section: string;\n title: string;\n subtitle?: string;\n /**\n * A hook giving a subtitle that changes (a version, a count). It is called\n * on every render of the Settings screen, in block order, so the set of\n * blocks must not change while the app runs (shells read them once).\n */\n useSubtitle?: () => string | null | undefined;\n /** Where tapping the row goes, as a path. */\n href?: string;\n /** Lower first within its section. Default 0. */\n order?: number;\n testID?: string;\n}\n\n/**\n * A screen a block's feature needs the app to route to. On file-based\n * routers the app owns the route file; this is the declaration a check (or\n * a deep-link allowlist) reads.\n *\n * @stability Beta\n */\nexport interface BlockRoute {\n path: string;\n /** What the screen is for, in a few words. */\n description?: string;\n /** `true` when only a signed-in person can open it. */\n signedIn?: boolean;\n}\n\n/**\n * A SQL migration a block needs, shipped in a package: copy it into the\n * app's `supabase/migrations/` under a timestamped name.\n *\n * @stability Beta\n */\nexport interface BlockMigration {\n /** The npm package that ships it, e.g. `@marktiderman/genesis-supabase`. */\n package: string;\n /** Its path in the package, e.g. `migrations/0002_genesis_app_release_policy.sql`. */\n file: string;\n /** Its pgTAP test in the package, if any. */\n test?: string;\n}\n\n/**\n * One kind of data a block collects, for the App Store privacy label and the\n * Play data safety form.\n *\n * @stability Beta\n */\nexport interface BlockDataUse {\n /** What, in the stores' words: `\"email address\"`, `\"user id\"`, `\"crash data\"`. */\n type: string;\n /** Why: `\"app functionality\"`, `\"analytics\"`, … */\n purposes: readonly string[];\n /** Tied to the person's identity. */\n linked: boolean;\n /** Used to track the person across other companies' apps. */\n tracking: boolean;\n}\n\n/** What a block means for privacy. @stability Beta */\nexport interface BlockPrivacy {\n collects?: readonly BlockDataUse[];\n /** Anything a reviewer or a privacy policy should say, one sentence each. */\n notes?: readonly string[];\n}\n\n/**\n * What a block adds to an app. Every key is optional. `S` is what a slot is\n * filled with on the consuming platform (a React component on native and web).\n *\n * @stability Beta\n */\nexport interface BlockContributions<S = unknown> {\n nav?: readonly BlockNavItem[];\n settings?: readonly BlockSettingsRow[];\n routes?: readonly BlockRoute[];\n /**\n * Fills for the host shell's slots, by slot name (e.g. `fatal` on\n * `GenesisNativeApp`). The app's own `slots` always win over a block's.\n */\n slots?: Readonly<Record<string, S>>;\n migrations?: readonly BlockMigration[];\n /** Agent skills that come with it: repo or package paths to a `SKILL.md`. */\n skills?: readonly string[];\n privacy?: BlockPrivacy;\n /**\n * Checks this block's section of a content pack (`sections[<block id>]`):\n * returns every problem with its items. `defineContentPack` and\n * `contentPackProblems` run it when given the block.\n */\n contentSection?: ContentPackSectionValidator;\n}\n\n/**\n * One block. `id` is the block's FeatureId: the same id as its entry in the\n * feature registry.\n *\n * @stability Beta\n */\nexport interface BlockDef<Id extends string = string, S = unknown> {\n readonly id: Id;\n /**\n * What must be on with it: other blocks' ids, or features the app owns that\n * aren't blocks. A requirement that is a block must be enabled (and on this\n * platform); one that isn't a block must be listed in `enabled`. A\n * requirement that is neither is an error, so a forgotten block is loud.\n */\n readonly requires?: readonly string[];\n readonly contributes?: BlockContributions<S>;\n /** Where it runs. Default every platform. */\n readonly platforms?: readonly FeaturePlatform[];\n}\n\n/** Thrown by {@link defineBlock} and {@link resolveBlocks}; lists every problem at once. @stability Beta */\nexport class BlockError extends Error {\n constructor(readonly problems: string[]) {\n super(`Invalid blocks:\\n${problems.map((p) => ` - ${p}`).join(\"\\n\")}`);\n this.name = \"BlockError\";\n }\n}\n\n// The feature registry's id rule (model.ts), repeated so this file stays free of zod.\nconst ID = /^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/;\n\nconst CONTRIBUTION_KEYS = [\"nav\", \"settings\", \"routes\", \"slots\", \"migrations\", \"skills\", \"privacy\", \"contentSection\"] as const;\n\nfunction duplicates(values: readonly string[]): string[] {\n const seen = new Set<string>();\n const dup = new Set<string>();\n for (const v of values) (seen.has(v) ? dup : seen).add(v);\n return [...dup];\n}\n\nfunction blockProblems(block: BlockDef<string, unknown>): string[] {\n const { id } = block;\n const problems: string[] = [];\n if (typeof id !== \"string\" || !ID.test(id)) problems.push(`${String(id)}: a block id is a feature id: lowercase letters and digits, joined by -, _ or .`);\n for (const req of block.requires ?? []) {\n if (req === id) problems.push(`${id}.requires: a block can't require itself`);\n else if (!ID.test(req)) problems.push(`${id}.requires: \"${req}\" is not a feature id`);\n }\n for (const p of block.platforms ?? []) {\n if (!(FEATURE_PLATFORMS as readonly string[]).includes(p)) problems.push(`${id}.platforms: \"${p}\" is not one of ${FEATURE_PLATFORMS.join(\", \")}`);\n }\n if (block.platforms && block.platforms.length === 0) problems.push(`${id}.platforms: an empty list runs nowhere; leave it out for every platform`);\n const c = block.contributes ?? {};\n for (const key of Object.keys(c)) {\n if (!(CONTRIBUTION_KEYS as readonly string[]).includes(key)) problems.push(`${id}.contributes.${key}: not a contribution (${CONTRIBUTION_KEYS.join(\", \")})`);\n }\n for (const d of duplicates((c.nav ?? []).map((n) => n.id))) problems.push(`${id}.contributes.nav: \"${d}\" appears twice`);\n for (const d of duplicates((c.settings ?? []).map((r) => r.id))) problems.push(`${id}.contributes.settings: \"${d}\" appears twice`);\n for (const d of duplicates((c.routes ?? []).map((r) => r.path))) problems.push(`${id}.contributes.routes: \"${d}\" appears twice`);\n for (const n of c.nav ?? []) if (!n.id || !n.label || !n.path) problems.push(`${id}.contributes.nav: every entry needs an id, a label and a path`);\n for (const n of c.nav ?? []) if (n.zone !== undefined && (typeof n.zone !== \"string\" || !n.zone.trim())) problems.push(`${id}.contributes.nav: \"${n.id}\" zone must be a non-empty string`);\n for (const r of c.settings ?? []) if (!r.id || !r.section || !r.title) problems.push(`${id}.contributes.settings: every row needs an id, a section and a title`);\n for (const m of c.migrations ?? []) if (!m.package || !m.file) problems.push(`${id}.contributes.migrations: every migration needs a package and a file`);\n return problems;\n}\n\n/**\n * Declare a block. Validates it (id, requirements, platforms, contribution\n * keys and duplicate ids within the block) and returns it frozen, so a\n * typo fails where the block is written rather than where it is used:\n *\n * ```ts\n * export const supportBlock = defineBlock({\n * id: \"support\",\n * requires: [\"account\"],\n * platforms: [\"web\", \"native\"],\n * contributes: {\n * settings: [{ id: \"contact-support\", section: \"about\", title: \"Contact support\", href: \"/support\" }],\n * routes: [{ path: \"/support\", signedIn: true }],\n * migrations: [{ package: \"@acme/support\", file: \"migrations/0001_support.sql\" }],\n * },\n * });\n * ```\n *\n * To check `id` against the app's registry at compile time, give the\n * FeatureId: `defineBlock<FeatureId>({ … })`. `S` is what slots are filled\n * with, inferred from `contributes.slots` (a component on native and web).\n *\n * @stability Beta\n */\nexport function defineBlock<const Id extends string, S = never>(block: BlockDef<Id, S>): BlockDef<Id, S> {\n const problems = blockProblems(block as BlockDef<string, unknown>);\n if (problems.length) throw new BlockError(problems);\n return Object.freeze(block);\n}\n\n/** Which blocks are on: ids, a predicate, or (left out) every block given. @stability Beta */\nexport type EnabledBlocks = Iterable<string> | ((id: string) => boolean);\n\n/** @stability Beta */\nexport interface ResolveBlocksOptions {\n /** Keep only blocks that run here. A required block that doesn't is a missing requirement. */\n platform?: FeaturePlatform;\n /**\n * The app's feature registry (`features` from `defineFeatures`): every block\n * id and requirement must be one of its ids.\n */\n features?: Readonly<Record<string, unknown>>;\n /**\n * A block whose requirement is off: `throw` (default: a set-up mistake, found\n * at launch) or `drop` it, and every block needing it, listing each in\n * `dropped` (for switches that change at run time, such as a tenant turning\n * a feature off).\n */\n missing?: \"throw\" | \"drop\";\n /**\n * The host's slot names (e.g. `GenesisNativeApp`'s). A block filling any\n * other slot is an error, so a typo doesn't fill nothing silently.\n */\n slots?: readonly string[];\n}\n\n/** A contribution with the FeatureId of the block it came from. @stability Beta */\nexport type Contributed<T, Id extends string = string> = T & { readonly feature: Id };\n\n/** @stability Beta */\nexport interface ResolvedBlocks<B extends BlockDef<string, unknown> = BlockDef> {\n /** The enabled blocks, in dependency order (a block after what it requires). */\n readonly blocks: readonly B[];\n readonly ids: ReadonlySet<B[\"id\"]>;\n has(id: string): boolean;\n /** One block's contributions, or `undefined` when it isn't on. */\n contributionsOf(id: B[\"id\"]): NonNullable<B[\"contributes\"]> | undefined;\n /** Nav entries by `order`, then block order. Place them in the app's tree by `feature` and `id`. */\n readonly nav: readonly Contributed<BlockNavItem, B[\"id\"]>[];\n /** Settings rows by `order`, then block order. */\n readonly settings: readonly Contributed<BlockSettingsRow, B[\"id\"]>[];\n readonly routes: readonly Contributed<BlockRoute, B[\"id\"]>[];\n /** Slot fills by slot name. Two blocks filling one slot is an error. */\n readonly slots: Readonly<Record<string, SlotOf<B>>>;\n readonly migrations: readonly Contributed<BlockMigration, B[\"id\"]>[];\n readonly skills: readonly Contributed<{ path: string }, B[\"id\"]>[];\n readonly privacy: readonly Contributed<BlockPrivacy, B[\"id\"]>[];\n /** With `missing: \"drop\"`: blocks left out, and the requirements that were off. */\n readonly dropped: readonly { id: B[\"id\"]; missing: readonly string[] }[];\n}\n\ntype SlotOf<B> = B extends BlockDef<string, infer S> ? S : never;\n\nfunction enabledPredicate(enabled: EnabledBlocks | undefined): ((id: string) => boolean) | undefined {\n if (enabled === undefined) return undefined;\n if (typeof enabled === \"function\") return enabled;\n const set = new Set(enabled);\n return (id) => set.has(id);\n}\n\nconst byOrder = <T extends { order?: number }>(items: { item: T; at: number }[]) =>\n items.sort((a, b) => (a.item.order ?? 0) - (b.item.order ?? 0) || a.at - b.at).map((x) => x.item);\n\n/**\n * The blocks that are on, checked and merged:\n *\n * - every block is valid ({@link defineBlock}'s checks, for blocks built by hand) and its id is unique;\n * - `requires` has no cycles, and with `features`, names real features;\n * - every enabled block's requirements are on (see {@link ResolveBlocksOptions.missing});\n * - no two enabled blocks contribute the same nav id, settings row id, route path or slot.\n *\n * `enabled` left out means every block given is on (and no app feature that\n * isn't a block). Throws a {@link BlockError} listing every problem at once.\n *\n * @stability Beta\n */\nexport function resolveBlocks<B extends BlockDef<string, unknown>>(\n blocks: readonly B[],\n enabled?: EnabledBlocks,\n options: ResolveBlocksOptions = {},\n): ResolvedBlocks<B> {\n const { platform, features, missing = \"throw\", slots: slotNames } = options;\n const problems: string[] = [];\n const byId = new Map<string, B>();\n for (const block of blocks) {\n problems.push(...blockProblems(block));\n if (byId.has(block.id)) problems.push(`${block.id}: two blocks have this id`);\n else byId.set(block.id, block);\n }\n const isFeature = features ? (id: string) => Object.hasOwn(features, id) : undefined;\n if (isFeature) for (const id of byId.keys()) if (!isFeature(id)) problems.push(`${id}: not a feature in the registry`);\n const graph = Object.fromEntries([...byId].map(([id, b]) => [id, { requires: b.requires }]));\n // Self-requirements are already reported by blockProblems; here, unknown ids and cycles.\n const known = { noun: \"block\", isKnown: (req: string) => byId.has(req) || !isFeature || isFeature(req) };\n for (const [id, node] of Object.entries(graph)) {\n for (const req of node.requires ?? []) {\n if (req !== id && requirementProblem(graph, id, req, known)) problems.push(`${id}.requires: \"${req}\" is neither a block nor a feature in the registry`);\n }\n }\n problems.push(...cycleProblems(graph));\n if (problems.length) throw new BlockError(problems);\n\n const isOn = enabledPredicate(enabled);\n const runsHere = (b: B) => !platform || !b.platforms || b.platforms.includes(platform);\n const active = new Set<string>();\n for (const [id, b] of byId) if ((!isOn || isOn(id)) && runsHere(b)) active.add(id);\n\n // In dependency order, so dropping a block also drops what needs it.\n const order = dependencyOrder(graph);\n const dropped: { id: B[\"id\"]; missing: string[] }[] = [];\n for (const id of order) {\n if (!active.has(id)) continue;\n const off = (byId.get(id)!.requires ?? []).filter((req) => {\n if (byId.has(req)) return !active.has(req);\n return !isOn || !isOn(req);\n });\n if (!off.length) continue;\n if (missing === \"drop\") {\n active.delete(id);\n dropped.push({ id, missing: off });\n continue;\n }\n for (const req of off) {\n const why = !byId.has(req)\n ? isOn\n ? \"is not enabled\"\n : \"is not one of the blocks given (pass it, or list the app feature in enabled)\"\n : !runsHere(byId.get(req)!)\n ? `doesn't run on ${platform}`\n : \"is off\";\n problems.push(`${id}.requires: \"${req}\" ${why}; turn it on or turn ${id} off`);\n }\n }\n if (problems.length) throw new BlockError(problems);\n\n const on = order.filter((id) => active.has(id)).map((id) => byId.get(id)!);\n const nav: { item: Contributed<BlockNavItem, B[\"id\"]>; at: number }[] = [];\n const settings: { item: Contributed<BlockSettingsRow, B[\"id\"]>; at: number }[] = [];\n const routes: Contributed<BlockRoute, B[\"id\"]>[] = [];\n const migrations: Contributed<BlockMigration, B[\"id\"]>[] = [];\n const skills: Contributed<{ path: string }, B[\"id\"]>[] = [];\n const privacy: Contributed<BlockPrivacy, B[\"id\"]>[] = [];\n const slots: Record<string, SlotOf<B>> = {};\n const owner = { nav: new Map<string, string>(), settings: new Map<string, string>(), routes: new Map<string, string>(), slots: new Map<string, string>() };\n const claim = (kind: keyof typeof owner, key: string, id: string, what: string) => {\n const first = owner[kind].get(key);\n if (first !== undefined) problems.push(`${id}.contributes.${kind}: ${what} \"${key}\" is already contributed by ${first}`);\n else owner[kind].set(key, id);\n return first === undefined;\n };\n on.forEach((block, at) => {\n const feature = block.id;\n const c = block.contributes ?? {};\n for (const n of c.nav ?? []) if (claim(\"nav\", n.id, feature, \"the nav entry\")) nav.push({ item: { ...n, feature }, at });\n for (const r of c.settings ?? []) if (claim(\"settings\", r.id, feature, \"the settings row\")) settings.push({ item: { ...r, feature }, at });\n for (const r of c.routes ?? []) if (claim(\"routes\", r.path, feature, \"the route\")) routes.push({ ...r, feature });\n for (const [name, fill] of Object.entries(c.slots ?? {})) {\n if (slotNames && !slotNames.includes(name)) {\n problems.push(`${feature}.contributes.slots: \"${name}\" is not a slot here (${slotNames.join(\", \")})`);\n continue;\n }\n if (claim(\"slots\", name, feature, \"the slot\")) slots[name] = fill as SlotOf<B>;\n }\n for (const m of c.migrations ?? []) migrations.push({ ...m, feature });\n for (const path of c.skills ?? []) skills.push({ path, feature });\n if (c.privacy) privacy.push({ ...c.privacy, feature });\n });\n if (problems.length) throw new BlockError(problems);\n\n const ids = new Set(on.map((b) => b.id)) as ReadonlySet<B[\"id\"]>;\n return Object.freeze({\n blocks: Object.freeze(on),\n ids,\n has: (id: string) => ids.has(id as B[\"id\"]),\n contributionsOf: (id: B[\"id\"]) => (ids.has(id) ? ((byId.get(id)!.contributes ?? {}) as NonNullable<B[\"contributes\"]>) : undefined),\n nav: Object.freeze(byOrder(nav)),\n settings: Object.freeze(byOrder(settings)),\n routes: Object.freeze(routes),\n slots: Object.freeze(slots),\n migrations: Object.freeze(migrations),\n skills: Object.freeze(skills),\n privacy: Object.freeze(privacy),\n dropped: Object.freeze(dropped),\n });\n}\n","/**\n * The typed sections content packs had before `sections`: session types,\n * metric templates, custom fields, forms and roadmap templates, each tied to a\n * block an app owns. Kept, and still checked as before, so packs written\n * against them keep working. New packs put their data in `sections`, keyed by\n * block id, and the block checks it.\n *\n * Everything here is deprecated and goes in the next major.\n */\nimport type { ContentPackDef } from \"./content-packs\";\n\n/**\n * A content pack's settings for one session type, with its agenda.\n * @deprecated Put session types in `sections` under the block that owns them, checked by that block's validator.\n * @stability Beta\n */\nexport interface ContentPackSessionType {\n key: string;\n kind: string;\n name: string;\n description?: string;\n defaultMinutes?: number;\n agenda: readonly { key: string; title: string; minutes: number }[];\n}\n\n/**\n * A metric to start from.\n * @deprecated Put metric templates in `sections` under the block that owns them, checked by that block's validator.\n * @stability Beta\n */\nexport interface ContentPackMetricTemplate {\n key: string;\n name: string;\n unitType: string;\n unit?: string;\n cadence: string;\n goalDirection: string;\n goalValue?: number;\n goalMax?: number;\n measureKind?: string;\n rollup?: string;\n}\n\n/**\n * Where a custom field lives, and the block that owns that table.\n * @deprecated Custom fields belong in `sections` under the block that owns their table.\n * @stability Beta\n */\nexport const CONTENT_PACK_FIELD_TARGETS = {\n pursuits: \"pursuits\",\n work_items: \"pursuits\",\n metrics: \"metrics\",\n sessions: \"sessions\",\n} as const;\n\n/**\n * @deprecated See {@link CONTENT_PACK_FIELD_TARGETS}.\n * @stability Beta\n */\nexport type ContentPackFieldTarget = keyof typeof CONTENT_PACK_FIELD_TARGETS;\n\n/**\n * A custom field: a genesis-forms serializable field, on one of the work tables.\n * @deprecated Put field definitions in `sections` under the block that owns their table.\n * @stability Beta\n */\nexport interface ContentPackFieldDefinition {\n key: string;\n target: ContentPackFieldTarget;\n label: string;\n /** A genesis-forms serializable field: type, options, validation. */\n field: { readonly type: string; readonly [key: string]: unknown };\n required?: boolean;\n visibility: \"tenant\" | \"app\" | \"private\";\n}\n\n/**\n * A worksheet, assessment or form: a genesis-forms definition.\n * @deprecated Put forms in `sections` under the block that owns them.\n * @stability Beta\n */\nexport interface ContentPackForm {\n key: string;\n kind: \"worksheet\" | \"assessment\" | \"form\";\n title: string;\n definition: { readonly [key: string]: unknown };\n scoring?: unknown;\n}\n\n/**\n * A roadmap to start from: items that release by a rule, linked to each other by key.\n * @deprecated Put roadmap templates in `sections` under the block that owns them, checked by that block's validator.\n * @stability Beta\n */\nexport interface ContentPackRoadmapTemplate {\n key: string;\n name: string;\n items: readonly {\n key: string;\n kind: string;\n title: string;\n /** Another item's key in this template. */\n ref?: string;\n release: { rule: string; afterDays?: number; anchor?: string };\n }[];\n}\n\n/** The deprecated typed sections, as optional fields of a pack. */\nexport interface LegacyContentPackSections {\n /** @deprecated Use `sections`. */\n sessionTypes?: readonly ContentPackSessionType[];\n /** @deprecated Use `sections`. */\n metricTemplates?: readonly ContentPackMetricTemplate[];\n /** @deprecated Use `sections`. */\n fieldDefinitions?: readonly ContentPackFieldDefinition[];\n /** @deprecated Use `sections`. */\n forms?: readonly ContentPackForm[];\n /** @deprecated Use `sections`. */\n roadmapTemplates?: readonly ContentPackRoadmapTemplate[];\n}\n\n/** The block each typed section fills. */\nconst SECTION_BLOCK = { sessionTypes: \"sessions\", metricTemplates: \"metrics\", forms: \"forms\", roadmapTemplates: \"roadmap\" } as const;\n\n/** The blocks a pack's typed sections need. */\nexport function legacyContentPackBlocks(pack: ContentPackDef): string[] {\n const needed: string[] = [];\n for (const [section, block] of Object.entries(SECTION_BLOCK)) {\n const items = pack[section as keyof typeof SECTION_BLOCK];\n if (items && items.length) needed.push(block);\n }\n for (const f of pack.fieldDefinitions ?? []) {\n const block = CONTENT_PACK_FIELD_TARGETS[f.target];\n if (block) needed.push(block);\n }\n return needed;\n}\n\n/** Every problem with a pack's typed sections, the checks they always had. */\nexport function legacyContentPackProblems(\n pack: ContentPackDef,\n at: string,\n keyProblems: (where: string, items: readonly unknown[] | undefined) => string[],\n): string[] {\n const problems: string[] = [\n ...keyProblems(`${at}.sessionTypes`, pack.sessionTypes),\n ...keyProblems(`${at}.metricTemplates`, pack.metricTemplates),\n ...keyProblems(`${at}.fieldDefinitions`, pack.fieldDefinitions),\n ...keyProblems(`${at}.forms`, pack.forms),\n ...keyProblems(`${at}.roadmapTemplates`, pack.roadmapTemplates),\n ];\n for (const s of pack.sessionTypes ?? []) {\n problems.push(...keyProblems(`${at}.sessionTypes.${s.key}.agenda`, s.agenda));\n for (const item of s.agenda ?? []) {\n if (!(typeof item.minutes === \"number\" && item.minutes > 0)) problems.push(`${at}.sessionTypes.${s.key}.agenda.${item.key}: minutes must be more than 0`);\n }\n }\n for (const f of pack.fieldDefinitions ?? []) {\n if (!Object.hasOwn(CONTENT_PACK_FIELD_TARGETS, f.target)) problems.push(`${at}.fieldDefinitions.${f.key}: target \"${String(f.target)}\" isn't one of ${Object.keys(CONTENT_PACK_FIELD_TARGETS).join(\", \")}`);\n if (typeof f.field?.type !== \"string\") problems.push(`${at}.fieldDefinitions.${f.key}: field needs a genesis-forms type`);\n if (![\"tenant\", \"app\", \"private\"].includes(f.visibility)) problems.push(`${at}.fieldDefinitions.${f.key}: visibility must be tenant, app or private`);\n }\n for (const r of pack.roadmapTemplates ?? []) {\n problems.push(...keyProblems(`${at}.roadmapTemplates.${r.key}.items`, r.items));\n const keys = new Set((r.items ?? []).map((i) => i.key));\n for (const item of r.items ?? []) {\n if (item.ref !== undefined && (!keys.has(item.ref) || item.ref === item.key)) {\n problems.push(`${at}.roadmapTemplates.${r.key}.items.${item.key}: ref \"${item.ref}\" isn't another item in this template`);\n }\n }\n }\n return problems;\n}\n","/**\n * Content packs: versioned data that fills installed blocks. A pack is code,\n * reviewed like any other: the publishing package exports it, and an installer\n * copies it into a tenant's editable rows, keeping each row's source (pack,\n * version, key) so an update can tell what a person changed.\n *\n * A pack's `sections` are keyed by the block that owns them, and each holds\n * that block's items. Genesis checks what every pack shares (id, version,\n * publisher, requires, labels, and a unique `key` on every item); what an item\n * holds is the block's business, checked by the validator the block registers\n * (`contributes.contentSection` on `defineBlock`, or a `validators` map).\n *\n * `defineContentPack` checks a pack's shape; `contentPackProblems` with the\n * installed blocks also checks that every block it fills is there. Keys, not\n * ids, link things together, and stay the same across versions.\n *\n * No zod here: packs ship to phones with `/blocks`.\n */\nimport type { BlockDef, EnabledBlocks } from \"./blocks\";\nimport {\n legacyContentPackBlocks,\n legacyContentPackProblems,\n type LegacyContentPackSections,\n} from \"./content-packs-legacy\";\n\nexport {\n CONTENT_PACK_FIELD_TARGETS,\n type ContentPackFieldDefinition,\n type ContentPackFieldTarget,\n type ContentPackForm,\n type ContentPackMetricTemplate,\n type ContentPackRoadmapTemplate,\n type ContentPackSessionType,\n} from \"./content-packs-legacy\";\n\n/**\n * Checks one section's items for the block that owns it, and returns every\n * problem (an empty list when they're fine). Messages are relative to the\n * section (\"weekly: minutes must be more than 0\"): the checker puts the pack\n * and section in front. A validator that throws is reported as a problem.\n *\n * @stability Beta\n */\nexport type ContentPackSectionValidator = (items: readonly unknown[]) => readonly string[];\n\n/** A pack's sections: block id → that block's items. @stability Beta */\nexport type ContentPackSections = Readonly<Record<string, readonly unknown[]>>;\n\n/** One content pack, as its publisher defines it. @stability Beta */\nexport interface ContentPackDef extends LegacyContentPackSections {\n /** Kebab-case, unique per publisher. */\n id: string;\n name: string;\n description?: string;\n /** Semver. Updates are additive. */\n version: string;\n /** The package that publishes it. */\n publisher: string;\n /** The block ids it fills; installing is refused unless every one is installed. */\n requires: readonly string[];\n /** Taxonomy: label key → display text, e.g. `\"project.phase\": \"Stage\"`. */\n labels?: Readonly<Record<string, string>>;\n /**\n * The data it fills, by block id. Every item has a `key`, unique in its\n * section and the same across versions; the rest is checked by the block's\n * validator.\n */\n sections?: ContentPackSections;\n}\n\n/** @stability Beta */\nexport interface ContentPackCheckOptions {\n /** The installed blocks: every block the pack requires must be one. */\n installed?: EnabledBlocks;\n /** Blocks whose `contributes.contentSection` checks their section's items. */\n blocks?: readonly BlockDef<string, unknown>[];\n /** Section validators by block id; these win over a block's own. */\n validators?: Readonly<Record<string, ContentPackSectionValidator>>;\n}\n/** Thrown by {@link defineContentPack}; lists every problem at once. @stability Beta */\nexport class ContentPackError extends Error {\n constructor(readonly problems: string[]) {\n super(`Invalid content pack:\\n${problems.map((p) => ` - ${p}`).join(\"\\n\")}`);\n this.name = \"ContentPackError\";\n }\n}\n\nconst KEBAB = /^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$/;\nconst KEY = /^[a-z][a-z0-9]*(?:[-_.][a-z0-9]+)*$/;\nconst SEMVER = /^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-[0-9A-Za-z.-]+)?(?:\\+[0-9A-Za-z.-]+)?$/;\n\nfunction keyProblems(where: string, items: readonly unknown[] | undefined): string[] {\n const problems: string[] = [];\n const seen = new Set<string>();\n for (const [i, item] of (items ?? []).entries()) {\n const key = (item as { key?: unknown } | null | undefined)?.key;\n if (typeof key !== \"string\" || !KEY.test(key)) problems.push(`${where}[${i}].key: \"${String(key)}\" is not a key (lowercase, dots, dashes or underscores)`);\n else if (seen.has(key)) problems.push(`${where}: the key \"${key}\" is used twice`);\n else seen.add(key);\n }\n return problems;\n}\n\n/** The block ids a pack's sections need, whatever it declares. @stability Beta */\nexport function contentPackBlocks(pack: ContentPackDef): string[] {\n const needed = new Set<string>(legacyContentPackBlocks(pack));\n const sections = pack.sections;\n const entries = sections && typeof sections === \"object\" && !Array.isArray(sections) ? Object.entries(sections) : [];\n for (const [block, items] of entries) {\n if (Array.isArray(items) && items.length) needed.add(block);\n }\n return [...needed].sort();\n}\n\nfunction test(blocks: EnabledBlocks): (id: string) => boolean {\n if (typeof blocks === \"function\") return blocks;\n const set = new Set(blocks);\n return (id) => set.has(id);\n}\n\n/** The second argument: the installed blocks (ids or a predicate), or options. Anything else is a caller's mistake. */\nfunction checkOptions(value: unknown): ContentPackCheckOptions {\n if (value === undefined) return {};\n if (typeof value === \"function\") return { installed: value as EnabledBlocks };\n if (typeof value === \"object\" && value !== null) {\n if (Symbol.iterator in value) return { installed: value as EnabledBlocks };\n return value as ContentPackCheckOptions;\n }\n throw new TypeError(`contentPackProblems: the second argument is the installed block ids (a list or a predicate) or options, not ${value === null ? \"null\" : typeof value}`);\n}\n\n/**\n * Every problem with a pack: its shape, each section's items (through the\n * validator its block registers, when given) and, given the installed blocks,\n * any block it fills that isn't installed. An empty list means it can be\n * installed. The second argument is the installed blocks, or options.\n *\n * @stability Beta\n */\nexport function contentPackProblems(pack: ContentPackDef, installedOrOptions?: EnabledBlocks | ContentPackCheckOptions): string[] {\n const options = checkOptions(installedOrOptions);\n const at = `content pack ${typeof pack?.id === \"string\" ? pack.id : \"?\"}`;\n const problems: string[] = [];\n if (typeof pack?.id !== \"string\" || !KEBAB.test(pack.id)) problems.push(`${at}: id must be kebab-case`);\n if (typeof pack?.name !== \"string\" || !pack.name.trim()) problems.push(`${at}: needs a name`);\n if (typeof pack?.version !== \"string\" || !SEMVER.test(pack.version)) problems.push(`${at}: version \"${String(pack?.version)}\" isn't semver`);\n if (typeof pack?.publisher !== \"string\" || !pack.publisher.trim()) problems.push(`${at}: needs a publisher (its package name)`);\n if (!Array.isArray(pack?.requires)) {\n problems.push(`${at}: requires must list the blocks it fills`);\n return problems;\n }\n for (const [label, text] of Object.entries(pack.labels ?? {})) {\n if (!KEY.test(label)) problems.push(`${at}: label key \"${label}\" is not a key`);\n if (typeof text !== \"string\" || !text.trim()) problems.push(`${at}: label \"${label}\" needs display text`);\n }\n // A null-prototype map: section keys come from the pack, so `constructor` must not find Object.\n const validators: Record<string, ContentPackSectionValidator> = Object.create(null);\n for (const block of options.blocks ?? []) {\n const validate = block.contributes?.contentSection;\n if (typeof validate === \"function\") validators[block.id] = validate;\n }\n for (const [block, validate] of Object.entries(options.validators ?? {})) if (typeof validate === \"function\") validators[block] = validate;\n const sections = pack.sections;\n const sectionsOk = sections === undefined || (typeof sections === \"object\" && sections !== null && !Array.isArray(sections));\n if (!sectionsOk) problems.push(`${at}: sections must be an object keyed by block id`);\n for (const [block, items] of sectionsOk ? Object.entries(sections ?? {}) : []) {\n const where = `${at}.sections.${block}`;\n if (!KEY.test(block)) problems.push(`${where}: \"${block}\" is not a block id`);\n if (!Array.isArray(items)) {\n problems.push(`${where}: must be a list of items`);\n continue;\n }\n problems.push(...keyProblems(where, items));\n const validate = validators[block];\n if (!validate) continue;\n let found: readonly string[] | undefined;\n try {\n found = validate(items);\n } catch (error) {\n problems.push(`${where}: the block's validator failed: ${error instanceof Error ? error.message : String(error)}`);\n continue;\n }\n for (const problem of Array.isArray(found) ? found : []) problems.push(`${where}: ${problem}`);\n }\n problems.push(...legacyContentPackProblems(pack, at, keyProblems));\n // Every block a section fills must be declared, and (when known) installed.\n const declared = new Set(pack.requires);\n for (const block of contentPackBlocks(pack)) {\n if (!declared.has(block)) problems.push(`${at}: fills the ${block} block but doesn't list it in requires`);\n }\n if (options.installed !== undefined) {\n const has = test(options.installed);\n for (const block of pack.requires) if (!has(block)) problems.push(`${at}: needs the ${block} block, which isn't installed`);\n }\n return problems;\n}\n\n/**\n * Declare a content pack: returns it unchanged, typed, after checking its\n * shape (throws a {@link ContentPackError} listing every problem). Give the\n * blocks it fills, or validators by block id, to check each section's items\n * too. Whether its blocks are installed is checked at install time with\n * {@link contentPackProblems}.\n *\n * ```ts\n * export const weeklyTeamRhythm = defineContentPack({\n * id: \"weekly-team-rhythm\", name: \"Weekly team rhythm\", version: \"1.0.0\",\n * publisher: \"@acme/content\", requires: [\"meetings\"],\n * labels: { \"project.phase\": \"Stage\" },\n * sections: { meetings: [{ key: \"weekly\", name: \"Weekly meeting\", minutes: 60 }] },\n * }, { blocks: [meetingsBlock] });\n * ```\n *\n * @stability Beta\n */\nexport function defineContentPack<const T extends ContentPackDef>(pack: T, options?: Omit<ContentPackCheckOptions, \"installed\">): T {\n const problems = contentPackProblems(pack, { blocks: options?.blocks, validators: options?.validators });\n if (problems.length) throw new ContentPackError(problems);\n return pack;\n}\n","/**\n * The overlay marker: `genesis.overlay` in the package.json of an app's local\n * copy of a published Genesis package (an \"overlay\"), which shadows that\n * package by name while the app changes it:\n *\n * \"genesis\": {\n * …the package's own genesis key…,\n * \"overlay\": {\n * \"upstream\": \"@marktiderman/genesis-support@0.2.6\",\n * \"since\": \"2026-10-30\",\n * \"owner\": \"web team\",\n * \"reason\": \"support inbox filters, to promote upstream\"\n * }\n * }\n *\n * `upstream` is the package and the exact release it was copied from; `since`\n * is the day it was made (an ISO date); `owner` and `reason` say who answers\n * for it and why it exists. The doctor reads the marker (genesis-cli,\n * `overlay-*` rules).\n */\n\n/**\n * A validated `genesis.overlay` marker.\n *\n * @stability Beta\n */\nexport interface OverlayMarker {\n /** `@marktiderman/genesis-<name>@<semver>`: the package and release the overlay was copied from. */\n upstream: string;\n /** The day the overlay was made, `YYYY-MM-DD`. */\n since: string;\n /** Who answers for it: a person, a team or a handle. */\n owner: string;\n /** Why it exists, in a sentence. */\n reason: string;\n}\n\nconst OVERLAY_KEYS = new Set([\"upstream\", \"since\", \"owner\", \"reason\", \"$comment\"]);\n/** A Genesis package name at an exact semver release (a prerelease tag allowed, no build metadata). */\nconst UPSTREAM = /^(@marktiderman\\/genesis(?:-[a-z0-9-]+)?)@(\\d+\\.\\d+\\.\\d+(?:-[0-9A-Za-z.-]+)?)$/;\n/** A local build's tag (`-local.1`): an overlay's own version, never the release it was copied from. */\nconst LOCAL_TAG = /(?:^|[.-])local(?:[.-]|$)/;\nconst ISO_DATE = /^(\\d{4})-(\\d{2})-(\\d{2})$/;\n\nconst isObject = (v: unknown): v is Record<string, unknown> => typeof v === \"object\" && v !== null && !Array.isArray(v);\nconst isText = (v: unknown): v is string => typeof v === \"string\" && v.trim().length > 0;\n\n/** A real calendar day written `YYYY-MM-DD`. */\nfunction isIsoDate(v: unknown): v is string {\n if (typeof v !== \"string\") return false;\n const m = ISO_DATE.exec(v);\n if (!m) return false;\n const d = new Date(Date.UTC(Number(m[1]), Number(m[2]) - 1, Number(m[3])));\n return d.getUTCFullYear() === Number(m[1]) && d.getUTCMonth() === Number(m[2]) - 1 && d.getUTCDate() === Number(m[3]);\n}\n\n/**\n * A package's `genesis.overlay` marker, or null when it doesn't validate.\n * Problems go in `problems`, each prefixed with the package name.\n *\n * @stability Beta\n */\nexport function readOverlayMarker(name: string, raw: unknown, problems: string[] = []): OverlayMarker | null {\n const at = `${name} genesis.overlay`;\n if (!isObject(raw)) {\n problems.push(`${at}: must be an object { \"upstream\", \"since\", \"owner\", \"reason\" }`);\n return null;\n }\n const before = problems.length;\n for (const key of Object.keys(raw)) {\n if (!OVERLAY_KEYS.has(key)) problems.push(`${at}: unknown key \"${key}\" (known: upstream, since, owner, reason)`);\n }\n const m = typeof raw.upstream === \"string\" ? UPSTREAM.exec(raw.upstream) : null;\n if (!m) problems.push(`${at}.upstream: must be \"@marktiderman/genesis-<name>@<version>\", the package and release it was copied from, not ${JSON.stringify(raw.upstream)}`);\n else if (m[1] !== name) problems.push(`${at}.upstream: names ${m[1]}, but the package is ${name}; an overlay keeps the name it shadows`);\n else if (m[2]!.includes(\"-\") && LOCAL_TAG.test(m[2]!.slice(m[2]!.indexOf(\"-\") + 1))) problems.push(`${at}.upstream: ${m[2]} is a local build; name the release it was copied from`);\n if (!isIsoDate(raw.since)) problems.push(`${at}.since: must be the day it was made, as YYYY-MM-DD, not ${JSON.stringify(raw.since)}`);\n if (!isText(raw.owner)) problems.push(`${at}.owner: say who answers for the overlay`);\n if (!isText(raw.reason)) problems.push(`${at}.reason: say why the overlay exists`);\n return problems.length === before ? { upstream: raw.upstream as string, since: raw.since as string, owner: raw.owner as string, reason: raw.reason as string } : null;\n}\n\n/**\n * The upstream package name and version of a marker: `{ name, version }`.\n *\n * @stability Beta\n */\nexport function overlayUpstream(marker: Pick<OverlayMarker, \"upstream\">): { name: string; version: string } {\n const at = marker.upstream.lastIndexOf(\"@\");\n return { name: marker.upstream.slice(0, at), version: marker.upstream.slice(at + 1) };\n}\n","/**\n * Package layers: where each Genesis package sits, read from its package.json\n * (`\"genesis\": { \"layer\", \"group\", \"essential\", \"module\" }`), and the rule\n * that keeps dependencies pointing down (docs/PACKAGE-STRATEGY.md, \"Layers\").\n *\n * - **foundation**: what every app needs (design-system, core, ui, ui-native,\n * features). Depends only on other foundation packages.\n * - **primitive**: a capability an app or module composes (data, AI, forms,\n * collaboration, the native and extension shells). Depends on foundation\n * and other primitives.\n * - **module**: a mini app a person installs and switches on per tenant\n * (sites, support, product), built from its blocks. Depends on foundation,\n * primitives, and only the modules it lists in `module.requiresModules`.\n * - **tooling**: the CLI and agent docs. May use anything; no runtime\n * package imports it, nor a package's `toolingEntries`.\n *\n * Plain data and string problems, with no zod and no I/O: the repo's check\n * (`scripts/check-package-layers.mjs`) reads the workspace and calls\n * {@link packageLayerProblems}.\n */\nimport { readOverlayMarker, type OverlayMarker } from \"./overlay\";\nimport { cycleProblems } from \"./graph\";\n\n/**\n * The package layers, bottom to top, with tooling beside them.\n *\n * @stability Beta\n */\nexport const PACKAGE_LAYERS = [\"foundation\", \"primitive\", \"module\", \"tooling\"] as const;\n/** @stability Beta */\nexport type PackageLayer = (typeof PACKAGE_LAYERS)[number];\n\n/**\n * Where a package appears on the site and in Storybook. `modules` holds every module.\n *\n * @stability Beta\n */\nexport const PACKAGE_GROUPS = [\"core\", \"data\", \"ai\", \"forms\", \"collaboration\", \"shells\", \"modules\"] as const;\n/** @stability Beta */\nexport type PackageGroup = (typeof PACKAGE_GROUPS)[number];\n\n/**\n * A module's card and install contract. It points at the package's blocks\n * (`genesis.blocks`), which hold the migrations, routes, nav and settings;\n * it never copies them. Which plan unlocks a module is the app's decision,\n * in its own features.ts, so there is no plan here.\n *\n * @stability Beta\n */\nexport interface ModuleMeta {\n /** The module's name on its card: `Sites`. */\n name: string;\n /** One sentence: what a tenant gets. */\n summary: string;\n /** Ids in this package's `genesis.blocks`, in install order. At least one. */\n blocks: readonly string[];\n /** Other modules (package names) it builds on: the only module-to-module dependencies allowed. */\n requiresModules?: readonly string[];\n /** The Postgres schema it owns, when it has tables. */\n schema?: string;\n /** How to add it: `genesis add <block>`, naming one of its own blocks (the others add the same way). */\n install: string;\n /** Its guide: a path in the package, or an https URL. */\n docs: string;\n /** Its agent skill: a `SKILL.md` path in the package. */\n skill: string;\n}\n\n/**\n * The `genesis` key of a package's package.json, as far as layers go (it also\n * holds `blocks` and `doctor`).\n *\n * @stability Beta\n */\nexport interface PackageMeta {\n layer: PackageLayer;\n group: PackageGroup;\n /** One of the packages every app starts with, badged on the site. Foundation or tooling only. */\n essential?: boolean;\n /** Present on a module, and only on a module. */\n module?: ModuleMeta;\n /** Entry points (`./node`) that are tooling inside a runtime package: no runtime package imports them. */\n toolingEntries?: readonly string[];\n /** Who reviews changes to it: a GitHub handle (`@octocat`) or team (`@acme/web`). Generates CODEOWNERS. */\n owner?: string;\n /** Present only on an app's local copy of a Genesis package (an overlay): what it was copied from, when, by whom and why. */\n overlay?: OverlayMarker;\n /**\n * An upgrade apps opt into (an optional or premium capability, like a media library). No\n * foundation package or primitive depends on it: the primitive owns a port, this package ships\n * the adapter, and the app passes it in. Upgrades plug in; primitives never import them.\n * An optional peer dependency (`peerDependenciesMeta.<name>.optional`) is the one allowed edge,\n * imported for types or with `import()` only. On a module it adds no rule (no foundation package\n * or primitive can use a module anyway); it records that the module is an upgrade.\n */\n optional?: boolean;\n}\n\n/**\n * One workspace package, as the layering check reads it.\n *\n * @stability Beta\n */\nexport interface LayerPackage {\n /** The npm name. */\n name: string;\n /** Its package.json `genesis` value, unchecked. */\n genesis: unknown;\n /** Its package.json `exports` keys, when it has them. */\n exports?: readonly string[];\n /**\n * What it uses: dependency and peer dependency names, and the specifiers\n * its source imports (`@marktiderman/genesis-ui/data`). Anything that is\n * not another package of the set is ignored.\n */\n uses: readonly string[];\n /**\n * The peer dependencies its `peerDependenciesMeta` marks optional (and that aren't also in\n * `dependencies` or `optionalDependencies`).\n */\n optionalPeers?: readonly string[];\n /**\n * The specifiers its source imports statically for their values (`import { x } from`, `export … from`,\n * `import \"x\"`): not `import type`, not a dynamic `import()`. When given, an optional package that is\n * an optional peer may only be imported for types or with `import()`, so the primitive still loads\n * without it. When left out, that isn't checked.\n */\n valueImports?: readonly string[];\n}\n\nconst isObject = (v: unknown): v is Record<string, unknown> => typeof v === \"object\" && v !== null && !Array.isArray(v);\nconst isText = (v: unknown): v is string => typeof v === \"string\" && v.trim().length > 0;\nconst isTextList = (v: unknown): v is string[] => Array.isArray(v) && v.every(isText);\nconst PG_NAME = /^[a-z_][a-z0-9_]*$/;\nconst MODULE_KEYS = new Set([\"name\", \"summary\", \"blocks\", \"requiresModules\", \"schema\", \"install\", \"docs\", \"skill\"]);\n\n/**\n * A package's layer metadata, or null when it has none valid. Problems go in\n * `problems`, each prefixed with the package name.\n *\n * @stability Beta\n */\nexport function readPackageMeta(name: string, genesis: unknown, problems: string[] = [], exportsKeys?: readonly string[]): PackageMeta | null {\n const at = `${name} genesis`;\n if (!isObject(genesis)) {\n problems.push(`${at}: missing; every package declares \"genesis\": { \"layer\", \"group\" }`);\n return null;\n }\n const before = problems.length;\n const { layer, group, essential, module, toolingEntries, owner, overlay, optional } = genesis;\n if (overlay !== undefined) readOverlayMarker(name, overlay, problems);\n if (owner !== undefined && (typeof owner !== \"string\" || !/^@[A-Za-z0-9-]+(\\/[A-Za-z0-9._-]+)?$/.test(owner))) {\n problems.push(`${at}.owner: must be a GitHub handle or team, like \"@octocat\" or \"@acme/web\"`);\n }\n if (!(PACKAGE_LAYERS as readonly unknown[]).includes(layer)) problems.push(`${at}.layer: must be one of ${PACKAGE_LAYERS.join(\", \")}, not ${JSON.stringify(layer)}`);\n if (!(PACKAGE_GROUPS as readonly unknown[]).includes(group)) problems.push(`${at}.group: must be one of ${PACKAGE_GROUPS.join(\", \")}, not ${JSON.stringify(group)}`);\n if (essential !== undefined && typeof essential !== \"boolean\") problems.push(`${at}.essential: must be true or false`);\n if (essential === true && layer !== \"foundation\" && layer !== \"tooling\") problems.push(`${at}.essential: only a foundation or tooling package is essential, not a ${String(layer)}`);\n if (optional !== undefined && typeof optional !== \"boolean\") problems.push(`${at}.optional: must be true or false`);\n if (optional === true && (layer === \"foundation\" || layer === \"tooling\")) problems.push(`${at}.optional: a ${String(layer)} package can't be optional; only a primitive or module is an upgrade apps opt into`);\n if (optional === true && essential === true) problems.push(`${at}.optional: an essential package can't be optional`);\n if ((layer === \"module\") !== (group === \"modules\")) problems.push(`${at}.group: a module is in the \"modules\" group, and only a module is`);\n if (layer === \"module\" && module === undefined) problems.push(`${at}.module: a module declares its card and install (name, summary, blocks, install, docs, skill)`);\n if (layer !== \"module\" && module !== undefined) problems.push(`${at}.module: only a package with layer \"module\" has one`);\n if (module !== undefined) moduleProblems(at, genesis, module, problems);\n if (toolingEntries !== undefined) {\n if (!isTextList(toolingEntries) || toolingEntries.some((e) => !e.startsWith(\"./\"))) problems.push(`${at}.toolingEntries: must be a list of entry points like \"./node\"`);\n else if (exportsKeys) for (const e of toolingEntries) if (!exportsKeys.includes(e)) problems.push(`${at}.toolingEntries: \"${e}\" is not in the package's exports`);\n }\n return problems.length === before ? (genesis as unknown as PackageMeta) : null;\n}\n\nfunction moduleProblems(at: string, genesis: Record<string, unknown>, module: unknown, problems: string[]): void {\n const where = `${at}.module`;\n if (!isObject(module)) {\n problems.push(`${where}: must be an object`);\n return;\n }\n for (const key of Object.keys(module)) if (!MODULE_KEYS.has(key)) problems.push(`${where}.${key}: unknown key (one of ${[...MODULE_KEYS].join(\", \")})`);\n for (const key of [\"name\", \"summary\", \"install\", \"docs\", \"skill\"] as const) if (!isText(module[key])) problems.push(`${where}.${key}: required text`);\n const declared = isObject(genesis[\"blocks\"]) ? Object.keys(genesis[\"blocks\"]) : [];\n const blocks = module[\"blocks\"];\n if (!isTextList(blocks) || blocks.length === 0) problems.push(`${where}.blocks: list at least one id from genesis.blocks`);\n else for (const id of blocks) if (!declared.includes(id)) problems.push(`${where}.blocks: \"${id}\" is not in genesis.blocks`);\n const requiresModules = module[\"requiresModules\"];\n if (requiresModules !== undefined && !isTextList(requiresModules)) problems.push(`${where}.requiresModules: must be a list of package names`);\n const schema = module[\"schema\"];\n if (schema !== undefined && !(typeof schema === \"string\" && PG_NAME.test(schema))) problems.push(`${where}.schema: must be a Postgres schema name`);\n const install = module[\"install\"];\n if (isText(install)) {\n const words = install.trim().split(/\\s+/);\n if (words.length !== 3 || words[0] !== \"genesis\" || words[1] !== \"add\") problems.push(`${where}.install: must be \"genesis add <block>\", not ${JSON.stringify(install)}`);\n else if (isTextList(blocks) && !blocks.includes(words[2]!)) problems.push(`${where}.install: \"${words[2]}\" is not one of the module's blocks`);\n }\n const docs = module[\"docs\"];\n if (isText(docs) && !docs.startsWith(\"https://\") && !isPackagePath(docs)) problems.push(`${where}.docs: a path in the package or an https URL, not ${JSON.stringify(docs)}`);\n const skill = module[\"skill\"];\n if (isText(skill) && !(isPackagePath(skill) && skill.endsWith(\"SKILL.md\"))) problems.push(`${where}.skill: a SKILL.md path in the package, not ${JSON.stringify(skill)}`);\n}\n\n/** A plain package-relative path: forward slashes, no `.`/`..`, not absolute. */\nfunction isPackagePath(value: string): boolean {\n if (/[\\0\\\\:]/.test(value) || value.startsWith(\"/\") || value.startsWith(\"~\")) return false;\n return value.split(\"/\").every((s) => s !== \"\" && s !== \".\" && s !== \"..\");\n}\n\n/** `@scope/name/sub/path` → `@scope/name`, `name/sub` → `name`. */\nfunction packageOf(specifier: string): string {\n const parts = specifier.split(\"/\");\n return specifier.startsWith(\"@\") ? parts.slice(0, 2).join(\"/\") : parts[0]!;\n}\n\n/**\n * Every layering problem across a set of packages, as strings:\n *\n * 1. each package's metadata is valid ({@link readPackageMeta});\n * 2. what it uses points down: foundation → foundation; primitive →\n * foundation or primitive; module → foundation, primitive, or a module it\n * lists in `requiresModules`; tooling → anything; and nothing outside\n * tooling uses a tooling package or another package's `toolingEntries`;\n * 3. no foundation package or primitive uses an optional package (`genesis.optional`) except as\n * an optional peer dependency, imported for types or with `import()` only (checked when\n * `valueImports` is given): upgrades plug in through ports the primitive owns;\n * 4. no cycles among the runtime packages.\n *\n * (Every module's docs and skill existing on disk is the caller's to check;\n * schema ownership is a follow-up, `package-schema-ownership`.)\n *\n * @stability Beta\n */\nexport function packageLayerProblems(packages: readonly LayerPackage[]): string[] {\n const problems: string[] = [];\n const metas = new Map<string, PackageMeta>();\n for (const pkg of packages) {\n const meta = readPackageMeta(pkg.name, pkg.genesis, problems, pkg.exports);\n // An overlay is an app's local copy of a Genesis package; a Genesis package is never one.\n if (isObject(pkg.genesis) && pkg.genesis[\"overlay\"] !== undefined) problems.push(`${pkg.name} genesis.overlay: only an app's local copy of a Genesis package carries one, never the package itself`);\n if (meta) metas.set(pkg.name, meta);\n }\n for (const [name, meta] of metas) {\n for (const req of meta.module?.requiresModules ?? []) {\n if (req === name) problems.push(`${name} genesis.module.requiresModules: a module can't require itself`);\n else if (metas.get(req)?.layer !== \"module\") problems.push(`${name} genesis.module.requiresModules: \"${req}\" is not a module`);\n }\n }\n\n const graph: Record<string, { requires: string[] }> = {};\n for (const pkg of packages) {\n const meta = metas.get(pkg.name);\n if (!meta) continue;\n const edges = new Set<string>();\n const optionalPeers = new Set(pkg.optionalPeers ?? []);\n const valueImported = new Set((pkg.valueImports ?? []).map(packageOf));\n for (const spec of new Set(pkg.uses)) {\n const target = packageOf(spec);\n if (target === pkg.name) continue;\n const to = metas.get(target);\n if (!to || meta.layer === \"tooling\") continue;\n const sub = spec.length > target.length ? `.${spec.slice(target.length)}` : \".\";\n if (to.layer === \"tooling\") problems.push(`${pkg.name} (${meta.layer}) uses ${target}, which is tooling: no runtime package depends on tooling`);\n else if (to.toolingEntries?.includes(sub)) problems.push(`${pkg.name} (${meta.layer}) imports ${spec}, a tooling entry point of ${target}`);\n else if (!allowed(meta, to, target)) problems.push(`${pkg.name} (${meta.layer}) uses ${target} (${to.layer}): ${rule(meta)}`);\n else if (to.optional === true && (meta.layer === \"foundation\" || meta.layer === \"primitive\") && !optionalPeers.has(target)) {\n problems.push(`${pkg.name} (${meta.layer}) uses ${target}, which is optional: define a port in ${pkg.name} and let ${target} ship the adapter (or list it as an optional peer dependency)`);\n } else if (to.optional === true && (meta.layer === \"foundation\" || meta.layer === \"primitive\") && valueImported.has(target)) {\n problems.push(`${pkg.name} (${meta.layer}) imports ${target} statically, but it is an optional peer: import it for types only or with import(), so ${pkg.name} still loads without it`);\n }\n // Only allowed edges go in the cycle search: a wrong-way edge is already reported, and an\n // optional peer is no edge at all (the adapter package may use this one).\n else if (!optionalPeers.has(target)) edges.add(target);\n }\n if (meta.layer !== \"tooling\") graph[pkg.name] = { requires: [...edges].sort() };\n }\n for (const cycle of cycleProblems(graph)) problems.push(`dependency cycle:${cycle.slice(cycle.indexOf(\": a cycle:\") + \": a cycle:\".length)}`);\n return problems;\n}\n\nfunction allowed(from: PackageMeta, to: PackageMeta, target: string): boolean {\n switch (from.layer) {\n case \"foundation\":\n return to.layer === \"foundation\";\n case \"primitive\":\n return to.layer === \"foundation\" || to.layer === \"primitive\";\n case \"module\":\n return to.layer !== \"module\" || (from.module?.requiresModules ?? []).includes(target);\n case \"tooling\":\n return true;\n }\n}\n\nfunction rule(from: PackageMeta): string {\n switch (from.layer) {\n case \"foundation\":\n return \"a foundation package depends only on foundation packages\";\n case \"primitive\":\n return \"a primitive depends only on foundation packages and other primitives (never a module)\";\n case \"module\":\n return \"a module depends on another module only when genesis.module.requiresModules lists it\";\n default:\n return \"\";\n }\n}\n"]}
@@ -1,199 +0,0 @@
1
- import { F as FlagValue, a as FeatureStatus, b as FeatureAccess, c as FlagKind } from './types-Bd766VxF.js';
2
- import { F as FeaturePlatform } from './platforms-NR0liM8L.js';
3
-
4
- /**
5
- * The feature gate: one answer to "is this feature on here?" for UI, server
6
- * code, agents and (for status and entitlement) the database.
7
- *
8
- * Checks run in a fixed order and the first "no" wins:
9
- *
10
- * 1. status the feature has shipped (beta, live or deprecated)
11
- * 2. platform it has shipped on this platform
12
- * 3. tenant the tenant has not switched it off
13
- * 4. flag each of its boolean release or permission flags is true
14
- * 5. entitlement a paid feature (`access: { plan }`) has an active entitlement
15
- *
16
- * A feature that `requires` other features in the registry (a module's parts
17
- * require the module) is also off while any of them is off: after its own
18
- * status and platform, each required feature is asked the same way, and the
19
- * first "no" comes back with `via` naming it. So switching a module off, or not
20
- * paying for it, turns off every part with it, and the upsell names the module's
21
- * plan.
22
- *
23
- * Entitlement is last on purpose: an "upgrade to unlock" answer is only given
24
- * when paying is the one thing missing, so an upsell never promises a feature
25
- * that a switch or a flag would still keep off.
26
- *
27
- * The registry comes from code (features.ts and flags.json). Everything that
28
- * changes at runtime (entitlements, switches, flag values) comes in through
29
- * {@link GateContext}, read once per request or session on the server. Role
30
- * and row rights are not the gate's business: "may this person" stays with
31
- * roles and row security.
32
- *
33
- * No zod, React, Node built-ins or DOM globals here: this file ships to
34
- * browsers, extension service workers, phones and edge functions.
35
- */
36
-
37
- /** The statuses in which a feature is on. A deprecated feature still works until it is retired. @stability Beta */
38
- declare const SHIPPED_STATUSES: readonly FeatureStatus[];
39
- /**
40
- * Why a feature is off: the first check that said no. `unknown` is an id that
41
- * isn't in the registry (or not in a snapshot).
42
- *
43
- * @stability Beta
44
- */
45
- type GateReason = "unknown" | "status" | "platform" | "tenant" | "flag" | "entitlement";
46
- /**
47
- * The gate's answer for one feature. `unlock` is set when the reason is
48
- * `entitlement`: the plan that turns it on, so the UI can show an upgrade
49
- * instead of hiding the feature.
50
- *
51
- * @stability Beta
52
- */
53
- interface GateAnswer {
54
- on: boolean;
55
- reason?: GateReason;
56
- unlock?: {
57
- plan: string;
58
- };
59
- /** The flag that turned it off, when the reason is `flag`. Server side only: snapshots leave it out. */
60
- flag?: string;
61
- /** The required feature that turned it off (a module its part needs), when the "no" came from one. */
62
- via?: string;
63
- }
64
- /** The fields of a feature the gate reads. A `FeatureDef` fits. @stability Beta */
65
- interface GateFeature {
66
- status: FeatureStatus;
67
- apps: readonly string[];
68
- platforms?: Partial<Record<FeaturePlatform, FeatureStatus>>;
69
- access?: FeatureAccess;
70
- /** Ids this feature needs; those in the registry must be on too. */
71
- requires?: readonly string[];
72
- }
73
- /** The fields of a flag the gate reads. A `FlagDef` fits. @stability Beta */
74
- interface GateFlag {
75
- feature: string;
76
- kind: FlagKind;
77
- default: FlagValue;
78
- }
79
- /** What the gate decides from: the registry, as code defines it. @stability Beta */
80
- interface GateRegistry {
81
- features: {
82
- readonly [id: string]: GateFeature;
83
- };
84
- flags?: {
85
- readonly [name: string]: GateFlag;
86
- };
87
- }
88
- /**
89
- * A set of ids: a list, a Set or a test. Not any iterable: an iterator would
90
- * be used up by the first feature asked, and a bare string would count as its
91
- * characters.
92
- *
93
- * @stability Beta
94
- */
95
- type IdSet = readonly string[] | ReadonlySet<string> | ((id: string) => boolean);
96
- /**
97
- * Where and for whom the gate is asked: the platform, plus the tenant's
98
- * runtime state. Leave out what the app doesn't have: no `entitlements` means
99
- * no paid feature is on, no `off` means no switch is off, no `flags` means
100
- * every flag has its default.
101
- *
102
- * @stability Beta
103
- */
104
- interface GateContext {
105
- platform: FeaturePlatform;
106
- /** Feature ids with an active entitlement: the tenant's, and the viewer's own (a person grant). */
107
- entitlements?: IdSet;
108
- /** Feature ids the tenant switched off. */
109
- off?: IdSet;
110
- /** Flag values for this tenant, by flag name. A missing flag has its default. */
111
- flags?: {
112
- readonly [name: string]: FlagValue | undefined;
113
- } | ((name: string) => FlagValue | undefined);
114
- }
115
- /**
116
- * Is feature `id` on for this context? Returns the first check that said no
117
- * as `reason`, and for a paid feature the plan that unlocks it. An unknown id
118
- * is off with reason `unknown`; it never throws for one.
119
- *
120
- * ```ts
121
- * const answer = featureOn({ features, flags }, { platform: "web", entitlements, off }, "form-webhook-delivery");
122
- * // { on: false, reason: "entitlement", unlock: { plan: "pro" } }
123
- * ```
124
- *
125
- * @stability Beta
126
- */
127
- declare function featureOn(registry: GateRegistry, context: GateContext, id: string): GateAnswer;
128
- /**
129
- * Every shipped feature's answer for one context: what a server hands a
130
- * client, so the client never decides on its own. Plain JSON, safe to store
131
- * (an extension's session storage, a cache) and to compare by `version`.
132
- *
133
- * It lists only features that have shipped somewhere (beta, live or
134
- * deprecated) and leaves out flag names; anything missing reads as off.
135
- *
136
- * @stability Beta
137
- */
138
- interface GateSnapshot {
139
- /** The answers, by feature id. */
140
- readonly answers: {
141
- readonly [id: string]: GateAnswer;
142
- };
143
- /** When the server made it (ISO 8601). Refresh after your own time limit. */
144
- readonly at: string;
145
- /** The registry version it was made from, when known (the build's version). */
146
- readonly version?: string | number;
147
- }
148
- /** @stability Beta */
149
- interface GateSnapshotOptions {
150
- /** Answer for these features only. */
151
- ids?: Iterable<string>;
152
- /** The registry version, carried into the snapshot. */
153
- version?: string | number;
154
- /** The time to stamp (default now). */
155
- at?: Date;
156
- }
157
- /** @stability Beta */
158
- declare function gateSnapshot(registry: GateRegistry, context: GateContext, options?: GateSnapshotOptions): GateSnapshot;
159
- /**
160
- * Whether a snapshot is older than `maxAgeMs`: refresh it then. A client
161
- * (an extension worker, a tab left open) keeps a snapshot, replaces it when it
162
- * is stale, after sign-in or a tenant switch, and right after a refusal.
163
- *
164
- * @stability Beta
165
- */
166
- declare function isSnapshotStale(snapshot: GateSnapshot, maxAgeMs: number, now?: Date): boolean;
167
- /** One feature's answer from a snapshot. An id missing from it is off, as an unknown feature. @stability Beta */
168
- declare function fromSnapshot(snapshot: GateSnapshot, id: string): GateAnswer;
169
- /**
170
- * Thrown by {@link requireFeature} when a feature is off. Servers map it to a
171
- * refusal that carries the reason (HTTP 403, or 402 for `entitlement`).
172
- *
173
- * @stability Beta
174
- */
175
- declare class FeatureOff extends Error {
176
- readonly feature: string;
177
- readonly reason: GateReason;
178
- readonly unlock?: {
179
- plan: string;
180
- };
181
- /** The required feature that turned it off, when one did. */
182
- readonly via?: string;
183
- constructor(feature: string, answer: GateAnswer);
184
- /** The HTTP status for this refusal: 402 when a plan unlocks it, else 403. */
185
- get status(): 402 | 403;
186
- }
187
- /**
188
- * Refuse unless the feature is on: call it at the top of every server
189
- * function and route that belongs to a feature.
190
- *
191
- * ```ts
192
- * requireFeature({ features, flags }, await gateContext(tenant), "form-webhook-delivery");
193
- * ```
194
- *
195
- * @stability Beta
196
- */
197
- declare function requireFeature(registry: GateRegistry, context: GateContext, id: string): void;
198
-
199
- export { FeatureOff as F, type GateAnswer as G, type IdSet as I, SHIPPED_STATUSES as S, type GateSnapshot as a, type GateContext as b, type GateFeature as c, type GateFlag as d, type GateReason as e, type GateRegistry as f, type GateSnapshotOptions as g, featureOn as h, fromSnapshot as i, gateSnapshot as j, isSnapshotStale as k, requireFeature as r };
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/gate-react.tsx"],"names":[],"mappings":";;;;;;AAYA,IAAM,WAAA,GAAc,cAAmC,IAAI,CAAA;AAGpD,SAAS,mBAAA,CAAoB;AAAA,EAClC,QAAA;AAAA,EACA;AACF,CAAA,EAGG;AACD,EAAA,2BACG,WAAA,CAAY,QAAA,EAAZ,EAAqB,KAAA,EAAO,UAAW,QAAA,EAAS,CAAA;AAErD;AASO,SAAS,WAAW,EAAA,EAAwB;AACjD,EAAA,MAAM,QAAA,GAAW,WAAW,WAAW,CAAA;AACvC,EAAA,IAAI,CAAC,QAAA;AACH,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,eAAe,EAAE,CAAA,yCAAA;AAAA,KACnB;AACF,EAAA,OAAO,YAAA,CAAa,UAAU,EAAE,CAAA;AAClC;AAyBO,SAAS,WAAA,CAAY;AAAA,EAC1B,OAAA;AAAA,EACA,QAAA;AAAA,EACA,MAAA;AAAA,EACA,QAAA,GAAW;AACb,CAAA,EAAqB;AACnB,EAAA,MAAM,MAAA,GAAS,WAAW,OAAO,CAAA;AACjC,EAAA,IAAI,MAAA,CAAO,EAAA,EAAI,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,QAAA,EAAS,CAAA;AAClC,EAAA,IAAI,MAAA,CAAO,MAAA,KAAW,aAAA,IAAiB,MAAA,CAAO,MAAA,IAAU,MAAA;AACtD,IAAA,uBAAO,GAAA,CAAA,QAAA,EAAA,EAAG,iBAAO,EAAE,GAAG,QAAQ,MAAA,EAAQ,MAAA,CAAO,MAAA,EAAQ,CAAA,EAAE,CAAA;AACzD,EAAA,uCAAU,QAAA,EAAA,QAAA,EAAS,CAAA;AACrB","file":"gate-react.js","sourcesContent":["/**\n * `@marktiderman/genesis-features/gate/react`: the gate's answers in React,\n * on the web and in React Native. The server computes a {@link GateSnapshot}\n * and the provider hands it down; components never decide on their own. To\n * refresh, give the provider a new snapshot: every `useFeature` below it\n * re-renders with the new answers.\n *\n * @stability Beta\n */\nimport { createContext, useContext, type ReactNode } from \"react\";\nimport { fromSnapshot, type GateAnswer, type GateSnapshot } from \"./gate\";\n\nconst GateContext = createContext<GateSnapshot | null>(null);\n\n/** Hands the session's gate answers to every {@link useFeature} below it. @stability Beta */\nexport function FeatureGateProvider({\n snapshot,\n children,\n}: {\n snapshot: GateSnapshot;\n children: ReactNode;\n}) {\n return (\n <GateContext.Provider value={snapshot}>{children}</GateContext.Provider>\n );\n}\n\n/**\n * The gate's answer for one feature. Outside a {@link FeatureGateProvider}\n * this throws: a missing provider would otherwise turn every feature off\n * without a word.\n *\n * @stability Beta\n */\nexport function useFeature(id: string): GateAnswer {\n const snapshot = useContext(GateContext);\n if (!snapshot)\n throw new Error(\n `useFeature(\"${id}\") needs a <FeatureGateProvider> above it`,\n );\n return fromSnapshot(snapshot, id);\n}\n\n/** @stability Beta */\nexport interface FeatureGateProps {\n /** The feature this content belongs to. */\n feature: string;\n children: ReactNode;\n /** Shown when a plan would unlock the feature: an upgrade prompt, a locked row. Defaults to `fallback`. */\n upsell?: (answer: GateAnswer & { unlock: { plan: string } }) => ReactNode;\n /** Shown for any other \"off\". Defaults to nothing. */\n fallback?: ReactNode;\n}\n\n/**\n * Renders `children` when the feature is on; `upsell` when a plan would turn\n * it on; otherwise `fallback`.\n *\n * ```tsx\n * <FeatureGate feature=\"form-webhook-delivery\" upsell={({ unlock }) => <UpgradeRow plan={unlock.plan} />}>\n * <WebhookSettings />\n * </FeatureGate>\n * ```\n *\n * @stability Beta\n */\nexport function FeatureGate({\n feature,\n children,\n upsell,\n fallback = null,\n}: FeatureGateProps) {\n const answer = useFeature(feature);\n if (answer.on) return <>{children}</>;\n if (answer.reason === \"entitlement\" && answer.unlock && upsell)\n return <>{upsell({ ...answer, unlock: answer.unlock })}</>;\n return <>{fallback}</>;\n}\n"]}
package/dist/gate.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"gate.js"}
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}