@treasure-ai/treasure-deck 2026.11.9 → 2026.11.10
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/analytics.d.ts +2 -1
- package/dist/analytics.js +3 -2
- package/dist/analytics.js.map +1 -1
- package/package.json +1 -1
- package/runtime/runtime.js +6 -2
package/dist/analytics.d.ts
CHANGED
|
@@ -25,7 +25,8 @@ export declare function deckInfo(file: string, title: string, theme: string, now
|
|
|
25
25
|
export declare function withAnalytics(html: string, info: DeckInfo, writeKey?: string): string;
|
|
26
26
|
/**
|
|
27
27
|
* The inline script, or '' without a write key. It goes before the runtime, which shows the first slide as it
|
|
28
|
-
* starts. It queues calls until the SDK loads (the SDK's own loader stub
|
|
28
|
+
* starts. It queues calls until the SDK loads (the SDK's own loader stub, except that it adds the SDK's script to
|
|
29
|
+
* <head>: the stock stub inserts it before the page's first script, which may be inside a slide) and listens for the runtime's
|
|
29
30
|
* `deck:show` and `deck:action` events. A deck that can't reach the CDN works as before; it just sends nothing.
|
|
30
31
|
*
|
|
31
32
|
* Every row carries the deck's build info, `host` (apps_script, file, or web), and `view_id`: a random ID made for
|
package/dist/analytics.js
CHANGED
|
@@ -36,7 +36,8 @@ export function withAnalytics(html, info, writeKey = WRITE_KEY) {
|
|
|
36
36
|
const json = (v) => JSON.stringify(v).replace(/</g, '\\u003c');
|
|
37
37
|
/**
|
|
38
38
|
* The inline script, or '' without a write key. It goes before the runtime, which shows the first slide as it
|
|
39
|
-
* starts. It queues calls until the SDK loads (the SDK's own loader stub
|
|
39
|
+
* starts. It queues calls until the SDK loads (the SDK's own loader stub, except that it adds the SDK's script to
|
|
40
|
+
* <head>: the stock stub inserts it before the page's first script, which may be inside a slide) and listens for the runtime's
|
|
40
41
|
* `deck:show` and `deck:action` events. A deck that can't reach the CDN works as before; it just sends nothing.
|
|
41
42
|
*
|
|
42
43
|
* Every row carries the deck's build info, `host` (apps_script, file, or web), and `view_id`: a random ID made for
|
|
@@ -46,7 +47,7 @@ export function analyticsScript(info, writeKey = WRITE_KEY) {
|
|
|
46
47
|
if (!writeKey)
|
|
47
48
|
return '';
|
|
48
49
|
return `<script>
|
|
49
|
-
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=["addRecord","blockEvents","fetchServerCookie","fetchGlobalID","fetchUserSegments","resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"],s=0;s<r.length;s++){var c=r[s];e[t].prototype[c]=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}}(c)}var n=document.createElement("script");n.async=!0,n.src=${json(SDK_URL)};
|
|
50
|
+
!function(t,e){if(void 0===e[t]){e[t]=function(){e[t].clients.push(this),this._init=[Array.prototype.slice.call(arguments)]},e[t].clients=[];for(var r=["addRecord","blockEvents","fetchServerCookie","fetchGlobalID","fetchUserSegments","resetUUID","ready","setSignedMode","setAnonymousMode","set","trackEvent","trackPageview","trackClicks","unblockEvents"],s=0;s<r.length;s++){var c=r[s];e[t].prototype[c]=function(t){return function(){return this["_"+t]=this["_"+t]||[],this["_"+t].push(Array.prototype.slice.call(arguments)),this}}(c)}var n=document.createElement("script");n.async=!0,n.src=${json(SDK_URL)};document.head.appendChild(n)}}("Treasure",window);
|
|
50
51
|
(function () {
|
|
51
52
|
var td = new Treasure(${json({ database: DATABASE, writeKey, host: HOST })});
|
|
52
53
|
td.setAnonymousMode();
|
package/dist/analytics.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../src/analytics.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CA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I,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,eAAe,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC/C,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,IAAI,GAAG,CAAC,CAAU,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAExE;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,IAAc,EAAE,QAAQ,GAAG,SAAS;IAClE,IAAI,CAAC,QAAQ;QAAE,OAAO,EAAE,CAAC;IACzB,OAAO;ilBACwkB,IAAI,CAAC,OAAO,CAAC;;0BAEpkB,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;;gBAE5D,IAAI,CAAC,KAAK,CAAC,YAAY,IAAI,CAAC,IAAI,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsChD,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@treasure-ai/treasure-deck",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.10",
|
|
4
4
|
"description": "Markdown presentations without <div> markup: four layouts, themes, and a single-file HTML output that publishes to Apps Script",
|
|
5
5
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
6
6
|
"homepage": "https://www.npmjs.com/package/@treasure-ai/treasure-deck",
|
package/runtime/runtime.js
CHANGED
|
@@ -850,9 +850,13 @@
|
|
|
850
850
|
var frame = document.createElement('div');
|
|
851
851
|
frame.className = 'deck-component-root';
|
|
852
852
|
root.appendChild(frame);
|
|
853
|
-
|
|
854
|
-
|
|
853
|
+
// By type, not position: a page's other scripts may add theirs beside these (the TD SDK's stock loader
|
|
854
|
+
// inserts before the page's first script, which can be a component's).
|
|
855
|
+
var code = host.querySelector(':scope > script[type="text/x-deck-component"]');
|
|
856
|
+
var data = host.querySelector(':scope > script[type="application/json"]');
|
|
857
|
+
var entry = { host: host, frame: frame, code: code ? code.textContent : '', round: 0 };
|
|
855
858
|
try {
|
|
859
|
+
entry.data = JSON.parse((data && data.textContent) || 'null');
|
|
856
860
|
entry.factory = componentFactory(entry.code);
|
|
857
861
|
} catch (e) {
|
|
858
862
|
failComponent(entry, e);
|