@barefootjs/shared 0.5.0 → 0.5.2

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/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- export { BF_SCOPE, BF_SLOT, BF_HOST, BF_AT, BF_ROOT, BF_PROPS, BF_COND, BF_ITEM, BF_PORTAL_OWNER, BF_PORTAL_ID, BF_PORTAL_PLACEHOLDER, BF_PARENT_OWNED_PREFIX, BF_SCOPE_COMMENT_PREFIX, BF_LOOP_START, BF_LOOP_END, BF_LOOP_ITEM, loopStartMarker, loopEndMarker, BF_KEY, BF_KEY_PREFIX, BF_PLACEHOLDER, BF_ASYNC, BF_ASYNC_RESOLVE, BF_PARENT_SCOPE_PLACEHOLDER, } from './markers';
1
+ export { BF_SCOPE, BF_SLOT, BF_HOST, BF_AT, BF_ROOT, BF_PROPS, BF_COND, BF_ITEM, BF_PORTAL_OWNER, BF_PORTAL_ID, BF_PORTAL_PLACEHOLDER, BF_PARENT_OWNED_PREFIX, BF_SCOPE_COMMENT_PREFIX, BF_LOOP_START, BF_LOOP_END, BF_LOOP_ITEM, loopItemMarker, loopStartMarker, loopEndMarker, BF_KEY, BF_KEY_PREFIX, BF_PLACEHOLDER, BF_ASYNC, BF_ASYNC_RESOLVE, BF_PARENT_SCOPE_PLACEHOLDER, } from './markers';
2
2
  export { classifyDOMProp, toHTMLAttrName, toHTMLAttrNameRuntime, isBooleanAttr, isEventProp, BOOLEAN_ATTRS, } from './dom-prop';
3
3
  export type { DOMPropKind, DOMPropClassification } from './dom-prop';
package/dist/index.js CHANGED
@@ -15,6 +15,9 @@ var BF_SCOPE_COMMENT_PREFIX = "bf-scope:";
15
15
  var BF_LOOP_START = "bf-loop";
16
16
  var BF_LOOP_END = "bf-/loop";
17
17
  var BF_LOOP_ITEM = "bf-loop-i";
18
+ function loopItemMarker(key) {
19
+ return `${BF_LOOP_ITEM}:${key}`;
20
+ }
18
21
  function loopStartMarker(markerId) {
19
22
  return `${BF_LOOP_START}:${markerId}`;
20
23
  }
@@ -194,6 +197,7 @@ export {
194
197
  toHTMLAttrNameRuntime,
195
198
  toHTMLAttrName,
196
199
  loopStartMarker,
200
+ loopItemMarker,
197
201
  loopEndMarker,
198
202
  isEventProp,
199
203
  isBooleanAttr,
package/dist/markers.d.ts CHANGED
@@ -85,6 +85,16 @@ export declare const BF_LOOP_END = "bf-/loop";
85
85
  * nodes (#1212).
86
86
  */
87
87
  export declare const BF_LOOP_ITEM = "bf-loop-i";
88
+ /**
89
+ * Build the per-item anchor comment value for a loop item: `bf-loop-i:<key>`.
90
+ *
91
+ * The key is embedded in the comment value (comments cannot carry
92
+ * attributes) so an item's identity survives SSR → hydration and so a
93
+ * range-scoped `insert()` can anchor a whole-item conditional to it
94
+ * without a wrapper element. An item's range runs from this anchor until
95
+ * the next `bf-loop-i:*` anchor or the loop end marker.
96
+ */
97
+ export declare function loopItemMarker(key: string): string;
88
98
  /** Build the start-marker comment value for a loop. */
89
99
  export declare function loopStartMarker(markerId: string): string;
90
100
  /** Build the end-marker comment value for a loop. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barefootjs/shared",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Shared constants for BarefootJS compiler and runtime",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
package/src/index.ts CHANGED
@@ -15,6 +15,7 @@ export {
15
15
  BF_LOOP_START,
16
16
  BF_LOOP_END,
17
17
  BF_LOOP_ITEM,
18
+ loopItemMarker,
18
19
  loopStartMarker,
19
20
  loopEndMarker,
20
21
  BF_KEY,
package/src/markers.ts CHANGED
@@ -122,6 +122,19 @@ export const BF_LOOP_END = 'bf-/loop'
122
122
  */
123
123
  export const BF_LOOP_ITEM = 'bf-loop-i'
124
124
 
125
+ /**
126
+ * Build the per-item anchor comment value for a loop item: `bf-loop-i:<key>`.
127
+ *
128
+ * The key is embedded in the comment value (comments cannot carry
129
+ * attributes) so an item's identity survives SSR → hydration and so a
130
+ * range-scoped `insert()` can anchor a whole-item conditional to it
131
+ * without a wrapper element. An item's range runs from this anchor until
132
+ * the next `bf-loop-i:*` anchor or the loop end marker.
133
+ */
134
+ export function loopItemMarker(key: string): string {
135
+ return `${BF_LOOP_ITEM}:${key}`
136
+ }
137
+
125
138
  /** Build the start-marker comment value for a loop. */
126
139
  export function loopStartMarker(markerId: string): string {
127
140
  return `${BF_LOOP_START}:${markerId}`