@osdk/react-components 0.19.0-main-b5d7e7b9644f6f9d2b3771c6fafca28cd20a3cbb → 0.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +3 -11
- package/build/browser/object-table/EditableCell.module.css +2 -2
- package/build/browser/public/experimental/theme.js +19 -0
- package/build/browser/public/experimental/theme.js.map +1 -0
- package/build/browser/public/experimental.js +1 -0
- package/build/browser/public/experimental.js.map +1 -1
- package/build/browser/styles.css +10 -99
- package/build/browser/theme/OsdkThemeContext.js +19 -0
- package/build/browser/theme/OsdkThemeContext.js.map +1 -0
- package/build/browser/theme/OsdkThemeProvider.js +74 -0
- package/build/browser/theme/OsdkThemeProvider.js.map +1 -0
- package/build/browser/theme/types.js +2 -0
- package/build/browser/theme/types.js.map +1 -0
- package/build/browser/theme/useOsdkTheme.js +40 -0
- package/build/browser/theme/useOsdkTheme.js.map +1 -0
- package/build/browser/theme/useSystemTheme.js +45 -0
- package/build/browser/theme/useSystemTheme.js.map +1 -0
- package/build/browser/tokens/base-tokens/dark.css +8 -99
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/cjs/chunk-2YA74OKB.cjs +86 -0
- package/build/cjs/chunk-2YA74OKB.cjs.map +1 -0
- package/build/cjs/{chunk-74XNR3YF.cjs → chunk-3OUALM3K.cjs} +4 -4
- package/build/cjs/{chunk-74XNR3YF.cjs.map → chunk-3OUALM3K.cjs.map} +1 -1
- package/build/cjs/chunk-3Y4W37E3.cjs +11 -0
- package/build/cjs/{chunk-G2AYUCKB.cjs.map → chunk-3Y4W37E3.cjs.map} +1 -1
- package/build/cjs/chunk-62DGPKOC.cjs +11 -0
- package/build/cjs/{chunk-6Z2CEPQP.cjs.map → chunk-62DGPKOC.cjs.map} +1 -1
- package/build/cjs/{chunk-BIPWKG5Q.cjs → chunk-6XRF4IAL.cjs} +4 -4
- package/build/cjs/{chunk-BIPWKG5Q.cjs.map → chunk-6XRF4IAL.cjs.map} +1 -1
- package/build/cjs/chunk-774FGQHO.cjs +11 -0
- package/build/cjs/{chunk-O5LBEGUH.cjs.map → chunk-774FGQHO.cjs.map} +1 -1
- package/build/cjs/{chunk-BBSLIWGB.cjs → chunk-BXCHISUQ.cjs} +3 -3
- package/build/cjs/chunk-BXCHISUQ.cjs.map +1 -0
- package/build/cjs/{chunk-B26H5TLV.cjs → chunk-DKPG7O4B.cjs} +4 -4
- package/build/cjs/{chunk-B26H5TLV.cjs.map → chunk-DKPG7O4B.cjs.map} +1 -1
- package/build/cjs/{chunk-5ZI6OPSJ.cjs → chunk-FIAYYZHY.cjs} +5 -5
- package/build/cjs/{chunk-5ZI6OPSJ.cjs.map → chunk-FIAYYZHY.cjs.map} +1 -1
- package/build/cjs/{chunk-NFFAHI3U.cjs → chunk-L6QDNMMG.cjs} +4 -4
- package/build/cjs/chunk-L6QDNMMG.cjs.map +1 -0
- package/build/cjs/{chunk-GABRYORZ.cjs → chunk-P7R4RWMU.cjs} +4 -4
- package/build/cjs/{chunk-GABRYORZ.cjs.map → chunk-P7R4RWMU.cjs.map} +1 -1
- package/build/cjs/{chunk-NXXHABK7.cjs → chunk-QOI2FQSL.cjs} +4 -4
- package/build/cjs/{chunk-NXXHABK7.cjs.map → chunk-QOI2FQSL.cjs.map} +1 -1
- package/build/cjs/chunk-S25XCKOA.cjs +11 -0
- package/build/cjs/{chunk-C6IVBY3E.cjs.map → chunk-S25XCKOA.cjs.map} +1 -1
- package/build/cjs/chunk-SLHKSOQC.cjs +11 -0
- package/build/cjs/{chunk-5NPRZBFO.cjs.map → chunk-SLHKSOQC.cjs.map} +1 -1
- package/build/cjs/public/experimental/action-form.cjs +4 -4
- package/build/cjs/public/experimental/document-viewer.cjs +5 -5
- package/build/cjs/public/experimental/email-viewer.cjs +3 -3
- package/build/cjs/public/experimental/excel-viewer.cjs +3 -3
- package/build/cjs/public/experimental/filter-list.cjs +13 -13
- package/build/cjs/public/experimental/image-viewer.cjs +3 -3
- package/build/cjs/public/experimental/markdown-renderer.cjs +3 -3
- package/build/cjs/public/experimental/object-table.cjs +8 -8
- package/build/cjs/public/experimental/object-table.css +2 -2
- package/build/cjs/public/experimental/object-table.css.map +1 -1
- package/build/cjs/public/experimental/pdf-viewer.cjs +7 -7
- package/build/cjs/public/experimental/theme.cjs +17 -0
- package/build/cjs/public/experimental/theme.cjs.map +1 -0
- package/build/cjs/public/experimental/theme.d.cts +88 -0
- package/build/cjs/public/experimental/tiff-renderer.cjs +3 -3
- package/build/cjs/public/experimental/video-viewer.cjs +3 -3
- package/build/cjs/public/experimental/xml-viewer.cjs +3 -3
- package/build/cjs/public/experimental.cjs +63 -54
- package/build/cjs/public/experimental.css +2 -2
- package/build/cjs/public/experimental.css.map +1 -1
- package/build/cjs/public/experimental.d.cts +1 -0
- package/build/esm/object-table/EditableCell.module.css +2 -2
- package/build/esm/public/experimental/theme.js +19 -0
- package/build/esm/public/experimental/theme.js.map +1 -0
- package/build/esm/public/experimental.js +1 -0
- package/build/esm/public/experimental.js.map +1 -1
- package/build/esm/theme/OsdkThemeContext.js +19 -0
- package/build/esm/theme/OsdkThemeContext.js.map +1 -0
- package/build/esm/theme/OsdkThemeProvider.js +74 -0
- package/build/esm/theme/OsdkThemeProvider.js.map +1 -0
- package/build/esm/theme/types.js +2 -0
- package/build/esm/theme/types.js.map +1 -0
- package/build/esm/theme/useOsdkTheme.js +40 -0
- package/build/esm/theme/useOsdkTheme.js.map +1 -0
- package/build/esm/theme/useSystemTheme.js +45 -0
- package/build/esm/theme/useSystemTheme.js.map +1 -0
- package/build/esm/tokens/base-tokens/dark.css +8 -99
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/types/public/experimental/theme.d.ts +3 -0
- package/build/types/public/experimental/theme.d.ts.map +1 -0
- package/build/types/public/experimental.d.ts +1 -0
- package/build/types/public/experimental.d.ts.map +1 -1
- package/build/types/theme/OsdkThemeContext.d.ts +3 -0
- package/build/types/theme/OsdkThemeContext.d.ts.map +1 -0
- package/build/types/theme/OsdkThemeProvider.d.ts +45 -0
- package/build/types/theme/OsdkThemeProvider.d.ts.map +1 -0
- package/build/types/theme/types.d.ts +25 -0
- package/build/types/theme/types.d.ts.map +1 -0
- package/build/types/theme/useOsdkTheme.d.ts +16 -0
- package/build/types/theme/useOsdkTheme.d.ts.map +1 -0
- package/build/types/theme/useSystemTheme.d.ts +7 -0
- package/build/types/theme/useSystemTheme.d.ts.map +1 -0
- package/docs/CSSVariables.md +4 -16
- package/docs/OsdkThemeProvider.md +239 -0
- package/docs/Prerequisites.md +23 -0
- package/package.json +17 -8
- package/build/cjs/chunk-5NPRZBFO.cjs +0 -11
- package/build/cjs/chunk-6Z2CEPQP.cjs +0 -11
- package/build/cjs/chunk-BBSLIWGB.cjs.map +0 -1
- package/build/cjs/chunk-C6IVBY3E.cjs +0 -11
- package/build/cjs/chunk-G2AYUCKB.cjs +0 -11
- package/build/cjs/chunk-NFFAHI3U.cjs.map +0 -1
- package/build/cjs/chunk-O5LBEGUH.cjs +0 -11
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
6
|
+
|
|
7
|
+
var React__default = /*#__PURE__*/_interopDefault(React);
|
|
8
|
+
|
|
9
|
+
// src/theme/OsdkThemeProvider.tsx
|
|
10
|
+
var OsdkThemeContext = /* @__PURE__ */ React.createContext(null);
|
|
11
|
+
var DARK_QUERY = "(prefers-color-scheme: dark)";
|
|
12
|
+
function subscribe(callback) {
|
|
13
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
14
|
+
return () => {
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
const mql = window.matchMedia(DARK_QUERY);
|
|
18
|
+
mql.addEventListener("change", callback);
|
|
19
|
+
return () => mql.removeEventListener("change", callback);
|
|
20
|
+
}
|
|
21
|
+
function getSnapshot() {
|
|
22
|
+
if (typeof window === "undefined" || typeof window.matchMedia !== "function") {
|
|
23
|
+
return "light";
|
|
24
|
+
}
|
|
25
|
+
return window.matchMedia(DARK_QUERY).matches ? "dark" : "light";
|
|
26
|
+
}
|
|
27
|
+
function getServerSnapshot() {
|
|
28
|
+
return "light";
|
|
29
|
+
}
|
|
30
|
+
function useSystemTheme() {
|
|
31
|
+
return React.useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// src/theme/OsdkThemeProvider.tsx
|
|
35
|
+
var DATA_THEME_ATTR = "data-bp-color-scheme";
|
|
36
|
+
function OsdkThemeProvider({
|
|
37
|
+
theme: controlledTheme,
|
|
38
|
+
defaultTheme = "system",
|
|
39
|
+
onThemeChanged,
|
|
40
|
+
target,
|
|
41
|
+
children
|
|
42
|
+
}) {
|
|
43
|
+
const [internalTheme, setInternalTheme] = React__default.default.useState(defaultTheme);
|
|
44
|
+
const theme = controlledTheme ?? internalTheme;
|
|
45
|
+
const systemTheme = useSystemTheme();
|
|
46
|
+
const resolvedTheme = theme === "system" ? systemTheme : theme;
|
|
47
|
+
React__default.default.useLayoutEffect(() => {
|
|
48
|
+
const element = target ?? (typeof document !== "undefined" ? document.documentElement : null);
|
|
49
|
+
if (element == null) return;
|
|
50
|
+
const previous = element.getAttribute(DATA_THEME_ATTR);
|
|
51
|
+
element.setAttribute(DATA_THEME_ATTR, resolvedTheme);
|
|
52
|
+
return () => {
|
|
53
|
+
if (previous == null) {
|
|
54
|
+
element.removeAttribute(DATA_THEME_ATTR);
|
|
55
|
+
} else {
|
|
56
|
+
element.setAttribute(DATA_THEME_ATTR, previous);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
}, [resolvedTheme, target]);
|
|
60
|
+
const setTheme = React__default.default.useCallback((next) => {
|
|
61
|
+
if (controlledTheme === void 0) {
|
|
62
|
+
setInternalTheme(next);
|
|
63
|
+
}
|
|
64
|
+
onThemeChanged?.(next);
|
|
65
|
+
}, [controlledTheme, onThemeChanged]);
|
|
66
|
+
const value = React__default.default.useMemo(() => ({
|
|
67
|
+
theme,
|
|
68
|
+
resolvedTheme,
|
|
69
|
+
setTheme
|
|
70
|
+
}), [theme, resolvedTheme, setTheme]);
|
|
71
|
+
return /* @__PURE__ */ React__default.default.createElement(OsdkThemeContext.Provider, {
|
|
72
|
+
value
|
|
73
|
+
}, children);
|
|
74
|
+
}
|
|
75
|
+
function useOsdkTheme() {
|
|
76
|
+
const ctx = React.useContext(OsdkThemeContext);
|
|
77
|
+
if (ctx == null) {
|
|
78
|
+
throw new Error("useOsdkTheme must be used within an <OsdkThemeProvider>.");
|
|
79
|
+
}
|
|
80
|
+
return ctx;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
exports.OsdkThemeProvider = OsdkThemeProvider;
|
|
84
|
+
exports.useOsdkTheme = useOsdkTheme;
|
|
85
|
+
//# sourceMappingURL=chunk-2YA74OKB.cjs.map
|
|
86
|
+
//# sourceMappingURL=chunk-2YA74OKB.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/theme/OsdkThemeContext.ts","../../src/theme/useSystemTheme.ts","../../src/theme/OsdkThemeProvider.tsx","../../src/theme/useOsdkTheme.ts"],"names":["useSyncExternalStore","React","useContext"],"mappings":";;;;;;;;;AAiBO,IAAM,gBAAA,uCAA8C,IAAI,CAAA;ACA/D,IAAM,UAAA,GAAa,8BAAA;AACnB,SAAS,UAAU,QAAA,EAAU;AAC3B,EAAA,IAAI,OAAO,MAAA,KAAW,WAAA,IAAe,OAAO,MAAA,CAAO,eAAe,UAAA,EAAY;AAC5E,IAAA,OAAO,MAAM;AAAA,IAAC,CAAA;AAAA,EAChB;AACA,EAAA,MAAM,GAAA,GAAM,MAAA,CAAO,UAAA,CAAW,UAAU,CAAA;AACxC,EAAA,GAAA,CAA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AAA;AACnD,IAAA,OAAO,MAAM;AACX,MAAA,IAAI,YAAY,IAAA,EAAM;AACpB,QAAA,OAAA,CAAQ,gBAAgB,eAAe,CAAA;AAAA,MACzC,CAAA,MAAO;AACL,QAAA,OAAA,CAAQ,YAAA,CAAa,iBAAiB,QAAQ,CAAA;AAAA,MAChD;AAAA,IACF,CAAA;AAAA,EACF,CAAA,EAAG,CAAC,aAAA,EAAe,MAAM,CAAC,CAAA;AAC1B,EAAA,MAAM,QAAA,GAAWA,sBAAA,CAAM,WAAA,CAAY,CAAA,IAAA,KAAQ;AACzC,IAAA,IAAI,oBAAoB,MAAA,EAAW;AACjC,MAAA,gBAAA,CAAiB,IAAI,CAAA;AAAA,IACvB;AACA,IAAA,cAAA,GAAiB,IAAI,CAAA;AAAA,EACvB,CAAA,EAAG,CAAC,eAAA,EAAiB,cAAc,CAAC,CAAA;AACpC,EAAA,MAAM,KAAA,GAAQA,sBAAA,CAAM,OAAA,CAAQ,OAAO;AAAA,IACjC,KAAA;AAAA,IACA,aAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,KAAA,EAAO,aAAA,EAAe,QAAQ,CAAC,CAAA;AACpC,EAAA,uBAAoBA,sBAAA,CAAM,aAAA,CAAc,gBAAA,CAAiB,QAAA,EAAU;AAAA,IACjE;AAAA,KACC,QAAQ,CAAA;AACb;ACxCO,SAAS,YAAA,GAAe;AAC7B,EAAA,MAAM,GAAA,GAAMC,iBAAW,gBAAgB,CAAA;AACvC,EAAA,IAAI,OAAO,IAAA,EAAM;AACf,IAAA,MAAM,IAAI,MAAM,0DAA0D,CAAA;AAAA,EAC5E;AACA,EAAA,OAAO,GAAA;AACT","file":"chunk-2YA74OKB.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createContext } from \"react\";\nexport const OsdkThemeContext = /*#__PURE__*/createContext(null);","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useSyncExternalStore } from \"react\";\nconst DARK_QUERY = \"(prefers-color-scheme: dark)\";\nfunction subscribe(callback) {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return () => {};\n }\n const mql = window.matchMedia(DARK_QUERY);\n mql.addEventListener(\"change\", callback);\n return () => mql.removeEventListener(\"change\", callback);\n}\nfunction getSnapshot() {\n if (typeof window === \"undefined\" || typeof window.matchMedia !== \"function\") {\n return \"light\";\n }\n return window.matchMedia(DARK_QUERY).matches ? \"dark\" : \"light\";\n}\nfunction getServerSnapshot() {\n return \"light\";\n}\n\n/**\n * Subscribes to the OS-level `prefers-color-scheme` media query and returns\n * the current resolved value. Re-renders the consumer when the OS preference\n * changes. SSR-safe: returns `\"light\"` on the server.\n */\nexport function useSystemTheme() {\n return useSyncExternalStore(subscribe, getSnapshot, getServerSnapshot);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from \"react\";\nimport { OsdkThemeContext } from \"./OsdkThemeContext.js\";\nimport { useSystemTheme } from \"./useSystemTheme.js\";\nexport const DATA_THEME_ATTR = \"data-bp-color-scheme\";\n/**\n * Provides OSDK theme state to descendants and writes a\n * `data-bp-color-scheme` attribute onto the document so the CSS in\n * `tokens/base-tokens/dark.css` activates the right theme.\n *\n * `defaultTheme=\"system\"` (default) follows the OS `prefers-color-scheme`\n * setting and re-renders when it changes. `defaultTheme=\"light\"` /\n * `defaultTheme=\"dark\"` start in the given theme regardless of the OS\n * preference. Call {@link useOsdkTheme}().setTheme from a descendant to\n * switch modes at runtime.\n *\n * To integrate with an external theme store, pass `theme` (controlled\n * mode)\n */\nexport function OsdkThemeProvider({\n theme: controlledTheme,\n defaultTheme = \"system\",\n onThemeChanged,\n target,\n children\n}) {\n const [internalTheme, setInternalTheme] = React.useState(defaultTheme);\n const theme = controlledTheme ?? internalTheme;\n const systemTheme = useSystemTheme();\n const resolvedTheme = theme === \"system\" ? systemTheme : theme;\n React.useLayoutEffect(() => {\n const element = target ?? (typeof document !== \"undefined\" ? document.documentElement : null);\n if (element == null) return;\n const previous = element.getAttribute(DATA_THEME_ATTR);\n element.setAttribute(DATA_THEME_ATTR, resolvedTheme);\n return () => {\n if (previous == null) {\n element.removeAttribute(DATA_THEME_ATTR);\n } else {\n element.setAttribute(DATA_THEME_ATTR, previous);\n }\n };\n }, [resolvedTheme, target]);\n const setTheme = React.useCallback(next => {\n if (controlledTheme === undefined) {\n setInternalTheme(next);\n }\n onThemeChanged?.(next);\n }, [controlledTheme, onThemeChanged]);\n const value = React.useMemo(() => ({\n theme,\n resolvedTheme,\n setTheme\n }), [theme, resolvedTheme, setTheme]);\n return /*#__PURE__*/React.createElement(OsdkThemeContext.Provider, {\n value: value\n }, children);\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useContext } from \"react\";\nimport { OsdkThemeContext } from \"./OsdkThemeContext.js\";\n/**\n * Read the active OSDK theme and update it imperatively.\n *\n * Must be called from a descendant of `<OsdkThemeProvider>`; throws otherwise.\n *\n * @returns\n * - `theme` — the requested mode (`\"light\" | \"dark\" | \"system\"`).\n * - `resolvedTheme` — the concrete theme on the DOM (`\"light\" | \"dark\"`).\n * When `theme === \"system\"`, this tracks `prefers-color-scheme` and\n * updates as the OS preference changes.\n * - `setTheme(next)` — update the mode. In controlled mode this only\n * invokes the provider's `onThemeChanged`; the consumer must re-render\n * the provider with the new value.\n */\nexport function useOsdkTheme() {\n const ctx = useContext(OsdkThemeContext);\n if (ctx == null) {\n throw new Error(\"useOsdkTheme must be used within an <OsdkThemeProvider>.\");\n }\n return ctx;\n}"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkIISDOJPR_cjs = require('./chunk-IISDOJPR.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkBXCHISUQ_cjs = require('./chunk-BXCHISUQ.cjs');
|
|
5
5
|
|
|
6
6
|
// src/public/experimental/tiff-renderer.ts
|
|
7
|
-
var TiffViewerMedia2 =
|
|
7
|
+
var TiffViewerMedia2 = chunkBXCHISUQ_cjs.withOsdkMetrics(chunkIISDOJPR_cjs.TiffViewerMedia, "TiffViewerMedia");
|
|
8
8
|
|
|
9
9
|
exports.TiffViewerMedia = TiffViewerMedia2;
|
|
10
|
-
//# sourceMappingURL=chunk-
|
|
11
|
-
//# sourceMappingURL=chunk-
|
|
10
|
+
//# sourceMappingURL=chunk-3OUALM3K.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-3OUALM3K.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/tiff-renderer.ts"],"names":["TiffViewerMedia","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,gBAAAA,GAAkBC,iCAAA,CAAgBD,iCAAA,EAAkB,iBAAiB","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/tiff-renderer.ts"],"names":["TiffViewerMedia","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,gBAAAA,GAAkBC,iCAAA,CAAgBD,iCAAA,EAAkB,iBAAiB","file":"chunk-3OUALM3K.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// TiffRenderer\nexport { TiffRenderer } from \"../../images/tiff-renderer/TiffRenderer.js\";\n// TiffViewerMedia (Media wrapper)\nimport { TiffViewerMedia as _TiffViewerMedia } from \"../../images/tiff-renderer/TiffViewerMedia.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const TiffViewerMedia = withOsdkMetrics(_TiffViewerMedia, \"TiffViewerMedia\");"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkOUJQJQ7N_cjs = require('./chunk-OUJQJQ7N.cjs');
|
|
4
|
+
var chunkBXCHISUQ_cjs = require('./chunk-BXCHISUQ.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/experimental/xml-viewer.ts
|
|
7
|
+
var XmlViewer2 = chunkBXCHISUQ_cjs.withOsdkMetrics(chunkOUJQJQ7N_cjs.XmlViewer, "XmlViewer");
|
|
8
|
+
|
|
9
|
+
exports.XmlViewer = XmlViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-3Y4W37E3.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-3Y4W37E3.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/xml-viewer.ts"],"names":["XmlViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/xml-viewer.ts"],"names":["XmlViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-3Y4W37E3.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// BaseXmlViewer\nexport { BaseXmlViewer } from \"../../xml-viewer/BaseXmlViewer.js\";\n// XmlViewer (Media wrapper)\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nimport { XmlViewer as _XmlViewer } from \"../../xml-viewer/XmlViewer.js\";\nexport const XmlViewer = withOsdkMetrics(_XmlViewer, \"XmlViewer\");"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkVOROB7KJ_cjs = require('./chunk-VOROB7KJ.cjs');
|
|
4
|
+
var chunkBXCHISUQ_cjs = require('./chunk-BXCHISUQ.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/experimental/image-viewer.ts
|
|
7
|
+
var ImageViewer2 = chunkBXCHISUQ_cjs.withOsdkMetrics(chunkVOROB7KJ_cjs.ImageViewer, "ImageViewer");
|
|
8
|
+
|
|
9
|
+
exports.ImageViewer = ImageViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-62DGPKOC.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-62DGPKOC.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/image-viewer.ts"],"names":["ImageViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/image-viewer.ts"],"names":["ImageViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-62DGPKOC.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// BaseImageViewer\nexport { BaseImageViewer } from \"../../images/image-viewer/BaseImageViewer.js\";\n// ImageViewer (Media wrapper)\nimport { ImageViewer as _ImageViewer } from \"../../images/image-viewer/ImageViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const ImageViewer = withOsdkMetrics(_ImageViewer, \"ImageViewer\");"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var chunkETOC4FJE_cjs = require('./chunk-ETOC4FJE.cjs');
|
|
4
|
-
var
|
|
4
|
+
var chunkBXCHISUQ_cjs = require('./chunk-BXCHISUQ.cjs');
|
|
5
5
|
var icons = require('@blueprintjs/icons');
|
|
6
6
|
var classnames = require('classnames');
|
|
7
7
|
require('pdfjs-dist/web/pdf_viewer.css');
|
|
@@ -181,12 +181,12 @@ function usePdfViewerInstance(options) {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
// src/public/experimental/pdf-viewer.ts
|
|
184
|
-
var PdfViewer2 =
|
|
184
|
+
var PdfViewer2 = chunkBXCHISUQ_cjs.withOsdkMetrics(chunkETOC4FJE_cjs.PdfViewer, "PdfViewer");
|
|
185
185
|
|
|
186
186
|
exports.PdfViewer = PdfViewer2;
|
|
187
187
|
exports.PdfViewerContent = PdfViewerContent;
|
|
188
188
|
exports.PdfViewerProvider = PdfViewerProvider;
|
|
189
189
|
exports.usePdfViewerContext = usePdfViewerContext;
|
|
190
190
|
exports.usePdfViewerInstance = usePdfViewerInstance;
|
|
191
|
-
//# sourceMappingURL=chunk-
|
|
192
|
-
//# sourceMappingURL=chunk-
|
|
191
|
+
//# sourceMappingURL=chunk-6XRF4IAL.cjs.map
|
|
192
|
+
//# sourceMappingURL=chunk-6XRF4IAL.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/experimental/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","PdfViewer_default","React","Spin","ErrorIcon","createPortal","Pdf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AQ,YAAA;AAAA,IACtB,cAAc,OAAA,CAAQ;AAAA,GACvB,CAAA;AACD,EAAA,MAAM,WAAA,GAAc,QAAQ,WAAA,IAAeH,wCAAA;AAC3C,EAAA,MAAM,iBAAA,GAAoBE,0CAAwB,WAAW,CAAA;AAC7D,EAAA,MAAM,gBAAA,GAAmB,QAAQ,gBAAA,IAAoB,KAAA;AACrD,EAAA,MAAM,cAAA,GAAiB,QAAQ,cAAA,IAAkB,KAAA;AACjD,EAAA,MAAM,cAAA,GAAiB,OAAA,CAAQ,YAAA,IAAgB,IAAA,IAAQ,aAAA;AACvD,EAAA,MAAM;AAAA,IACJ,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AACJ,EAAA,OAAOc,cAAQ,OAAO;AAAA,IACpB,GAAG,MAAA;AAAA,IACH,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,mBAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,MAAA,EAAQ,gBAAA,EAAkB,qBAAqB,mBAAA,EAAqB,aAAA,EAAe,cAAA,EAAgB,WAAA,EAAa,iBAAA,EAAmB,iBAAA,EAAmB,cAAA,EAAgB,cAAA,EAAgB,YAAY,CAAC,CAAA;AAC1M;;;AC9DO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-BIPWKG5Q.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport styles from \"../PdfViewer.module.css\";\nimport { PdfViewerAnnotationLayer } from \"./PdfViewerAnnotationLayer.js\";\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n initialPage = 1,\n initialScale = 1.0,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className\n}) {\n const viewer = usePdfViewerCore({\n src,\n initialPage,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(PdfViewerAnnotationLayer, {\n key: target.pageNumber,\n annotations: pageAnnotations,\n pageHeight: target.pageHeight,\n scale: target.scale,\n onAnnotationClick: onAnnotationClick\n }), target.container);\n }))));\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n initialPage: options.initialPage,\n initialScale: options.initialScale,\n initialAutoSize: options.initialAutoSize,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n const highlightEnabled = options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// PdfViewer\nexport { BasePdfViewer } from \"../../pdf-viewer/PdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../../pdf-viewer/hooks/usePdfViewerSync.js\";\n// PdfViewer context\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../../pdf-viewer/PdfViewerContext.js\";\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../../pdf-viewer/PdfRenderer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
1
|
+
{"version":3,"sources":["../../src/pdf-viewer/components/PdfViewerContent.tsx","../../src/pdf-viewer/PdfViewerContext.tsx","../../src/public/experimental/pdf-viewer.ts"],"names":["EMPTY_ANNOTATION_ARRAY","usePdfViewerCore","usePdfAnnotationsByPage","usePdfFormFields","useRef","useEffect","classnames","PdfViewer_default","React","Spin","ErrorIcon","createPortal","PdfViewerAnnotationLayer","useContext","usePdfViewerState","usePdfHighlightMode","useMemo","PdfViewer","withOsdkMetrics"],"mappings":";;;;;;;;;;;;;;;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,WAAA,IAAeH,wCAAA;AAC3C,EAAA,MAAM,iBAAA,GAAoBE,0CAAwB,WAAW,CAAA;AAC7D,EAAA,MAAM,gBAAA,GAAmB,QAAQ,gBAAA,IAAoB,KAAA;AACrD,EAAA,MAAM,cAAA,GAAiB,QAAQ,cAAA,IAAkB,KAAA;AACjD,EAAA,MAAM,cAAA,GAAiB,OAAA,CAAQ,YAAA,IAAgB,IAAA,IAAQ,aAAA;AACvD,EAAA,MAAM;AAAA,IACJ,iBAAA;AAAA,IACA;AAAA,GACF,GAAI,OAAA;AACJ,EAAA,OAAOc,cAAQ,OAAO;AAAA,IACpB,GAAG,MAAA;AAAA,IACH,gBAAA;AAAA,IACA,mBAAA;AAAA,IACA,mBAAA;AAAA,IACA,aAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA,iBAAA;AAAA,IACA,iBAAA;AAAA,IACA,cAAA;AAAA,IACA,cAAA;AAAA,IACA;AAAA,GACF,CAAA,EAAI,CAAC,MAAA,EAAQ,gBAAA,EAAkB,qBAAqB,mBAAA,EAAqB,aAAA,EAAe,cAAA,EAAgB,WAAA,EAAa,iBAAA,EAAmB,iBAAA,EAAmB,cAAA,EAAgB,cAAA,EAAgB,YAAY,CAAC,CAAA;AAC1M;;;AC9DO,IAAMC,UAAAA,GAAYC,iCAAA,CAAgBD,2BAAA,EAAY,WAAW","file":"chunk-6XRF4IAL.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Error as ErrorIcon, Spin } from \"@blueprintjs/icons\";\nimport classnames from \"classnames\";\nimport \"pdfjs-dist/web/pdf_viewer.css\";\nimport React, { useEffect, useRef } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"../constants.js\";\nimport { usePdfAnnotationsByPage } from \"../hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"../hooks/usePdfFormFields.js\";\nimport { usePdfViewerCore } from \"../hooks/usePdfViewerCore.js\";\nimport styles from \"../PdfViewer.module.css\";\nimport { PdfViewerAnnotationLayer } from \"./PdfViewerAnnotationLayer.js\";\nexport function PdfViewerContent({\n src,\n annotations = EMPTY_ANNOTATION_ARRAY,\n onAnnotationClick,\n initialPage = 1,\n initialScale = 1.0,\n onPageChange: onPageChangeProp,\n onScaleChange: onScaleChangeProp,\n formData,\n onFormChange,\n className\n}) {\n const viewer = usePdfViewerCore({\n src,\n initialPage,\n initialScale\n });\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData,\n onFormChange\n });\n\n // Use refs for callbacks to avoid firing on initial mount\n const onPageChangeRef = useRef(onPageChangeProp);\n onPageChangeRef.current = onPageChangeProp;\n const onScaleChangeRef = useRef(onScaleChangeProp);\n onScaleChangeRef.current = onScaleChangeProp;\n const isInitialMountRef = useRef(true);\n useEffect(function notifyPageChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onPageChangeRef.current?.(viewer.currentPage);\n }, [viewer.currentPage]);\n useEffect(function notifyScaleChange() {\n if (isInitialMountRef.current) {\n return;\n }\n onScaleChangeRef.current?.(viewer.scale);\n }, [viewer.scale]);\n useEffect(function clearInitialMount() {\n isInitialMountRef.current = false;\n }, []);\n const rootClassName = classnames(styles.pdfViewer, className);\n if (viewer.loading) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, /*#__PURE__*/React.createElement(Spin, {\n className: styles.spinnerIcon\n }), \"Loading\\u2026\"));\n }\n if (viewer.error != null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.errorContainer\n }, /*#__PURE__*/React.createElement(ErrorIcon, {\n className: styles.errorIcon\n }), \"Failed to load PDF: \", viewer.error.message));\n }\n if (viewer.document == null) {\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.loadingContainer\n }, \"No document\"));\n }\n return /*#__PURE__*/React.createElement(\"div\", {\n className: rootClassName\n }, /*#__PURE__*/React.createElement(\"div\", {\n className: styles.scrollContainerWrapper\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.containerRef,\n className: styles.scrollContainer\n }, /*#__PURE__*/React.createElement(\"div\", {\n ref: viewer.viewerRef,\n className: \"pdfViewer\"\n }), viewer.portalTargets.map(target => {\n const pageAnnotations = annotationsByPage[target.pageNumber] ?? EMPTY_ANNOTATION_ARRAY;\n if (pageAnnotations.length === 0) {\n return null;\n }\n return /*#__PURE__*/createPortal(/*#__PURE__*/React.createElement(PdfViewerAnnotationLayer, {\n key: target.pageNumber,\n annotations: pageAnnotations,\n pageHeight: target.pageHeight,\n scale: target.scale,\n onAnnotationClick: onAnnotationClick\n }), target.container);\n }))));\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, { createContext, useContext, useMemo } from \"react\";\nimport { EMPTY_ANNOTATION_ARRAY } from \"./constants.js\";\nimport { usePdfAnnotationsByPage } from \"./hooks/usePdfAnnotationsByPage.js\";\nimport { usePdfFormFields } from \"./hooks/usePdfFormFields.js\";\nimport { usePdfHighlightMode } from \"./hooks/usePdfHighlightMode.js\";\nimport { usePdfViewerState } from \"./hooks/usePdfViewerState.js\";\n\n/** The shape of the value provided by {@link PdfViewerProvider}. */\n\nconst PdfViewerContext = /*#__PURE__*/createContext(null);\n/** Provides {@link PdfViewerContextValue} to descendant components. */\nexport function PdfViewerProvider({\n value,\n children\n}) {\n return /*#__PURE__*/React.createElement(PdfViewerContext.Provider, {\n value: value\n }, children);\n}\n\n/**\n * Returns the nearest {@link PdfViewerContextValue} from a {@link PdfViewerProvider}.\n * Throws if called outside a provider.\n */\nexport function usePdfViewerContext() {\n const ctx = useContext(PdfViewerContext);\n if (ctx == null) {\n throw new Error(\"usePdfViewerContext must be used within a PdfViewerProvider\");\n }\n return ctx;\n}\n\n/**\n * Consumer-facing setup hook analogous to react-hook-form's `useForm()`.\n * Accepts viewer options and returns a {@link PdfViewerContextValue} suitable\n * for passing to {@link PdfViewerProvider}.\n */\nexport function usePdfViewerInstance(options) {\n const viewer = usePdfViewerState({\n src: options.src,\n initialPage: options.initialPage,\n initialScale: options.initialScale,\n initialAutoSize: options.initialAutoSize,\n initialSidebarOpen: options.initialSidebarOpen,\n sidebarMode: options.sidebarMode,\n onDownload: options.onDownload\n });\n const {\n highlightModeActive,\n toggleHighlightMode\n } = usePdfHighlightMode({\n pdfViewerRef: viewer.pdfViewerRef,\n document: viewer.document,\n enabled: options.highlightEnabled ?? false,\n onTextHighlight: options.onTextHighlight,\n onHighlightDelete: options.onHighlightDelete\n });\n const {\n hasFormFields,\n submitFormData\n } = usePdfFormFields({\n pdfViewerRef: viewer.pdfViewerRef,\n eventBusRef: viewer.eventBusRef,\n document: viewer.document,\n formData: options.formData,\n onFormSubmit: options.onFormSubmit,\n onFormChange: options.onFormChange\n });\n const annotations = options.annotations ?? EMPTY_ANNOTATION_ARRAY;\n const annotationsByPage = usePdfAnnotationsByPage(annotations);\n const highlightEnabled = options.highlightEnabled ?? false;\n const enableDownload = options.enableDownload ?? false;\n const enableFormSave = options.onFormSubmit != null && hasFormFields;\n const {\n onAnnotationClick,\n outlineIcons\n } = options;\n return useMemo(() => ({\n ...viewer,\n highlightEnabled,\n highlightModeActive,\n toggleHighlightMode,\n hasFormFields,\n submitFormData,\n annotations,\n annotationsByPage,\n onAnnotationClick,\n enableDownload,\n enableFormSave,\n outlineIcons\n }), [viewer, highlightEnabled, highlightModeActive, toggleHighlightMode, hasFormFields, submitFormData, annotations, annotationsByPage, onAnnotationClick, enableDownload, enableFormSave, outlineIcons]);\n}","/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// PdfViewer\nexport { BasePdfViewer } from \"../../pdf-viewer/PdfViewer.js\";\n// PdfViewer building blocks\nexport { PdfViewerAnnotationLayer } from \"../../pdf-viewer/components/PdfViewerAnnotationLayer.js\";\nexport { PdfViewerContent } from \"../../pdf-viewer/components/PdfViewerContent.js\";\nexport { PdfViewerOutlineSidebar } from \"../../pdf-viewer/components/PdfViewerOutlineSidebar.js\";\nexport { PdfViewerSearchBar } from \"../../pdf-viewer/components/PdfViewerSearchBar.js\";\nexport { PdfViewerSidebar } from \"../../pdf-viewer/components/PdfViewerSidebar.js\";\nexport { PdfViewerToolbar } from \"../../pdf-viewer/components/PdfViewerToolbar.js\";\n\n// PdfViewer hooks — primitive\nexport { usePdfAnnotationPortals } from \"../../pdf-viewer/hooks/usePdfAnnotationPortals.js\";\nexport { usePdfAnnotationsByPage } from \"../../pdf-viewer/hooks/usePdfAnnotationsByPage.js\";\nexport { usePdfDocument } from \"../../pdf-viewer/hooks/usePdfDocument.js\";\nexport { usePdfFormFields } from \"../../pdf-viewer/hooks/usePdfFormFields.js\";\nexport { usePdfHighlightMode } from \"../../pdf-viewer/hooks/usePdfHighlightMode.js\";\nexport { usePdfOutline } from \"../../pdf-viewer/hooks/usePdfOutline.js\";\nexport { usePdfViewer } from \"../../pdf-viewer/hooks/usePdfViewer.js\";\nexport { usePdfViewerSearch } from \"../../pdf-viewer/hooks/usePdfViewerSearch.js\";\nexport { usePdfViewerSync } from \"../../pdf-viewer/hooks/usePdfViewerSync.js\";\n// PdfViewer context\nexport { PdfViewerProvider, usePdfViewerContext, usePdfViewerInstance } from \"../../pdf-viewer/PdfViewerContext.js\";\n// PdfViewer hooks — composition\nexport { usePdfViewerCore } from \"../../pdf-viewer/hooks/usePdfViewerCore.js\";\nexport { usePdfViewerState } from \"../../pdf-viewer/hooks/usePdfViewerState.js\";\n\n// PdfViewer (Media wrapper)\nimport { PdfViewer as _PdfViewer } from \"../../pdf-viewer/PdfRenderer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const PdfViewer = withOsdkMetrics(_PdfViewer, \"PdfViewer\");"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk4VJIPB7R_cjs = require('./chunk-4VJIPB7R.cjs');
|
|
4
|
+
var chunkBXCHISUQ_cjs = require('./chunk-BXCHISUQ.cjs');
|
|
5
|
+
|
|
6
|
+
// src/public/experimental/excel-viewer.ts
|
|
7
|
+
var ExcelViewer2 = chunkBXCHISUQ_cjs.withOsdkMetrics(chunk4VJIPB7R_cjs.ExcelViewer, "ExcelViewer");
|
|
8
|
+
|
|
9
|
+
exports.ExcelViewer = ExcelViewer2;
|
|
10
|
+
//# sourceMappingURL=chunk-774FGQHO.cjs.map
|
|
11
|
+
//# sourceMappingURL=chunk-774FGQHO.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/public/experimental/excel-viewer.ts"],"names":["ExcelViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-
|
|
1
|
+
{"version":3,"sources":["../../src/public/experimental/excel-viewer.ts"],"names":["ExcelViewer","withOsdkMetrics"],"mappings":";;;;;;AAqBO,IAAMA,YAAAA,GAAcC,iCAAA,CAAgBD,6BAAA,EAAc,aAAa","file":"chunk-774FGQHO.cjs","sourcesContent":["/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// BaseExcelViewer\nexport { BaseExcelViewer } from \"../../excel-viewer/BaseExcelViewer.js\";\n// ExcelViewer (Media wrapper)\nimport { ExcelViewer as _ExcelViewer } from \"../../excel-viewer/ExcelViewer.js\";\nimport { withOsdkMetrics } from \"../../util/withOsdkMetrics.js\";\nexport const ExcelViewer = withOsdkMetrics(_ExcelViewer, \"ExcelViewer\");"]}
|
|
@@ -10,7 +10,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
|
|
|
10
10
|
// src/util/withOsdkMetrics.ts
|
|
11
11
|
|
|
12
12
|
// src/util/UserAgent.ts
|
|
13
|
-
var PACKAGE_USER_AGENT = `osdk-react-components/${"0.19.0
|
|
13
|
+
var PACKAGE_USER_AGENT = `osdk-react-components/${"0.19.0"}`;
|
|
14
14
|
function componentUserAgent(componentName) {
|
|
15
15
|
return `${PACKAGE_USER_AGENT}/${componentName}`;
|
|
16
16
|
}
|
|
@@ -26,5 +26,5 @@ function withOsdkMetrics(Component, name) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
exports.withOsdkMetrics = withOsdkMetrics;
|
|
29
|
-
//# sourceMappingURL=chunk-
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
29
|
+
//# sourceMappingURL=chunk-BXCHISUQ.cjs.map
|
|
30
|
+
//# sourceMappingURL=chunk-BXCHISUQ.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/util/UserAgent.ts","../../src/util/withOsdkMetrics.ts"],"names":["useRegisterUserAgent","React"],"mappings":";;;;;;;;;;;;AAgBA,IAAM,kBAAA,GAAqB,yBAAyB,QAA2B,CAAA,CAAA;AACxE,SAAS,mBAAmB,aAAA,EAAe;AAChD,EAAA,OAAO,CAAA,EAAG,kBAAkB,CAAA,CAAA,EAAI,aAAa,CAAA,CAAA;AAC/C;;;ACKO,SAAS,eAAA,CAAgB,WAAW,IAAA,EAAM;AAC/C,EAAA,MAAM,UAAU,CAAA,KAAA,KAAS;AACvB,IAAAA,0BAAA,CAAqB,kBAAA,CAAmB,IAAI,CAAC,CAAA;AAC7C,IAAA,uBAAoBC,sBAAA,CAAM,aAAA,CAAc,SAAA,EAAW,KAAK,CAAA;AAAA,EAC1D,CAAA;AACA,EAAA,OAAA,CAAQ,WAAA,GAAc,mBAAmB,IAAI,CAAA,CAAA,CAAA;AAC7C,EAAA,OAAO,OAAA;AACT","file":"chunk-BXCHISUQ.cjs","sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nconst PACKAGE_USER_AGENT = `osdk-react-components/${process.env.PACKAGE_VERSION}`;\nexport function componentUserAgent(componentName) {\n return `${PACKAGE_USER_AGENT}/${componentName}`;\n}","/*\n * Copyright 2026 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { useRegisterUserAgent } from \"@osdk/react\";\nimport React from \"react\";\nimport { componentUserAgent } from \"./UserAgent.js\";\n\n// `any` is required: FunctionComponent defaults to FunctionComponent<{}> which\n// rejects components with required props. A generic P parameter doesn't help\n// because TS can't infer both P and C simultaneously from a single argument.\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport function withOsdkMetrics(Component, name) {\n const Wrapped = props => {\n useRegisterUserAgent(componentUserAgent(name));\n return /*#__PURE__*/React.createElement(Component, props);\n };\n Wrapped.displayName = `withOsdkMetrics(${name})`;\n return Wrapped;\n}"]}
|
|
@@ -7,7 +7,7 @@ var chunkHNBSGCSZ_cjs = require('./chunk-HNBSGCSZ.cjs');
|
|
|
7
7
|
var chunk7LXS66DW_cjs = require('./chunk-7LXS66DW.cjs');
|
|
8
8
|
var chunkMD4KDE44_cjs = require('./chunk-MD4KDE44.cjs');
|
|
9
9
|
var chunkUCTQICPR_cjs = require('./chunk-UCTQICPR.cjs');
|
|
10
|
-
var
|
|
10
|
+
var chunkBXCHISUQ_cjs = require('./chunk-BXCHISUQ.cjs');
|
|
11
11
|
var react = require('@osdk/react');
|
|
12
12
|
var React17 = require('react');
|
|
13
13
|
var icons = require('@blueprintjs/icons');
|
|
@@ -1852,9 +1852,9 @@ var ActionForm = chunkGN3PIYGH_cjs.typedReactMemo(function ActionFormFn({
|
|
|
1852
1852
|
});
|
|
1853
1853
|
|
|
1854
1854
|
// src/public/experimental/action-form.ts
|
|
1855
|
-
var ActionForm2 =
|
|
1855
|
+
var ActionForm2 = chunkBXCHISUQ_cjs.withOsdkMetrics(ActionForm, "ActionForm");
|
|
1856
1856
|
|
|
1857
1857
|
exports.ActionForm = ActionForm2;
|
|
1858
1858
|
exports.BaseForm = BaseForm;
|
|
1859
|
-
//# sourceMappingURL=chunk-
|
|
1860
|
-
//# sourceMappingURL=chunk-
|
|
1859
|
+
//# sourceMappingURL=chunk-DKPG7O4B.cjs.map
|
|
1860
|
+
//# sourceMappingURL=chunk-DKPG7O4B.cjs.map
|