piral-breadcrumbs 0.15.0-alpha.3555 → 0.15.0-alpha.3564

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.
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import { BreadcrumbsContainerProps, BreadcrumbItemProps } from './types';
3
- export declare const PiralBreadcrumbsContainer: React.ComponentType<BreadcrumbsContainerProps>;
4
- export declare const PiralBreadcrumbItem: React.ComponentType<BreadcrumbItemProps>;
3
+ export declare const PiralBreadcrumbsContainer: ComponentType<BreadcrumbsContainerProps>;
4
+ export declare const PiralBreadcrumbItem: ComponentType<BreadcrumbItemProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,yBAAyB,GACpC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAA6C,iBAAiB,CAAC,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAG/C,MAAM,CAAC,MAAM,yBAAyB,GACpC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC;AAC5C,MAAM,CAAC,MAAM,mBAAmB,GAAuC,iBAAiB,CAAC,gBAAgB,CAAC,CAAC"}
package/esm/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ComponentType, ReactChild } from 'react';
2
- import { Dict, BaseRegistration, RegistrationDisposer } from 'piral-core';
1
+ import type { ComponentType, ReactChild } from 'react';
2
+ import type { Dict, BaseRegistration, RegistrationDisposer } from 'piral-core';
3
3
  declare module 'piral-core/lib/types/custom' {
4
4
  interface PiletCustomApi extends PiletBreadcrumbsApi {
5
5
  }
@@ -1,4 +1,4 @@
1
- import * as React from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import { BreadcrumbsContainerProps, BreadcrumbItemProps } from './types';
3
- export declare const PiralBreadcrumbsContainer: React.ComponentType<BreadcrumbsContainerProps>;
4
- export declare const PiralBreadcrumbItem: React.ComponentType<BreadcrumbItemProps>;
3
+ export declare const PiralBreadcrumbsContainer: ComponentType<BreadcrumbsContainerProps>;
4
+ export declare const PiralBreadcrumbItem: ComponentType<BreadcrumbItemProps>;
@@ -1 +1 @@
1
- {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AACA,2CAA+C;AAGlC,QAAA,yBAAyB,GACpC,IAAA,8BAAiB,EAAC,sBAAsB,CAAC,CAAC;AAC/B,QAAA,mBAAmB,GAA6C,IAAA,8BAAiB,EAAC,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"components.js","sourceRoot":"","sources":["../src/components.tsx"],"names":[],"mappings":";;;AACA,2CAA+C;AAGlC,QAAA,yBAAyB,GACpC,IAAA,8BAAiB,EAAC,sBAAsB,CAAC,CAAC;AAC/B,QAAA,mBAAmB,GAAuC,IAAA,8BAAiB,EAAC,gBAAgB,CAAC,CAAC"}
package/lib/types.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ComponentType, ReactChild } from 'react';
2
- import { Dict, BaseRegistration, RegistrationDisposer } from 'piral-core';
1
+ import type { ComponentType, ReactChild } from 'react';
2
+ import type { Dict, BaseRegistration, RegistrationDisposer } from 'piral-core';
3
3
  declare module 'piral-core/lib/types/custom' {
4
4
  interface PiletCustomApi extends PiletBreadcrumbsApi {
5
5
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "piral-breadcrumbs",
3
- "version": "0.15.0-alpha.3555",
3
+ "version": "0.15.0-alpha.3564",
4
4
  "description": "Plugin for creating a breadcrumb manager in Piral.",
5
5
  "keywords": [
6
6
  "piral",
@@ -24,7 +24,8 @@
24
24
  "files": [
25
25
  "esm",
26
26
  "lib",
27
- "src"
27
+ "src",
28
+ "piral-breadcrumbs.min.js"
28
29
  ],
29
30
  "repository": {
30
31
  "type": "git",
@@ -34,20 +35,27 @@
34
35
  "url": "https://github.com/smapiot/piral/issues"
35
36
  },
36
37
  "scripts": {
37
- "build": "yarn build:commonjs && yarn build:esnext",
38
+ "build": "yarn build:bundle && yarn build:commonjs && yarn build:esnext",
39
+ "build:bundle": "esbuild src/index.ts --outfile=piral-breadcrumbs.min.js --bundle --external:piral-core --external:react --external:react-router --minify",
38
40
  "build:commonjs": "tsc --project tsconfig.json --outDir lib --module commonjs",
39
41
  "build:esnext": "tsc --project tsconfig.json --outDir esm --module esnext",
40
42
  "typedoc": "typedoc --json ../../../docs/types/piral-breadcrumbs.json src --exclude \"src/**/*.test.*\"",
41
43
  "test": "echo \"Error: run tests from root\" && exit 1"
42
44
  },
43
45
  "devDependencies": {
44
- "piral-core": "0.15.0-alpha.3555"
46
+ "@types/react": "^17.0.0",
47
+ "@types/react-router": "^5.1.8",
48
+ "piral-core": "0.15.0-alpha.3564",
49
+ "react": "^17.0.1",
50
+ "react-router": "^5.2.0"
45
51
  },
46
52
  "dependencies": {
47
53
  "path-to-regexp": "^1.8.0"
48
54
  },
49
55
  "peerDependencies": {
50
- "piral-core": "0.14.x"
56
+ "piral-core": "0.14.x",
57
+ "react": ">=16.8.0",
58
+ "react-router": "5.x"
51
59
  },
52
- "gitHead": "0727a5c782dd1bbc7ccaa11a036a9f16e616bf10"
60
+ "gitHead": "e5af009799d073993a1c415c4ee63029f9b3d547"
53
61
  }
@@ -0,0 +1 @@
1
+ (()=>{var pr=Object.create;var R=Object.defineProperty,lr=Object.defineProperties,dr=Object.getOwnPropertyDescriptor,fr=Object.getOwnPropertyDescriptors,br=Object.getOwnPropertyNames,A=Object.getOwnPropertySymbols,gr=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty,M=Object.prototype.propertyIsEnumerable;var z=(r,e,t)=>e in r?R(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,f=(r,e)=>{for(var t in e||(e={}))G.call(e,t)&&z(r,t,e[t]);if(A)for(var t of A(e))M.call(e,t)&&z(r,t,e[t]);return r},g=(r,e)=>lr(r,fr(e)),H=r=>R(r,"__esModule",{value:!0});var h=(r=>typeof require!="undefined"?require:typeof Proxy!="undefined"?new Proxy(r,{get:(e,t)=>(typeof require!="undefined"?require:e)[t]}):r)(function(r){if(typeof require!="undefined")return require.apply(this,arguments);throw new Error('Dynamic require of "'+r+'" is not supported')});var L=(r,e)=>{var t={};for(var a in r)G.call(r,a)&&e.indexOf(a)<0&&(t[a]=r[a]);if(r!=null&&A)for(var a of A(r))e.indexOf(a)<0&&M.call(r,a)&&(t[a]=r[a]);return t};var W=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),hr=(r,e)=>{H(r);for(var t in e)R(r,t,{get:e[t],enumerable:!0})},Br=(r,e,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of br(e))!G.call(r,a)&&a!=="default"&&R(r,a,{get:()=>e[a],enumerable:!(t=dr(e,a))||t.enumerable});return r},B=r=>Br(H(R(r!=null?pr(gr(r)):{},"default",r&&r.__esModule&&"default"in r?{get:()=>r.default,enumerable:!0}:{value:r,enumerable:!0})),r);var tr=W((qr,er)=>{er.exports=Array.isArray||function(r){return Object.prototype.toString.call(r)=="[object Array]"}});var or=W((Jr,y)=>{var D=tr();y.exports=ir;y.exports.parse=j;y.exports.compile=wr;y.exports.tokensToFunction=ar;y.exports.tokensToRegExp=nr;var Cr=new RegExp(["(\\\\.)","([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^\\\\()])+)\\))?|\\(((?:\\\\.|[^\\\\()])+)\\))([+*?])?|(\\*))"].join("|"),"g");function j(r,e){for(var t=[],a=0,c=0,n="",m=e&&e.delimiter||"/",i;(i=Cr.exec(r))!=null;){var s=i[0],u=i[1],p=i.index;if(n+=r.slice(c,p),c=p+s.length,u){n+=u[1];continue}var o=r[c],l=i[2],d=i[3],b=i[4],w=i[5],v=i[6],P=i[7];n&&(t.push(n),n="");var E=l!=null&&o!=null&&o!==l,sr=v==="+"||v==="*",mr=v==="?"||v==="*",q=i[2]||m,J=b||w;t.push({name:d||a++,prefix:l||"",delimiter:q,optional:mr,repeat:sr,partial:E,asterisk:!!P,pattern:J?Ar(J):P?".*":"[^"+$(q)+"]+?"})}return c<r.length&&(n+=r.substr(c)),n&&t.push(n),t}function wr(r,e){return ar(j(r,e),e)}function Pr(r){return encodeURI(r).replace(/[\/?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function Er(r){return encodeURI(r).replace(/[?#]/g,function(e){return"%"+e.charCodeAt(0).toString(16).toUpperCase()})}function ar(r,e){for(var t=new Array(r.length),a=0;a<r.length;a++)typeof r[a]=="object"&&(t[a]=new RegExp("^(?:"+r[a].pattern+")$",K(e)));return function(c,n){for(var m="",i=c||{},s=n||{},u=s.pretty?Pr:encodeURIComponent,p=0;p<r.length;p++){var o=r[p];if(typeof o=="string"){m+=o;continue}var l=i[o.name],d;if(l==null)if(o.optional){o.partial&&(m+=o.prefix);continue}else throw new TypeError('Expected "'+o.name+'" to be defined');if(D(l)){if(!o.repeat)throw new TypeError('Expected "'+o.name+'" to not repeat, but received `'+JSON.stringify(l)+"`");if(l.length===0){if(o.optional)continue;throw new TypeError('Expected "'+o.name+'" to not be empty')}for(var b=0;b<l.length;b++){if(d=u(l[b]),!t[p].test(d))throw new TypeError('Expected all "'+o.name+'" to match "'+o.pattern+'", but received `'+JSON.stringify(d)+"`");m+=(b===0?o.prefix:o.delimiter)+d}continue}if(d=o.asterisk?Er(l):u(l),!t[p].test(d))throw new TypeError('Expected "'+o.name+'" to match "'+o.pattern+'", but received "'+d+'"');m+=o.prefix+d}return m}}function $(r){return r.replace(/([.+*?=^!:${}()[\]|\/\\])/g,"\\$1")}function Ar(r){return r.replace(/([=!:$\/()])/g,"\\$1")}function O(r,e){return r.keys=e,r}function K(r){return r&&r.sensitive?"":"i"}function Sr(r,e){var t=r.source.match(/\((?!\?)/g);if(t)for(var a=0;a<t.length;a++)e.push({name:a,prefix:null,delimiter:null,optional:!1,repeat:!1,partial:!1,asterisk:!1,pattern:null});return O(r,e)}function Tr(r,e,t){for(var a=[],c=0;c<r.length;c++)a.push(ir(r[c],e,t).source);var n=new RegExp("(?:"+a.join("|")+")",K(t));return O(n,e)}function Ir(r,e,t){return nr(j(r,t),e,t)}function nr(r,e,t){D(e)||(t=e||t,e=[]),t=t||{};for(var a=t.strict,c=t.end!==!1,n="",m=0;m<r.length;m++){var i=r[m];if(typeof i=="string")n+=$(i);else{var s=$(i.prefix),u="(?:"+i.pattern+")";e.push(i),i.repeat&&(u+="(?:"+s+u+")*"),i.optional?i.partial?u=s+"("+u+")?":u="(?:"+s+"("+u+"))?":u=s+"("+u+")",n+=u}}var p=$(t.delimiter||"/"),o=n.slice(-p.length)===p;return a||(n=(o?n.slice(0,-p.length):n)+"(?:"+p+"(?=$))?"),c?n+="$":n+=a&&o?"":"(?="+p+"|$)",O(new RegExp("^"+n,K(t)),e)}function ir(r,e,t){return D(e)||(t=e||t,e=[]),t=t||{},r instanceof RegExp?Sr(r,e):D(r)?Tr(r,e,t):Ir(r,e,t)}});var F=B(h("react")),T=B(h("react-router"));var U=B(h("piral-core")),X=(0,U.getPiralComponent)("BreadcrumbsContainer"),Z=(0,U.getPiralComponent)("BreadcrumbItem");var Q=B(h("piral-core"));function xr(r,e){let[t]=r.filter(a=>a.matcher.test(e));return t}function vr(r,e){let t=e.split("/");for(;t.length>1;){t.pop();let a=t.join("/"),c=S(r,a);if(c)return c}}function S(r,e){if(e)return xr(r,e)||vr(r,e)}function V(r){let e=(0,Q.useGlobalState)(a=>a.registry.breadcrumbs),t=Object.keys(e).map(a=>e[a]);if(t.length>0){let a=S(t,r);if(a){let c=[a],n=S(t,a.settings.parent);for(;n!==void 0;)c.push(n),n=S(t,n.settings.parent);return c.reverse()}}return[]}var N=()=>{var m;let r=(0,T.useLocation)(),e=V(r.pathname),t=e.length-1,a=e[t],{params:c}=(0,T.useRouteMatch)((m=a==null?void 0:a.settings.path)!=null?m:"/"),n=e.map(({settings:i},s)=>{let w=i,{title:u,path:p}=w,o=L(w,["title","path"]),l=`bc_${s}_${i.path}`,d=s===t,b=p.replace(/:([A-Za-z0-9_]+)/g,(v,P)=>{var E;return(E=c[P])!=null?E:v});return F.createElement(Z,f({key:l,current:d,path:b},o),u)});return F.createElement(X,{children:n})};N.displayName="Breadcrumbs";var _={};hr(_,{registerBreadcrumb:()=>yr,unregisterBreadcrumb:()=>Rr});var I=B(h("piral-core"));function yr(r,e,t){r.dispatch(a=>g(f({},a),{registry:g(f({},a.registry),{breadcrumbs:(0,I.withKey)(a.registry.breadcrumbs,e,t)})}))}function Rr(r,e){r.dispatch(t=>g(f({},t),{registry:g(f({},t.registry),{breadcrumbs:(0,I.withoutKey)(t.registry.breadcrumbs,e)})}))}var x=B(h("piral-core"));var Y=B(h("react")),C=B(h("piral-core")),k=r=>Y.createElement(C.ExtensionSlot,{name:"breadcrumbs",params:r,empty:()=>(0,C.defaultRender)(r.children,"default_breadcrumbs")}),rr=r=>(0,C.defaultRender)(r.children);var cr=or();function ur(r){return r.matcher instanceof RegExp?r.matcher:typeof r.matcher=="string"?cr(r.matcher):cr(r.path)}function Dr(r){let e={},t=0;for(let a of r)e[`global-${t++}`]={pilet:void 0,matcher:ur(a),settings:a};return e}function $r(r){return e=>g(f({},e),{components:f({BreadcrumbItem:rr,BreadcrumbsContainer:k},e.components),registry:g(f({},e.registry),{breadcrumbs:r})})}function Xr(r={}){let{breadcrumbs:e=[]}=r;return t=>(t.defineActions(_),t.dispatch((0,x.withAll)($r(Dr(e)),(0,x.withRootExtension)("piral-breadcrumbs",N))),(a,c)=>{let n=c.name,m=0;return{registerBreadcrumb(i,s){typeof i!="string"&&(s=i,i=m++);let u=(0,x.buildName)(n,i);return t.registerBreadcrumb(u,{pilet:n,matcher:ur(s),settings:s}),()=>a.unregisterBreadcrumb(i)},unregisterBreadcrumb(i){let s=(0,x.buildName)(n,i);t.unregisterBreadcrumb(s)}}})}})();
@@ -1,7 +1,7 @@
1
- import * as React from 'react';
1
+ import { ComponentType } from 'react';
2
2
  import { getPiralComponent } from 'piral-core';
3
3
  import { BreadcrumbsContainerProps, BreadcrumbItemProps } from './types';
4
4
 
5
- export const PiralBreadcrumbsContainer: React.ComponentType<BreadcrumbsContainerProps> =
5
+ export const PiralBreadcrumbsContainer: ComponentType<BreadcrumbsContainerProps> =
6
6
  getPiralComponent('BreadcrumbsContainer');
7
- export const PiralBreadcrumbItem: React.ComponentType<BreadcrumbItemProps> = getPiralComponent('BreadcrumbItem');
7
+ export const PiralBreadcrumbItem: ComponentType<BreadcrumbItemProps> = getPiralComponent('BreadcrumbItem');
package/src/types.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ComponentType, ReactChild } from 'react';
2
- import { Dict, BaseRegistration, RegistrationDisposer } from 'piral-core';
1
+ import type { ComponentType, ReactChild } from 'react';
2
+ import type { Dict, BaseRegistration, RegistrationDisposer } from 'piral-core';
3
3
 
4
4
  declare module 'piral-core/lib/types/custom' {
5
5
  interface PiletCustomApi extends PiletBreadcrumbsApi {}