@marko/runtime-tags 0.1.24 → 0.2.0

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.
@@ -32,6 +32,7 @@ export declare enum AccessorChar {
32
32
  LifecycleAbortController = "-",
33
33
  DynamicPlaceholderLastChild = "-",
34
34
  TagVariable = "/",
35
+ TagVariableChange = "@",
35
36
  ConditionalScope = "!",
36
37
  ConditionalRenderer = "(",
37
38
  LoopScopeArray = "!",
package/dist/debug/dom.js CHANGED
@@ -78,9 +78,11 @@ __export(dom_exports, {
78
78
  resetAbortSignal: () => resetAbortSignal,
79
79
  run: () => run,
80
80
  setTagVar: () => setTagVar,
81
+ setTagVarChange: () => setTagVarChange,
81
82
  state: () => state,
82
83
  styleAttr: () => styleAttr,
83
84
  tagVarSignal: () => tagVarSignal,
85
+ tagVarSignalChange: () => tagVarSignalChange,
84
86
  value: () => value
85
87
  });
86
88
  module.exports = __toCommonJS(dom_exports);
@@ -132,14 +134,15 @@ function forTo(to, from, step, cb) {
132
134
  }
133
135
 
134
136
  // src/dom/schedule.ts
135
- var task;
137
+ var runTask;
136
138
  var port2 = /* @__PURE__ */ (() => {
137
139
  const { port1, port2: port22 } = new MessageChannel();
138
140
  port1.onmessage = () => {
139
141
  isScheduled = false;
140
142
  if (true) {
141
- task.run(run);
142
- task = void 0;
143
+ const run2 = runTask;
144
+ runTask = void 0;
145
+ run2();
143
146
  } else {
144
147
  run();
145
148
  }
@@ -150,11 +153,12 @@ var isScheduled;
150
153
  function schedule() {
151
154
  if (!isScheduled) {
152
155
  if (true) {
153
- task = console.createTask?.("queue") || {
154
- run(fn) {
155
- fn();
156
- }
157
- };
156
+ if (console.createTask) {
157
+ const task = console.createTask("queue");
158
+ runTask = () => task.run(run);
159
+ } else {
160
+ runTask = run;
161
+ }
158
162
  }
159
163
  isScheduled = true;
160
164
  queueMicrotask(flushAndWaitFrame);
@@ -162,7 +166,7 @@ function schedule() {
162
166
  }
163
167
  function flushAndWaitFrame() {
164
168
  if (true) {
165
- task.run(run);
169
+ runTask();
166
170
  } else {
167
171
  run();
168
172
  }
@@ -604,6 +608,10 @@ function setTagVar(scope, childAccessor, tagVarSignal2) {
604
608
  scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
605
609
  }
606
610
  var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
611
+ function setTagVarChange(scope, changeHandler) {
612
+ scope["@" /* TagVariableChange */] = changeHandler;
613
+ }
614
+ var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
607
615
  var renderBodyClosures = (renderBody, childScope, op) => {
608
616
  const signals = renderBody?.___closureSignals;
609
617
  if (signals) {
@@ -45,14 +45,15 @@ function forTo(to, from, step, cb) {
45
45
  }
46
46
 
47
47
  // src/dom/schedule.ts
48
- var task;
48
+ var runTask;
49
49
  var port2 = /* @__PURE__ */ (() => {
50
50
  const { port1, port2: port22 } = new MessageChannel();
51
51
  port1.onmessage = () => {
52
52
  isScheduled = false;
53
53
  if (true) {
54
- task.run(run);
55
- task = void 0;
54
+ const run2 = runTask;
55
+ runTask = void 0;
56
+ run2();
56
57
  } else {
57
58
  run();
58
59
  }
@@ -63,11 +64,12 @@ var isScheduled;
63
64
  function schedule() {
64
65
  if (!isScheduled) {
65
66
  if (true) {
66
- task = console.createTask?.("queue") || {
67
- run(fn) {
68
- fn();
69
- }
70
- };
67
+ if (console.createTask) {
68
+ const task = console.createTask("queue");
69
+ runTask = () => task.run(run);
70
+ } else {
71
+ runTask = run;
72
+ }
71
73
  }
72
74
  isScheduled = true;
73
75
  queueMicrotask(flushAndWaitFrame);
@@ -75,7 +77,7 @@ function schedule() {
75
77
  }
76
78
  function flushAndWaitFrame() {
77
79
  if (true) {
78
- task.run(run);
80
+ runTask();
79
81
  } else {
80
82
  run();
81
83
  }
@@ -517,6 +519,10 @@ function setTagVar(scope, childAccessor, tagVarSignal2) {
517
519
  scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
518
520
  }
519
521
  var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
522
+ function setTagVarChange(scope, changeHandler) {
523
+ scope["@" /* TagVariableChange */] = changeHandler;
524
+ }
525
+ var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2);
520
526
  var renderBodyClosures = (renderBody, childScope, op) => {
521
527
  const signals = renderBody?.___closureSignals;
522
528
  if (signals) {
@@ -2061,8 +2067,10 @@ export {
2061
2067
  resetAbortSignal,
2062
2068
  run,
2063
2069
  setTagVar,
2070
+ setTagVarChange,
2064
2071
  state,
2065
2072
  styleAttr,
2066
2073
  tagVarSignal,
2074
+ tagVarSignalChange,
2067
2075
  value
2068
2076
  };
@@ -29,6 +29,8 @@ export declare function childClosures(closureSignals: IntersectionSignal[], chil
29
29
  export declare function dynamicSubscribers(valueAccessor: Accessor): (scope: Scope, op: SignalOp) => void;
30
30
  export declare function setTagVar(scope: Scope, childAccessor: Accessor, tagVarSignal: ValueSignal): void;
31
31
  export declare const tagVarSignal: (scope: Scope, valueOrOp: unknown | SignalOp) => any;
32
+ export declare function setTagVarChange(scope: Scope, changeHandler: (value: unknown) => void): void;
33
+ export declare const tagVarSignalChange: (scope: Scope, value: unknown) => any;
32
34
  export declare const renderBodyClosures: (renderBody: Renderer | string | undefined, childScope: Scope, op: SignalOp) => void;
33
35
  export declare const inMany: (scopes: Scope[], op: SignalOp, signal: IntersectionSignal) => void;
34
36
  export declare function nextTagId({ $global }: Scope): string;
package/dist/dom.d.ts CHANGED
@@ -11,5 +11,5 @@ export { run } from "./dom/queue";
11
11
  export { createRenderer, createRendererWithOwner, dynamicTagAttrs, } from "./dom/renderer";
12
12
  export { init, nodeRef, register, registerBoundSignal, registerSubscriber, } from "./dom/resume";
13
13
  export { createScope } from "./dom/scope";
14
- export { childClosures, closure, dynamicClosure, dynamicSubscribers, effect, inChild, intersection, intersections, nextTagId, setTagVar, state, tagVarSignal, value, } from "./dom/signals";
14
+ export { childClosures, closure, dynamicClosure, dynamicSubscribers, effect, inChild, intersection, intersections, nextTagId, setTagVar, setTagVarChange, state, tagVarSignal, tagVarSignalChange, value, } from "./dom/signals";
15
15
  export { createTemplate } from "./dom/template";
package/dist/dom.js CHANGED
@@ -75,9 +75,11 @@ __export(dom_exports, {
75
75
  resetAbortSignal: () => resetAbortSignal,
76
76
  run: () => run,
77
77
  setTagVar: () => setTagVar,
78
+ setTagVarChange: () => setTagVarChange,
78
79
  state: () => state,
79
80
  styleAttr: () => styleAttr,
80
81
  tagVarSignal: () => tagVarSignal,
82
+ tagVarSignalChange: () => tagVarSignalChange,
81
83
  value: () => value
82
84
  });
83
85
  module.exports = __toCommonJS(dom_exports);
@@ -381,7 +383,11 @@ function dynamicSubscribers(valueAccessor) {
381
383
  function setTagVar(scope, childAccessor, tagVarSignal2) {
382
384
  scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
383
385
  }
384
- var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp), renderBodyClosures = (renderBody, childScope, op) => {
386
+ var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
387
+ function setTagVarChange(scope, changeHandler) {
388
+ scope["@" /* TagVariableChange */] = changeHandler;
389
+ }
390
+ var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2), renderBodyClosures = (renderBody, childScope, op) => {
385
391
  let signals = renderBody?.c;
386
392
  if (signals)
387
393
  for (let signal of signals)
package/dist/dom.mjs CHANGED
@@ -297,7 +297,11 @@ function dynamicSubscribers(valueAccessor) {
297
297
  function setTagVar(scope, childAccessor, tagVarSignal2) {
298
298
  scope[childAccessor]["/" /* TagVariable */] = (valueOrOp) => tagVarSignal2(scope, valueOrOp);
299
299
  }
300
- var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp), renderBodyClosures = (renderBody, childScope, op) => {
300
+ var tagVarSignal = (scope, valueOrOp) => scope["/" /* TagVariable */]?.(valueOrOp);
301
+ function setTagVarChange(scope, changeHandler) {
302
+ scope["@" /* TagVariableChange */] = changeHandler;
303
+ }
304
+ var tagVarSignalChange = (scope, value2) => scope["@" /* TagVariableChange */]?.(value2), renderBodyClosures = (renderBody, childScope, op) => {
301
305
  let signals = renderBody?.c;
302
306
  if (signals)
303
307
  for (let signal of signals)
@@ -1328,8 +1332,10 @@ export {
1328
1332
  resetAbortSignal,
1329
1333
  run,
1330
1334
  setTagVar,
1335
+ setTagVarChange,
1331
1336
  state,
1332
1337
  styleAttr,
1333
1338
  tagVarSignal,
1339
+ tagVarSignalChange,
1334
1340
  value
1335
1341
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marko/runtime-tags",
3
- "version": "0.1.24",
3
+ "version": "0.2.0",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",