nucli 0.3.0__tar.gz → 0.4.0__tar.gz

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,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: nucli
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: The `nu` command line: doctor, demos, telemetry. Ships alongside the nucore kernel and the nustd fabrics.
5
5
  Project-URL: Repository, https://github.com/nustackdev/nu
6
6
  Author-email: Gor Arakelyan <gorarkln@gmail.com>
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Programming Language :: Python :: 3.13
17
17
  Requires-Python: >=3.10
18
18
  Requires-Dist: click>=8.0
19
- Requires-Dist: nustd>=0.3.0
19
+ Requires-Dist: nustd>=0.4.0
20
20
  Requires-Dist: rich-click>=1.6
21
21
  Requires-Dist: rich>=10.7
22
22
  Description-Content-Type: text/markdown
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "nucli"
7
- version = "0.3.0"
7
+ version = "0.4.0"
8
8
  description = "The `nu` command line: doctor, demos, telemetry. Ships alongside the nucore kernel and the nustd fabrics."
9
9
  readme = "README.md"
10
10
  license = "Apache-2.0"
@@ -15,7 +15,7 @@ requires-python = ">=3.10"
15
15
  # than the bare kernel because the packaged demos (`nu demo movies`) run on
16
16
  # `nu.ui` and `nu.kv` at runtime.
17
17
  dependencies = [
18
- "nustd>=0.3.0",
18
+ "nustd>=0.4.0",
19
19
  "click>=8.0",
20
20
  "rich>=10.7",
21
21
  "rich-click>=1.6",
@@ -62,7 +62,7 @@ class Dashboard(nu.ui.Page):
62
62
  class App(nu.ui.Index):
63
63
  """UI index with one page."""
64
64
 
65
- pages = nu.ui.Pages({"/": Dashboard})
65
+ home = Dashboard.slot("/")
66
66
 
67
67
 
68
68
  app = nu.With(
@@ -71,7 +71,7 @@ app = nu.With(
71
71
  nu.kv.auto_flow_atomic(
72
72
  nu.ReactForever(
73
73
  Counter.value.on_change(),
74
- Dashboard.count.set_value(nu.str(Counter.value)),
74
+ App.home.count.set_value(nu.str(Counter.value)),
75
75
  ),
76
76
  ),
77
77
  ),
@@ -225,7 +225,9 @@ class MovieDetail(nu.ui.Page):
225
225
  class App(nu.ui.Index):
226
226
  title: nu.ui.TitleRef
227
227
  nav: nu.ui.NavRef
228
- pages = nu.ui.Pages({"/": Movies, "/detail": MovieDetail, "/about": About})
228
+ movies = Movies.slot("/")
229
+ detail = MovieDetail.slot("/detail")
230
+ about = About.slot("/about")
229
231
 
230
232
 
231
233
  # ---- State ------------------------------------------------------------------
@@ -310,9 +312,9 @@ def _rows_form() -> nu.Nu:
310
312
 
311
313
  def _rows_filtered() -> nu.Nu:
312
314
  """Same shape as _rows_form, but honors the current FilterRow inputs."""
313
- min_r = nu.Float(FilterRow.min_rating.input)
314
- genre = nu.Str(FilterRow.genre.input)
315
- watched_only = nu.Bool(FilterRow.watched_only.input)
315
+ min_r = nu.Float(App.movies.filters.body.min_rating.input)
316
+ genre = nu.Str(App.movies.filters.body.genre.input)
317
+ watched_only = nu.Bool(App.movies.filters.body.watched_only.input)
316
318
  predicate = nu.And(
317
319
  nu.Ge(nu.DictAttrRef("r")["rating"], min_r),
318
320
  nu.Or(nu.Eq(genre, ""), nu.Eq(nu.DictAttrRef("r")["genre"], genre)),
@@ -345,61 +347,61 @@ init = nu.kv.Transaction(
345
347
 
346
348
 
347
349
  hydrate = nu.kv.Snapshot(
348
- Movies.stats.body.total.set_value(nu.str(State.total))
349
- | Movies.stats.body.watched.set_value(nu.str(State.watched))
350
- | Movies.stats.body.unseen.set_value(nu.str(State.total - State.watched))
351
- | Movies.stats.body.latest.set(State.latest_title)
352
- | Movies.shelf.body.table.set(_rows_form())
350
+ App.movies.stats.body.total.set_value(nu.str(State.total))
351
+ | App.movies.stats.body.watched.set_value(nu.str(State.watched))
352
+ | App.movies.stats.body.unseen.set_value(nu.str(State.total - State.watched))
353
+ | App.movies.stats.body.latest.set(State.latest_title)
354
+ | App.movies.shelf.body.table.set(_rows_form())
353
355
  )
354
356
 
355
357
 
356
358
  on_add = nu.ReactForever(
357
- AddMovieForm.submit.clicked(),
359
+ App.movies.form.submit.on_click(),
358
360
  nu.kv.Transaction(
359
361
  State.movies.append(
360
362
  nu.Dict.of(
361
- title=nu.Str(AddMovieForm.details.title.input),
362
- year=nu.Int(AddMovieForm.details.year.input),
363
- genre=nu.Str(AddMovieForm.details.genre.input),
364
- rating=nu.Float(AddMovieForm.score.rating.input),
365
- watched=nu.Bool(AddMovieForm.score.watched.input),
366
- notes=nu.Str(AddMovieForm.score.notes.input),
363
+ title=nu.Str(App.movies.form.details.title.input),
364
+ year=nu.Int(App.movies.form.details.year.input),
365
+ genre=nu.Str(App.movies.form.details.genre.input),
366
+ rating=nu.Float(App.movies.form.score.rating.input),
367
+ watched=nu.Bool(App.movies.form.score.watched.input),
368
+ notes=nu.Str(App.movies.form.score.notes.input),
367
369
  ),
368
370
  )
369
371
  | State.total.set(State.total + 1)
370
372
  | State.watched.set(
371
- State.watched + nu.If(nu.Bool(AddMovieForm.score.watched.input), 1, 0),
373
+ State.watched + nu.If(nu.Bool(App.movies.form.score.watched.input), 1, 0),
372
374
  )
373
- | State.latest_title.set(nu.Str(AddMovieForm.details.title.input)),
375
+ | State.latest_title.set(nu.Str(App.movies.form.details.title.input)),
374
376
  )
375
377
  >> nu.kv.Snapshot(
376
- Movies.shelf.body.table.set(_rows_form())
377
- | Movies.stats.body.total.set_value(nu.str(State.total))
378
- | Movies.stats.body.watched.set_value(nu.str(State.watched))
379
- | Movies.stats.body.unseen.set_value(nu.str(State.total - State.watched))
380
- | Movies.stats.body.latest.set(State.latest_title)
381
- | Movies.form.feedback.set(
378
+ App.movies.shelf.body.table.set(_rows_form())
379
+ | App.movies.stats.body.total.set_value(nu.str(State.total))
380
+ | App.movies.stats.body.watched.set_value(nu.str(State.watched))
381
+ | App.movies.stats.body.unseen.set_value(nu.str(State.total - State.watched))
382
+ | App.movies.stats.body.latest.set(State.latest_title)
383
+ | App.movies.form.feedback.set(
382
384
  title="Logged",
383
- body="Added " + nu.Str(AddMovieForm.details.title.input),
385
+ body="Added " + nu.Str(App.movies.form.details.title.input),
384
386
  )
385
387
  ),
386
388
  )
387
389
 
388
390
 
389
391
  on_row_click = nu.ReactForever(
390
- Movies.shelf.body.table.row_clicked(),
392
+ App.movies.shelf.body.table.on_row_click(),
391
393
  nu.IfDo(
392
394
  nu.Contains(nu.DictAttrRef("row_click"), "row_index"),
393
395
  nu.kv.Transaction(State.selected.set(nu.DictAttrRef("row_click")["row_index"]))
394
396
  >> nu.kv.Snapshot(
395
- MovieDetail.heading.set(State.movies[State.selected].title)
396
- | MovieDetail.meta.meta.year.set_value(nu.str(State.movies[State.selected].year))
397
- | MovieDetail.meta.meta.genre.set_value(State.movies[State.selected].genre)
398
- | MovieDetail.meta.meta.rating.set_value(nu.str(State.movies[State.selected].rating))
399
- | MovieDetail.meta.meta.watched.set(
397
+ App.detail.heading.set(State.movies[State.selected].title)
398
+ | App.detail.meta.meta.year.set_value(nu.str(State.movies[State.selected].year))
399
+ | App.detail.meta.meta.genre.set_value(State.movies[State.selected].genre)
400
+ | App.detail.meta.meta.rating.set_value(nu.str(State.movies[State.selected].rating))
401
+ | App.detail.meta.meta.watched.set(
400
402
  label=nu.If(State.movies[State.selected].watched, "Watched", "Unseen"),
401
403
  )
402
- | MovieDetail.notes.body.set(State.movies[State.selected].notes)
404
+ | App.detail.notes.body.set(State.movies[State.selected].notes)
403
405
  )
404
406
  >> App.nav.set("/detail"),
405
407
  ),
@@ -408,41 +410,41 @@ on_row_click = nu.ReactForever(
408
410
 
409
411
 
410
412
  on_delete = nu.ReactForever(
411
- MovieDetail.actions.remove.clicked(),
413
+ App.detail.actions.remove.on_click(),
412
414
  nu.kv.Transaction(
413
415
  State.movies.del_at(State.selected) >> State.total.set(nu.Len(State.movies)),
414
416
  )
415
417
  >> nu.kv.Snapshot(
416
- Movies.shelf.body.table.set(_rows_form())
417
- | Movies.stats.body.total.set_value(nu.str(State.total))
418
- | Movies.stats.body.unseen.set_value(nu.str(State.total - State.watched))
418
+ App.movies.shelf.body.table.set(_rows_form())
419
+ | App.movies.stats.body.total.set_value(nu.str(State.total))
420
+ | App.movies.stats.body.unseen.set_value(nu.str(State.total - State.watched))
419
421
  )
420
422
  >> App.nav.set("/"),
421
423
  )
422
424
 
423
425
 
424
- on_back = nu.ReactForever(MovieDetail.actions.back.clicked(), App.nav.set("/"))
426
+ on_back = nu.ReactForever(App.detail.actions.back.on_click(), App.nav.set("/"))
425
427
 
426
428
 
427
- on_about_open = nu.ReactForever(Movies.topbar.about.clicked(), App.nav.set("/about"))
429
+ on_about_open = nu.ReactForever(App.movies.topbar.about.on_click(), App.nav.set("/about"))
428
430
 
429
431
 
430
- on_about_back = nu.ReactForever(About.actions.back.clicked(), App.nav.set("/"))
432
+ on_about_back = nu.ReactForever(App.about.actions.back.on_click(), App.nav.set("/"))
431
433
 
432
434
 
433
435
  on_filter_apply = nu.ReactForever(
434
- FilterRow.apply.clicked(),
435
- nu.kv.Snapshot(Movies.shelf.body.table.set(_rows_filtered())),
436
+ App.movies.filters.body.apply.on_click(),
437
+ nu.kv.Snapshot(App.movies.shelf.body.table.set(_rows_filtered())),
436
438
  )
437
439
 
438
440
 
439
441
  on_filter_clear = nu.ReactForever(
440
- FilterRow.clear.clicked(),
442
+ App.movies.filters.body.clear.on_click(),
441
443
  nu.kv.Snapshot(
442
- FilterRow.min_rating.input.set(1.0)
443
- | FilterRow.genre.input.set("")
444
- | FilterRow.watched_only.input.set(False)
445
- | Movies.shelf.body.table.set(_rows_form())
444
+ App.movies.filters.body.min_rating.input.set(1.0)
445
+ | App.movies.filters.body.genre.input.set("")
446
+ | App.movies.filters.body.watched_only.input.set(False)
447
+ | App.movies.shelf.body.table.set(_rows_form())
446
448
  ),
447
449
  )
448
450
 
@@ -63,13 +63,13 @@ class Dashboard(nu.ui.Page):
63
63
  class App(nu.ui.Index):
64
64
  """UI index with one page."""
65
65
 
66
- pages = nu.ui.Pages({"/": Dashboard})
66
+ home = Dashboard.slot("/")
67
67
 
68
68
 
69
69
  # reactive wire: repaint the chart on every write to `nums`
70
70
  ui = nu.ReactForever(
71
71
  State.nums.on_change(),
72
- Dashboard.chart.set_points(
72
+ App.home.chart.set_points(
73
73
  nu.Collect(nu.Sorted(nu.Iter(State.nums.sample(200, 0, State.cursor)))),
74
74
  ),
75
75
  )
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes