@threadlabs/looma 0.13.2 → 0.13.3

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@threadlabs/looma",
3
- "version": "0.13.2",
3
+ "version": "0.13.3",
4
4
  "type": "module",
5
5
  "description": "Looma components as HTML, Vue, and plain DOM, with design tokens.",
6
6
  "license": "MIT",
@@ -3,17 +3,25 @@
3
3
  :scope {
4
4
  display: contents;
5
5
  --ui-affordance-scope-engaged: 0;
6
+ --ui-affordance-scope-guide: 1;
6
7
  }
7
8
 
8
9
  :scope[data-ui-affordance-scope-state~="engaged"] {
9
10
  --ui-affordance-scope-engaged: 1;
10
11
  }
11
12
 
13
+ /* Published to descendants: each guide multiplies its opacity by it, so none reaches them all. */
14
+ :scope[data-ui-affordance-scope-state~="guide=none"] {
15
+ --ui-affordance-scope-guide: 0;
16
+ }
17
+
12
18
  /* A component that sets its display still honours the hidden attribute on its root. */
13
19
  :scope[hidden] {
14
20
  display: none;
15
21
  }
16
22
  }
17
23
  @scope ([data-component~="ui-affordance-scope"]) to ([data-component]) {
18
- /* A component that sets its display still honours the hidden attribute on its root. */
24
+ /* Published to descendants: each guide multiplies its opacity by it, so none reaches them all. */
25
+
26
+ /* A component that sets its display still honours the hidden attribute on its root. */
19
27
  }
@@ -142,7 +142,7 @@
142
142
  height: var(--ui-affordance-guide-size);
143
143
  border-radius: var(--ui-radius-round);
144
144
  background: var(--ui-affordance-guide-color, var(--ui-border-strong));
145
- opacity: var(--ui-affordance-guide-opacity);
145
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
146
146
  transition: opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
147
147
  }
148
148
 
@@ -231,7 +231,7 @@
231
231
  inset: 50% auto auto 50%;
232
232
  border-radius: var(--ui-radius-round);
233
233
  background: var(--ui-affordance-guide-color, var(--ui-border-strong));
234
- opacity: var(--ui-affordance-guide-opacity);
234
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
235
235
  transform: translate(-50%, -50%);
236
236
  transition: opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
237
237
  pointer-events: none;
@@ -96,7 +96,7 @@
96
96
  block-size: var(--ui-affordance-guide-size);
97
97
  border-radius: var(--ui-radius-round);
98
98
  background: var(--ui-affordance-guide-color, var(--ui-border-strong));
99
- opacity: var(--ui-affordance-guide-opacity);
99
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
100
100
  transform: translate(-50%, -50%);
101
101
  transition: opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
102
102
  pointer-events: none;
@@ -99,7 +99,7 @@
99
99
  inset-inline-start: 3px;
100
100
  inline-size: 2px;
101
101
  background: color-mix(in srgb, var(--ui-affordance-guide-color, var(--ui-border-strong)) 45%, transparent);
102
- opacity: var(--ui-affordance-guide-opacity);
102
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
103
103
  transition:
104
104
  background-color var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease),
105
105
  opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
@@ -6,6 +6,7 @@ export interface UiAffordanceScopeElement extends HTMLSpanElement {
6
6
  removeEventListener<K extends keyof UiAffordanceScopeEventMap>(type: K, listener: (this: UiAffordanceScopeElement, event: UiAffordanceScopeEventMap[K]) => unknown, options?: boolean | EventListenerOptions): void;
7
7
  }
8
8
  export interface UiAffordanceScopeProps {
9
+ guide?: "dot" | "none" | null;
9
10
  nearRadius?: number | null;
10
11
  attributes?: Readonly<Record<string, string | number | boolean | null | undefined>>;
11
12
  children?: readonly (string | Node)[];
@@ -3,7 +3,7 @@ import { manageComponentLifecycle } from "@nextwebwg/html-next/runtime";
3
3
  import * as controller from "../components/ui-affordance-scope/ui-affordance-scope.js";
4
4
  import "../styles/ui-affordance-scope.css";
5
5
 
6
- const definition = {...{"contract":{"tag":"ui-affordance-scope","props":{"nearRadius":{"type":"number","required":false,"target":{"attribute":"nearradius"},"default":16}}},"template":{"kind":"element","name":"span","attributes":[],"children":[{"kind":"slot"}]},"declarations":[{"kind":"state","name":"engaged","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}}],"root":{"kind":"native","element":"span","choices":["span"]}},source:{file:import.meta.url},css:""};
6
+ const definition = {...{"contract":{"tag":"ui-affordance-scope","props":{"guide":{"type":{"enum":["dot","none"]},"required":false,"target":{"attribute":"guide"},"default":"dot"},"nearRadius":{"type":"number","required":false,"target":{"attribute":"nearradius"},"default":16}}},"template":{"kind":"element","name":"span","attributes":[],"children":[{"kind":"slot"}]},"declarations":[{"kind":"state","name":"engaged","expression":{"source":"false","ast":{"kind":"literal","value":false},"dependencies":[]}}],"root":{"kind":"native","element":"span","choices":["span"]}},source:{file:import.meta.url},css:""};
7
7
 
8
8
  export function createUiAffordanceScope(options = {}) {
9
9
  const { attributes = {}, children = [], slots = {}, ...componentProps } = options;
@@ -1,4 +1,5 @@
1
1
  type __VLS_Props = {
2
+ guide?: 'dot' | 'none';
2
3
  nearRadius?: number;
3
4
  };
4
5
  declare var __VLS_1: {};
@@ -6,6 +7,7 @@ type __VLS_Slots = {} & {
6
7
  default?: (props: typeof __VLS_1) => any;
7
8
  };
8
9
  declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {
10
+ guide: "dot" | "none";
9
11
  nearRadius: number;
10
12
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
13
  declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
@@ -8,9 +8,11 @@ defineOptions({ inheritAttrs: false })
8
8
 
9
9
  const props = withDefaults(
10
10
  defineProps<{
11
+ guide?: 'dot' | 'none'
11
12
  nearRadius?: number
12
13
  }>(),
13
14
  {
15
+ guide: 'dot',
14
16
  nearRadius: 16,
15
17
  },
16
18
  )
@@ -22,6 +24,7 @@ const engaged = ref(false)
22
24
  const hostState = computed(() =>
23
25
  [
24
26
  engaged.value && 'engaged',
27
+ props.guide && `guide guide=${props.guide}`,
25
28
  ].filter(Boolean).join(' ')
26
29
  )
27
30
 
@@ -48,12 +51,18 @@ useComponentHost(controllerModule.default, {
48
51
  [data-component~="ui-affordance-scope"] {
49
52
  display: contents;
50
53
  --ui-affordance-scope-engaged: 0;
54
+ --ui-affordance-scope-guide: 1;
51
55
  }
52
56
 
53
57
  [data-component~="ui-affordance-scope"][data-ui-affordance-scope-state~="engaged"] {
54
58
  --ui-affordance-scope-engaged: 1;
55
59
  }
56
60
 
61
+ /* Published to descendants: each guide multiplies its opacity by it, so none reaches them all. */
62
+ [data-component~="ui-affordance-scope"][data-ui-affordance-scope-state~="guide=none"] {
63
+ --ui-affordance-scope-guide: 0;
64
+ }
65
+
57
66
  /* A component that sets its display still honours the hidden attribute on its root. */
58
67
  [data-component~="ui-affordance-scope"][hidden] {
59
68
  display: none;
@@ -408,7 +408,7 @@ useComponentHost(controllerModule.default, {
408
408
  height: var(--ui-affordance-guide-size);
409
409
  border-radius: var(--ui-radius-round);
410
410
  background: var(--ui-affordance-guide-color, var(--ui-border-strong));
411
- opacity: var(--ui-affordance-guide-opacity);
411
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
412
412
  transition: opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
413
413
  }
414
414
 
@@ -497,7 +497,7 @@ useComponentHost(controllerModule.default, {
497
497
  inset: 50% auto auto 50%;
498
498
  border-radius: var(--ui-radius-round);
499
499
  background: var(--ui-affordance-guide-color, var(--ui-border-strong));
500
- opacity: var(--ui-affordance-guide-opacity);
500
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
501
501
  transform: translate(-50%, -50%);
502
502
  transition: opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
503
503
  pointer-events: none;
@@ -156,7 +156,7 @@ useComponentHost(controllerModule.default, {
156
156
  block-size: var(--ui-affordance-guide-size);
157
157
  border-radius: var(--ui-radius-round);
158
158
  background: var(--ui-affordance-guide-color, var(--ui-border-strong));
159
- opacity: var(--ui-affordance-guide-opacity);
159
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
160
160
  transform: translate(-50%, -50%);
161
161
  transition: opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
162
162
  pointer-events: none;
package/vue/UiSidebar.vue CHANGED
@@ -222,7 +222,7 @@ useComponentHost(controllerModule.default, {
222
222
  var(--ui-affordance-guide-color, var(--ui-border-strong)) 45%,
223
223
  transparent
224
224
  );
225
- opacity: var(--ui-affordance-guide-opacity);
225
+ opacity: calc(var(--ui-affordance-guide-opacity) * var(--ui-affordance-scope-guide, 1));
226
226
  transition:
227
227
  background-color var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease),
228
228
  opacity var(--ui-affordance-motion, var(--ui-motion-fast)) var(--ui-motion-ease);
@@ -9,13 +9,16 @@ var _hoisted_1 = ["data-ui-affordance-scope-state"];
9
9
  var UiAffordanceScope_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
10
10
  inheritAttrs: false,
11
11
  __name: "UiAffordanceScope",
12
- props: { nearRadius: { default: 16 } },
12
+ props: {
13
+ guide: { default: "dot" },
14
+ nearRadius: { default: 16 }
15
+ },
13
16
  setup(__props) {
14
17
  const props = __props;
15
18
  const root = ref(null);
16
19
  const engaged = ref(false);
17
20
  /** The values the styles' :host-state() rules test. */
18
- const hostState = computed(() => [engaged.value && "engaged"].filter(Boolean).join(" "));
21
+ const hostState = computed(() => [engaged.value && "engaged", props.guide && `guide guide=${props.guide}`].filter(Boolean).join(" "));
19
22
  const dispatch = createDispatch(root);
20
23
  useComponentHost(controllerModule.default, {
21
24
  root,
@@ -31,6 +34,6 @@ var UiAffordanceScope_default = /*#__PURE__*/ _plugin_vue_export_helper_default(
31
34
  }), [renderSlot(_ctx.$slots, "default", {}, void 0, true)], 16, _hoisted_1);
32
35
  };
33
36
  }
34
- }), [["__scopeId", "data-v-0288ef7b"]]);
37
+ }), [["__scopeId", "data-v-0ec8d3e6"]]);
35
38
  //#endregion
36
39
  export { UiAffordanceScope_default as t };
@@ -181,6 +181,6 @@ var UiEditorTableOverlay_default = /*#__PURE__*/ _plugin_vue_export_helper_defau
181
181
  ], 16, _hoisted_1);
182
182
  };
183
183
  }
184
- }), [["__scopeId", "data-v-af4935bb"]]);
184
+ }), [["__scopeId", "data-v-0de9cbcc"]]);
185
185
  //#endregion
186
186
  export { UiEditorTableOverlay_default as t };
@@ -59,6 +59,6 @@ var UiIconButton_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @_
59
59
  }), [renderSlot(_ctx.$slots, "default")], 16, _hoisted_1);
60
60
  };
61
61
  }
62
- }), [["__scopeId", "data-v-027d9fcb"]]);
62
+ }), [["__scopeId", "data-v-a20a82b7"]]);
63
63
  //#endregion
64
64
  export { UiIconButton_default as t };
@@ -85,6 +85,6 @@ var UiSidebar_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
85
85
  }, null, -1)])], 8, _hoisted_3)], 16, _hoisted_1);
86
86
  };
87
87
  }
88
- }), [["__scopeId", "data-v-eff27033"]]);
88
+ }), [["__scopeId", "data-v-6929aec9"]]);
89
89
  //#endregion
90
90
  export { UiSidebar_default as t };