ripple 0.2.64 → 0.2.65

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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Ripple is an elegant TypeScript UI framework",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.2.64",
6
+ "version": "0.2.65",
7
7
  "type": "module",
8
8
  "module": "src/runtime/index.js",
9
9
  "main": "src/runtime/index.js",
@@ -259,11 +259,12 @@ const visitors = {
259
259
  context.state.metadata.tracking = true;
260
260
  }
261
261
 
262
- if (!is_inside_component(context, true) || is_inside_call_expression(context)) {
263
- return context.next();
264
- }
265
-
266
- if (is_value_static(node)) {
262
+ if (
263
+ context.state.to_ts ||
264
+ !is_inside_component(context, true) ||
265
+ is_inside_call_expression(context) ||
266
+ is_value_static(node)
267
+ ) {
267
268
  return context.next();
268
269
  }
269
270
 
@@ -2,6 +2,11 @@ import { TEMPLATE_FRAGMENT, TEMPLATE_USE_IMPORT_NODE } from '../../../constants.
2
2
  import { first_child, is_firefox } from './operations.js';
3
3
  import { active_block } from './runtime.js';
4
4
 
5
+ /**
6
+ * Assigns start and end nodes to the active block's state.
7
+ * @param {Node} start - The start node.
8
+ * @param {Node} end - The end node.
9
+ */
5
10
  export function assign_nodes(start, end) {
6
11
  var block = /** @type {Effect} */ (active_block);
7
12
  if (block.s === null) {
@@ -12,12 +17,23 @@ export function assign_nodes(start, end) {
12
17
  }
13
18
  }
14
19
 
20
+ /**
21
+ * Creates a DocumentFragment from an HTML string.
22
+ * @param {string} html - The HTML string.
23
+ * @returns {DocumentFragment}
24
+ */
15
25
  function create_fragment_from_html(html) {
16
26
  var elem = document.createElement('template');
17
27
  elem.innerHTML = html;
18
28
  return elem.content;
19
29
  }
20
30
 
31
+ /**
32
+ * Creates a template node or fragment from content and flags.
33
+ * @param {string} content - The template content.
34
+ * @param {number} flags - Flags for template type.
35
+ * @returns {Node}
36
+ */
21
37
  export function template(content, flags) {
22
38
  var is_fragment = (flags & TEMPLATE_FRAGMENT) !== 0;
23
39
  var use_import_node = (flags & TEMPLATE_USE_IMPORT_NODE) !== 0;
@@ -46,6 +62,11 @@ export function template(content, flags) {
46
62
  };
47
63
  }
48
64
 
65
+ /**
66
+ * Appends a DOM node before the anchor node.
67
+ * @param {Node} anchor - The anchor node.
68
+ * @param {Node} dom - The DOM node to append.
69
+ */
49
70
  export function append(anchor, dom) {
50
71
  anchor.before(/** @type {Node} */ (dom));
51
72
  }
@@ -24,6 +24,11 @@ export function is_positive_integer(value) {
24
24
  return Number.isInteger(value) && /**@type {number} */ (value) >= 0;
25
25
  }
26
26
 
27
+ /**
28
+ * Checks if an object is a tracked object (has a numeric 'f' property).
29
+ * @param {object} v - The object to check.
30
+ * @returns {boolean}
31
+ */
27
32
  export function is_tracked_object(v) {
28
33
  return typeof v === 'object' && v !== null && typeof v.f === 'number';
29
34
  }
@@ -34,6 +34,11 @@ export function is_delegated(event_name) {
34
34
  return DELEGATED_EVENTS.includes(event_name);
35
35
  }
36
36
 
37
+ /**
38
+ * Determines if an attribute is an event attribute (e.g., 'onClick').
39
+ * @param {string} attr - The attribute name.
40
+ * @returns {boolean}
41
+ */
37
42
  export function is_event_attribute(attr) {
38
43
  return attr.startsWith('on') && attr.length > 2 && attr[2] === attr[2].toUpperCase();
39
44
  }
@@ -62,6 +67,11 @@ export function get_attribute_event_name(event_name) {
62
67
 
63
68
  const PASSIVE_EVENTS = ['touchstart', 'touchmove'];
64
69
 
70
+ /**
71
+ * Checks if an event is passive (e.g., 'touchstart', 'touchmove').
72
+ * @param {string} name - The event name.
73
+ * @returns {boolean}
74
+ */
65
75
  export function is_passive_event(name) {
66
76
  return PASSIVE_EVENTS.includes(name);
67
77
  }