@asymmetric-effort/specifyjs 1.0.0 → 1.1.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/dist/esm/chunks/{chunk-45EBJMQH.js → chunk-PGUFCUSX.js} +1 -1
- package/dist/esm/chunks/{chunk-H7ZJ2I3D.js → chunk-PJZGQ4ZR.js} +1 -1
- package/dist/esm/chunks/{chunk-4TF5WXQG.js → chunk-RH3DFT32.js} +13 -1
- package/dist/esm/chunks/{metrics-ELQJ4BZ7.js → metrics-KVVTHW65.js} +2 -2
- package/dist/esm/client/index.js +1 -1
- package/dist/esm/components-barrel.js +122 -6
- package/dist/esm/index.js +2 -2
- package/dist/esm/server/index.js +2 -1
- package/dist/esm/telemetry/index.js +3 -3
- package/dist/specifyjs-client.cjs.js +1 -1
- package/dist/specifyjs-client.esm.js +1 -1
- package/dist/specifyjs-components.cjs.js +4 -4
- package/dist/specifyjs-components.esm.js +122 -6
- package/dist/specifyjs-server.cjs.js +1 -1
- package/dist/specifyjs-server.esm.js +2 -1
- package/dist/specifyjs-telemetry.cjs.js +1 -1
- package/dist/specifyjs-telemetry.esm.js +3 -3
- package/dist/specifyjs.cjs.js +1 -1
- package/dist/specifyjs.esm.js +2 -2
- package/dist/types/core/src/shared/secure-fetch.d.ts +0 -11
- package/dist/types/shared/secure-fetch.d.ts +0 -11
- package/package.json +2 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
/* (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE */
|
|
2
2
|
import {
|
|
3
3
|
createContext
|
|
4
|
-
} from "./esm/chunks/chunk-
|
|
4
|
+
} from "./esm/chunks/chunk-PGUFCUSX.js";
|
|
5
5
|
import "./esm/chunks/chunk-7OC7LXZ7.js";
|
|
6
6
|
import "./esm/chunks/chunk-SRUWIDIG.js";
|
|
7
7
|
import {
|
|
8
8
|
createElement
|
|
9
9
|
} from "./esm/chunks/chunk-NKW7RJR3.js";
|
|
10
10
|
import "./esm/chunks/chunk-UJTLBTMV.js";
|
|
11
|
-
import "./esm/chunks/chunk-
|
|
11
|
+
import "./esm/chunks/chunk-RH3DFT32.js";
|
|
12
12
|
import {
|
|
13
13
|
useCallback,
|
|
14
14
|
useContext,
|
|
@@ -3755,11 +3755,127 @@ var BUTTON_META = {
|
|
|
3755
3755
|
undo: { label: "Undo", icon: "\u21A9", command: "undo" },
|
|
3756
3756
|
redo: { label: "Redo", icon: "\u21AA", command: "redo" }
|
|
3757
3757
|
};
|
|
3758
|
-
var
|
|
3759
|
-
|
|
3760
|
-
|
|
3758
|
+
var ALLOWED_TAGS = /* @__PURE__ */ new Set([
|
|
3759
|
+
"p",
|
|
3760
|
+
"br",
|
|
3761
|
+
"b",
|
|
3762
|
+
"strong",
|
|
3763
|
+
"i",
|
|
3764
|
+
"em",
|
|
3765
|
+
"u",
|
|
3766
|
+
"s",
|
|
3767
|
+
"strike",
|
|
3768
|
+
"del",
|
|
3769
|
+
"sub",
|
|
3770
|
+
"sup",
|
|
3771
|
+
"h1",
|
|
3772
|
+
"h2",
|
|
3773
|
+
"h3",
|
|
3774
|
+
"h4",
|
|
3775
|
+
"h5",
|
|
3776
|
+
"h6",
|
|
3777
|
+
"ul",
|
|
3778
|
+
"ol",
|
|
3779
|
+
"li",
|
|
3780
|
+
"blockquote",
|
|
3781
|
+
"pre",
|
|
3782
|
+
"code",
|
|
3783
|
+
"a",
|
|
3784
|
+
"img",
|
|
3785
|
+
"span",
|
|
3786
|
+
"div",
|
|
3787
|
+
"table",
|
|
3788
|
+
"thead",
|
|
3789
|
+
"tbody",
|
|
3790
|
+
"tr",
|
|
3791
|
+
"th",
|
|
3792
|
+
"td",
|
|
3793
|
+
"hr",
|
|
3794
|
+
"abbr",
|
|
3795
|
+
"mark",
|
|
3796
|
+
"small",
|
|
3797
|
+
"figure",
|
|
3798
|
+
"figcaption"
|
|
3799
|
+
]);
|
|
3800
|
+
var ALLOWED_ATTRS = /* @__PURE__ */ new Set([
|
|
3801
|
+
"href",
|
|
3802
|
+
"src",
|
|
3803
|
+
"alt",
|
|
3804
|
+
"title",
|
|
3805
|
+
"width",
|
|
3806
|
+
"height",
|
|
3807
|
+
"class",
|
|
3808
|
+
"id",
|
|
3809
|
+
"style",
|
|
3810
|
+
"colspan",
|
|
3811
|
+
"rowspan",
|
|
3812
|
+
"scope",
|
|
3813
|
+
"target",
|
|
3814
|
+
"rel"
|
|
3815
|
+
]);
|
|
3816
|
+
var DANGEROUS_URL_PATTERN = /^\s*(javascript|vbscript|data\s*:(?!image\/))/i;
|
|
3761
3817
|
function sanitizeRichText(html) {
|
|
3762
|
-
|
|
3818
|
+
if (typeof document === "undefined") return "";
|
|
3819
|
+
const container = document.createElement("div");
|
|
3820
|
+
container.innerHTML = html;
|
|
3821
|
+
const stack = [];
|
|
3822
|
+
for (let i = container.childNodes.length - 1; i >= 0; i--) {
|
|
3823
|
+
stack.push(container.childNodes[i]);
|
|
3824
|
+
}
|
|
3825
|
+
while (stack.length > 0) {
|
|
3826
|
+
const node = stack.pop();
|
|
3827
|
+
if (node.nodeType === 3) continue;
|
|
3828
|
+
if (node.nodeType !== 1) {
|
|
3829
|
+
node.parentNode?.removeChild(node);
|
|
3830
|
+
continue;
|
|
3831
|
+
}
|
|
3832
|
+
const el = node;
|
|
3833
|
+
const tag = el.tagName.toLowerCase();
|
|
3834
|
+
if (!ALLOWED_TAGS.has(tag)) {
|
|
3835
|
+
const parent = el.parentNode;
|
|
3836
|
+
if (parent) {
|
|
3837
|
+
while (el.firstChild) {
|
|
3838
|
+
parent.insertBefore(el.firstChild, el);
|
|
3839
|
+
}
|
|
3840
|
+
let sibling = parent.firstChild;
|
|
3841
|
+
const promoted = [];
|
|
3842
|
+
while (sibling) {
|
|
3843
|
+
if (sibling !== el) promoted.push(sibling);
|
|
3844
|
+
sibling = sibling.nextSibling;
|
|
3845
|
+
}
|
|
3846
|
+
parent.removeChild(el);
|
|
3847
|
+
for (let i = promoted.length - 1; i >= 0; i--) {
|
|
3848
|
+
stack.push(promoted[i]);
|
|
3849
|
+
}
|
|
3850
|
+
}
|
|
3851
|
+
continue;
|
|
3852
|
+
}
|
|
3853
|
+
const attrs = el.attributes;
|
|
3854
|
+
const toRemove = [];
|
|
3855
|
+
for (let i = 0; i < attrs.length; i++) {
|
|
3856
|
+
const name = attrs[i].name.toLowerCase();
|
|
3857
|
+
if (name.startsWith("on")) {
|
|
3858
|
+
toRemove.push(attrs[i].name);
|
|
3859
|
+
} else if (!ALLOWED_ATTRS.has(name)) {
|
|
3860
|
+
toRemove.push(attrs[i].name);
|
|
3861
|
+
}
|
|
3862
|
+
}
|
|
3863
|
+
for (const name of toRemove) {
|
|
3864
|
+
el.removeAttribute(name);
|
|
3865
|
+
}
|
|
3866
|
+
const href = el.getAttribute("href");
|
|
3867
|
+
if (href && DANGEROUS_URL_PATTERN.test(href)) {
|
|
3868
|
+
el.removeAttribute("href");
|
|
3869
|
+
}
|
|
3870
|
+
const src = el.getAttribute("src");
|
|
3871
|
+
if (src && DANGEROUS_URL_PATTERN.test(src)) {
|
|
3872
|
+
el.removeAttribute("src");
|
|
3873
|
+
}
|
|
3874
|
+
for (let i = el.childNodes.length - 1; i >= 0; i--) {
|
|
3875
|
+
stack.push(el.childNodes[i]);
|
|
3876
|
+
}
|
|
3877
|
+
}
|
|
3878
|
+
return container.innerHTML;
|
|
3763
3879
|
}
|
|
3764
3880
|
function TextEditor(props) {
|
|
3765
3881
|
const [focused, setFocused] = useState(false);
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE */
|
|
2
|
-
"use strict";var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var O=(n,o)=>{for(var s in o)d(n,s,{get:o[s],enumerable:!0})},T=(n,o,s,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of w(o))!N.call(n,r)&&r!==s&&d(n,r,{get:()=>o[r],enumerable:!(e=v(o,r))||e.enumerable});return n};var I=n=>T(d({},"__esModule",{value:!0}),n);var U={};O(U,{renderToPipeableStream:()=>b,renderToReadableStream:()=>g,renderToStaticMarkup:()=>_,renderToString:()=>a});module.exports=I(U);var S=Symbol.for("spec.element"),f=Symbol.for("spec.fragment"),j=Symbol.for("spec.portal"),P=Symbol.for("spec.provider"),q=Symbol.for("spec.consumer"),y=Symbol.for("spec.forward_ref"),E=Symbol.for("spec.memo"),
|
|
2
|
+
"use strict";var d=Object.defineProperty;var v=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var N=Object.prototype.hasOwnProperty;var O=(n,o)=>{for(var s in o)d(n,s,{get:o[s],enumerable:!0})},T=(n,o,s,e)=>{if(o&&typeof o=="object"||typeof o=="function")for(let r of w(o))!N.call(n,r)&&r!==s&&d(n,r,{get:()=>o[r],enumerable:!(e=v(o,r))||e.enumerable});return n};var I=n=>T(d({},"__esModule",{value:!0}),n);var U={};O(U,{renderToPipeableStream:()=>b,renderToReadableStream:()=>g,renderToStaticMarkup:()=>_,renderToString:()=>a});module.exports=I(U);var S=Symbol.for("spec.element"),f=Symbol.for("spec.fragment"),j=Symbol.for("spec.portal"),P=Symbol.for("spec.provider"),q=Symbol.for("spec.consumer"),y=Symbol.for("spec.forward_ref"),E=Symbol.for("spec.memo"),Z=Symbol.for("spec.lazy"),G=Symbol.for("spec.suspense"),C=Symbol.for("spec.strict_mode"),h=Symbol.for("spec.profiler");function m(n){return typeof n=="object"&&n!==null&&n.$$typeof===S}var $=new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]),L={className:"class",htmlFor:"for",httpEquiv:"http-equiv",acceptCharset:"accept-charset",tabIndex:"tabindex",autoFocus:"autofocus",autoComplete:"autocomplete",autoPlay:"autoplay",crossOrigin:"crossorigin",noValidate:"novalidate",formNoValidate:"formnovalidate",readOnly:"readonly",cellPadding:"cellpadding",cellSpacing:"cellspacing",colSpan:"colspan",rowSpan:"rowspan",frameBorder:"frameborder",marginHeight:"marginheight",marginWidth:"marginwidth"},Y=new Set(["children","key","ref","dangerouslySetInnerHTML"]),M=/^on[A-Z]/;function a(n){return R("renderToString"),l(n,!0)}function _(n){return R("renderToStaticMarkup"),l(n,!1)}function R(n){typeof process<"u"&&typeof process.env<"u"&&process.env.SPECIFYJS_ALLOW_PRERENDER==="true"||typeof process<"u"&&typeof process.env<"u"&&(process.env.SPECIFYJS_ALLOW_PRERENDER||console.warn(`[SpecifyJS] ${n}() is intended for build-time pre-rendering only, not runtime server-side rendering. Set SPECIFYJS_ALLOW_PRERENDER=true if you are using this in a build script. See: https://github.com/asymmetric-effort/specifyjs/blob/main/docs/api/static-prerendering.md`))}function l(n,o){if(n==null||typeof n=="boolean")return"";if(typeof n=="string")return u(n);if(typeof n=="number")return String(n);if(Array.isArray(n)){let e="",r=[];for(let t=n.length-1;t>=0;t--)r.push(n[t]);for(;r.length>0;){let t=r.pop();if(!(t==null||typeof t=="boolean")){if(typeof t=="string"){e+=u(t);continue}if(typeof t=="number"){e+=String(t);continue}if(Array.isArray(t)){for(let i=t.length-1;i>=0;i--)r.push(t[i]);continue}m(t)&&(e+=x(t,o))}}return e}return m(n)?x(n,o):""}function x(n,o){let{type:s,props:e}=n;if(s===f||s===C||s===h)return l(e.children,o);if(typeof s=="object"&&s!==null){let r=s.$$typeof;if(r===P){let t=s._context,i=t._currentValue;t._currentValue=e.value;let p=l(e.children,o);return t._currentValue=i,p}if(r===y){let t=s.render,i=t(e,n.ref);return l(i,o)}if(r===E){let t=s.type;if(typeof t=="function"){let i=t(e);return l(i,o)}}}if(typeof s=="function"){if(s.prototype?.isSpecComponent){let t=s,p=new t(e).render();return l(p,o)}let r=s(e);return l(r,o)}return typeof s=="string"?A(s,e,o):""}function A(n,o,s){let e=`<${n}`;for(let r in o){if(Y.has(r)||M.test(r))continue;let t=o[r];if(t==null||t===!1)continue;let i=L[r]||r.toLowerCase();/^[a-zA-Z_][\w\-:.]*$/.test(i)&&(r==="style"?e+=` style="${u(z(t))}"`:r==="value"||r==="checked"||r==="selected"?t===!0?e+=` ${i}`:e+=` ${i}="${u(String(t))}"`:t===!0?e+=` ${i}`:e+=` ${i}="${u(String(t))}"`)}if($.has(n))return e+="/>",e;if(e+=">",o.dangerouslySetInnerHTML){let r=o.dangerouslySetInnerHTML.__html;e+=r}else e+=l(o.children,s);return e+=`</${n}>`,e}function z(n){let o=[];for(let s in n){let e=n[s];if(e==null)continue;let r=s.replace(/[A-Z]/g,p=>`-${p.toLowerCase()}`);if(!/^-{0,2}[a-zA-Z][a-zA-Z0-9-]*$/.test(r))continue;let t=typeof e=="number"&&e!==0&&!D(s)?`${e}px`:String(e),i=t.replace(/\\([0-9a-fA-F]{1,6})\s?/g,(p,c)=>String.fromCodePoint(parseInt(c,16))).replace(/\\/g,"").replace(/\/\*[\s\S]*?\*\//g,"");/expression\s*\(|javascript\s*:|behavior\s*:|moz-binding|-o-link/i.test(i)&&(t=""),o.push(`${r}:${t}`)}return o.join(";")}var V=new Set(["animationIterationCount","aspectRatio","borderImageOutset","borderImageSlice","borderImageWidth","boxFlex","boxFlexGroup","boxOrdinalGroup","columnCount","columns","flex","flexGrow","flexPositive","flexShrink","flexNegative","flexOrder","gridArea","gridRow","gridRowEnd","gridRowSpan","gridRowStart","gridColumn","gridColumnEnd","gridColumnSpan","gridColumnStart","fontWeight","lineClamp","lineHeight","opacity","order","orphans","tabSize","widows","zIndex","zoom","fillOpacity","floodOpacity","stopOpacity","strokeDasharray","strokeDashoffset","strokeMiterlimit","strokeOpacity","strokeWidth"]);function D(n){return V.has(n)}function u(n){let o="",s=0;for(let e=0;e<n.length;e++){let r;switch(n.charCodeAt(e)){case 34:r=""";break;case 38:r="&";break;case 39:r="'";break;case 60:r="<";break;case 62:r=">";break}r!==void 0&&(s!==e&&(o+=n.slice(s,e)),o+=r,s=e+1)}return s===0?n:(s<n.length&&(o+=n.slice(s)),o)}function b(n,o){let s=!1;return{pipe(e){if(s)return e.end(),e;let r;try{r=a(n)}catch(p){return o?.onShellError?.(p),o?.onError?.(p),e.end(),e}o?.onShellReady?.();let t=o?.progressiveChunkSize??8192;if(r.length<=t)e.write(r),e.end(),o?.onAllReady?.();else{let c=function(){if(s||p>=r.length){e.end(),o?.onAllReady?.();return}let k=r.slice(p,p+t);p+=t,e.write(k)?setImmediate(c):e.once("drain",c)};var i=c;let p=0;c()}return e},abort(e){s=!0,o?.onError?.(e)}}}async function g(n,o){let s=new TextEncoder,e=o?.progressiveChunkSize??8192;return new ReadableStream({start(r){if(o?.signal?.aborted){r.close();return}let t;try{t=a(n)}catch(p){o?.onError?.(p),r.error(p);return}let i=0;for(;i<t.length;){let p=t.slice(i,i+e);r.enqueue(s.encode(p)),i+=e}r.close()}})}
|
|
@@ -163,7 +163,7 @@ function renderHostElement(tag, props, includeDataAttrs) {
|
|
|
163
163
|
const attrName = PROP_TO_ATTR[key] || key.toLowerCase();
|
|
164
164
|
if (!/^[a-zA-Z_][\w\-:.]*$/.test(attrName)) continue;
|
|
165
165
|
if (key === "style") {
|
|
166
|
-
html += ` style="${renderStyle(value)}"`;
|
|
166
|
+
html += ` style="${escapeHtml(renderStyle(value))}"`;
|
|
167
167
|
} else if (key === "value" || key === "checked" || key === "selected") {
|
|
168
168
|
if (value === true) {
|
|
169
169
|
html += ` ${attrName}`;
|
|
@@ -198,6 +198,7 @@ function renderStyle(style) {
|
|
|
198
198
|
const value = style[prop];
|
|
199
199
|
if (value == null) continue;
|
|
200
200
|
const cssProp = prop.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
|
|
201
|
+
if (!/^-{0,2}[a-zA-Z][a-zA-Z0-9-]*$/.test(cssProp)) continue;
|
|
201
202
|
let cssValue = typeof value === "number" && value !== 0 && !isUnitlessProp(prop) ? `${value}px` : String(value);
|
|
202
203
|
const normalizedCss = cssValue.replace(/\\([0-9a-fA-F]{1,6})\s?/g, (_m, hex) => String.fromCodePoint(parseInt(hex, 16))).replace(/\\/g, "").replace(/\/\*[\s\S]*?\*\//g, "");
|
|
203
204
|
if (/expression\s*\(|javascript\s*:|behavior\s*:|moz-binding|-o-link/i.test(normalizedCss)) {
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE */
|
|
2
|
-
"use strict";var v=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var
|
|
2
|
+
"use strict";var v=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var J=Object.prototype.hasOwnProperty;var E=(e,t)=>()=>(e&&(t=e(e=0)),t);var C=(e,t)=>{for(var n in t)v(e,n,{get:t[n],enumerable:!0})},G=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of F(t))!J.call(e,o)&&o!==n&&v(e,o,{get:()=>t[o],enumerable:!(r=j(t,o))||r.enumerable});return e};var K=e=>G(v({},"__esModule",{value:!0}),e);function B(e){let t=W.exec(e);return t?Number(t[1])<=255&&Number(t[2])<=255&&Number(t[3])<=255:!1}function A(e){if(e.startsWith("//"))throw new Error(`[SpecifyJS] Protocol-relative URL rejected: "${e}". Use an explicit https:// prefix.`);if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return;if(e.startsWith("data:")){if(e.length>1024*1024)throw new Error("[SpecifyJS] secureFetch: data: URI exceeds 1MB limit");return}let t;try{t=new URL(e,typeof window<"u"?window.location.href:void 0)}catch{throw new Error(`[SpecifyJS] secureFetch: unable to validate URL "${e}". Provide a valid absolute HTTPS URL or a relative path.`)}if(t.protocol==="https:")return;let n=t.hostname.toLowerCase();if(!(n==="localhost"||n==="127.0.0.1"||n==="[::1]"||n==="0.0.0.0"||B(n)))throw n.endsWith(".localhost")?new Error(`[SpecifyJS] SSRF protection: "${e}" uses a .localhost subdomain which resolves to the loopback interface. Use exact "localhost" instead.`):new Error(`[SpecifyJS] Insecure URL rejected: "${e}". SpecifyJS enforces HTTPS-only for all network requests. Use https:// or a relative URL. Localhost URLs are allowed for development.`)}var W,D=E(()=>{"use strict";W=/^127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/});var U={};C(U,{createMeterProvider:()=>I,exportToEndpoint:()=>S,formatOtlpMetrics:()=>y,formatOtlpTraces:()=>x});function b(e,t,n){e.length>=H&&e.splice(0,Math.floor(H/2)),e.push({value:t,attributes:n?{...n}:{},timestamp:performance.now()})}function X(e,t){let n=[];return{name:e,description:t?.description??"",add(r,o){r<0||b(n,r,o)},get dataPoints(){return n}}}function z(e,t){let n=[];return{name:e,description:t?.description??"",record(r,o){b(n,r,o)},get dataPoints(){return n}}}function Z(e,t){let n=[];return{name:e,description:t?.description??"",set(r,o){b(n,r,o)},get dataPoints(){return n}}}function I(e){let t=[],n;e.exportInterval&&e.exportInterval>0&&(n=setInterval(()=>{r.flush()},e.exportInterval),typeof n=="object"&&"unref"in n&&n.unref());let r={config:e,get instruments(){return t},counter(o,s){let i=X(o,s);return t.push(i),i},histogram(o,s){let i=z(o,s);return t.push(i),i},gauge(o,s){let i=Z(o,s);return t.push(i),i},async flush(){if(!e.endpoint)return;let o=y(t,e.serviceName);await S(e.endpoint,e.headers??{},o)}};return r}function l(e){return Object.entries(e).map(([t,n])=>typeof n=="string"?{key:t,value:{stringValue:n}}:typeof n=="boolean"?{key:t,value:{boolValue:n}}:{key:t,value:{intValue:n}})}function g(e){return String(Math.round(e*1e6))}function y(e,t){let n=e.map(r=>{let o=r.dataPoints.map(i=>({attributes:l(i.attributes),timeUnixNano:g(i.timestamp),asDouble:i.value})),s;return"add"in r?s={sum:{dataPoints:o,isMonotonic:!0,aggregationTemporality:2}}:"record"in r?s={histogram:{dataPoints:o,aggregationTemporality:2}}:s={gauge:{dataPoints:o}},{name:r.name,description:r.description,...s}});return{resourceMetrics:[{resource:{attributes:l({"service.name":t??"unknown"})},scopeMetrics:[{scope:{name:"specifyjs-telemetry",version:"1.0.0"},metrics:n}]}]}}function x(e,t,n){let r={"service.name":t??"unknown"};n&&(r["service.version"]=n);let o={internal:1,server:2,client:3,producer:4,consumer:5},s={unset:0,ok:1,error:2},i=e.map(a=>({traceId:a.traceId,spanId:a.spanId,parentSpanId:a.parentSpanId??"",name:a.name,kind:o[a.kind]??1,startTimeUnixNano:g(a.startTime),endTimeUnixNano:a.endTime!==void 0?g(a.endTime):"0",attributes:l(a.attributes),status:{code:s[a.status.code]??0,message:a.status.message??""},events:a.events.map(u=>({name:u.name,timeUnixNano:g(u.timestamp),attributes:u.attributes?l(u.attributes):[]}))}));return{resourceSpans:[{resource:{attributes:l(r)},scopeSpans:[{scope:{name:"specifyjs-telemetry",version:"1.0.0"},spans:i}]}]}}async function S(e,t,n){try{A(e),await fetch(e,{method:"POST",headers:{"Content-Type":"application/json",...t},body:JSON.stringify(n)})}catch{}}var H,R=E(()=>{"use strict";D();H=1e4});var Y={};C(Y,{createMeterProvider:()=>I,createTracer:()=>q,endSpan:()=>d,exportToEndpoint:()=>S,formatOtlpMetrics:()=>y,formatOtlpTraces:()=>x,formatTraceparent:()=>$,generateSpanId:()=>P,generateTraceId:()=>w,parseTraceparent:()=>V,startSpan:()=>k,useTracing:()=>_});module.exports=K(Y);var M=null;function O(){if(M===null)throw new Error("Invalid hook call. Hooks can only be called inside the body of a function component.");return M}function h(e,t){return O().useEffect(e,t)}function T(e){return O().useRef(e)}function L(e){let t=new Uint8Array(e);try{crypto.getRandomValues(t)}catch{for(let n=0;n<e;n++)t[n]=Math.floor(Math.random()*256)}return t}function N(e){let t="";for(let n=0;n<e.length;n++)t+=(e[n]??0).toString(16).padStart(2,"0");return t}function w(){return N(L(16))}function P(){return N(L(8))}var Q=/^([0-9a-f]{2})-([0-9a-f]{32})-([0-9a-f]{16})-([0-9a-f]{2})$/;function V(e){let t=Q.exec(e.trim());if(!t)return null;let n=t[2],r=t[3],o=t[4];return/^0+$/.test(n)||/^0+$/.test(r)?null:{traceId:n,spanId:r,traceFlags:o}}function $(e){return`00-${e.traceId}-${e.spanId}-${e.traceFlags}`}function k(e,t){return{traceId:t?.traceId??w(),spanId:P(),parentSpanId:t?.parentSpanId,name:e,kind:t?.kind??"internal",startTime:performance.now(),status:{code:"unset"},attributes:t?.attributes?{...t.attributes}:{},events:[]}}function d(e){e.endTime=performance.now()}function q(e){let t=e.batchSize??1e3,n=[],r=[];function o(a){r.length>=t&&r.splice(0,Math.floor(t/2)),r.push(a)}let s;e.flushInterval&&e.flushInterval>0&&(s=setInterval(()=>{i.flush()},e.flushInterval),typeof s=="object"&&"unref"in s&&s.unref());let i={config:e,get pendingSpans(){return r},activeSpan(){return n.length>0?n[n.length-1]:void 0},startSpan(a,u){let f=i.activeSpan(),p=k(a,{kind:u?.kind,attributes:u?.attributes,traceId:u?.traceId??f?.traceId,parentSpanId:u?.parentSpanId??f?.spanId});return n.push(p),p},withSpan(a,u){n.includes(a)||n.push(a);let p=()=>{for(let c=n.length-1;c>=0;c--)n[c]===a&&n.splice(c,1)};try{let c=u();return c&&typeof c.then=="function"?c.then(m=>(d(a),o(a),p(),m),m=>{throw a.status={code:"error",message:String(m)},d(a),o(a),p(),m}):(d(a),o(a),p(),c)}catch(c){throw a.status={code:"error",message:String(c)},d(a),o(a),p(),c}},async flush(){if(r.length===0)return;let a=r.splice(0,r.length);if(e.endpoint){let{formatOtlpTraces:u,exportToEndpoint:f}=await Promise.resolve().then(()=>(R(),U)),p=u(a,e.serviceName,e.serviceVersion);await f(e.endpoint,e.headers??{},p)}}};return i}function _(e,t){let n=T(null);h(()=>{let r=e.startSpan(t,{kind:"internal"});return r.events.push({name:"mount",timestamp:performance.now()}),n.current=r,()=>{n.current&&(n.current.events.push({name:"unmount",timestamp:performance.now()}),d(n.current))}},[])}R();
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
exportToEndpoint,
|
|
5
5
|
formatOtlpMetrics,
|
|
6
6
|
formatOtlpTraces
|
|
7
|
-
} from "./esm/chunks/chunk-
|
|
8
|
-
import "./esm/chunks/chunk-
|
|
7
|
+
} from "./esm/chunks/chunk-PJZGQ4ZR.js";
|
|
8
|
+
import "./esm/chunks/chunk-RH3DFT32.js";
|
|
9
9
|
import {
|
|
10
10
|
useEffect,
|
|
11
11
|
useRef
|
|
@@ -151,7 +151,7 @@ function createTracer(config) {
|
|
|
151
151
|
if (buffer.length === 0) return;
|
|
152
152
|
const toExport = buffer.splice(0, buffer.length);
|
|
153
153
|
if (config.endpoint) {
|
|
154
|
-
const { formatOtlpTraces: formatOtlpTraces2, exportToEndpoint: exportToEndpoint2 } = await import("../chunks/metrics-
|
|
154
|
+
const { formatOtlpTraces: formatOtlpTraces2, exportToEndpoint: exportToEndpoint2 } = await import("../chunks/metrics-KVVTHW65.js");
|
|
155
155
|
const body = formatOtlpTraces2(toExport, config.serviceName, config.serviceVersion);
|
|
156
156
|
await exportToEndpoint2(config.endpoint, config.headers ?? {}, body);
|
|
157
157
|
}
|
package/dist/specifyjs.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE */
|
|
2
|
-
"use strict";var U=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Je=Object.prototype.hasOwnProperty;var Xe=(e,t)=>{for(var o in t)U(e,o,{get:t[o],enumerable:!0})},Ze=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ge(t))!Je.call(e,r)&&r!==o&&U(e,r,{get:()=>t[r],enumerable:!(n=We(t,r))||n.enumerable});return e};var Qe=e=>Ze(U({},"__esModule",{value:!0}),e);var ut={};Xe(ut,{Children:()=>he,Component:()=>P,ErrorBoundary:()=>L,FeatureFlagProvider:()=>X,FeatureGate:()=>Z,Fragment:()=>ce,Link:()=>j,Profiler:()=>Le,PureComponent:()=>b,Route:()=>A,Router:()=>Y,StrictMode:()=>Ne,Suspense:()=>_e,act:()=>He,assertSecureUrl:()=>G,cloneElement:()=>ye,createContext:()=>R,createElement:()=>d,createFactory:()=>ue,createRef:()=>le,forwardRef:()=>fe,getComponentTypeTable:()=>ze,h:()=>d,isValidElement:()=>w,lazy:()=>me,matchPath:()=>E,memo:()=>de,resolveComponentId:()=>Ke,secureFetch:()=>M,setComponentIdsEnabled:()=>Be,startTransition:()=>Ae,useCallback:()=>x,useContext:()=>l,useDebugValue:()=>ve,useDeferredValue:()=>we,useEffect:()=>S,useFeatureFlags:()=>Q,useHead:()=>$,useId:()=>Re,useImperativeHandle:()=>ge,useInsertionEffect:()=>Te,useLayoutEffect:()=>Ee,useMemo:()=>k,useNavigate:()=>B,useParams:()=>q,useReducer:()=>Ce,useRef:()=>F,useRouter:()=>H,useState:()=>g,useSyncExternalStore:()=>be,useTransition:()=>ke});module.exports=Qe(ut);var v=Symbol.for("spec.element"),ee=Symbol.for("spec.fragment"),lt=Symbol.for("spec.portal"),te=Symbol.for("spec.provider"),ne=Symbol.for("spec.consumer"),oe=Symbol.for("spec.forward_ref"),re=Symbol.for("spec.memo"),se=Symbol.for("spec.lazy"),ae=Symbol.for("spec.suspense"),ie=Symbol.for("spec.strict_mode"),pe=Symbol.for("spec.profiler");function d(e,t,...o){let n=null,r=null,a={};if(t!=null){t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(r=t.ref);for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&s!=="key"&&s!=="ref"&&s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(a[s]=t[s])}if(o.length===1?a.children=o[0]:o.length>1&&(a.children=o),typeof e=="function"&&e.defaultProps){let s=e.defaultProps;for(let i of Object.keys(s))i!=="__proto__"&&i!=="constructor"&&a[i]===void 0&&(a[i]=s[i])}return{$$typeof:v,type:e,props:a,key:n,ref:r}}function ue(e){return(t,...o)=>d(e,t??null,...o)}var ce=ee;function R(e){let t={$$typeof:Symbol.for("spec.context"),Provider:null,Consumer:null,_currentValue:e,_defaultValue:e},o={$$typeof:te,_context:t},n={$$typeof:ne,_context:t};return t.Provider=o,t.Consumer=n,t}function le(){return{current:null}}function fe(e){return{$$typeof:oe,render:e,displayName:e.displayName||e.name||"ForwardRef"}}function de(e,t){return{$$typeof:re,type:e,compare:t||null,displayName:e.displayName||e.name||"Memo"}}function me(e){let t={_status:"pending",_result:void 0};return{$$typeof:se,_payload:t,_init:()=>{if(t._status==="resolved")return t._result;if(t._status==="rejected")throw t._result;let n=e();throw t._status="pending",n.then(r=>{t._status="resolved",t._result=r.default},r=>{t._status="rejected",t._result=r}),n},displayName:"Lazy"}}function w(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}function ye(e,t,...o){if(!w(e))throw new Error("cloneElement: argument must be a valid SpecifyJS element");let n=e.key,r=e.ref,a={...e.props};if(t!=null){t.key!==void 0&&(n=""+t.key),t.ref!==void 0&&(r=t.ref);for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&s!=="key"&&s!=="ref"&&s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(a[s]=t[s])}return o.length===1?a.children=o[0]:o.length>1&&(a.children=o),{$$typeof:v,type:e.type,props:a,key:n,ref:r}}function N(e){let t=[],o=[e];for(;o.length>0;){let n=o.pop();if(Array.isArray(n))for(let r=n.length-1;r>=0;r--)o.push(n[r]);else t.push(n)}return t}function et(e,t){let o=N(e),n=[];for(let r=0;r<o.length;r++){let a=o[r];a==null||typeof a=="boolean"||n.push(t(a,r))}return n}function tt(e,t){let o=N(e),n=0;for(let r of o)r==null||typeof r=="boolean"||t(r,n++)}function nt(e){let t=N(e),o=0;for(let n of t)n!=null&&typeof n!="boolean"&&o++;return o}function ot(e){if(!w(e))throw new Error("Children.only: expected a single SpecifyJS element child");return e}function rt(e){return N(e).filter(o=>o!=null&&typeof o!="boolean")}var he={map:et,forEach:tt,count:nt,only:ot,toArray:rt};var P=class{constructor(t){this._fiber=null;this._pendingState=[];this._forceUpdate=!1;this.props=t,this.state={},this.context=void 0}setState(t,o){this._pendingState.push(t),this._enqueueUpdate(o)}forceUpdate(t){this._forceUpdate=!0,this._enqueueUpdate(t)}render(){return null}_enqueueUpdate(t){}};P.prototype.isSpecComponent=!0;var b=class extends P{shouldComponentUpdate(t,o){return!xe(this.props,t)||!xe(this.state,o)}};b.prototype.isPureSpecComponent=!0;function xe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;let o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;let r=e,a=t;for(let s of o)if(!Object.prototype.hasOwnProperty.call(a,s)||!Object.is(r[s],a[s]))return!1;return!0}var L=class extends P{static getDerivedStateFromError(t){return{hasError:!0,error:t}}constructor(t){super(t),this.state={hasError:!1,error:null}}componentDidCatch(t,o){this.props.onError?.(t,o)}render(){return this.state.hasError?this.props.fallback??null:this.props.children??null}};function $(e){let t=F(e);t.current=e;let o=JSON.stringify([e.title,e.description,e.keywords,e.author,e.canonical,e.og,e.twitter,e.httpEquiv,e.meta]);S(()=>{let n=t.current,r=[],a=document.title;if(n.title&&(document.title=n.title,r.push(()=>{document.title=a})),n.description&&r.push(C("name","description",n.description)),n.keywords&&r.push(C("name","keywords",n.keywords)),n.author&&r.push(C("name","author",n.author)),n.canonical){let s=document.createElement("link");s.rel="canonical",s.href=n.canonical,document.head.appendChild(s),r.push(()=>s.remove())}if(n.og)for(let[s,i]of Object.entries(n.og))r.push(C("property",`og:${s}`,i));if(n.twitter)for(let[s,i]of Object.entries(n.twitter))r.push(C("name",`twitter:${s}`,i));if(n.httpEquiv){let s={csp:"Content-Security-Policy",referrer:"Referrer-Policy",contentType:"X-Content-Type-Options",frameOptions:"X-Frame-Options",cacheControl:"Cache-Control"};for(let[i,u]of Object.entries(n.httpEquiv)){if(u===void 0)continue;let p=s[i]??i;r.push(st(p,u))}}if(n.meta)for(let s of n.meta)s.name?r.push(C("name",s.name,s.content)):s.property&&r.push(C("property",s.property,s.content));return()=>{for(let s of r)s()}},[o])}function Pe(e){return e.replace(/["\\]/g,"\\$&")}function C(e,t,o){let n=`meta[${e}="${Pe(t)}"]`,r=document.querySelector(n),a=r!==null,s=r?.content;return r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.content=o,()=>{a&&s!==void 0?r.content=s:a||r.remove()}}function st(e,t){let o=`meta[http-equiv="${Pe(e)}"]`,n=document.querySelector(o),r=n!==null,a=n?.content;return n||(n=document.createElement("meta"),n.setAttribute("http-equiv",e),document.head.appendChild(n)),n.content=t,()=>{r&&a!==void 0?n.content=a:r||n.remove()}}var Se=null;function c(){if(Se===null)throw new Error("Invalid hook call. Hooks can only be called inside the body of a function component.");return Se}function g(e){return c().useState(e)}function S(e,t){return c().useEffect(e,t)}function l(e){return c().useContext(e)}function Ce(e,t,o){return c().useReducer(e,t,o)}function x(e,t){return c().useCallback(e,t)}function k(e,t){return c().useMemo(e,t)}function F(e){return c().useRef(e)}function ge(e,t,o){return c().useImperativeHandle(e,t,o)}function Ee(e,t){return c().useLayoutEffect(e,t)}function ve(e,t){return c().useDebugValue(e,t)}function Re(){return c().useId()}function we(e){return c().useDeferredValue(e)}function ke(){return c().useTransition()}function be(e,t,o){return c().useSyncExternalStore(e,t,o)}function Te(e,t){return c().useInsertionEffect(e,t)}var _e=ae;var Ne=ie;var Le=pe;var m=R({pathname:"/",params:{},navigate:()=>{throw new Error("useNavigate must be used inside a <Router> component.")},basePath:""});function Fe(){let t=(typeof window<"u"?window.location.hash:"").replace(/^#\/?/,"/");return t===""?"/":t}var Ie={pathname:Fe(),hash:typeof window<"u"?window.location.hash:""},V=new Set;function Me(){Ie={pathname:Fe(),hash:typeof window<"u"?window.location.hash:""};for(let e of V)e()}typeof window<"u"&&window.addEventListener("hashchange",Me);function Oe(e){return V.add(e),()=>{V.delete(e)}}function I(){return Ie}function De(e,t){let o=e.startsWith("#")?e:"#"+e;if(t?.replace){let n=window.location.pathname+window.location.search+o;window.history.replaceState(null,"",n)}else window.location.hash=o;Me()}function Y(e){let[t,o]=g(()=>I().pathname);S(()=>(o(I().pathname),Oe(()=>{o(I().pathname)})),[]);let n=x((...a)=>{De(a[0],a[1])},[]),r=k(()=>({pathname:t,params:{},navigate:n,basePath:""}),[t,n]);return d(m.Provider,{value:r},e.children)}function Ue(e){let t=e.length;for(;t>1&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function E(e,t,o){let n=o?.exact??!1,r=e==="/"?"/":Ue(e),a=t==="/"?"/":Ue(t);if(r==="/"){let h=a==="/";return n&&!h?null:{params:{},isExact:h,path:e,url:"/"}}let s=r.split("/").filter(Boolean),i=a.split("/").filter(Boolean),u=s[s.length-1]==="*";if(!u&&n&&i.length!==s.length||!u&&i.length<s.length)return null;let p={},y=[];for(let h=0;h<s.length;h++){let T=s[h];if(T==="*"){let D=i.slice(h).join("/");return p["*"]=D,{params:p,isExact:!0,path:e,url:"/"+i.join("/")}}if(h>=i.length)return null;let _=i[h];if(T.startsWith(":")){let D=T.slice(1);p[D]=decodeURIComponent(_),y.push(_);continue}if(T.toLowerCase()!==_.toLowerCase())return null;y.push(_)}let f="/"+y.join("/"),O=i.length===s.length;return n&&!O?null:{params:p,isExact:O,path:e,url:f}}function A(e){let t=l(m),o=t.basePath+e.path,n=E(o,t.pathname,{exact:e.exact??!1}),r=k(()=>({pathname:t.pathname,params:{...t.params,...n?n.params:{}},navigate:t.navigate,basePath:n?n.url:t.basePath}),[t.pathname,t.navigate,t.params,t.basePath,n]);if(!n)return null;for(let s of Object.keys(t.params))s in r.params||(r.params[s]=t.params[s]);let a=e.component?d(e.component,{...r.params}):e.children;return d(m.Provider,{value:r},a)}function j(e){let{to:t,className:o,activeClassName:n,exact:r,children:a,...s}=e,i=l(m),u=E(t,i.pathname,{exact:r??!1})!==null,p=x(((...f)=>{f[0].preventDefault(),i.navigate(t)}),[t,i.navigate]),y=[o,u?n:null].filter(Boolean).join(" ")||void 0;return d("a",{...s,href:"#"+t,onClick:p,className:y},a)}function H(){return l(m)}function q(){return l(m).params}function B(){return l(m).navigate}var $e=8;function Ve(){let e=$e;return $e=e===8?16:8,e}var K=4,z=!1;var Ye=[];function Ae(e){let t=K,o=z;K=Ve(),z=!0;try{e()}finally{K=t,z=o,it()}}function it(){let e=Ye;Ye=[];for(let t of e)t()}var je=[];function W(){let e=je;je=[];for(let t of e)t()}function He(e){let t=e();W(),t&&typeof t.then=="function"&&t.then(()=>{W()})}function G(e){if(e.startsWith("//"))throw new Error(`[SpecifyJS] Protocol-relative URL rejected: "${e}". Use an explicit https:// prefix.`);if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return;if(e.startsWith("data:")){if(e.length>1024*1024)throw new Error("[SpecifyJS] secureFetch: data: URI exceeds 1MB limit");return}let t;try{t=new URL(e,typeof window<"u"?window.location.href:void 0)}catch{throw new Error(`[SpecifyJS] secureFetch: unable to validate URL "${e}". Provide a valid absolute HTTPS URL or a relative path.`)}if(t.protocol!=="https:"&&!(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="[::1]"||t.hostname==="0.0.0.0"||t.hostname.startsWith("127.")))throw new Error(`[SpecifyJS] Insecure URL rejected: "${e}". SpecifyJS enforces HTTPS-only for all network requests. Use https:// or a relative URL. Localhost URLs are allowed for development.`)}function M(e,t){let o=typeof e=="string"?e:e instanceof URL?e.href:e.url;return G(o),fetch(e,{redirect:"error",...t})}var qe=new Map;var pt=!0;function Be(e){pt=e}function Ke(e){let t=e.match(/^s-(\d+)-(\d+)$/);if(!t||!t[1]||!t[2])return null;let o=parseInt(t[1],10),n=parseInt(t[2],10);for(let r of qe.values())if(r.index===o)return{typeName:r.name,typeIndex:o,instanceId:n};return null}function ze(){return qe}var J=R({flags:{},isEnabled:()=>!1,setFlag:()=>{},loading:!1});function X(e){let[t,o]=g(()=>({...e.defaults})),[n,r]=g(!!e.url);S(()=>{if(!e.url)return;let u=!1;return r(!0),M(e.url).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.json()}).then(p=>{if(!u&&typeof p=="object"&&p!==null){let y={};for(let f of Object.keys(p))f!=="__proto__"&&f!=="constructor"&&f!=="prototype"&&(y[f]=p[f]===!0);o(f=>({...f,...y}))}u||r(!1)}).catch(()=>{u||r(!1)}),()=>{u=!0}},[e.url]);let a=x(((...u)=>{let p=u[0];return t[p]===!0}),[t]),s=x(((...u)=>{let p=u[0],y=u[1];o(f=>({...f,[p]:y}))}),[]),i={flags:t,isEnabled:a,setFlag:s,loading:n};return d(J.Provider,{value:i},e.children)}function Z(e){let{isEnabled:t}=l(J);return t(e.flag)?e.children:e.fallback??null}function Q(){return l(J)}
|
|
2
|
+
"use strict";var U=Object.defineProperty;var We=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Je=Object.prototype.hasOwnProperty;var Xe=(e,t)=>{for(var n in t)U(e,n,{get:t[n],enumerable:!0})},Ze=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Ge(t))!Je.call(e,r)&&r!==n&&U(e,r,{get:()=>t[r],enumerable:!(o=We(t,r))||o.enumerable});return e};var Qe=e=>Ze(U({},"__esModule",{value:!0}),e);var lt={};Xe(lt,{Children:()=>he,Component:()=>P,ErrorBoundary:()=>L,FeatureFlagProvider:()=>X,FeatureGate:()=>Z,Fragment:()=>ce,Link:()=>j,Profiler:()=>Le,PureComponent:()=>k,Route:()=>Y,Router:()=>A,StrictMode:()=>Ne,Suspense:()=>_e,act:()=>He,assertSecureUrl:()=>G,cloneElement:()=>ye,createContext:()=>b,createElement:()=>d,createFactory:()=>ue,createRef:()=>le,forwardRef:()=>fe,getComponentTypeTable:()=>ze,h:()=>d,isValidElement:()=>w,lazy:()=>me,matchPath:()=>E,memo:()=>de,resolveComponentId:()=>Ke,secureFetch:()=>M,setComponentIdsEnabled:()=>Be,startTransition:()=>Ye,useCallback:()=>x,useContext:()=>l,useDebugValue:()=>ve,useDeferredValue:()=>we,useEffect:()=>S,useFeatureFlags:()=>Q,useHead:()=>$,useId:()=>be,useImperativeHandle:()=>ge,useInsertionEffect:()=>Te,useLayoutEffect:()=>Ee,useMemo:()=>R,useNavigate:()=>B,useParams:()=>q,useReducer:()=>Ce,useRef:()=>F,useRouter:()=>H,useState:()=>g,useSyncExternalStore:()=>ke,useTransition:()=>Re});module.exports=Qe(lt);var v=Symbol.for("spec.element"),ee=Symbol.for("spec.fragment"),dt=Symbol.for("spec.portal"),te=Symbol.for("spec.provider"),ne=Symbol.for("spec.consumer"),oe=Symbol.for("spec.forward_ref"),re=Symbol.for("spec.memo"),se=Symbol.for("spec.lazy"),ae=Symbol.for("spec.suspense"),ie=Symbol.for("spec.strict_mode"),pe=Symbol.for("spec.profiler");function d(e,t,...n){let o=null,r=null,a={};if(t!=null){t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(r=t.ref);for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&s!=="key"&&s!=="ref"&&s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(a[s]=t[s])}if(n.length===1?a.children=n[0]:n.length>1&&(a.children=n),typeof e=="function"&&e.defaultProps){let s=e.defaultProps;for(let i of Object.keys(s))i!=="__proto__"&&i!=="constructor"&&a[i]===void 0&&(a[i]=s[i])}return{$$typeof:v,type:e,props:a,key:o,ref:r}}function ue(e){return(t,...n)=>d(e,t??null,...n)}var ce=ee;function b(e){let t={$$typeof:Symbol.for("spec.context"),Provider:null,Consumer:null,_currentValue:e,_defaultValue:e},n={$$typeof:te,_context:t},o={$$typeof:ne,_context:t};return t.Provider=n,t.Consumer=o,t}function le(){return{current:null}}function fe(e){return{$$typeof:oe,render:e,displayName:e.displayName||e.name||"ForwardRef"}}function de(e,t){return{$$typeof:re,type:e,compare:t||null,displayName:e.displayName||e.name||"Memo"}}function me(e){let t={_status:"pending",_result:void 0};return{$$typeof:se,_payload:t,_init:()=>{if(t._status==="resolved")return t._result;if(t._status==="rejected")throw t._result;let o=e();throw t._status="pending",o.then(r=>{t._status="resolved",t._result=r.default},r=>{t._status="rejected",t._result=r}),o},displayName:"Lazy"}}function w(e){return typeof e=="object"&&e!==null&&e.$$typeof===v}function ye(e,t,...n){if(!w(e))throw new Error("cloneElement: argument must be a valid SpecifyJS element");let o=e.key,r=e.ref,a={...e.props};if(t!=null){t.key!==void 0&&(o=""+t.key),t.ref!==void 0&&(r=t.ref);for(let s in t)Object.prototype.hasOwnProperty.call(t,s)&&s!=="key"&&s!=="ref"&&s!=="__proto__"&&s!=="constructor"&&s!=="prototype"&&(a[s]=t[s])}return n.length===1?a.children=n[0]:n.length>1&&(a.children=n),{$$typeof:v,type:e.type,props:a,key:o,ref:r}}function N(e){let t=[],n=[e];for(;n.length>0;){let o=n.pop();if(Array.isArray(o))for(let r=o.length-1;r>=0;r--)n.push(o[r]);else t.push(o)}return t}function et(e,t){let n=N(e),o=[];for(let r=0;r<n.length;r++){let a=n[r];a==null||typeof a=="boolean"||o.push(t(a,r))}return o}function tt(e,t){let n=N(e),o=0;for(let r of n)r==null||typeof r=="boolean"||t(r,o++)}function nt(e){let t=N(e),n=0;for(let o of t)o!=null&&typeof o!="boolean"&&n++;return n}function ot(e){if(!w(e))throw new Error("Children.only: expected a single SpecifyJS element child");return e}function rt(e){return N(e).filter(n=>n!=null&&typeof n!="boolean")}var he={map:et,forEach:tt,count:nt,only:ot,toArray:rt};var P=class{constructor(t){this._fiber=null;this._pendingState=[];this._forceUpdate=!1;this.props=t,this.state={},this.context=void 0}setState(t,n){this._pendingState.push(t),this._enqueueUpdate(n)}forceUpdate(t){this._forceUpdate=!0,this._enqueueUpdate(t)}render(){return null}_enqueueUpdate(t){}};P.prototype.isSpecComponent=!0;var k=class extends P{shouldComponentUpdate(t,n){return!xe(this.props,t)||!xe(this.state,n)}};k.prototype.isPureSpecComponent=!0;function xe(e,t){if(Object.is(e,t))return!0;if(typeof e!="object"||e===null||typeof t!="object"||t===null)return!1;let n=Object.keys(e),o=Object.keys(t);if(n.length!==o.length)return!1;let r=e,a=t;for(let s of n)if(!Object.prototype.hasOwnProperty.call(a,s)||!Object.is(r[s],a[s]))return!1;return!0}var L=class extends P{static getDerivedStateFromError(t){return{hasError:!0,error:t}}constructor(t){super(t),this.state={hasError:!1,error:null}}componentDidCatch(t,n){this.props.onError?.(t,n)}render(){return this.state.hasError?this.props.fallback??null:this.props.children??null}};function $(e){let t=F(e);t.current=e;let n=JSON.stringify([e.title,e.description,e.keywords,e.author,e.canonical,e.og,e.twitter,e.httpEquiv,e.meta]);S(()=>{let o=t.current,r=[],a=document.title;if(o.title&&(document.title=o.title,r.push(()=>{document.title=a})),o.description&&r.push(C("name","description",o.description)),o.keywords&&r.push(C("name","keywords",o.keywords)),o.author&&r.push(C("name","author",o.author)),o.canonical){let s=document.createElement("link");s.rel="canonical",s.href=o.canonical,document.head.appendChild(s),r.push(()=>s.remove())}if(o.og)for(let[s,i]of Object.entries(o.og))r.push(C("property",`og:${s}`,i));if(o.twitter)for(let[s,i]of Object.entries(o.twitter))r.push(C("name",`twitter:${s}`,i));if(o.httpEquiv){let s={csp:"Content-Security-Policy",referrer:"Referrer-Policy",contentType:"X-Content-Type-Options",frameOptions:"X-Frame-Options",cacheControl:"Cache-Control"};for(let[i,u]of Object.entries(o.httpEquiv)){if(u===void 0)continue;let p=s[i]??i;r.push(st(p,u))}}if(o.meta)for(let s of o.meta)s.name?r.push(C("name",s.name,s.content)):s.property&&r.push(C("property",s.property,s.content));return()=>{for(let s of r)s()}},[n])}function Pe(e){return e.replace(/["\\]/g,"\\$&")}function C(e,t,n){let o=`meta[${e}="${Pe(t)}"]`,r=document.querySelector(o),a=r!==null,s=r?.content;return r||(r=document.createElement("meta"),r.setAttribute(e,t),document.head.appendChild(r)),r.content=n,()=>{a&&s!==void 0?r.content=s:a||r.remove()}}function st(e,t){let n=`meta[http-equiv="${Pe(e)}"]`,o=document.querySelector(n),r=o!==null,a=o?.content;return o||(o=document.createElement("meta"),o.setAttribute("http-equiv",e),document.head.appendChild(o)),o.content=t,()=>{r&&a!==void 0?o.content=a:r||o.remove()}}var Se=null;function c(){if(Se===null)throw new Error("Invalid hook call. Hooks can only be called inside the body of a function component.");return Se}function g(e){return c().useState(e)}function S(e,t){return c().useEffect(e,t)}function l(e){return c().useContext(e)}function Ce(e,t,n){return c().useReducer(e,t,n)}function x(e,t){return c().useCallback(e,t)}function R(e,t){return c().useMemo(e,t)}function F(e){return c().useRef(e)}function ge(e,t,n){return c().useImperativeHandle(e,t,n)}function Ee(e,t){return c().useLayoutEffect(e,t)}function ve(e,t){return c().useDebugValue(e,t)}function be(){return c().useId()}function we(e){return c().useDeferredValue(e)}function Re(){return c().useTransition()}function ke(e,t,n){return c().useSyncExternalStore(e,t,n)}function Te(e,t){return c().useInsertionEffect(e,t)}var _e=ae;var Ne=ie;var Le=pe;var m=b({pathname:"/",params:{},navigate:()=>{throw new Error("useNavigate must be used inside a <Router> component.")},basePath:""});function Fe(){let t=(typeof window<"u"?window.location.hash:"").replace(/^#\/?/,"/");return t===""?"/":t}var Ie={pathname:Fe(),hash:typeof window<"u"?window.location.hash:""},V=new Set;function Me(){Ie={pathname:Fe(),hash:typeof window<"u"?window.location.hash:""};for(let e of V)e()}typeof window<"u"&&window.addEventListener("hashchange",Me);function Oe(e){return V.add(e),()=>{V.delete(e)}}function I(){return Ie}function De(e,t){let n=e.startsWith("#")?e:"#"+e;if(t?.replace){let o=window.location.pathname+window.location.search+n;window.history.replaceState(null,"",o)}else window.location.hash=n;Me()}function A(e){let[t,n]=g(()=>I().pathname);S(()=>(n(I().pathname),Oe(()=>{n(I().pathname)})),[]);let o=x((...a)=>{De(a[0],a[1])},[]),r=R(()=>({pathname:t,params:{},navigate:o,basePath:""}),[t,o]);return d(m.Provider,{value:r},e.children)}function Ue(e){let t=e.length;for(;t>1&&e.charCodeAt(t-1)===47;)t--;return t===e.length?e:e.slice(0,t)}function E(e,t,n){let o=n?.exact??!1,r=e==="/"?"/":Ue(e),a=t==="/"?"/":Ue(t);if(r==="/"){let h=a==="/";return o&&!h?null:{params:{},isExact:h,path:e,url:"/"}}let s=r.split("/").filter(Boolean),i=a.split("/").filter(Boolean),u=s[s.length-1]==="*";if(!u&&o&&i.length!==s.length||!u&&i.length<s.length)return null;let p={},y=[];for(let h=0;h<s.length;h++){let T=s[h];if(T==="*"){let D=i.slice(h).join("/");return p["*"]=D,{params:p,isExact:!0,path:e,url:"/"+i.join("/")}}if(h>=i.length)return null;let _=i[h];if(T.startsWith(":")){let D=T.slice(1);p[D]=decodeURIComponent(_),y.push(_);continue}if(T.toLowerCase()!==_.toLowerCase())return null;y.push(_)}let f="/"+y.join("/"),O=i.length===s.length;return o&&!O?null:{params:p,isExact:O,path:e,url:f}}function Y(e){let t=l(m),n=t.basePath+e.path,o=E(n,t.pathname,{exact:e.exact??!1}),r=R(()=>({pathname:t.pathname,params:{...t.params,...o?o.params:{}},navigate:t.navigate,basePath:o?o.url:t.basePath}),[t.pathname,t.navigate,t.params,t.basePath,o]);if(!o)return null;for(let s of Object.keys(t.params))s in r.params||(r.params[s]=t.params[s]);let a=e.component?d(e.component,{...r.params}):e.children;return d(m.Provider,{value:r},a)}function j(e){let{to:t,className:n,activeClassName:o,exact:r,children:a,...s}=e,i=l(m),u=E(t,i.pathname,{exact:r??!1})!==null,p=x(((...f)=>{f[0].preventDefault(),i.navigate(t)}),[t,i.navigate]),y=[n,u?o:null].filter(Boolean).join(" ")||void 0;return d("a",{...s,href:"#"+t,onClick:p,className:y},a)}function H(){return l(m)}function q(){return l(m).params}function B(){return l(m).navigate}var $e=8;function Ve(){let e=$e;return $e=e===8?16:8,e}var K=4,z=!1;var Ae=[];function Ye(e){let t=K,n=z;K=Ve(),z=!0;try{e()}finally{K=t,z=n,it()}}function it(){let e=Ae;Ae=[];for(let t of e)t()}var je=[];function W(){let e=je;je=[];for(let t of e)t()}function He(e){let t=e();W(),t&&typeof t.then=="function"&&t.then(()=>{W()})}var pt=/^127\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/;function ut(e){let t=pt.exec(e);return t?Number(t[1])<=255&&Number(t[2])<=255&&Number(t[3])<=255:!1}function G(e){if(e.startsWith("//"))throw new Error(`[SpecifyJS] Protocol-relative URL rejected: "${e}". Use an explicit https:// prefix.`);if(e.startsWith("/")||e.startsWith("./")||e.startsWith("../"))return;if(e.startsWith("data:")){if(e.length>1024*1024)throw new Error("[SpecifyJS] secureFetch: data: URI exceeds 1MB limit");return}let t;try{t=new URL(e,typeof window<"u"?window.location.href:void 0)}catch{throw new Error(`[SpecifyJS] secureFetch: unable to validate URL "${e}". Provide a valid absolute HTTPS URL or a relative path.`)}if(t.protocol==="https:")return;let n=t.hostname.toLowerCase();if(!(n==="localhost"||n==="127.0.0.1"||n==="[::1]"||n==="0.0.0.0"||ut(n)))throw n.endsWith(".localhost")?new Error(`[SpecifyJS] SSRF protection: "${e}" uses a .localhost subdomain which resolves to the loopback interface. Use exact "localhost" instead.`):new Error(`[SpecifyJS] Insecure URL rejected: "${e}". SpecifyJS enforces HTTPS-only for all network requests. Use https:// or a relative URL. Localhost URLs are allowed for development.`)}function M(e,t){let n=typeof e=="string"?e:e instanceof URL?e.href:e.url;return G(n),fetch(e,{redirect:"error",...t})}var qe=new Map;var ct=!0;function Be(e){ct=e}function Ke(e){let t=e.match(/^s-(\d+)-(\d+)$/);if(!t||!t[1]||!t[2])return null;let n=parseInt(t[1],10),o=parseInt(t[2],10);for(let r of qe.values())if(r.index===n)return{typeName:r.name,typeIndex:n,instanceId:o};return null}function ze(){return qe}var J=b({flags:{},isEnabled:()=>!1,setFlag:()=>{},loading:!1});function X(e){let[t,n]=g(()=>({...e.defaults})),[o,r]=g(!!e.url);S(()=>{if(!e.url)return;let u=!1;return r(!0),M(e.url).then(p=>{if(!p.ok)throw new Error(`HTTP ${p.status}`);return p.json()}).then(p=>{if(!u&&typeof p=="object"&&p!==null){let y={};for(let f of Object.keys(p))f!=="__proto__"&&f!=="constructor"&&f!=="prototype"&&(y[f]=p[f]===!0);n(f=>({...f,...y}))}u||r(!1)}).catch(()=>{u||r(!1)}),()=>{u=!0}},[e.url]);let a=x(((...u)=>{let p=u[0];return t[p]===!0}),[t]),s=x(((...u)=>{let p=u[0],y=u[1];n(f=>({...f,[p]:y}))}),[]),i={flags:t,isEnabled:a,setFlag:s,loading:o};return d(J.Provider,{value:i},e.children)}function Z(e){let{isEnabled:t}=l(J);return t(e.flag)?e.children:e.fallback??null}function Q(){return l(J)}
|
package/dist/specifyjs.esm.js
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
useNavigate,
|
|
25
25
|
useParams,
|
|
26
26
|
useRouter
|
|
27
|
-
} from "./esm/chunks/chunk-
|
|
27
|
+
} from "./esm/chunks/chunk-PGUFCUSX.js";
|
|
28
28
|
import {
|
|
29
29
|
getComponentTypeTable,
|
|
30
30
|
resolveComponentId,
|
|
@@ -43,7 +43,7 @@ import "./esm/chunks/chunk-UJTLBTMV.js";
|
|
|
43
43
|
import {
|
|
44
44
|
assertSecureUrl,
|
|
45
45
|
secureFetch
|
|
46
|
-
} from "./esm/chunks/chunk-
|
|
46
|
+
} from "./esm/chunks/chunk-RH3DFT32.js";
|
|
47
47
|
import {
|
|
48
48
|
useCallback,
|
|
49
49
|
useContext,
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Secure fetch wrapper — enforces HTTPS-only policy.
|
|
3
|
-
*
|
|
4
|
-
* SpecifyJS prohibits HTTP connections. All network requests must use
|
|
5
|
-
* HTTPS or be relative URLs. This prevents data from being transmitted
|
|
6
|
-
* in plaintext, protecting against eavesdropping and MITM attacks.
|
|
7
|
-
*
|
|
8
|
-
* Exceptions:
|
|
9
|
-
* - Relative URLs (./path, /path) — resolved by the browser
|
|
10
|
-
* - localhost and 127.0.0.1 — development only
|
|
11
|
-
*/
|
|
12
1
|
/**
|
|
13
2
|
* Validate that a URL uses HTTPS or is a relative/localhost URL.
|
|
14
3
|
* Throws if the URL uses plaintext HTTP.
|
|
@@ -1,14 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Secure fetch wrapper — enforces HTTPS-only policy.
|
|
3
|
-
*
|
|
4
|
-
* SpecifyJS prohibits HTTP connections. All network requests must use
|
|
5
|
-
* HTTPS or be relative URLs. This prevents data from being transmitted
|
|
6
|
-
* in plaintext, protecting against eavesdropping and MITM attacks.
|
|
7
|
-
*
|
|
8
|
-
* Exceptions:
|
|
9
|
-
* - Relative URLs (./path, /path) — resolved by the browser
|
|
10
|
-
* - localhost and 127.0.0.1 — development only
|
|
11
|
-
*/
|
|
12
1
|
/**
|
|
13
2
|
* Validate that a URL uses HTTPS or is a relative/localhost URL.
|
|
14
3
|
* Throws if the URL uses plaintext HTTP.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@asymmetric-effort/specifyjs",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A declarative TypeScript UI framework built for performance and simplicity",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"devDependencies": {
|
|
98
98
|
"@asymmetric-effort/nogginlessdom": "^0.0.28",
|
|
99
99
|
"@playwright/test": "^1.59.0",
|
|
100
|
-
"@types/node": "^
|
|
100
|
+
"@types/node": "^26.2.0",
|
|
101
101
|
"@typescript-eslint/eslint-plugin": "^8.0.0",
|
|
102
102
|
"@typescript-eslint/parser": "^8.0.0",
|
|
103
103
|
"eslint": "^10.3.0",
|