diver_down 0.0.1.alpha4 → 0.0.1.alpha6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/diver_down/version.rb +1 -1
- data/lib/diver_down/web/action.rb +1 -0
- data/lib/diver_down/web/definition_to_dot.rb +66 -43
- data/lib/diver_down/web/module_store.rb +7 -1
- data/web/assets/bundle.js +2 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d4a5bb567f1141aaa13b3d6aaf7e4201b005988a072cfd5c4de2e11a180c480
|
4
|
+
data.tar.gz: 5cf5455488b8944830f2f25fb7f26a1b4d21ed2d42ee1c2ea755138ba3aa40e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79b39d0ecc4569ce41d26c24ae03d903c431a7cdc55c9c9fecbcbbfadc807edbdcab3c34481fde3b6d728791b780951ef1923afb37414f6403a3daa415537d73
|
7
|
+
data.tar.gz: '0800be880d27a2c61c8e7153bbea2c02ab8573d347a5b5cccd9325549e7284f2d8c4316b3fb794c9fa0c42ee47e9fa9d7df9d9a24efe4d106ba5d767c2d3c0a3'
|
data/lib/diver_down/version.rb
CHANGED
@@ -161,7 +161,7 @@ module DiverDown
|
|
161
161
|
|
162
162
|
# @return [String]
|
163
163
|
def to_s
|
164
|
-
io.puts %(strict digraph "#{definition.title}" {)
|
164
|
+
io.puts %(strict digraph "#{escape_quote(definition.title)}" {)
|
165
165
|
io.indented do
|
166
166
|
io.puts('compound=true') if @compound
|
167
167
|
io.puts('concentrate=true') if @concentrate
|
@@ -169,9 +169,7 @@ module DiverDown
|
|
169
169
|
if @only_module
|
170
170
|
render_only_modules
|
171
171
|
else
|
172
|
-
|
173
|
-
insert_source(_1)
|
174
|
-
end
|
172
|
+
render_sources
|
175
173
|
end
|
176
174
|
end
|
177
175
|
io.puts '}'
|
@@ -214,11 +212,11 @@ module DiverDown
|
|
214
212
|
module_names = specific_module_names[0..index]
|
215
213
|
module_name = specific_module_names[index]
|
216
214
|
|
217
|
-
io.puts %(subgraph "#{module_label(module_names)}" {)
|
215
|
+
io.puts %(subgraph "#{escape_quote(module_label(module_names))}" {)
|
218
216
|
io.indented do
|
219
217
|
io.puts %(id="#{@metadata_store.issue_modules_id(module_names)}")
|
220
|
-
io.puts %(label="#{module_name}")
|
221
|
-
io.puts %("#{module_name}" #{build_attributes(label: module_name, id: @metadata_store.issue_modules_id(module_names))})
|
218
|
+
io.puts %(label="#{escape_quote(module_name)}")
|
219
|
+
io.puts %("#{escape_quote(module_name)}" #{build_attributes(label: module_name, id: @metadata_store.issue_modules_id(module_names))})
|
222
220
|
|
223
221
|
next_proc&.call
|
224
222
|
end
|
@@ -260,7 +258,7 @@ module DiverDown
|
|
260
258
|
minlen: MODULE_MINLEN
|
261
259
|
)
|
262
260
|
|
263
|
-
io.write(%("#{from_modules[-1]}" -> "#{to_modules[-1]}"))
|
261
|
+
io.write(%("#{escape_quote(from_modules[-1])}" -> "#{escape_quote(to_modules[-1])}"))
|
264
262
|
io.write(%( #{build_attributes(**attributes)}), indent: false) unless attributes.empty?
|
265
263
|
io.write("\n")
|
266
264
|
end
|
@@ -268,13 +266,62 @@ module DiverDown
|
|
268
266
|
end
|
269
267
|
end
|
270
268
|
|
271
|
-
def
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
269
|
+
def render_sources
|
270
|
+
by_modules = definition.sources.group_by do |source|
|
271
|
+
module_store.get(source.source_name)
|
272
|
+
end
|
273
|
+
|
274
|
+
# Remove duplicated prefix modules
|
275
|
+
# from [["A"], ["A", "B"]] to [["A", "B"]]
|
276
|
+
uniq_modules = by_modules.keys.uniq
|
277
|
+
uniq_modules = uniq_modules.reject do |modules|
|
278
|
+
uniq_modules.any? { _1[0..modules.size - 1] == modules && _1.length > modules.size }
|
276
279
|
end
|
277
280
|
|
281
|
+
uniq_modules.each do |full_modules|
|
282
|
+
# Render module and source
|
283
|
+
if full_modules.empty?
|
284
|
+
sources = by_modules[full_modules].sort_by(&:source_name)
|
285
|
+
|
286
|
+
sources.each do |source|
|
287
|
+
insert_source(source)
|
288
|
+
insert_dependencies(source)
|
289
|
+
end
|
290
|
+
else
|
291
|
+
buf = swap_io do
|
292
|
+
indexes = (0..(full_modules.length - 1)).to_a
|
293
|
+
|
294
|
+
chain_yield(indexes) do |index, next_proc|
|
295
|
+
module_names = full_modules[0..index]
|
296
|
+
module_name = module_names[-1]
|
297
|
+
|
298
|
+
io.puts %(subgraph "#{escape_quote(module_label(module_names))}" {)
|
299
|
+
io.indented do
|
300
|
+
io.puts %(id="#{@metadata_store.issue_modules_id(module_names)}")
|
301
|
+
io.puts %(label="#{escape_quote(module_name)}")
|
302
|
+
|
303
|
+
sources = (by_modules[module_names] || []).sort_by(&:source_name)
|
304
|
+
sources.each do |source|
|
305
|
+
insert_source(source)
|
306
|
+
insert_dependencies(source)
|
307
|
+
end
|
308
|
+
|
309
|
+
next_proc&.call
|
310
|
+
end
|
311
|
+
io.puts '}'
|
312
|
+
end
|
313
|
+
end
|
314
|
+
|
315
|
+
io.write buf.string
|
316
|
+
end
|
317
|
+
end
|
318
|
+
end
|
319
|
+
|
320
|
+
def insert_source(source)
|
321
|
+
io.puts %("#{escape_quote(source.source_name)}" #{build_attributes(label: source.source_name, id: @metadata_store.issue_source_id(source))})
|
322
|
+
end
|
323
|
+
|
324
|
+
def insert_dependencies(source)
|
278
325
|
source.dependencies.each do
|
279
326
|
attributes = {}
|
280
327
|
ltail = module_label(*module_store.get(source.source_name))
|
@@ -307,40 +354,12 @@ module DiverDown
|
|
307
354
|
)
|
308
355
|
end
|
309
356
|
|
310
|
-
io.write(%("#{source.source_name}" -> "#{_1.source_name}"))
|
357
|
+
io.write(%("#{escape_quote(source.source_name)}" -> "#{escape_quote(_1.source_name)}"))
|
311
358
|
io.write(%( #{build_attributes(**attributes)}), indent: false) unless attributes.empty?
|
312
359
|
io.write("\n")
|
313
360
|
end
|
314
361
|
end
|
315
362
|
|
316
|
-
def insert_modules(source)
|
317
|
-
buf = swap_io do
|
318
|
-
all_module_names = module_store.get(source.source_name)
|
319
|
-
indexes = (0..(all_module_names.length - 1)).to_a
|
320
|
-
|
321
|
-
chain_yield(indexes) do |index, next_proc|
|
322
|
-
module_names = all_module_names[0..index]
|
323
|
-
module_name = module_names[-1]
|
324
|
-
|
325
|
-
io.puts %(subgraph "#{module_label(module_names)}" {)
|
326
|
-
io.indented do
|
327
|
-
io.puts %(id="#{@metadata_store.issue_modules_id(module_names)}")
|
328
|
-
io.puts %(label="#{module_name}")
|
329
|
-
|
330
|
-
if next_proc
|
331
|
-
next_proc.call
|
332
|
-
else
|
333
|
-
# last. equals indexes[-1] == index
|
334
|
-
io.puts %("#{source.source_name}" #{build_attributes(label: source.source_name, id: @metadata_store.issue_source_id(source))})
|
335
|
-
end
|
336
|
-
end
|
337
|
-
io.puts '}'
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
io.write buf.string
|
342
|
-
end
|
343
|
-
|
344
363
|
def chain_yield(values, &block)
|
345
364
|
*head, tail = values
|
346
365
|
|
@@ -363,7 +382,7 @@ module DiverDown
|
|
363
382
|
attrs = attrs.reject { _2.nil? || _2 == '' }
|
364
383
|
return if attrs.empty?
|
365
384
|
|
366
|
-
attrs_str = attrs.map { %(#{_1}="#{_2}") }.join(ATTRIBUTE_DELIMITER)
|
385
|
+
attrs_str = attrs.map { %(#{_1}="#{escape_quote(_2)}") }.join(ATTRIBUTE_DELIMITER)
|
367
386
|
|
368
387
|
if _wrap
|
369
388
|
"#{_wrap[0]}#{attrs_str}#{_wrap[1]}"
|
@@ -394,6 +413,10 @@ module DiverDown
|
|
394
413
|
|
395
414
|
"cluster_#{modules.join(MODULE_DELIMITER)}"
|
396
415
|
end
|
416
|
+
|
417
|
+
def escape_quote(string)
|
418
|
+
string.to_s.gsub(/"/, '\"')
|
419
|
+
end
|
397
420
|
end
|
398
421
|
end
|
399
422
|
end
|
data/web/assets/bundle.js
CHANGED
@@ -352,7 +352,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
352
352
|
height: calc(100% - 60px);
|
353
353
|
`,q6=We(pt)`
|
354
354
|
display: block;
|
355
|
-
`;var J6=Object.defineProperty,A6=(e,t,r)=>t in e?J6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bu=(e,t,r)=>(A6(e,typeof t!="symbol"?t+"":t,r),r),kp=new Map,wu=new WeakMap,m1=0,eD=void 0;function tD(e){return e?(wu.has(e)||(m1+=1,wu.set(e,m1.toString())),wu.get(e)):"0"}function rD(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?tD(e.root):e[t]}`).toString()}function nD(e){const t=rD(e);let r=kp.get(t);if(!r){const n=new Map;let o;const i=new IntersectionObserver(a=>{a.forEach(s=>{var l;const u=s.isIntersecting&&o.some(f=>s.intersectionRatio>=f);e.trackVisibility&&typeof s.isVisible>"u"&&(s.isVisible=u),(l=n.get(s.target))==null||l.forEach(f=>{f(u,s)})})},e);o=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},kp.set(t,r)}return r}function oD(e,t,r={},n=eD){if(typeof window.IntersectionObserver>"u"&&n!==void 0){const l=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:typeof r.threshold=="number"?r.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:o,observer:i,elements:a}=nD(r),s=a.get(e)||[];return a.has(e)||a.set(e,s),s.push(t),i.observe(e),function(){s.splice(s.indexOf(t),1),s.length===0&&(a.delete(e),i.unobserve(e)),a.size===0&&(i.disconnect(),kp.delete(o))}}function iD(e){return typeof e.children!="function"}var aD=class extends g.Component{constructor(e){super(e),bu(this,"node",null),bu(this,"_unobserveCb",null),bu(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&this.setState({inView:!!this.props.initialInView,entry:void 0})),this.node=t||null,this.observeNode()}),bu(this,"handleChange",(t,r)=>{t&&this.props.triggerOnce&&this.unobserve(),iD(this.props)||this.setState({inView:t,entry:r}),this.props.onChange&&this.props.onChange(t,r)}),this.state={inView:!!e.initialInView,entry:void 0}}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(e){(e.rootMargin!==this.props.rootMargin||e.root!==this.props.root||e.threshold!==this.props.threshold||e.skip!==this.props.skip||e.trackVisibility!==this.props.trackVisibility||e.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:e,root:t,rootMargin:r,trackVisibility:n,delay:o,fallbackInView:i}=this.props;this._unobserveCb=oD(this.node,this.handleChange,{threshold:e,root:t,rootMargin:r,trackVisibility:n,delay:o},i)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if(typeof e=="function"){const{inView:p,entry:y}=this.state;return e({inView:p,entry:y,ref:this.handleNode})}const{as:t,triggerOnce:r,threshold:n,root:o,rootMargin:i,onChange:a,skip:s,trackVisibility:l,delay:u,initialInView:f,fallbackInView:d,...m}=this.props;return g.createElement(t||"div",{ref:this.handleNode,...m},e)}};const g1=O.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),$d={dedupe:!0},sD=(e,t,r)=>{const{cache:n,compare:o,suspense:i,fallbackData:a,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:d,keepPreviousData:m}=r,[p,y,x,R]=rn.get(n),[v,b]=bo(e),E=g.useRef(!1),k=g.useRef(!1),_=g.useRef(v),T=g.useRef(t),L=g.useRef(r),I=()=>L.current,W=()=>I().isVisible()&&I().isOnline(),[D,G,j,Y]=Wn(n,v),B=g.useRef({}).current,$=pe(a)?r.fallback[v]:a,M=(te,oe)=>{for(const ne in B){const fe=ne;if(fe==="data"){if(!o(te[fe],oe[fe])&&(!pe(te[fe])||!o(ae,oe[fe])))return!1}else if(oe[fe]!==te[fe])return!1}return!0},U=g.useMemo(()=>{const te=!v||!t?!1:pe(s)?I().isPaused()||i?!1:pe(l)?!0:l:s,oe=se=>{const Re=Mr(se);return delete Re._k,te?{isValidating:!0,isLoading:!0,...Re}:Re},ne=D(),fe=Y(),me=oe(ne),S=ne===fe?me:oe(fe);let he=me;return[()=>{const se=oe(D());return M(se,he)?(he.data=se.data,he.isLoading=se.isLoading,he.isValidating=se.isValidating,he.error=se.error,he):(he=se,se)},()=>S]},[n,v]),P=vf.useSyncExternalStore(g.useCallback(te=>j(v,(oe,ne)=>{M(ne,oe)||te()}),[n,v]),U[0],U[1]),z=!E.current,Q=p[v]&&p[v].length>0,J=P.data,q=pe(J)?$:J,ie=P.error,Z=g.useRef(q),ae=m?pe(J)?Z.current:J:q,ce=Q&&!pe(ie)?!1:z&&!pe(s)?s:I().isPaused()?!1:i?pe(q)?!1:l:pe(q)||l,ge=!!(v&&t&&z&&ce),xe=pe(P.isValidating)?ge:P.isValidating,_e=pe(P.isLoading)?ge:P.isLoading,le=g.useCallback(async te=>{const oe=T.current;if(!v||!oe||k.current||I().isPaused())return!1;let ne,fe,me=!0;const S=te||{},he=!x[v]||!S.dedupe,se=()=>$i?!k.current&&v===_.current&&E.current:v===_.current,Re={isValidating:!1,isLoading:!1},gt=()=>{G(Re)},Ae=()=>{const Te=x[v];Te&&Te[1]===fe&&delete x[v]},qe={isValidating:!0};pe(D().data)&&(qe.isLoading=!0);try{if(he&&(G(qe),r.loadingTimeout&&pe(D().data)&&setTimeout(()=>{me&&se()&&I().onLoadingSlow(v,r)},r.loadingTimeout),x[v]=[oe(b),Bi()]),[ne,fe]=x[v],ne=await ne,he&&setTimeout(Ae,r.dedupingInterval),!x[v]||x[v][1]!==fe)return he&&se()&&I().onDiscarded(v),!1;Re.error=rt;const Te=y[v];if(!pe(Te)&&(fe<=Te[0]||fe<=Te[1]||Te[1]===0))return gt(),he&&se()&&I().onDiscarded(v),!1;const Ne=D().data;Re.data=o(Ne,ne)?Ne:ne,he&&se()&&I().onSuccess(ne,v,r)}catch(Te){Ae();const Ne=I(),{shouldRetryOnError:yt}=Ne;Ne.isPaused()||(Re.error=Te,he&&se()&&(Ne.onError(Te,v,Ne),(yt===!0||sr(yt)&&yt(Te))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||W())&&Ne.onErrorRetry(Te,v,Ne,Rt=>{const Ve=p[v];Ve&&Ve[0]&&Ve[0](gr.ERROR_REVALIDATE_EVENT,Rt)},{retryCount:(S.retryCount||0)+1,dedupe:!0})))}return me=!1,gt(),!0},[v,n]),Ee=g.useCallback((...te)=>wf(n,_.current,...te),[]);if(Gr(()=>{T.current=t,L.current=r,pe(J)||(Z.current=J)}),Gr(()=>{if(!v)return;const te=le.bind(rt,$d);let oe=0;const fe=og(v,p,(me,S={})=>{if(me==gr.FOCUS_EVENT){const he=Date.now();I().revalidateOnFocus&&he>oe&&W()&&(oe=he+I().focusThrottleInterval,te())}else if(me==gr.RECONNECT_EVENT)I().revalidateOnReconnect&&W()&&te();else{if(me==gr.MUTATE_EVENT)return le();if(me==gr.ERROR_REVALIDATE_EVENT)return le(S)}});return k.current=!1,_.current=v,E.current=!0,G({_k:b}),ce&&(pe(q)||vo?te():tg(te)),()=>{k.current=!0,fe()}},[v]),Gr(()=>{let te;function oe(){const fe=sr(u)?u(D().data):u;fe&&te!==-1&&(te=setTimeout(ne,fe))}function ne(){!D().error&&(f||I().isVisible())&&(d||I().isOnline())?le($d).then(oe):oe()}return oe(),()=>{te&&(clearTimeout(te),te=-1)}},[u,f,d,v]),g.useDebugValue(ae),i&&pe(q)&&v){if(!$i&&vo)throw new Error("Fallback data is required when using suspense in SSR.");T.current=t,L.current=r,k.current=!1;const te=R[v];if(!pe(te)){const oe=Ee(te);g1(oe)}if(pe(ie)){const oe=le($d);pe(ae)||(oe.status="fulfilled",oe.value=!0),g1(oe)}else throw ie}return{mutate:Ee,get data(){return B.data=!0,ae},get error(){return B.error=!0,ie},get isValidating(){return B.isValidating=!0,xe},get isLoading(){return B.isLoading=!0,_e}}};Ea.defineProperty(rg,"defaultValue",{value:Ef});const lD=ng(sD),uD=e=>bo(e?e(0,null):null)[0],Bd=Promise.resolve(),cD=e=>(t,r,n)=>{const o=g.useRef(!1),{cache:i,initialSize:a=1,revalidateAll:s=!1,persistSize:l=!1,revalidateFirstPage:u=!0,revalidateOnMount:f=!1,parallel:d=!1}=n,[,,,m]=rn.get(xf);let p;try{p=uD(t),p&&(p=O2+p)}catch{}const[y,x,R]=Wn(i,p),v=g.useCallback(()=>pe(y()._l)?a:y()._l,[i,p,a]);vf.useSyncExternalStore(g.useCallback(I=>p?R(p,()=>{I()}):()=>{},[i,p]),v,v);const b=g.useCallback(()=>{const I=y()._l;return pe(I)?a:I},[p,a]),E=g.useRef(b());Gr(()=>{if(!o.current){o.current=!0;return}p&&x({_l:l?E.current:b()})},[p,i]);const k=f&&!o.current,_=e(p,async I=>{const W=y()._i,D=y()._r;x({_r:rt});const G=[],j=b(),[Y]=Wn(i,I),B=Y().data,$=[];let M=null;for(let U=0;U<j;++U){const[P,z]=bo(t(U,d?null:M));if(!P)break;const[Q,J]=Wn(i,P);let q=Q().data;const ie=s||W||pe(q)||u&&!U&&!pe(B)||k||B&&!pe(B[U])&&!n.compare(B[U],q);if(r&&(typeof D=="function"?D(q,z):ie)){const Z=async()=>{if(!(P in m))q=await r(z);else{const ce=m[P];delete m[P],q=await ce}J({data:q,_k:z}),G[U]=q};d?$.push(Z):await Z()}else G[U]=q;d||(M=q)}return d&&await Promise.all($.map(U=>U())),x({_i:rt}),G},n),T=g.useCallback(function(I,W){const D=typeof W=="boolean"?{revalidate:W}:W||{},G=D.revalidate!==!1;return p?(G&&(pe(I)?x({_i:!0,_r:D.revalidate}):x({_i:!1,_r:D.revalidate})),arguments.length?_.mutate(I,{...D,revalidate:G}):_.mutate()):Bd},[p,i]),L=g.useCallback(I=>{if(!p)return Bd;const[,W]=Wn(i,p);let D;if(sr(I)?D=I(b()):typeof I=="number"&&(D=I),typeof D!="number")return Bd;W({_l:D}),E.current=D;const G=[],[j]=Wn(i,p);let Y=null;for(let B=0;B<D;++B){const[$]=bo(t(B,Y)),[M]=Wn(i,$),U=$?M().data:rt;if(pe(U))return T(j().data);G.push(U),Y=U}return T(G)},[p,i,T,b]);return{size:b(),setSize:L,mutate:T,get data(){return _.data},get error(){return _.error},get isValidating(){return _.isValidating},get isLoading(){return _.isLoading}}},fD=R2(lD,cD),y1=100,dD=(e,t=!1)=>{var d,m;const r=(p,y)=>{if(y&&y.length===0)return null;const x={per:y1,page:p+1,definition_group:e.definitionGroup,title:e.title,source:e.source};return`${Le.api.definitions.index()}?${ja(x)}`},n=g.useCallback(async p=>(await si(p)).definitions.map(x=>({id:x.id,definitionGroup:x.definition_group,title:x.title})),[]),{data:o,isLoading:i,size:a,setSize:s,isValidating:l}=fD(r,n,{keepPreviousData:t}),u=!!(((d=o==null?void 0:o[0])==null?void 0:d.length)===0||o&&((m=o==null?void 0:o[(o==null?void 0:o.length)-1])==null?void 0:m.length)<y1);return{definitions:(o??[]).flat(),isLoading:i,size:a,setSize:s,isValidating:l,isReachingEnd:u}},hD=({isOpen:e,onClickClose:t,searchDefinitionsOptions:r,setSearchDefinitionsOptions:n})=>{const[o,i]=g.useState(r),a=()=>{t(),i(r)},s=()=>{n(o),t()},l=g.useCallback(m=>{i(p=>({...p,definitionGroup:m.target.value}))},[i]),u=g.useCallback(m=>{i(p=>({...p,title:m.target.value}))},[i]),f=g.useCallback(m=>{i(p=>({...p,source:m.target.value}))},[i]),d=g.useCallback(m=>{i(p=>({...p,folding:m.target.checked}))},[i]);return N.jsx(o2,{title:"Configure Search Options",decorators:{closeButtonLabel:()=>"Close"},actionText:"Save",actionTheme:"primary",isOpen:e,onClickAction:s,onClickClose:a,onClickOverlay:a,width:"500px",children:N.jsx(pD,{children:N.jsx(Ze,{gap:1.5,children:N.jsxs(Ze,{gap:1.5,children:[N.jsx("p",{children:"Configure settings related to the display of definitions."}),N.jsxs(Ze,{gap:1.5,children:[N.jsx($o,{title:"Filtering definition group",helpMessage:"Refine the definition with a definition group",children:N.jsx(Ri,{name:"definitionGroup",type:"text",onChange:l,value:o.definitionGroup})}),N.jsx($o,{title:"Filtering title",helpMessage:"Refine the definition with a title",children:N.jsx(Ri,{name:"title",type:"text",onChange:u,value:o.title})}),N.jsx($o,{title:"Filtering source",helpMessage:"Refine the definition with a source",children:N.jsx(Ri,{name:"source",type:"text",onChange:f,value:o.source})}),N.jsx($o,{title:"Fold Definitions",helpMessage:"Folding the same definition_group",children:N.jsx(xa,{name:"folding",onChange:d,checked:o.folding})})]})]})})})})},pD=We(jt)`
|
355
|
+
`;var J6=Object.defineProperty,A6=(e,t,r)=>t in e?J6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bu=(e,t,r)=>(A6(e,typeof t!="symbol"?t+"":t,r),r),kp=new Map,wu=new WeakMap,m1=0,eD=void 0;function tD(e){return e?(wu.has(e)||(m1+=1,wu.set(e,m1.toString())),wu.get(e)):"0"}function rD(e){return Object.keys(e).sort().filter(t=>e[t]!==void 0).map(t=>`${t}_${t==="root"?tD(e.root):e[t]}`).toString()}function nD(e){const t=rD(e);let r=kp.get(t);if(!r){const n=new Map;let o;const i=new IntersectionObserver(a=>{a.forEach(s=>{var l;const u=s.isIntersecting&&o.some(f=>s.intersectionRatio>=f);e.trackVisibility&&typeof s.isVisible>"u"&&(s.isVisible=u),(l=n.get(s.target))==null||l.forEach(f=>{f(u,s)})})},e);o=i.thresholds||(Array.isArray(e.threshold)?e.threshold:[e.threshold||0]),r={id:t,observer:i,elements:n},kp.set(t,r)}return r}function oD(e,t,r={},n=eD){if(typeof window.IntersectionObserver>"u"&&n!==void 0){const l=e.getBoundingClientRect();return t(n,{isIntersecting:n,target:e,intersectionRatio:typeof r.threshold=="number"?r.threshold:0,time:0,boundingClientRect:l,intersectionRect:l,rootBounds:l}),()=>{}}const{id:o,observer:i,elements:a}=nD(r),s=a.get(e)||[];return a.has(e)||a.set(e,s),s.push(t),i.observe(e),function(){s.splice(s.indexOf(t),1),s.length===0&&(a.delete(e),i.unobserve(e)),a.size===0&&(i.disconnect(),kp.delete(o))}}function iD(e){return typeof e.children!="function"}var aD=class extends g.Component{constructor(e){super(e),bu(this,"node",null),bu(this,"_unobserveCb",null),bu(this,"handleNode",t=>{this.node&&(this.unobserve(),!t&&!this.props.triggerOnce&&!this.props.skip&&this.setState({inView:!!this.props.initialInView,entry:void 0})),this.node=t||null,this.observeNode()}),bu(this,"handleChange",(t,r)=>{t&&this.props.triggerOnce&&this.unobserve(),iD(this.props)||this.setState({inView:t,entry:r}),this.props.onChange&&this.props.onChange(t,r)}),this.state={inView:!!e.initialInView,entry:void 0}}componentDidMount(){this.unobserve(),this.observeNode()}componentDidUpdate(e){(e.rootMargin!==this.props.rootMargin||e.root!==this.props.root||e.threshold!==this.props.threshold||e.skip!==this.props.skip||e.trackVisibility!==this.props.trackVisibility||e.delay!==this.props.delay)&&(this.unobserve(),this.observeNode())}componentWillUnmount(){this.unobserve()}observeNode(){if(!this.node||this.props.skip)return;const{threshold:e,root:t,rootMargin:r,trackVisibility:n,delay:o,fallbackInView:i}=this.props;this._unobserveCb=oD(this.node,this.handleChange,{threshold:e,root:t,rootMargin:r,trackVisibility:n,delay:o},i)}unobserve(){this._unobserveCb&&(this._unobserveCb(),this._unobserveCb=null)}render(){const{children:e}=this.props;if(typeof e=="function"){const{inView:p,entry:y}=this.state;return e({inView:p,entry:y,ref:this.handleNode})}const{as:t,triggerOnce:r,threshold:n,root:o,rootMargin:i,onChange:a,skip:s,trackVisibility:l,delay:u,initialInView:f,fallbackInView:d,...m}=this.props;return g.createElement(t||"div",{ref:this.handleNode,...m},e)}};const g1=O.use||(e=>{if(e.status==="pending")throw e;if(e.status==="fulfilled")return e.value;throw e.status==="rejected"?e.reason:(e.status="pending",e.then(t=>{e.status="fulfilled",e.value=t},t=>{e.status="rejected",e.reason=t}),e)}),$d={dedupe:!0},sD=(e,t,r)=>{const{cache:n,compare:o,suspense:i,fallbackData:a,revalidateOnMount:s,revalidateIfStale:l,refreshInterval:u,refreshWhenHidden:f,refreshWhenOffline:d,keepPreviousData:m}=r,[p,y,x,R]=rn.get(n),[v,b]=bo(e),E=g.useRef(!1),k=g.useRef(!1),_=g.useRef(v),T=g.useRef(t),L=g.useRef(r),I=()=>L.current,W=()=>I().isVisible()&&I().isOnline(),[D,G,j,Y]=Wn(n,v),B=g.useRef({}).current,$=pe(a)?r.fallback[v]:a,M=(te,oe)=>{for(const ne in B){const fe=ne;if(fe==="data"){if(!o(te[fe],oe[fe])&&(!pe(te[fe])||!o(ae,oe[fe])))return!1}else if(oe[fe]!==te[fe])return!1}return!0},U=g.useMemo(()=>{const te=!v||!t?!1:pe(s)?I().isPaused()||i?!1:pe(l)?!0:l:s,oe=se=>{const Re=Mr(se);return delete Re._k,te?{isValidating:!0,isLoading:!0,...Re}:Re},ne=D(),fe=Y(),me=oe(ne),S=ne===fe?me:oe(fe);let he=me;return[()=>{const se=oe(D());return M(se,he)?(he.data=se.data,he.isLoading=se.isLoading,he.isValidating=se.isValidating,he.error=se.error,he):(he=se,se)},()=>S]},[n,v]),P=vf.useSyncExternalStore(g.useCallback(te=>j(v,(oe,ne)=>{M(ne,oe)||te()}),[n,v]),U[0],U[1]),z=!E.current,Q=p[v]&&p[v].length>0,J=P.data,q=pe(J)?$:J,ie=P.error,Z=g.useRef(q),ae=m?pe(J)?Z.current:J:q,ce=Q&&!pe(ie)?!1:z&&!pe(s)?s:I().isPaused()?!1:i?pe(q)?!1:l:pe(q)||l,ge=!!(v&&t&&z&&ce),xe=pe(P.isValidating)?ge:P.isValidating,_e=pe(P.isLoading)?ge:P.isLoading,le=g.useCallback(async te=>{const oe=T.current;if(!v||!oe||k.current||I().isPaused())return!1;let ne,fe,me=!0;const S=te||{},he=!x[v]||!S.dedupe,se=()=>$i?!k.current&&v===_.current&&E.current:v===_.current,Re={isValidating:!1,isLoading:!1},gt=()=>{G(Re)},Ae=()=>{const Te=x[v];Te&&Te[1]===fe&&delete x[v]},qe={isValidating:!0};pe(D().data)&&(qe.isLoading=!0);try{if(he&&(G(qe),r.loadingTimeout&&pe(D().data)&&setTimeout(()=>{me&&se()&&I().onLoadingSlow(v,r)},r.loadingTimeout),x[v]=[oe(b),Bi()]),[ne,fe]=x[v],ne=await ne,he&&setTimeout(Ae,r.dedupingInterval),!x[v]||x[v][1]!==fe)return he&&se()&&I().onDiscarded(v),!1;Re.error=rt;const Te=y[v];if(!pe(Te)&&(fe<=Te[0]||fe<=Te[1]||Te[1]===0))return gt(),he&&se()&&I().onDiscarded(v),!1;const Ne=D().data;Re.data=o(Ne,ne)?Ne:ne,he&&se()&&I().onSuccess(ne,v,r)}catch(Te){Ae();const Ne=I(),{shouldRetryOnError:yt}=Ne;Ne.isPaused()||(Re.error=Te,he&&se()&&(Ne.onError(Te,v,Ne),(yt===!0||sr(yt)&&yt(Te))&&(!I().revalidateOnFocus||!I().revalidateOnReconnect||W())&&Ne.onErrorRetry(Te,v,Ne,Rt=>{const Ve=p[v];Ve&&Ve[0]&&Ve[0](gr.ERROR_REVALIDATE_EVENT,Rt)},{retryCount:(S.retryCount||0)+1,dedupe:!0})))}return me=!1,gt(),!0},[v,n]),Ee=g.useCallback((...te)=>wf(n,_.current,...te),[]);if(Gr(()=>{T.current=t,L.current=r,pe(J)||(Z.current=J)}),Gr(()=>{if(!v)return;const te=le.bind(rt,$d);let oe=0;const fe=og(v,p,(me,S={})=>{if(me==gr.FOCUS_EVENT){const he=Date.now();I().revalidateOnFocus&&he>oe&&W()&&(oe=he+I().focusThrottleInterval,te())}else if(me==gr.RECONNECT_EVENT)I().revalidateOnReconnect&&W()&&te();else{if(me==gr.MUTATE_EVENT)return le();if(me==gr.ERROR_REVALIDATE_EVENT)return le(S)}});return k.current=!1,_.current=v,E.current=!0,G({_k:b}),ce&&(pe(q)||vo?te():tg(te)),()=>{k.current=!0,fe()}},[v]),Gr(()=>{let te;function oe(){const fe=sr(u)?u(D().data):u;fe&&te!==-1&&(te=setTimeout(ne,fe))}function ne(){!D().error&&(f||I().isVisible())&&(d||I().isOnline())?le($d).then(oe):oe()}return oe(),()=>{te&&(clearTimeout(te),te=-1)}},[u,f,d,v]),g.useDebugValue(ae),i&&pe(q)&&v){if(!$i&&vo)throw new Error("Fallback data is required when using suspense in SSR.");T.current=t,L.current=r,k.current=!1;const te=R[v];if(!pe(te)){const oe=Ee(te);g1(oe)}if(pe(ie)){const oe=le($d);pe(ae)||(oe.status="fulfilled",oe.value=!0),g1(oe)}else throw ie}return{mutate:Ee,get data(){return B.data=!0,ae},get error(){return B.error=!0,ie},get isValidating(){return B.isValidating=!0,xe},get isLoading(){return B.isLoading=!0,_e}}};Ea.defineProperty(rg,"defaultValue",{value:Ef});const lD=ng(sD),uD=e=>bo(e?e(0,null):null)[0],Bd=Promise.resolve(),cD=e=>(t,r,n)=>{const o=g.useRef(!1),{cache:i,initialSize:a=1,revalidateAll:s=!1,persistSize:l=!1,revalidateFirstPage:u=!0,revalidateOnMount:f=!1,parallel:d=!1}=n,[,,,m]=rn.get(xf);let p;try{p=uD(t),p&&(p=O2+p)}catch{}const[y,x,R]=Wn(i,p),v=g.useCallback(()=>pe(y()._l)?a:y()._l,[i,p,a]);vf.useSyncExternalStore(g.useCallback(I=>p?R(p,()=>{I()}):()=>{},[i,p]),v,v);const b=g.useCallback(()=>{const I=y()._l;return pe(I)?a:I},[p,a]),E=g.useRef(b());Gr(()=>{if(!o.current){o.current=!0;return}p&&x({_l:l?E.current:b()})},[p,i]);const k=f&&!o.current,_=e(p,async I=>{const W=y()._i,D=y()._r;x({_r:rt});const G=[],j=b(),[Y]=Wn(i,I),B=Y().data,$=[];let M=null;for(let U=0;U<j;++U){const[P,z]=bo(t(U,d?null:M));if(!P)break;const[Q,J]=Wn(i,P);let q=Q().data;const ie=s||W||pe(q)||u&&!U&&!pe(B)||k||B&&!pe(B[U])&&!n.compare(B[U],q);if(r&&(typeof D=="function"?D(q,z):ie)){const Z=async()=>{if(!(P in m))q=await r(z);else{const ce=m[P];delete m[P],q=await ce}J({data:q,_k:z}),G[U]=q};d?$.push(Z):await Z()}else G[U]=q;d||(M=q)}return d&&await Promise.all($.map(U=>U())),x({_i:rt}),G},n),T=g.useCallback(function(I,W){const D=typeof W=="boolean"?{revalidate:W}:W||{},G=D.revalidate!==!1;return p?(G&&(pe(I)?x({_i:!0,_r:D.revalidate}):x({_i:!1,_r:D.revalidate})),arguments.length?_.mutate(I,{...D,revalidate:G}):_.mutate()):Bd},[p,i]),L=g.useCallback(I=>{if(!p)return Bd;const[,W]=Wn(i,p);let D;if(sr(I)?D=I(b()):typeof I=="number"&&(D=I),typeof D!="number")return Bd;W({_l:D}),E.current=D;const G=[],[j]=Wn(i,p);let Y=null;for(let B=0;B<D;++B){const[$]=bo(t(B,Y)),[M]=Wn(i,$),U=$?M().data:rt;if(pe(U))return T(j().data);G.push(U),Y=U}return T(G)},[p,i,T,b]);return{size:b(),setSize:L,mutate:T,get data(){return _.data},get error(){return _.error},get isValidating(){return _.isValidating},get isLoading(){return _.isLoading}}},fD=R2(lD,cD),y1=100,dD=(e,t=!1)=>{var d,m;const r=(p,y)=>{if(y&&y.length===0)return null;const x={per:y1,page:p+1,definition_group:e.definitionGroup,title:e.title,source:e.source};return`${Le.api.definitions.index()}?${ja(x)}`},n=g.useCallback(async p=>(await si(p)).definitions.map(x=>({id:x.id,definitionGroup:x.definition_group,title:x.title,sourcesCount:x.sources_count})),[]),{data:o,isLoading:i,size:a,setSize:s,isValidating:l}=fD(r,n,{keepPreviousData:t}),u=!!(((d=o==null?void 0:o[0])==null?void 0:d.length)===0||o&&((m=o==null?void 0:o[(o==null?void 0:o.length)-1])==null?void 0:m.length)<y1);return{definitions:(o??[]).flat(),isLoading:i,size:a,setSize:s,isValidating:l,isReachingEnd:u}},hD=({isOpen:e,onClickClose:t,searchDefinitionsOptions:r,setSearchDefinitionsOptions:n})=>{const[o,i]=g.useState(r),a=()=>{t(),i(r)},s=()=>{n(o),t()},l=g.useCallback(m=>{i(p=>({...p,definitionGroup:m.target.value}))},[i]),u=g.useCallback(m=>{i(p=>({...p,title:m.target.value}))},[i]),f=g.useCallback(m=>{i(p=>({...p,source:m.target.value}))},[i]),d=g.useCallback(m=>{i(p=>({...p,folding:m.target.checked}))},[i]);return N.jsx(o2,{title:"Configure Search Options",decorators:{closeButtonLabel:()=>"Close"},actionText:"Save",actionTheme:"primary",isOpen:e,onClickAction:s,onClickClose:a,onClickOverlay:a,width:"500px",children:N.jsx(pD,{children:N.jsx(Ze,{gap:1.5,children:N.jsxs(Ze,{gap:1.5,children:[N.jsx("p",{children:"Configure settings related to the display of definitions."}),N.jsxs(Ze,{gap:1.5,children:[N.jsx($o,{title:"Filtering definition group",helpMessage:"Refine the definition with a definition group",children:N.jsx(Ri,{name:"definitionGroup",type:"text",onChange:l,value:o.definitionGroup})}),N.jsx($o,{title:"Filtering title",helpMessage:"Refine the definition with a title",children:N.jsx(Ri,{name:"title",type:"text",onChange:u,value:o.title})}),N.jsx($o,{title:"Filtering source",helpMessage:"Refine the definition with a source",children:N.jsx(Ri,{name:"source",type:"text",onChange:f,value:o.source})}),N.jsx($o,{title:"Fold Definitions",helpMessage:"Folding the same definition_group",children:N.jsx(xa,{name:"folding",onChange:d,checked:o.folding})})]})]})})})})},pD=We(jt)`
|
356
356
|
padding: ${ai.XS};
|
357
357
|
`;function mE(){const e=P2(gE.displayName||"SideNav");return g.useMemo(()=>({wrapper:e(),item:e("item"),itemTitle:e("itemTitle")}),[e])}const mD=g.forwardRef((e,t)=>{const{title:r,prefix:n,isSelected:o=!1,size:i,onClick:a}=e,s=mE(),l=a?f=>a(f):void 0,u=`${o?"selected":""} ${s.item}`;return N.jsx(gD,{ref:t,className:u,children:N.jsxs(yD,{className:i,onClick:l,children:[n&&N.jsx(vD,{children:n}),N.jsx("span",{className:s.itemTitle,children:r})]})})}),gD=We.li`
|
358
358
|
color: ${qt.TEXT_BLACK};
|
@@ -404,7 +404,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
404
404
|
background-color: ${qt.COLUMN};
|
405
405
|
list-style: none;
|
406
406
|
padding: 0;
|
407
|
-
`,wD=(e,t)=>e.reduce((r,n)=>{const o=t(n);return r[o]=r[o]??[],r[o].push(n),r},{}),xu="_____null_____",xD=g.forwardRef((e,t)=>{const{definitions:r,inView:n,loadNextPage:o,selectedDefinitionIds:i,setSelectedDefinitionIds:a,folding:s,isReachingEnd:l}=e;g.useEffect(()=>{n&&o()},[n,o]);const u=g.useMemo(()=>{const f=wD(r,m=>m.definitionGroup??xu),d=[];return Object.keys(f).forEach(m=>{const p=f[m];if(m!==xu){const y=p.map(({id:v})=>v),x=y.every(v=>i.includes(v)),R=v=>{v.preventDefault(),a(x?b=>b.filter(E=>!y.includes(E)):b=>[...new Set([...b,...y])])};d.push({key:`definition-group-${m}`,title:m,isSelected:x,onClick:R,prefix:N.jsx(xa,{checked:x,onClick:R})})}(!s||m===xu)&&p.forEach(y=>{const x=v=>{v.stopPropagation(),a(b=>b.includes(y.id)?b.filter(E=>E!==y.id):[...b,y.id])},R=i.includes(y.id);d.push({key:`definition-${y.id}`,title
|
407
|
+
`,wD=(e,t)=>e.reduce((r,n)=>{const o=t(n);return r[o]=r[o]??[],r[o].push(n),r},{}),xu="_____null_____",xD=g.forwardRef((e,t)=>{const{definitions:r,inView:n,loadNextPage:o,selectedDefinitionIds:i,setSelectedDefinitionIds:a,folding:s,isReachingEnd:l}=e;g.useEffect(()=>{n&&o()},[n,o]);const u=g.useMemo(()=>{const f=wD(r,m=>m.definitionGroup??xu),d=[];return Object.keys(f).forEach(m=>{const p=f[m];if(m!==xu){const y=p.map(({id:v})=>v),x=y.every(v=>i.includes(v)),R=v=>{v.preventDefault(),a(x?b=>b.filter(E=>!y.includes(E)):b=>[...new Set([...b,...y])])};d.push({key:`definition-group-${m}`,title:m,isSelected:x,onClick:R,prefix:N.jsx(xa,{checked:x,onClick:R})})}(!s||m===xu)&&p.forEach(y=>{const x=v=>{v.stopPropagation(),a(b=>b.includes(y.id)?b.filter(E=>E!==y.id):[...b,y.id])},R=i.includes(y.id);d.push({key:`definition-${y.id}`,title:`(${y.sourcesCount}) ${y.title}`,isSelected:R,onClick:x,prefix:N.jsxs(N.Fragment,{children:[m===xu?null:N.jsx(SD,{className:"side-nav-indent"}),N.jsx(xa,{checked:R,onClick:x})]})})})}),d.length>0&&(d[d.length-1].ref=t),l&&d.push({key:"definition-reaching-end",title:"--- Reached the end ---",isSelected:!1,onClick:()=>{}}),d},[r,i,t,a,s,l]);return N.jsx(ED,{size:"s",items:u})}),ED=We(gE)`
|
408
408
|
background-color: ${qt.WHITE};
|
409
409
|
text-wrap: nowrap;
|
410
410
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: diver_down
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.1.
|
4
|
+
version: 0.0.1.alpha6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- alpaca-tc
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-05-
|
11
|
+
date: 2024-05-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|