@teleporthq/teleport-shared 0.43.71 → 0.43.75
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/__tests__/_fixtures/rich-text/README.md +6 -0
- package/__tests__/_fixtures/rich-text/help-accept-an-invitation.html +50 -0
- package/__tests__/_fixtures/rich-text/help-activate-an-appsumo-license.html +44 -0
- package/__tests__/_fixtures/rich-text/help-add-custom-code-to-your-site.html +61 -0
- package/__tests__/_fixtures/rich-text/help-connect-a-custom-domain.html +106 -0
- package/__tests__/_fixtures/rich-text/help-custom-animations-with-code.html +69 -0
- package/__tests__/_fixtures/rich-text/help-generate-a-store.html +78 -0
- package/__tests__/_fixtures/rich-text/help-keyboard-shortcuts.html +417 -0
- package/__tests__/_fixtures/rich-text/help-prompting-tips.html +82 -0
- package/__tests__/_fixtures/rich-text/help-sitemap-robots-and-llms-txt.html +82 -0
- package/__tests__/_fixtures/rich-text/help-use-a-csv-file-or-static-data.html +61 -0
- package/__tests__/_helpers/rich-text-content-runtime-emitter.ts +117 -0
- package/__tests__/function-sources.ts +30 -0
- package/__tests__/utils/content-tables.ts +69 -0
- package/__tests__/utils/rich-text-content-runtime-module.ts +115 -0
- package/__tests__/utils/rich-text-content.ts +131 -0
- package/dist/cjs/index.d.ts +4 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +7 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/page-transition/index.d.ts +1 -0
- package/dist/cjs/page-transition/index.d.ts.map +1 -1
- package/dist/cjs/page-transition/index.js +1 -0
- package/dist/cjs/page-transition/index.js.map +1 -1
- package/dist/cjs/page-transition/variant-sources.generated.d.ts +7 -0
- package/dist/cjs/page-transition/variant-sources.generated.d.ts.map +1 -0
- package/dist/cjs/page-transition/variant-sources.generated.js +14 -0
- package/dist/cjs/page-transition/variant-sources.generated.js.map +1 -0
- package/dist/cjs/scroll-scene/engine-source.d.ts.map +1 -1
- package/dist/cjs/scroll-scene/engine-source.js +2 -5
- package/dist/cjs/scroll-scene/engine-source.js.map +1 -1
- package/dist/cjs/scroll-scene/helper-sources.generated.d.ts +9 -0
- package/dist/cjs/scroll-scene/helper-sources.generated.d.ts.map +1 -0
- package/dist/cjs/scroll-scene/helper-sources.generated.js +16 -0
- package/dist/cjs/scroll-scene/helper-sources.generated.js.map +1 -0
- package/dist/cjs/scroll-scene/index.d.ts +1 -0
- package/dist/cjs/scroll-scene/index.d.ts.map +1 -1
- package/dist/cjs/scroll-scene/index.js +3 -1
- package/dist/cjs/scroll-scene/index.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/cjs/utils/content-tables.d.ts +78 -0
- package/dist/cjs/utils/content-tables.d.ts.map +1 -0
- package/dist/cjs/utils/content-tables.js +123 -0
- package/dist/cjs/utils/content-tables.js.map +1 -0
- package/dist/cjs/utils/rich-text-content-codegen.d.ts +20 -0
- package/dist/cjs/utils/rich-text-content-codegen.d.ts.map +1 -0
- package/dist/cjs/utils/rich-text-content-codegen.js +55 -0
- package/dist/cjs/utils/rich-text-content-codegen.js.map +1 -0
- package/dist/cjs/utils/rich-text-content-runtime-source.d.ts +2 -0
- package/dist/cjs/utils/rich-text-content-runtime-source.d.ts.map +1 -0
- package/dist/cjs/utils/rich-text-content-runtime-source.js +591 -0
- package/dist/cjs/utils/rich-text-content-runtime-source.js.map +1 -0
- package/dist/cjs/utils/rich-text-content.d.ts +150 -0
- package/dist/cjs/utils/rich-text-content.d.ts.map +1 -0
- package/dist/cjs/utils/rich-text-content.js +649 -0
- package/dist/cjs/utils/rich-text-content.js.map +1 -0
- package/dist/cjs/utils/table-access.d.ts.map +1 -1
- package/dist/cjs/utils/table-access.js +5 -7
- package/dist/cjs/utils/table-access.js.map +1 -1
- package/dist/esm/index.d.ts +4 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/page-transition/index.d.ts +1 -0
- package/dist/esm/page-transition/index.d.ts.map +1 -1
- package/dist/esm/page-transition/index.js +1 -0
- package/dist/esm/page-transition/index.js.map +1 -1
- package/dist/esm/page-transition/variant-sources.generated.d.ts +7 -0
- package/dist/esm/page-transition/variant-sources.generated.d.ts.map +1 -0
- package/dist/esm/page-transition/variant-sources.generated.js +11 -0
- package/dist/esm/page-transition/variant-sources.generated.js.map +1 -0
- package/dist/esm/scroll-scene/engine-source.d.ts.map +1 -1
- package/dist/esm/scroll-scene/engine-source.js +2 -5
- package/dist/esm/scroll-scene/engine-source.js.map +1 -1
- package/dist/esm/scroll-scene/helper-sources.generated.d.ts +9 -0
- package/dist/esm/scroll-scene/helper-sources.generated.d.ts.map +1 -0
- package/dist/esm/scroll-scene/helper-sources.generated.js +13 -0
- package/dist/esm/scroll-scene/helper-sources.generated.js.map +1 -0
- package/dist/esm/scroll-scene/index.d.ts +1 -0
- package/dist/esm/scroll-scene/index.d.ts.map +1 -1
- package/dist/esm/scroll-scene/index.js +1 -0
- package/dist/esm/scroll-scene/index.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/utils/content-tables.d.ts +78 -0
- package/dist/esm/utils/content-tables.d.ts.map +1 -0
- package/dist/esm/utils/content-tables.js +114 -0
- package/dist/esm/utils/content-tables.js.map +1 -0
- package/dist/esm/utils/rich-text-content-codegen.d.ts +20 -0
- package/dist/esm/utils/rich-text-content-codegen.d.ts.map +1 -0
- package/dist/esm/utils/rich-text-content-codegen.js +50 -0
- package/dist/esm/utils/rich-text-content-codegen.js.map +1 -0
- package/dist/esm/utils/rich-text-content-runtime-source.d.ts +2 -0
- package/dist/esm/utils/rich-text-content-runtime-source.d.ts.map +1 -0
- package/dist/esm/utils/rich-text-content-runtime-source.js +588 -0
- package/dist/esm/utils/rich-text-content-runtime-source.js.map +1 -0
- package/dist/esm/utils/rich-text-content.d.ts +150 -0
- package/dist/esm/utils/rich-text-content.d.ts.map +1 -0
- package/dist/esm/utils/rich-text-content.js +613 -0
- package/dist/esm/utils/rich-text-content.js.map +1 -0
- package/dist/esm/utils/table-access.d.ts.map +1 -1
- package/dist/esm/utils/table-access.js +5 -7
- package/dist/esm/utils/table-access.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +6 -0
- package/src/page-transition/index.ts +1 -0
- package/src/page-transition/variant-sources.generated.ts +14 -0
- package/src/scroll-scene/engine-source.ts +7 -10
- package/src/scroll-scene/helper-sources.generated.ts +18 -0
- package/src/scroll-scene/index.ts +1 -0
- package/src/utils/content-tables.ts +151 -0
- package/src/utils/rich-text-content-codegen.ts +52 -0
- package/src/utils/rich-text-content-runtime-source.ts +587 -0
- package/src/utils/rich-text-content.ts +677 -0
- package/src/utils/table-access.ts +4 -2
|
@@ -7,6 +7,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
7
7
|
}
|
|
8
8
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
9
9
|
};
|
|
10
|
+
import { CONTENT_COMMENTS_TABLES } from './content-tables';
|
|
10
11
|
/**
|
|
11
12
|
* Which store tables a browser may touch through the generated data routes.
|
|
12
13
|
*
|
|
@@ -58,7 +59,7 @@ export var MONEY_TABLES = [
|
|
|
58
59
|
'teleport_product_files',
|
|
59
60
|
'teleport_license_keys',
|
|
60
61
|
];
|
|
61
|
-
export var CUSTOMER_RECORD_TABLES = [
|
|
62
|
+
export var CUSTOMER_RECORD_TABLES = __spreadArray(__spreadArray([
|
|
62
63
|
'users',
|
|
63
64
|
'teleport_orders',
|
|
64
65
|
'teleport_order_items',
|
|
@@ -83,11 +84,8 @@ export var CUSTOMER_RECORD_TABLES = [
|
|
|
83
84
|
'teleport_product_reviews',
|
|
84
85
|
// A push subscription is a capability: whoever holds the endpoint and its
|
|
85
86
|
// keys can notify that device. Only the app's push routes read the table.
|
|
86
|
-
'teleport_push_subscriptions'
|
|
87
|
-
|
|
88
|
-
// email and the comments still waiting for approval; the post page reads
|
|
89
|
-
// the approved ones server-side, public columns only.
|
|
90
|
-
'teleport_blog_comments',
|
|
87
|
+
'teleport_push_subscriptions'
|
|
88
|
+
], CONTENT_COMMENTS_TABLES, true), [
|
|
91
89
|
// What visitors told the AI assistant, and the merchant's private knowledge
|
|
92
90
|
// base it answers from: the assistant reads them in its own server
|
|
93
91
|
// segments, the admin lists them with its session.
|
|
@@ -95,7 +93,7 @@ export var CUSTOMER_RECORD_TABLES = [
|
|
|
95
93
|
'teleport_ai_chat_documents',
|
|
96
94
|
'teleport_ai_chat_conversations',
|
|
97
95
|
'teleport_ai_chat_messages',
|
|
98
|
-
];
|
|
96
|
+
], false);
|
|
99
97
|
export var PROTECTED_TABLES = __spreadArray(__spreadArray([], MONEY_TABLES, true), CUSTOMER_RECORD_TABLES, true);
|
|
100
98
|
export var WRITE_PROTECTED_TABLES = ['teleport_discounts'];
|
|
101
99
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"table-access.js","sourceRoot":"","sources":["../../../src/utils/table-access.ts"],"names":[],"mappings":";;;;;;;;;
|
|
1
|
+
{"version":3,"file":"table-access.js","sourceRoot":"","sources":["../../../src/utils/table-access.ts"],"names":[],"mappings":";;;;;;;;;AACA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAE1D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,IAAM,YAAY,GAA0B;IACjD,qBAAqB;IACrB,iCAAiC;IACjC,mBAAmB;IACnB,8BAA8B;IAC9B,uEAAuE;IACvE,sEAAsE;IACtE,0DAA0D;IAC1D,sBAAsB;IACtB,0EAA0E;IAC1E,qEAAqE;IACrE,uBAAuB;IACvB,wEAAwE;IACxE,qEAAqE;IACrE,yDAAyD;IACzD,wBAAwB;IACxB,uBAAuB;CACxB,CAAA;AAED,MAAM,CAAC,IAAM,sBAAsB;IACjC,OAAO;IACP,iBAAiB;IACjB,sBAAsB;IACtB,mBAAmB;IACnB,wBAAwB;IACxB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AC9D;IACH,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAA;AACjC,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,MAAM,CAAC,IAAM,6BAA6B,GAAG,UAAC,MAE7C;IACC,OAAO,gdAOqB,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,kDAC1B,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,wTAK1C,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,8GAEhC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,kBAAkB,CAAC,8CAC3C,IAAI,CAAC,SAAS,CAAC,uBAAuB,CAAC,0DAC3B,IAAI,CAAC,SAAS,CAAC,8BAA8B,CAAC,6CAC3D,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,29VA6PpE,CAAA;AACD,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@teleporthq/teleport-shared",
|
|
3
|
-
"version": "0.43.
|
|
3
|
+
"version": "0.43.75",
|
|
4
4
|
"description": "A utility belt for the entire teleportHQ ecosystem",
|
|
5
5
|
"author": "teleportHQ",
|
|
6
6
|
"license": "MIT",
|
|
@@ -25,9 +25,9 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@babel/types": "^7.5.5",
|
|
28
|
-
"@teleporthq/teleport-types": "^0.43.
|
|
28
|
+
"@teleporthq/teleport-types": "^0.43.75",
|
|
29
29
|
"jss": "^10.0.0",
|
|
30
30
|
"jss-preset-default": "^10.0.0"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "4bc0af8166575b4af971f39e63228ce2eefce661"
|
|
33
33
|
}
|
package/src/index.ts
CHANGED
|
@@ -20,12 +20,15 @@ import * as ProductOptions from './utils/product-options'
|
|
|
20
20
|
import * as CartLinePricing from './utils/cart-line-pricing'
|
|
21
21
|
import * as CartCurrency from './utils/cart-currency'
|
|
22
22
|
import * as TableAccess from './utils/table-access'
|
|
23
|
+
import * as ContentTables from './utils/content-tables'
|
|
23
24
|
import * as SessionCookieResolver from './utils/session-cookie-resolver'
|
|
24
25
|
import * as SubscriptionAccess from './utils/subscription-access'
|
|
25
26
|
import * as FontPreconnect from './utils/font-preconnect'
|
|
26
27
|
import * as EmailDate from './utils/email-date'
|
|
27
28
|
import * as RichTextEmbeds from './utils/rich-text-embeds'
|
|
28
29
|
import * as RichTextEmbedsCodegen from './utils/rich-text-embeds-codegen'
|
|
30
|
+
import * as RichTextContent from './utils/rich-text-content'
|
|
31
|
+
import * as RichTextContentCodegen from './utils/rich-text-content-codegen'
|
|
29
32
|
import * as DataCache from './cache'
|
|
30
33
|
import * as PageRevalidate from './page-revalidate'
|
|
31
34
|
import * as ScrollSceneRuntime from './scroll-scene'
|
|
@@ -58,12 +61,15 @@ export {
|
|
|
58
61
|
CartLinePricing,
|
|
59
62
|
CartCurrency,
|
|
60
63
|
TableAccess,
|
|
64
|
+
ContentTables,
|
|
61
65
|
SessionCookieResolver,
|
|
62
66
|
SubscriptionAccess,
|
|
63
67
|
FontPreconnect,
|
|
64
68
|
EmailDate,
|
|
65
69
|
RichTextEmbeds,
|
|
66
70
|
RichTextEmbedsCodegen,
|
|
71
|
+
RichTextContent,
|
|
72
|
+
RichTextContentCodegen,
|
|
67
73
|
DataCache,
|
|
68
74
|
PageRevalidate,
|
|
69
75
|
ScrollSceneRuntime,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// Generated by scripts/function-sources.js from variants.ts. Do not edit:
|
|
2
|
+
// `node scripts/function-sources.js` rewrites it, and its drift test fails until it is current.
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export const PAGE_TRANSITION_HELPER_SOURCES = {
|
|
6
|
+
reversePageTransitionPreset:
|
|
7
|
+
"function reversePageTransitionPreset(preset) {\n var pairs = {\n 'slide-up': 'slide-down',\n 'slide-down': 'slide-up',\n 'slide-left': 'slide-right',\n 'slide-right': 'slide-left',\n 'zoom-in': 'zoom-out',\n 'zoom-out': 'zoom-in',\n 'wipe-down': 'wipe-up',\n 'wipe-up': 'wipe-down',\n 'wipe-left': 'wipe-right',\n 'wipe-right': 'wipe-left',\n stack: 'unstack',\n unstack: 'stack',\n };\n return pairs[preset] || preset;\n}",
|
|
8
|
+
pageTransitionVariants:
|
|
9
|
+
"function pageTransitionVariants(preset, slidePx, context, options, custom) {\n var reverse = context ? context.reverse : false;\n var originX = context ? context.originX : '50%';\n var originY = context ? context.originY : '50%';\n var name = reverse ? reversePageTransitionPreset(preset) : preset;\n var bold = options\n ? options.distance === 'bold' || options.depth === 'bold' || options.amount === 'bold'\n : false;\n var near = bold ? slidePx * 4 : slidePx;\n var far = near * 2;\n var blurPx = options && options.softness === 'heavy' ? 28 : 12;\n var shrink = bold ? 0.85 : 0.94;\n var zoomOut = bold ? 0.85 : 0.96;\n var zoomIn = bold ? 1.15 : 1.04;\n if (name === 'custom') {\n var c = custom || {\n arrive: { opacity: 0, x: 0, y: 24, scale: 1, blur: 0 },\n leave: { opacity: 0, x: 0, y: -24, scale: 1, blur: 0 },\n };\n return {\n initial: {\n opacity: c.arrive.opacity,\n x: c.arrive.x,\n y: c.arrive.y,\n scale: c.arrive.scale,\n filter: 'blur(' + c.arrive.blur + 'px)',\n },\n animate: { opacity: 1, x: 0, y: 0, scale: 1, filter: 'blur(0px)' },\n exit: {\n opacity: c.leave.opacity,\n x: c.leave.x,\n y: c.leave.y,\n scale: c.leave.scale,\n filter: 'blur(' + c.leave.blur + 'px)',\n },\n };\n }\n if (name === 'fade') {\n return { initial: { opacity: 0 }, animate: { opacity: 1 }, exit: { opacity: 0 } };\n }\n if (name === 'crossfade') {\n return {\n initial: { opacity: 0, scale: 1.02 },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: 0.98 },\n };\n }\n if (name === 'blur') {\n return {\n initial: { opacity: 0, filter: 'blur(' + blurPx + 'px)' },\n animate: { opacity: 1, filter: 'blur(0px)' },\n exit: { opacity: 0, filter: 'blur(' + blurPx + 'px)' },\n };\n }\n if (name === 'slide-up') {\n return {\n initial: { opacity: 0, y: near },\n animate: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: -near },\n };\n }\n if (name === 'slide-down') {\n return {\n initial: { opacity: 0, y: -near },\n animate: { opacity: 1, y: 0 },\n exit: { opacity: 0, y: near },\n };\n }\n if (name === 'slide-left') {\n return {\n initial: { opacity: 0, x: far },\n animate: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: -far },\n };\n }\n if (name === 'slide-right') {\n return {\n initial: { opacity: 0, x: -far },\n animate: { opacity: 1, x: 0 },\n exit: { opacity: 0, x: far },\n };\n }\n if (name === 'stack') {\n return {\n initial: { opacity: 0, y: far },\n animate: { opacity: 1, y: 0, scale: 1 },\n exit: { opacity: 0, scale: shrink },\n };\n }\n if (name === 'unstack') {\n return {\n initial: { opacity: 0, scale: shrink },\n animate: { opacity: 1, y: 0, scale: 1 },\n exit: { opacity: 0, y: far },\n };\n }\n if (name === 'zoom-in') {\n return {\n initial: { opacity: 0, scale: zoomOut },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: zoomIn },\n };\n }\n if (name === 'zoom-out') {\n return {\n initial: { opacity: 0, scale: zoomIn },\n animate: { opacity: 1, scale: 1 },\n exit: { opacity: 0, scale: zoomOut },\n };\n }\n if (name === 'wipe-down') {\n return {\n initial: { clipPath: 'inset(0 0 100% 0)' },\n animate: { clipPath: 'inset(0 0 0% 0)' },\n exit: { clipPath: 'inset(100% 0 0 0)' },\n };\n }\n if (name === 'wipe-up') {\n return {\n initial: { clipPath: 'inset(100% 0 0 0)' },\n animate: { clipPath: 'inset(0% 0 0 0)' },\n exit: { clipPath: 'inset(0 0 100% 0)' },\n };\n }\n if (name === 'wipe-left') {\n return {\n initial: { clipPath: 'inset(0 0 0 100%)' },\n animate: { clipPath: 'inset(0 0 0 0%)' },\n exit: { clipPath: 'inset(0 100% 0 0)' },\n };\n }\n if (name === 'wipe-right') {\n return {\n initial: { clipPath: 'inset(0 100% 0 0)' },\n animate: { clipPath: 'inset(0 0% 0 0)' },\n exit: { clipPath: 'inset(0 0 0 100%)' },\n };\n }\n if (name === 'circle') {\n var at = ' at ' + originX + ' ' + originY + ')';\n return {\n initial: { clipPath: 'circle(0%' + at },\n animate: { clipPath: 'circle(150%' + at },\n exit: { clipPath: 'circle(0%' + at },\n };\n }\n if (name === 'cover' || name === 'curtain') {\n return { initial: { opacity: 1 }, animate: { opacity: 1 }, exit: { opacity: 0.999 } };\n }\n return null;\n}",
|
|
10
|
+
pageTransitionCover:
|
|
11
|
+
"function pageTransitionCover(preset) {\n if (preset === 'cover') {\n return [{ from: { y: '100%' }, cover: { y: '0%' }, away: { y: '-100%' } }];\n }\n if (preset === 'curtain') {\n return [\n { from: { x: '-100%' }, cover: { x: '0%' }, away: { x: '-100%' }, side: 'left' },\n { from: { x: '100%' }, cover: { x: '0%' }, away: { x: '100%' }, side: 'right' },\n ];\n }\n return null;\n}",
|
|
12
|
+
pageTransitionSkipPattern:
|
|
13
|
+
"function pageTransitionSkipPattern(route) {\n var escaped = route.replace(/[.*+?^$()|{}\\\\]/g, '\\\\$&');\n return new RegExp('^' + escaped.replace(/\\[[^\\]]+\\]/g, '[^/]+') + '/?$');\n}",
|
|
14
|
+
}
|
|
@@ -14,10 +14,7 @@
|
|
|
14
14
|
* canvas, the Next site and the HTML site move identically. (No backticks in
|
|
15
15
|
* the engine's own comments: it is a template literal.)
|
|
16
16
|
*/
|
|
17
|
-
import {
|
|
18
|
-
import { activeChapterIndex } from './chapter-index'
|
|
19
|
-
import { passedScenePoints, scenePointList, scenePointRank } from './points'
|
|
20
|
-
import { unclipStickyAncestors } from './unclip'
|
|
17
|
+
import { SCROLL_SCENE_HELPER_SOURCES } from './helper-sources.generated'
|
|
21
18
|
|
|
22
19
|
export const scrollSceneEngineSource = (): string => `const SCROLL_BIND_ATTR = 'data-scroll-bind'
|
|
23
20
|
// A chapter coming on stage is announced on the chapter element (bubbling), so
|
|
@@ -116,17 +113,17 @@ const isValidLane = (lane) => {
|
|
|
116
113
|
return lane.unit === undefined || lane.unit === 'px' || lane.unit === '%' || lane.unit === 'vw'
|
|
117
114
|
}
|
|
118
115
|
|
|
119
|
-
${settledMomentForLanes
|
|
116
|
+
${SCROLL_SCENE_HELPER_SOURCES.settledMomentForLanes}
|
|
120
117
|
|
|
121
|
-
${activeChapterIndex
|
|
118
|
+
${SCROLL_SCENE_HELPER_SOURCES.activeChapterIndex}
|
|
122
119
|
|
|
123
|
-
${scenePointList
|
|
120
|
+
${SCROLL_SCENE_HELPER_SOURCES.scenePointList}
|
|
124
121
|
|
|
125
|
-
${passedScenePoints
|
|
122
|
+
${SCROLL_SCENE_HELPER_SOURCES.passedScenePoints}
|
|
126
123
|
|
|
127
|
-
${scenePointRank
|
|
124
|
+
${SCROLL_SCENE_HELPER_SOURCES.scenePointRank}
|
|
128
125
|
|
|
129
|
-
${unclipStickyAncestors
|
|
126
|
+
${SCROLL_SCENE_HELPER_SOURCES.unclipStickyAncestors}
|
|
130
127
|
|
|
131
128
|
const parseScrollBind = (value) => {
|
|
132
129
|
const raw = String(value || '').trim()
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Generated by scripts/function-sources.js from moment.ts, chapter-index.ts, points.ts, unclip.ts. Do not edit:
|
|
2
|
+
// `node scripts/function-sources.js` rewrites it, and its drift test fails until it is current.
|
|
3
|
+
/* tslint:disable */
|
|
4
|
+
/* eslint-disable */
|
|
5
|
+
export const SCROLL_SCENE_HELPER_SOURCES = {
|
|
6
|
+
settledMomentForLanes:
|
|
7
|
+
'function settledMomentForLanes(lanes) {\n var arrive = -Infinity;\n var leave = Infinity;\n var lastStop = -Infinity;\n var found = false;\n for (var _i = 0, lanes_1 = lanes; _i < lanes_1.length; _i++) {\n var lane = lanes_1[_i];\n if (lane.at.length < 3) {\n continue;\n }\n var settledAt = null;\n for (var index = 1; index < lane.values.length - 1; index++) {\n if (lane.values[index] === lane.values[index + 1] && lane.values[index] !== lane.values[0]) {\n settledAt = index;\n break;\n }\n }\n if (settledAt === null && lane.values[0] === lane.values[1]) {\n settledAt = 0;\n }\n if (settledAt === null) {\n continue;\n }\n found = true;\n arrive = Math.max(arrive, lane.at[settledAt]);\n lastStop = Math.max(lastStop, lane.at[lane.at.length - 1]);\n var settledValue = lane.values[settledAt];\n for (var index = settledAt + 1; index < lane.values.length; index++) {\n if (lane.values[index] !== settledValue) {\n leave = Math.min(leave, lane.at[index - 1]);\n break;\n }\n }\n }\n if (!found) {\n return null;\n }\n if (leave === Infinity) {\n leave = lastStop;\n }\n if (leave < arrive) {\n return null;\n }\n return Math.round(((arrive + leave) / 2) * 10000) / 10000;\n}',
|
|
8
|
+
activeChapterIndex:
|
|
9
|
+
'function activeChapterIndex(moments, progress) {\n var active = -1;\n var best = -Infinity;\n for (var index = 0; index < moments.length; index++) {\n var moment = moments[index];\n if (moment <= progress + 0.000001 && moment >= best) {\n best = moment;\n active = index;\n }\n }\n return active;\n}',
|
|
10
|
+
scenePointList:
|
|
11
|
+
"function scenePointList() {\n return [\n { key: 'quarter', at: 0.25 },\n { key: 'half', at: 0.5 },\n { key: 'three-quarters', at: 0.75 },\n { key: 'end', at: 1 },\n ];\n}",
|
|
12
|
+
passedScenePoints:
|
|
13
|
+
'function passedScenePoints(from, to) {\n var passed = [];\n var points = scenePointList();\n for (var index = 0; index < points.length; index++) {\n var point = points[index];\n if (point.at > from + 0.000001 && point.at <= to + 0.000001) {\n passed.push(point.key);\n }\n }\n return passed;\n}',
|
|
14
|
+
scenePointRank:
|
|
15
|
+
'function scenePointRank(key) {\n var points = scenePointList();\n for (var index = 0; index < points.length; index++) {\n if (points[index].key === key) {\n return index + 1;\n }\n }\n return 0;\n}',
|
|
16
|
+
unclipStickyAncestors:
|
|
17
|
+
"function unclipStickyAncestors(track, getStyle) {\n var unclipped = [];\n var element = track.parentElement;\n while (element && element !== element.ownerDocument.documentElement) {\n var style = getStyle(element);\n var both = style.overflow === 'hidden';\n var axes = [];\n if (both || style.overflowX === 'hidden') {\n axes.push('x');\n }\n if (both || style.overflowY === 'hidden') {\n axes.push('y');\n }\n if (axes.length > 0) {\n var host = element;\n for (var i = 0; i < axes.length; i++) {\n host.style.setProperty('overflow-' + axes[i], 'clip');\n }\n host.setAttribute('data-scene-unclipped', axes.join(''));\n unclipped.push(host.tagName.toLowerCase() +\n (host.className ? '.' + String(host.className).split(' ')[0] : ''));\n }\n element = element.parentElement;\n }\n return unclipped;\n}",
|
|
18
|
+
}
|
|
@@ -2,6 +2,7 @@ export { settledMomentForLanes, MomentLane } from './moment'
|
|
|
2
2
|
export { activeChapterIndex } from './chapter-index'
|
|
3
3
|
export { passedScenePoints, scenePointList, scenePointRank } from './points'
|
|
4
4
|
export { unclipStickyAncestors } from './unclip'
|
|
5
|
+
export { SCROLL_SCENE_HELPER_SOURCES } from './helper-sources.generated'
|
|
5
6
|
export { scrollSceneEngineSource as engineSource } from './engine-source'
|
|
6
7
|
export {
|
|
7
8
|
announcementsSource,
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The content presets — the Blog, and every feature built like it — and the
|
|
3
|
+
* tables each one keeps. The ONE list the editor and the generators read: the
|
|
4
|
+
* editor's `ContentPreset` is built on these entries, the generated site's
|
|
5
|
+
* read routes, view models and feeds recognise a content table through
|
|
6
|
+
* `contentTableRole`. A preset added here and nowhere else is caught by the
|
|
7
|
+
* editor's wiring test; a table named anywhere else is a copy that drifts.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export type ContentPresetKey = 'blog' | 'help'
|
|
11
|
+
|
|
12
|
+
export type ContentTableRole = 'posts' | 'comments'
|
|
13
|
+
|
|
14
|
+
export interface ContentTables {
|
|
15
|
+
key: ContentPresetKey
|
|
16
|
+
/** The rows the preset publishes: one per post / article. */
|
|
17
|
+
posts: string
|
|
18
|
+
/** Reader comments under a post, when the preset takes them. */
|
|
19
|
+
comments: string | null
|
|
20
|
+
/**
|
|
21
|
+
* Whether a post without a picture is shown with the grey "No image" stand-in.
|
|
22
|
+
* Off for a preset whose posts are text: its cards and post page close up
|
|
23
|
+
* instead of drawing an empty grey box on every article.
|
|
24
|
+
*/
|
|
25
|
+
pictureStandIn: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const CONTENT_TABLES: ReadonlyArray<ContentTables> = [
|
|
29
|
+
{
|
|
30
|
+
key: 'blog',
|
|
31
|
+
posts: 'teleport_blog_posts',
|
|
32
|
+
comments: 'teleport_blog_comments',
|
|
33
|
+
pictureStandIn: true,
|
|
34
|
+
},
|
|
35
|
+
// The Help Center: articles at /help/<slug>, no reader comments, and a text
|
|
36
|
+
// article shows no picture at all rather than a stand-in.
|
|
37
|
+
{ key: 'help', posts: 'teleport_help_articles', comments: null, pictureStandIn: false },
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
export const CONTENT_POSTS_TABLES: ReadonlyArray<string> = CONTENT_TABLES.map(
|
|
41
|
+
(tables) => tables.posts
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
export const CONTENT_COMMENTS_TABLES: ReadonlyArray<string> = CONTENT_TABLES.map(
|
|
45
|
+
(tables) => tables.comments
|
|
46
|
+
).filter((table): table is string => table !== null)
|
|
47
|
+
|
|
48
|
+
export const contentTablesByKey = (key: ContentPresetKey): ContentTables => {
|
|
49
|
+
const tables = CONTENT_TABLES.find((entry) => entry.key === key)
|
|
50
|
+
if (!tables) {
|
|
51
|
+
throw new Error(`No content preset is registered under "${key}"`)
|
|
52
|
+
}
|
|
53
|
+
return tables
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** Which preset a table belongs to and what it holds there; null for any other table. */
|
|
57
|
+
export const contentTableRole = (
|
|
58
|
+
tableName: string
|
|
59
|
+
): { key: ContentPresetKey; role: ContentTableRole } | null => {
|
|
60
|
+
for (const tables of CONTENT_TABLES) {
|
|
61
|
+
if (tableName === tables.posts) {
|
|
62
|
+
return { key: tables.key, role: 'posts' }
|
|
63
|
+
}
|
|
64
|
+
if (tableName === tables.comments) {
|
|
65
|
+
return { key: tables.key, role: 'comments' }
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
return null
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export const isContentPostsTable = (tableName: string): boolean =>
|
|
72
|
+
contentTableRole(tableName)?.role === 'posts'
|
|
73
|
+
|
|
74
|
+
export interface VisitorRowPolicy {
|
|
75
|
+
/** SQL every browser read of the table is narrowed with. */
|
|
76
|
+
predicate: string
|
|
77
|
+
/** Keys never served to a browser, wherever they sit in a row (raw and transformed names). */
|
|
78
|
+
hiddenColumns: ReadonlyArray<string>
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/**
|
|
82
|
+
* What a visitor is served of a posts table: ONLY `published` rows — drafts,
|
|
83
|
+
* scheduled and archived posts are the author's (the editor's post statuses in
|
|
84
|
+
* `blog-post-status.ts`) — and never the author's email address.
|
|
85
|
+
*/
|
|
86
|
+
export const CONTENT_POSTS_VISITOR_ROW_POLICY: VisitorRowPolicy = {
|
|
87
|
+
predicate: "status = 'published'",
|
|
88
|
+
hiddenColumns: ['author_email', 'authorEmail'],
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* What a browser is served of the tables whose unpublished rows sit beside the
|
|
93
|
+
* public ones. Read by both route families of a generated site — the per-table
|
|
94
|
+
* read routes (teleport-plugin-next-data-source) and the workflow data API
|
|
95
|
+
* (teleport-plugin-next-workflows) — so no reader can disagree about what a
|
|
96
|
+
* visitor sees.
|
|
97
|
+
*/
|
|
98
|
+
export const VISITOR_ROW_POLICIES: Readonly<Record<string, VisitorRowPolicy>> = {
|
|
99
|
+
...Object.fromEntries(
|
|
100
|
+
CONTENT_POSTS_TABLES.map((table) => [table, CONTENT_POSTS_VISITOR_ROW_POLICY])
|
|
101
|
+
),
|
|
102
|
+
// The storefront sells `active` products; a draft or inactive one is the
|
|
103
|
+
// merchant's, spelled in any case the admin form stored it in.
|
|
104
|
+
teleport_products: {
|
|
105
|
+
predicate: "LOWER(TRIM(status)) = 'active'",
|
|
106
|
+
hiddenColumns: [],
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/* ------------------------------------------------------------------------ */
|
|
111
|
+
/* Category pages */
|
|
112
|
+
/* ------------------------------------------------------------------------ */
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* The generated module a preset's category page reads from — one function
|
|
116
|
+
* resolves the category at a slug with its published posts for
|
|
117
|
+
* `getStaticProps`, the other lists every category's slug for
|
|
118
|
+
* `getStaticPaths`. The editor names them on the page's UIDL (an external
|
|
119
|
+
* resource with a local dependency), the Next generator emits them; both read
|
|
120
|
+
* the names from here, so neither can misspell the other.
|
|
121
|
+
*/
|
|
122
|
+
export const CONTENT_CATEGORY_PAGES_MODULE = '@/content-category-pages'
|
|
123
|
+
|
|
124
|
+
const presetPascalCase = (key: ContentPresetKey): string =>
|
|
125
|
+
key.charAt(0).toUpperCase() + key.slice(1)
|
|
126
|
+
|
|
127
|
+
/** `resolveHelpCategoryPage`: `{ data: category | null }` for a slug. */
|
|
128
|
+
export const contentCategoryPageResolverName = (key: ContentPresetKey): string =>
|
|
129
|
+
`resolve${presetPascalCase(key)}CategoryPage`
|
|
130
|
+
|
|
131
|
+
/** `listHelpCategoryPaths`: `{ data: [{ slug }] }`, every category of the tree. */
|
|
132
|
+
export const contentCategoryPathsListerName = (key: ContentPresetKey): string =>
|
|
133
|
+
`list${presetPascalCase(key)}CategoryPaths`
|
|
134
|
+
|
|
135
|
+
/* ------------------------------------------------------------------------ */
|
|
136
|
+
/* The live site index */
|
|
137
|
+
/* ------------------------------------------------------------------------ */
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Where the generated site serves a preset's live sitemap: its published posts,
|
|
141
|
+
* read from the table on request, so a post published after the last publish
|
|
142
|
+
* is listed too. The editor's own `sitemap.xml` names it from its sitemap
|
|
143
|
+
* index; both sides read the address from here.
|
|
144
|
+
*/
|
|
145
|
+
export const contentSitemapPath = (key: ContentPresetKey): string => `/sitemap-${key}.xml`
|
|
146
|
+
|
|
147
|
+
/** The site's list for language models: its pages, then each preset's posts by category. */
|
|
148
|
+
export const LLMS_TXT_PATH = '/llms.txt'
|
|
149
|
+
|
|
150
|
+
/** Every published post of the presets, in full, as Markdown. */
|
|
151
|
+
export const LLMS_FULL_TXT_PATH = '/llms-full.txt'
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Code-generation half of the rich-text content contract. Kept apart from
|
|
3
|
+
* `rich-text-content.ts` on purpose: that module is imported by the studio
|
|
4
|
+
* editor and the canvas renderer, which are browser bundles. Only the project
|
|
5
|
+
* generator imports this file.
|
|
6
|
+
*/
|
|
7
|
+
import { RICH_TEXT_CONTENT_RUNTIME_MODULE_SOURCE } from './rich-text-content-runtime-source'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* `components/rich-text-content.js` for the generated project: the converter
|
|
11
|
+
* its rich-text editor runs on the way in and out, and the protected block's
|
|
12
|
+
* helpers. A STRING committed beside this file for the same reason the embed
|
|
13
|
+
* runtime is (`generateEmbedRuntimeModuleSource`): the generator runs inside a
|
|
14
|
+
* minified bundle where `Function.prototype.toString` prints renamed code.
|
|
15
|
+
* `__tests__/utils/rich-text-content-runtime-module.ts` fails when the string
|
|
16
|
+
* drifts from `rich-text-content.ts` and regenerates it with
|
|
17
|
+
* UPDATE_RICH_TEXT_CONTENT_RUNTIME=1.
|
|
18
|
+
*/
|
|
19
|
+
export function generateRichTextContentRuntimeModuleSource(): string {
|
|
20
|
+
return RICH_TEXT_CONTENT_RUNTIME_MODULE_SOURCE
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const RENDER_TIME_NAMES = [
|
|
24
|
+
'QUILL_LIST_ITEM_ATTR',
|
|
25
|
+
'escapeRichTextText',
|
|
26
|
+
'buildCodeBlockHtml',
|
|
27
|
+
'normalizeLegacyRichTextHtml',
|
|
28
|
+
'rebuildQuillListHtml',
|
|
29
|
+
'rebuildQuillCodeBlockHtml',
|
|
30
|
+
'mergeBlockquoteLines',
|
|
31
|
+
]
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* The string-only half of the contract as plain declarations, for the data
|
|
35
|
+
* modules a generated page runs in `getStaticProps`: a post stored before the
|
|
36
|
+
* contract (the studio's flat list lines, the admin panel's no-break spaces)
|
|
37
|
+
* renders as stored HTML would, without waiting for its next save. Cut from
|
|
38
|
+
* the committed runtime module, so it can never drift from it.
|
|
39
|
+
*/
|
|
40
|
+
export function generateLegacyRichTextNormalizerCode(): string {
|
|
41
|
+
const chunks = RICH_TEXT_CONTENT_RUNTIME_MODULE_SOURCE.split(/\n\n(?=export )/)
|
|
42
|
+
const picked = RENDER_TIME_NAMES.map((name) => {
|
|
43
|
+
const chunk = chunks.find((candidate) =>
|
|
44
|
+
new RegExp(`^export (?:var|function) ${name}\\b`).test(candidate)
|
|
45
|
+
)
|
|
46
|
+
if (!chunk) {
|
|
47
|
+
throw new Error(`Rich-text content runtime has no ${name} to cut for the data module`)
|
|
48
|
+
}
|
|
49
|
+
return chunk.replace(/^export /, '').replace(/\n$/, '')
|
|
50
|
+
})
|
|
51
|
+
return picked.join('\n\n')
|
|
52
|
+
}
|