@sparkletree/cli 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/add.d.ts +0 -2
- package/dist/add.d.ts.map +1 -1
- package/dist/add.js +1 -5
- package/dist/add.js.map +1 -1
- package/dist/fixtures-0.8.0.d.ts +8 -0
- package/dist/fixtures-0.8.0.d.ts.map +1 -0
- package/dist/fixtures-0.8.0.js +195 -0
- package/dist/fixtures-0.8.0.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/registry.d.ts.map +1 -1
- package/dist/registry.js +15 -31
- package/dist/registry.js.map +1 -1
- package/dist/upgrade.d.ts +13 -6
- package/dist/upgrade.d.ts.map +1 -1
- package/dist/upgrade.js +88 -9
- package/dist/upgrade.js.map +1 -1
- package/package.json +1 -1
package/dist/add.d.ts
CHANGED
|
@@ -33,6 +33,4 @@ export interface AddResult {
|
|
|
33
33
|
export declare function add(names: string[], options?: AddOptions): Promise<AddResult>;
|
|
34
34
|
/** Human-readable summary. Mirrors what `add` actually did. */
|
|
35
35
|
export declare function formatAddResult(result: AddResult, dryRun?: boolean): string;
|
|
36
|
-
/** Where `add` would write, for `--help` and for tests. */
|
|
37
|
-
export declare function targetPathFor(component: RegistryComponent, targetDir?: string): string;
|
|
38
36
|
//# sourceMappingURL=add.d.ts.map
|
package/dist/add.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.d.ts","sourceRoot":"","sources":["../src/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAKH,OAAO,EAA2B,KAAK,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEhF,MAAM,WAAW,UAAU;IACzB,uDAAuD;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,SAAS,CAAC,EAAE,MAAM,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DvF;AAED,+DAA+D;AAC/D,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,MAAM,UAAQ,GAAG,MAAM,CA8BzE"}
|
package/dist/add.js
CHANGED
|
@@ -90,11 +90,7 @@ export function formatAddResult(result, dryRun = false) {
|
|
|
90
90
|
if (result.dependencies.length) {
|
|
91
91
|
lines.push("", "Install these if you haven't already:", ` ${result.dependencies.join(" ")}`);
|
|
92
92
|
}
|
|
93
|
-
lines.push("", "These files are yours — edit them freely. Streaming, timing and the", "
|
|
93
|
+
lines.push("", "These files are yours — edit them freely. Streaming, timing and the", "provenance stamps live in @sparkletree/core, so upgrades reach you", "without re-copying anything. (A visible AI-disclosure mark is opt-in:", "render InlineMark from @sparkletree/react where decideChrome says so.)", "", "The default classNames assume Tailwind CSS — swap them freely if you", "style with something else.");
|
|
94
94
|
return lines.join("\n");
|
|
95
95
|
}
|
|
96
|
-
/** Where `add` would write, for `--help` and for tests. */
|
|
97
|
-
export function targetPathFor(component, targetDir = "components") {
|
|
98
|
-
return join(targetDir, component.files[0].path);
|
|
99
|
-
}
|
|
100
96
|
//# sourceMappingURL=add.js.map
|
package/dist/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../src/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAE9E,OAAO,EAAE,uBAAuB,EAA0B,MAAM,eAAe,CAAC;AAkBhF,iEAAiE;AACjE,KAAK,UAAU,QAAQ,CAAC,IAAY;IAClC,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC;QAC9B,OAAO,IAAI,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AAK,MAAM,IAAI,IAAI,MAAM,CAAC,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAC7D,CAAC;IACD,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC;QAC1B,KAAK,CAAC,IAAI,CAAC,EAAE,EAAE,UAAU,CAAC,CAAC;QAC3B,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,OAAO;YAAE,KAAK,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC;IACnF,CAAC;IACD,IAAI,MAAM,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QAC/B,KAAK,CAAC,IAAI,CACR,EAAE,EACF,uCAAuC,EACvC,KAAK,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CACrC,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,IAAI,CACR,EAAE,EACF,qEAAqE,EACrE,oEAAoE,EACpE,uEAAuE,EACvE,wEAAwE,EACxE,EAAE,EACF,sEAAsE,EACtE,4BAA4B,CAC7B,CAAC;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files `add` ACTUALLY wrote at v0.8.0, extracted from the registry
|
|
3
|
+
* byte for byte (same doctrine as fixtures-0.5.0.ts: only the real output
|
|
4
|
+
* can falsify the codemod's `find` claims). Do not "tidy" these.
|
|
5
|
+
*/
|
|
6
|
+
export declare const HERO_080 = "\"use client\";\n\nimport { StreamText, useIsland, withReserve, type UseIslandOptions } from \"@sparkletree/react\";\nimport type { FieldState } from \"@sparkletree/react\";\nimport { safeActionUrl, themeStyle } from \"@sparkletree/core\";\n\n/**\n * Your hero. Edit freely \u2014 this file is yours.\n *\n * What you should NOT need to touch, and what you will not find here: when the\n * copy paints, how long it holds, whether it types or lands composed, and the\n * provenance every adapted field carries. All of that lives in\n * @sparkletree/core and @sparkletree/react so it can be fixed for you without\n * you re-copying this file. No visible AI-disclosure mark renders by default \u2014\n * if you want one, render `InlineMark` from @sparkletree/react where\n * `decideChrome(field.source, prefersStandard).marked` is true.\n *\n * `fallback` is required. There is no loading state and no skeleton: if the\n * network is slow or the campaign is unreachable, this copy is what your\n * visitor reads. Write it as if it were the only version \u2014 often it is.\n *\n * Requires Tailwind CSS for the default classes \u2014 swap them freely.\n */\nexport interface HeroProps {\n campaignId: string;\n /** First paint. Real copy, never a placeholder. */\n fallback: UseIslandOptions[\"fallback\"];\n}\n\nexport function Hero({ campaignId, fallback }: HeroProps) {\n const { state, ref } = useIsland({ campaignId, island: \"hero\", fallback });\n const backgroundImage = safeActionUrl(state.backgroundImage);\n\n // The hold RESERVES (LAYOUT-DOCTRINE.md): while the canvas waits, each\n // field carries its fallback so StreamText keeps the geometry invisibly \u2014\n // nothing below the hero moves whichever way the wait ends. Delete this\n // and the section collapses during the hold; it is load-bearing.\n const holding = state.phase === \"holding\";\n const reserveOf = (name: \"greeting\" | \"headline\" | \"body\") =>\n state.held?.[name] || fallback[name];\n const held = (field: FieldState, reserve?: string) =>\n holding && reserve && !field.text ? withReserve(field, reserve) : field;\n\n return (\n <section\n ref={ref}\n className=\"relative overflow-hidden rounded-2xl p-10\"\n style={themeStyle(state.theme)}\n >\n {backgroundImage ? (\n <img\n src={backgroundImage}\n alt=\"\"\n className=\"absolute inset-0 h-full w-full object-cover\"\n />\n ) : null}\n\n <div className=\"relative\">\n {state.fields.greeting.text || (holding && reserveOf(\"greeting\")) ? (\n <StreamText\n field={held(state.fields.greeting, reserveOf(\"greeting\"))}\n as=\"p\"\n className=\"text-sm uppercase tracking-wide opacity-80\"\n />\n ) : null}\n\n {/* h2 to match the packaged Hero. The heading level is yours: pass\n as=\"h1\" if this section is your page's primary heading. */}\n <StreamText\n field={held(state.fields.headline, reserveOf(\"headline\"))}\n as=\"h2\"\n className=\"mt-2 text-4xl font-semibold\"\n />\n\n {state.fields.body.text || (holding && reserveOf(\"body\")) ? (\n <StreamText\n field={held(state.fields.body, reserveOf(\"body\"))}\n as=\"p\"\n className=\"mt-4 max-w-prose\"\n />\n ) : null}\n </div>\n </section>\n );\n}\n";
|
|
7
|
+
export declare const CTA_080 = "\"use client\";\n\nimport { StreamText, useIsland, useSparkletree, withReserve, type UseIslandOptions } from \"@sparkletree/react\";\nimport { readableTextColor, safeActionUrl, themeStyle, track } from \"@sparkletree/core\";\n\n/**\n * Your call to action. Edit freely.\n *\n * The button keeps its size while the label streams in, so the surrounding\n * layout does not shift under the visitor's cursor mid-click.\n *\n * Requires Tailwind CSS for the default classes \u2014 swap them freely.\n */\nexport interface CtaProps extends Omit<UseIslandOptions, \"island\"> {\n /** Where the button goes when the server has not resolved an action. */\n href?: string;\n onClick?: () => void;\n}\n\nexport function Cta(props: CtaProps) {\n const { href, onClick, ...islandOptions } = props;\n const { apiBase, organizationId } = useSparkletree();\n const { state, ref } = useIsland({ ...islandOptions, island: \"cta\" });\n // A rejected server action falls back to the href prop you control. The\n // prop is vetted too \u2014 the same render path, the same rules, one outcome.\n const action = safeActionUrl(state.ctaAction) ?? safeActionUrl(href);\n const { campaignId, surfaceId } = islandOptions;\n const variantId = state.variantId ?? undefined;\n // A surface-only Cta has no campaignId prop, but the click must still be\n // attributed: the server names the campaign it served in the terminal\n // done.meta, mirroring the impression path in useIsland.\n const metaCampaignId =\n typeof state.meta?.campaignId === \"string\" ? state.meta.campaignId : undefined;\n const resolvedCampaignId = campaignId ?? metaCampaignId;\n\n // The click is the other half of CTR. The SDK tells the server to suppress\n // its own counting for this page view \u2014 so if nothing here reports the\n // click, CTR for SDK traffic is a division by silence. Fire-and-forget:\n // track never throws and never blocks the navigation.\n const handleClick = () => {\n if (resolvedCampaignId) {\n void track(\n { apiBase, organizationId, campaignId: resolvedCampaignId, variantId, surfaceId },\n \"click\",\n { island: \"cta\" },\n );\n }\n onClick?.();\n };\n\n // The hold RESERVES (LAYOUT-DOCTRINE.md): a holding label rides the\n // fallback into StreamText invisibly, so the button keeps the size its\n // label will need. Delete this and the button collapses during the hold.\n const holding = state.phase === \"holding\";\n const ctaReserve = state.held?.cta || islandOptions.fallback.cta;\n const reserved = holding && !!ctaReserve && !state.fields.cta.text;\n const labelField = reserved\n ? withReserve(state.fields.cta, ctaReserve as string)\n : state.fields.cta;\n\n // Shared by the link and the no-destination fallback below.\n const shared = {\n onClick: handleClick,\n className:\n \"inline-flex min-h-11 min-w-40 items-center justify-center rounded-full px-6 font-medium\",\n style: {\n ...themeStyle(state.theme),\n // --st-cta-text is the label ink that reads on the theme's primary, so\n // a light theme can never produce a ghost button.\n ...(state.theme?.colors?.primary\n ? { [\"--st-cta-text\" as string]: readableTextColor(state.theme.colors.primary) }\n : {}),\n },\n // A CTA whose label is still empty is not yet a button a viewer can\n // meaningfully act on \u2014 but it must still occupy its space, or the\n // layout shifts when the copy lands.\n // A reserved button is full-size but its visible label is a hidden\n // reservation outside the a11y tree \u2014 never a NAMELESS control: the\n // reservation text is the honest accessible name.\n \"aria-disabled\": state.fields.cta.text ? undefined : true,\n \"aria-label\": reserved ? (ctaReserve as string) : undefined,\n };\n\n // Neither the stream nor you resolved a destination: render a\n // non-interactive element rather than an inert <a> with no href, which\n // some assistive tech still announces as a link to nowhere. Clicks are\n // still observed \u2014 engagement with the creative counts toward CTR whether\n // or not it navigates.\n if (action === undefined) {\n return (\n <span ref={ref as unknown as (element: HTMLSpanElement | null) => void} {...shared}>\n <StreamText field={labelField} />\n </span>\n );\n }\n\n return (\n <a ref={ref} href={action} {...shared}>\n <StreamText field={labelField} />\n </a>\n );\n}\n";
|
|
8
|
+
//# sourceMappingURL=fixtures-0.8.0.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures-0.8.0.d.ts","sourceRoot":"","sources":["../src/fixtures-0.8.0.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,QAAQ,03GAqFpB,CAAC;AAEF,eAAO,MAAM,OAAO,y5IAsGnB,CAAC"}
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The files `add` ACTUALLY wrote at v0.8.0, extracted from the registry
|
|
3
|
+
* byte for byte (same doctrine as fixtures-0.5.0.ts: only the real output
|
|
4
|
+
* can falsify the codemod's `find` claims). Do not "tidy" these.
|
|
5
|
+
*/
|
|
6
|
+
export const HERO_080 = `"use client";
|
|
7
|
+
|
|
8
|
+
import { StreamText, useIsland, withReserve, type UseIslandOptions } from "@sparkletree/react";
|
|
9
|
+
import type { FieldState } from "@sparkletree/react";
|
|
10
|
+
import { safeActionUrl, themeStyle } from "@sparkletree/core";
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Your hero. Edit freely — this file is yours.
|
|
14
|
+
*
|
|
15
|
+
* What you should NOT need to touch, and what you will not find here: when the
|
|
16
|
+
* copy paints, how long it holds, whether it types or lands composed, and the
|
|
17
|
+
* provenance every adapted field carries. All of that lives in
|
|
18
|
+
* @sparkletree/core and @sparkletree/react so it can be fixed for you without
|
|
19
|
+
* you re-copying this file. No visible AI-disclosure mark renders by default —
|
|
20
|
+
* if you want one, render \`InlineMark\` from @sparkletree/react where
|
|
21
|
+
* \`decideChrome(field.source, prefersStandard).marked\` is true.
|
|
22
|
+
*
|
|
23
|
+
* \`fallback\` is required. There is no loading state and no skeleton: if the
|
|
24
|
+
* network is slow or the campaign is unreachable, this copy is what your
|
|
25
|
+
* visitor reads. Write it as if it were the only version — often it is.
|
|
26
|
+
*
|
|
27
|
+
* Requires Tailwind CSS for the default classes — swap them freely.
|
|
28
|
+
*/
|
|
29
|
+
export interface HeroProps {
|
|
30
|
+
campaignId: string;
|
|
31
|
+
/** First paint. Real copy, never a placeholder. */
|
|
32
|
+
fallback: UseIslandOptions["fallback"];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function Hero({ campaignId, fallback }: HeroProps) {
|
|
36
|
+
const { state, ref } = useIsland({ campaignId, island: "hero", fallback });
|
|
37
|
+
const backgroundImage = safeActionUrl(state.backgroundImage);
|
|
38
|
+
|
|
39
|
+
// The hold RESERVES (LAYOUT-DOCTRINE.md): while the canvas waits, each
|
|
40
|
+
// field carries its fallback so StreamText keeps the geometry invisibly —
|
|
41
|
+
// nothing below the hero moves whichever way the wait ends. Delete this
|
|
42
|
+
// and the section collapses during the hold; it is load-bearing.
|
|
43
|
+
const holding = state.phase === "holding";
|
|
44
|
+
const reserveOf = (name: "greeting" | "headline" | "body") =>
|
|
45
|
+
state.held?.[name] || fallback[name];
|
|
46
|
+
const held = (field: FieldState, reserve?: string) =>
|
|
47
|
+
holding && reserve && !field.text ? withReserve(field, reserve) : field;
|
|
48
|
+
|
|
49
|
+
return (
|
|
50
|
+
<section
|
|
51
|
+
ref={ref}
|
|
52
|
+
className="relative overflow-hidden rounded-2xl p-10"
|
|
53
|
+
style={themeStyle(state.theme)}
|
|
54
|
+
>
|
|
55
|
+
{backgroundImage ? (
|
|
56
|
+
<img
|
|
57
|
+
src={backgroundImage}
|
|
58
|
+
alt=""
|
|
59
|
+
className="absolute inset-0 h-full w-full object-cover"
|
|
60
|
+
/>
|
|
61
|
+
) : null}
|
|
62
|
+
|
|
63
|
+
<div className="relative">
|
|
64
|
+
{state.fields.greeting.text || (holding && reserveOf("greeting")) ? (
|
|
65
|
+
<StreamText
|
|
66
|
+
field={held(state.fields.greeting, reserveOf("greeting"))}
|
|
67
|
+
as="p"
|
|
68
|
+
className="text-sm uppercase tracking-wide opacity-80"
|
|
69
|
+
/>
|
|
70
|
+
) : null}
|
|
71
|
+
|
|
72
|
+
{/* h2 to match the packaged Hero. The heading level is yours: pass
|
|
73
|
+
as="h1" if this section is your page's primary heading. */}
|
|
74
|
+
<StreamText
|
|
75
|
+
field={held(state.fields.headline, reserveOf("headline"))}
|
|
76
|
+
as="h2"
|
|
77
|
+
className="mt-2 text-4xl font-semibold"
|
|
78
|
+
/>
|
|
79
|
+
|
|
80
|
+
{state.fields.body.text || (holding && reserveOf("body")) ? (
|
|
81
|
+
<StreamText
|
|
82
|
+
field={held(state.fields.body, reserveOf("body"))}
|
|
83
|
+
as="p"
|
|
84
|
+
className="mt-4 max-w-prose"
|
|
85
|
+
/>
|
|
86
|
+
) : null}
|
|
87
|
+
</div>
|
|
88
|
+
</section>
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
`;
|
|
92
|
+
export const CTA_080 = `"use client";
|
|
93
|
+
|
|
94
|
+
import { StreamText, useIsland, useSparkletree, withReserve, type UseIslandOptions } from "@sparkletree/react";
|
|
95
|
+
import { readableTextColor, safeActionUrl, themeStyle, track } from "@sparkletree/core";
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Your call to action. Edit freely.
|
|
99
|
+
*
|
|
100
|
+
* The button keeps its size while the label streams in, so the surrounding
|
|
101
|
+
* layout does not shift under the visitor's cursor mid-click.
|
|
102
|
+
*
|
|
103
|
+
* Requires Tailwind CSS for the default classes — swap them freely.
|
|
104
|
+
*/
|
|
105
|
+
export interface CtaProps extends Omit<UseIslandOptions, "island"> {
|
|
106
|
+
/** Where the button goes when the server has not resolved an action. */
|
|
107
|
+
href?: string;
|
|
108
|
+
onClick?: () => void;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function Cta(props: CtaProps) {
|
|
112
|
+
const { href, onClick, ...islandOptions } = props;
|
|
113
|
+
const { apiBase, organizationId } = useSparkletree();
|
|
114
|
+
const { state, ref } = useIsland({ ...islandOptions, island: "cta" });
|
|
115
|
+
// A rejected server action falls back to the href prop you control. The
|
|
116
|
+
// prop is vetted too — the same render path, the same rules, one outcome.
|
|
117
|
+
const action = safeActionUrl(state.ctaAction) ?? safeActionUrl(href);
|
|
118
|
+
const { campaignId, surfaceId } = islandOptions;
|
|
119
|
+
const variantId = state.variantId ?? undefined;
|
|
120
|
+
// A surface-only Cta has no campaignId prop, but the click must still be
|
|
121
|
+
// attributed: the server names the campaign it served in the terminal
|
|
122
|
+
// done.meta, mirroring the impression path in useIsland.
|
|
123
|
+
const metaCampaignId =
|
|
124
|
+
typeof state.meta?.campaignId === "string" ? state.meta.campaignId : undefined;
|
|
125
|
+
const resolvedCampaignId = campaignId ?? metaCampaignId;
|
|
126
|
+
|
|
127
|
+
// The click is the other half of CTR. The SDK tells the server to suppress
|
|
128
|
+
// its own counting for this page view — so if nothing here reports the
|
|
129
|
+
// click, CTR for SDK traffic is a division by silence. Fire-and-forget:
|
|
130
|
+
// track never throws and never blocks the navigation.
|
|
131
|
+
const handleClick = () => {
|
|
132
|
+
if (resolvedCampaignId) {
|
|
133
|
+
void track(
|
|
134
|
+
{ apiBase, organizationId, campaignId: resolvedCampaignId, variantId, surfaceId },
|
|
135
|
+
"click",
|
|
136
|
+
{ island: "cta" },
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
onClick?.();
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
// The hold RESERVES (LAYOUT-DOCTRINE.md): a holding label rides the
|
|
143
|
+
// fallback into StreamText invisibly, so the button keeps the size its
|
|
144
|
+
// label will need. Delete this and the button collapses during the hold.
|
|
145
|
+
const holding = state.phase === "holding";
|
|
146
|
+
const ctaReserve = state.held?.cta || islandOptions.fallback.cta;
|
|
147
|
+
const reserved = holding && !!ctaReserve && !state.fields.cta.text;
|
|
148
|
+
const labelField = reserved
|
|
149
|
+
? withReserve(state.fields.cta, ctaReserve as string)
|
|
150
|
+
: state.fields.cta;
|
|
151
|
+
|
|
152
|
+
// Shared by the link and the no-destination fallback below.
|
|
153
|
+
const shared = {
|
|
154
|
+
onClick: handleClick,
|
|
155
|
+
className:
|
|
156
|
+
"inline-flex min-h-11 min-w-40 items-center justify-center rounded-full px-6 font-medium",
|
|
157
|
+
style: {
|
|
158
|
+
...themeStyle(state.theme),
|
|
159
|
+
// --st-cta-text is the label ink that reads on the theme's primary, so
|
|
160
|
+
// a light theme can never produce a ghost button.
|
|
161
|
+
...(state.theme?.colors?.primary
|
|
162
|
+
? { ["--st-cta-text" as string]: readableTextColor(state.theme.colors.primary) }
|
|
163
|
+
: {}),
|
|
164
|
+
},
|
|
165
|
+
// A CTA whose label is still empty is not yet a button a viewer can
|
|
166
|
+
// meaningfully act on — but it must still occupy its space, or the
|
|
167
|
+
// layout shifts when the copy lands.
|
|
168
|
+
// A reserved button is full-size but its visible label is a hidden
|
|
169
|
+
// reservation outside the a11y tree — never a NAMELESS control: the
|
|
170
|
+
// reservation text is the honest accessible name.
|
|
171
|
+
"aria-disabled": state.fields.cta.text ? undefined : true,
|
|
172
|
+
"aria-label": reserved ? (ctaReserve as string) : undefined,
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
// Neither the stream nor you resolved a destination: render a
|
|
176
|
+
// non-interactive element rather than an inert <a> with no href, which
|
|
177
|
+
// some assistive tech still announces as a link to nowhere. Clicks are
|
|
178
|
+
// still observed — engagement with the creative counts toward CTR whether
|
|
179
|
+
// or not it navigates.
|
|
180
|
+
if (action === undefined) {
|
|
181
|
+
return (
|
|
182
|
+
<span ref={ref as unknown as (element: HTMLSpanElement | null) => void} {...shared}>
|
|
183
|
+
<StreamText field={labelField} />
|
|
184
|
+
</span>
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return (
|
|
189
|
+
<a ref={ref} href={action} {...shared}>
|
|
190
|
+
<StreamText field={labelField} />
|
|
191
|
+
</a>
|
|
192
|
+
);
|
|
193
|
+
}
|
|
194
|
+
`;
|
|
195
|
+
//# sourceMappingURL=fixtures-0.8.0.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixtures-0.8.0.js","sourceRoot":"","sources":["../src/fixtures-0.8.0.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqFvB,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsGtB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The binary is a thin wrapper over these. Exported so the parity harness and
|
|
5
5
|
* anyone scripting a scaffold can use `add` without shelling out.
|
|
6
6
|
*/
|
|
7
|
-
export { add, formatAddResult,
|
|
7
|
+
export { add, formatAddResult, type AddOptions, type AddResult } from "./add.js";
|
|
8
8
|
export { upgrade, formatUpgradeResult, UPGRADE_TARGETS, type UpgradeOptions, type UpgradeResult, type UpgradeTarget, } from "./upgrade.js";
|
|
9
9
|
export { REGISTRY, findComponent, resolveWithDependencies, type RegistryComponent, } from "./registry.js";
|
|
10
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,KAAK,SAAS,EAAE,MAAM,UAAU,CAAC;AACjF,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,EACf,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* The binary is a thin wrapper over these. Exported so the parity harness and
|
|
5
5
|
* anyone scripting a scaffold can use `add` without shelling out.
|
|
6
6
|
*/
|
|
7
|
-
export { add, formatAddResult
|
|
7
|
+
export { add, formatAddResult } from "./add.js";
|
|
8
8
|
export { upgrade, formatUpgradeResult, UPGRADE_TARGETS, } from "./upgrade.js";
|
|
9
9
|
export { REGISTRY, findComponent, resolveWithDependencies, } from "./registry.js";
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,eAAe,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,eAAe,EAAmC,MAAM,UAAU,CAAC;AACjF,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,eAAe,GAIhB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,QAAQ,EACR,aAAa,EACb,uBAAuB,GAExB,MAAM,eAAe,CAAC"}
|
package/dist/registry.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,mCAAmC;IACnC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mDAAmD;IACnD,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,KAAK,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC3C,mCAAmC;IACnC,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mDAAmD;IACnD,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAChC;AAsUD,eAAO,MAAM,QAAQ,EAAE,SAAS,iBAAiB,EAoChD,CAAC;AAEF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,iBAAiB,GAAG,SAAS,CAEzE;AAED;;;;;GAKG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAe5E"}
|
package/dist/registry.js
CHANGED
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
const HERO_TSX = `"use client";
|
|
24
24
|
|
|
25
|
-
import { StreamText, useIsland,
|
|
26
|
-
import type { FieldState } from "@sparkletree/react";
|
|
25
|
+
import { heldReserve, StreamText, useIsland, type UseIslandOptions } from "@sparkletree/react";
|
|
27
26
|
import { safeActionUrl, themeStyle } from "@sparkletree/core";
|
|
28
27
|
|
|
29
28
|
/**
|
|
@@ -53,16 +52,6 @@ export function Hero({ campaignId, fallback }: HeroProps) {
|
|
|
53
52
|
const { state, ref } = useIsland({ campaignId, island: "hero", fallback });
|
|
54
53
|
const backgroundImage = safeActionUrl(state.backgroundImage);
|
|
55
54
|
|
|
56
|
-
// The hold RESERVES (LAYOUT-DOCTRINE.md): while the canvas waits, each
|
|
57
|
-
// field carries its fallback so StreamText keeps the geometry invisibly —
|
|
58
|
-
// nothing below the hero moves whichever way the wait ends. Delete this
|
|
59
|
-
// and the section collapses during the hold; it is load-bearing.
|
|
60
|
-
const holding = state.phase === "holding";
|
|
61
|
-
const reserveOf = (name: "greeting" | "headline" | "body") =>
|
|
62
|
-
state.held?.[name] || fallback[name];
|
|
63
|
-
const held = (field: FieldState, reserve?: string) =>
|
|
64
|
-
holding && reserve && !field.text ? withReserve(field, reserve) : field;
|
|
65
|
-
|
|
66
55
|
return (
|
|
67
56
|
<section
|
|
68
57
|
ref={ref}
|
|
@@ -78,9 +67,14 @@ export function Hero({ campaignId, fallback }: HeroProps) {
|
|
|
78
67
|
) : null}
|
|
79
68
|
|
|
80
69
|
<div className="relative">
|
|
81
|
-
{
|
|
70
|
+
{/* The hold RESERVES via useIsland (LAYOUT-DOCTRINE.md): a blank
|
|
71
|
+
holding field still carries its copy, drawn invisibly by
|
|
72
|
+
StreamText — heldReserve is how a conditional element knows the
|
|
73
|
+
field still occupies its space. Render it, or the section
|
|
74
|
+
collapses during the hold. */}
|
|
75
|
+
{state.fields.greeting.text || heldReserve(state.fields.greeting) ? (
|
|
82
76
|
<StreamText
|
|
83
|
-
field={
|
|
77
|
+
field={state.fields.greeting}
|
|
84
78
|
as="p"
|
|
85
79
|
className="text-sm uppercase tracking-wide opacity-80"
|
|
86
80
|
/>
|
|
@@ -89,14 +83,14 @@ export function Hero({ campaignId, fallback }: HeroProps) {
|
|
|
89
83
|
{/* h2 to match the packaged Hero. The heading level is yours: pass
|
|
90
84
|
as="h1" if this section is your page's primary heading. */}
|
|
91
85
|
<StreamText
|
|
92
|
-
field={
|
|
86
|
+
field={state.fields.headline}
|
|
93
87
|
as="h2"
|
|
94
88
|
className="mt-2 text-4xl font-semibold"
|
|
95
89
|
/>
|
|
96
90
|
|
|
97
|
-
{state.fields.body.text || (
|
|
91
|
+
{state.fields.body.text || heldReserve(state.fields.body) ? (
|
|
98
92
|
<StreamText
|
|
99
|
-
field={
|
|
93
|
+
field={state.fields.body}
|
|
100
94
|
as="p"
|
|
101
95
|
className="mt-4 max-w-prose"
|
|
102
96
|
/>
|
|
@@ -108,7 +102,7 @@ export function Hero({ campaignId, fallback }: HeroProps) {
|
|
|
108
102
|
`;
|
|
109
103
|
const CTA_TSX = `"use client";
|
|
110
104
|
|
|
111
|
-
import { StreamText, useIsland, useSparkletree,
|
|
105
|
+
import { heldReserve, StreamText, useIsland, useSparkletree, type UseIslandOptions } from "@sparkletree/react";
|
|
112
106
|
import { readableTextColor, safeActionUrl, themeStyle, track } from "@sparkletree/core";
|
|
113
107
|
|
|
114
108
|
/**
|
|
@@ -156,16 +150,6 @@ export function Cta(props: CtaProps) {
|
|
|
156
150
|
onClick?.();
|
|
157
151
|
};
|
|
158
152
|
|
|
159
|
-
// The hold RESERVES (LAYOUT-DOCTRINE.md): a holding label rides the
|
|
160
|
-
// fallback into StreamText invisibly, so the button keeps the size its
|
|
161
|
-
// label will need. Delete this and the button collapses during the hold.
|
|
162
|
-
const holding = state.phase === "holding";
|
|
163
|
-
const ctaReserve = state.held?.cta || islandOptions.fallback.cta;
|
|
164
|
-
const reserved = holding && !!ctaReserve && !state.fields.cta.text;
|
|
165
|
-
const labelField = reserved
|
|
166
|
-
? withReserve(state.fields.cta, ctaReserve as string)
|
|
167
|
-
: state.fields.cta;
|
|
168
|
-
|
|
169
153
|
// Shared by the link and the no-destination fallback below.
|
|
170
154
|
const shared = {
|
|
171
155
|
onClick: handleClick,
|
|
@@ -186,7 +170,7 @@ export function Cta(props: CtaProps) {
|
|
|
186
170
|
// reservation outside the a11y tree — never a NAMELESS control: the
|
|
187
171
|
// reservation text is the honest accessible name.
|
|
188
172
|
"aria-disabled": state.fields.cta.text ? undefined : true,
|
|
189
|
-
"aria-label":
|
|
173
|
+
"aria-label": heldReserve(state.fields.cta),
|
|
190
174
|
};
|
|
191
175
|
|
|
192
176
|
// Neither the stream nor you resolved a destination: render a
|
|
@@ -197,14 +181,14 @@ export function Cta(props: CtaProps) {
|
|
|
197
181
|
if (action === undefined) {
|
|
198
182
|
return (
|
|
199
183
|
<span ref={ref as unknown as (element: HTMLSpanElement | null) => void} {...shared}>
|
|
200
|
-
<StreamText field={
|
|
184
|
+
<StreamText field={state.fields.cta} />
|
|
201
185
|
</span>
|
|
202
186
|
);
|
|
203
187
|
}
|
|
204
188
|
|
|
205
189
|
return (
|
|
206
190
|
<a ref={ref} href={action} {...shared}>
|
|
207
|
-
<StreamText field={
|
|
191
|
+
<StreamText field={state.fields.cta} />
|
|
208
192
|
</a>
|
|
209
193
|
);
|
|
210
194
|
}
|
package/dist/registry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAaH,MAAM,QAAQ,GAAG
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../src/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAaH,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+EhB,CAAC;AAEF,MAAM,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4Ff,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCrB,CAAC;AAEF,MAAM,gBAAgB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmDxB,CAAC;AAEF,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuDpB,CAAC;AAEF,MAAM,CAAC,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OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC/D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAe;IACrD,MAAM,QAAQ,GAAwB,EAAE,CAAC;IACzC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAE/B,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE;QAC7B,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC;YAAE,OAAO;QAC3B,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACf,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACtC,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,IAAI,GAAG,CAAC,CAAC;QAC/D,KAAK,MAAM,UAAU,IAAI,SAAS,CAAC,oBAAoB;YAAE,KAAK,CAAC,UAAU,CAAC,CAAC;QAC3E,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK;QAAE,KAAK,CAAC,IAAI,CAAC,CAAC;IACtC,OAAO,QAAQ,CAAC;AAClB,CAAC"}
|
package/dist/upgrade.d.ts
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* command ports each GENERATION of template wiring into copies that predate
|
|
7
7
|
* it. A copy from `add` at 0.3.0 gets every generation in order; a 0.5.0
|
|
8
8
|
* copy gets only the generations it is missing. Which generations a copy is
|
|
9
|
-
* missing is decided by content (each generation's
|
|
10
|
-
*
|
|
9
|
+
* missing is decided by content (each generation's markers — its own
|
|
10
|
+
* signature, plus the signature of any later generation that rewrites its
|
|
11
|
+
* wiring away), never by guessing a version.
|
|
11
12
|
*
|
|
12
13
|
* How it stays safe in someone else's repository:
|
|
13
14
|
*
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
* hand;
|
|
21
22
|
* - hunks avoid the Tailwind classNames, which `add` explicitly invites
|
|
22
23
|
* customers to change. A restyled copy still upgrades;
|
|
23
|
-
* - idempotent: a generation
|
|
24
|
+
* - idempotent: a generation with a marker already in the file is
|
|
24
25
|
* skipped, and a copy missing none is reported up to date and never
|
|
25
26
|
* touched;
|
|
26
27
|
* - `--dry-run` reports the same verdicts and writes nothing.
|
|
@@ -36,10 +37,16 @@ interface Hunk {
|
|
|
36
37
|
}
|
|
37
38
|
interface Codemod {
|
|
38
39
|
/**
|
|
39
|
-
* Already-upgraded detection: presence of
|
|
40
|
-
* generation's wiring is in the copy, so the generation is skipped.
|
|
40
|
+
* Already-upgraded detection: presence of ANY of these markers means this
|
|
41
|
+
* generation's wiring is in the copy, so the generation is skipped. The
|
|
42
|
+
* first marker is the generation's own signature; a later entry names the
|
|
43
|
+
* signature of a generation that REWRITES this one's wiring away (0.9.0
|
|
44
|
+
* deletes the withReserve wiring 0.4.0 added), so a copy carrying the
|
|
45
|
+
* rewrite still counts as having this generation. Detection stays
|
|
46
|
+
* per-generation — a marker only ever vouches for the generations it is
|
|
47
|
+
* listed under, never for every generation before it.
|
|
41
48
|
*/
|
|
42
|
-
|
|
49
|
+
markers: readonly string[];
|
|
43
50
|
/**
|
|
44
51
|
* Minimum installed @sparkletree/react (core, react and cli version
|
|
45
52
|
* together) the REWRITTEN copy compiles against. Below it the run behaves
|
package/dist/upgrade.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"upgrade.d.ts","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAKH,UAAU,IAAI;IACZ,gEAAgE;IAChE,KAAK,EAAE,MAAM,CAAC;IACd,mDAAmD;IACnD,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package/dist/upgrade.js
CHANGED
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
* command ports each GENERATION of template wiring into copies that predate
|
|
7
7
|
* it. A copy from `add` at 0.3.0 gets every generation in order; a 0.5.0
|
|
8
8
|
* copy gets only the generations it is missing. Which generations a copy is
|
|
9
|
-
* missing is decided by content (each generation's
|
|
10
|
-
*
|
|
9
|
+
* missing is decided by content (each generation's markers — its own
|
|
10
|
+
* signature, plus the signature of any later generation that rewrites its
|
|
11
|
+
* wiring away), never by guessing a version.
|
|
11
12
|
*
|
|
12
13
|
* How it stays safe in someone else's repository:
|
|
13
14
|
*
|
|
@@ -20,7 +21,7 @@
|
|
|
20
21
|
* hand;
|
|
21
22
|
* - hunks avoid the Tailwind classNames, which `add` explicitly invites
|
|
22
23
|
* customers to change. A restyled copy still upgrades;
|
|
23
|
-
* - idempotent: a generation
|
|
24
|
+
* - idempotent: a generation with a marker already in the file is
|
|
24
25
|
* skipped, and a copy missing none is reported up to date and never
|
|
25
26
|
* touched;
|
|
26
27
|
* - `--dry-run` reports the same verdicts and writes nothing.
|
|
@@ -83,7 +84,7 @@ export const UPGRADE_TARGETS = [
|
|
|
83
84
|
codemods: [
|
|
84
85
|
{
|
|
85
86
|
// 0.4.0: the hold RESERVES instead of blanking (LAYOUT-DOCTRINE.md).
|
|
86
|
-
|
|
87
|
+
markers: ["withReserve", "heldReserve"],
|
|
87
88
|
needs: "0.4.0",
|
|
88
89
|
hunks: [
|
|
89
90
|
{
|
|
@@ -129,7 +130,7 @@ ${HERO_RESERVATION}`,
|
|
|
129
130
|
{
|
|
130
131
|
// 0.6.1: one safeActionUrl, imported from core; the header stops
|
|
131
132
|
// claiming a default disclosure mark is handled upstream.
|
|
132
|
-
|
|
133
|
+
markers: [`safeActionUrl, themeStyle } from "@sparkletree/core"`],
|
|
133
134
|
needs: "0.6.1",
|
|
134
135
|
hunks: [
|
|
135
136
|
{
|
|
@@ -157,6 +158,56 @@ ${HERO_RESERVATION}`,
|
|
|
157
158
|
},
|
|
158
159
|
],
|
|
159
160
|
},
|
|
161
|
+
{
|
|
162
|
+
// 0.9.0: the reservation join moved into useIsland — a holding
|
|
163
|
+
// field arrives already carrying its reserve, so the copy sheds
|
|
164
|
+
// its timing logic and asks heldReserve instead.
|
|
165
|
+
markers: ["heldReserve"],
|
|
166
|
+
needs: "0.9.0",
|
|
167
|
+
hunks: [
|
|
168
|
+
{
|
|
169
|
+
label: "imports",
|
|
170
|
+
find: `import { StreamText, useIsland, withReserve, type UseIslandOptions } from "@sparkletree/react";
|
|
171
|
+
import type { FieldState } from "@sparkletree/react";`,
|
|
172
|
+
replace: `import { heldReserve, StreamText, useIsland, type UseIslandOptions } from "@sparkletree/react";`,
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
label: "reservation helpers",
|
|
176
|
+
find: `\n\n${HERO_RESERVATION}`,
|
|
177
|
+
replace: ``,
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
label: "greeting condition",
|
|
181
|
+
find: `{state.fields.greeting.text || (holding && reserveOf("greeting")) ? (`,
|
|
182
|
+
replace: `{/* The hold RESERVES via useIsland (LAYOUT-DOCTRINE.md): a blank
|
|
183
|
+
holding field still carries its copy, drawn invisibly by
|
|
184
|
+
StreamText — heldReserve is how a conditional element knows the
|
|
185
|
+
field still occupies its space. Render it, or the section
|
|
186
|
+
collapses during the hold. */}
|
|
187
|
+
{state.fields.greeting.text || heldReserve(state.fields.greeting) ? (`,
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
label: "greeting field",
|
|
191
|
+
find: `field={held(state.fields.greeting, reserveOf("greeting"))}`,
|
|
192
|
+
replace: `field={state.fields.greeting}`,
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
label: "headline field",
|
|
196
|
+
find: `field={held(state.fields.headline, reserveOf("headline"))}`,
|
|
197
|
+
replace: `field={state.fields.headline}`,
|
|
198
|
+
},
|
|
199
|
+
{
|
|
200
|
+
label: "body condition",
|
|
201
|
+
find: `{state.fields.body.text || (holding && reserveOf("body")) ? (`,
|
|
202
|
+
replace: `{state.fields.body.text || heldReserve(state.fields.body) ? (`,
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
label: "body field",
|
|
206
|
+
find: `field={held(state.fields.body, reserveOf("body"))}`,
|
|
207
|
+
replace: `field={state.fields.body}`,
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
},
|
|
160
211
|
],
|
|
161
212
|
},
|
|
162
213
|
{
|
|
@@ -165,7 +216,7 @@ ${HERO_RESERVATION}`,
|
|
|
165
216
|
codemods: [
|
|
166
217
|
{
|
|
167
218
|
// 0.4.0: the hold RESERVES instead of blanking (LAYOUT-DOCTRINE.md).
|
|
168
|
-
|
|
219
|
+
markers: ["withReserve", "heldReserve"],
|
|
169
220
|
needs: "0.4.0",
|
|
170
221
|
hunks: [
|
|
171
222
|
{
|
|
@@ -201,7 +252,7 @@ ${CTA_RESERVATION}`,
|
|
|
201
252
|
},
|
|
202
253
|
{
|
|
203
254
|
// 0.6.1: one safeActionUrl, imported from core.
|
|
204
|
-
|
|
255
|
+
markers: [`readableTextColor, safeActionUrl, themeStyle, track } from "@sparkletree/core"`],
|
|
205
256
|
needs: "0.6.1",
|
|
206
257
|
hunks: [
|
|
207
258
|
{
|
|
@@ -216,6 +267,34 @@ ${CTA_RESERVATION}`,
|
|
|
216
267
|
},
|
|
217
268
|
],
|
|
218
269
|
},
|
|
270
|
+
{
|
|
271
|
+
// 0.9.0: the reservation join moved into useIsland.
|
|
272
|
+
markers: ["heldReserve"],
|
|
273
|
+
needs: "0.9.0",
|
|
274
|
+
hunks: [
|
|
275
|
+
{
|
|
276
|
+
label: "imports",
|
|
277
|
+
find: `import { StreamText, useIsland, useSparkletree, withReserve, type UseIslandOptions } from "@sparkletree/react";`,
|
|
278
|
+
replace: `import { heldReserve, StreamText, useIsland, useSparkletree, type UseIslandOptions } from "@sparkletree/react";`,
|
|
279
|
+
},
|
|
280
|
+
{
|
|
281
|
+
label: "reservation helpers",
|
|
282
|
+
find: `\n\n${CTA_RESERVATION}`,
|
|
283
|
+
replace: ``,
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
label: "reserved accessible name",
|
|
287
|
+
find: ` "aria-label": reserved ? (ctaReserve as string) : undefined,`,
|
|
288
|
+
replace: ` "aria-label": heldReserve(state.fields.cta),`,
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
label: "label field",
|
|
292
|
+
find: `<StreamText field={labelField} />`,
|
|
293
|
+
replace: `<StreamText field={state.fields.cta} />`,
|
|
294
|
+
all: true,
|
|
295
|
+
},
|
|
296
|
+
],
|
|
297
|
+
},
|
|
219
298
|
],
|
|
220
299
|
},
|
|
221
300
|
];
|
|
@@ -290,7 +369,7 @@ export async function upgrade(options = {}) {
|
|
|
290
369
|
result.missing.push(path);
|
|
291
370
|
continue;
|
|
292
371
|
}
|
|
293
|
-
const needed = target.codemods.filter((codemod) => !content.includes(
|
|
372
|
+
const needed = target.codemods.filter((codemod) => !codemod.markers.some((marker) => content.includes(marker)));
|
|
294
373
|
if (!needed.length) {
|
|
295
374
|
result.upToDate.push(path);
|
|
296
375
|
continue;
|
|
@@ -361,7 +440,7 @@ export function formatUpgradeResult(result, dryRun = false) {
|
|
|
361
440
|
if (!lines.length) {
|
|
362
441
|
lines.push("Nothing to upgrade — no copied hero or cta found.");
|
|
363
442
|
}
|
|
364
|
-
lines.push("", "Why: copies drift. 0.4.0 holds by RESERVING space with the fallback", "(without it a copied hero or cta collapses during the hold),
|
|
443
|
+
lines.push("", "Why: copies drift. 0.4.0 holds by RESERVING space with the fallback", "(without it a copied hero or cta collapses during the hold), 0.6.1", "moved URL vetting to one implementation in @sparkletree/core so security", "fixes reach copies through npm instead of a migration guide, and 0.9.0", "moved the reservation itself into useIsland so copies carry no timing", "logic at all.");
|
|
365
444
|
return lines.join("\n");
|
|
366
445
|
}
|
|
367
446
|
//# sourceMappingURL=upgrade.js.map
|
package/dist/upgrade.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../src/upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA0C7D,MAAM,gBAAgB,GAAG;;;;;;;;6EAQoD,CAAC;AAE9E,MAAM,eAAe,GAAG;;;;;;;;wBAQA,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,sBAAsB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;CAwB9B,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAA6B;IACvD;QACE,SAAS,EAAE,MAAM;QACjB,IAAI,EAAE,sBAAsB;QAC5B,QAAQ,EAAE;YACR;gBACE,qEAAqE;gBACrE,OAAO,EAAE,CAAC,aAAa,EAAE,aAAa,CAAC;gBACvC,KAAK,EAAE,OAAO;gBACd,KAAK,EAAE;oBACL;wBACE,KAAK,EAAE,SAAS;wBAChB,IAAI,EAAE,oFAAoF;wBAC1F,OAAO,EAAE;sDACiC;qBAC3C;oBACD;wBACE,KAAK,EAAE,qBAAqB;wBAC5B,IAAI,EAAE,+DAA+D;wBACrE,OAAO,EAAE;;EAEnB,gBAAgB,EAAE;qBACT;oBACD;wBACE,KAAK,EAAE,oBAAoB;wBAC3B,IAAI,EAAE,iCAAiC;wBACvC,OAAO,EAAE,uEAAuE;qBACjF;oBACD;wBACE,KAAK,EAAE,gBAAgB;wBACvB,IAAI,EAAE,+BAA+B;wBACrC,OAAO,EAAE,4DAA4D;qBACtE;oBACD;wBACE,KAAK,EAAE,gBAAgB;wBACvB,IAAI,EAAE,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