@flamingo-stack/openframe-frontend-core 0.0.799 → 0.0.801
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/{chunk-4RK62AMV.cjs → chunk-237MLBT7.cjs} +68 -68
- package/dist/{chunk-IJGIWG6G.cjs → chunk-3W2PBWD5.cjs} +4 -4
- package/dist/{chunk-BSBCZIPQ.cjs → chunk-3YPEXJVQ.cjs} +39 -39
- package/dist/{chunk-GRNTIKPD.cjs → chunk-7E4BC3AF.cjs} +68 -51
- package/dist/{chunk-6CB3AXZM.cjs → chunk-CJSUMYTH.cjs} +30 -30
- package/dist/{chunk-PPORXZI7.cjs → chunk-CRVXQYUZ.cjs} +25 -25
- package/dist/{chunk-FDDM5Z52.cjs → chunk-DYDS2P5G.cjs} +2 -2
- package/dist/{chunk-FIKIPO4F.cjs → chunk-FAUVDMH4.cjs} +1 -1
- package/dist/{chunk-SDV335EO.cjs → chunk-FFRFKWTZ.cjs} +4 -4
- package/dist/{chunk-XJD7IZR2.cjs → chunk-FS4TVAE7.cjs} +48 -48
- package/dist/{chunk-AVAE5B2A.cjs → chunk-KVGWOJCX.cjs} +2 -2
- package/dist/{chunk-HB7FVY46.cjs → chunk-LEEBFBI4.cjs} +32 -32
- package/dist/{chunk-UFCKY7OL.cjs → chunk-LOCJD7TD.cjs} +16 -16
- package/dist/{chunk-6EDOASF4.cjs → chunk-PJMLRXAG.cjs} +11 -11
- package/dist/{chunk-TETW5NR4.cjs → chunk-PY6SPYUR.cjs} +3 -3
- package/dist/{chunk-2KEBGXA4.cjs → chunk-QAUQYQWT.cjs} +4 -4
- package/dist/{chunk-CS2KLF4O.cjs → chunk-QNIUDJAK.cjs} +13 -13
- package/dist/{chunk-B3X4J4HQ.cjs → chunk-SHOE6ATQ.cjs} +14 -14
- package/dist/{chunk-PO5IIN4S.cjs → chunk-THQKEA2T.cjs} +11 -11
- package/dist/{chunk-O6KQ64RI.cjs → chunk-UYGXJ5SQ.cjs} +2 -2
- package/dist/{chunk-3MRK7X6Z.cjs → chunk-XYPNYTCV.cjs} +3 -3
- package/dist/{chunk-ZOK4OWMJ.cjs → chunk-Y5XHMEBB.cjs} +2 -2
- package/dist/{chunk-247LDSQE.cjs → chunk-YUGX72P4.cjs} +61 -61
- package/dist/{chunk-DBRXZC2I.cjs → chunk-Z66FOMSA.cjs} +136 -129
- package/dist/{chunk-T5OCU3EL.cjs → chunk-ZPVFFPQM.cjs} +4 -4
- package/dist/{cloud-tenants-BQAVRN44.cjs → cloud-tenants-X7QHAIX2.cjs} +6 -6
- package/dist/components/case-studies/index.cjs +20 -20
- package/dist/components/chat/chat-context-picker.d.ts.map +1 -1
- package/dist/components/chat/chat-context-picker.js +16 -14
- package/dist/components/chat/index.cjs +5 -5
- package/dist/components/contact/index.cjs +7 -7
- package/dist/components/docs/index.cjs +10 -10
- package/dist/components/embeds/index.cjs +7 -7
- package/dist/components/faq/index.cjs +8 -8
- package/dist/components/features/index.cjs +6 -6
- package/dist/components/help-center-pages/index.cjs +82 -82
- package/dist/components/index.cjs +52 -52
- package/dist/components/layout/page-heading.js +1 -1
- package/dist/components/meeting-scheduler/index.cjs +38 -38
- package/dist/components/navigation/index.cjs +9 -9
- package/dist/components/onboarding-guides/index.cjs +9 -9
- package/dist/components/product-demo/index.cjs +15 -15
- package/dist/components/related-content/index.cjs +5 -5
- package/dist/components/tickets/index.cjs +13 -13
- package/dist/components/ui/fade-preview.d.ts.map +1 -1
- package/dist/components/ui/fade-preview.js +9 -2
- package/dist/components/ui/index.cjs +6 -6
- package/dist/{devices-KDT5ZGSG.cjs → devices-VBFYZVVG.cjs} +7 -7
- package/dist/{embeddable-chat-ODKTSW3C.cjs → embeddable-chat-XZDZOHFY.cjs} +62 -62
- package/dist/index.cjs +10 -10
- package/dist/{knowledge-4NLP77HP.cjs → knowledge-RJZJFD2Y.cjs} +7 -7
- package/dist/loading-standard/engine.d.mts +1 -0
- package/dist/loading-standard/engine.d.mts.map +1 -1
- package/dist/loading-standard/rule-examples.d.mts.map +1 -1
- package/dist/{logs-U6VMTY4N.cjs → logs-3WZ4GROE.cjs} +14 -14
- package/dist/{policies-TBLFBRFM.cjs → policies-E6WQEXDF.cjs} +10 -10
- package/dist/{scripts-ZMNJWX7I.cjs → scripts-JLCM42F4.cjs} +11 -11
- package/dist/{software-update-Q5AEQ4A4.cjs → software-update-BVBHAROC.cjs} +9 -9
- package/dist/utils/index.cjs +16 -1
- package/dist/utils/markdown-to-plain.d.ts.map +1 -1
- package/dist/utils/markdown-to-plain.js +16 -1
- package/package.json +1 -1
- package/src/components/chat/chat-context-picker.tsx +30 -16
- package/src/components/layout/page-heading.tsx +3 -1
- package/src/components/ui/fade-preview.tsx +13 -2
- package/src/loading-standard/engine.mjs +49 -2
- package/src/loading-standard/rule-examples.mjs +35 -3
- package/src/utils/markdown-to-plain.ts +23 -4
|
@@ -69,6 +69,14 @@
|
|
|
69
69
|
* by one, share one boundary; the page's static frame (heading, copy, back link, cached content)
|
|
70
70
|
* renders at once, outside every boundary. A component that reads in the browser keeps its own
|
|
71
71
|
* loading state (`LoadingWhen`, `useLoadingScope`) and needs no boundary.
|
|
72
|
+
* BOUNDARY_OWNER A `LoadingSuspense` placed AROUND a component instead of BY it. The boundary is the whole output
|
|
73
|
+
* of the component that waits (the root element it returns), wrapping exactly one component
|
|
74
|
+
* declared in the same file (its reader), with no `fallback`: the reader draws its own loading form
|
|
75
|
+
* in the scope the boundary opens (`useLoadingScope()`, the skeletons inside the component). A
|
|
76
|
+
* parent renders the component and never wraps it; a fallback built beside the reader, a boundary
|
|
77
|
+
* around an imported component, around markup or an expression, or in the middle of a layout,
|
|
78
|
+
* each puts a component's loading state outside the component. A host's own boundary built on it
|
|
79
|
+
* (`config.boundaries`) opts out where it is defined.
|
|
72
80
|
* WHOLE_VIEW_SKELETON A component declared or rendered as `*PageSkeleton`, `*ScreenSkeleton`, `*DetailSkeleton`,
|
|
73
81
|
* `*ArticleSkeleton`, `*ViewSkeleton`, `*HomeSkeleton`, `*DeckSkeleton`, `*EditorSkeleton`,
|
|
74
82
|
* `*CenterSkeleton`, `*CatalogSkeleton`, `*FormSkeleton`, `*LayoutSkeleton`,
|
|
@@ -192,6 +200,8 @@ export const RULES = {
|
|
|
192
200
|
RAW_SUSPENSE: 'a raw Suspense (use LoadingSuspense: its fallback is the component it waits on, in a loading scope)',
|
|
193
201
|
PAGE_BOUNDARY:
|
|
194
202
|
'a boundary around a whole page (wrap only the component that waits on a read; the static frame renders at once)',
|
|
203
|
+
BOUNDARY_OWNER:
|
|
204
|
+
'a boundary placed around a component (the component that waits returns <LoadingSuspense><Reader /></LoadingSuspense>, the reader draws its own loading form)',
|
|
195
205
|
WHOLE_VIEW_SKELETON: 'a whole-view skeleton (the view itself in a loading scope is its loading state)',
|
|
196
206
|
FOLD_PROP: 'a `fold` prop (a skeleton draws its full count: skeletonCount)',
|
|
197
207
|
DEPRECATED_SKELETON: 'deprecated in the lib (render the component in a loading scope)',
|
|
@@ -248,7 +258,7 @@ export const CONFIGS = {
|
|
|
248
258
|
* a loading scope until it answers), which renders directly when told `cached`.
|
|
249
259
|
*/
|
|
250
260
|
hub: {
|
|
251
|
-
rules: ['SUSPENSE_FALLBACK', 'HAND_PAIR', 'RAW_SUSPENSE', 'PAGE_BOUNDARY'],
|
|
261
|
+
rules: ['SUSPENSE_FALLBACK', 'HAND_PAIR', 'RAW_SUSPENSE', 'PAGE_BOUNDARY', 'BOUNDARY_OWNER'],
|
|
252
262
|
trees: ['app', 'components', 'lib'],
|
|
253
263
|
boundaries: { StreamedSection: 'cached' },
|
|
254
264
|
exempt: [],
|
|
@@ -260,7 +270,14 @@ export const CONFIGS = {
|
|
|
260
270
|
why: "the lib's own loading primitives: the one pulse, the scope, the fallback and the Suspense wrapper are built here",
|
|
261
271
|
files:
|
|
262
272
|
/(?:^|\/)components\/(?:loading\/(?:loading-fallback|loading-region|unified-skeleton)|ui\/(?:loading-scope|skeleton[\w-]*|text-line-skeleton))\.tsx?$/,
|
|
263
|
-
rules: [
|
|
273
|
+
rules: [
|
|
274
|
+
'OWN_PULSE',
|
|
275
|
+
'HAND_PAIR',
|
|
276
|
+
'SUSPENSE_FALLBACK',
|
|
277
|
+
'RAW_SUSPENSE',
|
|
278
|
+
'NOTHING_WHILE_LOADING',
|
|
279
|
+
'BOUNDARY_OWNER',
|
|
280
|
+
],
|
|
264
281
|
},
|
|
265
282
|
{
|
|
266
283
|
why: "the loaders themselves (declared, never a screen state in the lib), the Button's own action progress, and the chat registry's card loader (a card read by id, drawn by the card's own skeleton)",
|
|
@@ -2303,6 +2320,7 @@ function analyzeFile(project, path, active, rel, page, boundaries = {}) {
|
|
|
2303
2320
|
}
|
|
2304
2321
|
}
|
|
2305
2322
|
if (leaf === 'Suspense' || leaf === 'LoadingSuspense') checkFallback(opening, leaf);
|
|
2323
|
+
if (leaf === 'LoadingSuspense') checkBoundaryOwner(opening);
|
|
2306
2324
|
if (leaf === 'LoadingFallback' && ts.isJsxOpeningElement(opening)) {
|
|
2307
2325
|
const children = opening.parent.children.filter(c => !(ts.isJsxText(c) && !c.text.trim()));
|
|
2308
2326
|
if (children.every(c => (ts.isJsxExpression(c) ? !c.expression || isBlank(c.expression) : isBlank(c))))
|
|
@@ -2349,6 +2367,35 @@ function analyzeFile(project, path, active, rel, page, boundaries = {}) {
|
|
|
2349
2367
|
}
|
|
2350
2368
|
}
|
|
2351
2369
|
|
|
2370
|
+
/**
|
|
2371
|
+
* BOUNDARY_OWNER: the boundary is the root element its component returns, around one component declared in this file,
|
|
2372
|
+
* with no fallback of its own.
|
|
2373
|
+
*/
|
|
2374
|
+
function checkBoundaryOwner(opening) {
|
|
2375
|
+
const problems = [];
|
|
2376
|
+
if (attribute(opening, 'fallback'))
|
|
2377
|
+
problems.push('it takes a fallback (the component it wraps draws its own loading form in the scope)');
|
|
2378
|
+
const el = ts.isJsxOpeningElement(opening) ? opening.parent : opening;
|
|
2379
|
+
const kids = ts.isJsxElement(el) ? el.children.filter(c => !(ts.isJsxText(c) && !c.text.trim())) : [];
|
|
2380
|
+
const only = kids.length === 1 && !ts.isJsxExpression(kids[0]) ? openingOf(kids[0]) : null;
|
|
2381
|
+
const name = only ? dottedName(only.tagName) : '';
|
|
2382
|
+
const decl = name && isComponentName(name) && !name.includes('.') ? model.lookup(name, el) : null;
|
|
2383
|
+
if (!decl || decl.kind === 'import' || decl.kind === 'namespace' || decl.kind === 'param')
|
|
2384
|
+
problems.push(
|
|
2385
|
+
name && isComponentName(name)
|
|
2386
|
+
? `it wraps ${name}, which is not declared in this file (move the boundary into ${name})`
|
|
2387
|
+
: 'it does not wrap exactly one component declared in this file',
|
|
2388
|
+
);
|
|
2389
|
+
let at = el.parent;
|
|
2390
|
+
while (at && ts.isParenthesizedExpression(at)) at = at.parent;
|
|
2391
|
+
const fn = nearestFunction(el);
|
|
2392
|
+
const isRoot = !!fn && (ts.isReturnStatement(at) ? nearestFunction(at) === fn : at === fn && fn.body === el);
|
|
2393
|
+
if (!isRoot || !isComponentName(functionName(fn)))
|
|
2394
|
+
problems.push("it is not the whole output of the component it is written in (make it that component's root)");
|
|
2395
|
+
if (problems.length)
|
|
2396
|
+
report('BOUNDARY_OWNER', opening, `a boundary placed around a component, not by it: ${problems.join('; ')}`);
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2352
2399
|
/** A `Suspense` / `LoadingSuspense` fallback that draws nothing (LoadingSuspense's own default is its children). */
|
|
2353
2400
|
function checkFallback(opening, leaf) {
|
|
2354
2401
|
const fallback = attribute(opening, 'fallback');
|
|
@@ -231,7 +231,7 @@ export function L({ loading }: { loading: boolean }) { return loading ? <Wait />
|
|
|
231
231
|
},
|
|
232
232
|
pass: {
|
|
233
233
|
'components/su.tsx':
|
|
234
|
-
'
|
|
234
|
+
'function XReader() { return <X />; }\nexport function Su() { return <LoadingSuspense label="Loading X"><XReader /></LoadingSuspense>; }\n',
|
|
235
235
|
},
|
|
236
236
|
},
|
|
237
237
|
{
|
|
@@ -244,7 +244,7 @@ export function L({ loading }: { loading: boolean }) { return loading ? <Wait />
|
|
|
244
244
|
'components/raw.tsx': `export function Raw() {
|
|
245
245
|
return (
|
|
246
246
|
<>
|
|
247
|
-
<
|
|
247
|
+
<X />
|
|
248
248
|
{/* loading-standard-ok(SUSPENSE_FALLBACK): structured data for crawlers, nothing is drawn */}
|
|
249
249
|
<Suspense fallback={null}><StructuredData /></Suspense>
|
|
250
250
|
</>
|
|
@@ -274,13 +274,45 @@ export function L({ loading }: { loading: boolean }) { return loading ? <Wait />
|
|
|
274
274
|
'app/devices/page.tsx': `export default function Page() {
|
|
275
275
|
return (
|
|
276
276
|
<>
|
|
277
|
+
<DevicesHeading />
|
|
278
|
+
<DevicesTable />
|
|
279
|
+
</>
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
`,
|
|
283
|
+
},
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
rule: 'BOUNDARY_OWNER',
|
|
287
|
+
fail: {
|
|
288
|
+
'components/devices-view.tsx': `import { DevicesTable } from './devices-table';
|
|
289
|
+
export function DevicesView() {
|
|
290
|
+
return (
|
|
291
|
+
<div>
|
|
277
292
|
<DevicesHeading />
|
|
278
293
|
<LoadingSuspense label="Loading the devices">
|
|
279
294
|
<DevicesTable />
|
|
280
295
|
</LoadingSuspense>
|
|
281
|
-
|
|
296
|
+
</div>
|
|
297
|
+
);
|
|
298
|
+
}
|
|
299
|
+
`,
|
|
300
|
+
'components/run-view.tsx':
|
|
301
|
+
'function RunReader() { return <Run />; }\nexport function RunView() { return <LoadingSuspense label="Loading the run" fallback={<RunSkeleton />}><RunReader /></LoadingSuspense>; }\n',
|
|
302
|
+
},
|
|
303
|
+
pass: {
|
|
304
|
+
'components/devices-table.tsx': `/** The table, with its own boundary: in the scope the reader draws its own rows. */
|
|
305
|
+
export function DevicesTable(props: { search: string }) {
|
|
306
|
+
return (
|
|
307
|
+
<LoadingSuspense label="Loading the devices">
|
|
308
|
+
<DevicesTableReader {...props} />
|
|
309
|
+
</LoadingSuspense>
|
|
282
310
|
);
|
|
283
311
|
}
|
|
312
|
+
function DevicesTableReader({ search }: { search: string }) {
|
|
313
|
+
const loading = useLoadingScope();
|
|
314
|
+
return <Table rows={loading ? [] : useDevices(search)} loading={loading} />;
|
|
315
|
+
}
|
|
284
316
|
`,
|
|
285
317
|
},
|
|
286
318
|
},
|
|
@@ -61,6 +61,25 @@ const NOT_PROSE = new Set(['pre', 'img']);
|
|
|
61
61
|
|
|
62
62
|
const TABLE_SECTIONS = new Set(['thead', 'tbody', 'tfoot']);
|
|
63
63
|
|
|
64
|
+
const element = (tagName: string, children: Element['children']): Element => ({
|
|
65
|
+
type: 'element',
|
|
66
|
+
tagName,
|
|
67
|
+
properties: {},
|
|
68
|
+
children,
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/** Whether `toText` already breaks between a table's sections (current `hast-util-to-text` does; an older one ran
|
|
72
|
+
* the header row into the first body row). Asked once, of a one-cell header over a one-cell body. */
|
|
73
|
+
let sectionsBreak: boolean | undefined;
|
|
74
|
+
function toTextBreaksBetweenSections(): boolean {
|
|
75
|
+
if (sectionsBreak === undefined) {
|
|
76
|
+
const row = (text: string) => element('tr', [element('td', [{ type: 'text', value: text }])]);
|
|
77
|
+
const table = element('table', [element('thead', [row('a')]), element('tbody', [row('b')])]);
|
|
78
|
+
sectionsBreak = toText({ type: 'root', children: [table] }).includes('\n');
|
|
79
|
+
}
|
|
80
|
+
return sectionsBreak;
|
|
81
|
+
}
|
|
82
|
+
|
|
64
83
|
/** The renderer's steps, as functions: markdown (GFM) → line breaks → HTML tree with raw HTML parsed. */
|
|
65
84
|
function htmlTree(markdown: string): Root {
|
|
66
85
|
const mdast = fromMarkdown(markdown, { extensions: [gfm()], mdastExtensions: [gfmFromMarkdown()] });
|
|
@@ -75,10 +94,10 @@ function proseTree(markdown: string): Root {
|
|
|
75
94
|
parent.children.splice(index, 1);
|
|
76
95
|
return [SKIP, index];
|
|
77
96
|
}
|
|
78
|
-
// `innerText`
|
|
79
|
-
// ran into the first body row ("What it buysEnthusiast").
|
|
80
|
-
// its last row with a line break.
|
|
81
|
-
if (TABLE_SECTIONS.has(node.tagName) && parent && index !== undefined) {
|
|
97
|
+
// An older `innerText` broke between rows of the same `thead` / `tbody` only, so the last header
|
|
98
|
+
// row ran into the first body row ("What it buysEnthusiast"). There, a section followed by
|
|
99
|
+
// another ends its last row with a line break; a current one breaks there itself.
|
|
100
|
+
if (TABLE_SECTIONS.has(node.tagName) && parent && index !== undefined && !toTextBreaksBetweenSections()) {
|
|
82
101
|
const followedBySection = parent.children
|
|
83
102
|
.slice(index + 1)
|
|
84
103
|
.some(sibling => sibling.type === 'element' && TABLE_SECTIONS.has(sibling.tagName));
|