tungsten 0.3.3 → 0.3.5
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/.build-complete +1 -1
- package/dist/Components.d.ts +6 -1
- package/dist/Components.d.ts.map +1 -1
- package/dist/Components.js +103 -40
- package/dist/DomPointer.d.ts +11 -0
- package/dist/DomPointer.d.ts.map +1 -1
- package/dist/DomPointer.js +15 -0
- package/dist/DomRegion.d.ts +2 -0
- package/dist/DomRegion.d.ts.map +1 -1
- package/dist/DomRegion.js +23 -3
- package/dist/Framework.d.ts.map +1 -1
- package/dist/Framework.js +28 -6
- package/dist/FrameworkConfig.d.ts +2 -0
- package/dist/FrameworkConfig.d.ts.map +1 -1
- package/dist/Instance/Instance.d.ts +1 -1
- package/dist/Instance/Instance.d.ts.map +1 -1
- package/dist/Servers/DevServer.d.ts.map +1 -1
- package/dist/Servers/DevServer.js +3 -3
- package/dist/Servers/ProdServer.d.ts +1 -1
- package/dist/Servers/ProdServer.d.ts.map +1 -1
- package/dist/Servers/ProdServer.js +13 -3
- package/dist/Servers/loadEnvsDev.d.ts.map +1 -1
- package/dist/Servers/loadEnvsDev.js +17 -6
- package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts +13 -0
- package/dist/babelPlugins/BabelExtractComponentStylesheet.d.ts.map +1 -0
- package/dist/babelPlugins/BabelExtractComponentStylesheet.js +24 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts +2 -0
- package/dist/babelPlugins/BabelTransformComponentStyles.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformComponentStyles.js +21 -5
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts +1 -0
- package/dist/babelPlugins/BabelTransformPackageImports.d.ts.map +1 -1
- package/dist/babelPlugins/BabelTransformPackageImports.js +21 -9
- package/dist/bin/commands/build.d.ts.map +1 -1
- package/dist/bin/commands/build.js +9 -2
- package/dist/bin/commands/compile.d.ts.map +1 -1
- package/dist/bin/commands/compile.js +7 -2
- package/dist/build/CompilationInfo.d.ts +1 -0
- package/dist/build/CompilationInfo.d.ts.map +1 -1
- package/dist/build/combineComponentCss.d.ts +1 -1
- package/dist/build/combineComponentCss.d.ts.map +1 -1
- package/dist/build/combineComponentCss.js +3 -3
- package/dist/build/compileJavascript.d.ts.map +1 -1
- package/dist/build/compileJavascript.js +2 -2
- package/dist/build/compileUserApp.d.ts.map +1 -1
- package/dist/build/compileUserApp.js +14 -5
- package/dist/build/frameworkStylesheets.d.ts +5 -0
- package/dist/build/frameworkStylesheets.d.ts.map +1 -0
- package/dist/build/frameworkStylesheets.js +49 -0
- package/dist/build/getPackageDirForFile.d.ts +2 -0
- package/dist/build/getPackageDirForFile.d.ts.map +1 -0
- package/dist/build/getPackageDirForFile.js +11 -0
- package/dist/build/getSxyClientPackageAliases.d.ts.map +1 -1
- package/dist/build/getSxyClientPackageAliases.js +3 -1
- package/dist/build/makeBabelUserDevConfig.d.ts +1 -1
- package/dist/build/makeBabelUserDevConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserDevConfig.js +3 -2
- package/dist/build/makeBabelUserProdConfig.d.ts +1 -1
- package/dist/build/makeBabelUserProdConfig.d.ts.map +1 -1
- package/dist/build/makeBabelUserProdConfig.js +4 -2
- package/dist/build/rollup.user.prod.config.d.ts.map +1 -1
- package/dist/build/rollup.user.prod.config.js +4 -1
- package/dist/build/rollupExtractComponentStylesheets.d.ts +12 -0
- package/dist/build/rollupExtractComponentStylesheets.d.ts.map +1 -0
- package/dist/build/rollupExtractComponentStylesheets.js +35 -0
- package/dist/compat/context.d.ts +1 -1
- package/dist/compat/context.d.ts.map +1 -1
- package/dist/componentCss/i/T-components-library-RichTextEditor-RichTextEditor.css +115 -0
- package/dist/componentCss/i/T-components-library-__StatefulMessage-StatefulMessage.css +25 -0
- package/dist/componentCss/tungsten.css +2 -0
- package/dist/componentProxyHandlers.d.ts +2 -1
- package/dist/componentProxyHandlers.d.ts.map +1 -1
- package/dist/componentProxyHandlers.js +45 -9
- package/dist/components/GoToComponent.d.ts +1 -1
- package/dist/components/GoToComponent.d.ts.map +1 -1
- package/dist/components/_GoToComponent.d.ts +10 -0
- package/dist/components/_GoToComponent.d.ts.map +1 -0
- package/dist/components/_GoToComponent.js +13 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.d.ts +50 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/RichTextEditor.js +458 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.d.ts +5 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/StoredContentNode.js +1 -0
- package/dist/components/library/RichTextEditor/activeFormats.d.ts +20 -0
- package/dist/components/library/RichTextEditor/activeFormats.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/activeFormats.js +48 -0
- package/dist/components/library/RichTextEditor/contentTree.d.ts +30 -0
- package/dist/components/library/RichTextEditor/contentTree.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/contentTree.js +81 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts +30 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.d.ts.map +1 -0
- package/dist/components/library/RichTextEditor/sanitizeAuthoredHtml.js +97 -0
- package/dist/components/library/__StatefulMessage/MessageData.d.ts +7 -0
- package/dist/components/library/__StatefulMessage/MessageData.d.ts.map +1 -0
- package/dist/components/library/__StatefulMessage/MessageData.js +1 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts +22 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.d.ts.map +1 -0
- package/dist/components/library/__StatefulMessage/StatefulMessage.js +88 -0
- package/dist/components/library/index.d.ts +5 -0
- package/dist/components/library/index.d.ts.map +1 -0
- package/dist/components/library/index.js +7 -0
- package/dist/defaultConfig.d.ts +1 -0
- package/dist/defaultConfig.d.ts.map +1 -1
- package/dist/defaultConfig.js +1 -0
- package/dist/env/addToEnv.d.ts +2 -0
- package/dist/env/addToEnv.d.ts.map +1 -0
- package/dist/env/addToEnv.js +19 -0
- package/dist/findUserConfig.d.ts +1 -1
- package/dist/indexInner.d.ts +5 -5
- package/dist/indexInner.d.ts.map +1 -1
- package/dist/indexInner.js +2 -1
- package/dist/postcssPlugins/TransformCssNames.d.ts.map +1 -1
- package/dist/postcssPlugins/TransformCssNames.js +10 -2
- package/dist/propsAreEqual.d.ts +8 -0
- package/dist/propsAreEqual.d.ts.map +1 -0
- package/dist/propsAreEqual.js +97 -0
- package/dist/render/HeadData.d.ts +1 -0
- package/dist/render/HeadData.d.ts.map +1 -1
- package/dist/render/contentToHtml.d.ts.map +1 -1
- package/dist/render/contentToHtml.js +1 -0
- package/dist/render/instantiateClassComponent.d.ts.map +1 -1
- package/dist/render/instantiateClassComponent.js +4 -0
- package/dist/render/processHead.d.ts.map +1 -1
- package/dist/render/processHead.js +14 -1
- package/dist/settings.d.ts +2 -0
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +3 -0
- package/dist/stateTracking.d.ts +47 -0
- package/dist/stateTracking.d.ts.map +1 -0
- package/dist/stateTracking.js +83 -0
- package/dist/staticGen/staticGen.d.ts.map +1 -1
- package/dist/staticGen/staticGen.js +117 -107
- package/dist/testing/installTestStyleProcessors.d.ts +2 -0
- package/dist/testing/installTestStyleProcessors.d.ts.map +1 -0
- package/dist/testing/installTestStyleProcessors.js +21 -0
- package/dist/testing/temp/componentPackageMock.d.ts +18 -0
- package/dist/testing/temp/componentPackageMock.d.ts.map +1 -0
- package/dist/testing/temp/componentPackageMock.js +37 -0
- package/dist/testing/temp/contentHtmlElements.d.ts +3 -0
- package/dist/testing/temp/contentHtmlElements.d.ts.map +1 -0
- package/dist/testing/temp/contentHtmlElements.js +12 -0
- package/dist/update/integrateUpdateVdom.d.ts.map +1 -1
- package/dist/update/integrateUpdateVdom.js +160 -51
- package/dist/update/pendingMounts.d.ts +25 -0
- package/dist/update/pendingMounts.d.ts.map +1 -0
- package/dist/update/pendingMounts.js +55 -0
- package/package.json +4 -2
- package/dist/env/injectEnv.d.ts +0 -2
- package/dist/env/injectEnv.d.ts.map +0 -1
- package/dist/env/injectEnv.js +0 -9
- package/dist/env/parseEnv.d.ts +0 -2
- package/dist/env/parseEnv.d.ts.map +0 -1
- package/dist/env/parseEnv.js +0 -14
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { HtmlAllowList } from '../../../rawHtml/HtmlAllowList.js';
|
|
2
|
+
/**
|
|
3
|
+
* Cleans authored HTML (typically pasted content) down to what the editor
|
|
4
|
+
* stores: the tags and attributes `safeHtmlAllowList` — and therefore
|
|
5
|
+
* `<RawHtml safe>` — will actually render, with no generic block containers.
|
|
6
|
+
*
|
|
7
|
+
* The safety half is entirely Tungsten's `sanitizeHtml`, which is
|
|
8
|
+
* `parseHtml` + `contentNodeToHtml` and so makes exactly the decisions the
|
|
9
|
+
* display side makes: nothing saved from the editor can be silently stripped
|
|
10
|
+
* later on, because one implementation decides both. Comments go with it —
|
|
11
|
+
* Windows wraps clipboard HTML in `<!--StartFragment-->` markers, which
|
|
12
|
+
* otherwise accumulate in the stored markup — as do `script`/`style` whole,
|
|
13
|
+
* `on*` handlers, and `javascript:`/`data:` URLs.
|
|
14
|
+
*
|
|
15
|
+
* What is left here is editor-specific normalisation, which is structure
|
|
16
|
+
* rather than safety: `<p>`/`<div>` flattened to `<br>`-separated inline
|
|
17
|
+
* content, empty elements swept, and leading/trailing/repeated blank lines
|
|
18
|
+
* trimmed.
|
|
19
|
+
*
|
|
20
|
+
* Parsing that second pass goes through `DOMParser` rather than assigning to a
|
|
21
|
+
* detached element's `innerHTML`: a DOMParser document is inert, so nothing in
|
|
22
|
+
* the markup can load a resource or run a handler while it is walked. The live
|
|
23
|
+
* document is never touched either way.
|
|
24
|
+
*
|
|
25
|
+
* `doc` supplies that parser and defaults to the ambient global `document`,
|
|
26
|
+
* which is always right in a real browser; callers holding a specific node
|
|
27
|
+
* should pass its `ownerDocument` instead of relying on the global.
|
|
28
|
+
*/
|
|
29
|
+
export declare function sanitizeAuthoredHtml(html: string, doc?: Document, allowList?: HtmlAllowList): string;
|
|
30
|
+
//# sourceMappingURL=sanitizeAuthoredHtml.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sanitizeAuthoredHtml.d.ts","sourceRoot":"","sources":["../../../../src/components/library/RichTextEditor/sanitizeAuthoredHtml.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAA;AAsEtE;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,oBAAoB,CAChC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,QAAmB,EAAE,SAAS,GAAE,aAAiC,GACrF,MAAM,CAUR"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { sanitizeHtml } from "../../../rawHtml/sanitizeHtml.js";
|
|
2
|
+
import { safeHtmlAllowList } from "../../../rawHtml/safeHtmlAllowList.js";
|
|
3
|
+
// Generic block containers. The editor never creates these — Enter inserts a
|
|
4
|
+
// <br> — so any that appear came from a paste or legacy content, and are
|
|
5
|
+
// flattened to <br>-separated inline content. Browsers disagree about which of
|
|
6
|
+
// <p>/<div> to emit and leave empty ones behind, which is the whole reason the
|
|
7
|
+
// editor avoids them; accepting them back in would reintroduce the mess.
|
|
8
|
+
// Deliberate blocks (headings, blockquote, lists, tables) are not in this set.
|
|
9
|
+
const flattenedBlocks = new Set(['p', 'div']);
|
|
10
|
+
// Elements that carry meaning with no children, so must survive the empty
|
|
11
|
+
// sweep: void elements, and table cells where blank is a real value.
|
|
12
|
+
const meaningfulWhenEmpty = new Set(['br', 'hr', 'img', 'td', 'th', 'col', 'colgroup']);
|
|
13
|
+
function unwrap(element) {
|
|
14
|
+
const parent = element.parentNode;
|
|
15
|
+
if (parent === null) return;
|
|
16
|
+
while (element.firstChild !== null) parent.insertBefore(element.firstChild, element);
|
|
17
|
+
parent.removeChild(element);
|
|
18
|
+
}
|
|
19
|
+
// Structure only — every safety decision was already made by sanitizeHtml
|
|
20
|
+
// before this ran. Nothing here may reintroduce markup, so nothing here needs
|
|
21
|
+
// to know what is safe.
|
|
22
|
+
function normaliseElement(element) {
|
|
23
|
+
const tag = element.tagName.toLowerCase();
|
|
24
|
+
// Recurse before unwrapping, so emptiness cascades outwards from the
|
|
25
|
+
// deepest node: a block whose only content was an empty span is itself
|
|
26
|
+
// empty by the time it is considered.
|
|
27
|
+
for (const child of [...element.children]) {
|
|
28
|
+
normaliseElement(child);
|
|
29
|
+
}
|
|
30
|
+
if (flattenedBlocks.has(tag)) {
|
|
31
|
+
// A line break stands in for the block boundary, unless nothing
|
|
32
|
+
// follows it — a trailing break is just a blank line at the end.
|
|
33
|
+
if (element.nextSibling !== null && element.parentNode !== null) {
|
|
34
|
+
element.parentNode.insertBefore(element.ownerDocument.createElement('br'), element.nextSibling);
|
|
35
|
+
}
|
|
36
|
+
unwrap(element);
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if (element.childNodes.length === 0 && !meaningfulWhenEmpty.has(tag)) {
|
|
40
|
+
element.remove();
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
// Blank lines at either end are always noise, and a run of them is usually an
|
|
44
|
+
// accident of editing rather than intent.
|
|
45
|
+
function trimBreaks(body) {
|
|
46
|
+
const isBreak = node => node !== null && node.nodeType === 1 && node.nodeName.toLowerCase() === 'br';
|
|
47
|
+
while (isBreak(body.firstChild)) body.firstChild?.remove();
|
|
48
|
+
while (isBreak(body.lastChild)) body.lastChild?.remove();
|
|
49
|
+
for (const child of [...body.childNodes]) {
|
|
50
|
+
if (!isBreak(child)) continue;
|
|
51
|
+
let following = child.nextSibling;
|
|
52
|
+
let run = 0;
|
|
53
|
+
while (isBreak(following)) {
|
|
54
|
+
const next = following?.nextSibling ?? null;
|
|
55
|
+
if (++run >= 2) following?.parentNode?.removeChild(following);
|
|
56
|
+
following = next;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Cleans authored HTML (typically pasted content) down to what the editor
|
|
62
|
+
* stores: the tags and attributes `safeHtmlAllowList` — and therefore
|
|
63
|
+
* `<RawHtml safe>` — will actually render, with no generic block containers.
|
|
64
|
+
*
|
|
65
|
+
* The safety half is entirely Tungsten's `sanitizeHtml`, which is
|
|
66
|
+
* `parseHtml` + `contentNodeToHtml` and so makes exactly the decisions the
|
|
67
|
+
* display side makes: nothing saved from the editor can be silently stripped
|
|
68
|
+
* later on, because one implementation decides both. Comments go with it —
|
|
69
|
+
* Windows wraps clipboard HTML in `<!--StartFragment-->` markers, which
|
|
70
|
+
* otherwise accumulate in the stored markup — as do `script`/`style` whole,
|
|
71
|
+
* `on*` handlers, and `javascript:`/`data:` URLs.
|
|
72
|
+
*
|
|
73
|
+
* What is left here is editor-specific normalisation, which is structure
|
|
74
|
+
* rather than safety: `<p>`/`<div>` flattened to `<br>`-separated inline
|
|
75
|
+
* content, empty elements swept, and leading/trailing/repeated blank lines
|
|
76
|
+
* trimmed.
|
|
77
|
+
*
|
|
78
|
+
* Parsing that second pass goes through `DOMParser` rather than assigning to a
|
|
79
|
+
* detached element's `innerHTML`: a DOMParser document is inert, so nothing in
|
|
80
|
+
* the markup can load a resource or run a handler while it is walked. The live
|
|
81
|
+
* document is never touched either way.
|
|
82
|
+
*
|
|
83
|
+
* `doc` supplies that parser and defaults to the ambient global `document`,
|
|
84
|
+
* which is always right in a real browser; callers holding a specific node
|
|
85
|
+
* should pass its `ownerDocument` instead of relying on the global.
|
|
86
|
+
*/
|
|
87
|
+
export function sanitizeAuthoredHtml(html, doc = document, allowList = safeHtmlAllowList) {
|
|
88
|
+
const safe = sanitizeHtml(html, {
|
|
89
|
+
allowList
|
|
90
|
+
});
|
|
91
|
+
const parsed = new (doc.defaultView ?? window).DOMParser().parseFromString(safe, 'text/html');
|
|
92
|
+
for (const child of [...parsed.body.children]) {
|
|
93
|
+
normaliseElement(child);
|
|
94
|
+
}
|
|
95
|
+
trimBreaks(parsed.body);
|
|
96
|
+
return parsed.body.innerHTML;
|
|
97
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageData.d.ts","sourceRoot":"","sources":["../../../../src/components/library/__StatefulMessage/MessageData.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,WAAW,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,GAAG,WAAW,CAAA;AAEhF,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,EAAE,WAAW,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IAGZ,MAAM,CAAC,EAAE,OAAO,CAAA;CACnB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { TungstenStatefulComponent } from '../../../Components.jsx';
|
|
2
|
+
import type { MessageData } from './MessageData.js';
|
|
3
|
+
export interface StatefulMessageData extends MessageData {
|
|
4
|
+
timestamp: number;
|
|
5
|
+
}
|
|
6
|
+
export type StampedMessageData = StatefulMessageData;
|
|
7
|
+
type Props = {
|
|
8
|
+
className?: string;
|
|
9
|
+
data: StatefulMessageData | null;
|
|
10
|
+
};
|
|
11
|
+
type State = {
|
|
12
|
+
message: StatefulMessageData | null;
|
|
13
|
+
lastTimestamp: number | null;
|
|
14
|
+
};
|
|
15
|
+
export declare class StatefulMessage extends TungstenStatefulComponent<Props, State> {
|
|
16
|
+
state: State;
|
|
17
|
+
componentDidUpdate: () => Promise<void>;
|
|
18
|
+
content: ({ className }: Props, { message: data }: State) => import("../../../ContentNode.js").ContentNode;
|
|
19
|
+
style: import("../../../CssNames.js").CssNames;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=StatefulMessage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatefulMessage.d.ts","sourceRoot":"","sources":["../../../../src/components/library/__StatefulMessage/StatefulMessage.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAEnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAEnD,MAAM,WAAW,mBAAoB,SAAQ,WAAW;IACpD,SAAS,EAAE,MAAM,CAAA;CACpB;AACD,MAAM,MAAM,kBAAkB,GAAG,mBAAmB,CAAA;AAIpD,KAAK,KAAK,GAAG;IACT,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,mBAAmB,GAAG,IAAI,CAAA;CACnC,CAAA;AAED,KAAK,KAAK,GAAG;IAET,OAAO,EAAE,mBAAmB,GAAG,IAAI,CAAA;IAGnC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/B,CAAA;AAOD,qBAAa,eAAgB,SAAQ,yBAAyB,CAAC,KAAK,EAAE,KAAK,CAAC;IACxE,KAAK,EAAE,KAAK,CAIX;IAED,kBAAkB,sBAyBjB;IAED,OAAO,GAAI,eAAe,KAAK,EAAE,mBAAmB,KAAK,mDAM7C;IAEZ,KAAK,0CAyBJ;CACJ"}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
function _defineProperty(e, r, t) {
|
|
2
|
+
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
3
|
+
value: t,
|
|
4
|
+
enumerable: !0,
|
|
5
|
+
configurable: !0,
|
|
6
|
+
writable: !0
|
|
7
|
+
}) : e[r] = t, e;
|
|
8
|
+
}
|
|
9
|
+
function _toPropertyKey(t) {
|
|
10
|
+
var i = _toPrimitive(t, "string");
|
|
11
|
+
return "symbol" == typeof i ? i : i + "";
|
|
12
|
+
}
|
|
13
|
+
function _toPrimitive(t, r) {
|
|
14
|
+
if ("object" != typeof t || !t) return t;
|
|
15
|
+
var e = t[Symbol.toPrimitive];
|
|
16
|
+
if (void 0 !== e) {
|
|
17
|
+
var i = e.call(t, r || "default");
|
|
18
|
+
if ("object" != typeof i) return i;
|
|
19
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
20
|
+
}
|
|
21
|
+
return ("string" === r ? String : Number)(t);
|
|
22
|
+
}
|
|
23
|
+
import { TungstenStatefulComponent } from "../../../Components.js";
|
|
24
|
+
import { combineClassNames } from "../../../helpers/combineClassNames.js";
|
|
25
|
+
import { jsx as _jsx } from "tungsten/jsxRuntime.js";
|
|
26
|
+
const BLANK_MS = 70;
|
|
27
|
+
// Inline page feedback which owns its own flash. A page sets a message stamped
|
|
28
|
+
// with the time it was produced; a repeat of the same result therefore arrives
|
|
29
|
+
// as a new timestamp, and the component hides the message briefly so the
|
|
30
|
+
// repeat still reads as a new one. The hidden message keeps its text, and so
|
|
31
|
+
// its size, and nothing else on the page moves.
|
|
32
|
+
export class StatefulMessage extends TungstenStatefulComponent {
|
|
33
|
+
constructor(...args) {
|
|
34
|
+
super(...args);
|
|
35
|
+
_defineProperty(this, "state", {
|
|
36
|
+
message: this.props.data,
|
|
37
|
+
// treat the mounting message as already handled, so it does not flash
|
|
38
|
+
lastTimestamp: this.props.data?.timestamp ?? null
|
|
39
|
+
});
|
|
40
|
+
_defineProperty(this, "componentDidUpdate", async () => {
|
|
41
|
+
const {
|
|
42
|
+
data
|
|
43
|
+
} = this.props;
|
|
44
|
+
if (data === null) {
|
|
45
|
+
if (this.state.message !== null) this.state.message = null;
|
|
46
|
+
if (this.state.lastTimestamp !== null) this.state.lastTimestamp = null;
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// already reacted to this message
|
|
50
|
+
if (this.state.lastTimestamp === data.timestamp) return;
|
|
51
|
+
this.state.lastTimestamp = data.timestamp;
|
|
52
|
+
const shown = this.state.message;
|
|
53
|
+
const repeatsShownMessage = shown !== null && shown.type === data.type && shown.text === data.text;
|
|
54
|
+
if (repeatsShownMessage) {
|
|
55
|
+
this.state.message = {
|
|
56
|
+
...data,
|
|
57
|
+
hidden: true
|
|
58
|
+
};
|
|
59
|
+
await new Promise(resolve => setTimeout(resolve, BLANK_MS));
|
|
60
|
+
}
|
|
61
|
+
// The prop is the object held in the parent's state; Tungsten adopts it
|
|
62
|
+
// as a copy, so this component's message and the page's stay separate.
|
|
63
|
+
this.state.message = data;
|
|
64
|
+
});
|
|
65
|
+
_defineProperty(this, "content", ({
|
|
66
|
+
className
|
|
67
|
+
}, {
|
|
68
|
+
message: data
|
|
69
|
+
}) => data === null ? null : _jsx("p", {
|
|
70
|
+
className: combineClassNames(className, 'message', data.type, data.hidden === true && 'hidden'),
|
|
71
|
+
children: data.text
|
|
72
|
+
}));
|
|
73
|
+
_defineProperty(this, "style", {
|
|
74
|
+
"moduleName": "T#-components-library-__StatefulMessage-StatefulMessage",
|
|
75
|
+
"tags": {},
|
|
76
|
+
"classes": {
|
|
77
|
+
"message": "T#-components-library-__StatefulMessage-StatefulMessage_message",
|
|
78
|
+
"hidden": "T#-components-library-__StatefulMessage-StatefulMessage_hidden",
|
|
79
|
+
"success": "T#-components-library-__StatefulMessage-StatefulMessage_success",
|
|
80
|
+
"info": "T#-components-library-__StatefulMessage-StatefulMessage_info",
|
|
81
|
+
"warning": "T#-components-library-__StatefulMessage-StatefulMessage_warning",
|
|
82
|
+
"error": "T#-components-library-__StatefulMessage-StatefulMessage_error",
|
|
83
|
+
"exception": "T#-components-library-__StatefulMessage-StatefulMessage_exception"
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
static $stylesheet = "i/T-components-library-__StatefulMessage-StatefulMessage.css";
|
|
88
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { RichTextEditor } from './RichTextEditor/RichTextEditor.jsx';
|
|
2
|
+
export type { StoredContentNode } from './RichTextEditor/StoredContentNode.js';
|
|
3
|
+
export { serializeContentTree, deserializeContentTree } from './RichTextEditor/contentTree.js';
|
|
4
|
+
export { sanitizeAuthoredHtml } from './RichTextEditor/sanitizeAuthoredHtml.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/library/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAA;AACpE,YAAY,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAA;AAG9E,OAAO,EAAE,oBAAoB,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAA;AAC9F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAA"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
// Tungsten's component library — components built on the framework rather than
|
|
2
|
+
// part of it. Exposed as `tungsten/library` so it stays separable from the core.
|
|
3
|
+
export { RichTextEditor } from "./RichTextEditor/RichTextEditor.js";
|
|
4
|
+
// Storing the editor's tree output means reading it back, so the conversion is
|
|
5
|
+
// part of the component's public surface rather than an internal.
|
|
6
|
+
export { serializeContentTree, deserializeContentTree } from "./RichTextEditor/contentTree.js";
|
|
7
|
+
export { sanitizeAuthoredHtml } from "./RichTextEditor/sanitizeAuthoredHtml.js";
|
package/dist/defaultConfig.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultConfig.d.ts","sourceRoot":"","sources":["../src/defaultConfig.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa
|
|
1
|
+
{"version":3,"file":"defaultConfig.d.ts","sourceRoot":"","sources":["../src/defaultConfig.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;CAyBS,CAAA;AAEnC,MAAM,MAAM,sBAAsB,GAAG,OAAO,aAAa,CAAA"}
|
package/dist/defaultConfig.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"addToEnv.d.ts","sourceRoot":"","sources":["../../src/env/addToEnv.ts"],"names":[],"mappings":"AAGA,wBAAgB,QAAQ,CACpB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC9B,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAe,EAC1C,MAAM,GAAE,MAAW,EAGnB,OAAO,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EACrC,yBAAyB,GAAE,OAAe,QAmB7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cliWarn } from "../cliOutput.js";
|
|
2
|
+
export function addToEnv(newEnv, env = process.env, prefix = '',
|
|
3
|
+
// the real (OS/shell) environment as it was before any .env file was loaded - these values
|
|
4
|
+
// always win over .env files, they're never overwritten, only warned about on conflict
|
|
5
|
+
trueEnv = {}, suppressOverwriteWarnings = false) {
|
|
6
|
+
for (const [key, value] of Object.entries(newEnv)) {
|
|
7
|
+
const fullKey = prefix + key;
|
|
8
|
+
if (Object.prototype.hasOwnProperty.call(trueEnv, fullKey)) {
|
|
9
|
+
if (trueEnv[fullKey] !== value && !suppressOverwriteWarnings) {
|
|
10
|
+
cliWarn(`env var ${fullKey} from your .env* file is being shadowed by system env`);
|
|
11
|
+
}
|
|
12
|
+
continue;
|
|
13
|
+
}
|
|
14
|
+
if (!suppressOverwriteWarnings && env[fullKey] !== undefined && env[fullKey] !== value) {
|
|
15
|
+
cliWarn(`env var ${fullKey} is being overwritten (was "${env[fullKey]}", now "${value}")`);
|
|
16
|
+
}
|
|
17
|
+
env[fullKey] = value;
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/findUserConfig.d.ts
CHANGED
package/dist/indexInner.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export { sanitizeHtml, type SanitizeHtmlOptions } from './rawHtml/sanitizeHtml.j
|
|
|
26
26
|
export { filterContentNode } from './rawHtml/filterContentNode.js';
|
|
27
27
|
export { contentNodeToHtml } from './render/contentNodeToHtml.js';
|
|
28
28
|
export * from './components/WebRedirectComponent.jsx';
|
|
29
|
-
export * from './nbsp.
|
|
29
|
+
export * from './nbsp.jsx';
|
|
30
30
|
export { pop, dismissPop } from './pop.js';
|
|
31
31
|
export * from './browserStorage.js';
|
|
32
32
|
export { createElement } from './createElement.js';
|
|
@@ -34,9 +34,8 @@ export * from './createRef.js';
|
|
|
34
34
|
export { foreach } from './foreach.js';
|
|
35
35
|
export * from './helpers/index.js';
|
|
36
36
|
export * from './hooks/index.js';
|
|
37
|
-
export * from './hydrate/hydrate.
|
|
37
|
+
export * from './hydrate/hydrate.jsx';
|
|
38
38
|
export * from './jsxRuntime.js';
|
|
39
|
-
export * from './env/parseEnv.js';
|
|
40
39
|
export * from './makeServerRpc.js';
|
|
41
40
|
export { isBrowser } from './isBrowser.js';
|
|
42
41
|
export { isClient } from './isClient.js';
|
|
@@ -46,10 +45,10 @@ export { isProd } from './isProd.js';
|
|
|
46
45
|
export { logAndReturn } from './logAndReturn.js';
|
|
47
46
|
export * from './requests/index.js';
|
|
48
47
|
export { registerGlobalData, type GlobalData, type GlobalDataFunction } from './routing/registerGlobalData.js';
|
|
49
|
-
export * from './routing/MatchedRoute.
|
|
48
|
+
export * from './routing/MatchedRoute.js';
|
|
50
49
|
export * from './routing/RedirectCode.js';
|
|
51
50
|
export * from './routing/Route.jsx';
|
|
52
|
-
export * from './routing/Router.
|
|
51
|
+
export * from './routing/Router.jsx';
|
|
53
52
|
export * from './routing/RouteContentFunction.js';
|
|
54
53
|
export * from './routing/RoutingRedirect.js';
|
|
55
54
|
export * from './routing/WebRedirect.js';
|
|
@@ -61,6 +60,7 @@ export * from './Store/registerStore.js';
|
|
|
61
60
|
export * from './components/Stylesheet.jsx';
|
|
62
61
|
export { TungstenError } from './TungstenError.js';
|
|
63
62
|
export * from './__deproxy.js';
|
|
63
|
+
export { $original } from './componentProxyHandlers.js';
|
|
64
64
|
export type { Request } from './api/Request.js';
|
|
65
65
|
export type { Response } from './api/Response.js';
|
|
66
66
|
export type { BindVariable, TypedBindVariable } from './components/bindable/BindVariable.js';
|
package/dist/indexInner.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M,sBAAsB,CAAA;AAC3D,YAAY,EACR,0BAA0B,EAAE,0BAA0B,IAAI,SAAS,EACnE,gCAAgC,EAAE,gCAAgC,IAAI,eAAe,EACrF,cAAc,EACjB,MAAM,kBAAkB,CAAA;AACzB,YAAY,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAG7C,mBAAmB,mBAAmB,CAAA"}
|
package/dist/indexInner.js
CHANGED
|
@@ -43,7 +43,7 @@ export * from "./hooks/index.js";
|
|
|
43
43
|
export * from "./hydrate/hydrate.js";
|
|
44
44
|
export * from "./jsxRuntime.js";
|
|
45
45
|
//export { tungstenPrivateEnv, tungstenPublicEnv } from './env/env.js'
|
|
46
|
-
export * from
|
|
46
|
+
//export * from './env/parseEnv.js'
|
|
47
47
|
export * from "./makeServerRpc.js";
|
|
48
48
|
export { isBrowser } from "./isBrowser.js";
|
|
49
49
|
export { isClient } from "./isClient.js";
|
|
@@ -70,6 +70,7 @@ export * from "./Store/registerStore.js";
|
|
|
70
70
|
export * from "./components/Stylesheet.js";
|
|
71
71
|
export { TungstenError } from "./TungstenError.js";
|
|
72
72
|
export * from "./__deproxy.js";
|
|
73
|
+
export { $original } from "./componentProxyHandlers.js";
|
|
73
74
|
export * from "./ContentNode.js"; // types and type guards
|
|
74
75
|
export { StringIsPath, RouteKeyIsPath } from "./routing/RouteTypes.js";
|
|
75
76
|
export { makeTungstenErrorInfo } from "./routing/TungstenErrorInfo.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransformCssNames.d.ts","sourceRoot":"","sources":["../../src/postcssPlugins/TransformCssNames.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;
|
|
1
|
+
{"version":3,"file":"TransformCssNames.d.ts","sourceRoot":"","sources":["../../src/postcssPlugins/TransformCssNames.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,IAAI,EAAQ,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AAkE9C,KAAK,IAAI,GAAG;IACR,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,QAAQ,CAAA;CACrB,CAAA;AAKD,eAAO,MAAM,iBAAiB;WAAU,IAAI;;mBAezB,IAAI;;;CAoHtB,CAAA"}
|
|
@@ -36,9 +36,17 @@ function transformClass(moduleName, className) {
|
|
|
36
36
|
}
|
|
37
37
|
const escapedHash = '\\0023';
|
|
38
38
|
//const escapedDollar = '\\0024'
|
|
39
|
+
// A module name may carry a `#` marking it as framework-owned rather than
|
|
40
|
+
// app-owned (see modulePrefix). `#` cannot appear raw in a selector, so the CSS
|
|
41
|
+
// side takes the escaped form while the JS side keeps the literal one that goes
|
|
42
|
+
// into the DOM class attribute. The 4-digit escape needs a non-hex character
|
|
43
|
+
// after it to terminate, which the prefix's trailing `-` provides.
|
|
44
|
+
function escapeModuleName(moduleName) {
|
|
45
|
+
return moduleName.replaceAll('#', escapedHash);
|
|
46
|
+
}
|
|
39
47
|
function transformTag(moduleName, tag) {
|
|
40
48
|
return {
|
|
41
|
-
css: moduleName + '_' + escapedHash + '_' + tag,
|
|
49
|
+
css: escapeModuleName(moduleName) + '_' + escapedHash + '_' + tag,
|
|
42
50
|
jsx: moduleName + '_#_' + tag
|
|
43
51
|
};
|
|
44
52
|
}
|
|
@@ -94,7 +102,7 @@ export const TransformCssNames = opts => {
|
|
|
94
102
|
} else if (type === 'class') {
|
|
95
103
|
const className = content.slice(1);
|
|
96
104
|
const newClassName = transformClass(moduleName, className);
|
|
97
|
-
newSelectors.push('.' +
|
|
105
|
+
newSelectors.push('.' + transformClass(escapeModuleName(moduleName), className));
|
|
98
106
|
names.classes[className] = newClassName;
|
|
99
107
|
} else if (type === 'tag') {
|
|
100
108
|
const newName = transformTag(moduleName, content);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `since` is the tick at which the receiving component last rendered. It is only consulted
|
|
3
|
+
* when the two sides are the same object, which is where a structural comparison cannot
|
|
4
|
+
* help: deep state is mutated in place, so both sides are the already-mutated object.
|
|
5
|
+
*/
|
|
6
|
+
export declare function valuesAreEqual(a: unknown, b: unknown, since?: number): boolean;
|
|
7
|
+
export declare function propsAreEqual(previous: unknown, next: unknown, since?: number): boolean;
|
|
8
|
+
//# sourceMappingURL=propsAreEqual.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"propsAreEqual.d.ts","sourceRoot":"","sources":["../src/propsAreEqual.ts"],"names":[],"mappings":"AA+DA;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAwC9E;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,OAAO,CAEvF"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { objectTypesToProxy } from "./objectTypesToProxy.js";
|
|
2
|
+
import { changedAt } from "./stateTracking.js";
|
|
3
|
+
/**
|
|
4
|
+
* Structural comparison of component props, used to skip updating a child whose
|
|
5
|
+
* props have not changed.
|
|
6
|
+
*
|
|
7
|
+
* Follows the same reachability rule as the state proxy (see componentProxyHandlers):
|
|
8
|
+
* arrays and plain objects are data holders and are traversed; anything built from
|
|
9
|
+
* another constructor is an integral entity and is compared by identity. That keeps
|
|
10
|
+
* `state.form.x` style deep props working without walking into class instances.
|
|
11
|
+
*
|
|
12
|
+
* Reference identity short-circuits, so an unchanged array prop costs one comparison
|
|
13
|
+
* regardless of its length.
|
|
14
|
+
*/
|
|
15
|
+
function constructorNameOf(value) {
|
|
16
|
+
const proto = Object.getPrototypeOf(value);
|
|
17
|
+
if (proto === null || proto === undefined) return undefined;
|
|
18
|
+
const ctor = Reflect.get(proto, 'constructor');
|
|
19
|
+
if (typeof ctor !== 'function') return undefined;
|
|
20
|
+
return ctor.name;
|
|
21
|
+
}
|
|
22
|
+
/** treated as a data holder, and therefore traversed rather than compared by identity */
|
|
23
|
+
function isTraversable(value) {
|
|
24
|
+
const name = constructorNameOf(value);
|
|
25
|
+
return name !== undefined && objectTypesToProxy.includes(name);
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Has anything inside this object been mutated since the given tick?
|
|
29
|
+
*
|
|
30
|
+
* Walks down through data holders only, exactly as the comparison does, and stops at the
|
|
31
|
+
* first stamp newer than `since`. Cycles are possible in user state, so visited objects
|
|
32
|
+
* are tracked.
|
|
33
|
+
*/
|
|
34
|
+
function hasChangedSince(value, since, seen) {
|
|
35
|
+
if (seen.has(value)) return false;
|
|
36
|
+
seen.add(value);
|
|
37
|
+
// read through the proxy: $changed lives on the object and every get trap forwards
|
|
38
|
+
// unrecognised symbol keys to its target, so this works proxied or not
|
|
39
|
+
if (changedAt(value) > since) return true;
|
|
40
|
+
const raw = value;
|
|
41
|
+
if (Array.isArray(raw)) {
|
|
42
|
+
for (const entry of raw) {
|
|
43
|
+
if (typeof entry === 'object' && entry !== null && hasChangedSince(entry, since, seen)) return true;
|
|
44
|
+
}
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
if (!isTraversable(raw)) return false; // integral entity: its internals are not our business
|
|
48
|
+
for (const key of Object.keys(raw)) {
|
|
49
|
+
const entry = Reflect.get(raw, key);
|
|
50
|
+
if (typeof entry === 'object' && entry !== null && hasChangedSince(entry, since, seen)) return true;
|
|
51
|
+
}
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* `since` is the tick at which the receiving component last rendered. It is only consulted
|
|
56
|
+
* when the two sides are the same object, which is where a structural comparison cannot
|
|
57
|
+
* help: deep state is mutated in place, so both sides are the already-mutated object.
|
|
58
|
+
*/
|
|
59
|
+
export function valuesAreEqual(a, b, since) {
|
|
60
|
+
if (a === b) {
|
|
61
|
+
// primitives cannot have been mutated behind our back
|
|
62
|
+
if (typeof a !== 'object' || a === null) return true;
|
|
63
|
+
// no render baseline means we cannot prove the object is unchanged, and deep state
|
|
64
|
+
// is mutated in place -- so assume it changed rather than silently skipping
|
|
65
|
+
if (since === undefined) return false;
|
|
66
|
+
return !hasChangedSince(a, since, new Set());
|
|
67
|
+
}
|
|
68
|
+
// TODO: compare functions by source (String(fn)), so an inline handler recreated
|
|
69
|
+
// on each render does not by itself force a child to re-render. Left as identity
|
|
70
|
+
// for now because source equality ignores captured variables: two closures written
|
|
71
|
+
// identically but capturing different values would compare equal, and a child whose
|
|
72
|
+
// only differing prop is such a closure would be skipped and keep the old binding.
|
|
73
|
+
// Memoize String(fn) per function object if this is implemented -- it allocates.
|
|
74
|
+
if (typeof a === 'function' || typeof b === 'function') return false;
|
|
75
|
+
if (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) return false;
|
|
76
|
+
if (Array.isArray(a) || Array.isArray(b)) {
|
|
77
|
+
if (!Array.isArray(a) || !Array.isArray(b) || a.length !== b.length) return false;
|
|
78
|
+
for (let i = 0; i < a.length; i++) {
|
|
79
|
+
if (!valuesAreEqual(a[i], b[i], since)) return false;
|
|
80
|
+
}
|
|
81
|
+
return true;
|
|
82
|
+
}
|
|
83
|
+
// class instances are integral entities: not equal unless the same object,
|
|
84
|
+
// which `a === b` above already covered
|
|
85
|
+
if (!isTraversable(a) || !isTraversable(b)) return false;
|
|
86
|
+
const aKeys = Object.keys(a);
|
|
87
|
+
const bKeys = Object.keys(b);
|
|
88
|
+
if (aKeys.length !== bKeys.length) return false;
|
|
89
|
+
for (const key of aKeys) {
|
|
90
|
+
if (!Object.prototype.hasOwnProperty.call(b, key)) return false;
|
|
91
|
+
if (!valuesAreEqual(Reflect.get(a, key), Reflect.get(b, key), since)) return false;
|
|
92
|
+
}
|
|
93
|
+
return true;
|
|
94
|
+
}
|
|
95
|
+
export function propsAreEqual(previous, next, since) {
|
|
96
|
+
return valuesAreEqual(previous, next, since);
|
|
97
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HeadData.d.ts","sourceRoot":"","sources":["../../src/render/HeadData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,CAAA;AAE5C,MAAM,MAAM,QAAQ,GAAG;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,mBAAmB,EAAE,aAAa,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,OAAO,GAAG,QAAQ,CAAA;IACvB,GAAG,EAAE,OAAO,CAAA;CACf,CAAA"}
|
|
1
|
+
{"version":3,"file":"HeadData.d.ts","sourceRoot":"","sources":["../../src/render/HeadData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAE9D,MAAM,MAAM,YAAY,GAAG,EAAE,GAAG,IAAI,MAAM,EAAE,CAAA;AAE5C,MAAM,MAAM,QAAQ,GAAG;IACnB,KAAK,EAAE,OAAO,CAAA;IACd,QAAQ,EAAE,QAAQ,CAAC;IACnB,mBAAmB,EAAE,aAAa,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,GAAG,EAAE,OAAO,CAAC;IACb,iBAAiB,EAAE,sBAAsB,CAAC;IAC1C,YAAY,EAAE,YAAY,CAAC;IAC3B,GAAG,EAAE,OAAO,GAAG,QAAQ,CAAA;IACvB,GAAG,EAAE,OAAO,CAAA;CACf,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"contentToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAMvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAI9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,wBAAsB,aAAa,CAC/B,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EACpE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EACxC,MAAM,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EACnE,iBAAiB,GAAE,sBAAkC,EAAE,GAAG,UAAQ,GACnE,OAAO,CAAC,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"contentToHtml.d.ts","sourceRoot":"","sources":["../../src/render/contentToHtml.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAC9D,OAAO,KAAK,EAAY,YAAY,EAAE,MAAM,eAAe,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAEpD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAMvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AAI9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,6BAA6B,CAAA;AAGrE,wBAAsB,aAAa,CAC/B,eAAe,EAAE,eAAe,EAAE,mBAAmB,EAAE,aAAa,EACpE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,QAAQ,EACxC,MAAM,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EACnE,iBAAiB,GAAE,sBAAkC,EAAE,GAAG,UAAQ,GACnE,OAAO,CAAC,MAAM,CAAC,CAuDjB"}
|
|
@@ -20,6 +20,7 @@ export async function contentToHtml(compilationInfo, clientImportAliases, conten
|
|
|
20
20
|
importAliases: compilationInfo.importAliases,
|
|
21
21
|
clientImportAliases,
|
|
22
22
|
compilationLocation: compilationInfo.buildCodeLocation,
|
|
23
|
+
frameworkCss: compilationInfo.frameworkCss,
|
|
23
24
|
dev,
|
|
24
25
|
tungstenPublicEnv,
|
|
25
26
|
siteBasePath: siteBasePathOverride,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instantiateClassComponent.d.ts","sourceRoot":"","sources":["../../src/render/instantiateClassComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;
|
|
1
|
+
{"version":3,"file":"instantiateClassComponent.d.ts","sourceRoot":"","sources":["../../src/render/instantiateClassComponent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,mBAAmB,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAC5D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AAKvD,wBAAsB,yBAAyB,CAC3C,IAAI,EAAE,yBAAyB,EAAE,eAAe,GAAE,eAAe,GAAG,IAAI,aAAO,EAAE,QAAQ,EAAE,QAAQ,wEAkBtG"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { $props, $routeData, $routeParams, $type } from "../contentNodeSymbols.js";
|
|
2
|
+
import { markRendered } from "../stateTracking.js";
|
|
2
3
|
//import type { TungstenComponent, TungstenComponentProps } from '../TungstenComponent.jsx'
|
|
3
4
|
export async function instantiateClassComponent(node, parentComponent = null, instance) {
|
|
4
5
|
const Component = node[$type];
|
|
@@ -11,6 +12,9 @@ export async function instantiateClassComponent(node, parentComponent = null, in
|
|
|
11
12
|
});
|
|
12
13
|
//console.log('init on', Component.name)
|
|
13
14
|
await element.__init();
|
|
15
|
+
// the component has now rendered against the state as it currently stands, so its
|
|
16
|
+
// first update can also be skipped if nothing it depends on has been written since
|
|
17
|
+
markRendered(element);
|
|
14
18
|
//console.log('init done on', Component.name)
|
|
15
19
|
if (parentComponent !== null) parentComponent.childComponents.push(element); // register the child in the parent's list of child components
|
|
16
20
|
return element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;AAS7E,wBAAgB,WAAW,CACvB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,QAAQ,
|
|
1
|
+
{"version":3,"file":"processHead.d.ts","sourceRoot":"","sources":["../../src/render/processHead.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAA;AAK7C,OAAO,EAAE,oBAAoB,EAAqB,MAAM,qBAAqB,CAAA;AAS7E,wBAAgB,WAAW,CACvB,QAAQ,EAAE,oBAAoB,EAC9B,QAAQ,EAAE,QAAQ,QA0NrB"}
|