cjm-fasthtml-token-selector 0.0.1__tar.gz → 0.0.2__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.
Files changed (41) hide show
  1. {cjm_fasthtml_token_selector-0.0.1/cjm_fasthtml_token_selector.egg-info → cjm_fasthtml_token_selector-0.0.2}/PKG-INFO +12 -6
  2. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/README.md +11 -5
  3. cjm_fasthtml_token_selector-0.0.2/cjm_fasthtml_token_selector/__init__.py +1 -0
  4. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/js/core.py +19 -12
  5. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2/cjm_fasthtml_token_selector.egg-info}/PKG-INFO +12 -6
  6. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/settings.ini +15 -23
  7. cjm_fasthtml_token_selector-0.0.1/cjm_fasthtml_token_selector/__init__.py +0 -1
  8. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/LICENSE +0 -0
  9. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/MANIFEST.in +0 -0
  10. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/_modidx.py +0 -0
  11. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/components/__init__.py +0 -0
  12. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/components/inputs.py +0 -0
  13. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/components/tokens.py +0 -0
  14. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/core/__init__.py +0 -0
  15. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/core/config.py +0 -0
  16. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/core/constants.py +0 -0
  17. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/core/html_ids.py +0 -0
  18. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/core/models.py +0 -0
  19. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/helpers/__init__.py +0 -0
  20. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/helpers/tokenizer.py +0 -0
  21. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/js/__init__.py +0 -0
  22. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/js/display.py +0 -0
  23. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/js/navigation.py +0 -0
  24. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/js/repeat.py +0 -0
  25. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/keyboard/__init__.py +0 -0
  26. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector/keyboard/actions.py +0 -0
  27. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector.egg-info/SOURCES.txt +0 -0
  28. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector.egg-info/dependency_links.txt +0 -0
  29. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector.egg-info/entry_points.txt +0 -0
  30. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector.egg-info/not-zip-safe +0 -0
  31. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector.egg-info/requires.txt +0 -0
  32. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/cjm_fasthtml_token_selector.egg-info/top_level.txt +0 -0
  33. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/demos/__init__.py +0 -0
  34. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/demos/data.py +0 -0
  35. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/demos/gap.py +0 -0
  36. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/demos/shared.py +0 -0
  37. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/demos/span.py +0 -0
  38. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/demos/word.py +0 -0
  39. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/pyproject.toml +0 -0
  40. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/setup.cfg +0 -0
  41. {cjm_fasthtml_token_selector-0.0.1 → cjm_fasthtml_token_selector-0.0.2}/setup.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cjm-fasthtml-token-selector
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: A token-level interactive text selector for FastHTML with gap, word, and span selection modes, custom key repeat navigation, and HTMX state sync.
5
5
  Home-page: https://github.com/cj-mills/cjm-fasthtml-token-selector
6
6
  Author: Christian J. Mills
@@ -87,24 +87,24 @@ graph LR
87
87
 
88
88
  components_inputs --> core_models
89
89
  components_inputs --> core_html_ids
90
- components_tokens --> core_models
91
90
  components_tokens --> core_constants
91
+ components_tokens --> core_models
92
92
  components_tokens --> core_config
93
93
  components_tokens --> core_html_ids
94
94
  components_tokens --> helpers_tokenizer
95
95
  core_config --> core_constants
96
96
  helpers_tokenizer --> core_models
97
+ js_core --> js_display
97
98
  js_core --> core_models
98
- js_core --> js_repeat
99
99
  js_core --> core_html_ids
100
100
  js_core --> core_config
101
+ js_core --> js_repeat
101
102
  js_core --> js_navigation
102
- js_core --> js_display
103
103
  js_display --> core_constants
104
104
  js_display --> core_html_ids
105
105
  js_display --> core_config
106
- js_navigation --> core_html_ids
107
106
  js_navigation --> core_config
107
+ js_navigation --> core_html_ids
108
108
  js_repeat --> core_config
109
109
  keyboard_actions --> core_html_ids
110
110
  keyboard_actions --> core_config
@@ -335,7 +335,13 @@ def _generate_settle_handler_js(
335
335
  config:TokenSelectorConfig, # config for this instance
336
336
  ids:TokenSelectorHtmlIds, # HTML IDs
337
337
  ) -> str: # JS code fragment
338
- "Generate htmx:afterSettle handler for swap resilience."
338
+ """
339
+ Generate htmx:afterSettle handler for swap resilience.
340
+
341
+ Stores the handler reference globally and replaces it on
342
+ re-initialization to avoid stale closure references when
343
+ the IIFE re-runs after HTMX page transitions.
344
+ """
339
345
  ```
340
346
 
341
347
  ``` python
@@ -51,24 +51,24 @@ graph LR
51
51
 
52
52
  components_inputs --> core_models
53
53
  components_inputs --> core_html_ids
54
- components_tokens --> core_models
55
54
  components_tokens --> core_constants
55
+ components_tokens --> core_models
56
56
  components_tokens --> core_config
57
57
  components_tokens --> core_html_ids
58
58
  components_tokens --> helpers_tokenizer
59
59
  core_config --> core_constants
60
60
  helpers_tokenizer --> core_models
61
+ js_core --> js_display
61
62
  js_core --> core_models
62
- js_core --> js_repeat
63
63
  js_core --> core_html_ids
64
64
  js_core --> core_config
65
+ js_core --> js_repeat
65
66
  js_core --> js_navigation
66
- js_core --> js_display
67
67
  js_display --> core_constants
68
68
  js_display --> core_html_ids
69
69
  js_display --> core_config
70
- js_navigation --> core_html_ids
71
70
  js_navigation --> core_config
71
+ js_navigation --> core_html_ids
72
72
  js_repeat --> core_config
73
73
  keyboard_actions --> core_html_ids
74
74
  keyboard_actions --> core_config
@@ -299,7 +299,13 @@ def _generate_settle_handler_js(
299
299
  config:TokenSelectorConfig, # config for this instance
300
300
  ids:TokenSelectorHtmlIds, # HTML IDs
301
301
  ) -> str: # JS code fragment
302
- "Generate htmx:afterSettle handler for swap resilience."
302
+ """
303
+ Generate htmx:afterSettle handler for swap resilience.
304
+
305
+ Stores the handler reference globally and replaces it on
306
+ re-initialization to avoid stale closure references when
307
+ the IIFE re-runs after HTMX page transitions.
308
+ """
303
309
  ```
304
310
 
305
311
  ``` python
@@ -0,0 +1 @@
1
+ __version__ = "0.0.2"
@@ -124,21 +124,28 @@ def _generate_settle_handler_js(
124
124
  config:TokenSelectorConfig, # config for this instance
125
125
  ids:TokenSelectorHtmlIds, # HTML IDs
126
126
  ) -> str: # JS code fragment
127
- """Generate htmx:afterSettle handler for swap resilience."""
128
- guard = f"_tsMasterListener_{config.prefix}"
127
+ """Generate htmx:afterSettle handler for swap resilience.
128
+
129
+ Stores the handler reference globally and replaces it on
130
+ re-initialization to avoid stale closure references when
131
+ the IIFE re-runs after HTMX page transitions.
132
+ """
133
+ handler_key = f"_tsSettleHandler_{config.prefix}"
129
134
  return f"""
130
135
  // HTMX afterSettle: re-read word count and update display
131
- if (!window['{guard}']) {{
132
- window['{guard}'] = true;
133
- document.body.addEventListener('htmx:afterSettle', function() {{
134
- var grid = document.getElementById('{ids.token_grid}');
135
- if (grid && ns.active) {{
136
- ns.wordCount = parseInt(grid.dataset.wordCount) || 0;
137
- ns.updateDisplay();
138
- ns.updateInputs();
139
- }}
140
- }});
136
+ // Replace old handler to avoid stale closure references
137
+ if (window['{handler_key}']) {{
138
+ document.body.removeEventListener('htmx:afterSettle', window['{handler_key}']);
141
139
  }}
140
+ window['{handler_key}'] = function() {{
141
+ var grid = document.getElementById('{ids.token_grid}');
142
+ if (grid && ns.active) {{
143
+ ns.wordCount = parseInt(grid.dataset.wordCount) || 0;
144
+ ns.updateDisplay();
145
+ ns.updateInputs();
146
+ }}
147
+ }};
148
+ document.body.addEventListener('htmx:afterSettle', window['{handler_key}']);
142
149
  """
143
150
 
144
151
  # %% ../../nbs/js/core.ipynb #48c0e44b
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: cjm-fasthtml-token-selector
3
- Version: 0.0.1
3
+ Version: 0.0.2
4
4
  Summary: A token-level interactive text selector for FastHTML with gap, word, and span selection modes, custom key repeat navigation, and HTMX state sync.
5
5
  Home-page: https://github.com/cj-mills/cjm-fasthtml-token-selector
6
6
  Author: Christian J. Mills
@@ -87,24 +87,24 @@ graph LR
87
87
 
88
88
  components_inputs --> core_models
89
89
  components_inputs --> core_html_ids
90
- components_tokens --> core_models
91
90
  components_tokens --> core_constants
91
+ components_tokens --> core_models
92
92
  components_tokens --> core_config
93
93
  components_tokens --> core_html_ids
94
94
  components_tokens --> helpers_tokenizer
95
95
  core_config --> core_constants
96
96
  helpers_tokenizer --> core_models
97
+ js_core --> js_display
97
98
  js_core --> core_models
98
- js_core --> js_repeat
99
99
  js_core --> core_html_ids
100
100
  js_core --> core_config
101
+ js_core --> js_repeat
101
102
  js_core --> js_navigation
102
- js_core --> js_display
103
103
  js_display --> core_constants
104
104
  js_display --> core_html_ids
105
105
  js_display --> core_config
106
- js_navigation --> core_html_ids
107
106
  js_navigation --> core_config
107
+ js_navigation --> core_html_ids
108
108
  js_repeat --> core_config
109
109
  keyboard_actions --> core_html_ids
110
110
  keyboard_actions --> core_config
@@ -335,7 +335,13 @@ def _generate_settle_handler_js(
335
335
  config:TokenSelectorConfig, # config for this instance
336
336
  ids:TokenSelectorHtmlIds, # HTML IDs
337
337
  ) -> str: # JS code fragment
338
- "Generate htmx:afterSettle handler for swap resilience."
338
+ """
339
+ Generate htmx:afterSettle handler for swap resilience.
340
+
341
+ Stores the handler reference globally and replaces it on
342
+ re-initialization to avoid stale closure references when
343
+ the IIFE re-runs after HTMX page transitions.
344
+ """
339
345
  ```
340
346
 
341
347
  ``` python
@@ -1,16 +1,10 @@
1
1
  [DEFAULT]
2
- # All sections below are required unless otherwise specified.
3
- # See https://github.com/AnswerDotAI/nbdev/blob/main/settings.ini for examples.
4
-
5
- ### Python library ###
6
2
  repo = cjm-fasthtml-token-selector
7
- lib_name = %(repo)s
8
- version = 0.0.1
3
+ lib_name = cjm-fasthtml-token-selector
4
+ version = 0.0.2
9
5
  min_python = 3.12
10
6
  license = apache2
11
7
  black_formatting = False
12
-
13
- ### nbdev ###
14
8
  doc_path = _docs
15
9
  lib_path = cjm_fasthtml_token_selector
16
10
  nbs_path = nbs
@@ -18,29 +12,27 @@ recursive = True
18
12
  tst_flags = notest
19
13
  put_version_in_init = True
20
14
  update_pyproject = True
21
-
22
- ### Docs ###
23
15
  branch = main
24
16
  custom_sidebar = False
25
- doc_host = https://%(user)s.github.io
26
- doc_baseurl = /%(repo)s
27
- git_url = https://github.com/%(user)s/%(repo)s
28
- title = %(lib_name)s
29
-
30
- ### PyPI ###
17
+ doc_host = https://cj-mills.github.io
18
+ doc_baseurl = /cjm-fasthtml-token-selector
19
+ git_url = https://github.com/cj-mills/cjm-fasthtml-token-selector
20
+ title = cjm-fasthtml-token-selector
31
21
  audience = Developers
32
22
  author = Christian J. Mills
33
23
  author_email = 9126128+cj-mills@users.noreply.github.com
34
- copyright = 2026 onwards, %(author)s
24
+ copyright = 2026 onwards, Christian J. Mills
35
25
  description = A token-level interactive text selector for FastHTML with gap, word, and span selection modes, custom key repeat navigation, and HTMX state sync.
36
26
  keywords = nbdev jupyter notebook python
37
27
  language = English
38
28
  status = 3
39
29
  user = cj-mills
40
-
41
- ### Optional ###
42
30
  requirements = python-fasthtml cjm-fasthtml-tailwind cjm-fasthtml-daisyui cjm-fasthtml-keyboard-navigation
43
- # dev_requirements =
44
- # console_scripts =
45
- # conda_user =
46
- # package_data =
31
+ readme_nb = index.ipynb
32
+ allowed_metadata_keys =
33
+ allowed_cell_metadata_keys =
34
+ jupyter_hooks = False
35
+ clean_ids = True
36
+ clear_all = False
37
+ skip_procs =
38
+
@@ -1 +0,0 @@
1
- __version__ = "0.0.1"