@justai/core 0.7.0 → 0.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@justai/core",
3
- "version": "0.7.0",
3
+ "version": "0.8.0",
4
4
  "description": "The framework-free heart of the persona shell \u2014 the load-bearing behaviour (auth capture, reveal, ready) as plain strings, so Astro and Next inject the SAME logic instead of each re-writing it.",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
package/src/index.d.ts CHANGED
@@ -59,3 +59,9 @@ export interface PersonaScrollOptions {
59
59
  * surfaces (`/me`, `/files`, the feed) run one implementation rather than four copies.
60
60
  */
61
61
  export declare function personaScroll(options?: PersonaScrollOptions): void;
62
+
63
+ /**
64
+ * `personaScroll` as an inline script string, for surfaces that cannot bundle a module (the feed).
65
+ * Generated from the function itself, so there is never a second implementation to keep in step.
66
+ */
67
+ export declare function personaScrollJs(options?: PersonaScrollOptions): string;
package/src/index.js CHANGED
@@ -532,3 +532,24 @@ export function personaScroll(options) {
532
532
  }),
533
533
  );
534
534
  }
535
+
536
+ // queries: persona scroll for a surface that cannot bundle · inline scroll script · feed toolbar
537
+ // script · why is there a JS string version of personaScroll
538
+ //
539
+ // THE SAME BEHAVIOUR, AS A STRING, FOR A SURFACE THAT CANNOT IMPORT IT.
540
+ //
541
+ // The feed is served under every persona's host from its own origin, so its scripts are `is:inline`
542
+ // rather than bundled assets — a cross-origin module would need CORS on every one of them. That is
543
+ // why core's other load-bearing pieces are strings too (AUTH_CAPTURE_JS, READY_JS, CONSENT_JS).
544
+ //
545
+ // It is generated FROM the function rather than written twice, which is the only version of this
546
+ // worth having: a second hand-minified copy is what the feed already had, and it had drifted — its
547
+ // hash writer dropped the query, it never set the title text, and it found its navs by href. One
548
+ // source, two shapes.
549
+ //
550
+ // This works because `personaScroll` closes over nothing: every helper it uses is defined inside it.
551
+ // A future edit that reaches for a module-level helper would compile, ship, and throw here — so if
552
+ // you add one, inline it.
553
+ export function personaScrollJs(options) {
554
+ return "(" + personaScroll.toString() + ")(" + JSON.stringify(options || {}) + ");";
555
+ }