@marktiderman/genesis-features 0.9.1 → 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
package/dist/blocks.d.ts CHANGED
@@ -1,473 +1,7 @@
1
- import { F as FeaturePlatform } from './platforms-NR0liM8L.js';
2
- export { a as FEATURE_PLATFORMS } from './platforms-NR0liM8L.js';
3
- export { L as LayerPackage, M as ModuleMeta, a as PACKAGE_GROUPS, b as PACKAGE_LAYERS, c as PackageGroup, P as PackageLayer, d as PackageMeta, p as packageLayerProblems, e as readPackageMeta } from './packages-CWhdXtzS.js';
4
-
5
1
  /**
6
- * The typed sections content packs had before `sections`: session types,
7
- * metric templates, custom fields, forms and roadmap templates, each tied to a
8
- * block an app owns. Kept, and still checked as before, so packs written
9
- * against them keep working. New packs put their data in `sections`, keyed by
10
- * block id, and the block checks it.
2
+ * `@marktiderman/genesis-features/blocks`: renamed to `@marktiderman/genesis-config/blocks`.
11
3
  *
12
- * Everything here is deprecated and goes in the next major.
4
+ * @deprecated Import from `@marktiderman/genesis-config/blocks` instead: `npx genesis codemod
5
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
13
6
  */
14
-
15
- /**
16
- * A content pack's settings for one session type, with its agenda.
17
- * @deprecated Put session types in `sections` under the block that owns them, checked by that block's validator.
18
- * @stability Beta
19
- */
20
- interface ContentPackSessionType {
21
- key: string;
22
- kind: string;
23
- name: string;
24
- description?: string;
25
- defaultMinutes?: number;
26
- agenda: readonly {
27
- key: string;
28
- title: string;
29
- minutes: number;
30
- }[];
31
- }
32
- /**
33
- * A metric to start from.
34
- * @deprecated Put metric templates in `sections` under the block that owns them, checked by that block's validator.
35
- * @stability Beta
36
- */
37
- interface ContentPackMetricTemplate {
38
- key: string;
39
- name: string;
40
- unitType: string;
41
- unit?: string;
42
- cadence: string;
43
- goalDirection: string;
44
- goalValue?: number;
45
- goalMax?: number;
46
- measureKind?: string;
47
- rollup?: string;
48
- }
49
- /**
50
- * Where a custom field lives, and the block that owns that table.
51
- * @deprecated Custom fields belong in `sections` under the block that owns their table.
52
- * @stability Beta
53
- */
54
- declare const CONTENT_PACK_FIELD_TARGETS: {
55
- readonly pursuits: "pursuits";
56
- readonly work_items: "pursuits";
57
- readonly metrics: "metrics";
58
- readonly sessions: "sessions";
59
- };
60
- /**
61
- * @deprecated See {@link CONTENT_PACK_FIELD_TARGETS}.
62
- * @stability Beta
63
- */
64
- type ContentPackFieldTarget = keyof typeof CONTENT_PACK_FIELD_TARGETS;
65
- /**
66
- * A custom field: a genesis-forms serializable field, on one of the work tables.
67
- * @deprecated Put field definitions in `sections` under the block that owns their table.
68
- * @stability Beta
69
- */
70
- interface ContentPackFieldDefinition {
71
- key: string;
72
- target: ContentPackFieldTarget;
73
- label: string;
74
- /** A genesis-forms serializable field: type, options, validation. */
75
- field: {
76
- readonly type: string;
77
- readonly [key: string]: unknown;
78
- };
79
- required?: boolean;
80
- visibility: "tenant" | "app" | "private";
81
- }
82
- /**
83
- * A worksheet, assessment or form: a genesis-forms definition.
84
- * @deprecated Put forms in `sections` under the block that owns them.
85
- * @stability Beta
86
- */
87
- interface ContentPackForm {
88
- key: string;
89
- kind: "worksheet" | "assessment" | "form";
90
- title: string;
91
- definition: {
92
- readonly [key: string]: unknown;
93
- };
94
- scoring?: unknown;
95
- }
96
- /**
97
- * A roadmap to start from: items that release by a rule, linked to each other by key.
98
- * @deprecated Put roadmap templates in `sections` under the block that owns them, checked by that block's validator.
99
- * @stability Beta
100
- */
101
- interface ContentPackRoadmapTemplate {
102
- key: string;
103
- name: string;
104
- items: readonly {
105
- key: string;
106
- kind: string;
107
- title: string;
108
- /** Another item's key in this template. */
109
- ref?: string;
110
- release: {
111
- rule: string;
112
- afterDays?: number;
113
- anchor?: string;
114
- };
115
- }[];
116
- }
117
- /** The deprecated typed sections, as optional fields of a pack. */
118
- interface LegacyContentPackSections {
119
- /** @deprecated Use `sections`. */
120
- sessionTypes?: readonly ContentPackSessionType[];
121
- /** @deprecated Use `sections`. */
122
- metricTemplates?: readonly ContentPackMetricTemplate[];
123
- /** @deprecated Use `sections`. */
124
- fieldDefinitions?: readonly ContentPackFieldDefinition[];
125
- /** @deprecated Use `sections`. */
126
- forms?: readonly ContentPackForm[];
127
- /** @deprecated Use `sections`. */
128
- roadmapTemplates?: readonly ContentPackRoadmapTemplate[];
129
- }
130
-
131
- /**
132
- * Content packs: versioned data that fills installed blocks. A pack is code,
133
- * reviewed like any other: the publishing package exports it, and an installer
134
- * copies it into a tenant's editable rows, keeping each row's source (pack,
135
- * version, key) so an update can tell what a person changed.
136
- *
137
- * A pack's `sections` are keyed by the block that owns them, and each holds
138
- * that block's items. Genesis checks what every pack shares (id, version,
139
- * publisher, requires, labels, and a unique `key` on every item); what an item
140
- * holds is the block's business, checked by the validator the block registers
141
- * (`contributes.contentSection` on `defineBlock`, or a `validators` map).
142
- *
143
- * `defineContentPack` checks a pack's shape; `contentPackProblems` with the
144
- * installed blocks also checks that every block it fills is there. Keys, not
145
- * ids, link things together, and stay the same across versions.
146
- *
147
- * No zod here: packs ship to phones with `/blocks`.
148
- */
149
-
150
- /**
151
- * Checks one section's items for the block that owns it, and returns every
152
- * problem (an empty list when they're fine). Messages are relative to the
153
- * section ("weekly: minutes must be more than 0"): the checker puts the pack
154
- * and section in front. A validator that throws is reported as a problem.
155
- *
156
- * @stability Beta
157
- */
158
- type ContentPackSectionValidator = (items: readonly unknown[]) => readonly string[];
159
- /** A pack's sections: block id → that block's items. @stability Beta */
160
- type ContentPackSections = Readonly<Record<string, readonly unknown[]>>;
161
- /** One content pack, as its publisher defines it. @stability Beta */
162
- interface ContentPackDef extends LegacyContentPackSections {
163
- /** Kebab-case, unique per publisher. */
164
- id: string;
165
- name: string;
166
- description?: string;
167
- /** Semver. Updates are additive. */
168
- version: string;
169
- /** The package that publishes it. */
170
- publisher: string;
171
- /** The block ids it fills; installing is refused unless every one is installed. */
172
- requires: readonly string[];
173
- /** Taxonomy: label key → display text, e.g. `"project.phase": "Stage"`. */
174
- labels?: Readonly<Record<string, string>>;
175
- /**
176
- * The data it fills, by block id. Every item has a `key`, unique in its
177
- * section and the same across versions; the rest is checked by the block's
178
- * validator.
179
- */
180
- sections?: ContentPackSections;
181
- }
182
- /** @stability Beta */
183
- interface ContentPackCheckOptions {
184
- /** The installed blocks: every block the pack requires must be one. */
185
- installed?: EnabledBlocks;
186
- /** Blocks whose `contributes.contentSection` checks their section's items. */
187
- blocks?: readonly BlockDef<string, unknown>[];
188
- /** Section validators by block id; these win over a block's own. */
189
- validators?: Readonly<Record<string, ContentPackSectionValidator>>;
190
- }
191
- /** Thrown by {@link defineContentPack}; lists every problem at once. @stability Beta */
192
- declare class ContentPackError extends Error {
193
- readonly problems: string[];
194
- constructor(problems: string[]);
195
- }
196
- /** The block ids a pack's sections need, whatever it declares. @stability Beta */
197
- declare function contentPackBlocks(pack: ContentPackDef): string[];
198
- /**
199
- * Every problem with a pack: its shape, each section's items (through the
200
- * validator its block registers, when given) and, given the installed blocks,
201
- * any block it fills that isn't installed. An empty list means it can be
202
- * installed. The second argument is the installed blocks, or options.
203
- *
204
- * @stability Beta
205
- */
206
- declare function contentPackProblems(pack: ContentPackDef, installedOrOptions?: EnabledBlocks | ContentPackCheckOptions): string[];
207
- /**
208
- * Declare a content pack: returns it unchanged, typed, after checking its
209
- * shape (throws a {@link ContentPackError} listing every problem). Give the
210
- * blocks it fills, or validators by block id, to check each section's items
211
- * too. Whether its blocks are installed is checked at install time with
212
- * {@link contentPackProblems}.
213
- *
214
- * ```ts
215
- * export const weeklyTeamRhythm = defineContentPack({
216
- * id: "weekly-team-rhythm", name: "Weekly team rhythm", version: "1.0.0",
217
- * publisher: "@acme/content", requires: ["meetings"],
218
- * labels: { "project.phase": "Stage" },
219
- * sections: { meetings: [{ key: "weekly", name: "Weekly meeting", minutes: 60 }] },
220
- * }, { blocks: [meetingsBlock] });
221
- * ```
222
- *
223
- * @stability Beta
224
- */
225
- declare function defineContentPack<const T extends ContentPackDef>(pack: T, options?: Omit<ContentPackCheckOptions, "installed">): T;
226
-
227
- /**
228
- * A navigation entry a block offers. The app's nav tree places it (by the
229
- * block's FeatureId and this id); a block never decides where it goes.
230
- * `id`, `label` and `path` match genesis-core's `NavigationNode`.
231
- *
232
- * @stability Beta
233
- */
234
- interface BlockNavItem {
235
- /** Unique across every enabled block. */
236
- id: string;
237
- label: string;
238
- path: string;
239
- /** An icon name the app's icon set knows. */
240
- icon?: string;
241
- /** Lower first. Default 0. */
242
- order?: number;
243
- /**
244
- * The navigation zone the entry lands in (ADR 0003): an id from the app's
245
- * zones (`NavigationZone`, genesis-core/navigation), copied to the tree node
246
- * the app builds from it, so a module's pages sit in their zone with no app
247
- * wiring. Unset: a global page.
248
- *
249
- * @stability Beta
250
- */
251
- zone?: string;
252
- }
253
- /**
254
- * A Settings row a block offers, placed in the section with id `section`
255
- * (`"account"`, `"about"`, or one of the app's own; an unknown id becomes a
256
- * new section at the end).
257
- *
258
- * @stability Beta
259
- */
260
- interface BlockSettingsRow {
261
- /** Unique across every enabled block. */
262
- id: string;
263
- section: string;
264
- title: string;
265
- subtitle?: string;
266
- /**
267
- * A hook giving a subtitle that changes (a version, a count). It is called
268
- * on every render of the Settings screen, in block order, so the set of
269
- * blocks must not change while the app runs (shells read them once).
270
- */
271
- useSubtitle?: () => string | null | undefined;
272
- /** Where tapping the row goes, as a path. */
273
- href?: string;
274
- /** Lower first within its section. Default 0. */
275
- order?: number;
276
- testID?: string;
277
- }
278
- /**
279
- * A screen a block's feature needs the app to route to. On file-based
280
- * routers the app owns the route file; this is the declaration a check (or
281
- * a deep-link allowlist) reads.
282
- *
283
- * @stability Beta
284
- */
285
- interface BlockRoute {
286
- path: string;
287
- /** What the screen is for, in a few words. */
288
- description?: string;
289
- /** `true` when only a signed-in person can open it. */
290
- signedIn?: boolean;
291
- }
292
- /**
293
- * A SQL migration a block needs, shipped in a package: copy it into the
294
- * app's `supabase/migrations/` under a timestamped name.
295
- *
296
- * @stability Beta
297
- */
298
- interface BlockMigration {
299
- /** The npm package that ships it, e.g. `@marktiderman/genesis-supabase`. */
300
- package: string;
301
- /** Its path in the package, e.g. `migrations/0002_genesis_app_release_policy.sql`. */
302
- file: string;
303
- /** Its pgTAP test in the package, if any. */
304
- test?: string;
305
- }
306
- /**
307
- * One kind of data a block collects, for the App Store privacy label and the
308
- * Play data safety form.
309
- *
310
- * @stability Beta
311
- */
312
- interface BlockDataUse {
313
- /** What, in the stores' words: `"email address"`, `"user id"`, `"crash data"`. */
314
- type: string;
315
- /** Why: `"app functionality"`, `"analytics"`, … */
316
- purposes: readonly string[];
317
- /** Tied to the person's identity. */
318
- linked: boolean;
319
- /** Used to track the person across other companies' apps. */
320
- tracking: boolean;
321
- }
322
- /** What a block means for privacy. @stability Beta */
323
- interface BlockPrivacy {
324
- collects?: readonly BlockDataUse[];
325
- /** Anything a reviewer or a privacy policy should say, one sentence each. */
326
- notes?: readonly string[];
327
- }
328
- /**
329
- * What a block adds to an app. Every key is optional. `S` is what a slot is
330
- * filled with on the consuming platform (a React component on native and web).
331
- *
332
- * @stability Beta
333
- */
334
- interface BlockContributions<S = unknown> {
335
- nav?: readonly BlockNavItem[];
336
- settings?: readonly BlockSettingsRow[];
337
- routes?: readonly BlockRoute[];
338
- /**
339
- * Fills for the host shell's slots, by slot name (e.g. `fatal` on
340
- * `GenesisNativeApp`). The app's own `slots` always win over a block's.
341
- */
342
- slots?: Readonly<Record<string, S>>;
343
- migrations?: readonly BlockMigration[];
344
- /** Agent skills that come with it: repo or package paths to a `SKILL.md`. */
345
- skills?: readonly string[];
346
- privacy?: BlockPrivacy;
347
- /**
348
- * Checks this block's section of a content pack (`sections[<block id>]`):
349
- * returns every problem with its items. `defineContentPack` and
350
- * `contentPackProblems` run it when given the block.
351
- */
352
- contentSection?: ContentPackSectionValidator;
353
- }
354
- /**
355
- * One block. `id` is the block's FeatureId: the same id as its entry in the
356
- * feature registry.
357
- *
358
- * @stability Beta
359
- */
360
- interface BlockDef<Id extends string = string, S = unknown> {
361
- readonly id: Id;
362
- /**
363
- * What must be on with it: other blocks' ids, or features the app owns that
364
- * aren't blocks. A requirement that is a block must be enabled (and on this
365
- * platform); one that isn't a block must be listed in `enabled`. A
366
- * requirement that is neither is an error, so a forgotten block is loud.
367
- */
368
- readonly requires?: readonly string[];
369
- readonly contributes?: BlockContributions<S>;
370
- /** Where it runs. Default every platform. */
371
- readonly platforms?: readonly FeaturePlatform[];
372
- }
373
- /** Thrown by {@link defineBlock} and {@link resolveBlocks}; lists every problem at once. @stability Beta */
374
- declare class BlockError extends Error {
375
- readonly problems: string[];
376
- constructor(problems: string[]);
377
- }
378
- /**
379
- * Declare a block. Validates it (id, requirements, platforms, contribution
380
- * keys and duplicate ids within the block) and returns it frozen, so a
381
- * typo fails where the block is written rather than where it is used:
382
- *
383
- * ```ts
384
- * export const supportBlock = defineBlock({
385
- * id: "support",
386
- * requires: ["account"],
387
- * platforms: ["web", "native"],
388
- * contributes: {
389
- * settings: [{ id: "contact-support", section: "about", title: "Contact support", href: "/support" }],
390
- * routes: [{ path: "/support", signedIn: true }],
391
- * migrations: [{ package: "@acme/support", file: "migrations/0001_support.sql" }],
392
- * },
393
- * });
394
- * ```
395
- *
396
- * To check `id` against the app's registry at compile time, give the
397
- * FeatureId: `defineBlock<FeatureId>({ … })`. `S` is what slots are filled
398
- * with, inferred from `contributes.slots` (a component on native and web).
399
- *
400
- * @stability Beta
401
- */
402
- declare function defineBlock<const Id extends string, S = never>(block: BlockDef<Id, S>): BlockDef<Id, S>;
403
- /** Which blocks are on: ids, a predicate, or (left out) every block given. @stability Beta */
404
- type EnabledBlocks = Iterable<string> | ((id: string) => boolean);
405
- /** @stability Beta */
406
- interface ResolveBlocksOptions {
407
- /** Keep only blocks that run here. A required block that doesn't is a missing requirement. */
408
- platform?: FeaturePlatform;
409
- /**
410
- * The app's feature registry (`features` from `defineFeatures`): every block
411
- * id and requirement must be one of its ids.
412
- */
413
- features?: Readonly<Record<string, unknown>>;
414
- /**
415
- * A block whose requirement is off: `throw` (default: a set-up mistake, found
416
- * at launch) or `drop` it, and every block needing it, listing each in
417
- * `dropped` (for switches that change at run time, such as a tenant turning
418
- * a feature off).
419
- */
420
- missing?: "throw" | "drop";
421
- /**
422
- * The host's slot names (e.g. `GenesisNativeApp`'s). A block filling any
423
- * other slot is an error, so a typo doesn't fill nothing silently.
424
- */
425
- slots?: readonly string[];
426
- }
427
- /** A contribution with the FeatureId of the block it came from. @stability Beta */
428
- type Contributed<T, Id extends string = string> = T & {
429
- readonly feature: Id;
430
- };
431
- /** @stability Beta */
432
- interface ResolvedBlocks<B extends BlockDef<string, unknown> = BlockDef> {
433
- /** The enabled blocks, in dependency order (a block after what it requires). */
434
- readonly blocks: readonly B[];
435
- readonly ids: ReadonlySet<B["id"]>;
436
- has(id: string): boolean;
437
- /** One block's contributions, or `undefined` when it isn't on. */
438
- contributionsOf(id: B["id"]): NonNullable<B["contributes"]> | undefined;
439
- /** Nav entries by `order`, then block order. Place them in the app's tree by `feature` and `id`. */
440
- readonly nav: readonly Contributed<BlockNavItem, B["id"]>[];
441
- /** Settings rows by `order`, then block order. */
442
- readonly settings: readonly Contributed<BlockSettingsRow, B["id"]>[];
443
- readonly routes: readonly Contributed<BlockRoute, B["id"]>[];
444
- /** Slot fills by slot name. Two blocks filling one slot is an error. */
445
- readonly slots: Readonly<Record<string, SlotOf<B>>>;
446
- readonly migrations: readonly Contributed<BlockMigration, B["id"]>[];
447
- readonly skills: readonly Contributed<{
448
- path: string;
449
- }, B["id"]>[];
450
- readonly privacy: readonly Contributed<BlockPrivacy, B["id"]>[];
451
- /** With `missing: "drop"`: blocks left out, and the requirements that were off. */
452
- readonly dropped: readonly {
453
- id: B["id"];
454
- missing: readonly string[];
455
- }[];
456
- }
457
- type SlotOf<B> = B extends BlockDef<string, infer S> ? S : never;
458
- /**
459
- * The blocks that are on, checked and merged:
460
- *
461
- * - every block is valid ({@link defineBlock}'s checks, for blocks built by hand) and its id is unique;
462
- * - `requires` has no cycles, and with `features`, names real features;
463
- * - every enabled block's requirements are on (see {@link ResolveBlocksOptions.missing});
464
- * - no two enabled blocks contribute the same nav id, settings row id, route path or slot.
465
- *
466
- * `enabled` left out means every block given is on (and no app feature that
467
- * isn't a block). Throws a {@link BlockError} listing every problem at once.
468
- *
469
- * @stability Beta
470
- */
471
- declare function resolveBlocks<B extends BlockDef<string, unknown>>(blocks: readonly B[], enabled?: EnabledBlocks, options?: ResolveBlocksOptions): ResolvedBlocks<B>;
472
-
473
- export { type BlockContributions, type BlockDataUse, type BlockDef, BlockError, type BlockMigration, type BlockNavItem, type BlockPrivacy, type BlockRoute, type BlockSettingsRow, CONTENT_PACK_FIELD_TARGETS, type ContentPackCheckOptions, type ContentPackDef, ContentPackError, type ContentPackFieldDefinition, type ContentPackFieldTarget, type ContentPackForm, type ContentPackMetricTemplate, type ContentPackRoadmapTemplate, type ContentPackSectionValidator, type ContentPackSections, type ContentPackSessionType, type Contributed, type EnabledBlocks, FeaturePlatform, type ResolveBlocksOptions, type ResolvedBlocks, contentPackBlocks, contentPackProblems, defineBlock, defineContentPack, resolveBlocks };
7
+ export * from "@marktiderman/genesis-config/blocks";
package/dist/blocks.js CHANGED
@@ -1,5 +1,7 @@
1
- export { BlockError, CONTENT_PACK_FIELD_TARGETS, ContentPackError, PACKAGE_GROUPS, PACKAGE_LAYERS, contentPackBlocks, contentPackProblems, defineBlock, defineContentPack, packageLayerProblems, readPackageMeta, resolveBlocks } from './chunk-Z3TTDIVM.js';
2
- import './chunk-VYUX7VAX.js';
3
- export { FEATURE_PLATFORMS } from './chunk-B6WRD3WF.js';
4
- //# sourceMappingURL=blocks.js.map
5
- //# sourceMappingURL=blocks.js.map
1
+ /**
2
+ * `@marktiderman/genesis-features/blocks`: renamed to `@marktiderman/genesis-config/blocks`.
3
+ *
4
+ * @deprecated Import from `@marktiderman/genesis-config/blocks` instead: `npx genesis codemod
5
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
6
+ */
7
+ export * from "@marktiderman/genesis-config/blocks";
@@ -1,48 +1,7 @@
1
- import * as react from 'react';
2
- import { ReactNode } from 'react';
3
- import { G as GateAnswer, a as GateSnapshot } from './gate-oYFzQKyb.js';
4
- import './types-Bd766VxF.js';
5
- import './platforms-NR0liM8L.js';
6
-
7
- /** Hands the session's gate answers to every {@link useFeature} below it. @stability Beta */
8
- declare function FeatureGateProvider({ snapshot, children, }: {
9
- snapshot: GateSnapshot;
10
- children: ReactNode;
11
- }): react.JSX.Element;
12
1
  /**
13
- * The gate's answer for one feature. Outside a {@link FeatureGateProvider}
14
- * this throws: a missing provider would otherwise turn every feature off
15
- * without a word.
2
+ * `@marktiderman/genesis-features/gate/react`: renamed to `@marktiderman/genesis-config/gate/react`.
16
3
  *
17
- * @stability Beta
4
+ * @deprecated Import from `@marktiderman/genesis-config/gate/react` instead: `npx genesis codemod
5
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
18
6
  */
19
- declare function useFeature(id: string): GateAnswer;
20
- /** @stability Beta */
21
- interface FeatureGateProps {
22
- /** The feature this content belongs to. */
23
- feature: string;
24
- children: ReactNode;
25
- /** Shown when a plan would unlock the feature: an upgrade prompt, a locked row. Defaults to `fallback`. */
26
- upsell?: (answer: GateAnswer & {
27
- unlock: {
28
- plan: string;
29
- };
30
- }) => ReactNode;
31
- /** Shown for any other "off". Defaults to nothing. */
32
- fallback?: ReactNode;
33
- }
34
- /**
35
- * Renders `children` when the feature is on; `upsell` when a plan would turn
36
- * it on; otherwise `fallback`.
37
- *
38
- * ```tsx
39
- * <FeatureGate feature="form-webhook-delivery" upsell={({ unlock }) => <UpgradeRow plan={unlock.plan} />}>
40
- * <WebhookSettings />
41
- * </FeatureGate>
42
- * ```
43
- *
44
- * @stability Beta
45
- */
46
- declare function FeatureGate({ feature, children, upsell, fallback, }: FeatureGateProps): react.JSX.Element;
47
-
48
- export { FeatureGate, type FeatureGateProps, FeatureGateProvider, useFeature };
7
+ export * from "@marktiderman/genesis-config/gate/react";
@@ -1,37 +1,8 @@
1
1
  "use client";
2
- import { fromSnapshot } from './chunk-YTPGUU5F.js';
3
- import './chunk-OW46SL2G.js';
4
- import { createContext, useContext } from 'react';
5
- import { jsx, Fragment } from 'react/jsx-runtime';
6
-
7
- var GateContext = createContext(null);
8
- function FeatureGateProvider({
9
- snapshot,
10
- children
11
- }) {
12
- return /* @__PURE__ */ jsx(GateContext.Provider, { value: snapshot, children });
13
- }
14
- function useFeature(id) {
15
- const snapshot = useContext(GateContext);
16
- if (!snapshot)
17
- throw new Error(
18
- `useFeature("${id}") needs a <FeatureGateProvider> above it`
19
- );
20
- return fromSnapshot(snapshot, id);
21
- }
22
- function FeatureGate({
23
- feature,
24
- children,
25
- upsell,
26
- fallback = null
27
- }) {
28
- const answer = useFeature(feature);
29
- if (answer.on) return /* @__PURE__ */ jsx(Fragment, { children });
30
- if (answer.reason === "entitlement" && answer.unlock && upsell)
31
- return /* @__PURE__ */ jsx(Fragment, { children: upsell({ ...answer, unlock: answer.unlock }) });
32
- return /* @__PURE__ */ jsx(Fragment, { children: fallback });
33
- }
34
-
35
- export { FeatureGate, FeatureGateProvider, useFeature };
36
- //# sourceMappingURL=gate-react.js.map
37
- //# sourceMappingURL=gate-react.js.map
2
+ /**
3
+ * `@marktiderman/genesis-features/gate/react`: renamed to `@marktiderman/genesis-config/gate/react`.
4
+ *
5
+ * @deprecated Import from `@marktiderman/genesis-config/gate/react` instead: `npx genesis codemod
6
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
7
+ */
8
+ export * from "@marktiderman/genesis-config/gate/react";
package/dist/gate.d.ts CHANGED
@@ -1,18 +1,7 @@
1
- export { F as FeatureOff, G as GateAnswer, b as GateContext, c as GateFeature, d as GateFlag, e as GateReason, f as GateRegistry, a as GateSnapshot, g as GateSnapshotOptions, I as IdSet, S as SHIPPED_STATUSES, h as featureOn, i as fromSnapshot, j as gateSnapshot, k as isSnapshotStale, r as requireFeature } from './gate-oYFzQKyb.js';
2
- import { a as FeatureStatus } from './types-Bd766VxF.js';
3
- import { F as FeaturePlatform } from './platforms-NR0liM8L.js';
4
- export { a as FEATURE_PLATFORMS } from './platforms-NR0liM8L.js';
5
-
6
1
  /**
7
- * A feature's status on one platform, or undefined when it isn't there.
8
- * Zod-free so the gate can use it on phones and in browsers.
2
+ * `@marktiderman/genesis-features/gate`: renamed to `@marktiderman/genesis-config/gate`.
9
3
  *
10
- * @stability Beta
4
+ * @deprecated Import from `@marktiderman/genesis-config/gate` instead: `npx genesis codemod
5
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
11
6
  */
12
- declare function statusOn(def: {
13
- status: FeatureStatus;
14
- apps: readonly string[];
15
- platforms?: Partial<Record<FeaturePlatform, FeatureStatus>>;
16
- }, platform: FeaturePlatform): FeatureStatus | undefined;
17
-
18
- export { FeaturePlatform, statusOn };
7
+ export * from "@marktiderman/genesis-config/gate";
package/dist/gate.js CHANGED
@@ -1,5 +1,7 @@
1
- export { FeatureOff, SHIPPED_STATUSES, featureOn, fromSnapshot, gateSnapshot, isSnapshotStale, requireFeature } from './chunk-YTPGUU5F.js';
2
- export { FEATURE_PLATFORMS } from './chunk-B6WRD3WF.js';
3
- export { statusOn } from './chunk-OW46SL2G.js';
4
- //# sourceMappingURL=gate.js.map
5
- //# sourceMappingURL=gate.js.map
1
+ /**
2
+ * `@marktiderman/genesis-features/gate`: renamed to `@marktiderman/genesis-config/gate`.
3
+ *
4
+ * @deprecated Import from `@marktiderman/genesis-config/gate` instead: `npx genesis codemod
5
+ * genesis-features-renamed-genesis-config` moves an app's imports. This alias goes after 0.11.
6
+ */
7
+ export * from "@marktiderman/genesis-config/gate";